(url: string)
| 46 | panelManager.setExtensionPath(context.extensionPath); |
| 47 | |
| 48 | const openInPanel = async (url: string) => { |
| 49 | log.info(`[open] received url: ${url}`); |
| 50 | |
| 51 | // Each panel gets its own cookie proxy so multiple agents |
| 52 | // can point to different upstream servers without conflicts. |
| 53 | const proxy = await createCookieProxy({ |
| 54 | loadCookies: () => { |
| 55 | const cookies = context.globalState.get<string>(COOKIE_KEY) ?? ""; |
| 56 | log.info(`[load] ${cookies.length} chars: ${cookies.slice(0, 120)}…`); |
| 57 | return cookies; |
| 58 | }, |
| 59 | onSaveCookies: (cookies) => { |
| 60 | log.info(`[save] ${cookies.length} chars: ${cookies.slice(0, 120)}…`); |
| 61 | context.globalState.update(COOKIE_KEY, cookies); |
| 62 | }, |
| 63 | onClose: () => { |
| 64 | log.info("[close] received close signal from plannotator"); |
| 65 | }, |
| 66 | }); |
| 67 | |
| 68 | const panel = await panelManager.open(proxy.rewriteUrl(url)); |
| 69 | setActiveProxyPort(proxy.port); |
| 70 | |
| 71 | // Auto-close this specific panel when plannotator signals completion |
| 72 | proxy.events.on("close", () => panel.dispose()); |
| 73 | |
| 74 | // Clean up proxy server and editor annotations state when the panel is closed |
| 75 | panel.onDidDispose(() => { |
| 76 | proxy.server.close(); |
| 77 | setActiveProxyPort(null); |
| 78 | }); |
| 79 | |
| 80 | vscode.window.showInformationMessage("Plannotator panel opened"); |
| 81 | }; |
| 82 | |
| 83 | // Start local IPC server to receive URLs from the router script. |
| 84 | // Reuse the last port so restored terminals still have a valid PLANNOTATOR_VSCODE_PORT. |
no test coverage detected