@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
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
# Small Model
|
|
2
|
-
|
|
3
|
-
Server-side direct LLM calls that reuse the user's existing OpenCode provider
|
|
4
|
-
logins (`~/.local/share/opencode/auth.json`). OpenCode uses a "small model"
|
|
5
|
-
internally (titles, summaries) but does not expose it through the SDK or
|
|
6
|
-
plugins — this module replicates that mechanism as an AiWorker runtime API.
|
|
7
|
-
|
|
8
|
-
## Security boundary
|
|
9
|
-
|
|
10
|
-
Credentials never leave the server process. The client sends only a prompt;
|
|
11
|
-
auth resolution, OAuth refresh, and provider dispatch all happen server-side.
|
|
12
|
-
Routes live under `/api/*` and are gated by the ui-auth middleware like every
|
|
13
|
-
other runtime API.
|
|
14
|
-
|
|
15
|
-
## Files
|
|
16
|
-
|
|
17
|
-
- `index.js` — orchestration: `generateSmallModelText()` / `describeSmallModel()`.
|
|
18
|
-
- `runtime-providers.js` — provider state that exists only inside the running
|
|
19
|
-
OpenCode process. A plugin registers its provider from the `config` hook and
|
|
20
|
-
supplies the credential from its `auth` loader, so neither reaches
|
|
21
|
-
`opencode.json` nor `auth.json`; `GET /provider` is the only place they
|
|
22
|
-
become visible. The module caches one snapshot (30s TTL, shared in-flight
|
|
23
|
-
request) and answers `null` — never an empty provider list — when OpenCode is
|
|
24
|
-
unreachable, so a momentary outage cannot retract providers. It is wired once
|
|
25
|
-
from `server/index.js` and reset on OpenCode restart, which reloads plugins
|
|
26
|
-
and can move their ports and keys.
|
|
27
|
-
- `resolve.js` — model selection, mirroring OpenCode's `getSmallModel` chain:
|
|
28
|
-
0. AiWorker's own settings override (Settings → Sessions → Small Model):
|
|
29
|
-
when `smallModelUseDefault` is `false`, `smallModelOverride`
|
|
30
|
-
(`provider/model`) outranks everything below. Sanitized in
|
|
31
|
-
`settings-helpers.js` (server), `persistence.ts` (client), and
|
|
32
|
-
`bridge-settings-runtime.ts` (VS Code).
|
|
33
|
-
1. `small_model` from the merged OpenCode config layers (`provider/model`).
|
|
34
|
-
2. Family-priority scan (`gemini-flash` → `gpt-nano` → `claude-haiku`)
|
|
35
|
-
**within the session's provider first** (`preferredProviderID`, like
|
|
36
|
-
OpenCode resolves within the current provider), then over the other
|
|
37
|
-
providers with a usable auth entry, newest `release_date` first.
|
|
38
|
-
3. GitHub Copilot hidden utility models (`gpt-*-nano/mini`) — these never
|
|
39
|
-
appear in the catalog, so they participate as the `gpt-nano` family entry
|
|
40
|
-
and as a final utility fallback.
|
|
41
|
-
4. Last resort: the session's own model (`preferredModelID`) when no small
|
|
42
|
-
model resolves anywhere — costlier, but always valid.
|
|
43
|
-
- Input clamp: the prompt is measured against the resolved model's catalog
|
|
44
|
-
`limit.context` (minus an output reserve, ~4 chars/token estimate;
|
|
45
|
-
conservative default when the model is not in the catalog). `onOverflow`
|
|
46
|
-
decides what an oversized prompt means:
|
|
47
|
-
- `truncate` (default) clips the tail and reports `inputTruncated: true`.
|
|
48
|
-
Correct for callers that degrade gracefully (summaries, commit messages).
|
|
49
|
-
- `error` throws a `413` with `code: 'context-too-small'` plus
|
|
50
|
-
`requiredChars`/`availableChars`. Correct for callers whose output would be
|
|
51
|
-
quietly wrong on a clipped input, so they can ask the user for a roomier
|
|
52
|
-
model instead of returning confident nonsense.
|
|
53
|
-
- Structured output: pass `responseSchema` (a JSON Schema) to get
|
|
54
|
-
schema-shaped JSON back as `text`. Wire support differs per format —
|
|
55
|
-
`response_format: {type: 'json_schema'}` for OpenAI-compatible chat,
|
|
56
|
-
`text.format` for the Responses API, a forced single tool call for the
|
|
57
|
-
Anthropic messages API, and `generationConfig.responseSchema` for Google
|
|
58
|
-
(whose OpenAPI-flavored dialect drops unknown JSON Schema keywords). The
|
|
59
|
-
ChatGPT-plan codex backend has no equivalent and rejects a schema request
|
|
60
|
-
with `code: 'structured-output-unsupported'` rather than silently returning
|
|
61
|
-
prose.
|
|
62
|
-
- Output budget: `maxOutputTokens` is capped at the catalog's `limit.output` for
|
|
63
|
-
the model, and the **same number** is reserved from the input allowance. The
|
|
64
|
-
two must not drift — a caller that asks for a large answer while the reserve
|
|
65
|
-
stays at the default overruns the context, and the failure looks like a
|
|
66
|
-
truncation bug rather than a budgeting one. `describeSmallModel` takes
|
|
67
|
-
`outputReserveTokens` so readiness checks agree with what generation will do.
|
|
68
|
-
It may be a **function** of `{ contextTokens, outputTokenLimit }` for callers
|
|
69
|
-
that want as much answer room as the resolved model allows — they cannot name
|
|
70
|
-
a number before knowing which model they got. The resolved value comes back as
|
|
71
|
-
`outputTokens`, which is what the caller should then request, so the reserve
|
|
72
|
-
and the request are the same number by construction.
|
|
73
|
-
- Reasoning models can spend the entire output budget thinking and return
|
|
74
|
-
nothing. That case (empty content with `finish_reason: 'length'`, or content
|
|
75
|
-
empty while `reasoning_content` is populated) throws with
|
|
76
|
-
`code: 'output-exhausted'` so callers can offer a different model instead of
|
|
77
|
-
showing a transport error.
|
|
78
|
-
- `timeoutMs` overrides the 60s default per call; `signal` lets a caller abort
|
|
79
|
-
a request that is no longer wanted. Both apply to every wire format.
|
|
80
|
-
- `describeSmallModel()` additionally reports `inputCharBudget`,
|
|
81
|
-
`contextTokens`, `contextKnown`, `structuredOutput`, and `hasLogin`. The last
|
|
82
|
-
is whether the resolved provider has a usable credential (`auth.json` or
|
|
83
|
-
config `provider.<id>.options.apiKey`) — settings/config overrides can name a
|
|
84
|
-
provider with none, and callers such as the walkthrough refuse before the
|
|
85
|
-
request. `structuredOutput` is tri-state: `true`/`false` from the catalog,
|
|
86
|
-
`null` when the catalog omits the field — which it does for roughly half of
|
|
87
|
-
all models, aggregators and proxies especially. Callers must treat `null` as
|
|
88
|
-
"try it", not "unsupported".
|
|
89
|
-
- Missing credentials throw with `statusCode: 401` and
|
|
90
|
-
`code: 'no-provider-login'` rather than a bare `Error`, so UI callers can show
|
|
91
|
-
a blocker instead of a raw 500 message.
|
|
92
|
-
- `call.js` — wire formats and per-provider auth, replicating OpenCode's
|
|
93
|
-
plugin auth loaders:
|
|
94
|
-
- **GitHub Copilot**: fetches the requested model's authenticated `/models`
|
|
95
|
-
metadata from `https://api.githubcopilot.com` (or
|
|
96
|
-
`copilot-api.<enterprise>`) and honors its advertised endpoint, preferring
|
|
97
|
-
Anthropic-compatible `/v1/messages`, then OpenAI `/responses`, then
|
|
98
|
-
`/chat/completions`. Models without `supported_endpoints` retain the legacy
|
|
99
|
-
Chat Completions default; metadata, missing-model, and unsupported-endpoint
|
|
100
|
-
failures are surfaced instead of guessing. The stored device-OAuth token is
|
|
101
|
-
used as the bearer with no token exchange or expiry.
|
|
102
|
-
- **OpenAI OAuth (ChatGPT plan)**: streaming Responses API on
|
|
103
|
-
`https://chatgpt.com/backend-api/codex/responses` with
|
|
104
|
-
`ChatGPT-Account-Id`; expired tokens are refreshed against
|
|
105
|
-
`auth.openai.com` (single-flight) and written back to `auth.json`.
|
|
106
|
-
- **Anthropic** (`type: api`): `/messages` with `x-api-key`, against
|
|
107
|
-
`provider.anthropic.options.baseURL` when configured (used as-is, matching
|
|
108
|
-
`@ai-sdk/anthropic` — no `/v1` is inserted) or `https://api.anthropic.com/v1`
|
|
109
|
-
otherwise.
|
|
110
|
-
- **Google** (`type: api`): `generateContent` with `x-goog-api-key`; Gemini 3
|
|
111
|
-
uses `thinkingLevel`, Gemini 2.x uses `thinkingBudget: 0`, and all other
|
|
112
|
-
models omit `thinkingConfig` entirely.
|
|
113
|
-
- Everything else: OpenAI-compatible `/chat/completions` against the
|
|
114
|
-
provider's base URL, resolved from (1) `provider.<id>.options.baseURL`
|
|
115
|
-
in the OpenCode config, (2) the hardcoded `https://api.openai.com/v1`
|
|
116
|
-
endpoint, (3) the endpoint OpenCode resolved at runtime, or (4) the
|
|
117
|
-
provider's `api` field from the models.dev catalog. The credential follows
|
|
118
|
-
the same shape: config `options.apiKey`, then the runtime credential, then
|
|
119
|
-
the auth.json entry. `provider.<id>.options.headers` is sent with the
|
|
120
|
-
request and overrides the bearer default, so gateways that authenticate on
|
|
121
|
-
their own header work here exactly as they do in a chat turn. Configured API
|
|
122
|
-
keys and header values honor OpenCode's `{env:NAME}` and `{file:path}`
|
|
123
|
-
substitutions; file contents and resolved credentials remain server-side.
|
|
124
|
-
- The runtime credential is refused for providers listed in
|
|
125
|
-
`OWN_CREDENTIAL_HANDLING`. Their branches need the stored entry rather than
|
|
126
|
-
a bearer token: the clearest case is the ChatGPT-plan `openai` login, whose
|
|
127
|
-
runtime `options.apiKey` is an OAuth access token that `api.openai.com`
|
|
128
|
-
answers with 401.
|
|
129
|
-
- `[small-model:diagnostic]` logs record provider/model, input character
|
|
130
|
-
counts, output budget, thinking toggle, HTTP/finish status, and
|
|
131
|
-
content/reasoning lengths without logging prompts, response text, or
|
|
132
|
-
credentials. Goal audit parsing similarly emits
|
|
133
|
-
`[session-goal:diagnostic]` structural verdict metadata.
|
|
134
|
-
- `catalog.js` — models.dev catalog via the shared in-process cache
|
|
135
|
-
(`../opencode/models-metadata.js`, also serving
|
|
136
|
-
`/api/openchamber/models-metadata`).
|
|
137
|
-
- `routes.js` — `GET /api/small-model` (resolution preview) and
|
|
138
|
-
`POST /api/small-model/generate` (`{ prompt, system?, maxOutputTokens?,
|
|
139
|
-
model?, directory? }` → `{ text, providerID, modelID, source }`).
|
|
140
|
-
|
|
141
|
-
## Which providers the pickers may offer
|
|
142
|
-
|
|
143
|
-
`listAuthenticatedProviders()` answers one question for the Small Model and
|
|
144
|
-
Changes Walkthrough pickers alike: which providers can this module actually
|
|
145
|
-
call. One rule decides it, applied the same way to every provider — **a
|
|
146
|
-
credential we are allowed to use, and an endpoint to send it to.** The
|
|
147
|
-
auth.json scan as before, plus the credential and endpoint OpenCode resolved
|
|
148
|
-
for a plugin provider.
|
|
149
|
-
|
|
150
|
-
**opencode zen is excluded without a real login.** When the user has no zen
|
|
151
|
-
credential, OpenCode substitutes the sentinel `options.apiKey = "public"` and
|
|
152
|
-
trims its catalog to the free models. Those run on OpenCode's own subsidised
|
|
153
|
-
infrastructure and are meant to be reached through OpenCode, so the sentinel is
|
|
154
|
-
never accepted as a credential — see `ZEN_ANONYMOUS_API_KEY`.
|
|
155
|
-
|
|
156
|
-
### Why there is no capability probe
|
|
157
|
-
|
|
158
|
-
A plugin may implement its whole integration inside `options.fetch` —
|
|
159
|
-
rewriting the path, signing the request, translating the payload — and OpenCode
|
|
160
|
-
cannot serialise a function. Such a provider advertises an ordinary base URL
|
|
161
|
-
that answers nothing we know how to ask, and no reported field distinguishes it
|
|
162
|
-
from a plain one.
|
|
163
|
-
|
|
164
|
-
Asking the endpoint (`GET /models`) does identify that case correctly. It was
|
|
165
|
-
measured against all 166 providers carrying an `api` URL in the models.dev
|
|
166
|
-
catalog, and it also denies six of them — `cloudflare-workers-ai`,
|
|
167
|
-
`infomaniak`, `iflowcn`, `inference`, `kuae-cloud-coding-plan`,
|
|
168
|
-
`thinkingmachines` — which work fine and simply have no `/models` route. At a
|
|
169
|
-
3.6% false-negative rate on providers known to work, the probe removes more
|
|
170
|
-
working models from the picker than broken ones, and a provider that silently
|
|
171
|
-
vanishes explains nothing while one that fails on use says why.
|
|
172
|
-
|
|
173
|
-
So availability stops at credential and endpoint, and the protocol verdict is
|
|
174
|
-
left to the call. A provider whose protocol lives in a plugin's `fetch` stays
|
|
175
|
-
selectable and fails when used — which is what it did before this resolution
|
|
176
|
-
existed.
|
|
177
|
-
|
|
178
|
-
Claude Code is refused unconditionally. A plugin can publish an
|
|
179
|
-
OpenAI-compatible endpoint for it, but that endpoint is a façade over the
|
|
180
|
-
Claude Agent SDK, which spawns the Claude Code CLI per request and spends the
|
|
181
|
-
user's Claude subscription rate limit. Paying that for a session title or a
|
|
182
|
-
summary is the wrong trade, so an available endpoint does not lift the
|
|
183
|
-
refusal — the cost is the reason, not the transport.
|
|
184
|
-
|
|
185
|
-
The result is served as `authenticatedProviders` on `GET /api/small-model`.
|
|
186
|
-
The field name predates the runtime resolution; it now means "callable", which
|
|
187
|
-
is a superset of "has an auth.json entry".
|
|
188
|
-
|
|
189
|
-
## Registration
|
|
190
|
-
|
|
191
|
-
Mounted lazily from `feature-routes-runtime.js` (same pattern as quota): the
|
|
192
|
-
module is imported on first request, not at server startup.
|
|
193
|
-
|
|
194
|
-
## Known limitations
|
|
195
|
-
|
|
196
|
-
- OpenCode's free models (`opencode/big-pickle`, `*-free`) work without a
|
|
197
|
-
token only through OpenCode's own server — direct calls are rejected, and
|
|
198
|
-
piggybacking on their subsidized infra is out of bounds by design. Every
|
|
199
|
-
resolution step therefore requires a credential we are allowed to use:
|
|
200
|
-
a session on an unauthenticated `opencode` provider falls through to the
|
|
201
|
-
global scan (or a clean 404 on a vanilla setup with no logins). The runtime
|
|
202
|
-
snapshot does not weaken this — OpenCode reports the sentinel
|
|
203
|
-
`apiKey: "public"` for that state, and this module refuses to read it as a
|
|
204
|
-
credential.
|
|
205
|
-
|
|
206
|
-
- Anthropic OAuth (Claude Pro/Max) entries are not supported — OpenCode itself
|
|
207
|
-
keeps those outside `auth.json` in this generation; only `type: api` keys
|
|
208
|
-
work for Anthropic.
|
|
209
|
-
- Amazon Bedrock, GitLab, Azure and other credential-chain providers are out
|
|
210
|
-
of scope; they need more than a key/token (regions, resource names).
|
|
211
|
-
- Responses from the codex backend are collected from the SSE stream; the
|
|
212
|
-
endpoint itself is non-streaming by design (small utility calls).
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# Managed System Prompt Optimizer
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
|
|
5
|
-
This module injects an opt-in OpenCode plugin only when AiWorker launches
|
|
6
|
-
and owns the OpenCode process and `optimizeSystemPrompt` is enabled. The plugin
|
|
7
|
-
replaces OpenCode's built-in behavioral/provider prompt with a short identity
|
|
8
|
-
while preserving the environment, project instructions, MCP instructions,
|
|
9
|
-
skills, conversation history, and separately supplied tools.
|
|
10
|
-
|
|
11
|
-
## Runtime flow
|
|
12
|
-
|
|
13
|
-
1. Settings persist `optimizeSystemPrompt` in AiWorker's `settings.json`.
|
|
14
|
-
2. The setting is applied when managed OpenCode restarts.
|
|
15
|
-
3. The runtime materializes the plugin under
|
|
16
|
-
`<openchamber-data-dir>/system-prompt/` and appends its `file://` URL to
|
|
17
|
-
`OPENCODE_CONFIG_CONTENT` without replacing existing plugin entries.
|
|
18
|
-
4. The plugin tracks the selected agent through `chat.message`. The transform
|
|
19
|
-
runs only for sessions using the built-in `build` or `plan` agent.
|
|
20
|
-
5. The transform locates OpenCode's environment boundary and removes only the
|
|
21
|
-
preceding text. If the boundary is absent, it leaves the prompt unchanged.
|
|
22
|
-
|
|
23
|
-
## Limitations
|
|
24
|
-
|
|
25
|
-
OpenCode exposes the assembled prompt rather than structured sections. A custom
|
|
26
|
-
prompt configured by overriding the `build` or `plan` agent occupies the same
|
|
27
|
-
prefix as the built-in provider prompt, so the optimizer also removes that
|
|
28
|
-
override. Other agents are never transformed. The setting is off by default.
|
|
29
|
-
|
|
30
|
-
Plan-mode restrictions and build-mode transitions are not part of the removed
|
|
31
|
-
prefix. OpenCode injects those as synthetic message reminders after system
|
|
32
|
-
prompt transformation and separately enforces plan restrictions through tool
|
|
33
|
-
permissions.
|
|
34
|
-
|
|
35
|
-
The plugin is not injected for external OpenCode servers or VS Code's separate
|
|
36
|
-
OpenCode lifecycle.
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Terminal Subsystem
|
|
2
|
-
|
|
3
|
-
## Ownership
|
|
4
|
-
|
|
5
|
-
`runtime.js` owns terminal identity, PTY processes, status, ordered output, bounded scrollback, WebSocket attachments, and lifecycle routes. `shells.js` discovers executable shell families and resolves the persisted shell ID without accepting command strings or arguments. Clients own tab arrangement and choose stable terminal IDs. Electron uses this same runtime in-process; VS Code returns an explicit unsupported error.
|
|
6
|
-
|
|
7
|
-
## Protocol
|
|
8
|
-
|
|
9
|
-
`/api/terminal/ws` is the only terminal data transport. It uses v3 binary JSON control frames and is opened through `openRuntimeWebSocket`, preserving direct, Electron proxy, URL-token authentication, and private-relay routing.
|
|
10
|
-
|
|
11
|
-
- `attach` registers a connection for one terminal. One socket may attach to many terminals.
|
|
12
|
-
- Every attach and reconnect begins with an authoritative `snapshot` containing bounded history and the current sequence.
|
|
13
|
-
- A current socket that closes or errors before its initial `open` invalidates its URL-scoped auth token before retrying, so retries mint a fresh token instead of backing off against a rejected upgrade. Hidden or offline clients wait 60 seconds and wake promptly on visibility/online recovery.
|
|
14
|
-
- `output`, `exit`, and `restarted` carry monotonically increasing per-terminal sequences. Output carries raw live bytes plus replay-safe bytes with terminal query exchanges removed.
|
|
15
|
-
- Attach registers before capturing the snapshot, buffers concurrent events, drops events represented by the snapshot sequence, then enters live delivery.
|
|
16
|
-
- `write` always includes the terminal ID; sockets never have mutable single-terminal binding state.
|
|
17
|
-
- `detach` removes only that attachment.
|
|
18
|
-
- Creation carries the active UI appearance. The PTY sets `COLORFGBG` and answers OSC 10, OSC 11, Mode 2031, and primary-device-attribute queries immediately, including queries emitted before a WebSocket attachment exists. The DA1 fallback prevents Fish from waiting ten seconds for a renderer that cannot observe or answer its startup query. Subscribed TUIs receive a Mode 2031 notification when the appearance changes.
|
|
19
|
-
|
|
20
|
-
HTTP remains the authenticated command plane for create, resize, appearance updates, restart, close, and force-kill. There is no SSE output or HTTP input compatibility path.
|
|
21
|
-
|
|
22
|
-
`GET /api/terminal/sessions` enumerates live sessions (optionally filtered by resolved `cwd`) so clients can adopt terminals their local tab projection does not know about — another device, a new browser tab, or cleared storage. `POST /api/terminal/touch` refreshes `lastActivity` for the listed session ids; open clients call it periodically so background tabs, which hold no WebSocket attachment, are not idle-reaped while a client still shows them.
|
|
23
|
-
|
|
24
|
-
## PTY Lifecycle
|
|
25
|
-
|
|
26
|
-
- IDs are client-provided or generated with `randomUUID()`.
|
|
27
|
-
- Concurrent creates for one ID are single-flight only when working directory and shell preference match. Existing IDs cannot be reused for another working directory.
|
|
28
|
-
- Dimensions are bounded to 1-1000 columns and 1-500 rows; input is capped at 64 KiB.
|
|
29
|
-
- A client may create before its renderer has mounted. It derives an initial size from the container and font metrics (falling back to 80x24 when unavailable), then sends a resize once Ghostty reports its final dimensions. This allows shell startup and renderer initialization to overlap.
|
|
30
|
-
- PTY children explicitly clear `NODE_CHANNEL_FD`; daemon IPC descriptors are host-private and invalid after PTY descriptor cleanup.
|
|
31
|
-
- PTY children also strip AppImage `ARGV0` (and other host-private shell vars such as `ELECTRON_RUN_AS_NODE`, `BASH_ENV`, `ENV`, `BASH_XTRACEFD`). An exported `ARGV0` makes zsh rewrite argv[0] for every external command, which breaks Python venv detection and other argv[0]/$0 consumers while leaving `/proc/self/exe` correct. On Linux, PTY spawn is wrapped with `env -u ARGV0` because `bun-pty` merges the native OS environ and would otherwise reintroduce `ARGV0` after a JS-only delete.
|
|
32
|
-
- `GET /api/terminal/shells` reports shell IDs available on the active server using the same augmented PATH provided to spawned PTYs, plus whether each executable has a supported login-mode argument. `auto` preserves environment/platform fallback order; an explicit unavailable shell fails creation instead of silently running a different shell. Login mode is opt-in and uses only built-in arguments for known shells. Preference changes affect new sessions and explicit restarts, not running PTYs.
|
|
33
|
-
- PTY data and exit callbacks enter one FIFO queue. Stale callbacks from replaced processes are ignored.
|
|
34
|
-
- Scrollback is retained on the server and capped at 512 KiB with UTF-8-safe trimming. Device-status, device-attribute, cursor-position reply, and color-query exchanges are removed from replay history with incomplete control sequences carried across PTY chunks; live output remains byte-for-byte unchanged.
|
|
35
|
-
- Exited sessions remain attachable until explicit close or idle cleanup.
|
|
36
|
-
- Restarts are serialized per terminal. Each restart spawns and wires the replacement before terminating the old process, retaining the terminal ID.
|
|
37
|
-
- Close uses SIGTERM with bounded SIGKILL escalation. Force-kill, idle cleanup, and runtime shutdown terminate process groups immediately where supported. Removal explicitly sends a fatal scoped closure and evicts client projections even when a PTY backend fails to emit `onExit`; attached terminals are not considered idle.
|
|
38
|
-
|
|
39
|
-
## Security And Relay
|
|
40
|
-
|
|
41
|
-
The WebSocket path must remain in both `isUrlAuthWebSocketPath` and relay `ALLOWED_WS_PATHS`. The client must use `getRuntimeUrlResolver().websocket()` and `openRuntimeWebSocket`; direct local URLs or raw browser WebSockets break relay and URL-token authentication.
|
|
42
|
-
|
|
43
|
-
## Verification
|
|
44
|
-
|
|
45
|
-
Run:
|
|
46
|
-
|
|
47
|
-
```sh
|
|
48
|
-
bun test packages/web/server/lib/terminal/runtime.test.js packages/web/server/lib/terminal/terminal-ws-protocol.test.js
|
|
49
|
-
bun test packages/web/server/lib/ui-auth/ui-auth.test.js packages/web/server/lib/relay/cross-compat.test.js
|
|
50
|
-
```
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
# Text Module Documentation
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
This module provides shared text transformation helpers that are not owned by a single product surface. It previously proxied model-backed summarization through the opencode.ai Zen provider; that provider is no longer available for this use, so summarization now returns local sanitized/distilled fallback text only.
|
|
5
|
-
|
|
6
|
-
## Entrypoints and structure
|
|
7
|
-
- `packages/web/server/lib/text/summarization.js`: Shared summarize stub + sanitize helpers. It performs no external model calls.
|
|
8
|
-
|
|
9
|
-
## Public exports
|
|
10
|
-
|
|
11
|
-
### Summarization (summarization.js)
|
|
12
|
-
- `summarizeText({ text, threshold, maxLength, zenModel, mode })`: Retired summarization entrypoint retained as an API-compatible stub. `zenModel` is ignored.
|
|
13
|
-
- `sanitizeForTTS(text)`: Sanitizes text for speech output.
|
|
14
|
-
- `sanitizeForNotification(text)`: Sanitizes text for compact notification output.
|
|
15
|
-
- `sanitizeForNote(text)`: Sanitizes text for short note/distillation output.
|
|
16
|
-
|
|
17
|
-
## Modes
|
|
18
|
-
- `tts`: Speakable summary for TTS flows.
|
|
19
|
-
- `notification`: Short plain-text summary for notification bodies.
|
|
20
|
-
- `note`: Distilled short project-memory note.
|
|
21
|
-
|
|
22
|
-
## Response contract
|
|
23
|
-
|
|
24
|
-
### `summarizeText`
|
|
25
|
-
Returns object with:
|
|
26
|
-
- `summary`: Local sanitized/distilled fallback text.
|
|
27
|
-
- `summarized`: Always `false` while the model provider is unavailable.
|
|
28
|
-
- `reason`: Skip reason, usually `Model summarization provider unavailable` for text above threshold.
|
|
29
|
-
- `originalLength`: Optional original text length.
|
|
30
|
-
- `summaryLength`: Optional final summary length.
|
|
31
|
-
|
|
32
|
-
## Notes for contributors
|
|
33
|
-
- Keep this module neutral. Do not re-couple it to TTS-specific naming or routing.
|
|
34
|
-
- Add new mode semantics here when multiple product surfaces need the same text pipeline.
|
|
35
|
-
- Prefer mode-specific prompt and sanitize behavior over creating duplicated summarizers in unrelated modules.
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
# TTS Module Documentation
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
This module provides server-side Text-to-Speech services using OpenAI's TTS API. The historical shared text summarization endpoint now lives in `packages/web/server/lib/text/` as an API-compatible stub because the previous Zen model provider is unavailable.
|
|
5
|
-
|
|
6
|
-
## Entrypoints and structure
|
|
7
|
-
- `packages/web/server/lib/tts/index.js`: Public entrypoint imported by `packages/web/server/index.js`.
|
|
8
|
-
- `packages/web/server/lib/tts/routes.js`: Express route registration for `/api/voice/*`, `/api/tts/*`, and `/api/stt/*` endpoints.
|
|
9
|
-
- `packages/web/server/lib/tts/capability-runtime.js`: runtime helper for probing local macOS `say` TTS voice capability.
|
|
10
|
-
- `packages/web/server/lib/tts/service.js`: TTS service implementation with OpenAI integration.
|
|
11
|
-
- `packages/web/server/lib/text/summarization.js`: Shared text summarization stub and sanitization utilities. It performs no external Zen calls.
|
|
12
|
-
- `packages/web/server/lib/tts/stt.js`: STT proxy for OpenAI-compatible transcription endpoints.
|
|
13
|
-
- `packages/web/server/lib/tts/base-url.js`: shared base URL validation and normalization for custom OpenAI-compatible endpoints.
|
|
14
|
-
- `packages/web/server/lib/tts/language-detect.js`: dependency-free language detection for voice selection (`detectTextLanguage`, `pickVoiceForLanguage`, `languageOfLocale`). Used by the macOS `say` route (`language: 'auto'` switches to an installed voice whose locale matches the text; the response carries `X-Speech-Voice` and `X-Speech-Language`) and by the dictation module's local TTS model choice.
|
|
15
|
-
|
|
16
|
-
## Public exports
|
|
17
|
-
|
|
18
|
-
### TTS Service (from service.js)
|
|
19
|
-
- `ttsService`: Singleton instance of TTSService class.
|
|
20
|
-
- `TTSService`: TTS service class for OpenAI audio generation.
|
|
21
|
-
- `TTS_VOICES`: Array of supported OpenAI voice identifiers.
|
|
22
|
-
|
|
23
|
-
### Shared text summarization (re-exported from ../text/summarization.js)
|
|
24
|
-
- `summarizeText({ text, threshold, maxLength, zenModel, mode })`: Retired shared text summarizer retained as a stub. TTS uses `mode: 'tts'`; `zenModel` is ignored.
|
|
25
|
-
- `sanitizeForTTS(text)`: Sanitizes text by removing markdown, URLs, file paths, and other non-speakable content.
|
|
26
|
-
- `sanitizeForNote(text)`: Re-exported for note-mode callers that still import through the TTS surface.
|
|
27
|
-
|
|
28
|
-
### Capability runtime (capability-runtime.js)
|
|
29
|
-
- `detectSayTtsCapability(processLike)`: probes local `say -v "?"` support and returns `{ available, voices, reason }`.
|
|
30
|
-
|
|
31
|
-
## Constants
|
|
32
|
-
|
|
33
|
-
### Voice identifiers
|
|
34
|
-
- `TTS_VOICES`: Array of supported OpenAI voices: `['alloy', 'ash', 'ballad', 'coral', 'echo', 'fable', 'nova', 'onyx', 'sage', 'shimmer', 'verse', 'marin', 'cedar']`.
|
|
35
|
-
|
|
36
|
-
### Summarization defaults
|
|
37
|
-
- No model request timeout is used; the summarization provider is disabled.
|
|
38
|
-
|
|
39
|
-
### Default values
|
|
40
|
-
- `summarizeText` defaults: `threshold` = 200, `maxLength` = 500, `mode` = 'tts'. `zenModel` is ignored.
|
|
41
|
-
- `generateSpeechStream` defaults: `voice` = 'coral', `model` = 'gpt-4o-mini-tts', `speed` = 1.0.
|
|
42
|
-
- `generateSpeechBuffer` defaults: `voice` = 'coral', `model` = 'gpt-4o-mini-tts', `speed` = 1.0.
|
|
43
|
-
|
|
44
|
-
## TTSService methods
|
|
45
|
-
|
|
46
|
-
### `isAvailable()`
|
|
47
|
-
Returns boolean indicating whether OpenAI API key is configured (checks environment variable `OPENAI_API_KEY` or OpenCode auth file).
|
|
48
|
-
|
|
49
|
-
### `generateSpeechStream(options)`
|
|
50
|
-
Generates speech and returns as a web stream for direct streaming to clients.
|
|
51
|
-
- Options: `text` (required), `voice`, `model`, `speed`, `instructions`, `apiKey`.
|
|
52
|
-
- Returns: `{ stream: ReadableStream, contentType: 'audio/mpeg' }`.
|
|
53
|
-
- Throws: Error if API key not configured or text is empty.
|
|
54
|
-
|
|
55
|
-
### `generateSpeechBuffer(options)`
|
|
56
|
-
Generates speech and returns as Buffer for caching purposes.
|
|
57
|
-
- Options: `text` (required), `voice`, `model`, `speed`, `instructions`.
|
|
58
|
-
- Returns: Buffer containing MP3 audio data.
|
|
59
|
-
- Throws: Error if API key not configured or text is empty.
|
|
60
|
-
|
|
61
|
-
## Response contracts
|
|
62
|
-
|
|
63
|
-
### `summarizeText`
|
|
64
|
-
Returns object with:
|
|
65
|
-
- `summary`: Sanitized or locally distilled fallback text.
|
|
66
|
-
- `summarized`: Always `false` while the model provider is unavailable.
|
|
67
|
-
- `reason`: String explaining why summarization was skipped.
|
|
68
|
-
- `originalLength`: Optional number for original text length.
|
|
69
|
-
- `summaryLength`: Optional number for summarized text length.
|
|
70
|
-
|
|
71
|
-
The route-level text summarize API is now `/api/text/summarize`.
|
|
72
|
-
|
|
73
|
-
### `sanitizeForTTS`
|
|
74
|
-
Returns sanitized string with markdown, URLs, file paths, and special characters removed.
|
|
75
|
-
|
|
76
|
-
### `generateSpeechStream`
|
|
77
|
-
Returns object with:
|
|
78
|
-
- `stream`: ReadableStream of MP3 audio data.
|
|
79
|
-
- `contentType`: Always 'audio/mpeg'.
|
|
80
|
-
|
|
81
|
-
### `generateSpeechBuffer`
|
|
82
|
-
Returns Buffer containing MP3 audio data.
|
|
83
|
-
|
|
84
|
-
## API key resolution
|
|
85
|
-
OpenAI API keys are resolved in order:
|
|
86
|
-
1. Environment variable `OPENAI_API_KEY`.
|
|
87
|
-
2. OpenCode auth file (`auth.openai`, `auth.codex`, or `auth.chatgpt`).
|
|
88
|
-
3. Supports both string format (just token) and object format (with `access` or `token` fields).
|
|
89
|
-
|
|
90
|
-
## Usage in web server
|
|
91
|
-
The TTS module is used by `packages/web/server/index.js` for:
|
|
92
|
-
- Generating speech streams for client playback.
|
|
93
|
-
- Generating speech buffers for caching.
|
|
94
|
-
- Sanitizing text before TTS synthesis. Historical summarization calls now return local fallback text.
|
|
95
|
-
- Sanitizing text to remove non-speakable content.
|
|
96
|
-
|
|
97
|
-
The historical summarization API is shared with notifications and notes, but currently acts as a no-model fallback/stub.
|
|
98
|
-
|
|
99
|
-
The server-side TTS approach bypasses mobile Safari's audio context restrictions by generating audio on the server and streaming to clients.
|
|
100
|
-
|
|
101
|
-
## Notes for contributors
|
|
102
|
-
|
|
103
|
-
### Adding new TTS features
|
|
104
|
-
1. Add new methods to `packages/web/server/lib/tts/service.js` TTSService class.
|
|
105
|
-
2. Export public functions from `packages/web/server/lib/tts/index.js`.
|
|
106
|
-
3. Follow existing patterns for API key resolution and error handling.
|
|
107
|
-
4. Ensure all text is sanitized before TTS synthesis.
|
|
108
|
-
5. Consider adding new voice options to `TTS_VOICES` constant.
|
|
109
|
-
|
|
110
|
-
### Text sanitization
|
|
111
|
-
- Always call `sanitizeForTTS` on text before passing to TTS generation.
|
|
112
|
-
- The sanitization removes markdown, code blocks, URLs, file paths, shell commands, and special characters.
|
|
113
|
-
- This prevents the TTS from reading out technical formatting that sounds unnatural.
|
|
114
|
-
|
|
115
|
-
### Error handling
|
|
116
|
-
- `generateSpeechStream` and `generateSpeechBuffer` throw descriptive errors for missing API keys or empty text.
|
|
117
|
-
- `summarizeText` does not call Zen and returns mode-specific fallback text with `summarized: false`.
|
|
118
|
-
- All errors are logged to console with `[TTSService]` or `[Summarize]` prefix.
|
|
119
|
-
|
|
120
|
-
### API key management
|
|
121
|
-
- TTSService caches OpenAI client instance and recreates when API key changes.
|
|
122
|
-
- API key changes are detected by comparing with `_lastApiKey` property.
|
|
123
|
-
- This allows dynamic API key updates without server restart.
|
|
124
|
-
|
|
125
|
-
### Testing
|
|
126
|
-
- Run `bun run type-check`, `bun run lint`, and `bun run build` before finalizing changes.
|
|
127
|
-
- Test API key resolution with environment variable and auth file.
|
|
128
|
-
- Test speech generation with various text lengths and voice options.
|
|
129
|
-
- Test summarization stub behavior above and below threshold.
|
|
130
|
-
- Test sanitization with markdown, URLs, and code blocks.
|
|
131
|
-
- Verify streaming and buffer generation produce valid MP3 audio.
|
|
132
|
-
|
|
133
|
-
## Verification notes
|
|
134
|
-
|
|
135
|
-
### Manual verification
|
|
136
|
-
1. Configure OpenAI API key via environment variable or OpenCode settings.
|
|
137
|
-
2. Test `ttsService.isAvailable()` returns true.
|
|
138
|
-
3. Call `ttsService.generateSpeechStream({ text: 'Hello world' })` and verify stream is returned.
|
|
139
|
-
4. Call `ttsService.generateSpeechBuffer({ text: 'Hello world' })` and verify Buffer is returned.
|
|
140
|
-
5. Test `summarizeText` with text above and below threshold.
|
|
141
|
-
6. Test `sanitizeForTTS` with markdown, URLs, and code blocks.
|
|
142
|
-
|
|
143
|
-
### API endpoint verification
|
|
144
|
-
1. Start web server and access TTS endpoint via client.
|
|
145
|
-
2. Verify audio plays correctly in browser.
|
|
146
|
-
3. Test on mobile Safari to verify bypass of audio context restrictions.
|
|
147
|
-
4. Test with long messages to verify summarization is triggered.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Tunnels Module Documentation
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
This module contains tunnel provider orchestration for AiWorker, including provider registry/service wiring, managed remote token config lifecycle, and tunnel HTTP route registration.
|
|
5
|
-
|
|
6
|
-
## Entrypoints and structure
|
|
7
|
-
- `packages/web/server/lib/tunnels/index.js`: tunnel service orchestration.
|
|
8
|
-
- `packages/web/server/lib/tunnels/executable-search.js`: cross-platform executable discovery, including Windows Store app aliases.
|
|
9
|
-
- `packages/web/server/lib/tunnels/registry.js`: provider registry.
|
|
10
|
-
- `packages/web/server/lib/tunnels/managed-config.js`: managed remote tunnel token/preset persistence runtime.
|
|
11
|
-
- `packages/web/server/lib/tunnels/install-help.js`: provider/platform install command metadata for missing tunnel dependencies.
|
|
12
|
-
- `packages/web/server/lib/tunnels/routes.js`: tunnel API route registration and request orchestration runtime.
|
|
13
|
-
- `packages/web/server/lib/tunnels/types.js`: tunnel constants, normalization, and shared type helpers.
|
|
14
|
-
- `packages/web/server/lib/tunnels/providers/cloudflare.js`: Cloudflare tunnel provider implementation.
|
|
15
|
-
- `packages/web/server/lib/tunnels/providers/ngrok.js`: Ngrok quick tunnel provider implementation.
|
|
16
|
-
|
|
17
|
-
## Public exports (routes.js)
|
|
18
|
-
- `createTunnelRoutesRuntime(dependencies)`: creates tunnel routes runtime and helpers.
|
|
19
|
-
- Returned API:
|
|
20
|
-
- `registerRoutes(app)`
|
|
21
|
-
- `startTunnelWithNormalizedRequest(request)`
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# UI Auth Module Documentation
|
|
2
|
-
|
|
3
|
-
## Purpose
|
|
4
|
-
This module owns AiWorker UI authentication for browser access, including password session auth, WebAuthn passkeys, and trusted-device session handling.
|
|
5
|
-
|
|
6
|
-
Trusted-device access has one durable credential model: a remote client bearer token stored by `packages/web/server/lib/client-auth/remote-clients.js`. Password, passkey, and Pairing v2 are issuance methods for that credential, not separate credential systems. Issued client tokens are returned once, stored server-side only as hashes, and are later authenticated via `Authorization: Bearer oc_client_...`.
|
|
7
|
-
|
|
8
|
-
Pairing v2 is implemented by `packages/web/server/lib/client-auth/pairing.js`. It stores short-lived one-time pairing sessions with hashed secrets, exposes create/cancel/redeem routes under `/api/client-auth/pairing/*`, and redeems a valid pairing secret into the same remote client token used by password/passkey trusted-device flows.
|
|
9
|
-
|
|
10
|
-
## Entrypoints and structure
|
|
11
|
-
- `packages/web/server/lib/ui-auth/ui-auth.js`: UI auth controller runtime, cookie/session issuance, rate limiting, and auth route handlers.
|
|
12
|
-
- `packages/web/server/lib/ui-auth/ui-passkeys.js`: passkey store and WebAuthn registration/authentication verification helpers.
|
|
13
|
-
- `packages/web/server/lib/client-auth/remote-clients.js`: trusted-device client token storage, bearer authentication, last-used tracking, and revocation.
|
|
14
|
-
- `packages/web/server/lib/client-auth/pairing.js`: short-lived Pairing v2 sessions and one-time secret redemption into trusted-device client tokens.
|
|
15
|
-
|
|
16
|
-
## Public exports (ui-auth.js)
|
|
17
|
-
- `createUiAuth({ password, cookieName, sessionTtlMs, readSettingsFromDiskMigrated })`: creates UI auth controller with methods:
|
|
18
|
-
- `enabled`
|
|
19
|
-
- `requireAuth(req, res, next)`
|
|
20
|
-
- `handleSessionStatus(req, res)`
|
|
21
|
-
- `handleSessionCreate(req, res)`
|
|
22
|
-
- `handlePasskeyStatus(req, res)`
|
|
23
|
-
- `handlePasskeyRegistrationOptions(req, res)`
|
|
24
|
-
- `handlePasskeyRegistrationVerify(req, res)`
|
|
25
|
-
- `handlePasskeyAuthenticationOptions(req, res)`
|
|
26
|
-
- `handlePasskeyAuthenticationVerify(req, res)`
|
|
27
|
-
- `handlePasskeyList(req, res)`
|
|
28
|
-
- `handlePasskeyRevoke(req, res)`
|
|
29
|
-
- `handleResetAuth(req, res)`
|
|
30
|
-
- `ensureSessionToken(req, res)`
|
|
31
|
-
- `dispose()`
|
|
32
|
-
|
|
33
|
-
## Public exports (ui-passkeys.js)
|
|
34
|
-
- `createUiPasskeys({ passwordBinding, readSettingsFromDiskMigrated, storeFile, rpName, challengeTtlMs })`: creates passkey runtime with methods:
|
|
35
|
-
- `enabled`
|
|
36
|
-
- `getStatus(req)`
|
|
37
|
-
- `listPasskeys(req)`
|
|
38
|
-
- `revokePasskey(req, passkeyId)`
|
|
39
|
-
- `clearAllPasskeys()`
|
|
40
|
-
- `beginRegistration(req, { label })`
|
|
41
|
-
- `finishRegistration(payload)`
|
|
42
|
-
- `beginAuthentication(req)`
|
|
43
|
-
- `finishAuthentication(payload)`
|
|
44
|
-
- `dispose()`
|