@pi-chamber/web 1.0.4-rc.4 → 1.0.5-rc.1
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/README.md +1 -1
- package/bin/cli.js +21 -2
- package/bin/cli.test.js +164 -4
- package/bin/lib/DOCUMENTATION.md +3 -3
- package/bin/lib/cli-args.js +96 -13
- package/bin/lib/commands-connect-url-tailscale.test.js +136 -0
- package/bin/lib/commands-connect-url.js +146 -39
- package/bin/lib/commands-connect-url.test.js +126 -0
- package/bin/lib/commands-serve.js +45 -2
- package/bin/lib/commands-status.js +28 -5
- package/bin/lib/commands-status.test.js +107 -0
- package/bin/lib/commands-tunnel.js +36 -10
- package/dist/assets/{DiagramView--BGR3PRZ.js → DiagramView-D-OSWTbO.js} +1 -1
- package/dist/assets/DiffView-BKT-MIH4.js +18 -0
- package/dist/assets/{FileSaveConflictDialog-CcrWHRvd.js → FileSaveConflictDialog-DBkVFssC.js} +2 -2
- package/dist/assets/FilesView-B7GIuRlh.js +6 -0
- package/dist/assets/{GitHubDetailScaffold-BZhP67Va.js → GitHubDetailScaffold-C9rCZMUT.js} +2 -2
- package/dist/assets/{GitHubLinkPicker-CJZmDljp.js → GitHubLinkPicker-Bm09hvhJ.js} +1 -1
- package/dist/assets/{GitHubListPrimitives-DhF42guB.js → GitHubListPrimitives-DlhAlxI6.js} +1 -1
- package/dist/assets/{GitView-JK-QCK9R.js → GitView-BgqdMb0m.js} +4 -4
- package/dist/assets/{IssuesSurface-CAqQzrsv.js → IssuesSurface-BZXAvt49.js} +3 -3
- package/dist/assets/{JsonTreeView-CKTqB1CD.js → JsonTreeView-BKgCQjh_.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-B5kJy9Nt.js → MarkdownRendererImpl-BdcyMPw-.js} +1 -1
- package/dist/assets/{PatchDiff-BQnRFN30.js → PatchDiff-2MmWXcGe.js} +1 -1
- package/dist/assets/PierreDiffViewer-D1F2WvD0.js +135 -0
- package/dist/assets/PullRequestsSurface-CN2z3DFv.js +2 -0
- package/dist/assets/SessionSwitcherContent-CCljxAZb.js +1 -0
- package/dist/assets/SessionSwitcherDropdown-DtNt3qw4.js +2 -0
- package/dist/assets/SessionUnreadDot-B9bHMy5q.js +1 -0
- package/dist/assets/SettingsView-DaZVCInW.js +6 -0
- package/dist/assets/{SettingsWindow-CAxKgYOu.js → SettingsWindow-C-ydfopH.js} +1 -1
- package/dist/assets/StickyHorizontalScrollbar-BMITjK4e.js +8 -0
- package/dist/assets/{ToolOutputDialog-lz5exVQ4.js → ToolOutputDialog-DJUAx_Oj.js} +4 -4
- package/dist/assets/{ToolPartDiffPreview-nIUiNLpP.js → ToolPartDiffPreview-DFyuJM4c.js} +1 -1
- package/dist/assets/{VirtualizedFileDiff-IWqCJNXu.js → VirtualizedFileDiff-BS-af6rn.js} +4 -4
- package/dist/assets/{Virtualizer-Cp_cJWbI.js → Virtualizer-DP6HbEeC.js} +1 -1
- package/dist/assets/{collapsible-C7oyikVm.js → collapsible-BOcd0lzY.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-CyhUKEfv.js → computeVirtualFileMetrics-BI6wORhM.js} +1 -1
- package/dist/assets/{contextFileOpenGuard-DkjmJ-NU.js → contextFileOpenGuard-DUMSGR4M.js} +1 -1
- package/dist/assets/{gitStatusPredicates-DBmUY3kA.js → gitStatusPredicates-FdKYDZe3.js} +1 -1
- package/dist/assets/{githubLink-BdbPMMAK.js → githubLink-B3-BaGpb.js} +5 -5
- package/dist/assets/index-DWSrsQWl.js +11 -0
- package/dist/assets/{index-CKgYIOis.js → index-Df-vmvzu.js} +1 -1
- package/dist/assets/index-DsQIBAWK.css +1 -0
- package/dist/assets/main-61_cd7S7.js +2 -0
- package/dist/assets/main-q43jqZ2I.js +136 -0
- package/dist/assets/{markdownCore-D7V46WY9.js → markdownCore-CqHYlXi_.js} +2 -2
- package/dist/assets/{miniChat-PanPmbEK.js → miniChat-vOuWN5pV.js} +2 -2
- package/dist/assets/mobile-mrXWV5ky.js +2 -0
- package/dist/assets/{nativeFileSave-BzhtrDoD.js → nativeFileSave-CFuugNKV.js} +1 -1
- package/dist/assets/pi-session-focus-preference-BEufpwC6.js +9 -0
- package/dist/assets/{renderDiffWithHighlighter-ByZtK9za.js → renderDiffWithHighlighter-BD9CAhZU.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-QQFXkY5Y.js +2 -0
- package/dist/assets/{renderFileWithHighlighter-CnN0Tv_8.js → renderFileWithHighlighter-KiEWMtzI.js} +1 -1
- package/dist/assets/renderMobileApp-DIZYvrhi.js +11 -0
- package/dist/assets/runtimeEndpointReset-BA2uP2rj.js +62 -0
- package/dist/assets/{runtimeSurface-DBiUWYK2.js → runtimeSurface-Der4qUnI.js} +1 -1
- package/dist/assets/useAppFontEffects-Bfw_d5eB.js +212 -0
- package/dist/assets/{useFilesViewSearch-BWABG6pS.js → useFilesViewSearch-Budwejnx.js} +3 -3
- package/dist/assets/useGitHubRemoteSearch-gUdylYy3.js +1 -0
- package/dist/assets/{useSwitcherItems-BSTSev5C.js → useSwitcherItems-yHSMduoo.js} +1 -1
- package/dist/assets/{vendor-aparajita-capacitor-secure-storage-BYohCVY0.js → vendor-aparajita-capacitor-secure-storage-BDrMx_CE.js} +1 -1
- package/dist/assets/{vendor-base-ui-BscvGUFt.js → vendor-base-ui-CKRUCG-f.js} +1 -1
- package/dist/assets/{vendor-boot-Dgb9NVFe.js → vendor-boot-EC6IyLt1.js} +13 -13
- package/dist/assets/{vendor-capacitor-app-BjdQVib9.js → vendor-capacitor-app-BaupizkW.js} +1 -1
- package/dist/assets/{vendor-capacitor-keyboard-eTtI5go3.js → vendor-capacitor-keyboard-9BVxykO7.js} +1 -1
- package/dist/assets/{vendor-capacitor-status-bar-9rNIGxlO.js → vendor-capacitor-status-bar-BsrUwiaA.js} +1 -1
- package/dist/assets/{vendor-codemirror-autocomplete-DxS3jwvE.js → vendor-codemirror-autocomplete-CGpAsPWp.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-angular-DdjXl9e2.js → vendor-codemirror-lang-angular-CDJoHJSY.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-cpp--aMr7NVt.js → vendor-codemirror-lang-cpp-BmHofQls.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-css-CZ_qxZY9.js → vendor-codemirror-lang-css-RM2HqXZ0.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-go-Ca-y2Alu.js → vendor-codemirror-lang-go-Crwca_X7.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-html-COZ0L5wT.js → vendor-codemirror-lang-html-CHSHUpwq.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-java-D3Rf3QNJ.js → vendor-codemirror-lang-java-lhQXgWu0.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-javascript-DwJ-IvCs.js → vendor-codemirror-lang-javascript-Dw4kFO4e.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-jinja-D_5lod6k.js → vendor-codemirror-lang-jinja-_pAC3UTN.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-json-BG8C7OpC.js → vendor-codemirror-lang-json-B-b1vAv-.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-less-CVEkoaTw.js → vendor-codemirror-lang-less-xIgOi1ze.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-liquid-U9vj0m8w.js → vendor-codemirror-lang-liquid-CP49m5dB.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-markdown-DqlYH9gY.js → vendor-codemirror-lang-markdown-BTht2ATe.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-php-BFEiEVA1.js → vendor-codemirror-lang-php-BguZDhaO.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-python-Cz1dQXQd.js → vendor-codemirror-lang-python-CH6_em9L.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-rust-C_CoD9mj.js → vendor-codemirror-lang-rust-EG_DtGyi.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sass-BuR0aKh5.js → vendor-codemirror-lang-sass-BknY5Qpo.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sql-DggNUjdM.js → vendor-codemirror-lang-sql-B0f-qCZo.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-vue-DFZHi2J3.js → vendor-codemirror-lang-vue-CyGn9snv.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-wast-zuTN3SHT.js → vendor-codemirror-lang-wast-CsFfSyyB.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-xml-CrcvhI-k.js → vendor-codemirror-lang-xml-Cdan_Jp1.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-yaml-DcVWsakb.js → vendor-codemirror-lang-yaml-COI5hck8.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-CCLITgCF.js → vendor-codemirror-language-data-CqU7kHmg.js} +2 -2
- package/dist/assets/{vendor-codemirror-search-H7NOEdbX.js → vendor-codemirror-search-DUfSCF9S.js} +1 -1
- package/dist/assets/{vendor-lezer-cpp-C8aD2KAr.js → vendor-lezer-cpp-DMZOJzBa.js} +1 -1
- package/dist/assets/{vendor-lezer-css-2lbTJF-Y.js → vendor-lezer-css-DUkkbMp7.js} +1 -1
- package/dist/assets/{vendor-lezer-go-Bw6LFTrZ.js → vendor-lezer-go-CHIhCNY6.js} +1 -1
- package/dist/assets/{vendor-lezer-html-D7ym2z7S.js → vendor-lezer-html-B3h0MOrG.js} +1 -1
- package/dist/assets/{vendor-lezer-java-CZhK7w21.js → vendor-lezer-java-tMazV_6X.js} +1 -1
- package/dist/assets/{vendor-lezer-javascript-rpKeTHZp.js → vendor-lezer-javascript-ctwLWf4v.js} +1 -1
- package/dist/assets/{vendor-lezer-json-C7jwsd2G.js → vendor-lezer-json-BP_UAzLL.js} +1 -1
- package/dist/assets/{vendor-lezer-lr-DR-ylqNN.js → vendor-lezer-lr-B8TQctNw.js} +1 -1
- package/dist/assets/{vendor-lezer-markdown-Bir0m5nB.js → vendor-lezer-markdown-aGLZf_3h.js} +1 -1
- package/dist/assets/{vendor-lezer-php-y0hIEfo1.js → vendor-lezer-php-D5zCNzlt.js} +1 -1
- package/dist/assets/{vendor-lezer-python-D64A9lNV.js → vendor-lezer-python-EJ4Im4y2.js} +1 -1
- package/dist/assets/{vendor-lezer-rust-E3ZA9T2L.js → vendor-lezer-rust-DO5c7OtA.js} +1 -1
- package/dist/assets/{vendor-lezer-sass-C5UFI9SP.js → vendor-lezer-sass-CMi6zfXI.js} +1 -1
- package/dist/assets/{vendor-lezer-xml-DOy7FzCR.js → vendor-lezer-xml-0MHMeZDp.js} +1 -1
- package/dist/assets/{vendor-lezer-yaml-kEjaSCvZ.js → vendor-lezer-yaml-BE2EFjpA.js} +1 -1
- package/dist/assets/{vendor-replit-codemirror-vim-BLfh0LPy.js → vendor-replit-codemirror-vim-AnOuN8yJ.js} +1 -1
- package/dist/assets/{web-components-CdMfsnXE.js → web-components-CeHLxvED.js} +3 -3
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/dist/sw.js +1 -1
- package/package.json +1 -2
- package/server/index.js +69 -30
- package/server/lib/client-auth/DOCUMENTATION.md +15 -1
- package/server/lib/client-auth/pairing.js +2 -12
- package/server/lib/client-auth/remote-clients.js +2 -12
- package/server/lib/cloudflare-tunnel.js +0 -132
- package/server/lib/fs/DOCUMENTATION.md +8 -0
- package/server/lib/fs/atomic-write.js +111 -0
- package/server/lib/fs/atomic-write.test.js +133 -0
- package/server/lib/notifications/DOCUMENTATION.md +43 -32
- package/server/lib/notifications/pi-notification-watcher.js +8 -7
- package/server/lib/notifications/pi-notification-watcher.test.js +88 -2
- package/server/lib/pi/routes-extension-events.test.js +231 -0
- package/server/lib/pi/routes.js +137 -4
- package/server/lib/pi/routes.test.js +248 -2
- package/server/lib/pi/session-daemon/DOCUMENTATION.md +17 -4
- package/server/lib/pi/session-daemon/daemon-process.js +2 -0
- package/server/lib/pi/session-daemon/engines/index.js +6 -0
- package/server/lib/pi/session-daemon/extension-bridge-draft.test.js +1 -1
- package/server/lib/pi/session-daemon/extension-bridge.js +24 -0
- package/server/lib/pi/session-daemon/extension-message-render.js +74 -0
- package/server/lib/pi/session-daemon/extension-message-render.test.js +164 -0
- package/server/lib/pi/session-daemon/extension-tool-render.js +13 -6
- package/server/lib/pi/session-daemon/pending-input.js +188 -0
- package/server/lib/pi/session-daemon/pending-input.test.js +202 -0
- package/server/lib/pi/session-daemon/session-daemon-engines.test.js +828 -0
- package/server/lib/pi/session-daemon/session-daemon-extensions.test.js +296 -6
- package/server/lib/pi/session-daemon/session-daemon-turn.e2e.test.js +9 -0
- package/server/lib/pi/session-daemon/session-daemon.js +219 -19
- package/server/lib/pi/session-daemon/session-daemon.test.js +30 -2
- package/server/lib/pi/session-daemon/session-engine-router.js +390 -0
- package/server/lib/pi/session-daemon/session-engine-router.test.js +515 -0
- package/server/lib/pi/session-daemon/session-engines.js +467 -0
- package/server/lib/pi/session-daemon/session-engines.test.js +383 -0
- package/server/lib/pi/snippets-store.js +8 -17
- package/server/lib/pi/ui-settings-store.js +6 -10
- package/server/lib/pi/ui-settings-store.test.js +37 -1
- package/server/lib/relay/DOCUMENTATION.md +6 -4
- package/server/lib/relay/identity-store.js +116 -0
- package/server/lib/relay/identity-store.test.js +169 -0
- package/server/lib/relay/identity.js +6 -4
- package/server/lib/relay/server-id.js +63 -0
- package/server/lib/relay/server-id.test.js +132 -0
- package/server/lib/relay/signing-key.js +14 -11
- package/server/lib/security/bind-host.js +6 -2
- package/server/lib/security/bind-host.test.js +17 -0
- package/server/lib/server/core-routes.js +27 -1
- package/server/lib/server/lan-addresses.js +18 -6
- package/server/lib/server/lan-addresses.test.js +28 -0
- package/server/lib/server/tunnel-auth.js +47 -7
- package/server/lib/server/tunnel-auth.rate-limit.test.js +164 -0
- package/server/lib/server/tunnel-service.DOCUMENTATION.md +3 -4
- package/server/lib/server/tunnel-service.js +23 -20
- package/server/lib/server/tunnel-service.test.js +19 -2
- package/server/lib/stt/config-store.js +5 -15
- package/server/lib/tailscale/DOCUMENTATION.md +264 -0
- package/server/lib/tailscale/routes.js +45 -0
- package/server/lib/tailscale/service.js +959 -0
- package/server/lib/tailscale/tailscale.js +302 -0
- package/server/lib/tailscale/tailscale.test.js +1861 -0
- package/server/lib/tunnels/DOCUMENTATION.md +3 -4
- package/server/lib/tunnels/providers/cloudflare.js +1 -22
- package/server/lib/tunnels/types.js +0 -2
- package/server/lib/ui-auth/DOCUMENTATION.md +31 -0
- package/server/lib/ui-auth/ui-auth.js +80 -6
- package/server/lib/ui-auth/ui-auth.test.js +136 -0
- package/server/lib/ui-auth/ui-passkeys.js +2 -13
- package/server/lib/update-job-store.js +4 -6
- package/dist/assets/DiffView-hz90_htv.js +0 -18
- package/dist/assets/FilesView-DaqkPMqx.js +0 -6
- package/dist/assets/PierreDiffViewer-BeGpdI0x.js +0 -134
- package/dist/assets/PullRequestsSurface-D9beq2x9.js +0 -2
- package/dist/assets/SessionSwitcherContent-DElQ_cjm.js +0 -1
- package/dist/assets/SessionSwitcherDropdown-JaIDcDIj.js +0 -2
- package/dist/assets/SessionUnreadDot-Czfvjbdi.js +0 -1
- package/dist/assets/SettingsView-C_GC1Mx3.js +0 -6
- package/dist/assets/index-BnZVqcki.js +0 -11
- package/dist/assets/index-BnieExes.css +0 -1
- package/dist/assets/main-6YKi4QM2.js +0 -2
- package/dist/assets/main-CWdWdhdL.js +0 -136
- package/dist/assets/mobile-0LY-2fxw.js +0 -2
- package/dist/assets/pi-session-focus-preference-BC-ze1oC.js +0 -10
- package/dist/assets/renderElectronMiniChatApp-DETQLjFi.js +0 -2
- package/dist/assets/renderMobileApp-DS0FDQLg.js +0 -11
- package/dist/assets/runtimeEndpointReset-BqqXMwE9.js +0 -62
- package/dist/assets/useAppFontEffects-BisjofNZ.js +0 -212
- package/dist/assets/useGitHubRemoteSearch-Bsf2YeQP.js +0 -1
- package/dist/assets/vendor-capacitor-push-notifications-CBKq2Arn.js +0 -1
- package/server/lib/notifications/delivery-runtime.js +0 -314
- package/server/lib/notifications/delivery-runtime.test.js +0 -85
- package/server/lib/notifications/routes.js +0 -74
- package/server/lib/relay/service.js +0 -9
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session engine registry: the Pi-neutral seam that lets a build register
|
|
3
|
+
* extra session "engines" (other coding agents) without touching the Pi
|
|
4
|
+
* runtime code. PiChamber main ships zero engines, so every daemon behavior
|
|
5
|
+
* stays byte-identical to the Pi-only path until a factory is registered.
|
|
6
|
+
*
|
|
7
|
+
* An engine translates its own agent events into PiChamber's existing
|
|
8
|
+
* session event protocol and publishes them through the host `publish`
|
|
9
|
+
* wrapper, so engine events share the global sequence, stream epoch, and
|
|
10
|
+
* replay log and are indistinguishable on the wire.
|
|
11
|
+
*
|
|
12
|
+
* All engine output (list rows, provider rows, event payloads, detail and
|
|
13
|
+
* command results, snapshot fields) is redacted through the injected
|
|
14
|
+
* `redact` dependency (the daemon passes `redactAttachmentValues`), so a
|
|
15
|
+
* server-local attachment path an engine echoes back never reaches the
|
|
16
|
+
* public wire.
|
|
17
|
+
*
|
|
18
|
+
* Pending input: engines MAY carry `inputState: { pending }` on list rows,
|
|
19
|
+
* snapshot fields, and detail results, where `pending` is
|
|
20
|
+
* `{ count, kind, since }` (`count` an integer 1..99, `kind` `'input'` or
|
|
21
|
+
* `'approval'`, `since` epoch ms of the oldest open request) or `null` when
|
|
22
|
+
* authoritatively nothing is pending. `kind: 'approval'` marks a
|
|
23
|
+
* permission-style request; `'input'` marks any other request. A missing or
|
|
24
|
+
* malformed value falls back to the daemon index without failing the row.
|
|
25
|
+
* Engines MUST publish `session.input { pending }` on every pending-input
|
|
26
|
+
* transition for live updates; the daemon normalizes the summary (unknown
|
|
27
|
+
* kinds become `'input'`) and republishes it canonically as
|
|
28
|
+
* `{ pending, serverNow }` (`serverNow` is the daemon ms clock at publish),
|
|
29
|
+
* rejecting a
|
|
30
|
+
* malformed summary as `INVALID_ARGUMENT`. Only the engine that owns the
|
|
31
|
+
* session may publish its `session.input`: a summary for a session the
|
|
32
|
+
* publishing engine does not own is rejected as `INVALID_ARGUMENT` and
|
|
33
|
+
* never applied.
|
|
34
|
+
*
|
|
35
|
+
* Engine notifications: an engine publishes `extension.notify
|
|
36
|
+
* { message, level }` through the host publish wrapper. The payload is
|
|
37
|
+
* published live through the usual redaction (message capped at 2000
|
|
38
|
+
* characters, level `'info'` unless `'warning'`/`'error'`); notices are
|
|
39
|
+
* live-only and are never stored.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Stable error code an engine throws (as `.code` on the thrown error) when
|
|
44
|
+
* it does not implement a session-scoped command routed to it. The router
|
|
45
|
+
* throws this automatically for a routed command with no handler, so
|
|
46
|
+
* engines never write it themselves.
|
|
47
|
+
*/
|
|
48
|
+
export const ENGINE_UNSUPPORTED_OPERATION = 'ENGINE_UNSUPPORTED_OPERATION';
|
|
49
|
+
|
|
50
|
+
const ENGINE_ID_PATTERN = /^[a-z][a-z0-9-]{0,31}$/;
|
|
51
|
+
const ERROR_CODE_PATTERN = /^[A-Z][A-Z0-9_]{0,63}$/;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Whether a value is usable as a session engine id. `'pi'` is reserved for
|
|
55
|
+
* the built-in Pi runtime and can never name an engine.
|
|
56
|
+
*/
|
|
57
|
+
export const isValidEngineId = (value) => typeof value === 'string'
|
|
58
|
+
&& value !== 'pi'
|
|
59
|
+
&& ENGINE_ID_PATTERN.test(value);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Whether a value is usable as a session engine label: a non-empty string
|
|
63
|
+
* of at most 64 characters. Missing labels default to the engine id.
|
|
64
|
+
*/
|
|
65
|
+
export const isValidEngineLabel = (value) => typeof value === 'string'
|
|
66
|
+
&& value.length > 0
|
|
67
|
+
&& value.length <= 64;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Session-scoped daemon commands routed to the engine that owns the
|
|
71
|
+
* session. All other commands (extension, resource, settings, provider
|
|
72
|
+
* auth, `sessions.list`, `sessions.create`, `sessions.sendReceipt`,
|
|
73
|
+
* `extensions.draft`, `engines.list`) stay Pi-only or are dispatched
|
|
74
|
+
* separately.
|
|
75
|
+
*/
|
|
76
|
+
export const ENGINE_SESSION_COMMANDS = Object.freeze(new Set([
|
|
77
|
+
'sessions.open',
|
|
78
|
+
'sessions.messages',
|
|
79
|
+
'sessions.rename',
|
|
80
|
+
'sessions.delete',
|
|
81
|
+
'sessions.tree',
|
|
82
|
+
'sessions.navigate',
|
|
83
|
+
'sessions.fork',
|
|
84
|
+
'sessions.clone',
|
|
85
|
+
'sessions.prompt',
|
|
86
|
+
'sessions.steer',
|
|
87
|
+
'sessions.followUp',
|
|
88
|
+
'sessions.abort',
|
|
89
|
+
'sessions.setModel',
|
|
90
|
+
'sessions.setThinking',
|
|
91
|
+
'sessions.compact',
|
|
92
|
+
]));
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Commands an engine may implement in its handler map: the routed session
|
|
96
|
+
* commands plus `sessions.create`. `engines.list` command strings are drawn
|
|
97
|
+
* from this set, and the route projector keeps only these values.
|
|
98
|
+
*/
|
|
99
|
+
export const ENGINE_HANDLER_COMMANDS = Object.freeze(new Set([
|
|
100
|
+
...ENGINE_SESSION_COMMANDS,
|
|
101
|
+
'sessions.create',
|
|
102
|
+
]));
|
|
103
|
+
|
|
104
|
+
const sanitizeLogToken = (value, fallback) => {
|
|
105
|
+
if (typeof value !== 'string' || value.length === 0) return fallback;
|
|
106
|
+
const cleaned = value.replace(/[\r\n]/g, '').slice(0, 128);
|
|
107
|
+
return cleaned.length > 0 ? cleaned : fallback;
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const defaultSessionEngineLogger = (engineId, event, code) => {
|
|
111
|
+
process.stderr.write(
|
|
112
|
+
`[session-engine] ${sanitizeLogToken(engineId, 'unknown')} ${sanitizeLogToken(event, 'event')} ${sanitizeLogToken(code, 'UNKNOWN')}\n`,
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Report an engine failure through the registry logger. Only the engine id,
|
|
118
|
+
* a short event name, and the error's stable `code` cross the boundary:
|
|
119
|
+
* error messages, payloads, credentials, and paths are never logged.
|
|
120
|
+
* A throwing logger cannot break daemon dispatch.
|
|
121
|
+
*/
|
|
122
|
+
export const logSessionEngineError = (logger, engineId, event, error) => {
|
|
123
|
+
const code = typeof error?.code === 'string' && ERROR_CODE_PATTERN.test(error.code) ? error.code : 'UNKNOWN';
|
|
124
|
+
try {
|
|
125
|
+
(typeof logger === 'function' ? logger : defaultSessionEngineLogger)(engineId, event, code);
|
|
126
|
+
} catch {}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const invalidEngineError = (message) => {
|
|
130
|
+
const error = new Error(message);
|
|
131
|
+
error.code = 'INVALID_ENGINE';
|
|
132
|
+
return error;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const REQUIRED_ENGINE_METHODS = ['ownsSession', 'ownsProvider', 'listSessions', 'snapshot', 'dispose'];
|
|
136
|
+
|
|
137
|
+
const isInvalidHandlersShape = (handlers) => {
|
|
138
|
+
if (!handlers || typeof handlers !== 'object' || Array.isArray(handlers)) return true;
|
|
139
|
+
return Object.entries(handlers).some(([command, handler]) => (
|
|
140
|
+
!ENGINE_HANDLER_COMMANDS.has(command) || typeof handler !== 'function'
|
|
141
|
+
));
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const isInvalidEngineShape = (engine) => {
|
|
145
|
+
if (!engine || typeof engine !== 'object') return true;
|
|
146
|
+
if (!isValidEngineId(engine.id)) return true;
|
|
147
|
+
if (engine.label !== undefined && !isValidEngineLabel(engine.label)) return true;
|
|
148
|
+
if (engine.listProviders !== undefined && typeof engine.listProviders !== 'function') return true;
|
|
149
|
+
if (isInvalidHandlersShape(engine.handlers)) return true;
|
|
150
|
+
return REQUIRED_ENGINE_METHODS.some((method) => typeof engine[method] !== 'function');
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const engineLabelOf = (engine) => (
|
|
154
|
+
typeof engine.label === 'string' && engine.label.length > 0 ? engine.label : engine.id
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
export const engineCommandsOf = (engine) => Object.keys(engine?.handlers ?? {}).sort();
|
|
158
|
+
|
|
159
|
+
const isRecord = (value) => Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
160
|
+
|
|
161
|
+
const isValidListRow = (row) => {
|
|
162
|
+
if (!isRecord(row) || !isRecord(row.session)) return false;
|
|
163
|
+
if (typeof row.session.id !== 'string' || row.session.id.length === 0) return false;
|
|
164
|
+
return Number.isFinite(row.session.createdAt)
|
|
165
|
+
&& Number.isFinite(row.session.updatedAt)
|
|
166
|
+
&& Number.isFinite(row.updatedAt);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const isValidProviderRow = (provider) => isRecord(provider)
|
|
170
|
+
&& typeof provider.id === 'string'
|
|
171
|
+
&& typeof provider.label === 'string'
|
|
172
|
+
&& typeof provider.authenticated === 'boolean'
|
|
173
|
+
&& Array.isArray(provider.models);
|
|
174
|
+
|
|
175
|
+
const extractProviderRows = (result) => {
|
|
176
|
+
if (Array.isArray(result)) return result;
|
|
177
|
+
if (isRecord(result) && Array.isArray(result.providers)) return result.providers;
|
|
178
|
+
return undefined;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @typedef {object} SessionEngineHost
|
|
183
|
+
* @property {(event: string, payload: object | undefined, sessionId: string, directory: string) => void} publish
|
|
184
|
+
* Engine-facing publish wrapper. `directory` is required and must be an
|
|
185
|
+
* absolute path; it is passed through as-is and never falls back to Pi's
|
|
186
|
+
* active project. Engine events share the daemon's global
|
|
187
|
+
* sequence, stream epoch, and replay log. The wrapper redacts attachment
|
|
188
|
+
* paths and strips `sessionId` / `directory` keys from the payload so an
|
|
189
|
+
* engine cannot spoof them. `session.input` summaries are accepted only
|
|
190
|
+
* from the engine that owns the session (the registry binds the
|
|
191
|
+
* publishing engine id before routing).
|
|
192
|
+
* @property {(attachments: Array<object> | undefined) => Promise<{ text: string, images: Array<object>, files: Array<object> }>} prepareAttachments
|
|
193
|
+
* Same attachment preparation Pi prompts use: validates the shape,
|
|
194
|
+
* reads image bytes as base64 `images`, and turns other files into
|
|
195
|
+
* `[Attachment <name> is available at <path>]` text lines alongside
|
|
196
|
+
* path-free `files` metadata (`{ mime, filename }`). The returned `text`
|
|
197
|
+
* and `images` contain server-local paths and file bytes and must go
|
|
198
|
+
* only to the native agent, never into published events or results;
|
|
199
|
+
* router redaction still covers events and results as a backstop.
|
|
200
|
+
* `files` is path-free metadata safe to publish.
|
|
201
|
+
* @property {string} streamEpoch Opaque stream-lifetime id of the daemon process.
|
|
202
|
+
* @property {string} agentDir Server-side Pi agent directory.
|
|
203
|
+
* @property {string} dataDir PiChamber data root.
|
|
204
|
+
* @property {(engineId: string, event: string, error: unknown) => void} logger
|
|
205
|
+
* Sanitizing logger: only the engine id, event name, and stable error
|
|
206
|
+
* code are recorded, never messages or payloads.
|
|
207
|
+
* @property {(code: string, message: string) => Error} createError Builds a
|
|
208
|
+
* daemon protocol error with the given stable code.
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @typedef {object} SessionEngine
|
|
213
|
+
* @property {string} id Engine id (`isValidEngineId`; never `'pi'`).
|
|
214
|
+
* @property {string} [label] Optional display label (non-empty, at most 64
|
|
215
|
+
* characters; defaults to the id).
|
|
216
|
+
* @property {(sessionId: string, directory?: string) => boolean} ownsSession
|
|
217
|
+
* Sync and cheap, answered from the engine's own index.
|
|
218
|
+
* @property {(providerId: string) => boolean} ownsProvider Sync ownership check.
|
|
219
|
+
* @property {(directory: string, options?: { signal?: AbortSignal }) => Promise<Array<object>>} listSessions
|
|
220
|
+
* Async rows in Pi's list-row shape. Must THROW on failure so the listing
|
|
221
|
+
* reports the engine in `failed` instead of empty success. Receives an
|
|
222
|
+
* AbortSignal aborted when the per-engine timeout fires. Output is
|
|
223
|
+
* redacted in core before it reaches the wire.
|
|
224
|
+
* @property {((options?: { signal?: AbortSignal }) => Promise<object>) | undefined} [listProviders] Optional
|
|
225
|
+
* async Pi provider shape (`{ providers: [...] }` or a bare array).
|
|
226
|
+
* Receives an AbortSignal aborted when the per-engine timeout fires.
|
|
227
|
+
* @property {Record<string, (payload: object) => Promise<object | undefined>>} handlers
|
|
228
|
+
* Handler map for session-scoped commands. Keys must belong to
|
|
229
|
+
* `ENGINE_HANDLER_COMMANDS` (the routed session commands plus
|
|
230
|
+
* `sessions.create`); values must be functions. Detail commands
|
|
231
|
+
* (open/messages/navigate/fork/clone/create) return a Pi-shaped detail
|
|
232
|
+
* (`{ session, messages, lastSequence, ... }`); prompt/steer/followUp
|
|
233
|
+
* return `{ messageId }`; others return a result object or undefined.
|
|
234
|
+
* A routed command with no handler fails as
|
|
235
|
+
* `ENGINE_UNSUPPORTED_OPERATION` automatically. Engines own their own
|
|
236
|
+
* event publication (e.g. `session.deleted` after delete,
|
|
237
|
+
* `session.updated` after rename). An engine publishing its own live
|
|
238
|
+
* user start publishes `assistant.message.start` with `role: 'user'` and
|
|
239
|
+
* includes the `files` metadata from `host.prepareAttachments` as
|
|
240
|
+
* path-free `file` parts
|
|
241
|
+
* (`{ type: 'file', id: `${messageId}:file:${index}`, index, mime, filename }`),
|
|
242
|
+
* the same shape Pi uses, so the browser shows the attachment footer
|
|
243
|
+
* immediately.
|
|
244
|
+
* @property {(sessionId: string) => object | undefined} snapshot SYNC
|
|
245
|
+
* snapshot payload fields, or undefined when unavailable (never an empty
|
|
246
|
+
* session). Must include an absolute `directory`; a snapshot without one
|
|
247
|
+
* is treated as unavailable. Output is redacted in core.
|
|
248
|
+
* @property {() => Promise<void>} dispose Async teardown.
|
|
249
|
+
*/
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @typedef {object} SessionEngineRegistry
|
|
253
|
+
* @property {number} size Number of registered engines.
|
|
254
|
+
* @property {(id: string) => SessionEngine | undefined} get
|
|
255
|
+
* @property {(sessionId: string, directory?: string) => SessionEngine | undefined} ownerOfSession
|
|
256
|
+
* @property {(providerId: string) => SessionEngine | undefined} ownerOfProvider
|
|
257
|
+
* @property {(directory: string) => Promise<{ items: Array<object>, failed: Array<string> }>} listSessions
|
|
258
|
+
* @property {() => Promise<{ providers: Array<object>, failed: Array<string> }>} listProviders
|
|
259
|
+
* @property {() => Array<{ id: string, label: string, commands: Array<string> }>} describeEngines
|
|
260
|
+
* @property {() => Promise<void>} disposeAll
|
|
261
|
+
*/
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Build the engine registry from an ordered list of factories. Each factory
|
|
265
|
+
* runs as `factory(host)` in registration order; ownership follows that
|
|
266
|
+
* order (first owner wins). A factory that throws is isolated (logged and
|
|
267
|
+
* skipped) so the daemon still starts; a duplicate id or invalid id/shape
|
|
268
|
+
* (including an unknown handler key, a non-function handler, a missing
|
|
269
|
+
* `handlers` object, or an invalid label) is a programming error that
|
|
270
|
+
* throws `INVALID_ENGINE` after best-effort disposal of already-created
|
|
271
|
+
* engines.
|
|
272
|
+
*
|
|
273
|
+
* Listing calls share one in-flight result per directory (sessions) or one
|
|
274
|
+
* global result (providers) across concurrent callers; the entry clears
|
|
275
|
+
* when it settles and failures are never cached beyond the flight. Each
|
|
276
|
+
* engine call receives an AbortSignal aborted when its per-engine timeout
|
|
277
|
+
* fires so a hung engine can stop its work. Returned rows are redacted
|
|
278
|
+
* through `redact` before attribution.
|
|
279
|
+
*
|
|
280
|
+
* @param {{ factories?: Array<(host: SessionEngineHost) => SessionEngine | Promise<SessionEngine>>, host: SessionEngineHost, logger?: (engineId: string, event: string, code: string) => void, listTimeoutMs?: number, redact: (value: unknown) => unknown }} [options]
|
|
281
|
+
* @returns {Promise<SessionEngineRegistry>}
|
|
282
|
+
*/
|
|
283
|
+
export const createSessionEngineRegistry = async ({
|
|
284
|
+
factories = [],
|
|
285
|
+
host,
|
|
286
|
+
logger,
|
|
287
|
+
listTimeoutMs = 10_000,
|
|
288
|
+
redact,
|
|
289
|
+
} = {}) => {
|
|
290
|
+
const log = typeof logger === 'function' ? logger : undefined;
|
|
291
|
+
// Redaction is mandatory: engine output never reaches the wire unredacted.
|
|
292
|
+
if (typeof redact !== 'function') throw new TypeError('Session engine output requires a redact function.');
|
|
293
|
+
const applyRedact = redact;
|
|
294
|
+
const engines = [];
|
|
295
|
+
const byId = new Map();
|
|
296
|
+
|
|
297
|
+
const disposeCreated = async () => {
|
|
298
|
+
for (const created of engines) {
|
|
299
|
+
try {
|
|
300
|
+
await created.dispose();
|
|
301
|
+
} catch (error) {
|
|
302
|
+
logSessionEngineError(log, created.id, 'dispose-failed', error);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
for (const factory of factories) {
|
|
308
|
+
// Each engine receives its own host whose publish carries that engine's
|
|
309
|
+
// id to the router, so `session.input` summaries are accepted only from
|
|
310
|
+
// the owning engine. The id cell is filled once the factory returns;
|
|
311
|
+
// publishes after registration carry the id, while a publish during
|
|
312
|
+
// factory execution (before the id is known) fails ownership as unknown.
|
|
313
|
+
let boundEngineId;
|
|
314
|
+
const perEngineHost = host && typeof host === 'object'
|
|
315
|
+
? {
|
|
316
|
+
...host,
|
|
317
|
+
publish: (event, payload, sessionId, directory) => host.publish(event, payload, sessionId, directory, boundEngineId),
|
|
318
|
+
}
|
|
319
|
+
: host;
|
|
320
|
+
let engine;
|
|
321
|
+
try {
|
|
322
|
+
engine = await factory(perEngineHost);
|
|
323
|
+
} catch (error) {
|
|
324
|
+
logSessionEngineError(log, 'unknown', 'factory-failed', error);
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
boundEngineId = engine?.id;
|
|
328
|
+
if (isInvalidEngineShape(engine) || byId.has(engine.id)) {
|
|
329
|
+
await disposeCreated();
|
|
330
|
+
throw invalidEngineError('The session engine registration is invalid.');
|
|
331
|
+
}
|
|
332
|
+
byId.set(engine.id, engine);
|
|
333
|
+
engines.push(engine);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const ownerOf = (id, directory, check) => {
|
|
337
|
+
if (typeof id !== 'string' || id.length === 0) return undefined;
|
|
338
|
+
for (const engine of engines) {
|
|
339
|
+
try {
|
|
340
|
+
if (check(engine, directory)) return engine;
|
|
341
|
+
} catch (error) {
|
|
342
|
+
logSessionEngineError(log, engine.id, 'owns-failed', error);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
return undefined;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
const callWithTimeout = (engine, event, invoke) => {
|
|
349
|
+
const controller = typeof AbortController === 'function' ? new AbortController() : undefined;
|
|
350
|
+
let timer;
|
|
351
|
+
const timeout = new Promise((_, reject) => {
|
|
352
|
+
timer = setTimeout(() => {
|
|
353
|
+
try {
|
|
354
|
+
controller?.abort();
|
|
355
|
+
} catch {}
|
|
356
|
+
const error = new Error('The session engine listing timed out.');
|
|
357
|
+
error.code = 'ENGINE_TIMEOUT';
|
|
358
|
+
reject(error);
|
|
359
|
+
}, listTimeoutMs);
|
|
360
|
+
});
|
|
361
|
+
const task = Promise.resolve().then(() => invoke(controller?.signal));
|
|
362
|
+
return Promise.race([task, timeout]).finally(() => clearTimeout(timer));
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
const listSessionsUnshared = async (directory) => {
|
|
366
|
+
const settled = await Promise.allSettled(engines.map((engine) => callWithTimeout(
|
|
367
|
+
engine,
|
|
368
|
+
'list-failed',
|
|
369
|
+
(signal) => engine.listSessions(directory, { signal }),
|
|
370
|
+
)));
|
|
371
|
+
const items = [];
|
|
372
|
+
const failed = [];
|
|
373
|
+
settled.forEach((outcome, index) => {
|
|
374
|
+
const engine = engines[index];
|
|
375
|
+
if (outcome.status !== 'fulfilled' || !Array.isArray(outcome.value) || !outcome.value.every(isValidListRow)) {
|
|
376
|
+
logSessionEngineError(log, engine.id, 'list-failed', outcome.status === 'rejected' ? outcome.reason : invalidEngineError('The session engine returned an invalid listing.'));
|
|
377
|
+
failed.push(engine.id);
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
for (const row of outcome.value) {
|
|
381
|
+
const redacted = applyRedact(row);
|
|
382
|
+
const safeRow = isRecord(redacted) ? redacted : row;
|
|
383
|
+
const safeSession = isRecord(safeRow.session) ? safeRow.session : row.session;
|
|
384
|
+
items.push({ ...safeRow, session: { ...safeSession, directory, engine: engine.id } });
|
|
385
|
+
}
|
|
386
|
+
});
|
|
387
|
+
return { items, failed };
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
const listProvidersUnshared = async () => {
|
|
391
|
+
const contributing = engines.filter((engine) => typeof engine.listProviders === 'function');
|
|
392
|
+
const settled = await Promise.allSettled(contributing.map((engine) => callWithTimeout(
|
|
393
|
+
engine,
|
|
394
|
+
'list-failed',
|
|
395
|
+
(signal) => engine.listProviders({ signal }),
|
|
396
|
+
)));
|
|
397
|
+
const providers = [];
|
|
398
|
+
const failed = [];
|
|
399
|
+
settled.forEach((outcome, index) => {
|
|
400
|
+
const engine = contributing[index];
|
|
401
|
+
const rows = outcome.status === 'fulfilled' ? extractProviderRows(outcome.value) : undefined;
|
|
402
|
+
if (!rows || !rows.every(isValidProviderRow)) {
|
|
403
|
+
logSessionEngineError(log, engine.id, 'list-failed', outcome.status === 'rejected' ? outcome.reason : invalidEngineError('The session engine returned invalid providers.'));
|
|
404
|
+
failed.push(engine.id);
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
// Stamped for merge attribution; the daemon strips it before
|
|
408
|
+
// responding so the provider wire shape stays Pi-shaped.
|
|
409
|
+
for (const provider of rows) {
|
|
410
|
+
const redacted = applyRedact(provider);
|
|
411
|
+
const safeProvider = isRecord(redacted) ? redacted : provider;
|
|
412
|
+
providers.push({ ...safeProvider, engine: engine.id });
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
return { providers, failed };
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
const listSessionsInflightByDirectory = new Map();
|
|
419
|
+
let listProvidersInflight = null;
|
|
420
|
+
|
|
421
|
+
return {
|
|
422
|
+
get size() {
|
|
423
|
+
return engines.length;
|
|
424
|
+
},
|
|
425
|
+
get: (id) => byId.get(id),
|
|
426
|
+
ownerOfSession: (sessionId, directory) => ownerOf(sessionId, directory,
|
|
427
|
+
(engine, engineDirectory) => engine.ownsSession(sessionId, engineDirectory)),
|
|
428
|
+
ownerOfProvider: (providerId) => ownerOf(providerId, undefined,
|
|
429
|
+
(engine) => engine.ownsProvider(providerId)),
|
|
430
|
+
listSessions: async (directory) => {
|
|
431
|
+
const cached = listSessionsInflightByDirectory.get(directory);
|
|
432
|
+
if (cached) return cached;
|
|
433
|
+
const pending = listSessionsUnshared(directory).finally(() => {
|
|
434
|
+
if (listSessionsInflightByDirectory.get(directory) === pending) listSessionsInflightByDirectory.delete(directory);
|
|
435
|
+
});
|
|
436
|
+
listSessionsInflightByDirectory.set(directory, pending);
|
|
437
|
+
return pending;
|
|
438
|
+
},
|
|
439
|
+
listProviders: async () => {
|
|
440
|
+
if (listProvidersInflight) return listProvidersInflight;
|
|
441
|
+
const pending = listProvidersUnshared().finally(() => {
|
|
442
|
+
if (listProvidersInflight === pending) listProvidersInflight = null;
|
|
443
|
+
});
|
|
444
|
+
listProvidersInflight = pending;
|
|
445
|
+
return pending;
|
|
446
|
+
},
|
|
447
|
+
describeEngines: () => engines.map((engine) => ({
|
|
448
|
+
id: engine.id,
|
|
449
|
+
label: engineLabelOf(engine),
|
|
450
|
+
commands: engineCommandsOf(engine),
|
|
451
|
+
})),
|
|
452
|
+
disposeAll: async () => {
|
|
453
|
+
const errors = [];
|
|
454
|
+
for (const engine of engines) {
|
|
455
|
+
try {
|
|
456
|
+
await engine.dispose();
|
|
457
|
+
} catch (error) {
|
|
458
|
+
logSessionEngineError(log, engine.id, 'dispose-failed', error);
|
|
459
|
+
errors.push(error);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
if (errors.length > 0) {
|
|
463
|
+
throw new AggregateError(errors, 'One or more session engines could not be disposed.');
|
|
464
|
+
}
|
|
465
|
+
},
|
|
466
|
+
};
|
|
467
|
+
};
|