@senpiper/sp-agent 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +36 -24
- package/README.md +13 -13
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -4
- package/dist/cli.js.map +1 -1
- package/dist/distribution.d.ts +2 -2
- package/dist/distribution.d.ts.map +1 -1
- package/dist/distribution.js +1 -1
- package/dist/distribution.js.map +1 -1
- package/dist/extension-identity.generated.d.ts +3 -3
- package/dist/extension-identity.generated.d.ts.map +1 -1
- package/dist/extension-identity.generated.js +3 -3
- package/dist/extension-identity.generated.js.map +1 -1
- package/dist/install-sp.sh +9 -9
- package/dist/release-manager.d.ts.map +1 -1
- package/dist/release-manager.js +2 -2
- package/dist/release-manager.js.map +1 -1
- package/dist/runtime-cli.d.ts.map +1 -1
- package/dist/runtime-cli.js +4 -4
- package/dist/runtime-cli.js.map +1 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.d.ts.map +1 -1
- package/dist/sdk.js +5 -5
- package/dist/sdk.js.map +1 -1
- package/dist/session-manager.d.ts +1 -1
- package/dist/session-manager.d.ts.map +1 -1
- package/dist/session-manager.js +15 -15
- package/dist/session-manager.js.map +1 -1
- package/dist/sp-web.d.ts.map +1 -1
- package/dist/sp-web.js +2 -2
- package/dist/sp-web.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/node_modules/@senpiper/pi-coding-agent/dist/bundle/chunks/{chunk-LUSUF4ZH.js → chunk-VVKE4QZJ.js} +1 -1
- package/node_modules/@senpiper/pi-coding-agent/dist/bundle/cli.js +1 -1
- package/node_modules/@senpiper/pi-coding-agent/dist/bundle/index.js +1 -1
- package/node_modules/@senpiper/pi-coding-agent/dist/bundle/rpc-entry.js +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/kimi-coding.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@senpiper/pi-coding-agent/package.json +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/CHANGELOG.md +17 -0
- package/node_modules/@senpiper/sp-agent-extensions/CONCURRENT_SESSIONS.md +9 -9
- package/node_modules/@senpiper/sp-agent-extensions/TERMINAL_WEB_BRIDGE.md +28 -9
- package/node_modules/@senpiper/sp-agent-extensions/dist/cli-commands.d.ts.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/cli-commands.js +5 -5
- package/node_modules/@senpiper/sp-agent-extensions/dist/cli-commands.js.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/gateway.d.ts +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/gateway.d.ts.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/gateway.js +18 -18
- package/node_modules/@senpiper/sp-agent-extensions/dist/gateway.js.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/index.d.ts +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/index.d.ts.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/index.js +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/index.js.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/login-command.d.ts.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/login-command.js +9 -9
- package/node_modules/@senpiper/sp-agent-extensions/dist/login-command.js.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/sp-web-launcher.d.ts +27 -0
- package/node_modules/@senpiper/sp-agent-extensions/dist/sp-web-launcher.d.ts.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/sp-web-launcher.js +270 -28
- package/node_modules/@senpiper/sp-agent-extensions/dist/sp-web-launcher.js.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/startup-header.d.ts.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/startup-header.js +12 -19
- package/node_modules/@senpiper/sp-agent-extensions/dist/startup-header.js.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/terminal-web-bridge.d.ts +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/terminal-web-bridge.d.ts.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/terminal-web-bridge.js +11 -9
- package/node_modules/@senpiper/sp-agent-extensions/dist/terminal-web-bridge.js.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/web-command.d.ts.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/dist/web-command.js +36 -10
- package/node_modules/@senpiper/sp-agent-extensions/dist/web-command.js.map +1 -1
- package/node_modules/@senpiper/sp-agent-extensions/package.json +3 -2
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-command.js","sourceRoot":"","sources":["../src/web-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,MAAM,UAAU,WAAW,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG,EAAU;IACzE,MAAM,GAAG,GAAG,GAAG,CAAC,gBAAgB,IAAI,GAAG,CAAC,mBAAmB,CAAC;IAC5D,MAAM,IAAI,GAAY,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,EAAE,CAAC;QAC3E,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACtE,CAAC;IACD,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;QAC5B,IAAI;QACJ,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACR,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE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,IAAI,KAAK,CAAC;4BAAE,OAAO,EAAE,CAAC;;4BACrB,MAAM,CAAC,IAAI,KAAK,CAAC,mCAAmC,IAAI,GAAG,CAAC,CAAC,CAAC;oBAAA,CACnE,CAAC,CAAC;gBAAA,CACH,CAAC,CAAC;gBACH,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;YAC7C,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO,CAAC,EAAE,CAAC,MAAM,CAChB,0BAA0B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAClF,SAAS,CACT,CAAC;YACH,CAAC;QAAA,CACD;KACD,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { spawn } from \"node:child_process\";\nimport { mkdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { setTimeout } from \"node:timers/promises\";\nimport { parseArgs } from \"node:util\";\nimport type { ExtensionAPI } from \"@senpiper/pi-coding-agent\";\nimport { getSpAgentDir } from \"./gateway.ts\";\nimport { ensureSpWebSidecar } from \"./sp-web-launcher.ts\";\nimport type { TerminalWebBridgeOptions } from \"./terminal-web-bridge.ts\";\n\nexport function getSpWebUrl(env: NodeJS.ProcessEnv = process.env): string {\n\tconst raw = env.SP_WEB_ARGS_JSON ?? env.SP_PI_WEB_ARGS_JSON;\n\tconst args: unknown = raw ? JSON.parse(raw) : [];\n\tif (!Array.isArray(args) || !args.every((arg) => typeof arg === \"string\")) {\n\t\tthrow new Error(\"SP_WEB_ARGS_JSON must be a JSON array of strings.\");\n\t}\n\tconst { values } = parseArgs({\n\t\targs,\n\t\tstrict: false,\n\t\toptions: {\n\t\t\tport: { type: \"string\", short: \"p\" },\n\t\t\thostname: { type: \"string\", short: \"H\" },\n\t\t},\n\t});\n\tconst port = String(values.port ?? env.SP_WEB_PORT ?? env.PORT ?? \"30141\");\n\tif (!/^\\d+$/.test(port) || Number(port) < 1 || Number(port) > 65535) {\n\t\tthrow new Error(\"Set SP_WEB_PORT to a fixed port between 1 and 65535 to open SP Web.\");\n\t}\n\tlet hostname = String(values.hostname ?? env.SP_WEB_HOSTNAME ?? env.PI_WEB_HOSTNAME ?? \"127.0.0.1\");\n\tif ([\"0.0.0.0\", \"localhost\"].includes(hostname)) hostname = \"127.0.0.1\";\n\tif ([\"::\", \"[::]\"].includes(hostname)) hostname = \"::1\";\n\tif (hostname.includes(\":\") && !hostname.startsWith(\"[\")) hostname = `[${hostname}]`;\n\tconst url = new URL(`http://${hostname}:${port}`);\n\tif (url.username || url.password || url.pathname !== \"/\" || url.search || url.hash) {\n\t\tthrow new Error(\"SP_WEB_HOSTNAME must be a hostname or IP address.\");\n\t}\n\treturn url.origin;\n}\n\nexport function registerWebCommand(pi: ExtensionAPI, options: TerminalWebBridgeOptions = {}) {\n\tpi.registerCommand(\"web\", {\n\t\tdescription: \"Open SP Web in your browser\",\n\t\thandler: async (_args, context) => {\n\t\t\ttry {\n\t\t\t\tconst url = getSpWebUrl(options.launcherOptions?.env);\n\t\t\t\tconst discovery = join(options.agentDir ?? getSpAgentDir(), \"web-bridge\", \"discovery\");\n\t\t\t\tmkdirSync(discovery, { recursive: true, mode: 0o700 });\n\t\t\t\tconst result = ensureSpWebSidecar(discovery, options.launcherOptions);\n\t\t\t\tif (result.status === \"disabled\") throw new Error(\"SP Web is disabled by SP_WEB_DISABLE.\");\n\t\t\t\tif (result.status === \"failed\") throw new Error(result.error);\n\t\t\t\tlet ready = false;\n\t\t\t\tfor (let attempt = 0; attempt < 20; attempt++) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait fetch(url, { method: \"HEAD\", signal: AbortSignal.timeout(1000) });\n\t\t\t\t\t\tready = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tawait setTimeout(500);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!ready) throw new Error(`SP Web is not responding at ${url}. Try /web again after it starts.`);\n\t\t\t\tcontext.ui.notify(`Opening SP Web: ${url}`, \"info\");\n\t\t\t\tconst command =\n\t\t\t\t\tprocess.platform === \"darwin\" ? \"open\" : process.platform === \"win32\" ? \"rundll32\" : \"xdg-open\";\n\t\t\t\tconst args = process.platform === \"win32\" ? [\"url.dll,FileProtocolHandler\", url] : [url];\n\t\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\t\tconst child = spawn(command, args, { stdio: \"ignore\", shell: false });\n\t\t\t\t\t// Some desktop openers remain alive as long as the browser window.\n\t\t\t\t\tconst timer = globalThis.setTimeout(() => {\n\t\t\t\t\t\tchild.unref();\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t}, 5000);\n\t\t\t\t\tchild.once(\"error\", (error) => {\n\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t});\n\t\t\t\t\tchild.once(\"exit\", (code) => {\n\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t\tif (code === 0) resolve();\n\t\t\t\t\t\telse reject(new Error(`Browser opener exited with code ${code}.`));\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tcontext.ui.notify(`SP Web: ${url}`, \"info\");\n\t\t\t} catch (error) {\n\t\t\t\tcontext.ui.notify(\n\t\t\t\t\t`Could not open SP Web: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t\t\"warning\",\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
|
|
1
|
+
{"version":3,"file":"web-command.js","sourceRoot":"","sources":["../src/web-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CA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C,EAAE,CAAC,MAAM,CAChB,aAAa,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,mCAAmC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAC1I,SAAS,CACT,CAAC;YACH,CAAC;QAAA,CACD;KACD,CAAC,CAAC;AAAA,CACH","sourcesContent":["import { spawn } from \"node:child_process\";\nimport { mkdirSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { setTimeout } from \"node:timers/promises\";\nimport { parseArgs } from \"node:util\";\nimport type { ExtensionAPI } from \"@senpiper/pi-coding-agent\";\nimport { getSpAgentDir } from \"./gateway.ts\";\nimport { ensureSpWebSidecar, stopSpWebSidecar } from \"./sp-web-launcher.ts\";\nimport type { TerminalWebBridgeOptions } from \"./terminal-web-bridge.ts\";\n\nexport function getSpWebUrl(env: NodeJS.ProcessEnv = process.env): string {\n\tconst raw = env.SP_WEB_ARGS_JSON ?? env.SP_PI_WEB_ARGS_JSON;\n\tconst args: unknown = raw ? JSON.parse(raw) : [];\n\tif (!Array.isArray(args) || !args.every((arg) => typeof arg === \"string\")) {\n\t\tthrow new Error(\"SP_WEB_ARGS_JSON must be a JSON array of strings.\");\n\t}\n\tconst { values } = parseArgs({\n\t\targs,\n\t\tstrict: false,\n\t\toptions: {\n\t\t\tport: { type: \"string\", short: \"p\" },\n\t\t\thostname: { type: \"string\", short: \"H\" },\n\t\t},\n\t});\n\tconst port = String(values.port ?? env.SP_WEB_PORT ?? env.PORT ?? \"30141\");\n\tif (!/^\\d+$/.test(port) || Number(port) < 1 || Number(port) > 65535) {\n\t\tthrow new Error(\"Set SP_WEB_PORT to a fixed port between 1 and 65535 to open Senpiper Workbench.\");\n\t}\n\tlet hostname = String(values.hostname ?? env.SP_WEB_HOSTNAME ?? env.PI_WEB_HOSTNAME ?? \"127.0.0.1\");\n\tif ([\"0.0.0.0\", \"localhost\"].includes(hostname)) hostname = \"127.0.0.1\";\n\tif ([\"::\", \"[::]\"].includes(hostname)) hostname = \"::1\";\n\tif (hostname.includes(\":\") && !hostname.startsWith(\"[\")) hostname = `[${hostname}]`;\n\tconst url = new URL(`http://${hostname}:${port}`);\n\tif (url.username || url.password || url.pathname !== \"/\" || url.search || url.hash) {\n\t\tthrow new Error(\"SP_WEB_HOSTNAME must be a hostname or IP address.\");\n\t}\n\treturn url.origin;\n}\n\nexport function registerWebCommand(pi: ExtensionAPI, options: TerminalWebBridgeOptions = {}) {\n\tpi.registerCommand(\"web\", {\n\t\tdescription: \"Open the Senpiper Workbench web UI, or use /web off to stop it\",\n\t\tgetArgumentCompletions: (prefix) =>\n\t\t\t[\n\t\t\t\t{ value: \"on\", label: \"on\", description: \"Start the web UI and open it in your browser\" },\n\t\t\t\t{ value: \"off\", label: \"off\", description: \"Stop the managed web UI without stopping terminal sessions\" },\n\t\t\t].filter((item) => item.value.startsWith(prefix) && item.value !== prefix),\n\t\thandler: async (args, context) => {\n\t\t\tconst action = args.trim();\n\t\t\tif (action !== \"\" && action !== \"on\" && action !== \"off\") {\n\t\t\t\tcontext.ui.notify(\"Usage: /web [on|off]. /web opens the web UI; /web off stops it.\", \"warning\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst discovery = join(options.agentDir ?? getSpAgentDir(), \"web-bridge\", \"discovery\");\n\t\t\t\tif (action === \"off\") {\n\t\t\t\t\tconst result = await stopSpWebSidecar(discovery, options.launcherOptions);\n\t\t\t\t\tif (result.status === \"failed\")\n\t\t\t\t\t\tthrow new Error(result.error ?? \"The managed web server could not be stopped.\");\n\t\t\t\t\tif (result.status === \"pending\") {\n\t\t\t\t\t\tcontext.ui.notify(\n\t\t\t\t\t\t\t\"The web UI is starting or stopping. Wait a moment and run /web off again.\",\n\t\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontext.ui.notify(\n\t\t\t\t\t\t\tresult.status === \"stopped\"\n\t\t\t\t\t\t\t\t? \"Senpiper Workbench web UI stopped. Terminal sessions keep running. Use /web to start it again.\"\n\t\t\t\t\t\t\t\t: \"No managed Senpiper Workbench web UI is running. Manually started servers must be stopped in their own terminal.\",\n\t\t\t\t\t\t\t\"info\",\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst url = getSpWebUrl(options.launcherOptions?.env);\n\t\t\t\tmkdirSync(discovery, { recursive: true, mode: 0o700 });\n\t\t\t\tconst result = ensureSpWebSidecar(discovery, options.launcherOptions);\n\t\t\t\tif (result.status === \"disabled\") throw new Error(\"The web UI is disabled by SP_WEB_DISABLE.\");\n\t\t\t\tif (result.status === \"failed\") throw new Error(result.error);\n\t\t\t\tif (result.status === \"pending\") {\n\t\t\t\t\tthrow new Error(\"The web UI is starting or stopping. Wait a moment and run /web again.\");\n\t\t\t\t}\n\t\t\t\tlet ready = false;\n\t\t\t\tfor (let attempt = 0; attempt < 20; attempt++) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait fetch(url, { method: \"HEAD\", signal: AbortSignal.timeout(1000) });\n\t\t\t\t\t\tready = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\tawait setTimeout(500);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!ready)\n\t\t\t\t\tthrow new Error(`Senpiper Workbench is not responding at ${url}. Try /web again after it starts.`);\n\t\t\t\tcontext.ui.notify(`Opening Senpiper Workbench: ${url}`, \"info\");\n\t\t\t\tconst command =\n\t\t\t\t\tprocess.platform === \"darwin\" ? \"open\" : process.platform === \"win32\" ? \"rundll32\" : \"xdg-open\";\n\t\t\t\tconst args = process.platform === \"win32\" ? [\"url.dll,FileProtocolHandler\", url] : [url];\n\t\t\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\t\t\tconst child = spawn(command, args, { stdio: \"ignore\", shell: false });\n\t\t\t\t\t// Some desktop openers remain alive as long as the browser window.\n\t\t\t\t\tconst timer = globalThis.setTimeout(() => {\n\t\t\t\t\t\tchild.unref();\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t}, 5000);\n\t\t\t\t\tchild.once(\"error\", (error) => {\n\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t});\n\t\t\t\t\tchild.once(\"exit\", (code) => {\n\t\t\t\t\t\tclearTimeout(timer);\n\t\t\t\t\t\tif (code === 0) resolve();\n\t\t\t\t\t\telse reject(new Error(`Browser opener exited with code ${code}.`));\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t\tcontext.ui.notify(`Senpiper Workbench: ${url}`, \"info\");\n\t\t\t} catch (error) {\n\t\t\t\tcontext.ui.notify(\n\t\t\t\t\t`Could not ${action === \"off\" ? \"stop\" : \"open\"} the Senpiper Workbench web UI: ${error instanceof Error ? error.message : String(error)}`,\n\t\t\t\t\t\"warning\",\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t});\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@senpiper/sp-agent-extensions",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Private Senpiper runtime extensions
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"description": "Private Senpiper Workbench runtime extensions",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./dist/index.js",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
|
+
"CHANGELOG.md",
|
|
17
18
|
"CONCURRENT_SESSIONS.md",
|
|
18
19
|
"TERMINAL_WEB_BRIDGE.md"
|
|
19
20
|
],
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@senpiper/sp-agent",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.11",
|
|
4
|
+
"description": "Senpiper Workbench: Pi-based coding agent and web interface",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"piConfig": {
|
|
7
7
|
"configDir": ".sp",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
30
|
"dist",
|
|
31
|
+
"CHANGELOG.md",
|
|
31
32
|
"README.md",
|
|
32
33
|
"INSTALL.md"
|
|
33
34
|
],
|
|
@@ -37,15 +38,15 @@
|
|
|
37
38
|
},
|
|
38
39
|
"scripts": {
|
|
39
40
|
"clean": "shx rm -rf dist",
|
|
40
|
-
"prepublishOnly": "node -e \"console.error('Use npm run publish:sp:npm from the repository root with a validated
|
|
41
|
+
"prepublishOnly": "node -e \"console.error('Use npm run publish:sp:npm from the repository root with a validated web tarball.'); process.exit(1)\"",
|
|
41
42
|
"generate:extension-identity": "node ../../scripts/generate-sp-extension-identity.mjs",
|
|
42
43
|
"build": "npm run generate:extension-identity && tsgo -p tsconfig.build.json && shx chmod +x dist/cli.js dist/rpc-entry.js dist/sp-web.js && node ../../scripts/render-sp-installer.mjs dist/install-sp.sh",
|
|
43
|
-
"test": "vitest --run"
|
|
44
|
+
"test": "vitest --run --config test/concurrent-vitest.config.ts"
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"@senpiper/pi-coding-agent": "0.84.4",
|
|
47
|
-
"@senpiper/sp-agent-extensions": "0.1.
|
|
48
|
-
"@senpiper/sp-web": "0.1.
|
|
48
|
+
"@senpiper/sp-agent-extensions": "0.1.5",
|
|
49
|
+
"@senpiper/sp-web": "0.1.4"
|
|
49
50
|
},
|
|
50
51
|
"bundleDependencies": [
|
|
51
52
|
"@senpiper/pi-coding-agent",
|