@code-yeongyu/senpi 2026.9.28-2 → 2026.9.28-3
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/CHANGELOG.md +14 -0
- package/dist/bundle/chunks/{app-server-command-H6LFICZ2.js → app-server-command-JTHJ2U7J.js} +1 -1
- package/dist/bundle/chunks/{chunk-LSW7QSLV.js → chunk-6XBT6OGS.js} +36 -34
- package/dist/bundle/chunks/chunk-OP3QMR6B.js +8 -0
- package/dist/bundle/chunks/{cli-main-GYRTYPMG.js → cli-main-Z2Y55XHU.js} +1 -1
- package/dist/bundle/chunks/{interactive-mode-LX665HTP.js → interactive-mode-A3EYB6DW.js} +1 -1
- package/dist/bundle/chunks/{multi-session-host-MFTUM6XQ.js → multi-session-host-HM2UJ4ER.js} +2 -2
- package/dist/bundle/chunks/{package-manager-cli-6IAE5WG3.js → package-manager-cli-T7Q4AZKX.js} +1 -1
- package/dist/bundle/chunks/{rpc-mode-XN3HNZMH.js → rpc-mode-ROB6IG6J.js} +1 -1
- package/dist/bundle/chunks/session-worker.js +140 -138
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/webview/bun-chrome.d.ts +15 -0
- package/dist/core/webview/bun-chrome.d.ts.map +1 -0
- package/dist/core/webview/bun-chrome.js +91 -0
- package/dist/core/webview/bun-chrome.js.map +1 -0
- package/dist/core/webview/native-webview.d.ts +16 -0
- package/dist/core/webview/native-webview.d.ts.map +1 -0
- package/dist/core/webview/native-webview.js +15 -0
- package/dist/core/webview/native-webview.js.map +1 -0
- package/dist/core/webview/webview-broker.d.ts +27 -0
- package/dist/core/webview/webview-broker.d.ts.map +1 -0
- package/dist/core/webview/webview-broker.js +120 -0
- package/dist/core/webview/webview-broker.js.map +1 -0
- package/dist/core/webview/webview-client.d.ts +19 -0
- package/dist/core/webview/webview-client.d.ts.map +1 -0
- package/dist/core/webview/webview-client.js +135 -0
- package/dist/core/webview/webview-client.js.map +1 -0
- package/dist/core/webview/webview-service.d.ts +26 -0
- package/dist/core/webview/webview-service.d.ts.map +1 -0
- package/dist/core/webview/webview-service.js +102 -0
- package/dist/core/webview/webview-service.js.map +1 -0
- package/dist/core/webview/webview-wire.d.ts +76 -0
- package/dist/core/webview/webview-wire.d.ts.map +1 -0
- package/dist/core/webview/webview-wire.js +57 -0
- package/dist/core/webview/webview-wire.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/modes/rpc/session-worker-client.d.ts +2 -0
- package/dist/modes/rpc/session-worker-client.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-client.js +7 -1
- package/dist/modes/rpc/session-worker-client.js.map +1 -1
- package/dist/modes/rpc/session-worker.js +3 -1
- package/dist/modes/rpc/session-worker.js.map +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +14 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridge/protocol.ts +14 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/inline-worker.ts +2 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/local-module-loader.ts +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/webview-host.ts +59 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-core.js +17 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-host.ts +2 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-runtime.js +2 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-slot.ts +14 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-webview-client.js +79 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-webview.js +204 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-queue.ts +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/skill/bun-1-4/references/runtime-apis.md +1 -0
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +7 -7
- package/dist/bundle/chunks/chunk-KOPTADA3.js +0 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webview-client.js","sourceRoot":"","sources":["../../../src/core/webview/webview-client.ts"],"names":[],"mappings":"AAEA,OAAO,EAEN,kBAAkB,EAIlB,SAAS,GACT,MAAM,mBAAmB,CAAC;AAU3B,SAAS,OAAO,CAAC,IAAmB;IACnC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;AACpE,CAAC;AAED,SAAS,YAAY,CAAC,IAAmB;IACxC,IAAI,CAAC;QACJ,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACR,+DAA+D;IAChE,CAAC;AACF,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAGvB,KAAK,CAAc;IACnB,KAAK,CAAoB;IACzB,MAAM,GAAG,IAAI,GAAG,EAAyB,CAAC;IACnD,SAAS,GAAG,KAAK,CAAC;IAElB,YAAY,EAAU,EAAE,KAAa,E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,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACvE,CAAC;IACF,CAAC;IAED,KAAK,CAAC,MAAc,EAAE,KAAmB;QACxC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,OAAwB;QAC7B,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,IAAI,CAAC;YACJ,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE;gBAAE,OAAO;YACpD,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC/F,CAAC;IACF,CAAC;CACD","sourcesContent":["import type { MessagePort } from \"node:worker_threads\";\nimport type { NativeWebView } from \"./native-webview.ts\";\nimport {\n\ttype ClientToService,\n\tparseClientMessage,\n\ttype ServiceToClient,\n\ttype WebViewEvent,\n\ttype WebViewState,\n\twireError,\n} from \"./webview-wire.ts\";\n\nexport interface WebViewClientHost {\n\tcreateView(\n\t\toptions: Readonly<Record<string, unknown>>,\n\t\tonConsole: ((...args: unknown[]) => void) | undefined,\n\t): Promise<NativeWebView>;\n\tonClientClosed(client: WebViewServiceClient): void;\n}\n\nfunction stateOf(view: NativeWebView): WebViewState {\n\treturn { url: view.url, title: view.title, loading: view.loading };\n}\n\nfunction closeQuietly(view: NativeWebView): void {\n\ttry {\n\t\tview.close();\n\t} catch {\n\t\t// A view whose browser already died has nothing left to close.\n\t}\n}\n\n/**\n * One kernel's capability: the views it created and the only port that can reach them. Nothing is\n * addressable across clients, so one session's cell cannot see, drive, or close another's views.\n */\nexport class WebViewServiceClient {\n\treadonly id: string;\n\treadonly owner: object;\n\treadonly #port: MessagePort;\n\treadonly #host: WebViewClientHost;\n\treadonly #views = new Map<string, NativeWebView>();\n\t#released = false;\n\n\tconstructor(id: string, owner: object, port: MessagePort, host: WebViewClientHost) {\n\t\tthis.id = id;\n\t\tthis.owner = owner;\n\t\tthis.#port = port;\n\t\tthis.#host = host;\n\t\tport.on(\"message\", (message: unknown) => void this.#handle(parseClientMessage(message)));\n\t\tport.on(\"close\", () => this.#host.onClientClosed(this));\n\t\tport.unref();\n\t}\n\n\tget viewCount(): number {\n\t\treturn this.#views.size;\n\t}\n\n\trelease(): void {\n\t\tif (this.#released) return;\n\t\tthis.#released = true;\n\t\tfor (const view of this.#views.values()) closeQuietly(view);\n\t\tthis.#views.clear();\n\t\tthis.#port.close();\n\t}\n\n\tasync #handle(message: ClientToService | undefined): Promise<void> {\n\t\tif (!message || this.#released) return;\n\t\tswitch (message.kind) {\n\t\t\tcase \"create\":\n\t\t\t\tawait this.#reply(message.id, async () => {\n\t\t\t\t\tconst view = await this.#create(message.viewId, message.options, message.captureConsole);\n\t\t\t\t\treturn { value: undefined, view };\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\tcase \"call\":\n\t\t\t\tawait this.#reply(message.id, async () => {\n\t\t\t\t\tconst view = this.#view(message.viewId);\n\t\t\t\t\tconst method: unknown = Reflect.get(view, message.method);\n\t\t\t\t\tif (typeof method !== \"function\") throw new TypeError(`WebView.${message.method} is not available`);\n\t\t\t\t\tconst value: unknown = await Reflect.apply(method, view, [...message.args]);\n\t\t\t\t\treturn { value, view };\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\tcase \"close\": {\n\t\t\t\tconst view = this.#views.get(message.viewId);\n\t\t\t\tthis.#views.delete(message.viewId);\n\t\t\t\tif (view) closeQuietly(view);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase \"listen\": {\n\t\t\t\tconst view = this.#views.get(message.viewId);\n\t\t\t\tview?.addEventListener(message.event, (event) => {\n\t\t\t\t\tconst data: unknown = Reflect.get(event, \"data\");\n\t\t\t\t\tthis.#emit(message.viewId, { type: \"dom\", name: message.event, data });\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcase \"close-all\":\n\t\t\t\tfor (const view of this.#views.values()) closeQuietly(view);\n\t\t\t\tthis.#views.clear();\n\t\t\t\tthis.#post({ kind: \"reply\", id: message.id, ok: true, value: undefined });\n\t\t\t\treturn;\n\t\t}\n\t}\n\n\tasync #create(\n\t\tviewId: string,\n\t\toptions: Readonly<Record<string, unknown>>,\n\t\tcaptureConsole: boolean,\n\t): Promise<NativeWebView> {\n\t\tif (this.#views.has(viewId)) throw new Error(`WebView ${viewId} already exists`);\n\t\tconst onConsole = captureConsole\n\t\t\t? (...args: unknown[]) => this.#emit(viewId, { type: \"console\", args })\n\t\t\t: undefined;\n\t\tconst view = await this.#host.createView(options, onConsole);\n\t\tif (this.#released) {\n\t\t\tcloseQuietly(view);\n\t\t\tthrow new Error(\"WebView client released\");\n\t\t}\n\t\tview.onNavigated = (url, title) => this.#emit(viewId, { type: \"navigated\", url, title });\n\t\tview.onNavigationFailed = (error) => this.#emit(viewId, { type: \"navigation-failed\", error: wireError(error) });\n\t\tthis.#views.set(viewId, view);\n\t\treturn view;\n\t}\n\n\t#view(viewId: string): NativeWebView {\n\t\tconst view = this.#views.get(viewId);\n\t\tif (view) return view;\n\t\tconst error = new Error(`Unknown WebView ${viewId}: it was closed or belongs to another kernel`);\n\t\tReflect.set(error, \"code\", \"ERR_INVALID_STATE\");\n\t\tthrow error;\n\t}\n\n\tasync #reply(id: number, work: () => Promise<{ value: unknown; view: NativeWebView }>): Promise<void> {\n\t\ttry {\n\t\t\tconst { value, view } = await work();\n\t\t\tthis.#post({ kind: \"reply\", id, ok: true, value, state: stateOf(view) });\n\t\t} catch (error) {\n\t\t\tthis.#post({ kind: \"reply\", id, ok: false, error: wireError(error) });\n\t\t}\n\t}\n\n\t#emit(viewId: string, event: WebViewEvent): void {\n\t\tthis.#post({ kind: \"event\", viewId, event });\n\t}\n\n\t#post(message: ServiceToClient): void {\n\t\tif (this.#released) return;\n\t\ttry {\n\t\t\tthis.#port.postMessage(message);\n\t\t} catch (error) {\n\t\t\tif (message.kind !== \"reply\" || !message.ok) return;\n\t\t\tthis.#port.postMessage({ kind: \"reply\", id: message.id, ok: false, error: wireError(error) });\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type MessagePort } from "node:worker_threads";
|
|
2
|
+
import { type NativeWebViewClass } from "./native-webview.ts";
|
|
3
|
+
export interface WebViewClientGrant {
|
|
4
|
+
readonly clientId: string;
|
|
5
|
+
readonly port: MessagePort;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Serves Chrome-backed `Bun.WebView`s on the process main thread (Bun allows that backend nowhere
|
|
9
|
+
* else) for eval kernels running in worker threads. Every kernel gets its own client: a private
|
|
10
|
+
* MessagePort plus the views created through it, released as a unit by the owner that asked.
|
|
11
|
+
*/
|
|
12
|
+
export declare class WebViewService {
|
|
13
|
+
#private;
|
|
14
|
+
constructor(webViewClass: NativeWebViewClass);
|
|
15
|
+
get viewCount(): number;
|
|
16
|
+
connect(owner: object): WebViewClientGrant;
|
|
17
|
+
/**
|
|
18
|
+
* Only the owner that connected a client can release it. Resolves after any Chrome retirement in
|
|
19
|
+
* flight, including one a closed port (the client's worker died first) already started.
|
|
20
|
+
*/
|
|
21
|
+
release(clientId: string, owner: object): Promise<void>;
|
|
22
|
+
releaseOwner(owner: object): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
/** The process-wide service, created on first use; undefined off the main thread or without `Bun.WebView`. */
|
|
25
|
+
export declare function mainThreadWebViewService(): WebViewService | undefined;
|
|
26
|
+
//# sourceMappingURL=webview-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webview-service.d.ts","sourceRoot":"","sources":["../../../src/core/webview/webview-service.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAA8C,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAG1G,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC3B;AAED;;;;GAIG;AACH,qBAAa,cAAc;;IAM1B,YAAY,YAAY,EAAE,kBAAkB,EAE3C;IAED,IAAI,SAAS,IAAI,MAAM,CAItB;IAED,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,CASzC;IAED;;;OAGG;IACG,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI5D;IAEK,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/C;CA+BD;AAkBD,8GAA8G;AAC9G,wBAAgB,wBAAwB,IAAI,cAAc,GAAG,SAAS,CAQrE"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { MessageChannel } from "node:worker_threads";
|
|
3
|
+
import { retireBunChrome, settleDeadBunChrome } from "./bun-chrome.js";
|
|
4
|
+
import { mainThreadWebViewClass } from "./native-webview.js";
|
|
5
|
+
import { WebViewServiceClient } from "./webview-client.js";
|
|
6
|
+
/**
|
|
7
|
+
* Serves Chrome-backed `Bun.WebView`s on the process main thread (Bun allows that backend nowhere
|
|
8
|
+
* else) for eval kernels running in worker threads. Every kernel gets its own client: a private
|
|
9
|
+
* MessagePort plus the views created through it, released as a unit by the owner that asked.
|
|
10
|
+
*/
|
|
11
|
+
export class WebViewService {
|
|
12
|
+
#webViewClass;
|
|
13
|
+
#clients = new Map();
|
|
14
|
+
#retiring = Promise.resolve();
|
|
15
|
+
#chromeInUse = false;
|
|
16
|
+
constructor(webViewClass) {
|
|
17
|
+
this.#webViewClass = webViewClass;
|
|
18
|
+
}
|
|
19
|
+
get viewCount() {
|
|
20
|
+
let count = 0;
|
|
21
|
+
for (const client of this.#clients.values())
|
|
22
|
+
count += client.viewCount;
|
|
23
|
+
return count;
|
|
24
|
+
}
|
|
25
|
+
connect(owner) {
|
|
26
|
+
const clientId = randomUUID();
|
|
27
|
+
const channel = new MessageChannel();
|
|
28
|
+
const client = new WebViewServiceClient(clientId, owner, channel.port1, {
|
|
29
|
+
createView: (options, onConsole) => this.#createView(options, onConsole),
|
|
30
|
+
onClientClosed: (closed) => void this.#drop(closed),
|
|
31
|
+
});
|
|
32
|
+
this.#clients.set(clientId, client);
|
|
33
|
+
return { clientId, port: channel.port2 };
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Only the owner that connected a client can release it. Resolves after any Chrome retirement in
|
|
37
|
+
* flight, including one a closed port (the client's worker died first) already started.
|
|
38
|
+
*/
|
|
39
|
+
async release(clientId, owner) {
|
|
40
|
+
const client = this.#clients.get(clientId);
|
|
41
|
+
if (client?.owner === owner)
|
|
42
|
+
await this.#drop(client);
|
|
43
|
+
await this.#retiring;
|
|
44
|
+
}
|
|
45
|
+
async releaseOwner(owner) {
|
|
46
|
+
const owned = [...this.#clients.values()].filter((client) => client.owner === owner);
|
|
47
|
+
await Promise.all(owned.map((client) => this.#drop(client)));
|
|
48
|
+
await this.#retiring;
|
|
49
|
+
}
|
|
50
|
+
async #createView(options, onConsole) {
|
|
51
|
+
await this.#retiring;
|
|
52
|
+
await settleDeadBunChrome();
|
|
53
|
+
this.#chromeInUse = true;
|
|
54
|
+
const viewOptions = onConsole ? { ...options, console: onConsole } : options;
|
|
55
|
+
for (let attempt = 1;; attempt++) {
|
|
56
|
+
try {
|
|
57
|
+
return new this.#webViewClass(viewOptions);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if (!isChromeRelaunchWindow(error) || attempt >= RELAUNCH_ATTEMPTS)
|
|
61
|
+
throw error;
|
|
62
|
+
await new Promise((resolve) => setTimeout(resolve, RELAUNCH_RETRY_MS));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
async #drop(client) {
|
|
67
|
+
if (this.#clients.get(client.id) !== client)
|
|
68
|
+
return await this.#retiring;
|
|
69
|
+
this.#clients.delete(client.id);
|
|
70
|
+
client.release();
|
|
71
|
+
if (!this.#chromeInUse || this.viewCount > 0)
|
|
72
|
+
return await this.#retiring;
|
|
73
|
+
this.#chromeInUse = false;
|
|
74
|
+
this.#retiring = this.#retiring.then(() => this.viewCount > 0 ? undefined : retireBunChrome(this.#webViewClass));
|
|
75
|
+
await this.#retiring;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Right after Chrome dies, Windows refuses to relaunch it for about a second (Bun reports
|
|
79
|
+
// ERR_DLOPEN_FAILED "Failed to spawn Chrome"); a missing Chrome fails the same way, so the
|
|
80
|
+
// retry is bounded and the last error is surfaced.
|
|
81
|
+
const RELAUNCH_ATTEMPTS = 8;
|
|
82
|
+
const RELAUNCH_RETRY_MS = 250;
|
|
83
|
+
function isChromeRelaunchWindow(error) {
|
|
84
|
+
return error instanceof Error && Reflect.get(error, "code") === "ERR_DLOPEN_FAILED";
|
|
85
|
+
}
|
|
86
|
+
const SERVICE_KEY = Symbol.for("senpi.webview.service");
|
|
87
|
+
function isWebViewService(value) {
|
|
88
|
+
return value instanceof WebViewService;
|
|
89
|
+
}
|
|
90
|
+
/** The process-wide service, created on first use; undefined off the main thread or without `Bun.WebView`. */
|
|
91
|
+
export function mainThreadWebViewService() {
|
|
92
|
+
const existing = Reflect.get(globalThis, SERVICE_KEY);
|
|
93
|
+
if (isWebViewService(existing))
|
|
94
|
+
return existing;
|
|
95
|
+
const webViewClass = mainThreadWebViewClass();
|
|
96
|
+
if (!webViewClass)
|
|
97
|
+
return undefined;
|
|
98
|
+
const service = new WebViewService(webViewClass);
|
|
99
|
+
Reflect.set(globalThis, SERVICE_KEY, service);
|
|
100
|
+
return service;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=webview-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webview-service.js","sourceRoot":"","sources":["../../../src/core/webview/webview-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAoB,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAA+C,MAAM,qBAAqB,CAAC;AAC1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAO3D;;;;GAIG;AACH,MAAM,OAAO,cAAc;IACjB,aAAa,CAAqB;IAClC,QAAQ,GAAG,IAAI,GAAG,EAAgC,CAAC;IAC5D,SAAS,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAC7C,YAAY,GAAG,KAAK,CAAC;IAErB,YAAY,YAAgC;QAC3C,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACnC,CAAC;IAED,IAAI,SAAS;QACZ,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YAAE,KAAK,IAAI,MAAM,CAAC,SAAS,CAAC;QACvE,OAAO,KAAK,CAAC;IACd,CAAC;IAED,OAAO,CAAC,KAAa;QACpB,MAAM,QAAQ,GAAG,UAAU,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAI,cAAc,EAAE,CAAC;QACrC,MAAM,MAAM,GAAG,IAAI,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE;YACvE,UAAU,EA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,0FAA0F;AAC1F,2FAA2F;AAC3F,mDAAmD;AACnD,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,SAAS,sBAAsB,CAAC,KAAc;IAC7C,OAAO,KAAK,YAAY,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,mBAAmB,CAAC;AACrF,CAAC;AAED,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;AAExD,SAAS,gBAAgB,CAAC,KAAc;IACvC,OAAO,KAAK,YAAY,cAAc,CAAC;AACxC,CAAC;AAED,8GAA8G;AAC9G,MAAM,UAAU,wBAAwB;IACvC,MAAM,QAAQ,GAAY,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAC/D,IAAI,gBAAgB,CAAC,QAAQ,CAAC;QAAE,OAAO,QAAQ,CAAC;IAChD,MAAM,YAAY,GAAG,sBAAsB,EAAE,CAAC;IAC9C,IAAI,CAAC,YAAY;QAAE,OAAO,SAAS,CAAC;IACpC,MAAM,OAAO,GAAG,IAAI,cAAc,CAAC,YAAY,CAAC,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAC9C,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { MessageChannel, type MessagePort } from \"node:worker_threads\";\nimport { retireBunChrome, settleDeadBunChrome } from \"./bun-chrome.ts\";\nimport { mainThreadWebViewClass, type NativeWebView, type NativeWebViewClass } from \"./native-webview.ts\";\nimport { WebViewServiceClient } from \"./webview-client.ts\";\n\nexport interface WebViewClientGrant {\n\treadonly clientId: string;\n\treadonly port: MessagePort;\n}\n\n/**\n * Serves Chrome-backed `Bun.WebView`s on the process main thread (Bun allows that backend nowhere\n * else) for eval kernels running in worker threads. Every kernel gets its own client: a private\n * MessagePort plus the views created through it, released as a unit by the owner that asked.\n */\nexport class WebViewService {\n\treadonly #webViewClass: NativeWebViewClass;\n\treadonly #clients = new Map<string, WebViewServiceClient>();\n\t#retiring: Promise<void> = Promise.resolve();\n\t#chromeInUse = false;\n\n\tconstructor(webViewClass: NativeWebViewClass) {\n\t\tthis.#webViewClass = webViewClass;\n\t}\n\n\tget viewCount(): number {\n\t\tlet count = 0;\n\t\tfor (const client of this.#clients.values()) count += client.viewCount;\n\t\treturn count;\n\t}\n\n\tconnect(owner: object): WebViewClientGrant {\n\t\tconst clientId = randomUUID();\n\t\tconst channel = new MessageChannel();\n\t\tconst client = new WebViewServiceClient(clientId, owner, channel.port1, {\n\t\t\tcreateView: (options, onConsole) => this.#createView(options, onConsole),\n\t\t\tonClientClosed: (closed) => void this.#drop(closed),\n\t\t});\n\t\tthis.#clients.set(clientId, client);\n\t\treturn { clientId, port: channel.port2 };\n\t}\n\n\t/**\n\t * Only the owner that connected a client can release it. Resolves after any Chrome retirement in\n\t * flight, including one a closed port (the client's worker died first) already started.\n\t */\n\tasync release(clientId: string, owner: object): Promise<void> {\n\t\tconst client = this.#clients.get(clientId);\n\t\tif (client?.owner === owner) await this.#drop(client);\n\t\tawait this.#retiring;\n\t}\n\n\tasync releaseOwner(owner: object): Promise<void> {\n\t\tconst owned = [...this.#clients.values()].filter((client) => client.owner === owner);\n\t\tawait Promise.all(owned.map((client) => this.#drop(client)));\n\t\tawait this.#retiring;\n\t}\n\n\tasync #createView(\n\t\toptions: Readonly<Record<string, unknown>>,\n\t\tonConsole: ((...args: unknown[]) => void) | undefined,\n\t): Promise<NativeWebView> {\n\t\tawait this.#retiring;\n\t\tawait settleDeadBunChrome();\n\t\tthis.#chromeInUse = true;\n\t\tconst viewOptions = onConsole ? { ...options, console: onConsole } : options;\n\t\tfor (let attempt = 1; ; attempt++) {\n\t\t\ttry {\n\t\t\t\treturn new this.#webViewClass(viewOptions);\n\t\t\t} catch (error) {\n\t\t\t\tif (!isChromeRelaunchWindow(error) || attempt >= RELAUNCH_ATTEMPTS) throw error;\n\t\t\t\tawait new Promise((resolve) => setTimeout(resolve, RELAUNCH_RETRY_MS));\n\t\t\t}\n\t\t}\n\t}\n\n\tasync #drop(client: WebViewServiceClient): Promise<void> {\n\t\tif (this.#clients.get(client.id) !== client) return await this.#retiring;\n\t\tthis.#clients.delete(client.id);\n\t\tclient.release();\n\t\tif (!this.#chromeInUse || this.viewCount > 0) return await this.#retiring;\n\t\tthis.#chromeInUse = false;\n\t\tthis.#retiring = this.#retiring.then(() =>\n\t\t\tthis.viewCount > 0 ? undefined : retireBunChrome(this.#webViewClass),\n\t\t);\n\t\tawait this.#retiring;\n\t}\n}\n\n// Right after Chrome dies, Windows refuses to relaunch it for about a second (Bun reports\n// ERR_DLOPEN_FAILED \"Failed to spawn Chrome\"); a missing Chrome fails the same way, so the\n// retry is bounded and the last error is surfaced.\nconst RELAUNCH_ATTEMPTS = 8;\nconst RELAUNCH_RETRY_MS = 250;\n\nfunction isChromeRelaunchWindow(error: unknown): boolean {\n\treturn error instanceof Error && Reflect.get(error, \"code\") === \"ERR_DLOPEN_FAILED\";\n}\n\nconst SERVICE_KEY = Symbol.for(\"senpi.webview.service\");\n\nfunction isWebViewService(value: unknown): value is WebViewService {\n\treturn value instanceof WebViewService;\n}\n\n/** The process-wide service, created on first use; undefined off the main thread or without `Bun.WebView`. */\nexport function mainThreadWebViewService(): WebViewService | undefined {\n\tconst existing: unknown = Reflect.get(globalThis, SERVICE_KEY);\n\tif (isWebViewService(existing)) return existing;\n\tconst webViewClass = mainThreadWebViewClass();\n\tif (!webViewClass) return undefined;\n\tconst service = new WebViewService(webViewClass);\n\tReflect.set(globalThis, SERVICE_KEY, service);\n\treturn service;\n}\n"]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Messages on one kernel client's MessagePort to the main-thread WebView service. The eval
|
|
3
|
+
* kernel's worker side (`senpi-codemode/src/kernels/js/worker-webview-client.js`) is plain
|
|
4
|
+
* JavaScript and mirrors these shapes; keep the two in sync.
|
|
5
|
+
*/
|
|
6
|
+
export declare const WEBVIEW_METHODS: readonly ["navigate", "evaluate", "screenshot", "click", "type", "press", "scroll", "scrollTo", "resize", "back", "forward", "reload", "cdp"];
|
|
7
|
+
export type WebViewMethod = (typeof WEBVIEW_METHODS)[number];
|
|
8
|
+
export interface WebViewState {
|
|
9
|
+
readonly url: string;
|
|
10
|
+
readonly title: string;
|
|
11
|
+
readonly loading: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface WebViewWireError {
|
|
14
|
+
readonly name: string;
|
|
15
|
+
readonly message: string;
|
|
16
|
+
readonly code?: string;
|
|
17
|
+
}
|
|
18
|
+
export type ClientToService = {
|
|
19
|
+
readonly kind: "create";
|
|
20
|
+
readonly id: number;
|
|
21
|
+
readonly viewId: string;
|
|
22
|
+
readonly options: Readonly<Record<string, unknown>>;
|
|
23
|
+
readonly captureConsole: boolean;
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: "call";
|
|
26
|
+
readonly id: number;
|
|
27
|
+
readonly viewId: string;
|
|
28
|
+
readonly method: WebViewMethod;
|
|
29
|
+
readonly args: readonly unknown[];
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: "close";
|
|
32
|
+
readonly viewId: string;
|
|
33
|
+
} | {
|
|
34
|
+
readonly kind: "listen";
|
|
35
|
+
readonly viewId: string;
|
|
36
|
+
readonly event: string;
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: "close-all";
|
|
39
|
+
readonly id: number;
|
|
40
|
+
};
|
|
41
|
+
export type WebViewEvent = {
|
|
42
|
+
readonly type: "console";
|
|
43
|
+
readonly args: readonly unknown[];
|
|
44
|
+
} | {
|
|
45
|
+
readonly type: "navigated";
|
|
46
|
+
readonly url: string;
|
|
47
|
+
readonly title: string;
|
|
48
|
+
} | {
|
|
49
|
+
readonly type: "navigation-failed";
|
|
50
|
+
readonly error: WebViewWireError;
|
|
51
|
+
} | {
|
|
52
|
+
readonly type: "dom";
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly data: unknown;
|
|
55
|
+
};
|
|
56
|
+
export type ServiceToClient = {
|
|
57
|
+
readonly kind: "reply";
|
|
58
|
+
readonly id: number;
|
|
59
|
+
readonly ok: true;
|
|
60
|
+
readonly value: unknown;
|
|
61
|
+
readonly state?: WebViewState;
|
|
62
|
+
} | {
|
|
63
|
+
readonly kind: "reply";
|
|
64
|
+
readonly id: number;
|
|
65
|
+
readonly ok: false;
|
|
66
|
+
readonly error: WebViewWireError;
|
|
67
|
+
readonly state?: WebViewState;
|
|
68
|
+
} | {
|
|
69
|
+
readonly kind: "event";
|
|
70
|
+
readonly viewId: string;
|
|
71
|
+
readonly event: WebViewEvent;
|
|
72
|
+
};
|
|
73
|
+
/** Parses one message from a kernel worker; anything else is dropped at this boundary. */
|
|
74
|
+
export declare function parseClientMessage(value: unknown): ClientToService | undefined;
|
|
75
|
+
export declare function wireError(error: unknown): WebViewWireError;
|
|
76
|
+
//# sourceMappingURL=webview-wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webview-wire.d.ts","sourceRoot":"","sources":["../../../src/core/webview/webview-wire.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,eAAe,YAC3B,UAAU,EACV,UAAU,EACV,YAAY,EACZ,OAAO,EACP,MAAM,EACN,OAAO,EACP,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,MAAM,EACN,SAAS,EACT,QAAQ,EACR,KAAK,CACI,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gB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|
|
3
|
+
* kernel's worker side (`senpi-codemode/src/kernels/js/worker-webview-client.js`) is plain
|
|
4
|
+
* JavaScript and mirrors these shapes; keep the two in sync.
|
|
5
|
+
*/
|
|
6
|
+
export const WEBVIEW_METHODS = [
|
|
7
|
+
"navigate",
|
|
8
|
+
"evaluate",
|
|
9
|
+
"screenshot",
|
|
10
|
+
"click",
|
|
11
|
+
"type",
|
|
12
|
+
"press",
|
|
13
|
+
"scroll",
|
|
14
|
+
"scrollTo",
|
|
15
|
+
"resize",
|
|
16
|
+
"back",
|
|
17
|
+
"forward",
|
|
18
|
+
"reload",
|
|
19
|
+
"cdp",
|
|
20
|
+
];
|
|
21
|
+
function isRecord(value) {
|
|
22
|
+
return typeof value === "object" && value !== null;
|
|
23
|
+
}
|
|
24
|
+
function isMethod(value) {
|
|
25
|
+
return WEBVIEW_METHODS.some((method) => method === value);
|
|
26
|
+
}
|
|
27
|
+
/** Parses one message from a kernel worker; anything else is dropped at this boundary. */
|
|
28
|
+
export function parseClientMessage(value) {
|
|
29
|
+
if (!isRecord(value))
|
|
30
|
+
return undefined;
|
|
31
|
+
const { kind, id, viewId } = value;
|
|
32
|
+
if (kind === "close-all")
|
|
33
|
+
return typeof id === "number" ? { kind, id } : undefined;
|
|
34
|
+
if (typeof viewId !== "string")
|
|
35
|
+
return undefined;
|
|
36
|
+
if (kind === "close")
|
|
37
|
+
return { kind, viewId };
|
|
38
|
+
if (kind === "listen")
|
|
39
|
+
return typeof value.event === "string" ? { kind, viewId, event: value.event } : undefined;
|
|
40
|
+
if (typeof id !== "number")
|
|
41
|
+
return undefined;
|
|
42
|
+
if (kind === "create") {
|
|
43
|
+
const options = isRecord(value.options) ? value.options : {};
|
|
44
|
+
return { kind, id, viewId, options, captureConsole: value.captureConsole === true };
|
|
45
|
+
}
|
|
46
|
+
if (kind === "call" && isMethod(value.method) && Array.isArray(value.args)) {
|
|
47
|
+
return { kind, id, viewId, method: value.method, args: value.args };
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
export function wireError(error) {
|
|
52
|
+
if (!(error instanceof Error))
|
|
53
|
+
return { name: "Error", message: String(error) };
|
|
54
|
+
const code = Reflect.get(error, "code");
|
|
55
|
+
return { name: error.name, message: error.message, ...(typeof code === "string" ? { code } : {}) };
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=webview-wire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webview-wire.js","sourceRoot":"","sources":["../../../src/core/webview/webview-wire.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC9B,UAAU;IACV,UAAU;IACV,YAAY;IACZ,OAAO;IACP,MAAM;IACN,OAAO;IACP,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,MAAM;IACN,SAAS;IACT,QAAQ;IACR,KAAK;CACI,CAAC;AA0DX,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACpD,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAChD,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACvC,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACnC,IAAI,IAAI,KAAK,WAAW;QAAE,OAAO,OAAO,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;IACnF,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACjD,IAAI,I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K,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACpG,CAAC","sourcesContent":["/**\n * Messages on one kernel client's MessagePort to the main-thread WebView service. The eval\n * kernel's worker side (`senpi-codemode/src/kernels/js/worker-webview-client.js`) is plain\n * JavaScript and mirrors these shapes; keep the two in sync.\n */\n\nexport const WEBVIEW_METHODS = [\n\t\"navigate\",\n\t\"evaluate\",\n\t\"screenshot\",\n\t\"click\",\n\t\"type\",\n\t\"press\",\n\t\"scroll\",\n\t\"scrollTo\",\n\t\"resize\",\n\t\"back\",\n\t\"forward\",\n\t\"reload\",\n\t\"cdp\",\n] as const;\n\nexport type WebViewMethod = (typeof WEBVIEW_METHODS)[number];\n\nexport interface WebViewState {\n\treadonly url: string;\n\treadonly title: string;\n\treadonly loading: boolean;\n}\n\nexport interface WebViewWireError {\n\treadonly name: string;\n\treadonly message: string;\n\treadonly code?: string;\n}\n\nexport type ClientToService =\n\t| {\n\t\t\treadonly kind: \"create\";\n\t\t\treadonly id: number;\n\t\t\treadonly viewId: string;\n\t\t\treadonly options: Readonly<Record<string, unknown>>;\n\t\t\treadonly captureConsole: boolean;\n\t }\n\t| {\n\t\t\treadonly kind: \"call\";\n\t\t\treadonly id: number;\n\t\t\treadonly viewId: string;\n\t\t\treadonly method: WebViewMethod;\n\t\t\treadonly args: readonly unknown[];\n\t }\n\t| { readonly kind: \"close\"; readonly viewId: string }\n\t| { readonly kind: \"listen\"; readonly viewId: string; readonly event: string }\n\t| { readonly kind: \"close-all\"; readonly id: number };\n\nexport type WebViewEvent =\n\t| { readonly type: \"console\"; readonly args: readonly unknown[] }\n\t| { readonly type: \"navigated\"; readonly url: string; readonly title: string }\n\t| { readonly type: \"navigation-failed\"; readonly error: WebViewWireError }\n\t| { readonly type: \"dom\"; readonly name: string; readonly data: unknown };\n\nexport type ServiceToClient =\n\t| {\n\t\t\treadonly kind: \"reply\";\n\t\t\treadonly id: number;\n\t\t\treadonly ok: true;\n\t\t\treadonly value: unknown;\n\t\t\treadonly state?: WebViewState;\n\t }\n\t| {\n\t\t\treadonly kind: \"reply\";\n\t\t\treadonly id: number;\n\t\t\treadonly ok: false;\n\t\t\treadonly error: WebViewWireError;\n\t\t\treadonly state?: WebViewState;\n\t }\n\t| { readonly kind: \"event\"; readonly viewId: string; readonly event: WebViewEvent };\n\nfunction isRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction isMethod(value: unknown): value is WebViewMethod {\n\treturn WEBVIEW_METHODS.some((method) => method === value);\n}\n\n/** Parses one message from a kernel worker; anything else is dropped at this boundary. */\nexport function parseClientMessage(value: unknown): ClientToService | undefined {\n\tif (!isRecord(value)) return undefined;\n\tconst { kind, id, viewId } = value;\n\tif (kind === \"close-all\") return typeof id === \"number\" ? { kind, id } : undefined;\n\tif (typeof viewId !== \"string\") return undefined;\n\tif (kind === \"close\") return { kind, viewId };\n\tif (kind === \"listen\") return typeof value.event === \"string\" ? { kind, viewId, event: value.event } : undefined;\n\tif (typeof id !== \"number\") return undefined;\n\tif (kind === \"create\") {\n\t\tconst options = isRecord(value.options) ? value.options : {};\n\t\treturn { kind, id, viewId, options, captureConsole: value.captureConsole === true };\n\t}\n\tif (kind === \"call\" && isMethod(value.method) && Array.isArray(value.args)) {\n\t\treturn { kind, id, viewId, method: value.method, args: value.args };\n\t}\n\treturn undefined;\n}\n\nexport function wireError(error: unknown): WebViewWireError {\n\tif (!(error instanceof Error)) return { name: \"Error\", message: String(error) };\n\tconst code = Reflect.get(error, \"code\");\n\treturn { name: error.name, message: error.message, ...(typeof code === \"string\" ? { code } : {}) };\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export { type EditDiffResult, generateDiffString, generateUnifiedPatch } from ".
|
|
|
29
29
|
export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, type FindOperations, type FindToolDetails, type FindToolInput, type FindToolOptions, formatSize, type GrepOperations, type GrepToolDetails, type GrepToolInput, type GrepToolOptions, type LsOperations, type LsToolDetails, type LsToolInput, type LsToolOptions, type ReadOperations, type ReadToolDetails, type ReadToolInput, type ReadToolOptions, type ToolsOptions, type TruncationOptions, type TruncationResult, truncateHead, truncateLine, truncateTail, type WriteOperations, type WriteToolInput, type WriteToolOptions, withFileMutationQueue, } from "./core/tools/index.ts";
|
|
30
30
|
export { type CompactReadClassification, classifyRead, type ReadClassifier, registerReadClassifier, } from "./core/tools/read-classifiers.ts";
|
|
31
31
|
export { hasTrustRequiringProjectResources, type ProjectTrustDecision, ProjectTrustStore, type ProjectTrustStoreEntry, type ProjectTrustUpdate, } from "./core/trust-manager.ts";
|
|
32
|
+
export { connectWebViewService, type WebViewServiceConnection } from "./core/webview/webview-broker.ts";
|
|
32
33
|
export { type MainOptions, main } from "./main.ts";
|
|
33
34
|
export { createHostDaemonPaths, DEFAULT_HOST_LAUNCH_SPEC, daemonDirectoryName, decideHostAction, type EnsuredHost, type EnsureHostOptions, ensureHost, GENERATION_HANDOFF_CAPABILITY, type HandoffHostOptions, type HandoffRefusal, type HandoffResult, HOST_EXIT_ERROR, HOST_EXIT_FALLBACK, HOST_EXIT_OK, HOST_EXIT_REFUSED, HOST_EXIT_USAGE, HOST_PROTOCOL_VERSION, type HostAction, type HostDaemonPaths, type HostDecision, type HostDecisionClient, type HostDecisionPolicy, type HostDecisionWarning, HostEnsureRefusedError, type HostGenerationRow, type HostLaunchSpec, type HostLaunchSpecCore, HostLaunchSpecError, type HostLaunchSpecRefusal, type HostOutcome, type HostProtocolInfo, type HostRefusalReason, type HostRequest, type HostSessionCounts, type HostStatusOptions, type HostStatusReport, type HostTarget, type HostUpgradePolicy, handoffHost, InteractiveMode, type InteractiveModeOptions, isTransportGoneError, type JsonAgentSessionEvent, loadHostLaunchSpec, type ModelInfo, PINNED_HOST_CLIENT_CAPABILITIES, type PrintModeOptions, type ProbeHostOptions, parseHostLaunchSpec, parseHostProtocolInfo, probeHost, REQUIRED_HOST_CAPABILITIES, type ResolvedHostLaunchSpec, RpcClient, type RpcClientEvent, RpcClientOpenInFlightError, type RpcClientOptions, type RpcCommand, type RpcEventListener, type RpcExtensionEvent, type RpcExtensionUIRequest, type RpcExtensionUIResponse, type RpcResponse, type RpcSessionState, RpcTransportGoneError, readHostStatus, runHostRequest, runPrintMode, runRpcMode, type ShardKind, type StopHostOptions, type StopHostResult, shardKey, shardSocketPath, shardSocketPathForKey, stopHost, } from "./modes/index.ts";
|
|
34
35
|
export { ArminComponent, AssistantMessageComponent, BashExecutionComponent, BorderedLoader, BranchSummaryMessageComponent, CompactionSummaryMessageComponent, CustomEditor, type CustomEditorOptions, CustomMessageComponent, DynamicBorder, ExtensionEditorComponent, ExtensionInputComponent, ExtensionSelectorComponent, FooterComponent, keyHint, keyText, LoginDialogComponent, ModelSelectorComponent, OAuthSelectorComponent, type RenderDiffOptions, rawKeyHint, renderDiff, SessionSelectorComponent, type SettingsCallbacks, type SettingsConfig, SettingsSelectorComponent, ShowImagesSelectorComponent, SkillInvocationMessageComponent, ThemeSelectorComponent, ThinkingSelectorComponent, ToolExecutionComponent, type ToolExecutionOptions, TreeSelectorComponent, truncateToVisualLines, UserMessageComponent, UserMessageSelectorComponent, type VisualTruncateResult, } from "./modes/interactive/components/index.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAA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,cAAc,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EACtB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,KAAK,oBAAoB,GACzB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,EACL,KAAK,UAAU,GACf,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -38,6 +38,8 @@ export { generateDiffString, generateUnifiedPatch } from "./core/tools/edit-diff
|
|
|
38
38
|
export { createBashToolDefinition, createEditToolDefinition, createFindToolDefinition, createGrepToolDefinition, createLocalBashOperations, createLsToolDefinition, createReadToolDefinition, createWriteToolDefinition, DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead, truncateLine, truncateTail, withFileMutationQueue, } from "./core/tools/index.js";
|
|
39
39
|
export { classifyRead, registerReadClassifier, } from "./core/tools/read-classifiers.js";
|
|
40
40
|
export { hasTrustRequiringProjectResources, ProjectTrustStore, } from "./core/trust-manager.js";
|
|
41
|
+
// Main-thread Bun.WebView service for eval kernels running in worker threads
|
|
42
|
+
export { connectWebViewService } from "./core/webview/webview-broker.js";
|
|
41
43
|
// Main entry point
|
|
42
44
|
export { main } from "./main.js";
|
|
43
45
|
// Run modes for programmatic SDK usage
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAa,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,iGAAiG;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,eAAe;AACf,OAAO,EACN,eAAe,EACf,WAAW,EACX,WAAW,EACX,eAAe,EACf,aAAa,EACb,aAAa,EACb,OAAO,GACP,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAwB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACpF,aAAa;AACb,OAAO,EAON,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EAEd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,gFAAgF;AAChF,OAAO,EACN,oBAAoB,EAKpB,mBAAmB,EACnB,uBAAuB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,cAAc,EAA0C,MAAM,qBAAqB,CAAC;AAsH7F,OAAO,EACN,sBAAsB,EACtB,UAAU,EACV,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,GACnB,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UAAU,EACV,wBAAwB,EAGxB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EAEtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,GAE5B,MAAM,yCAAyC,CAAC;AACjD,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AACvE,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\nexport { sanitizeTerminalLabel } from \"@earendil-works/pi-tui\";\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// The shared-daemon command surface: one JSON line, one exit code, for launchers without a shell\nexport { runHostCommand } from \"./cli/host-command.ts\";\n// Config paths\nexport {\n\tCONFIG_DIR_NAME,\n\tgetAgentDir,\n\tgetDocsPath,\n\tgetExamplesPath,\n\tgetPackageDir,\n\tgetReadmePath,\n\tVERSION,\n} from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\nexport { type OAuthCredential, readStoredCredential } from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CacheFriendlySummaryOptions,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgenerateSummaryWithUsage,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.ts\";\n// Engine build identity: the ordinal clients compare instead of version strings\nexport {\n\tcompareEngineOrdinal,\n\ttype EngineBuildIdentity,\n\ttype EngineBuildInput,\n\ttype EngineOrdinal,\n\ttype EngineOrdinalScheme,\n\tengineBuildIdentity,\n\tengineBuildIdentityFrom,\n} from \"./core/engine-build-identity.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentSettledEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderHeadersEvent,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tEntryRenderer,\n\tEntryRendererOptions,\n\tEntryRenderOptions,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRpcRequestHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFilesystemOperation,\n\tFilesystemPolicy,\n\tFilesystemPolicyChecker,\n\tFilesystemPolicyDecision,\n\tFilesystemPolicyRequest,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInlineExtension,\n\tInputDispositionEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKernelPreludeContribution,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMarkdownTransformContext,\n\tMarkdownTransformer,\n\tMcpServerDeclaration,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tMessageStartEvent,\n\tMessageUpdateEvent,\n\tPowerShellToolCallEvent,\n\tProjectTrustContext,\n\tProjectTrustEvent,\n\tProjectTrustEventDecision,\n\tProjectTrustEventResult,\n\tProjectTrustHandler,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionInfoChangedEvent,\n\tSessionParkedEvent,\n\tSessionResumedEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionEndEvent,\n\tToolExecutionMode,\n\tToolExecutionStartEvent,\n\tToolExecutionUpdateEvent,\n\tToolInfo,\n\tToolPermissionRequest,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUIPromptEndEvent,\n\tUIPromptKind,\n\tUIPromptStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisPowerShellToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\nexport {\n\ttype ExtensionKernelTools,\n\ttype KernelToolInvokeOptions,\n\ttype KernelToolInvokeScope,\n\tkernelToolsStorage,\n} from \"./core/extensions/kernel-tools-context.ts\";\n// Notice primitives\nexport {\n\tbuildNoticeBox,\n\ttype NoticeLine,\n\ttype NoticeSpec,\n\ttype NoticeTone,\n\tnoticeEntryRenderer,\n\tnoticeMessageRenderer,\n} from \"./core/extensions/notice/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport {\n\ttype ModelScopeDiagnostic,\n\ttype ResolveCliModelResult,\n\ttype ResolveModelScopeResult,\n\tresolveCliModel,\n\tresolveModelScopeWithDiagnostics,\n\ttype ScopedModel,\n} from \"./core/model-resolver.ts\";\nexport {\n\ttype CreateModelRuntimeOptions,\n\tCredentialSynchronizationError,\n\ttype CredentialSynchronizationOperation,\n\tModelRuntime,\n\ttype ModelRuntimeAuthOverrides,\n} from \"./core/model-runtime.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreatePowerShellTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildContextEntries,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype SessionTreeNode,\n\tsessionEntryToContextMessages,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionModelOverride,\n\ttype CompactionSettings,\n\ttype DefaultProjectTrust,\n\ttype FullscreenExitOutput,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n\ttype TuiMode,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport { type EditDiffResult, generateDiffString, generateUnifiedPatch } from \"./core/tools/edit-diff.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\nexport {\n\ttype CompactReadClassification,\n\tclassifyRead,\n\ttype ReadClassifier,\n\tregisterReadClassifier,\n} from \"./core/tools/read-classifiers.ts\";\nexport {\n\thasTrustRequiringProjectResources,\n\ttype ProjectTrustDecision,\n\tProjectTrustStore,\n\ttype ProjectTrustStoreEntry,\n\ttype ProjectTrustUpdate,\n} from \"./core/trust-manager.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tcreateHostDaemonPaths,\n\tDEFAULT_HOST_LAUNCH_SPEC,\n\tdaemonDirectoryName,\n\tdecideHostAction,\n\ttype EnsuredHost,\n\ttype EnsureHostOptions,\n\tensureHost,\n\tGENERATION_HANDOFF_CAPABILITY,\n\ttype HandoffHostOptions,\n\ttype HandoffRefusal,\n\ttype HandoffResult,\n\tHOST_EXIT_ERROR,\n\tHOST_EXIT_FALLBACK,\n\tHOST_EXIT_OK,\n\tHOST_EXIT_REFUSED,\n\tHOST_EXIT_USAGE,\n\tHOST_PROTOCOL_VERSION,\n\ttype HostAction,\n\ttype HostDaemonPaths,\n\ttype HostDecision,\n\ttype HostDecisionClient,\n\ttype HostDecisionPolicy,\n\ttype HostDecisionWarning,\n\tHostEnsureRefusedError,\n\ttype HostGenerationRow,\n\ttype HostLaunchSpec,\n\ttype HostLaunchSpecCore,\n\tHostLaunchSpecError,\n\ttype HostLaunchSpecRefusal,\n\ttype HostOutcome,\n\ttype HostProtocolInfo,\n\ttype HostRefusalReason,\n\ttype HostRequest,\n\ttype HostSessionCounts,\n\ttype HostStatusOptions,\n\ttype HostStatusReport,\n\ttype HostTarget,\n\ttype HostUpgradePolicy,\n\thandoffHost,\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\tisTransportGoneError,\n\ttype JsonAgentSessionEvent,\n\tloadHostLaunchSpec,\n\ttype ModelInfo,\n\tPINNED_HOST_CLIENT_CAPABILITIES,\n\ttype PrintModeOptions,\n\ttype ProbeHostOptions,\n\tparseHostLaunchSpec,\n\tparseHostProtocolInfo,\n\tprobeHost,\n\tREQUIRED_HOST_CAPABILITIES,\n\ttype ResolvedHostLaunchSpec,\n\tRpcClient,\n\ttype RpcClientEvent,\n\tRpcClientOpenInFlightError,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcExtensionEvent,\n\ttype RpcExtensionUIRequest,\n\ttype RpcExtensionUIResponse,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\tRpcTransportGoneError,\n\treadHostStatus,\n\trunHostRequest,\n\trunPrintMode,\n\trunRpcMode,\n\ttype ShardKind,\n\ttype StopHostOptions,\n\ttype StopHostResult,\n\tshardKey,\n\tshardSocketPath,\n\tshardSocketPathForKey,\n\tstopHost,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\ttype CustomEditorOptions,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\nexport { detectSupportedImageMimeTypeFromFile } from \"./utils/mime.ts\";\n// Shell utilities\nexport { getPowerShellConfig, getShellConfig } from \"./utils/shell.ts\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAa,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,iGAAiG;AACjG,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,eAAe;AACf,OAAO,EACN,eAAe,EACf,WAAW,EACX,WAAW,EACX,eAAe,EACf,aAAa,EACb,aAAa,EACb,OAAO,GACP,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,YAAY,EAOZ,eAAe,GAEf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAwB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACpF,aAAa;AACb,OAAO,EAON,sBAAsB,EACtB,8BAA8B,EAC9B,OAAO,EACP,2BAA2B,EAC3B,cAAc,EAEd,YAAY,EACZ,kBAAkB,EAElB,qBAAqB,EACrB,eAAe,EACf,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACpB,qBAAqB,EACrB,aAAa,GACb,MAAM,4BAA4B,CAAC;AACpC,gFAAgF;AAChF,OAAO,EACN,oBAAoB,EAKpB,mBAAmB,EACnB,uBAAuB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE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AAqB,EACrB,QAAQ,GACR,MAAM,kBAAkB,CAAC;AAC1B,+BAA+B;AAC/B,OAAO,EACN,cAAc,EACd,yBAAyB,EACzB,sBAAsB,EACtB,cAAc,EACd,6BAA6B,EAC7B,iCAAiC,EACjC,YAAY,EAEZ,sBAAsB,EACtB,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,EAC1B,eAAe,EACf,OAAO,EACP,OAAO,EACP,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EAEtB,UAAU,EACV,UAAU,EACV,wBAAwB,EAGxB,yBAAyB,EACzB,2BAA2B,EAC3B,+BAA+B,EAC/B,sBAAsB,EACtB,yBAAyB,EACzB,sBAAsB,EAEtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,GAE5B,MAAM,yCAAyC,CAAC;AACjD,kDAAkD;AAClD,OAAO,EACN,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,oBAAoB,EACpB,aAAa,EACb,SAAS,EACT,KAAK,GAEL,MAAM,oCAAoC,CAAC;AAC5C,sBAAsB;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAAE,oCAAoC,EAAE,MAAM,iBAAiB,CAAC;AACvE,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["// Core session management\n\nexport { sanitizeTerminalLabel } from \"@earendil-works/pi-tui\";\nexport { type Args, parseArgs } from \"./cli/args.ts\";\n// The shared-daemon command surface: one JSON line, one exit code, for launchers without a shell\nexport { runHostCommand } from \"./cli/host-command.ts\";\n// Config paths\nexport {\n\tCONFIG_DIR_NAME,\n\tgetAgentDir,\n\tgetDocsPath,\n\tgetExamplesPath,\n\tgetPackageDir,\n\tgetReadmePath,\n\tVERSION,\n} from \"./config.ts\";\nexport {\n\tAgentSession,\n\ttype AgentSessionConfig,\n\ttype AgentSessionEvent,\n\ttype AgentSessionEventListener,\n\ttype ModelCycleResult,\n\ttype ParsedSkillBlock,\n\ttype PromptOptions,\n\tparseSkillBlock,\n\ttype SessionStats,\n} from \"./core/agent-session.ts\";\nexport { type OAuthCredential, readStoredCredential } from \"./core/auth-storage.ts\";\n// Compaction\nexport {\n\ttype BranchPreparation,\n\ttype BranchSummaryResult,\n\ttype CacheFriendlySummaryOptions,\n\ttype CollectEntriesResult,\n\ttype CompactionResult,\n\ttype CutPointResult,\n\tcalculateContextTokens,\n\tcollectEntriesForBranchSummary,\n\tcompact,\n\tDEFAULT_COMPACTION_SETTINGS,\n\testimateTokens,\n\ttype FileOperations,\n\tfindCutPoint,\n\tfindTurnStartIndex,\n\ttype GenerateBranchSummaryOptions,\n\tgenerateBranchSummary,\n\tgenerateSummary,\n\tgenerateSummaryWithUsage,\n\tgetLastAssistantUsage,\n\tprepareBranchEntries,\n\tserializeConversation,\n\tshouldCompact,\n} from \"./core/compaction/index.ts\";\n// Engine build identity: the ordinal clients compare instead of version strings\nexport {\n\tcompareEngineOrdinal,\n\ttype EngineBuildIdentity,\n\ttype EngineBuildInput,\n\ttype EngineOrdinal,\n\ttype EngineOrdinalScheme,\n\tengineBuildIdentity,\n\tengineBuildIdentityFrom,\n} from \"./core/engine-build-identity.ts\";\nexport { createEventBus, type EventBus, type EventBusController } from \"./core/event-bus.ts\";\n// Extension system\nexport type {\n\tAgentEndEvent,\n\tAgentSettledEvent,\n\tAgentStartEvent,\n\tAgentToolResult,\n\tAgentToolUpdateCallback,\n\tAppKeybinding,\n\tAutocompleteProviderFactory,\n\tBashToolCallEvent,\n\tBeforeAgentStartEvent,\n\tBeforeAgentStartEventResult,\n\tBeforeProviderHeadersEvent,\n\tBeforeProviderRequestEvent,\n\tBeforeProviderRequestEventResult,\n\tBuildSystemPromptOptions,\n\tCompactOptions,\n\tContextEvent,\n\tContextUsage,\n\tCustomToolCallEvent,\n\tEditToolCallEvent,\n\tEntryRenderer,\n\tEntryRendererOptions,\n\tEntryRenderOptions,\n\tExecOptions,\n\tExecResult,\n\tExtension,\n\tExtensionActions,\n\tExtensionAPI,\n\tExtensionCommandContext,\n\tExtensionCommandContextActions,\n\tExtensionContext,\n\tExtensionContextActions,\n\tExtensionError,\n\tExtensionEvent,\n\tExtensionFactory,\n\tExtensionFlag,\n\tExtensionHandler,\n\tExtensionRpcRequestHandler,\n\tExtensionRuntime,\n\tExtensionShortcut,\n\tExtensionUIContext,\n\tExtensionUIDialogOptions,\n\tExtensionWidgetOptions,\n\tFilesystemOperation,\n\tFilesystemPolicy,\n\tFilesystemPolicyChecker,\n\tFilesystemPolicyDecision,\n\tFilesystemPolicyRequest,\n\tFindToolCallEvent,\n\tGrepToolCallEvent,\n\tInlineExtension,\n\tInputDispositionEvent,\n\tInputEvent,\n\tInputEventResult,\n\tInputSource,\n\tKernelPreludeContribution,\n\tKeybindingsManager,\n\tLoadExtensionsResult,\n\tLsToolCallEvent,\n\tMarkdownTransformContext,\n\tMarkdownTransformer,\n\tMcpServerDeclaration,\n\tMessageEndEvent,\n\tMessageRenderer,\n\tMessageRenderOptions,\n\tMessageStartEvent,\n\tMessageUpdateEvent,\n\tPowerShellToolCallEvent,\n\tProjectTrustContext,\n\tProjectTrustEvent,\n\tProjectTrustEventDecision,\n\tProjectTrustEventResult,\n\tProjectTrustHandler,\n\tProviderConfig,\n\tProviderModelConfig,\n\tReadToolCallEvent,\n\tRegisteredCommand,\n\tRegisteredTool,\n\tResolvedCommand,\n\tSessionBeforeCompactEvent,\n\tSessionBeforeForkEvent,\n\tSessionBeforeSwitchEvent,\n\tSessionBeforeTreeEvent,\n\tSessionCompactEvent,\n\tSessionInfoChangedEvent,\n\tSessionParkedEvent,\n\tSessionResumedEvent,\n\tSessionShutdownEvent,\n\tSessionStartEvent,\n\tSessionTreeEvent,\n\tSlashCommandInfo,\n\tSlashCommandSource,\n\tSourceInfo,\n\tTerminalInputHandler,\n\tToolCallEvent,\n\tToolCallEventResult,\n\tToolDefinition,\n\tToolExecutionEndEvent,\n\tToolExecutionMode,\n\tToolExecutionStartEvent,\n\tToolExecutionUpdateEvent,\n\tToolInfo,\n\tToolPermissionRequest,\n\tToolRenderResultOptions,\n\tToolResultEvent,\n\tTurnEndEvent,\n\tTurnStartEvent,\n\tUIPromptEndEvent,\n\tUIPromptKind,\n\tUIPromptStartEvent,\n\tUserBashEvent,\n\tUserBashEventResult,\n\tWidgetPlacement,\n\tWorkingIndicatorOptions,\n\tWriteToolCallEvent,\n} from \"./core/extensions/index.ts\";\nexport {\n\tcreateExtensionRuntime,\n\tdefineTool,\n\tdiscoverAndLoadExtensions,\n\tExtensionRunner,\n\tisBashToolResult,\n\tisEditToolResult,\n\tisFindToolResult,\n\tisGrepToolResult,\n\tisLsToolResult,\n\tisPowerShellToolResult,\n\tisReadToolResult,\n\tisToolCallEventType,\n\tisWriteToolResult,\n\twrapRegisteredTool,\n\twrapRegisteredTools,\n} from \"./core/extensions/index.ts\";\nexport {\n\ttype ExtensionKernelTools,\n\ttype KernelToolInvokeOptions,\n\ttype KernelToolInvokeScope,\n\tkernelToolsStorage,\n} from \"./core/extensions/kernel-tools-context.ts\";\n// Notice primitives\nexport {\n\tbuildNoticeBox,\n\ttype NoticeLine,\n\ttype NoticeSpec,\n\ttype NoticeTone,\n\tnoticeEntryRenderer,\n\tnoticeMessageRenderer,\n} from \"./core/extensions/notice/index.ts\";\n// Footer data provider (git branch + extension statuses - data not otherwise available to extensions)\nexport type { ReadonlyFooterDataProvider } from \"./core/footer-data-provider.ts\";\nexport { convertToLlm } from \"./core/messages.ts\";\nexport { ModelRegistry } from \"./core/model-registry.ts\";\nexport {\n\ttype ModelScopeDiagnostic,\n\ttype ResolveCliModelResult,\n\ttype ResolveModelScopeResult,\n\tresolveCliModel,\n\tresolveModelScopeWithDiagnostics,\n\ttype ScopedModel,\n} from \"./core/model-resolver.ts\";\nexport {\n\ttype CreateModelRuntimeOptions,\n\tCredentialSynchronizationError,\n\ttype CredentialSynchronizationOperation,\n\tModelRuntime,\n\ttype ModelRuntimeAuthOverrides,\n} from \"./core/model-runtime.ts\";\nexport type {\n\tPackageManager,\n\tPathMetadata,\n\tProgressCallback,\n\tProgressEvent,\n\tResolvedPaths,\n\tResolvedResource,\n} from \"./core/package-manager.ts\";\nexport { DefaultPackageManager } from \"./core/package-manager.ts\";\nexport type { ResourceCollision, ResourceDiagnostic, ResourceLoader } from \"./core/resource-loader.ts\";\nexport { DefaultResourceLoader, loadProjectContextFiles } from \"./core/resource-loader.ts\";\n// SDK for programmatic usage\nexport {\n\tAgentSessionRuntime,\n\ttype AgentSessionRuntimeDiagnostic,\n\ttype AgentSessionServices,\n\ttype CreateAgentSessionFromServicesOptions,\n\ttype CreateAgentSessionOptions,\n\ttype CreateAgentSessionResult,\n\ttype CreateAgentSessionRuntimeFactory,\n\ttype CreateAgentSessionRuntimeResult,\n\ttype CreateAgentSessionServicesOptions,\n\t// Factory\n\tcreateAgentSession,\n\tcreateAgentSessionFromServices,\n\tcreateAgentSessionRuntime,\n\tcreateAgentSessionServices,\n\tcreateBashTool,\n\t// Tool factories (for custom cwd)\n\tcreateCodingTools,\n\tcreateEditTool,\n\tcreateFindTool,\n\tcreateGrepTool,\n\tcreateLsTool,\n\tcreatePowerShellTool,\n\tcreateReadOnlyTools,\n\tcreateReadTool,\n\tcreateWriteTool,\n\ttype PromptTemplate,\n} from \"./core/sdk.ts\";\nexport {\n\ttype BranchSummaryEntry,\n\tbuildContextEntries,\n\tbuildSessionContext,\n\ttype CompactionEntry,\n\tCURRENT_SESSION_VERSION,\n\ttype CustomEntry,\n\ttype CustomMessageEntry,\n\ttype FileEntry,\n\tgetLatestCompactionEntry,\n\ttype ModelChangeEntry,\n\tmigrateSessionEntries,\n\ttype NewSessionOptions,\n\tparseSessionEntries,\n\ttype SessionContext,\n\ttype SessionEntry,\n\ttype SessionEntryBase,\n\ttype SessionHeader,\n\ttype SessionInfo,\n\ttype SessionInfoEntry,\n\tSessionManager,\n\ttype SessionMessageEntry,\n\ttype SessionTreeNode,\n\tsessionEntryToContextMessages,\n\ttype ThinkingLevelChangeEntry,\n} from \"./core/session-manager.ts\";\nexport {\n\ttype CompactionModelOverride,\n\ttype CompactionSettings,\n\ttype DefaultProjectTrust,\n\ttype FullscreenExitOutput,\n\ttype ImageSettings,\n\ttype PackageSource,\n\ttype RetrySettings,\n\tSettingsManager,\n\ttype SettingsManagerCreateOptions,\n\ttype TuiMode,\n} from \"./core/settings-manager.ts\";\n// Skills\nexport {\n\tformatSkillsForPrompt,\n\ttype LoadSkillsFromDirOptions,\n\ttype LoadSkillsResult,\n\tloadSkills,\n\tloadSkillsFromDir,\n\ttype Skill,\n\ttype SkillFrontmatter,\n} from \"./core/skills.ts\";\nexport { createSyntheticSourceInfo } from \"./core/source-info.ts\";\nexport { type EditDiffResult, generateDiffString, generateUnifiedPatch } from \"./core/tools/edit-diff.ts\";\n// Tools\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tcreateBashToolDefinition,\n\tcreateEditToolDefinition,\n\tcreateFindToolDefinition,\n\tcreateGrepToolDefinition,\n\tcreateLocalBashOperations,\n\tcreateLsToolDefinition,\n\tcreateReadToolDefinition,\n\tcreateWriteToolDefinition,\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tformatSize,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\ttype ToolsOptions,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twithFileMutationQueue,\n} from \"./core/tools/index.ts\";\nexport {\n\ttype CompactReadClassification,\n\tclassifyRead,\n\ttype ReadClassifier,\n\tregisterReadClassifier,\n} from \"./core/tools/read-classifiers.ts\";\nexport {\n\thasTrustRequiringProjectResources,\n\ttype ProjectTrustDecision,\n\tProjectTrustStore,\n\ttype ProjectTrustStoreEntry,\n\ttype ProjectTrustUpdate,\n} from \"./core/trust-manager.ts\";\n// Main-thread Bun.WebView service for eval kernels running in worker threads\nexport { connectWebViewService, type WebViewServiceConnection } from \"./core/webview/webview-broker.ts\";\n// Main entry point\nexport { type MainOptions, main } from \"./main.ts\";\n// Run modes for programmatic SDK usage\nexport {\n\tcreateHostDaemonPaths,\n\tDEFAULT_HOST_LAUNCH_SPEC,\n\tdaemonDirectoryName,\n\tdecideHostAction,\n\ttype EnsuredHost,\n\ttype EnsureHostOptions,\n\tensureHost,\n\tGENERATION_HANDOFF_CAPABILITY,\n\ttype HandoffHostOptions,\n\ttype HandoffRefusal,\n\ttype HandoffResult,\n\tHOST_EXIT_ERROR,\n\tHOST_EXIT_FALLBACK,\n\tHOST_EXIT_OK,\n\tHOST_EXIT_REFUSED,\n\tHOST_EXIT_USAGE,\n\tHOST_PROTOCOL_VERSION,\n\ttype HostAction,\n\ttype HostDaemonPaths,\n\ttype HostDecision,\n\ttype HostDecisionClient,\n\ttype HostDecisionPolicy,\n\ttype HostDecisionWarning,\n\tHostEnsureRefusedError,\n\ttype HostGenerationRow,\n\ttype HostLaunchSpec,\n\ttype HostLaunchSpecCore,\n\tHostLaunchSpecError,\n\ttype HostLaunchSpecRefusal,\n\ttype HostOutcome,\n\ttype HostProtocolInfo,\n\ttype HostRefusalReason,\n\ttype HostRequest,\n\ttype HostSessionCounts,\n\ttype HostStatusOptions,\n\ttype HostStatusReport,\n\ttype HostTarget,\n\ttype HostUpgradePolicy,\n\thandoffHost,\n\tInteractiveMode,\n\ttype InteractiveModeOptions,\n\tisTransportGoneError,\n\ttype JsonAgentSessionEvent,\n\tloadHostLaunchSpec,\n\ttype ModelInfo,\n\tPINNED_HOST_CLIENT_CAPABILITIES,\n\ttype PrintModeOptions,\n\ttype ProbeHostOptions,\n\tparseHostLaunchSpec,\n\tparseHostProtocolInfo,\n\tprobeHost,\n\tREQUIRED_HOST_CAPABILITIES,\n\ttype ResolvedHostLaunchSpec,\n\tRpcClient,\n\ttype RpcClientEvent,\n\tRpcClientOpenInFlightError,\n\ttype RpcClientOptions,\n\ttype RpcCommand,\n\ttype RpcEventListener,\n\ttype RpcExtensionEvent,\n\ttype RpcExtensionUIRequest,\n\ttype RpcExtensionUIResponse,\n\ttype RpcResponse,\n\ttype RpcSessionState,\n\tRpcTransportGoneError,\n\treadHostStatus,\n\trunHostRequest,\n\trunPrintMode,\n\trunRpcMode,\n\ttype ShardKind,\n\ttype StopHostOptions,\n\ttype StopHostResult,\n\tshardKey,\n\tshardSocketPath,\n\tshardSocketPathForKey,\n\tstopHost,\n} from \"./modes/index.ts\";\n// UI components for extensions\nexport {\n\tArminComponent,\n\tAssistantMessageComponent,\n\tBashExecutionComponent,\n\tBorderedLoader,\n\tBranchSummaryMessageComponent,\n\tCompactionSummaryMessageComponent,\n\tCustomEditor,\n\ttype CustomEditorOptions,\n\tCustomMessageComponent,\n\tDynamicBorder,\n\tExtensionEditorComponent,\n\tExtensionInputComponent,\n\tExtensionSelectorComponent,\n\tFooterComponent,\n\tkeyHint,\n\tkeyText,\n\tLoginDialogComponent,\n\tModelSelectorComponent,\n\tOAuthSelectorComponent,\n\ttype RenderDiffOptions,\n\trawKeyHint,\n\trenderDiff,\n\tSessionSelectorComponent,\n\ttype SettingsCallbacks,\n\ttype SettingsConfig,\n\tSettingsSelectorComponent,\n\tShowImagesSelectorComponent,\n\tSkillInvocationMessageComponent,\n\tThemeSelectorComponent,\n\tThinkingSelectorComponent,\n\tToolExecutionComponent,\n\ttype ToolExecutionOptions,\n\tTreeSelectorComponent,\n\ttruncateToVisualLines,\n\tUserMessageComponent,\n\tUserMessageSelectorComponent,\n\ttype VisualTruncateResult,\n} from \"./modes/interactive/components/index.ts\";\n// Theme utilities for custom tools and extensions\nexport {\n\tgetLanguageFromPath,\n\tgetMarkdownTheme,\n\tgetSelectListTheme,\n\tgetSettingsListTheme,\n\thighlightCode,\n\tinitTheme,\n\tTheme,\n\ttype ThemeColor,\n} from \"./modes/interactive/theme/theme.ts\";\n// Clipboard utilities\nexport { copyToClipboard } from \"./utils/clipboard.ts\";\nexport { parseFrontmatter, stripFrontmatter } from \"./utils/frontmatter.ts\";\nexport { convertToPng } from \"./utils/image-convert.ts\";\nexport { formatDimensionNote, type ResizedImage, resizeImage } from \"./utils/image-resize.ts\";\nexport { detectSupportedImageMimeTypeFromFile } from \"./utils/mime.ts\";\n// Shell utilities\nexport { getPowerShellConfig, getShellConfig } from \"./utils/shell.ts\";\n"]}
|
|
@@ -14,6 +14,8 @@ export interface SessionWorkerCallbacks {
|
|
|
14
14
|
failure: (error: string) => void;
|
|
15
15
|
}
|
|
16
16
|
export declare class SessionWorkerClient {
|
|
17
|
+
/** The worker's own route to the main-thread Bun.WebView service; released when the worker exits. */
|
|
18
|
+
private readonly webviewBroker;
|
|
17
19
|
readonly worker: Worker;
|
|
18
20
|
readonly exited: Promise<void>;
|
|
19
21
|
snapshot?: WorkerSnapshot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-worker-client.d.ts","sourceRoot":"","sources":["../../../src/modes/rpc/session-worker-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,E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|
2
2
|
import { Worker } from "node:worker_threads";
|
|
3
3
|
import { isBunBinary } from "../../config.js";
|
|
4
|
+
import { createWebViewBroker } from "../../core/webview/webview-broker.js";
|
|
4
5
|
import { SessionWorkerRequests } from "./session-worker-requests.js";
|
|
5
6
|
import { acknowledge, acknowledgeGrant, respondDisplay } from "./session-worker-signals.js";
|
|
6
7
|
const compiledWorkerEntry = typeof SENPI_RPC_SESSION_WORKER_ENTRY === "string"
|
|
@@ -8,9 +9,13 @@ const compiledWorkerEntry = typeof SENPI_RPC_SESSION_WORKER_ENTRY === "string"
|
|
|
8
9
|
: "./src/modes/rpc/session-worker.ts";
|
|
9
10
|
export class SessionWorkerClient {
|
|
10
11
|
constructor(callbacks) {
|
|
12
|
+
/** The worker's own route to the main-thread Bun.WebView service; released when the worker exits. */
|
|
13
|
+
this.webviewBroker = createWebViewBroker();
|
|
11
14
|
this.worker = new Worker(isBunBinary
|
|
12
15
|
? fileURLToPath(new URL(compiledWorkerEntry, import.meta.url)).replaceAll("\\", "/")
|
|
13
|
-
: new URL(import.meta.url.endsWith(".ts") ? "./session-worker.ts" : "./session-worker.js", import.meta.url)
|
|
16
|
+
: new URL(import.meta.url.endsWith(".ts") ? "./session-worker.ts" : "./session-worker.js", import.meta.url), this.webviewBroker
|
|
17
|
+
? { workerData: { webviewBroker: this.webviewBroker.port }, transferList: [this.webviewBroker.port] }
|
|
18
|
+
: {});
|
|
14
19
|
/** Main marks this only after installing the unique routing binding. */
|
|
15
20
|
this.bindingReady = false;
|
|
16
21
|
this.requests = new SessionWorkerRequests((message) => this.worker.postMessage(message), () => this.fail("session_worker_request_timeout"));
|
|
@@ -28,6 +33,7 @@ export class SessionWorkerClient {
|
|
|
28
33
|
if (this.closeTimer)
|
|
29
34
|
clearTimeout(this.closeTimer);
|
|
30
35
|
this.requests.close(new Error("session_worker_exited"));
|
|
36
|
+
void this.webviewBroker?.dispose();
|
|
31
37
|
this.listeners.clear();
|
|
32
38
|
callbacks.exit();
|
|
33
39
|
this.publishTerminalFailure();
|