@aiworker/web 1.22.0 → 1.23.0
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 +4 -4
- package/bin/cli.js +14 -4
- package/bin/cli.test.js +165 -73
- package/bin/lib/cli-api-target.js +2 -2
- package/bin/lib/cli-args.js +119 -119
- package/bin/lib/cli-lifecycle.js +9 -9
- package/bin/lib/cli-network.js +3 -3
- package/bin/lib/cli-paths.js +3 -3
- package/bin/lib/cli-ports.js +2 -2
- package/bin/lib/cli-process.js +4 -4
- package/bin/lib/cli-startup.js +64 -15
- package/bin/lib/cli-tunnel-profiles.js +1 -1
- package/bin/lib/cli-tunnel-utils.js +2 -2
- package/bin/lib/commands-connect-url.js +19 -19
- package/bin/lib/commands-lifecycle.js +27 -27
- package/bin/lib/commands-logs.js +5 -5
- package/bin/lib/commands-models.js +1 -1
- package/bin/lib/commands-projects.js +1 -1
- package/bin/lib/commands-schedule.js +1 -1
- package/bin/lib/commands-serve.js +29 -29
- package/bin/lib/commands-session.js +1 -1
- package/bin/lib/commands-startup.js +45 -10
- package/bin/lib/commands-status.js +1 -1
- package/bin/lib/commands-tunnel.js +40 -40
- package/bin/lib/commands-update.js +1 -1
- package/bin/lib/commands-update.test.js +6 -6
- package/dist/assets/{CodeMirrorCommentWidgets-B3u7UIcE.js → CodeMirrorCommentWidgets-B1Gizi3a.js} +1 -1
- package/dist/assets/DiffView-DXjVsEOw.js +4 -0
- package/dist/assets/DirtyBranchSwitchDialog-aig6zJjg.js +1 -0
- package/dist/assets/FilesView-CJdG0-wk.js +17 -0
- package/dist/assets/GitView-BXsS3jG6.js +6 -0
- package/dist/assets/{JsonTreeView-B0BdZEHG.js → JsonTreeView-D_hpXBnF.js} +1 -1
- package/dist/assets/LinearIssuesView-BoUiLQG1.js +1 -0
- package/dist/assets/MarkdownImageGallery-B_B_a9KS.js +1 -0
- package/dist/assets/MarkdownRendererImpl-xgyyLiBM.js +12 -0
- package/dist/assets/OnboardingScreen-DIp84OWt.js +1 -0
- package/dist/assets/{PatchDiff-DvfqDql7.js → PatchDiff-8p6nLJaU.js} +1 -1
- package/dist/assets/PierreDiffViewer-DjC8nTk9.js +161 -0
- package/dist/assets/PlanView-CJTmOF6I.js +5 -0
- package/dist/assets/SettingsView-DD-JqIJx.js +28 -0
- package/dist/assets/{SettingsWindow-i45U1Cy1.js → SettingsWindow-Cpb4hM6q.js} +1 -1
- package/dist/assets/SymbolsNerdFontMono-Regular-aK5vsLov.woff2 +0 -0
- package/dist/assets/{ToolOutputDialog-BTwyh5OF.js → ToolOutputDialog-DfaKZXNU.js} +6 -6
- package/dist/assets/ToolPartDiffPreview-DtZLzrSK.js +8 -0
- package/dist/assets/{VirtualizedFileDiff-DD8lDVej.js → VirtualizedFileDiff-C8i9HpTB.js} +1 -1
- package/dist/assets/WalkthroughView-DeKMvZlL.js +4 -0
- package/dist/assets/{computeVirtualFileMetrics-BMIRgMHv.js → computeVirtualFileMetrics-BBI7ZwrC.js} +2 -2
- package/dist/assets/contextPanelEmbeddedChat-BdA6bdky.js +1 -0
- package/dist/assets/de-DCrsQ5zS.js +10 -0
- package/dist/assets/es-Dwv4YfH6.js +16 -0
- package/dist/assets/fr-BCWg4Cnx.js +14 -0
- package/dist/assets/ghostty-vt-DdA0Zryv.wasm +0 -0
- package/dist/assets/index-B68h5S5B.css +1 -0
- package/dist/assets/index-DVwMarHI.js +39 -0
- package/dist/assets/{index-CODwDsU_.js → index-jXSK5RrB.js} +1 -1
- package/dist/assets/{isDiffPlainText-BqayB8d3.js → isDiffPlainText-B_x_rVon.js} +1 -1
- package/dist/assets/{isFilePlainText-QfoiKJNY.js → isFilePlainText-DW_xMer1.js} +1 -1
- package/dist/assets/ja-Bruw3RYC.js +16 -0
- package/dist/assets/ko-idhXGF8j.js +16 -0
- package/dist/assets/main-BkyaQhJX.js +930 -0
- package/dist/assets/{main-C5DVOxc6.js → main-CzdPuL0s.js} +2 -2
- package/dist/assets/markdownCore-Cn4Tyejo.js +5 -0
- package/dist/assets/{miniChat-DUJ4irZc.js → miniChat-CCkqKOLp.js} +2 -2
- package/dist/assets/{mobile-CcaxB0n4.js → mobile-mvxTo055.js} +2 -2
- package/dist/assets/patchFileDiff-Csk4iNUi.js +13 -0
- package/dist/assets/pl-CGZWUqZJ.js +16 -0
- package/dist/assets/pt-BR-B8V7u7tA.js +16 -0
- package/dist/assets/renderElectronMiniChatApp-BxoyujA5.js +2 -0
- package/dist/assets/renderMobileApp-B48CsP4r.js +25 -0
- package/dist/assets/runtimeEndpointReset-Bg5gx18H.js +17 -0
- package/dist/assets/scheduledTasksApi-BW0Etzwz.js +1 -0
- package/dist/assets/{shikiHighlight-DYOWuY65.js → shikiHighlight-CRl0SUC9.js} +1 -1
- package/dist/assets/surface-oMvhsog3.js +1 -0
- package/dist/assets/tr-BK_KiO2V.js +7 -0
- package/dist/assets/uk-CG74xV8N.js +16 -0
- package/dist/assets/useAppFontEffects-CPKeOpUo.js +7284 -0
- package/dist/assets/useGitComparison-DH220WmO.js +1 -0
- package/dist/assets/useInlineCommentController-BiWz4AVb.js +2 -0
- package/dist/assets/useRootScrollLock-BS4-kr7P.js +1 -0
- package/dist/assets/{vendor-base-ui-BeMD8X_w.js → vendor-base-ui-DdV8vhHn.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-DFZik9R2.js → vendor-codemirror-language-data-Bg4AEeCr.js} +2 -2
- package/dist/assets/vendor-zod-BPAANqvH.js +39 -0
- package/dist/assets/{web-components-Bhg83tjf.js → web-components-z7hfnS8n.js} +1 -1
- package/dist/assets/zh-CN-T4AXofZI.js +16 -0
- package/dist/assets/zh-TW-Dte40sxp.js +16 -0
- package/dist/index.html +21 -59
- package/dist/mini-chat.html +7 -7
- package/dist/mobile.html +5 -5
- package/package.json +3 -4
- package/server/index.d.ts +15 -0
- package/server/index.js +158 -89
- package/server/lib/agent-memory/actions.js +2 -2
- package/server/lib/agent-memory/feature-flag.js +1 -1
- package/server/lib/agent-memory/feature-flag.test.js +8 -8
- package/server/lib/agent-memory/routes.js +2 -2
- package/server/lib/agent-tool/runtime.js +37 -54
- package/server/lib/agent-tool/runtime.test.js +59 -59
- package/server/lib/browser-control/broker.js +3 -3
- package/server/lib/browser-control/broker.test.js +1 -1
- package/server/lib/changelog/update-notes.js +82 -0
- package/server/lib/changelog/update-notes.test.js +59 -0
- package/server/lib/client-auth/remote-clients.test.js +5 -5
- package/server/lib/context-obligatory/runtime.js +7 -7
- package/server/lib/context-obligatory/runtime.test.js +5 -5
- package/server/lib/data-dir-migration.js +40 -0
- package/server/lib/data-dir-migration.test.js +59 -0
- package/server/lib/dev-servers/parse.js +2 -2
- package/server/lib/dev-servers/parse.test.js +2 -2
- package/server/lib/dev-servers/routes.js +1 -1
- package/server/lib/dev-tunnel/DOCUMENTATION.md +13 -4
- package/server/lib/dev-tunnel/client.js +1 -1
- package/server/lib/dev-tunnel/runtime.js +5 -5
- package/server/lib/dev-tunnel/tunnel.test.js +21 -1
- package/server/lib/dictation/local/model-catalog.js +1 -1
- package/server/lib/dictation/local/worker-process.js +2 -2
- package/server/lib/event-stream/directory-ws-bridge.js +1 -1
- package/server/lib/event-stream/global-ws-bridge.js +1 -1
- package/server/lib/event-stream/protocol.test.js +4 -4
- package/server/lib/event-stream/runtime.test.js +18 -18
- package/server/lib/fs/DOCUMENTATION.md +5 -0
- package/server/lib/fs/routes.js +68 -26
- package/server/lib/fs/routes.test.js +208 -22
- package/server/lib/git/DOCUMENTATION.md +32 -6
- package/server/lib/git/identity-storage.js +1 -1
- package/server/lib/git/issue-2746-longpaths.test.js +4 -4
- package/server/lib/git/routes.js +41 -5
- package/server/lib/git/service.js +300 -224
- package/server/lib/git/service.test.js +596 -28
- package/server/lib/github/auth.js +8 -8
- package/server/lib/github/pr-status.js +1 -1
- package/server/lib/github/routes.js +2 -2
- package/server/lib/inherited-env.js +17 -10
- package/server/lib/inherited-env.test.js +10 -11
- package/server/lib/linear/auth.js +8 -8
- package/server/lib/linear/auth.test.js +24 -24
- package/server/lib/linear/issues.test.js +6 -6
- package/server/lib/linear/mapping.test.js +4 -4
- package/server/lib/linear/oauth.js +2 -2
- package/server/lib/linear/oauth.test.js +14 -14
- package/server/lib/linear/routes.js +5 -5
- package/server/lib/linear/routes.test.js +16 -16
- package/server/lib/linear/status-runtime.test.js +9 -9
- package/server/lib/linear/status.js +1 -1
- package/server/lib/linear/status.test.js +15 -15
- package/server/lib/linear/teams.test.js +4 -4
- package/server/lib/magic-prompts/routes.js +2 -2
- package/server/lib/mcp-reconnect/DOCUMENTATION.md +55 -0
- package/server/lib/mcp-reconnect/runtime.js +122 -0
- package/server/lib/mcp-reconnect/runtime.test.js +140 -0
- package/server/lib/message-queue/DOCUMENTATION.md +161 -0
- package/server/lib/message-queue/runtime.js +870 -0
- package/server/lib/message-queue/runtime.test.js +482 -0
- package/server/lib/network-defaults.js +23 -0
- package/server/lib/network-defaults.test.js +52 -0
- package/server/lib/notifications/apns-runtime.js +17 -17
- package/server/lib/notifications/apns-runtime.test.js +11 -11
- package/server/lib/notifications/emitter-runtime.js +1 -1
- package/server/lib/notifications/emitter-runtime.test.js +1 -1
- package/server/lib/notifications/push-runtime.js +7 -7
- package/server/lib/notifications/routes.js +1 -1
- package/server/lib/notifications/runtime.js +1 -1
- package/server/lib/openchamber-control/action-resolution.test.js +10 -10
- package/server/lib/openchamber-control/actions.js +24 -24
- package/server/lib/openchamber-control/error.js +4 -4
- package/server/lib/openchamber-control/routes.js +2 -2
- package/server/lib/openchamber-control/routes.test.js +5 -5
- package/server/lib/openchamber-control/screenshots.js +1 -1
- package/server/lib/openchamber-control/screenshots.test.js +1 -1
- package/server/lib/openchamber-control/service.js +50 -50
- package/server/lib/openchamber-control/service.test.js +5 -5
- package/server/lib/openchamber-sessions/routes.js +124 -22
- package/server/lib/openchamber-sessions/routes.test.js +99 -11
- package/server/lib/opencode/DOCUMENTATION.md +30 -6
- package/server/lib/opencode/auth.js +1 -1
- package/server/lib/opencode/bootstrap-runtime.js +8 -6
- package/server/lib/opencode/cli-options.js +8 -8
- package/server/lib/opencode/config-paths.test.js +116 -0
- package/server/lib/opencode/core-routes.js +8 -7
- package/server/lib/opencode/core-routes.test.js +11 -11
- package/server/lib/opencode/env-config.js +5 -5
- package/server/lib/opencode/env-config.test.js +7 -7
- package/server/lib/opencode/env-runtime.js +10 -10
- package/server/lib/opencode/env-runtime.test.js +18 -18
- package/server/lib/opencode/feature-routes-runtime.js +19 -12
- package/server/lib/opencode/hmr-state-runtime.js +2 -2
- package/server/lib/opencode/hmr-state-runtime.test.js +1 -1
- package/server/lib/opencode/input-history-scope.js +14 -0
- package/server/lib/opencode/lifecycle.js +8 -8
- package/server/lib/opencode/lifecycle.test.js +4 -4
- package/server/lib/opencode/managed-plugin-config.js +35 -0
- package/server/lib/opencode/managed-process-registry.js +3 -3
- package/server/lib/opencode/mcp-oauth-callback.test.js +2 -2
- package/server/lib/opencode/openchamber-routes.js +79 -19
- package/server/lib/opencode/openchamber-routes.test.js +139 -12
- package/server/lib/opencode/plugins.js +2 -2
- package/server/lib/opencode/plugins.test.js +1 -1
- package/server/lib/opencode/project-icon-routes.js +2 -2
- package/server/lib/opencode/project-icon-routes.test.js +1 -1
- package/server/lib/opencode/providers.js +44 -2
- package/server/lib/opencode/providers.test.js +131 -4
- package/server/lib/opencode/proxy.js +2 -2
- package/server/lib/opencode/pwa-manifest-routes.js +1 -1
- package/server/lib/opencode/restart-session-recovery.test.js +1 -1
- package/server/lib/opencode/routes-upgrade.test.js +4 -4
- package/server/lib/opencode/routes.js +19 -17
- package/server/lib/opencode/server-startup-runtime.js +6 -6
- package/server/lib/opencode/session-runtime.js +3 -3
- package/server/lib/opencode/session-runtime.test.js +6 -6
- package/server/lib/opencode/settings-files.js +214 -0
- package/server/lib/opencode/settings-helpers.js +116 -44
- package/server/lib/opencode/settings-helpers.test.js +354 -12
- package/server/lib/opencode/settings-registry.json +747 -0
- package/server/lib/opencode/settings-runtime.js +141 -20
- package/server/lib/opencode/settings-runtime.test.js +191 -4
- package/server/lib/opencode/shared.js +5 -2
- package/server/lib/opencode/shared.test.js +7 -7
- package/server/lib/opencode/shutdown-runtime.js +2 -0
- package/server/lib/opencode/skill-routes.js +2 -1
- package/server/lib/opencode/snippets.js +1 -2
- package/server/lib/opencode/startup-performance.js +1 -1
- package/server/lib/opencode/startup-performance.test.js +6 -6
- package/server/lib/opencode/static-routes-runtime.js +8 -8
- package/server/lib/opencode/static-routes-runtime.test.js +7 -7
- package/server/lib/opencode/upgrade-capability.js +2 -2
- package/server/lib/opencode/upgrade-capability.test.js +3 -3
- package/server/lib/package-manager.js +17 -42
- package/server/lib/package-manager.test.js +19 -19
- package/server/lib/permission-auto-accept/runtime.js +1 -1
- package/server/lib/project-context/DOCUMENTATION.md +25 -1
- package/server/lib/project-context/routes.http.test.js +18 -0
- package/server/lib/project-context/routes.js +16 -1
- package/server/lib/project-context/runtime.js +248 -23
- package/server/lib/project-context/runtime.test.js +106 -3
- package/server/lib/projects/DOCUMENTATION.md +76 -0
- package/server/lib/projects/project-config.js +144 -11
- package/server/lib/projects/project-id.js +17 -0
- package/server/lib/projects/project-setup.js +409 -0
- package/server/lib/projects/project-setup.test.js +557 -0
- package/server/lib/projects/routes.js +59 -0
- package/server/lib/quota/DOCUMENTATION.md +40 -2
- package/server/lib/quota/credentials/providers.js +4 -0
- package/server/lib/quota/credentials/store.js +4 -4
- package/server/lib/quota/credentials/store.test.js +8 -8
- package/server/lib/quota/index.js +1 -0
- package/server/lib/quota/providers/cline-pass.js +125 -0
- package/server/lib/quota/providers/cline-pass.test.js +103 -0
- package/server/lib/quota/providers/exe-dev.js +75 -0
- package/server/lib/quota/providers/exe-dev.test.js +47 -0
- package/server/lib/quota/providers/hyper.js +118 -0
- package/server/lib/quota/providers/hyper.test.js +126 -0
- package/server/lib/quota/providers/index.js +22 -0
- package/server/lib/quota/providers/neuralwatt.js +3 -6
- package/server/lib/quota/providers/neuralwatt.test.js +7 -7
- package/server/lib/quota/providers/ollama-cloud.js +32 -1
- package/server/lib/quota/providers/ollama-cloud.test.js +33 -1
- package/server/lib/quota/providers/opencode-go.js +3 -2
- package/server/lib/quota/providers/opencode-go.test.js +35 -6
- package/server/lib/quota/providers/openrouter.js +119 -24
- package/server/lib/quota/providers/openrouter.test.js +330 -0
- package/server/lib/quota/providers/xai.js +1 -1
- package/server/lib/quota/routes.js +2 -0
- package/server/lib/quota/utils/auth.js +1 -1
- package/server/lib/relay/DOCUMENTATION.md +56 -1
- package/server/lib/relay/cross-compat.test.js +26 -0
- package/server/lib/relay/downstream-scheduler.js +154 -0
- package/server/lib/relay/downstream-scheduler.test.js +162 -0
- package/server/lib/relay/e2ee.js +10 -8
- package/server/lib/relay/flow-control.test.js +177 -0
- package/server/lib/relay/host-client.js +38 -9
- package/server/lib/relay/host-client.test.js +9 -1
- package/server/lib/relay/host-lock.js +1 -1
- package/server/lib/relay/service.js +5 -5
- package/server/lib/relay/tunnel-codec.js +9 -0
- package/server/lib/relay/tunnel-host.js +69 -18
- package/server/lib/relay/tunnel-host.test.js +9 -1
- package/server/lib/scheduled-tasks/issue-2710-double-execution.test.js +2 -2
- package/server/lib/scheduled-tasks/routes.js +5 -5
- package/server/lib/scheduled-tasks/service.js +25 -25
- package/server/lib/scheduled-tasks/service.test.js +1 -1
- package/server/lib/security/bind-host.js +4 -4
- package/server/lib/security/bind-host.test.js +1 -1
- package/server/lib/security/request-security.js +11 -5
- package/server/lib/security/request-security.test.js +14 -14
- package/server/lib/session-assist/runtime.js +15 -18
- package/server/lib/session-folders/routes.js +2 -2
- package/server/lib/session-folders/routes.test.js +8 -8
- package/server/lib/session-goal/DOCUMENTATION.md +20 -7
- package/server/lib/session-goal/create.js +4 -2
- package/server/lib/session-goal/create.test.js +1 -1
- package/server/lib/session-goal/objectives.js +4 -4
- package/server/lib/session-goal/routes.js +1 -1
- package/server/lib/session-goal/runtime.js +91 -30
- package/server/lib/session-goal/runtime.test.js +428 -2
- package/server/lib/session-knowledge/runtime.js +11 -11
- package/server/lib/session-knowledge/runtime.test.js +5 -5
- package/server/lib/skills-catalog/DOCUMENTATION.md +1 -1
- package/server/lib/skills-catalog/cache.test.js +2 -2
- package/server/lib/skills-catalog/disk-cache.js +5 -5
- package/server/lib/skills-catalog/github-meta.test.js +2 -2
- package/server/lib/skills-catalog/install.js +3 -2
- package/server/lib/small-model/DOCUMENTATION.md +7 -2
- package/server/lib/small-model/call.js +18 -7
- package/server/lib/small-model/call.test.js +58 -6
- package/server/lib/small-model/index.js +12 -16
- package/server/lib/small-model/index.test.js +1 -1
- package/server/lib/small-model/resolve.js +1 -1
- package/server/lib/small-model/resolve.test.js +1 -1
- package/server/lib/small-model/routes.js +2 -1
- package/server/lib/small-model/runtime-providers.js +15 -7
- package/server/lib/small-model/runtime-providers.test.js +7 -1
- package/server/lib/system-prompt/runtime.js +3 -22
- package/server/lib/system-prompt/runtime.test.js +3 -3
- package/server/lib/terminal/DOCUMENTATION.md +14 -10
- package/server/lib/terminal/runtime.js +190 -31
- package/server/lib/terminal/runtime.test.js +572 -38
- package/server/lib/terminal/shells.js +20 -3
- package/server/lib/terminal/shells.test.js +33 -2
- package/server/lib/tts/base-url.js +3 -3
- package/server/lib/tts/routes.test.js +20 -20
- package/server/lib/ui-auth/ui-auth.js +12 -9
- package/server/lib/ui-auth/ui-auth.test.js +19 -3
- package/server/lib/ui-auth/ui-passkeys.js +7 -7
- package/server/lib/walkthrough/DOCUMENTATION.md +33 -14
- package/server/lib/walkthrough/index.js +1 -0
- package/server/lib/walkthrough/jobs.test.js +1 -1
- package/server/lib/walkthrough/language.test.js +1 -1
- package/server/lib/walkthrough/model-settings.js +11 -15
- package/server/lib/walkthrough/model-settings.test.js +1 -1
- package/server/lib/walkthrough/prompt.js +3 -1
- package/server/lib/walkthrough/pull-request.test.js +5 -5
- package/server/lib/walkthrough/reproduce-2607.test.js +2 -2
- package/server/lib/walkthrough/routes.test.js +26 -5
- package/server/lib/walkthrough/sources.js +23 -2
- package/server/lib/walkthrough/store.js +3 -3
- package/server/lib/walkthrough/store.test.js +1 -1
- package/server/opencode-proxy.test.js +2 -2
- package/server/proxy-headers.js +1 -1
- package/server/sse-routes.test.js +4 -4
- package/README.md.bak +0 -250
- package/bin/lib/DOCUMENTATION.md.bak +0 -163
- package/dist/assets/CommitSection-SGBCAW0w.js +0 -1
- package/dist/assets/DiffView-DluiRSla.js +0 -4
- package/dist/assets/FilesView-Bdq8ppva.js +0 -17
- package/dist/assets/GitView-Znn7VJcP.js +0 -6
- package/dist/assets/LinearIssuesView-jP-hXyac.js +0 -1
- package/dist/assets/MarkdownImageGallery-ClOvuZxC.js +0 -1
- package/dist/assets/MarkdownRendererImpl-Dt9mjTRN.js +0 -12
- package/dist/assets/OnboardingScreen-D2DG7K6b.js +0 -1
- package/dist/assets/PierreDiffViewer-B7m3f0d7.js +0 -157
- package/dist/assets/PlanView-B0F3BtPZ.js +0 -5
- package/dist/assets/SettingsView-BBW-S-gh.js +0 -28
- package/dist/assets/ToolPartDiffPreview-CUNe28U1.js +0 -8
- package/dist/assets/WalkthroughView-egQgxel3.js +0 -4
- package/dist/assets/contextPanelEmbeddedChat-C3fjDbdg.js +0 -1
- package/dist/assets/de-C1P6X5Rs.js +0 -9
- package/dist/assets/es-CDgaF1_t.js +0 -15
- package/dist/assets/fr-Bgxqvvz_.js +0 -13
- package/dist/assets/index-C57jT0Sa.css +0 -1
- package/dist/assets/index-DW_E3rnL.js +0 -7
- package/dist/assets/ja-BDRrEcNP.js +0 -15
- package/dist/assets/ko-Ba8sQV79.js +0 -15
- package/dist/assets/main-Bv5Pkngh.js +0 -928
- package/dist/assets/markdownCore-CZwzz5gw.js +0 -3
- package/dist/assets/patchFileDiff-yNfWXN4E.js +0 -10
- package/dist/assets/pl-Dioz29BI.js +0 -15
- package/dist/assets/pt-BR-DIs6ElwV.js +0 -15
- package/dist/assets/renderElectronMiniChatApp-BcKLHXKe.js +0 -2
- package/dist/assets/renderMobileApp-D9yQJy0L.js +0 -25
- package/dist/assets/runtimeEndpointReset-CjhvxLH0.js +0 -16
- package/dist/assets/scheduledTasksApi-DLW0mkQK.js +0 -1
- package/dist/assets/tr-DFnMlPxY.js +0 -6
- package/dist/assets/uk-ZrCNjM7Y.js +0 -15
- package/dist/assets/useAppFontEffects-CjrntdL0.js +0 -7310
- package/dist/assets/useInlineCommentController-CDEuSlPH.js +0 -2
- package/dist/assets/useRootScrollLock-BHYPkrLv.js +0 -1
- package/dist/assets/vendor-ghostty-web-CrxinGGH.js +0 -13
- package/dist/assets/vendor-zod-BLfBSgBh.js +0 -39
- package/dist/assets/zh-CN-iv_AV4EC.js +0 -15
- package/dist/assets/zh-TW-CzEUk38j.js +0 -15
- package/server/index.d.ts.bak +0 -39
- package/server/lib/agent-tool/DOCUMENTATION.md.bak +0 -119
- package/server/lib/browser-control/DOCUMENTATION.md.bak +0 -50
- package/server/lib/context-obligatory/DOCUMENTATION.md.bak +0 -19
- package/server/lib/dev-tunnel/DOCUMENTATION.md.bak +0 -57
- package/server/lib/dictation/DOCUMENTATION.md.bak +0 -100
- package/server/lib/event-stream/DOCUMENTATION.md.bak +0 -62
- package/server/lib/fs/DOCUMENTATION.md.bak +0 -47
- package/server/lib/git/DOCUMENTATION.md.bak +0 -193
- package/server/lib/github/DOCUMENTATION.md.bak +0 -183
- package/server/lib/linear/DOCUMENTATION.md.bak +0 -97
- package/server/lib/linear/OAUTH-BROKER-HANDOFF.md.bak +0 -91
- package/server/lib/markdown-image-grants/DOCUMENTATION.md.bak +0 -40
- package/server/lib/notifications/APNS.md.bak +0 -135
- package/server/lib/notifications/DOCUMENTATION.md.bak +0 -138
- package/server/lib/openchamber-control/DOCUMENTATION.md.bak +0 -64
- package/server/lib/opencode/DOCUMENTATION.md.bak +0 -431
- package/server/lib/opencode/managed-process-registry.d.ts.bak +0 -13
- package/server/lib/opencode/provider-env-aliases.d.ts.bak +0 -3
- package/server/lib/permission-auto-accept/DOCUMENTATION.md.bak +0 -34
- package/server/lib/project-context/DOCUMENTATION.md.bak +0 -160
- package/server/lib/quota/DOCUMENTATION.md.bak +0 -123
- package/server/lib/relay/DOCUMENTATION.md.bak +0 -100
- package/server/lib/scheduled-tasks/DOCUMENTATION.md.bak +0 -182
- package/server/lib/session-assist/DOCUMENTATION.md.bak +0 -66
- package/server/lib/session-goal/DOCUMENTATION.md.bak +0 -213
- package/server/lib/session-knowledge/DOCUMENTATION.md.bak +0 -89
- package/server/lib/skills-catalog/DOCUMENTATION.md.bak +0 -151
- package/server/lib/small-model/DOCUMENTATION.md.bak +0 -212
- package/server/lib/system-prompt/DOCUMENTATION.md.bak +0 -36
- package/server/lib/terminal/DOCUMENTATION.md.bak +0 -50
- package/server/lib/text/DOCUMENTATION.md.bak +0 -35
- package/server/lib/tts/DOCUMENTATION.md.bak +0 -147
- package/server/lib/tunnels/DOCUMENTATION.md.bak +0 -21
- package/server/lib/ui-auth/DOCUMENTATION.md.bak +0 -44
- package/server/lib/walkthrough/DOCUMENTATION.md.bak +0 -411
package/server/index.d.ts.bak
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { Express } from "express";
|
|
2
|
-
import type { Server } from "http";
|
|
3
|
-
|
|
4
|
-
export interface WebUiServerController {
|
|
5
|
-
expressApp: Express;
|
|
6
|
-
httpServer: Server;
|
|
7
|
-
getPort: () => number | null;
|
|
8
|
-
getOpenCodePort: () => number | null;
|
|
9
|
-
isReady: () => boolean;
|
|
10
|
-
restartOpenCode: () => Promise<void>;
|
|
11
|
-
stop: (options?: { exitProcess?: boolean }) => Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface StartWebUiServerOptions {
|
|
15
|
-
port?: number;
|
|
16
|
-
host?: string;
|
|
17
|
-
attachSignals?: boolean;
|
|
18
|
-
exitOnShutdown?: boolean;
|
|
19
|
-
uiPassword?: string | null;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export declare function startWebUiServer(
|
|
23
|
-
options?: StartWebUiServerOptions
|
|
24
|
-
): Promise<WebUiServerController>;
|
|
25
|
-
|
|
26
|
-
export declare function gracefulShutdown(options?: { exitProcess?: boolean }): Promise<void>;
|
|
27
|
-
export declare function setupProxy(app: Express): void;
|
|
28
|
-
export declare function restartOpenCode(): Promise<void>;
|
|
29
|
-
export declare function parseArgs(argv?: string[]): {
|
|
30
|
-
port: number;
|
|
31
|
-
host?: string;
|
|
32
|
-
uiPassword: string | null;
|
|
33
|
-
tryCfTunnel: boolean;
|
|
34
|
-
tunnelProvider?: string;
|
|
35
|
-
tunnelMode?: string;
|
|
36
|
-
tunnelConfigPath?: string | null;
|
|
37
|
-
tunnelToken?: string;
|
|
38
|
-
tunnelHostname?: string;
|
|
39
|
-
};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
# Managed AiWorker Agent Tool
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
|
|
5
|
-
This module exposes AiWorker to agents as typed OpenCode custom tools. There
|
|
6
|
-
are two, because controlling sessions and driving a page are separate intents
|
|
7
|
-
the user can want independently:
|
|
8
|
-
|
|
9
|
-
- `aiworker` — projects, sessions, worktrees, and scheduled tasks. Enabled
|
|
10
|
-
while the persisted `agentControlToolEnabled` setting is not `false`.
|
|
11
|
-
- `aiworker_web` — looking at and interacting with the page in AiWorker's
|
|
12
|
-
browser panel. Enabled while `agentWebToolEnabled` is not `false`.
|
|
13
|
-
|
|
14
|
-
Both default to on, are toggled in Settings → General → OpenCode CLI, and apply
|
|
15
|
-
on the next managed OpenCode restart. Each tool carries only its own actions and
|
|
16
|
-
only the parameters those actions use, so turning one off removes its inputs
|
|
17
|
-
from the schema rather than leaving them visible. The plugin is injected only
|
|
18
|
-
when AiWorker launches and owns the OpenCode process, and not at all when
|
|
19
|
-
both settings are `false`.
|
|
20
|
-
|
|
21
|
-
- The plugin accepts the action's inputs either inside `parameters` or beside
|
|
22
|
-
`action`, because models produce both shapes; an explicit `parameters` object
|
|
23
|
-
wins on a conflict. Rejecting the flattened shape turned a call that plainly
|
|
24
|
-
carried a `url` into "url is required", which reads as a broken tool rather
|
|
25
|
-
than a malformed call.
|
|
26
|
-
|
|
27
|
-
## Runtime flow
|
|
28
|
-
|
|
29
|
-
1. The AiWorker HTTP listener binds and publishes its authoritative port.
|
|
30
|
-
2. `prepareManagedOpenCodeEnv()` materializes the plugin under
|
|
31
|
-
`<openchamber-data-dir>/agent-tool/` and appends its `file://` URL to
|
|
32
|
-
`OPENCODE_CONFIG_CONTENT` without replacing existing plugin entries.
|
|
33
|
-
3. A random per-child token and loopback callback URL are added only to the
|
|
34
|
-
managed OpenCode child environment.
|
|
35
|
-
4. The plugin calls `POST /api/openchamber/agent-tool` with its typed input and
|
|
36
|
-
OpenCode's authoritative session directory.
|
|
37
|
-
5. The route delegates the fixed action allowlist directly to the shared
|
|
38
|
-
AiWorker control service. The CLI uses the same service through its
|
|
39
|
-
authenticated HTTP adapter, so Goal Mode ordering, wait behavior,
|
|
40
|
-
partial-failure reporting, and scheduled-task contracts have one owner.
|
|
41
|
-
6. Each action definition owns a short presentation title and a separate
|
|
42
|
-
agent-facing description. The generated schema uses the description to state
|
|
43
|
-
required inputs or one non-obvious behavior, while completed calls use the
|
|
44
|
-
short title in native tool metadata.
|
|
45
|
-
|
|
46
|
-
## Agent context budget
|
|
47
|
-
|
|
48
|
-
- The tool exposes one shared parameter object rather than repeating parameters
|
|
49
|
-
in a large per-action union. Action descriptions carry only required inputs,
|
|
50
|
-
defaults, or one non-obvious semantic detail.
|
|
51
|
-
- Obvious fields rely on their names and JSON types. Parameter descriptions are
|
|
52
|
-
reserved for formats, dependencies, scope, and behavior that cannot be safely
|
|
53
|
-
inferred from the field name.
|
|
54
|
-
- Session dispatches do not wait by default. Agents are told to set `wait` only
|
|
55
|
-
when the user asks or the next step requires the completed result.
|
|
56
|
-
- The tool exposes only agent-relevant actions
|
|
57
|
-
(`AIWORKER_AGENT_TOOL_ACTIONS`): `schedule.status` stays CLI-only because
|
|
58
|
-
`schedule.list` already returns scheduler status, and enable/disable are one
|
|
59
|
-
`schedule.toggle` action driven by the `disabled` boolean.
|
|
60
|
-
- The tool description frames intent: created sessions and scheduled tasks are
|
|
61
|
-
user-facing work the user follows up with, never a channel for the agent to
|
|
62
|
-
delegate parts of its own current task.
|
|
63
|
-
- Optional behavior switches (`worktree`, `goal`, `agent`, `variant`, `wait`)
|
|
64
|
-
state their default and an explicit "only when the user asks" rule so agents
|
|
65
|
-
do not invent worktrees, goal mode, or waits the user never requested.
|
|
66
|
-
- Detailed combination rules are enforced by the shared control service and
|
|
67
|
-
returned as actionable usage errors only after an invalid call. Per-action
|
|
68
|
-
examples and a repeated per-action parameter schema are intentionally omitted.
|
|
69
|
-
|
|
70
|
-
## Security invariants
|
|
71
|
-
|
|
72
|
-
- The callback accepts loopback requests only and requires the current
|
|
73
|
-
per-child bearer token using a timing-safe comparison.
|
|
74
|
-
- The token is never persisted, logged, returned to the UI, or written into
|
|
75
|
-
the materialized plugin.
|
|
76
|
-
- Inputs map to a fixed action and parameter allowlist. There is no arbitrary
|
|
77
|
-
CLI, shell, route, or URL forwarding.
|
|
78
|
-
- Session/worktree deletion and project-path registration are not exposed.
|
|
79
|
-
- An aborted tool request propagates an abort signal into the shared service.
|
|
80
|
-
|
|
81
|
-
## Result contract
|
|
82
|
-
|
|
83
|
-
Every completed call returns JSON:
|
|
84
|
-
|
|
85
|
-
```json
|
|
86
|
-
{
|
|
87
|
-
"schemaVersion": 1,
|
|
88
|
-
"ok": true,
|
|
89
|
-
"action": "session.create",
|
|
90
|
-
"data": {}
|
|
91
|
-
}
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Command and operational failures use the same envelope with `ok: false` and
|
|
95
|
-
an `error` object. OpenCode-level cancellation can still produce a native tool
|
|
96
|
-
error state.
|
|
97
|
-
|
|
98
|
-
## Runtime parity
|
|
99
|
-
|
|
100
|
-
- Web and Desktop managed OpenCode: injected automatically.
|
|
101
|
-
- External OpenCode selected with `OPENCODE_HOST` or skip-start: not injected,
|
|
102
|
-
because AiWorker does not control that process environment.
|
|
103
|
-
- VS Code: not injected; the extension owns a separate OpenCode lifecycle.
|
|
104
|
-
- Hosted and Capacitor mobile clients use the server's managed OpenCode tool
|
|
105
|
-
when connected to such a server; no tool runs in the client runtime.
|
|
106
|
-
|
|
107
|
-
## The calling tool is part of the request
|
|
108
|
-
|
|
109
|
-
Each generated tool sends its own name with every callback. Models routinely
|
|
110
|
-
drop the namespace their tool's name appears to supply — `aiworker_memory`
|
|
111
|
-
asked for `memory.read` gets called as `read` — and resolving the bare name
|
|
112
|
-
inside the calling tool's action set makes that unambiguous even where it is not
|
|
113
|
-
globally (`delete` belongs to both schedule and memory).
|
|
114
|
-
|
|
115
|
-
Resolution never reaches outside the tool that asked: `open` from the memory
|
|
116
|
-
tool fails rather than driving the browser. An unresolvable action answers with
|
|
117
|
-
the actions that tool actually has, because an error that only says
|
|
118
|
-
"unsupported" leaves the model to guess a second wrong name — which is exactly
|
|
119
|
-
what happened before this existed.
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Browser Control Broker
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
|
|
5
|
-
This module carries agent browser actions from the server to the client that
|
|
6
|
-
owns the in-app browser view, and the result back. The browser lives in a
|
|
7
|
-
renderer, not in the server process, so the server can never act on a page
|
|
8
|
-
itself; it can only ask and wait.
|
|
9
|
-
|
|
10
|
-
## Boundaries
|
|
11
|
-
|
|
12
|
-
- `broker.js` owns request lifetime: it publishes one action through the
|
|
13
|
-
injected `emitRequest`, holds the pending request, and settles it on a client
|
|
14
|
-
result, a timeout, or an abort signal. It knows nothing about transports.
|
|
15
|
-
- `routes.js` is the result callback (`POST /api/browser-control/result`). It
|
|
16
|
-
validates the envelope and hands the outcome to the broker.
|
|
17
|
-
- `../../index.js` supplies `emitRequest`, which writes the request to the
|
|
18
|
-
AiWorker SSE clients and returns how many were reached.
|
|
19
|
-
- `../openchamber-control/service.js` is the only caller. It maps the
|
|
20
|
-
`browser.*` actions of the `aiworker_web` tool onto `broker.request()` and
|
|
21
|
-
owns their parameter validation.
|
|
22
|
-
- The client half is `packages/ui/src/lib/browser/controlClient.ts`, which
|
|
23
|
-
registers the mounted browser pane as the one responder.
|
|
24
|
-
|
|
25
|
-
## Invariants
|
|
26
|
-
|
|
27
|
-
- Capability belongs to the connection, not to configuration. A client declares
|
|
28
|
-
it can drive a page by opening its event stream with `browser=1`, which only
|
|
29
|
-
a Chromium host does; the flag lives and dies with that connection, so there
|
|
30
|
-
is no setting to enable and no restart to remember.
|
|
31
|
-
- `emitRequest` counts only clients that can serve the action. `browser.open`
|
|
32
|
-
needs any client, because opening a tab is what creates a view; every other
|
|
33
|
-
action needs a declared-capable one.
|
|
34
|
-
- Exactly one client performs a request. The broadcast reaches everyone who
|
|
35
|
-
could serve it, so a client claims the request over
|
|
36
|
-
`POST /api/browser-control/claim` and acts only if granted; the first claim
|
|
37
|
-
wins and every other client does nothing. Deciding by whose result arrives
|
|
38
|
-
first would be too late, because by then each of them has already clicked.
|
|
39
|
-
A claim for a settled request is refused for the same reason.
|
|
40
|
-
- Nobody listening is answered immediately with a 503 describing the
|
|
41
|
-
environment, never by blocking for the full timeout. A blocked wait followed
|
|
42
|
-
by a timeout cannot be told apart from a page that hung.
|
|
43
|
-
- A client that accepted a request and then disappeared still times out.
|
|
44
|
-
Assuming success would report a page interaction that never happened.
|
|
45
|
-
- A result for an unknown request id is accepted with `matched: false`, not an
|
|
46
|
-
error: a client answering after the timeout has behaved correctly.
|
|
47
|
-
- The result route parses its own body. This server has no global body parser,
|
|
48
|
-
and a missing one silently turns every answer into an agent-visible timeout.
|
|
49
|
-
- Request payload limits are sized for a page snapshot (visible text plus every
|
|
50
|
-
interactive element), not for a control message.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Context Obligatory Messages
|
|
2
|
-
|
|
3
|
-
Messages explicitly pinned by the user are stored under
|
|
4
|
-
`session.metadata.aiworker.context_obligatory_messages` as `{ id, createdAt,
|
|
5
|
-
role }`. The UI uses a fresh-read metadata merge when pinning or unpinning.
|
|
6
|
-
|
|
7
|
-
The server runtime listens for OpenCode's dedicated `session.compacted` event.
|
|
8
|
-
It fetches every pinned message by ID, keeps non-empty text parts, sorts them
|
|
9
|
-
by the stored creation time, and immediately sends one synthetic user part
|
|
10
|
-
through `prompt_async`. OpenCode's session runner serializes this with its own
|
|
11
|
-
post-compaction continuation. Missing individual messages are skipped without
|
|
12
|
-
discarding the remaining context. Ordinary idle events perform no work and
|
|
13
|
-
make no requests.
|
|
14
|
-
|
|
15
|
-
After a successful send, the runtime merge-writes
|
|
16
|
-
`context_obligatory_last_compaction_message_id`. This cursor prevents a
|
|
17
|
-
replayed compaction event from reinjecting the same summary. The runtime is
|
|
18
|
-
owned by the AiWorker web backend and therefore is not available in
|
|
19
|
-
extension-only VS Code mode.
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# Dev Server Tunnel
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
|
|
5
|
-
This module carries raw TCP bytes between a desktop client and a dev server
|
|
6
|
-
running on the AiWorker host, so a remote dev server can be opened in the
|
|
7
|
-
browser panel without anything being rewritten.
|
|
8
|
-
|
|
9
|
-
The page is served from a real origin at the root of its own host. That is the
|
|
10
|
-
whole design: absolute URLs resolve, cookies scope correctly, HMR sockets
|
|
11
|
-
connect, and developer tools behave as they do locally. No HTML, header, or
|
|
12
|
-
URL is inspected or modified, which is what the previous rewriting proxy did
|
|
13
|
-
and what made it fragile per framework.
|
|
14
|
-
|
|
15
|
-
## Boundaries
|
|
16
|
-
|
|
17
|
-
- `runtime.js` is the host end: it accepts the WebSocket upgrade at
|
|
18
|
-
`/api/dev-tunnel`, authenticates it, opens a TCP socket to the requested
|
|
19
|
-
local port, and pipes the two together.
|
|
20
|
-
- `client.js` is the local end: it binds a loopback listener on the user's
|
|
21
|
-
machine and pipes each accepted connection through one WebSocket. It lives in
|
|
22
|
-
this package because it needs a WebSocket client the package already depends
|
|
23
|
-
on; the desktop shell drives it over IPC.
|
|
24
|
-
- Port discovery is not owned here. `runtime.js` is given the reachable set by
|
|
25
|
-
the same dev-server discovery the user's own list is built from.
|
|
26
|
-
- The browser panel decides when to tunnel; this module never chooses a target.
|
|
27
|
-
`packages/ui/src/lib/browser/devTunnel.ts` owns that decision, including for
|
|
28
|
-
navigations the page starts itself: a tunnelled page that sends the view to
|
|
29
|
-
another loopback port means a port on the host, not on the user's machine.
|
|
30
|
-
|
|
31
|
-
## Invariants
|
|
32
|
-
|
|
33
|
-
- The reachable set is exactly what dev-server discovery offers the user, never
|
|
34
|
-
"any loopback port". Without that restriction an authenticated client could
|
|
35
|
-
dial arbitrary local services on the host — databases, admin panels, the
|
|
36
|
-
OpenCode API — through this socket.
|
|
37
|
-
- Authentication depends on whether the caller is a browser, and this is
|
|
38
|
-
deliberate rather than a relaxation:
|
|
39
|
-
- With an `Origin` header the request came from a browser context, and the
|
|
40
|
-
usual origin allowlist applies unchanged. That check is a CSRF defence: a
|
|
41
|
-
hostile page can make a browser open a WebSocket carrying ambient cookies,
|
|
42
|
-
and the origin is what exposes it.
|
|
43
|
-
- With no `Origin` the request must carry client-token auth. A browser cannot
|
|
44
|
-
reach this path — the WebSocket API always sends an origin and never lets a
|
|
45
|
-
page set an `Authorization` header — so this case is the desktop shell.
|
|
46
|
-
- Concurrency is capped per host, not per page, because one page load opens
|
|
47
|
-
many sockets.
|
|
48
|
-
- A connection that cannot be established fails the socket rather than holding
|
|
49
|
-
it open; a stalled connect is bounded by an explicit timeout, and so is the
|
|
50
|
-
WebSocket handshake. While it is pending the local socket is paused and its
|
|
51
|
-
buffered bytes are capped, so a local process writing into a stalled
|
|
52
|
-
handshake cannot grow the desktop app's memory.
|
|
53
|
-
- A tunnel that cannot be opened is reported to the panel, never replaced by the
|
|
54
|
-
plain loopback URL. On a remote instance that substitution would change which
|
|
55
|
-
machine answers and show local content under a remote address.
|
|
56
|
-
- Closing either end closes the other. A half-open pipe would leave the page
|
|
57
|
-
waiting on bytes that will never arrive.
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# Dictation module
|
|
2
|
-
|
|
3
|
-
Server-authoritative speech-to-text for the chat composer, plus local
|
|
4
|
-
text-to-speech. The client streams 16 kHz mono PCM16 chunks (base64) over a
|
|
5
|
-
WebSocket while the user speaks; the server buffers them and transcribes each
|
|
6
|
-
segment exactly once, when the segment is committed.
|
|
7
|
-
|
|
8
|
-
Transcription is deliberately not incremental. Parakeet is an offline model
|
|
9
|
-
trained on whole utterances, so re-decoding the growing buffer to animate a
|
|
10
|
-
live transcript costs O(n^2) work for a result the final decode replaces. The
|
|
11
|
-
composer shows no text while recording and inserts the full transcript on
|
|
12
|
-
stop.
|
|
13
|
-
|
|
14
|
-
Local TTS (Kokoro and Piper/VITS via sherpa-onnx OfflineTts) runs in the same
|
|
15
|
-
worker process and is exposed as `POST /api/dictation/tts/speak` (JSON
|
|
16
|
-
`{text, speakerId?, speed?, model?, language?, languageSample?}` → WAV bytes; 503 with
|
|
17
|
-
`reasonCode` while the model is downloading). TTS models live in the same
|
|
18
|
-
catalog/downloader as STT models (`local/model-catalog.js`
|
|
19
|
-
`LOCAL_TTS_MODEL_CATALOG`) and are managed by the same status/download/delete
|
|
20
|
-
routes.
|
|
21
|
-
|
|
22
|
-
Each TTS catalog entry declares the `languages` it speaks. With
|
|
23
|
-
`language: 'auto'` the service detects the language of `languageSample` — the
|
|
24
|
-
whole message the chunk belongs to, sent by the client with every chunk — or
|
|
25
|
-
of `text` when no sample is given
|
|
26
|
-
(`../tts/language-detect.js`, script plus function-word scoring, no
|
|
27
|
-
dependencies) and keeps the caller's model when it speaks that language;
|
|
28
|
-
otherwise it switches to the catalog model for the language, downloading it on
|
|
29
|
-
first use like any other model, and starts from that model's default speaker
|
|
30
|
-
(`defaultSpeakerByLanguage`) instead of the caller's speaker id. A language no
|
|
31
|
-
catalog model covers keeps the caller's model, so text is always spoken. The
|
|
32
|
-
response carries `X-Speech-Model` and `X-Speech-Language`.
|
|
33
|
-
|
|
34
|
-
## Ownership
|
|
35
|
-
|
|
36
|
-
- `runtime.js` — registers `GET /api/dictation/status`,
|
|
37
|
-
`POST /api/dictation/models/:modelId/download`, and the
|
|
38
|
-
`/api/dictation/ws` WebSocket endpoint (auth-gated the same way as the
|
|
39
|
-
terminal WS: UI session token or `oc_url_token`, plus origin check).
|
|
40
|
-
Created from the startup pipeline (`startup-pipeline-runtime.js`) before
|
|
41
|
-
the generic OpenCode proxy so routes are not shadowed.
|
|
42
|
-
- `stream-manager.js` — `DictationStreamManager`, one per WS connection.
|
|
43
|
-
Chunk reordering by `seq` + ack, resampling to the provider rate, segment
|
|
44
|
-
splitting, silence suppression by PCM peak, partial-transcript
|
|
45
|
-
concatenation, adaptive finalization timeout.
|
|
46
|
-
- `service.js` — provider resolution and readiness. Providers:
|
|
47
|
-
- `local` (default): sherpa-onnx Parakeet TDT in a forked worker process.
|
|
48
|
-
Models auto-download in the background on first use; while missing, the
|
|
49
|
-
stream fails with `reasonCode: 'model_download_in_progress'` and the
|
|
50
|
-
status route reports per-model install/download state.
|
|
51
|
-
- `openai-compatible`: buffered per-segment transcription against any
|
|
52
|
-
OpenAI-compatible `/v1/audio/transcriptions` endpoint
|
|
53
|
-
(`openai-compatible-session.js`, reuses `../tts/stt.js`).
|
|
54
|
-
- `local/` — worker process + client (IPC, idle shutdown TTL), sherpa
|
|
55
|
-
recognizer engine and segment session (one decode per committed segment),
|
|
56
|
-
model catalog and downloader. The native `sherpa-onnx-node` addon is only
|
|
57
|
-
ever loaded inside the worker process.
|
|
58
|
-
- `audio.js` — PCM16 helpers: format parsing, peak, WAV wrapping, streaming
|
|
59
|
-
linear resampler.
|
|
60
|
-
|
|
61
|
-
## WebSocket protocol (JSON text frames)
|
|
62
|
-
|
|
63
|
-
Client → server: `start {dictationId, format, options}`,
|
|
64
|
-
`chunk {dictationId, seq, audio}`, `finish {dictationId, finalSeq}`,
|
|
65
|
-
`cancel {dictationId}`, `ping`.
|
|
66
|
-
|
|
67
|
-
Server → client: `ready`, `ack {ackSeq}`, `partial {text}`,
|
|
68
|
-
`finish_accepted {timeoutMs}`, `final {text}`,
|
|
69
|
-
`error {error, retryable, reasonCode?}`, `pong`.
|
|
70
|
-
|
|
71
|
-
`options` in `start` carries the client-selected provider config:
|
|
72
|
-
`{ provider: 'local' | 'openai-compatible', language?, localModel?,
|
|
73
|
-
openaiCompatible?: { baseUrl, model, apiKey } }`.
|
|
74
|
-
|
|
75
|
-
## Segmentation
|
|
76
|
-
|
|
77
|
-
A dictation is one segment unless it runs long. Past `segmentMinSeconds`
|
|
78
|
-
(60 s) the manager commits on the first silent chunk, so cuts land at a pause
|
|
79
|
-
rather than mid-word; `segmentMaxSeconds` (90 s) is a hard cap for speech with
|
|
80
|
-
no pause in it. Client chunks are ~1 s, so "silent chunk" is roughly a second
|
|
81
|
-
of silence.
|
|
82
|
-
|
|
83
|
-
The bounds exist because Parakeet is a full-attention conformer: decode cost
|
|
84
|
-
and peak memory grow quadratically with segment length. Measured on Parakeet
|
|
85
|
-
v3 int8 with 2 threads: 60 s took 2.1 s and +90 MB, 180 s took 9.3 s and
|
|
86
|
-
+490 MB, 300 s took 21.3 s and +1.5 GB. Committed segments decode while the
|
|
87
|
-
user is still speaking, so only the tail is left to transcribe on stop.
|
|
88
|
-
|
|
89
|
-
## Invariants
|
|
90
|
-
|
|
91
|
-
- Never load `sherpa-onnx-node` in the main server process.
|
|
92
|
-
- Transcription happens on commit only; sessions never emit non-final
|
|
93
|
-
transcripts. The `partial` messages a client receives are the concatenation
|
|
94
|
-
of already-committed segments, and exist so a dictation that fails partway
|
|
95
|
-
can be salvaged instead of losing minutes of speech.
|
|
96
|
-
- The stream manager acks only the highest contiguous seq; the client is
|
|
97
|
-
expected to retain unacked segments for retry/replay.
|
|
98
|
-
- Silence-only segments (peak < 300) are cleared, never committed, so
|
|
99
|
-
Whisper-style providers do not hallucinate on silence.
|
|
100
|
-
- Model files live under `~/.config/openchamber/speech-models`.
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# Event Stream Module Documentation
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
This module contains the AiWorker message-stream WebSocket protocol and runtime bridge. It keeps the browser-facing WebSocket transport separate from the upstream OpenCode SSE transport.
|
|
5
|
-
|
|
6
|
-
## Entrypoints and structure
|
|
7
|
-
- `packages/web/server/lib/event-stream/index.js`: public entrypoint re-exporting protocol and runtime helpers.
|
|
8
|
-
- `packages/web/server/lib/event-stream/global-hub.js`: shared global upstream SSE hub for server-side subscribers and browser WS fan-out.
|
|
9
|
-
- `packages/web/server/lib/event-stream/global-ws-bridge.js`: browser-facing global WS bridge that subscribes clients to the shared global hub.
|
|
10
|
-
- `packages/web/server/lib/event-stream/directory-ws-bridge.js`: browser-facing per-directory WS bridge that owns one scoped upstream reader per connection.
|
|
11
|
-
- `packages/web/server/lib/event-stream/protocol.js`: path constants, SSE envelope parsing, and WebSocket frame serialization helpers.
|
|
12
|
-
- `packages/web/server/lib/event-stream/upstream-reader.js`: reusable upstream SSE reader with event-id tracking, stall recovery, and reconnect handling.
|
|
13
|
-
- `packages/web/server/lib/event-stream/runtime.js`: thin WebSocket server runtime for upgrade handling and path dispatch to the global/directory bridges.
|
|
14
|
-
- `packages/web/server/lib/event-stream/protocol.test.js`: unit tests for protocol helpers.
|
|
15
|
-
- `packages/web/server/lib/event-stream/upstream-reader.test.js`: unit tests for upstream SSE reader behavior.
|
|
16
|
-
- `packages/web/server/lib/event-stream/runtime.test.js`: unit tests for runtime-side broadcaster behavior.
|
|
17
|
-
|
|
18
|
-
## Public exports
|
|
19
|
-
|
|
20
|
-
### Protocol helpers
|
|
21
|
-
- `MESSAGE_STREAM_GLOBAL_WS_PATH`: `/api/global/event/ws`
|
|
22
|
-
- `MESSAGE_STREAM_DIRECTORY_WS_PATH`: `/api/event/ws`
|
|
23
|
-
- `MESSAGE_STREAM_WS_HEARTBEAT_INTERVAL_MS`: heartbeat interval for browser-facing WS connections.
|
|
24
|
-
- `parseSseEventEnvelope(block)`: parses an SSE block into `{ eventId, directory, payload }`.
|
|
25
|
-
- `sendMessageStreamWsFrame(socket, payload)`: serializes and sends a JSON WS frame.
|
|
26
|
-
- `sendMessageStreamWsEvent(socket, payload, options)`: sends an event frame with optional `eventId` and `directory`.
|
|
27
|
-
|
|
28
|
-
### Runtime helpers
|
|
29
|
-
- `createGlobalMessageStreamHub(...)`: creates a shared `/global/event` upstream SSE hub with event/status subscribers and bounded event-id replay.
|
|
30
|
-
- `createGlobalUiEventBroadcaster({ sseClients, wsClients, writeSseEvent })`: returns a broadcaster that fans out the same synthetic UI event to SSE and WS clients.
|
|
31
|
-
- `createMessageStreamWsRuntime(...)`: mounts the message-stream WS server, upgrade handler, and SSE-to-WS bridge onto the web HTTP server.
|
|
32
|
-
|
|
33
|
-
### Upstream reader helpers
|
|
34
|
-
- `DEFAULT_UPSTREAM_STALL_TIMEOUT_MS`: default idle timeout before an attached upstream SSE fetch is aborted for reconnect.
|
|
35
|
-
- `DEFAULT_UPSTREAM_RECONNECT_DELAY_MS`: default delay between upstream reconnect attempts.
|
|
36
|
-
- `createUpstreamSseReader(...)`: creates a start/stop reader for OpenCode SSE streams. The reader parses SSE blocks, tracks the latest `Last-Event-ID`, reconnects after closed or stalled upstream streams, and reports events through callbacks.
|
|
37
|
-
|
|
38
|
-
## Runtime behavior
|
|
39
|
-
- Browser clients connect to the WS endpoints above.
|
|
40
|
-
- AiWorker still fetches OpenCode upstream event streams over SSE.
|
|
41
|
-
- The web server creates one shared global message-stream hub. OpenCode watcher side effects and global WS clients subscribe to that hub, so there is one upstream `/global/event` SSE reader for both server-side processing and browser fan-out.
|
|
42
|
-
- The global hub keeps a bounded replay buffer keyed by SSE `eventId` so reconnecting browser clients can receive buffered events after their requested `Last-Event-ID`.
|
|
43
|
-
- Directory WS clients still attach one upstream `/event?directory=...` SSE reader per connection because directory streams are scoped.
|
|
44
|
-
- If an upstream SSE stream stalls after the browser WS is already ready, the reader aborts that upstream fetch and reconnects upstream with `Last-Event-ID`, keeping the browser WS alive when recovery is fast.
|
|
45
|
-
- When the shared global upstream reconnects after it was previously ready, the global WS bridge sends a fresh `ready` frame to already-ready browser clients. The browser treats this as a reconnect edge and can run scoped state repair without requiring the browser WS to close.
|
|
46
|
-
- Health checks are reserved for initial upstream connect failures and explicit upstream-unavailable responses, not for ordinary stall recovery on an already-established stream.
|
|
47
|
-
- Global synthetic events such as `aiworker:session-status`, `aiworker:session-activity`, `aiworker:notification`, and `aiworker:heartbeat` are preserved on the WS path, but heartbeat frames are emitted only while an upstream SSE stream is actively attached.
|
|
48
|
-
- Global UI broadcasts are fan-out capable across both SSE and WS clients.
|
|
49
|
-
- The reusable upstream reader centralizes SSE fetch/parsing/reconnect behavior for the WS runtime and OpenCode watcher. Additional event consumers should move to it only with parity tests for their lifecycle and error semantics.
|
|
50
|
-
- Browser transport concerns live in the WS bridge modules; server-side global stream ownership lives in `global-hub.js`.
|
|
51
|
-
|
|
52
|
-
## Notes for contributors
|
|
53
|
-
- Keep protocol helpers pure and small so they can be unit tested without spinning up a server.
|
|
54
|
-
- Keep `runtime.js` focused on WebSocket upgrade and endpoint dispatch. Put global browser-client lifecycle in `global-ws-bridge.js`, directory stream lifecycle in `directory-ws-bridge.js`, and upstream stream sharing in `global-hub.js`.
|
|
55
|
-
- Do not change upstream OpenCode transport assumptions here; OpenCode remains SSE-based.
|
|
56
|
-
- Keep global replay bounded; do not turn it into an unbounded event log.
|
|
57
|
-
|
|
58
|
-
## Testing
|
|
59
|
-
- Run `bun test packages/web/server/lib/event-stream/protocol.test.js`
|
|
60
|
-
- Run `bun test packages/web/server/lib/event-stream/upstream-reader.test.js`
|
|
61
|
-
- Run `bun test packages/web/server/lib/event-stream/runtime.test.js`
|
|
62
|
-
- Run repo validation before finalizing: `bun run type-check`, `bun run lint`, `bun run build`
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
# FS Module Documentation
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
Own filesystem API behavior for the web server runtime, including workspace-bound file operations, directory listing, reveal, and background command execution jobs.
|
|
5
|
-
|
|
6
|
-
## Entrypoints and structure
|
|
7
|
-
- `packages/web/server/lib/fs/routes.js`: route registration and runtime-owned state for `/api/fs/*` endpoints.
|
|
8
|
-
- `packages/web/server/lib/fs/search.js`: fuzzy filesystem search runtime used by non-FS routes (for example project icon discovery).
|
|
9
|
-
|
|
10
|
-
## Public exports
|
|
11
|
-
- `registerFsRoutes(app, dependencies)` from `routes.js`
|
|
12
|
-
- Registers all filesystem routes:
|
|
13
|
-
- `GET /api/fs/home`
|
|
14
|
-
- `POST /api/fs/mkdir`
|
|
15
|
-
- `GET /api/fs/read`
|
|
16
|
-
- `GET /api/fs/raw`
|
|
17
|
-
- `GET /api/fs/serve/:path(*)`
|
|
18
|
-
- `POST /api/fs/write`
|
|
19
|
-
- `POST /api/fs/upload`
|
|
20
|
-
- `POST /api/fs/delete`
|
|
21
|
-
- `POST /api/fs/rename`
|
|
22
|
-
- `POST /api/fs/reveal`
|
|
23
|
-
- `POST /api/fs/exec`
|
|
24
|
-
- `GET /api/fs/exec/:jobId`
|
|
25
|
-
- `GET /api/fs/list`
|
|
26
|
-
- `GET /api/fs/git-dirs` — shallow nested git repository discovery for the
|
|
27
|
-
Git tab (depth- and visit-capped readdir walk; `.git` directory, file, or
|
|
28
|
-
symlink marks a repository boundary; junk directories and symlinks are
|
|
29
|
-
never descended into)
|
|
30
|
-
- Owns exec job queue state (`execJobs`) and lifecycle/TTL pruning.
|
|
31
|
-
- Enforces workspace boundary checks with active project + worktree fallback support.
|
|
32
|
-
- The active project directory is validated with `fs.realpath`, so when the project root is itself a symlink the workspace base no longer matches the paths the client sends. Workspace resolution therefore retries against the raw directory the client requested (`requestedDirectory` from `resolveProjectDirectory`) before falling back to worktree roots. Symlinks are still resolved afterwards, and write/exec routes keep their canonical containment check against the resolved base.
|
|
33
|
-
- `createFsSearchRuntime({ fsPromises, path, spawn, resolveGitBinaryForSpawn })` from `search.js`
|
|
34
|
-
- Returns `{ searchFilesystemFiles(rootPath, options) }`.
|
|
35
|
-
- Supports fuzzy matching, hidden-file handling, and optional `git check-ignore` filtering.
|
|
36
|
-
|
|
37
|
-
## Composition contract with `index.js`
|
|
38
|
-
- `index.js` provides composition-time dependencies only (platform primitives + callbacks such as `resolveProjectDirectory`, `normalizeDirectoryPath`, and `buildAugmentedPath`).
|
|
39
|
-
- `index.js` no longer owns FS route handlers or FS exec job state.
|
|
40
|
-
|
|
41
|
-
## Notes for contributors
|
|
42
|
-
- Keep filesystem policy (workspace root checks, error mapping, exec timeout behavior) inside this module, not in the composition root.
|
|
43
|
-
- Filesystem `EPERM`/`EACCES` failures use the stable `reason: "os-permission"` response marker. Policy denials such as workspace-boundary or missing-grant failures must not use that marker because a native folder picker cannot remediate them.
|
|
44
|
-
- Read-only routes authorize the requested path against the workspace before resolving symlinks. A symlink reached through the workspace may therefore target a file outside it, while a directly requested outside path still requires an exact-path grant. Write routes keep canonical-target boundary checks.
|
|
45
|
-
- If adding new `/api/fs/*` endpoints, add them in `routes.js` and extend this document.
|
|
46
|
-
- `GET /api/fs/list` may resolve symlinks with `realpath` to read directory contents, but the response `path` and each entry `path` must stay in the caller's requested path space (`path.join(requestedPath, name)`). Returning real paths breaks file-tree expansion for directories reached through workspace symlinks.
|
|
47
|
-
- `POST /api/fs/upload` accepts one `application/octet-stream` body with `path` and optional `overwrite=true` query parameters. The body streams into a same-directory temp file with a 100 MiB default cap configurable through `AIWORKER_FS_UPLOAD_MAX_BYTES`; failed and oversized uploads clean up that temp file. New files commit through an atomic no-replace link, existing files return `409` unless overwrite is explicit, directory targets are rejected, and the destination parent resolves before writing so uploads cannot escape through workspace symlinks.
|