@openchamber/web 1.18.4 → 1.20.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 +1 -0
- package/dist/assets/{CodeMirrorCommentWidgets-4qZbrEXU.js → CodeMirrorCommentWidgets-C36E738Y.js} +1 -1
- package/dist/assets/{CommitSection-MJmntVPJ.js → CommitSection-C-F3AX6D.js} +1 -1
- package/dist/assets/{DiagramEditor-jnG3Hbxg.js → DiagramEditor-BPECg1jS.js} +1 -1
- package/dist/assets/DiagramView-D0YNMix8.js +1 -0
- package/dist/assets/DiffView-BHWaMYCC.js +4 -0
- package/dist/assets/FilesView-NMBCW2Tm.js +14 -0
- package/dist/assets/{GitView-DBFrDDBv.js → GitView-Rp8P1KEI.js} +4 -4
- package/dist/assets/{JsonTreeView-DLW2Wy1g.js → JsonTreeView-KnXFN2A-.js} +1 -1
- package/dist/assets/MarkdownImageGallery-BMn3mtor.js +1 -0
- package/dist/assets/MarkdownRendererImpl-kD6N03pH.js +12 -0
- package/dist/assets/OnboardingScreen-CenIeD4v.js +1 -0
- package/dist/assets/{PatchDiff-BuLPx7AN.js → PatchDiff-BzVOVog8.js} +1 -1
- package/dist/assets/{PierreDiffViewer-BHm4Yr0X.js → PierreDiffViewer-Dlby4XqT.js} +2 -2
- package/dist/assets/PlanView-Czu1KMJa.js +4 -0
- package/dist/assets/SessionSwitcherDropdown-IETz58DB.js +1 -0
- package/dist/assets/SettingsView-B6vmuf-c.js +28 -0
- package/dist/assets/SettingsWindow-CauZpdD3.js +1 -0
- package/dist/assets/ToolOutputDialog-BB1c--Zr.js +15 -0
- package/dist/assets/ToolPartDiffPreview-DaOIDISD.js +8 -0
- package/dist/assets/{VirtualizedFileDiff-CwGocYQd.js → VirtualizedFileDiff-lESMT-2b.js} +4 -4
- package/dist/assets/{WalkthroughView-5DyvN03T.js → WalkthroughView-CaSYE0lw.js} +2 -2
- package/dist/assets/{computeVirtualFileMetrics-Da00Jg7M.js → computeVirtualFileMetrics-DkRR5b75.js} +2 -2
- package/dist/assets/contextPanelEmbeddedChat-BEARQjgn.js +1 -0
- package/dist/assets/de-DFdX3ABv.js +9 -0
- package/dist/assets/document-attachments-DFAWlG3U.js +31 -0
- package/dist/assets/es-iC-FKvV9.js +15 -0
- package/dist/assets/fr-BBbi_1AL.js +13 -0
- package/dist/assets/index-BiEgzzkg.js +1 -0
- package/dist/assets/index-Cwmuwk3V.js +7 -0
- package/dist/assets/index-GNm1wgUH.css +1 -0
- package/dist/assets/{isDiffPlainText-D9YpoLrV.js → isDiffPlainText-BG53Ixxy.js} +1 -1
- package/dist/assets/{isFilePlainText-gTibdNIe.js → isFilePlainText-BbV-39jl.js} +1 -1
- package/dist/assets/ja-DQLQJL2J.js +15 -0
- package/dist/assets/ko-BeElEB4Y.js +15 -0
- package/dist/assets/{lua-BgMRiT3U.js → lua-VAEuO923.js} +1 -1
- package/dist/assets/main-Dpzo18z7.js +2 -0
- package/dist/assets/main-WMjtYzJs.js +921 -0
- package/dist/assets/markdownCore--tDmyI_v.js +2 -0
- package/dist/assets/miniChat-ldEghBLB.js +2 -0
- package/dist/assets/mobile-Dk-VGreF.js +2 -0
- package/dist/assets/{patchFileDiff-KNkxM1C1.js → patchFileDiff-BcFaMtMu.js} +1 -1
- package/dist/assets/pl-CLHt2_vV.js +15 -0
- package/dist/assets/pt-BR-C_MPUq7e.js +15 -0
- package/dist/assets/renderElectronMiniChatApp-DIgCOmXY.js +2 -0
- package/dist/assets/renderMobileApp-CDfHS5rr.js +25 -0
- package/dist/assets/runtimeEndpointReset-ovNbaZ-x.js +15 -0
- package/dist/assets/scheduledTasksApi-BFSlqgnG.js +1 -0
- package/dist/assets/{shikiHighlight-C7LTbwFx.js → shikiHighlight-DCT2Sq_z.js} +1 -1
- package/dist/assets/uk-PhsC-c4-.js +15 -0
- package/dist/assets/{useAppFontEffects-BikB6enL.js → useAppFontEffects-B53Rb6m7.js} +168 -164
- package/dist/assets/useInlineCommentController-DSfrIBKT.js +2 -0
- package/dist/assets/{vendor-base-ui-D_V6hAcE.js → vendor-base-ui-DsHmyMwp.js} +1 -1
- package/dist/assets/vendor-codemirror-autocomplete-DzPz9Wgq.js +1 -0
- package/dist/assets/vendor-codemirror-commands-B7H_j0iU.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-angular-CgY7_gQ1.js → vendor-codemirror-lang-angular-DEPs2M5t.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-cpp-B5Ta4enQ.js → vendor-codemirror-lang-cpp-DhkseaMo.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-css-VgNqFSH-.js → vendor-codemirror-lang-css-O0cZX78y.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-go-LxLz62pp.js → vendor-codemirror-lang-go-fMdQYcON.js} +1 -1
- package/dist/assets/vendor-codemirror-lang-html-CfgK872x.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-java-Bksi1PH4.js → vendor-codemirror-lang-java-CQj4S3zl.js} +1 -1
- package/dist/assets/vendor-codemirror-lang-javascript-Cc2ZYbgX.js +13 -0
- package/dist/assets/{vendor-codemirror-lang-jinja-C7npuDD7.js → vendor-codemirror-lang-jinja-BmZZv8g-.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-json-ryCw7nab.js → vendor-codemirror-lang-json-CMBS2tG9.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-less-BxsZJD6N.js → vendor-codemirror-lang-less-C6Eo8hVS.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-liquid-De6qch10.js → vendor-codemirror-lang-liquid-DSTR47-H.js} +1 -1
- package/dist/assets/vendor-codemirror-lang-markdown-BPGOH9ye.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-php-Cm1es33p.js → vendor-codemirror-lang-php-DD9udfPH.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-python-N414WYK-.js → vendor-codemirror-lang-python-HahnQaAS.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-rust-C_WuUStH.js → vendor-codemirror-lang-rust-nLTovbjv.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sass-8UHTCAOM.js → vendor-codemirror-lang-sass-pL2Yc72v.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-sql-CV3sMA5D.js → vendor-codemirror-lang-sql-BVBnan19.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-vue-DzvC1Dhk.js → vendor-codemirror-lang-vue-BqGzJVm1.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-wast-jlr-LDdA.js → vendor-codemirror-lang-wast-B0_m5DqU.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-xml-CrO63OVp.js → vendor-codemirror-lang-xml-Dj3voadT.js} +1 -1
- package/dist/assets/{vendor-codemirror-lang-yaml-dxi6CISW.js → vendor-codemirror-lang-yaml-yu-9Z5u7.js} +1 -1
- package/dist/assets/vendor-codemirror-language-BgPj_McA.js +3 -0
- package/dist/assets/{vendor-codemirror-language-data-CLHw8NWn.js → vendor-codemirror-language-data-vch3tJ4c.js} +2 -2
- package/dist/assets/vendor-codemirror-search-BmS-GmcX.js +2 -0
- package/dist/assets/{vendor-codemirror-state-CNWM3Q8V.js → vendor-codemirror-state-C9awkmn-.js} +5 -5
- package/dist/assets/vendor-codemirror-view-CiLROUVV.js +4 -0
- package/dist/assets/vendor-replit-codemirror-vim-B2DJlAhT.js +6 -0
- package/dist/assets/vendor-replit-codemirror-vim-core-FHzKdNUS.js +34 -0
- package/dist/assets/vendor-zod-C9ioTTSo.js +39 -0
- package/dist/assets/{web-components-GMc3oR3i.js → web-components-pcwCTWjC.js} +4 -4
- package/dist/assets/zh-CN-wF-NOFHM.js +15 -0
- package/dist/assets/zh-TW-4m4-A7rT.js +15 -0
- package/dist/index.html +5 -4
- package/dist/mini-chat.html +4 -3
- package/dist/mobile.html +4 -3
- package/package.json +3 -5
- package/server/index.js +152 -3
- package/server/lib/agent-memory/actions.js +243 -0
- package/server/lib/agent-memory/actions.test.js +343 -0
- package/server/lib/agent-memory/feature-flag.js +19 -0
- package/server/lib/agent-memory/feature-flag.test.js +38 -0
- package/server/lib/agent-memory/project-resolution.js +65 -0
- package/server/lib/agent-memory/project-resolution.test.js +94 -0
- package/server/lib/agent-memory/routes.http.test.js +270 -0
- package/server/lib/agent-memory/routes.js +169 -0
- package/server/lib/agent-memory/runtime.js +432 -0
- package/server/lib/agent-memory/runtime.test.js +344 -0
- package/server/lib/agent-memory/threat-patterns.js +61 -0
- package/server/lib/agent-memory/threat-patterns.test.js +61 -0
- package/server/lib/agent-tool/DOCUMENTATION.md +14 -0
- package/server/lib/agent-tool/runtime.js +63 -13
- package/server/lib/agent-tool/runtime.test.js +85 -2
- package/server/lib/context-obligatory/runtime.js +34 -3
- package/server/lib/context-obligatory/runtime.test.js +114 -0
- package/server/lib/dictation/DOCUMENTATION.md +32 -8
- package/server/lib/dictation/local/sherpa-recognizer.js +35 -78
- package/server/lib/dictation/local/worker-process.js +2 -2
- package/server/lib/dictation/openai-compatible-session.js +3 -2
- package/server/lib/dictation/stream-manager.js +77 -34
- package/server/lib/dictation/stream-manager.test.js +60 -2
- package/server/lib/fs/DOCUMENTATION.md +3 -0
- package/server/lib/fs/routes.js +149 -32
- package/server/lib/fs/routes.test.js +301 -0
- package/server/lib/git/DOCUMENTATION.md +8 -0
- package/server/lib/git/routes.js +43 -0
- package/server/lib/git/service.js +206 -72
- package/server/lib/git/service.test.js +222 -0
- package/server/lib/github/DOCUMENTATION.md +14 -3
- package/server/lib/github/pr-status.js +188 -83
- package/server/lib/github/pr-status.test.js +182 -0
- package/server/lib/github/routes.js +36 -30
- package/server/lib/notifications/template-runtime.js +2 -3
- package/server/lib/openchamber-control/action-resolution.test.js +65 -0
- package/server/lib/openchamber-control/actions.js +78 -0
- package/server/lib/openchamber-control/service.js +7 -0
- package/server/lib/openchamber-sessions/routes.js +14 -0
- package/server/lib/opencode/DOCUMENTATION.md +12 -6
- package/server/lib/opencode/claude-cli-auth.js +60 -0
- package/server/lib/opencode/claude-cli-auth.test.js +54 -0
- package/server/lib/opencode/feature-routes-runtime.js +16 -9
- package/server/lib/opencode/lifecycle.js +202 -26
- package/server/lib/opencode/lifecycle.test.js +179 -1
- package/server/lib/opencode/plugins.js +12 -3
- package/server/lib/opencode/plugins.test.js +18 -0
- package/server/lib/opencode/providers.js +9 -4
- package/server/lib/opencode/providers.test.js +27 -0
- package/server/lib/opencode/proxy-agent-wiring.test.js +152 -0
- package/server/lib/opencode/proxy.js +116 -6
- package/server/lib/opencode/proxy.test.js +158 -1
- package/server/lib/opencode/restart-session-recovery.test.js +59 -0
- package/server/lib/opencode/routes.js +4 -1
- package/server/lib/opencode/session-runtime.js +39 -2
- package/server/lib/opencode/session-runtime.test.js +74 -0
- package/server/lib/opencode/settings-helpers.js +26 -0
- package/server/lib/opencode/settings-helpers.test.js +57 -0
- package/server/lib/opencode/settings-normalization-runtime.js +3 -0
- package/server/lib/opencode/settings-normalization-runtime.test.js +16 -0
- package/server/lib/opencode/settings-runtime.js +83 -10
- package/server/lib/opencode/settings-runtime.test.js +85 -0
- package/server/lib/opencode/shared.js +120 -16
- package/server/lib/opencode/shared.test.js +185 -1
- package/server/lib/opencode/skill-routes.js +29 -73
- package/server/lib/opencode/skill-routes.test.js +2 -5
- package/server/lib/project-context/DOCUMENTATION.md +160 -0
- package/server/lib/project-context/routes.http.test.js +264 -0
- package/server/lib/project-context/routes.js +237 -0
- package/server/lib/project-context/runtime.js +672 -0
- package/server/lib/project-context/runtime.test.js +498 -0
- package/server/lib/projects/project-config.js +7 -2
- package/server/lib/quota/DOCUMENTATION.md +17 -2
- package/server/lib/quota/providers/claude/auth.js +113 -0
- package/server/lib/quota/providers/claude/auth.test.js +117 -0
- package/server/lib/quota/providers/claude/index.js +151 -0
- package/server/lib/quota/providers/claude/index.test.js +147 -0
- package/server/lib/quota/providers/claude/transforms.js +127 -0
- package/server/lib/quota/providers/claude/transforms.test.js +82 -0
- package/server/lib/quota/providers/command-code.js +90 -0
- package/server/lib/quota/providers/command-code.test.js +85 -0
- package/server/lib/quota/providers/index.js +30 -2
- package/server/lib/quota/providers/index.test.js +10 -1
- package/server/lib/quota/providers/zai.js +26 -6
- package/server/lib/quota/providers/zai.test.js +33 -0
- package/server/lib/quota/utils/formatters.js +2 -1
- package/server/lib/scheduled-tasks/runtime.js +21 -2
- package/server/lib/session-knowledge/DOCUMENTATION.md +89 -0
- package/server/lib/session-knowledge/routes.js +107 -0
- package/server/lib/session-knowledge/runtime.js +331 -0
- package/server/lib/session-knowledge/runtime.test.js +275 -0
- package/server/lib/skills-catalog/DOCUMENTATION.md +18 -45
- package/server/lib/skills-catalog/cache.js +120 -1
- package/server/lib/skills-catalog/cache.test.js +77 -0
- package/server/lib/skills-catalog/curated-sources.js +21 -5
- package/server/lib/skills-catalog/curated-sources.test.js +10 -0
- package/server/lib/skills-catalog/disk-cache.js +52 -0
- package/server/lib/skills-catalog/github-meta.js +139 -0
- package/server/lib/skills-catalog/github-meta.test.js +71 -0
- package/server/lib/skills-catalog/source.js +0 -5
- package/server/lib/small-model/DOCUMENTATION.md +74 -6
- package/server/lib/small-model/call.js +46 -12
- package/server/lib/small-model/call.test.js +79 -0
- package/server/lib/small-model/index.js +57 -6
- package/server/lib/small-model/index.test.js +102 -2
- package/server/lib/small-model/routes.js +4 -2
- package/server/lib/small-model/runtime-providers.js +156 -0
- package/server/lib/small-model/runtime-providers.test.js +112 -0
- package/dist/assets/DiagramView-CFXxgg_a.js +0 -1
- package/dist/assets/DiffView-DZIoOnV7.js +0 -4
- package/dist/assets/FilesView-BKL6YlKG.js +0 -14
- package/dist/assets/MarkdownImageGallery-DKIylIK7.js +0 -1
- package/dist/assets/MarkdownRendererImpl-CLv8hxvv.js +0 -12
- package/dist/assets/OnboardingScreen-D2Y6djMw.js +0 -1
- package/dist/assets/PlanView-ZYEJn8A_.js +0 -4
- package/dist/assets/SessionSwitcherDropdown-rro-SsaO.js +0 -1
- package/dist/assets/SettingsView-5RmswFZe.js +0 -28
- package/dist/assets/SettingsWindow-BZhAYFdS.js +0 -1
- package/dist/assets/ToolOutputDialog-Za6V4VMJ.js +0 -15
- package/dist/assets/ToolPartDiffPreview-BL-9ixyC.js +0 -8
- package/dist/assets/contextPanelEmbeddedChat-B-bSg3P5.js +0 -1
- package/dist/assets/de-u7gSnqWs.js +0 -9
- package/dist/assets/document-attachments-CX_YaDsu.js +0 -30
- package/dist/assets/es-T9O7aAOr.js +0 -15
- package/dist/assets/fr-Oor7ewbE.js +0 -13
- package/dist/assets/index-BzIpNlNE.css +0 -1
- package/dist/assets/index-C0yNhuZw.js +0 -1
- package/dist/assets/index-DRpChWux.js +0 -7
- package/dist/assets/ja-DHpqbVmr.js +0 -15
- package/dist/assets/ko-CwLkS3nx.js +0 -15
- package/dist/assets/main-D7UcL3VQ.js +0 -2
- package/dist/assets/main-DPMd2iKS.js +0 -915
- package/dist/assets/markdownCore-DDrHVneM.js +0 -2
- package/dist/assets/miniChat-O_GVoEbc.js +0 -2
- package/dist/assets/mobile-Br4TtAqc.js +0 -2
- package/dist/assets/pl-CcZILN8q.js +0 -15
- package/dist/assets/pt-BR-DYHhVK6o.js +0 -15
- package/dist/assets/renderElectronMiniChatApp-CJpdxTT1.js +0 -2
- package/dist/assets/renderMobileApp-toj9cXoh.js +0 -25
- package/dist/assets/runtimeEndpointReset-BVmispdD.js +0 -13
- package/dist/assets/scheduledTasksApi-ByKya3Un.js +0 -1
- package/dist/assets/uk-BA2kZR38.js +0 -15
- package/dist/assets/useInlineCommentController-CYPvYJDt.js +0 -2
- package/dist/assets/vendor-codemirror-autocomplete-BjbBRsUA.js +0 -1
- package/dist/assets/vendor-codemirror-commands-ARAOgp1x.js +0 -1
- package/dist/assets/vendor-codemirror-lang-html-B3Qe3OpS.js +0 -1
- package/dist/assets/vendor-codemirror-lang-javascript-Bbw3D7r0.js +0 -13
- package/dist/assets/vendor-codemirror-lang-markdown-FGQydhTc.js +0 -1
- package/dist/assets/vendor-codemirror-language-DUOssd4j.js +0 -3
- package/dist/assets/vendor-codemirror-search-8kyQdB3f.js +0 -2
- package/dist/assets/vendor-codemirror-view-DSzLbZiS.js +0 -4
- package/dist/assets/vendor-replit-codemirror-vim-B0Ecqnlh.js +0 -39
- package/dist/assets/zh-CN-dlOQK6v9.js +0 -15
- package/dist/assets/zh-TW-BnqQ-WL5.js +0 -15
- package/server/lib/quota/providers/claude.js +0 -107
- package/server/lib/skills-catalog/clawdhub/api.js +0 -126
- package/server/lib/skills-catalog/clawdhub/install.js +0 -238
- package/server/lib/skills-catalog/clawdhub/install.test.js +0 -100
- package/server/lib/skills-catalog/clawdhub/scan.js +0 -61
package/dist/index.html
CHANGED
|
@@ -509,15 +509,16 @@
|
|
|
509
509
|
pointer-events: none;
|
|
510
510
|
}
|
|
511
511
|
</style>
|
|
512
|
-
<script type="module" crossorigin src="/assets/main-
|
|
512
|
+
<script type="module" crossorigin src="/assets/main-Dpzo18z7.js"></script>
|
|
513
513
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
514
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-C9ioTTSo.js">
|
|
514
515
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
|
|
515
516
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
516
517
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
517
518
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
518
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
519
|
-
<link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-
|
|
520
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
519
|
+
<link rel="modulepreload" crossorigin href="/assets/index-Cwmuwk3V.js">
|
|
520
|
+
<link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-BEARQjgn.js">
|
|
521
|
+
<link rel="stylesheet" crossorigin href="/assets/index-GNm1wgUH.css">
|
|
521
522
|
</head>
|
|
522
523
|
<body class="h-full bg-background text-foreground">
|
|
523
524
|
<div id="root" class="h-full">
|
package/dist/mini-chat.html
CHANGED
|
@@ -74,14 +74,15 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
|
|
77
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
77
|
+
<script type="module" crossorigin src="/assets/miniChat-ldEghBLB.js"></script>
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
79
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-C9ioTTSo.js">
|
|
79
80
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
|
|
80
81
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
81
82
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
82
83
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
83
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
84
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
84
|
+
<link rel="modulepreload" crossorigin href="/assets/index-Cwmuwk3V.js">
|
|
85
|
+
<link rel="stylesheet" crossorigin href="/assets/index-GNm1wgUH.css">
|
|
85
86
|
</head>
|
|
86
87
|
<body class="h-full bg-background text-foreground">
|
|
87
88
|
<div id="root" class="h-full">
|
package/dist/mobile.html
CHANGED
|
@@ -63,14 +63,15 @@
|
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-Dk-VGreF.js"></script>
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-C9ioTTSo.js">
|
|
68
69
|
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-sdk-BJ73u-bH.js">
|
|
69
70
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
70
71
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
71
72
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
73
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/index-Cwmuwk3V.js">
|
|
74
|
+
<link rel="stylesheet" crossorigin href="/assets/index-GNm1wgUH.css">
|
|
74
75
|
</head>
|
|
75
76
|
<body class="h-full bg-background text-foreground">
|
|
76
77
|
<div id="root" class="h-full"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openchamber/web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.20.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./server/index.js",
|
|
@@ -25,9 +25,8 @@
|
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@clack/prompts": "^1.1.0",
|
|
27
27
|
"@octokit/rest": "^22.0.1",
|
|
28
|
-
"@opencode-ai/sdk": "1.18.
|
|
28
|
+
"@opencode-ai/sdk": "1.18.21",
|
|
29
29
|
"@simplewebauthn/server": "13.3.1",
|
|
30
|
-
"adm-zip": "^0.6.0",
|
|
31
30
|
"bun-pty": "^0.4.5",
|
|
32
31
|
"compression": "^1.8.1",
|
|
33
32
|
"cron-parser": "^4.9.0",
|
|
@@ -63,7 +62,6 @@
|
|
|
63
62
|
"@remixicon/react": "^4.7.0",
|
|
64
63
|
"@simplewebauthn/browser": "13.3.0",
|
|
65
64
|
"@tailwindcss/postcss": "^4.0.0",
|
|
66
|
-
"@types/adm-zip": "^0.5.7",
|
|
67
65
|
"@types/node": "^24.3.1",
|
|
68
66
|
"@types/react": "^19.1.10",
|
|
69
67
|
"@types/react-dom": "^19.1.7",
|
|
@@ -89,8 +87,8 @@
|
|
|
89
87
|
"remark-gfm": "^4.0.1",
|
|
90
88
|
"sonner": "^2.0.7",
|
|
91
89
|
"strip-json-comments": "^5.0.3",
|
|
92
|
-
"tailwind-merge": "^3.3.1",
|
|
93
90
|
"supertest": "^7.2.2",
|
|
91
|
+
"tailwind-merge": "^3.3.1",
|
|
94
92
|
"tailwindcss": "^4.0.0",
|
|
95
93
|
"tsx": "^4.20.6",
|
|
96
94
|
"tw-animate-css": "^1.3.8",
|
package/server/index.js
CHANGED
|
@@ -72,10 +72,12 @@ import { createOpenCodeResolutionRuntime } from './lib/opencode/opencode-resolut
|
|
|
72
72
|
import { resolveOpenCodeUpgradeCapability } from './lib/opencode/upgrade-capability.js';
|
|
73
73
|
import { createBootstrapRuntime } from './lib/opencode/bootstrap-runtime.js';
|
|
74
74
|
import { createSessionRuntime } from './lib/opencode/session-runtime.js';
|
|
75
|
+
import { configureOpenCodeRuntimeProviders, resetOpenCodeRuntimeProviders } from './lib/small-model/runtime-providers.js';
|
|
75
76
|
import { createOpenCodeWatcherRuntime } from './lib/opencode/watcher.js';
|
|
76
77
|
import { createSessionAssistRuntime } from './lib/session-assist/runtime.js';
|
|
77
78
|
import { createSessionGoalRuntime } from './lib/session-goal/runtime.js';
|
|
78
79
|
import { createContextObligatoryRuntime } from './lib/context-obligatory/runtime.js';
|
|
80
|
+
import { createSessionKnowledgeRuntime } from './lib/session-knowledge/runtime.js';
|
|
79
81
|
import { createScheduledTasksRuntime } from './lib/scheduled-tasks/runtime.js';
|
|
80
82
|
import { createServerStartupRuntime } from './lib/opencode/server-startup-runtime.js';
|
|
81
83
|
import { createTunnelWiringRuntime } from './lib/opencode/tunnel-wiring-runtime.js';
|
|
@@ -90,6 +92,12 @@ import { createNotificationTemplateRuntime } from './lib/notifications/template-
|
|
|
90
92
|
import { createPermissionAutoAcceptRuntime } from './lib/permission-auto-accept/runtime.js';
|
|
91
93
|
import { createGracefulShutdownRuntime } from './lib/opencode/shutdown-runtime.js';
|
|
92
94
|
import { createProjectConfigRuntime } from './lib/projects/project-config.js';
|
|
95
|
+
import { createProjectContextRuntime } from './lib/project-context/runtime.js';
|
|
96
|
+
import { createAgentMemoryRuntime } from './lib/agent-memory/runtime.js';
|
|
97
|
+
import { createAgentMemoryActions } from './lib/agent-memory/actions.js';
|
|
98
|
+
import { createMemoryProjectResolver } from './lib/agent-memory/project-resolution.js';
|
|
99
|
+
import { isAgentMemoryFeatureAvailable } from './lib/agent-memory/feature-flag.js';
|
|
100
|
+
import { resolvePrimaryWorktreeRoot } from './lib/git/service.js';
|
|
93
101
|
import { createRemoteClientAuthRuntime } from './lib/client-auth/remote-clients.js';
|
|
94
102
|
import { createClientPairingRuntime } from './lib/client-auth/pairing.js';
|
|
95
103
|
import { attachRealtimeProxy } from './lib/realtime-proxy.js';
|
|
@@ -104,6 +112,7 @@ import { createSystemPromptRuntime } from './lib/system-prompt/runtime.js';
|
|
|
104
112
|
import { createOpenChamberSessionService } from './lib/openchamber-sessions/routes.js';
|
|
105
113
|
import { createScheduledTaskService } from './lib/scheduled-tasks/service.js';
|
|
106
114
|
import { createOpenChamberControlService } from './lib/openchamber-control/service.js';
|
|
115
|
+
import { OpenChamberControlError } from './lib/openchamber-control/error.js';
|
|
107
116
|
import webPush from 'web-push';
|
|
108
117
|
|
|
109
118
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -472,6 +481,34 @@ const projectConfigRuntime = createProjectConfigRuntime({
|
|
|
472
481
|
projectsDirPath: OPENCHAMBER_PROJECTS_CONFIG_DIR,
|
|
473
482
|
});
|
|
474
483
|
|
|
484
|
+
const projectContextRuntime = createProjectContextRuntime({
|
|
485
|
+
fsPromises,
|
|
486
|
+
path,
|
|
487
|
+
projectsDirPath: OPENCHAMBER_PROJECTS_CONFIG_DIR,
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
const agentMemoryRuntime = createAgentMemoryRuntime({
|
|
491
|
+
fsPromises,
|
|
492
|
+
path,
|
|
493
|
+
projectsDirPath: OPENCHAMBER_PROJECTS_CONFIG_DIR,
|
|
494
|
+
userConfigRoot: OPENCHAMBER_USER_CONFIG_ROOT,
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* One switch for everything memory-related. It gates the tool, these routes,
|
|
499
|
+
* and the session index alike, so turning memory off leaves nothing behind
|
|
500
|
+
* that still reads or writes the store.
|
|
501
|
+
*/
|
|
502
|
+
const isAgentMemoryEnabled = async () => {
|
|
503
|
+
// The feature gate comes first: unreleased means absent, not merely switched
|
|
504
|
+
// off, so no stored setting can bring it back.
|
|
505
|
+
if (!isAgentMemoryFeatureAvailable()) {
|
|
506
|
+
return false;
|
|
507
|
+
}
|
|
508
|
+
const settings = await readSettingsFromDiskMigrated().catch(() => null);
|
|
509
|
+
return settings?.agentMemoryToolEnabled === true;
|
|
510
|
+
};
|
|
511
|
+
|
|
475
512
|
// HMR-persistent state via globalThis
|
|
476
513
|
// These values survive Vite HMR reloads to prevent zombie OpenCode processes
|
|
477
514
|
const hmrStateRuntime = createHmrStateRuntime({
|
|
@@ -494,6 +531,9 @@ let openCodeApiPrefixDetected = true;
|
|
|
494
531
|
let openCodeApiDetectionTimer = null;
|
|
495
532
|
let lastOpenCodeError = null;
|
|
496
533
|
let lastOpenCodeLaunchDiagnostics = null;
|
|
534
|
+
let lastOpenCodeHealthFailure = null;
|
|
535
|
+
let lastManagedOpenCodeProcess = null;
|
|
536
|
+
let lastOpenCodeRestartDiagnostics = null;
|
|
497
537
|
let isOpenCodeReady = false;
|
|
498
538
|
let openCodeNotReadySince = 0;
|
|
499
539
|
let isExternalOpenCode = false;
|
|
@@ -625,6 +665,11 @@ const buildOpenCodeUrl = (...args) => openCodeNetworkRuntime.buildOpenCodeUrl(..
|
|
|
625
665
|
const ensureOpenCodeApiPrefix = (...args) => openCodeNetworkRuntime.ensureOpenCodeApiPrefix(...args);
|
|
626
666
|
const scheduleOpenCodeApiDetection = (...args) => openCodeNetworkRuntime.scheduleOpenCodeApiDetection(...args);
|
|
627
667
|
|
|
668
|
+
// Plugin-registered providers exist only inside the running OpenCode process.
|
|
669
|
+
// Small-model callers resolve them through this connection; without it they
|
|
670
|
+
// stay on the file-based resolution and plugin models remain unreachable.
|
|
671
|
+
configureOpenCodeRuntimeProviders({ buildOpenCodeUrl, getOpenCodeAuthHeaders });
|
|
672
|
+
|
|
628
673
|
const ENV_CONFIGURED_API_PREFIX = normalizeApiPrefix(
|
|
629
674
|
process.env.OPENCODE_API_PREFIX || process.env.OPENCHAMBER_API_PREFIX || ''
|
|
630
675
|
);
|
|
@@ -774,9 +819,41 @@ const sessionGoalRuntime = createSessionGoalRuntime({
|
|
|
774
819
|
});
|
|
775
820
|
},
|
|
776
821
|
});
|
|
822
|
+
/**
|
|
823
|
+
* Owns what a session must be told about the project's knowledge. Every sender
|
|
824
|
+
* asks it — the UI over HTTP, scheduled tasks and agent-dispatched sessions in
|
|
825
|
+
* process — so the answer cannot differ between them.
|
|
826
|
+
*/
|
|
827
|
+
const sessionKnowledgeRuntime = createSessionKnowledgeRuntime({
|
|
828
|
+
projectContextRuntime,
|
|
829
|
+
agentMemoryRuntime,
|
|
830
|
+
// Called, not captured: the resolver is declared further down, and taking a
|
|
831
|
+
// reference here would read it before it exists.
|
|
832
|
+
resolveProjectId: (directory) => resolveMemoryProjectId(directory),
|
|
833
|
+
isAgentMemoryEnabled,
|
|
834
|
+
openCodeFetch: async (fetchPath, { directory, method = 'GET', body } = {}) => {
|
|
835
|
+
const params = new URLSearchParams();
|
|
836
|
+
if (directory) params.set('directory', directory);
|
|
837
|
+
const search = params.toString();
|
|
838
|
+
const response = await fetch(`${buildOpenCodeUrl(fetchPath, '')}${search ? `?${search}` : ''}`, {
|
|
839
|
+
method,
|
|
840
|
+
headers: {
|
|
841
|
+
Accept: 'application/json',
|
|
842
|
+
...(body ? { 'Content-Type': 'application/json' } : {}),
|
|
843
|
+
...getOpenCodeAuthHeaders(),
|
|
844
|
+
},
|
|
845
|
+
...(body ? { body: JSON.stringify(body) } : {}),
|
|
846
|
+
signal: AbortSignal.timeout(15_000),
|
|
847
|
+
});
|
|
848
|
+
if (!response.ok) throw new Error(`OpenCode ${method} ${fetchPath} failed with ${response.status}`);
|
|
849
|
+
return response.json().catch(() => null);
|
|
850
|
+
},
|
|
851
|
+
});
|
|
852
|
+
|
|
777
853
|
const contextObligatoryRuntime = createContextObligatoryRuntime({
|
|
778
854
|
buildOpenCodeUrl,
|
|
779
855
|
getOpenCodeAuthHeaders,
|
|
856
|
+
sessionKnowledgeRuntime,
|
|
780
857
|
});
|
|
781
858
|
|
|
782
859
|
const globalMessageStreamHub = createGlobalMessageStreamHub({
|
|
@@ -1021,6 +1098,9 @@ Object.defineProperties(openCodeLifecycleState, {
|
|
|
1021
1098
|
openCodeApiDetectionTimer: { get: () => openCodeApiDetectionTimer, set: (value) => { openCodeApiDetectionTimer = value; } },
|
|
1022
1099
|
lastOpenCodeError: { get: () => lastOpenCodeError, set: (value) => { lastOpenCodeError = value; } },
|
|
1023
1100
|
lastOpenCodeLaunchDiagnostics: { get: () => lastOpenCodeLaunchDiagnostics, set: (value) => { lastOpenCodeLaunchDiagnostics = value; } },
|
|
1101
|
+
lastOpenCodeHealthFailure: { get: () => lastOpenCodeHealthFailure, set: (value) => { lastOpenCodeHealthFailure = value; } },
|
|
1102
|
+
lastManagedOpenCodeProcess: { get: () => lastManagedOpenCodeProcess, set: (value) => { lastManagedOpenCodeProcess = value; } },
|
|
1103
|
+
lastOpenCodeRestartDiagnostics: { get: () => lastOpenCodeRestartDiagnostics, set: (value) => { lastOpenCodeRestartDiagnostics = value; } },
|
|
1024
1104
|
isOpenCodeReady: { get: () => isOpenCodeReady, set: (value) => { isOpenCodeReady = value; } },
|
|
1025
1105
|
openCodeNotReadySince: { get: () => openCodeNotReadySince, set: (value) => { openCodeNotReadySince = value; } },
|
|
1026
1106
|
isExternalOpenCode: { get: () => isExternalOpenCode, set: (value) => { isExternalOpenCode = value; } },
|
|
@@ -1088,11 +1168,31 @@ const openCodeLifecycleRuntime = createOpenCodeLifecycleRuntime({
|
|
|
1088
1168
|
// process (#2638). The runtime is created later by the startup pipeline;
|
|
1089
1169
|
// by the time any restart runs, it is assigned.
|
|
1090
1170
|
onOpenCodeRestarted: () => {
|
|
1171
|
+
// A restart reloads plugins: provider ports, credentials and the provider
|
|
1172
|
+
// list itself can all differ from what was cached.
|
|
1173
|
+
resetOpenCodeRuntimeProviders();
|
|
1091
1174
|
try {
|
|
1092
1175
|
messageStreamRuntime?.rebindUpstream();
|
|
1093
1176
|
} catch (error) {
|
|
1094
1177
|
console.warn('Failed to rebind message stream after OpenCode restart:', error?.message ?? error);
|
|
1095
1178
|
}
|
|
1179
|
+
try {
|
|
1180
|
+
const { sessionIds } = sessionRuntime.interruptBusySessionsAfterRestart();
|
|
1181
|
+
if (sessionIds.length > 0) {
|
|
1182
|
+
const multiple = sessionIds.length > 1;
|
|
1183
|
+
broadcastUiNotification({
|
|
1184
|
+
title: multiple ? 'Chats interrupted' : 'Chat interrupted',
|
|
1185
|
+
body: multiple
|
|
1186
|
+
? 'OpenCode restarted during running responses. Send a message in each chat to continue.'
|
|
1187
|
+
: 'OpenCode restarted during a running response. Send a message to continue.',
|
|
1188
|
+
tag: 'opencode-restart-interrupted',
|
|
1189
|
+
kind: 'opencode-restart-interrupted',
|
|
1190
|
+
sessionId: sessionIds[0],
|
|
1191
|
+
});
|
|
1192
|
+
}
|
|
1193
|
+
} catch (error) {
|
|
1194
|
+
console.warn('Failed to reconcile sessions after OpenCode restart:', error?.message ?? error);
|
|
1195
|
+
}
|
|
1096
1196
|
},
|
|
1097
1197
|
getManagedOpenCodeEnv: async () => {
|
|
1098
1198
|
const settings = await readSettingsFromDiskMigrated().catch(() => null);
|
|
@@ -1100,8 +1200,9 @@ const openCodeLifecycleRuntime = createOpenCodeLifecycleRuntime({
|
|
|
1100
1200
|
// injected while at least one of them is on.
|
|
1101
1201
|
const includeControl = settings?.agentControlToolEnabled !== false;
|
|
1102
1202
|
const includeWeb = settings?.agentWebToolEnabled !== false;
|
|
1103
|
-
const
|
|
1104
|
-
|
|
1203
|
+
const includeMemory = isAgentMemoryFeatureAvailable() && settings?.agentMemoryToolEnabled === true;
|
|
1204
|
+
const managedEnv = includeControl || includeWeb || includeMemory
|
|
1205
|
+
? await (agentToolRuntime?.prepareManagedOpenCodeEnv({ includeControl, includeWeb, includeMemory }) || {})
|
|
1105
1206
|
: {};
|
|
1106
1207
|
if (settings?.optimizeSystemPrompt !== true) return managedEnv;
|
|
1107
1208
|
|
|
@@ -1138,6 +1239,7 @@ const scheduledTasksRuntime = createScheduledTasksRuntime({
|
|
|
1138
1239
|
buildOpenCodeUrl,
|
|
1139
1240
|
getOpenCodeAuthHeaders,
|
|
1140
1241
|
waitForOpenCodeReady,
|
|
1242
|
+
sessionKnowledgeRuntime,
|
|
1141
1243
|
setSessionAutoAccept: (sessionId, enabled, directory) => permissionAutoAcceptRuntime.setSessionPolicy(sessionId, enabled, directory),
|
|
1142
1244
|
emitTaskRunEvent: (event) => {
|
|
1143
1245
|
for (const client of uiOpenChamberEventClients) {
|
|
@@ -1179,6 +1281,38 @@ const emitSessionCreatedEvent = (event) => {
|
|
|
1179
1281
|
}
|
|
1180
1282
|
}
|
|
1181
1283
|
};
|
|
1284
|
+
/**
|
|
1285
|
+
* Maps a session directory onto the project whose memory it belongs to, so a
|
|
1286
|
+
* session running in a worktree writes to the project the panel shows.
|
|
1287
|
+
*/
|
|
1288
|
+
const resolveMemoryProjectId = createMemoryProjectResolver({
|
|
1289
|
+
listProjectPaths: async () => {
|
|
1290
|
+
const settings = await readSettingsFromDiskMigrated().catch(() => null);
|
|
1291
|
+
return sanitizeProjects(settings?.projects || []).map((project) => project.path);
|
|
1292
|
+
},
|
|
1293
|
+
resolvePrimaryWorktreeRoot,
|
|
1294
|
+
managedProjectRoots: [path.join(OPENCHAMBER_USER_CONFIG_ROOT, 'chats')],
|
|
1295
|
+
});
|
|
1296
|
+
|
|
1297
|
+
/**
|
|
1298
|
+
* Tells open panels that the agent changed what it remembers, so what it just
|
|
1299
|
+
* stored is visible without reopening anything.
|
|
1300
|
+
*/
|
|
1301
|
+
const emitAgentMemoryChangedEvent = (event) => {
|
|
1302
|
+
for (const client of uiOpenChamberEventClients) {
|
|
1303
|
+
try {
|
|
1304
|
+
writeSseEvent(client, {
|
|
1305
|
+
type: 'openchamber:agent-memory-changed',
|
|
1306
|
+
properties: {
|
|
1307
|
+
scope: event.scope,
|
|
1308
|
+
...(event.projectId ? { projectId: event.projectId } : {}),
|
|
1309
|
+
},
|
|
1310
|
+
});
|
|
1311
|
+
} catch {
|
|
1312
|
+
uiOpenChamberEventClients.delete(client);
|
|
1313
|
+
}
|
|
1314
|
+
}
|
|
1315
|
+
};
|
|
1182
1316
|
const scheduledTaskService = createScheduledTaskService({
|
|
1183
1317
|
readSettingsFromDiskMigrated,
|
|
1184
1318
|
sanitizeProjects,
|
|
@@ -1193,6 +1327,7 @@ const openChamberSessionService = createOpenChamberSessionService({
|
|
|
1193
1327
|
getOpenCodeAuthHeaders,
|
|
1194
1328
|
waitForOpenCodeReady,
|
|
1195
1329
|
emitSessionCreatedEvent,
|
|
1330
|
+
sessionKnowledgeRuntime,
|
|
1196
1331
|
});
|
|
1197
1332
|
// Browser actions are published to whichever OpenChamber clients are connected;
|
|
1198
1333
|
// the one owning the browser panel answers. `emitRequest` returns the number of
|
|
@@ -1234,6 +1369,13 @@ const openChamberControlService = createOpenChamberControlService({
|
|
|
1234
1369
|
sessionService: openChamberSessionService,
|
|
1235
1370
|
scheduledTaskService,
|
|
1236
1371
|
browserControl: browserControlBroker,
|
|
1372
|
+
agentMemoryActions: createAgentMemoryActions({
|
|
1373
|
+
agentMemoryRuntime,
|
|
1374
|
+
createError: (message, status) => new OpenChamberControlError(message, status),
|
|
1375
|
+
onMemoryChanged: emitAgentMemoryChangedEvent,
|
|
1376
|
+
isAgentMemoryEnabled,
|
|
1377
|
+
resolveProjectId: resolveMemoryProjectId,
|
|
1378
|
+
}),
|
|
1237
1379
|
});
|
|
1238
1380
|
|
|
1239
1381
|
const ensureGlobalWatcherStarted = async () => {
|
|
@@ -1499,7 +1641,7 @@ async function main(options = {}) {
|
|
|
1499
1641
|
res.setHeader('Access-Control-Allow-Origin', origin);
|
|
1500
1642
|
res.setHeader('Access-Control-Allow-Credentials', 'true');
|
|
1501
1643
|
res.setHeader('Access-Control-Allow-Methods', 'GET,POST,PUT,PATCH,DELETE,OPTIONS');
|
|
1502
|
-
res.setHeader('Access-Control-Allow-Headers', 'Content-Type,Authorization,Accept,X-Requested-With,Cache-Control,X-OpenCode-Directory,X-OpenCode-Directory-Encoding');
|
|
1644
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type,Authorization,Accept,X-Requested-With,Cache-Control,X-OpenCode-Directory,X-OpenCode-Directory-Encoding,Ngrok-Skip-Browser-Warning');
|
|
1503
1645
|
res.setHeader('Access-Control-Expose-Headers', 'x-next-cursor');
|
|
1504
1646
|
res.setHeader('Vary', 'Origin');
|
|
1505
1647
|
if (req.method === 'OPTIONS') {
|
|
@@ -1549,6 +1691,9 @@ async function main(options = {}) {
|
|
|
1549
1691
|
isOpenCodeReady,
|
|
1550
1692
|
lastOpenCodeError,
|
|
1551
1693
|
lastOpenCodeLaunchDiagnostics,
|
|
1694
|
+
lastOpenCodeHealthFailure,
|
|
1695
|
+
lastManagedOpenCodeProcess,
|
|
1696
|
+
lastOpenCodeRestartDiagnostics,
|
|
1552
1697
|
opencodeBinaryResolved: resolvedOpencodeBinary || null,
|
|
1553
1698
|
opencodeBinarySource: resolvedOpencodeBinarySource || null,
|
|
1554
1699
|
opencodeLaunchBinary: launchSpec?.binary || null,
|
|
@@ -1744,6 +1889,10 @@ async function main(options = {}) {
|
|
|
1744
1889
|
devServerScanner,
|
|
1745
1890
|
buildAugmentedPath,
|
|
1746
1891
|
projectConfigRuntime,
|
|
1892
|
+
projectContextRuntime,
|
|
1893
|
+
agentMemoryRuntime,
|
|
1894
|
+
isAgentMemoryEnabled,
|
|
1895
|
+
sessionKnowledgeRuntime,
|
|
1747
1896
|
scheduledTasksRuntime,
|
|
1748
1897
|
scheduledTaskService,
|
|
1749
1898
|
openChamberSessionService,
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispatch for the `memory.*` actions the `openchamber_memory` tool calls.
|
|
3
|
+
*
|
|
4
|
+
* Kept beside the store rather than inside the control service, because the
|
|
5
|
+
* control service already owns sessions, schedules and the browser; memory
|
|
6
|
+
* shares none of that machinery and only needs the same envelope.
|
|
7
|
+
*
|
|
8
|
+
* Project scope is derived from the session's directory, never from the model.
|
|
9
|
+
* Letting the agent name a project id would let a memory learned in one
|
|
10
|
+
* checkout be filed against another, which the user would have no way to
|
|
11
|
+
* notice.
|
|
12
|
+
*
|
|
13
|
+
* The directory is resolved to the project first. A session running in a
|
|
14
|
+
* worktree has the worktree's own path, and keying memory by that path filed it
|
|
15
|
+
* under a project the panel never looks at — the memory was written, stored,
|
|
16
|
+
* and invisible. Every worktree of a repository shares one project memory,
|
|
17
|
+
* which is also what the user means by "this project".
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const MEMORY_TYPES = new Set(['fact', 'preference', 'reference']);
|
|
21
|
+
|
|
22
|
+
const asNonEmptyString = (value) => {
|
|
23
|
+
if (typeof value !== 'string') return null;
|
|
24
|
+
const trimmed = value.trim();
|
|
25
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** Everything the agent is told about an entry it has not opened yet. */
|
|
29
|
+
const toSummary = (entry, scope) => ({
|
|
30
|
+
memoryId: entry.id,
|
|
31
|
+
title: entry.title,
|
|
32
|
+
type: entry.type,
|
|
33
|
+
scope,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const toFullEntry = (entry, scope) => ({ ...toSummary(entry, scope), body: entry.body });
|
|
37
|
+
|
|
38
|
+
export const createAgentMemoryActions = (dependencies) => {
|
|
39
|
+
const {
|
|
40
|
+
agentMemoryRuntime,
|
|
41
|
+
createError,
|
|
42
|
+
onMemoryChanged,
|
|
43
|
+
resolveProjectId: resolveProjectIdForDirectory,
|
|
44
|
+
isAgentMemoryEnabled,
|
|
45
|
+
} = dependencies;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Announce a write so an open panel shows it without being reopened. The
|
|
49
|
+
* agent writes here on its own initiative, so without this the user only
|
|
50
|
+
* learns what was stored the next time something else happens to reload.
|
|
51
|
+
*
|
|
52
|
+
* Never allowed to fail the action: the memory is already on disk, and a
|
|
53
|
+
* broken notification must not report the write as failed.
|
|
54
|
+
*/
|
|
55
|
+
const announce = (scope, projectId) => {
|
|
56
|
+
if (typeof onMemoryChanged !== 'function') return;
|
|
57
|
+
try {
|
|
58
|
+
onMemoryChanged({ scope, ...(projectId ? { projectId } : {}) });
|
|
59
|
+
} catch {
|
|
60
|
+
// A listener that throws must not take the write down with it.
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const fail = (message, status = 400) => {
|
|
65
|
+
throw createError(message, status);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const resolveProjectId = async (contextDirectory) => {
|
|
69
|
+
const directory = asNonEmptyString(contextDirectory);
|
|
70
|
+
const projectId = directory ? await resolveProjectIdForDirectory(directory) : '';
|
|
71
|
+
if (!projectId) {
|
|
72
|
+
fail('Project memory needs a session directory, and this session has none', 400);
|
|
73
|
+
}
|
|
74
|
+
return projectId;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const resolveTarget = async (input, contextDirectory) => {
|
|
78
|
+
const scope = asNonEmptyString(input.scope);
|
|
79
|
+
if (scope === 'global') return { scope: 'global' };
|
|
80
|
+
if (scope === 'project') {
|
|
81
|
+
return { scope: 'project', projectId: await resolveProjectId(contextDirectory) };
|
|
82
|
+
}
|
|
83
|
+
return fail('scope must be global or project', 400);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const listBothScopes = async (contextDirectory) => {
|
|
87
|
+
const directory = asNonEmptyString(contextDirectory);
|
|
88
|
+
const projectId = directory ? await resolveProjectIdForDirectory(directory) : null;
|
|
89
|
+
const result = await agentMemoryRuntime.readAll(projectId);
|
|
90
|
+
|
|
91
|
+
// A scope that failed to load is reported, never rendered as empty: an
|
|
92
|
+
// agent told it has no memories will happily store them all again.
|
|
93
|
+
return {
|
|
94
|
+
memories: [
|
|
95
|
+
...result.global.map((entry) => toSummary(entry, 'global')),
|
|
96
|
+
...result.project.map((entry) => toSummary(entry, 'project')),
|
|
97
|
+
],
|
|
98
|
+
...(result.globalFailed ? { globalUnavailable: true } : {}),
|
|
99
|
+
...(result.projectFailed ? { projectUnavailable: true } : {}),
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const list = async (input, contextDirectory) => {
|
|
104
|
+
const scope = asNonEmptyString(input.scope);
|
|
105
|
+
if (!scope || scope === 'both') {
|
|
106
|
+
return listBothScopes(contextDirectory);
|
|
107
|
+
}
|
|
108
|
+
const target = await resolveTarget(input, contextDirectory);
|
|
109
|
+
const { entries } = await agentMemoryRuntime.read(target);
|
|
110
|
+
return { memories: entries.map((entry) => toSummary(entry, target.scope)) };
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Reading by title as well as by id is deliberate: the session index lists
|
|
115
|
+
* titles only, so requiring an id would force a list call before every read
|
|
116
|
+
* just to translate what the agent can already see.
|
|
117
|
+
*
|
|
118
|
+
* Scope is optional here. It decides everything for a write — a fact filed
|
|
119
|
+
* globally reaches every project — but for a read it is only which drawer to
|
|
120
|
+
* open, and demanding it turned a legible request into an error the model had
|
|
121
|
+
* to recover from. Omitted, both stores are searched.
|
|
122
|
+
*/
|
|
123
|
+
const read = async (input, contextDirectory) => {
|
|
124
|
+
const memoryId = asNonEmptyString(input.memoryId);
|
|
125
|
+
const title = asNonEmptyString(input.title);
|
|
126
|
+
if (!memoryId && !title) {
|
|
127
|
+
fail('memory.read requires memoryId or title', 400);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const matches = (entry) => (memoryId
|
|
131
|
+
? entry.id === memoryId
|
|
132
|
+
: entry.title.toLowerCase() === title.toLowerCase());
|
|
133
|
+
|
|
134
|
+
const requestedScope = asNonEmptyString(input.scope);
|
|
135
|
+
if (requestedScope === 'global' || requestedScope === 'project') {
|
|
136
|
+
const target = await resolveTarget(input, contextDirectory);
|
|
137
|
+
const { entries } = await agentMemoryRuntime.read(target);
|
|
138
|
+
const found = entries.find(matches);
|
|
139
|
+
if (!found) {
|
|
140
|
+
fail('No memory matches that id or title in this scope', 404);
|
|
141
|
+
}
|
|
142
|
+
return { memory: toFullEntry(found, target.scope) };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const directory = asNonEmptyString(contextDirectory);
|
|
146
|
+
const projectId = directory ? await resolveProjectIdForDirectory(directory) : null;
|
|
147
|
+
const result = await agentMemoryRuntime.readAll(projectId);
|
|
148
|
+
|
|
149
|
+
const projectMatch = result.project.find(matches);
|
|
150
|
+
if (projectMatch) {
|
|
151
|
+
// Project first: when both stores hold the same title, the one about this
|
|
152
|
+
// codebase is the one being asked about.
|
|
153
|
+
return { memory: toFullEntry(projectMatch, 'project') };
|
|
154
|
+
}
|
|
155
|
+
const globalMatch = result.global.find(matches);
|
|
156
|
+
if (globalMatch) {
|
|
157
|
+
return { memory: toFullEntry(globalMatch, 'global') };
|
|
158
|
+
}
|
|
159
|
+
if (result.globalFailed || result.projectFailed) {
|
|
160
|
+
// Never reported as "no such memory": a store that failed to load may well
|
|
161
|
+
// hold it, and the agent would go on to store it a second time.
|
|
162
|
+
fail('Stored memory could not be read; try again before assuming it is absent', 503);
|
|
163
|
+
}
|
|
164
|
+
fail('No memory matches that id or title', 404);
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const save = async (input, contextDirectory) => {
|
|
168
|
+
const target = await resolveTarget(input, contextDirectory);
|
|
169
|
+
const title = asNonEmptyString(input.title);
|
|
170
|
+
const body = asNonEmptyString(input.body);
|
|
171
|
+
if (!title) fail('title is required for memory.save', 400);
|
|
172
|
+
if (!body) fail('body is required for memory.save', 400);
|
|
173
|
+
if (input.type !== undefined && !MEMORY_TYPES.has(input.type)) {
|
|
174
|
+
fail('type must be fact, preference, or reference', 400);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const result = await agentMemoryRuntime.create(target, {
|
|
178
|
+
title,
|
|
179
|
+
body,
|
|
180
|
+
type: input.type,
|
|
181
|
+
sessionId: asNonEmptyString(input.sessionId),
|
|
182
|
+
});
|
|
183
|
+
announce(target.scope, target.projectId);
|
|
184
|
+
// Deliberately does not echo the text back. Handing the model what it just
|
|
185
|
+
// wrote invites it to find something to improve and re-save, and the store
|
|
186
|
+
// is not the place to discover that a save worked — the confirmation is.
|
|
187
|
+
return {
|
|
188
|
+
saved: true,
|
|
189
|
+
memory: toSummary(result.entry, target.scope),
|
|
190
|
+
// Told plainly so the agent does not report storing a second memory when
|
|
191
|
+
// it actually corrected one it had already written.
|
|
192
|
+
replaced: result.replaced,
|
|
193
|
+
...(result.entry.flagged
|
|
194
|
+
? { warning: 'Stored, but held back from future sessions: this text reads as an instruction to the model rather than a fact. The user can see it in the Memory panel.' }
|
|
195
|
+
: {}),
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const remove = async (input, contextDirectory) => {
|
|
200
|
+
const target = await resolveTarget(input, contextDirectory);
|
|
201
|
+
const memoryId = asNonEmptyString(input.memoryId);
|
|
202
|
+
if (!memoryId) fail('memoryId is required for memory.delete', 400);
|
|
203
|
+
|
|
204
|
+
const result = await agentMemoryRuntime.remove(target, memoryId);
|
|
205
|
+
if (!result.deleted) {
|
|
206
|
+
fail('No memory has that id in this scope', 404);
|
|
207
|
+
}
|
|
208
|
+
announce(target.scope, target.projectId);
|
|
209
|
+
return { deleted: true, memoryId };
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
const execute = async (action, input = {}, contextDirectory) => {
|
|
213
|
+
/**
|
|
214
|
+
* The tool lives in the managed OpenCode child and only disappears when
|
|
215
|
+
* that child restarts, so between switching memory off and restarting it
|
|
216
|
+
* the agent can still call this. Ungated, those writes would land on disk
|
|
217
|
+
* while the panel that shows them is hidden and the index that carries
|
|
218
|
+
* them is suppressed — memory accumulating where nobody can see it.
|
|
219
|
+
*/
|
|
220
|
+
if (typeof isAgentMemoryEnabled === 'function') {
|
|
221
|
+
let enabled = false;
|
|
222
|
+
try {
|
|
223
|
+
enabled = await isAgentMemoryEnabled();
|
|
224
|
+
} catch {
|
|
225
|
+
// An unreadable setting closes the surface rather than opening it.
|
|
226
|
+
enabled = false;
|
|
227
|
+
}
|
|
228
|
+
if (!enabled) {
|
|
229
|
+
return fail('Agent memory is switched off in OpenChamber settings', 403);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
switch (action) {
|
|
234
|
+
case 'memory.list': return list(input, contextDirectory);
|
|
235
|
+
case 'memory.read': return read(input, contextDirectory);
|
|
236
|
+
case 'memory.save': return save(input, contextDirectory);
|
|
237
|
+
case 'memory.delete': return remove(input, contextDirectory);
|
|
238
|
+
default: return fail(`Unsupported memory action: ${action || 'missing'}`, 400);
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
return { execute };
|
|
243
|
+
};
|