@openchamber/web 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{CodeMirrorCommentWidgets-hJbl3JX4.js → CodeMirrorCommentWidgets-zm3C1FvM.js} +1 -1
- package/dist/assets/DiffView-DNExNi1z.js +4 -0
- package/dist/assets/FilesView-DUCLmHBi.js +17 -0
- package/dist/assets/{GitView-DY4pelsO.js → GitView-Bz9z6gZA.js} +4 -4
- package/dist/assets/{GuestAttachDialog-D6mHDTB2.js → GuestAttachDialog-UGp4KDlK.js} +1 -1
- package/dist/assets/GuestSurfacePane-B3pdB_2u.js +1 -0
- package/dist/assets/{JsonTreeView-DEXI2NvJ.js → JsonTreeView-7lVecnZl.js} +1 -1
- package/dist/assets/{LinearIssuesView-BTNc-4dN.js → LinearIssuesView-CTGRS9Vq.js} +1 -1
- package/dist/assets/{MarkdownImageGallery-wcUUcf8l.js → MarkdownImageGallery-DQk5adUs.js} +1 -1
- package/dist/assets/MarkdownRendererImpl-DPF8fZpX.js +12 -0
- package/dist/assets/{OnboardingScreen-FJUreEgI.js → OnboardingScreen-CBx6cXPP.js} +1 -1
- package/dist/assets/{PatchDiff-C0oOkKnO.js → PatchDiff-D7VVpR_l.js} +1 -1
- package/dist/assets/{PierreDiffViewer-asuSQAsf.js → PierreDiffViewer-Gbfks1pk.js} +3 -3
- package/dist/assets/{PlanView-DGbasNHP.js → PlanView-CPSK0x97.js} +4 -4
- package/dist/assets/PluginPane-BIGsUx69.js +3 -0
- package/dist/assets/SettingsView-Dql7z6Ww.js +30 -0
- package/dist/assets/{SettingsWindow-By4cqnqy.js → SettingsWindow-D6oi-UmV.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-C0P2tXLU.js → SubmoduleDiffSummary-BXA0FAWj.js} +1 -1
- package/dist/assets/{ToolOutputDialog-Cayc-yIM.js → ToolOutputDialog-BQJsSbDm.js} +6 -6
- package/dist/assets/{ToolPartDiffPreview-B0jmpPQz.js → ToolPartDiffPreview-FY9w0TVT.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-DsOpvWZD.js → VirtualizedFileDiff-B9YhAya5.js} +1 -1
- package/dist/assets/{WalkthroughView-CCakjyn9.js → WalkthroughView-CmFgOUFN.js} +2 -2
- package/dist/assets/{appThemeRegistry-Bw5oTm41.js → appThemeRegistry-BebxalUt.js} +1 -1
- package/dist/assets/changesTree-CePHbFcj.js +1 -0
- package/dist/assets/commitAndPush-Wfxng_IK.js +1 -0
- package/dist/assets/{computeVirtualFileMetrics-B-4aLf4A.js → computeVirtualFileMetrics-BCOqgixN.js} +2 -2
- package/dist/assets/de-CMA45TC-.js +10 -0
- package/dist/assets/es-DPL4fBtl.js +16 -0
- package/dist/assets/fr-OHBKBseP.js +14 -0
- package/dist/assets/{index-B6r0Kv-B.js → index-3TiDNtfN.js} +1 -1
- package/dist/assets/index-BLUZa5u0.js +41 -0
- package/dist/assets/index-Cm2rrq69.css +1 -0
- package/dist/assets/{isDiffPlainText-Ok-kgtJA.js → isDiffPlainText-DnDYQmWK.js} +1 -1
- package/dist/assets/{isFilePlainText-0dLnkYm8.js → isFilePlainText-BA_AHX7d.js} +1 -1
- package/dist/assets/ja-DvX4WSRf.js +16 -0
- package/dist/assets/ko-BUcLd8YZ.js +16 -0
- package/dist/assets/main-B_jri4i-.js +896 -0
- package/dist/assets/{main-CjXBM_Xe.js → main-DtUmJp9B.js} +2 -2
- package/dist/assets/{markdown-shiki.worker-CahLvHIq.js → markdown-shiki.worker-Bg8SoAJJ.js} +8 -5
- package/dist/assets/markdownCore-BSnlUXBf.js +7 -0
- package/dist/assets/{miniChat-DZ3OAeLN.js → miniChat-BYfLUnDK.js} +2 -2
- package/dist/assets/{mobile-CH0LOIF-.js → mobile-DH3hI6gd.js} +2 -2
- package/dist/assets/patchFileDiff--L7lt_GZ.js +13 -0
- package/dist/assets/pl-BkI_xHqz.js +16 -0
- package/dist/assets/pt-BR-7wFtQlV9.js +16 -0
- package/dist/assets/{renderElectronMiniChatApp-CB1uLYvh.js → renderElectronMiniChatApp-C7kpNW_-.js} +2 -2
- package/dist/assets/renderMobileApp-i0nq7Dwy.js +25 -0
- package/dist/assets/runtimeEndpointReset-CfEYbcCc.js +27 -0
- package/dist/assets/scheduledTasksApi-Cy7uZCaI.js +1 -0
- package/dist/assets/{shikiHighlight-CocY80VR.js → shikiHighlight-D4vxipfr.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-CF77r8FA.js → textMateThemeFromAppTheme-BYAHtJwQ.js} +1 -1
- package/dist/assets/tr-TsD-AqEH.js +7 -0
- package/dist/assets/uk-B-qspCmD.js +16 -0
- package/dist/assets/{useAppFontEffects-Dc5nTHi8.js → useAppFontEffects-DHZ9-L30.js} +158 -157
- package/dist/assets/{useInlineCommentController-Dbza5c8l.js → useInlineCommentController-CvpOMK-R.js} +2 -2
- package/dist/assets/{useRootScrollLock-CSCLv396.js → useRootScrollLock-DzNFi-fn.js} +2 -2
- package/dist/assets/{vendor-codemirror-language-data-CkmYWcRI.js → vendor-codemirror-language-data-j3fhlwUM.js} +2 -2
- package/dist/assets/{vendor-opencode-client-_BAHQo4R.js → vendor-opencode-client-DYdsLbCM.js} +2 -2
- package/dist/assets/vendor-zod-BSoePkpP.js +39 -0
- package/dist/assets/{web-components-nsStrYq9.js → web-components-BvHNFSEG.js} +1 -1
- package/dist/assets/zh-CN-DYuPJV5i.js +16 -0
- package/dist/assets/zh-TW-BX_2D_lV.js +16 -0
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +5 -5
- package/dist/mobile.html +5 -5
- package/package.json +4 -4
- package/server/index.js +18 -0
- package/server/lib/agent-tool/DOCUMENTATION.md +5 -0
- package/server/lib/agent-tool/runtime.js +34 -6
- package/server/lib/agent-tool/runtime.test.js +15 -0
- package/server/lib/browser-control/DOCUMENTATION.md +14 -2
- package/server/lib/git/DOCUMENTATION.md +1 -1
- package/server/lib/git/service.js +22 -0
- package/server/lib/git/service.test.js +8 -0
- package/server/lib/guests/DOCUMENTATION.md +4 -3
- package/server/lib/guests/catalog.js +19 -1
- package/server/lib/guests/catalog.test.js +22 -0
- package/server/lib/guests/html-styles.js +5 -3
- package/server/lib/guests/html-styles.test.js +3 -1
- package/server/lib/guests/routes.js +11 -3
- package/server/lib/guests/service.js +5 -0
- package/server/lib/guests/surface.js +55 -9
- package/server/lib/guests/surface.test.js +56 -6
- package/server/lib/notifications/DOCUMENTATION.md +10 -0
- package/server/lib/notifications/emit-route.js +118 -0
- package/server/lib/notifications/emit-route.test.js +112 -0
- package/server/lib/openchamber-control/actions.js +16 -2
- package/server/lib/openchamber-control/service.js +23 -0
- package/server/lib/openchamber-control/service.test.js +31 -0
- package/server/lib/openchamber-sessions/fork-inheritance.js +103 -0
- package/server/lib/openchamber-sessions/fork-inheritance.test.js +69 -0
- package/server/lib/openchamber-sessions/routes.js +11 -0
- package/server/lib/openchamber-sessions/routes.test.js +18 -0
- package/server/lib/opencode/DOCUMENTATION.md +31 -22
- package/server/lib/opencode/bootstrap-runtime.js +12 -0
- package/server/lib/opencode/compatibility.js +6 -3
- package/server/lib/opencode/compatibility.test.js +8 -0
- package/server/lib/opencode/config-v2.d.ts +2 -0
- package/server/lib/opencode/config-v2.js +42 -0
- package/server/lib/opencode/config-v2.test.js +17 -0
- package/server/lib/opencode/core-routes.js +3 -0
- package/server/lib/opencode/core-routes.test.js +15 -0
- package/server/lib/opencode/env-runtime.js +1 -8
- package/server/lib/opencode/feature-routes-runtime.js +2 -1
- package/server/lib/opencode/lifecycle.js +30 -2
- package/server/lib/opencode/lifecycle.test.js +27 -0
- package/server/lib/opencode/managed-config-file.js +18 -6
- package/server/lib/opencode/managed-config-file.test.js +23 -7
- package/server/lib/opencode/openchamber-routes.js +29 -11
- package/server/lib/opencode/openchamber-routes.test.js +18 -0
- package/server/lib/opencode/provider-source-route.test.js +59 -0
- package/server/lib/opencode/providers.js +3 -0
- package/server/lib/opencode/providers.test.js +62 -0
- package/server/lib/opencode/routes-upgrade.test.js +1 -1
- package/server/lib/opencode/routes.js +18 -1
- package/server/lib/opencode/settings-helpers.js +7 -0
- package/server/lib/opencode/settings-helpers.test.js +2 -2
- package/server/lib/opencode/settings-registry.json +14 -0
- package/server/lib/opencode/settings-runtime.js +1 -0
- package/server/lib/opencode/shared.js +32 -2
- package/server/lib/opencode/shared.test.js +79 -1
- package/server/lib/opencode/skill-routes.js +28 -12
- package/server/lib/opencode/skill-routes.test.js +121 -1
- package/server/lib/opencode/upgrade-capability.js +0 -14
- package/server/lib/opencode/v1-migration-topup.js +21 -15
- package/server/lib/opencode/v1-migration-topup.test.js +14 -6
- package/server/lib/opencode/v2-install.d.ts +1 -0
- package/server/lib/opencode/v2-install.js +8 -7
- package/server/lib/opencode/v2-install.test.js +13 -4
- package/server/lib/opencode/websearch-config.js +13 -1
- package/server/lib/quota/providers/kimi.js +1 -1
- package/server/lib/session-assist/DOCUMENTATION.md +17 -5
- package/server/lib/session-assist/runtime.js +19 -2
- package/server/lib/session-assist/runtime.test.js +8 -0
- package/server/lib/session-goal/DOCUMENTATION.md +11 -0
- package/dist/assets/DiffView-BucGEJYa.js +0 -4
- package/dist/assets/FilesView-CQcaaAVP.js +0 -17
- package/dist/assets/GuestSurfacePane--DJ7rsmY.js +0 -1
- package/dist/assets/MarkdownRendererImpl-BPe2TVV2.js +0 -12
- package/dist/assets/PluginPane-DImv8hV2.js +0 -3
- package/dist/assets/SettingsView-DOjuOljf.js +0 -29
- package/dist/assets/commitAndPush-sGEelpjh.js +0 -1
- package/dist/assets/de-CD9utsNj.js +0 -10
- package/dist/assets/es-NNum2rX8.js +0 -16
- package/dist/assets/fr-CJLGmduQ.js +0 -14
- package/dist/assets/index-DjGPR5vW.js +0 -41
- package/dist/assets/index-fCXJ-8Qt.css +0 -1
- package/dist/assets/ja-BuddHNi6.js +0 -16
- package/dist/assets/ko-BrwMbHmf.js +0 -16
- package/dist/assets/main-CxVyUDU_.js +0 -896
- package/dist/assets/markdownCore-B6PpX409.js +0 -5
- package/dist/assets/patchFileDiff-BFRGKaGH.js +0 -13
- package/dist/assets/pl-BwN4TNlP.js +0 -16
- package/dist/assets/pt-BR-BhMtownO.js +0 -16
- package/dist/assets/renderMobileApp-nQ4sjQtb.js +0 -25
- package/dist/assets/runtimeEndpointReset-9ZGlXU4J.js +0 -27
- package/dist/assets/scheduledTasksApi-6DsL_SwM.js +0 -1
- package/dist/assets/tr-DRzvqMdi.js +0 -7
- package/dist/assets/uk-b2aYOSNh.js +0 -16
- package/dist/assets/vendor-zod-Gea9uBlY.js +0 -39
- package/dist/assets/zh-CN-DZeUThm_.js +0 -16
- package/dist/assets/zh-TW-2fRE7uc6.js +0 -16
package/dist/index.html
CHANGED
|
@@ -515,17 +515,17 @@
|
|
|
515
515
|
pointer-events: none;
|
|
516
516
|
}
|
|
517
517
|
</style>
|
|
518
|
-
<script type="module" crossorigin src="/assets/main-
|
|
518
|
+
<script type="module" crossorigin src="/assets/main-DtUmJp9B.js"></script>
|
|
519
519
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
520
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
520
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-BSoePkpP.js">
|
|
521
521
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
522
522
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
523
523
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
524
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
525
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
524
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-DYdsLbCM.js">
|
|
525
|
+
<link rel="modulepreload" crossorigin href="/assets/index-BLUZa5u0.js">
|
|
526
526
|
<link rel="modulepreload" crossorigin href="/assets/contextPanelEmbeddedChat-CirXEPJq.js">
|
|
527
527
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
528
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
528
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Cm2rrq69.css">
|
|
529
529
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
530
530
|
</head>
|
|
531
531
|
<body class="h-full bg-background text-foreground">
|
package/dist/mini-chat.html
CHANGED
|
@@ -74,16 +74,16 @@
|
|
|
74
74
|
}
|
|
75
75
|
</style>
|
|
76
76
|
|
|
77
|
-
<script type="module" crossorigin src="/assets/miniChat-
|
|
77
|
+
<script type="module" crossorigin src="/assets/miniChat-BYfLUnDK.js"></script>
|
|
78
78
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
79
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
79
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-BSoePkpP.js">
|
|
80
80
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
81
81
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
82
82
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
83
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
84
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
83
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-DYdsLbCM.js">
|
|
84
|
+
<link rel="modulepreload" crossorigin href="/assets/index-BLUZa5u0.js">
|
|
85
85
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
86
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
86
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Cm2rrq69.css">
|
|
87
87
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
88
88
|
</head>
|
|
89
89
|
<body class="h-full bg-background text-foreground">
|
package/dist/mobile.html
CHANGED
|
@@ -63,16 +63,16 @@
|
|
|
63
63
|
})();
|
|
64
64
|
</script>
|
|
65
65
|
|
|
66
|
-
<script type="module" crossorigin src="/assets/mobile-
|
|
66
|
+
<script type="module" crossorigin src="/assets/mobile-DH3hI6gd.js"></script>
|
|
67
67
|
<link rel="modulepreload" crossorigin href="/assets/vendor-vite-runtime-DD1OZmLC.js">
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-
|
|
68
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-zod-BSoePkpP.js">
|
|
69
69
|
<link rel="modulepreload" crossorigin href="/assets/vendor-scheduler-7OC5HNn7.js">
|
|
70
70
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BUCujlKS.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="/assets/vendor-zustand-BAGL70zf.js">
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
72
|
+
<link rel="modulepreload" crossorigin href="/assets/vendor-opencode-client-DYdsLbCM.js">
|
|
73
|
+
<link rel="modulepreload" crossorigin href="/assets/index-BLUZa5u0.js">
|
|
74
74
|
<link rel="modulepreload" crossorigin href="/assets/vendor-katex-CHD9BdDO.js">
|
|
75
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
75
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Cm2rrq69.css">
|
|
76
76
|
<link rel="stylesheet" crossorigin href="/assets/vendor-katex-Cp579UoJ.css">
|
|
77
77
|
</head>
|
|
78
78
|
<body class="h-full bg-background text-foreground">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openchamber/web",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./server/index.js",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@clack/prompts": "^1.1.0",
|
|
28
28
|
"@octokit/rest": "^22.0.1",
|
|
29
|
-
"@openchamber/sdk": "2.0.
|
|
30
|
-
"@opencode/client": "2.0.
|
|
31
|
-
"@opencode/schema": "2.0.
|
|
29
|
+
"@openchamber/sdk": "2.0.1",
|
|
30
|
+
"@opencode/client": "2.0.16",
|
|
31
|
+
"@opencode/schema": "2.0.16",
|
|
32
32
|
"@simplewebauthn/server": "13.3.3",
|
|
33
33
|
"bun-pty": "^0.4.5",
|
|
34
34
|
"compression": "^1.8.1",
|
package/server/index.js
CHANGED
|
@@ -129,6 +129,7 @@ import { createOpenChamberSessionService } from './lib/openchamber-sessions/rout
|
|
|
129
129
|
import { createSessionMetadataStore, createOpenCodeSessionMetadata } from './lib/openchamber-sessions/session-metadata-store.js';
|
|
130
130
|
import { createScheduledTaskService } from './lib/scheduled-tasks/service.js';
|
|
131
131
|
import { createOpenChamberControlService } from './lib/openchamber-control/service.js';
|
|
132
|
+
import { createPluginNotificationEmitter } from './lib/notifications/emit-route.js';
|
|
132
133
|
import { OpenChamberControlError } from './lib/openchamber-control/error.js';
|
|
133
134
|
import { createFileOpenRequester } from './lib/openchamber-control/file-open.js';
|
|
134
135
|
import { applyConnectAttemptTimeout } from './lib/network-defaults.js';
|
|
@@ -1563,6 +1564,12 @@ const fileOpenRequester = createFileOpenRequester({
|
|
|
1563
1564
|
},
|
|
1564
1565
|
});
|
|
1565
1566
|
|
|
1567
|
+
const pluginNotificationEmitter = createPluginNotificationEmitter({
|
|
1568
|
+
readSettingsFromDiskMigrated,
|
|
1569
|
+
emitDesktopNotification,
|
|
1570
|
+
broadcastUiNotification,
|
|
1571
|
+
});
|
|
1572
|
+
|
|
1566
1573
|
const openChamberControlService = createOpenChamberControlService({
|
|
1567
1574
|
readSettingsFromDiskMigrated,
|
|
1568
1575
|
sanitizeProjects,
|
|
@@ -1573,6 +1580,15 @@ const openChamberControlService = createOpenChamberControlService({
|
|
|
1573
1580
|
scheduledTaskService,
|
|
1574
1581
|
browserControl: browserControlRouter,
|
|
1575
1582
|
fileOpen: fileOpenRequester,
|
|
1583
|
+
// The tool is off by default; a plugin generated before it was switched off
|
|
1584
|
+
// must not keep paging the user.
|
|
1585
|
+
notifyUser: async (input) => {
|
|
1586
|
+
const settings = await readSettingsFromDiskMigrated().catch(() => null);
|
|
1587
|
+
if (settings?.agentNotifyToolEnabled !== true) {
|
|
1588
|
+
return { status: 403, body: { error: 'The notify tool is turned off in OpenChamber settings' } };
|
|
1589
|
+
}
|
|
1590
|
+
return pluginNotificationEmitter.emit(input);
|
|
1591
|
+
},
|
|
1576
1592
|
agentMemoryActions: createAgentMemoryActions({
|
|
1577
1593
|
agentMemoryRuntime,
|
|
1578
1594
|
createError: (message, status) => new OpenChamberControlError(message, status),
|
|
@@ -1997,6 +2013,7 @@ async function main(options = {}) {
|
|
|
1997
2013
|
isUiVisible,
|
|
1998
2014
|
getUiNotificationClients: () => uiNotificationClients,
|
|
1999
2015
|
writeSseEvent,
|
|
2016
|
+
pluginNotificationEmitter,
|
|
2000
2017
|
sessionRuntime,
|
|
2001
2018
|
setPushInitialized,
|
|
2002
2019
|
fs,
|
|
@@ -2107,6 +2124,7 @@ async function main(options = {}) {
|
|
|
2107
2124
|
guestSurfaceRuntime?.endForGuest(event.guestId);
|
|
2108
2125
|
return browserControlRouter.handleGuestDeactivated(event);
|
|
2109
2126
|
},
|
|
2127
|
+
surfaceViewerHeaders: (guestId, viewerId) => guestSurfaceRuntime?.viewerHeaders(guestId, viewerId) ?? null,
|
|
2110
2128
|
builtInExtensionsDir: options.builtInExtensionsDir,
|
|
2111
2129
|
openchamberUserConfigRoot: OPENCHAMBER_USER_CONFIG_ROOT,
|
|
2112
2130
|
managedChatsRoot: OPENCHAMBER_CHATS_DIR,
|
|
@@ -11,6 +11,11 @@ the user can want independently:
|
|
|
11
11
|
`agentControlToolEnabled` setting is not `false`.
|
|
12
12
|
- `openchamber_web` — looking at and interacting with the page in OpenChamber's
|
|
13
13
|
browser panel. Enabled while `agentWebToolEnabled` is not `false`.
|
|
14
|
+
- `openchamber_notify` — `notify.send`, a notification to the user through
|
|
15
|
+
`lib/notifications/emit-route.js` (same limits and rate window as
|
|
16
|
+
`POST /api/notifications/emit`). Off by default: enabled only while
|
|
17
|
+
`agentNotifyToolEnabled` is `true`, and the control service refuses the
|
|
18
|
+
action when the setting is off, so a stale plugin cannot keep paging.
|
|
14
19
|
|
|
15
20
|
Both default to on, are toggled in Settings → General → OpenCode CLI, and take
|
|
16
21
|
effect in the running OpenCode within a couple of seconds — OpenChamber rewrites
|
|
@@ -3,6 +3,8 @@ import {
|
|
|
3
3
|
OPENCHAMBER_AGENT_TOOL_ACTIONS,
|
|
4
4
|
OPENCHAMBER_MEMORY_ACTION_DEFINITIONS,
|
|
5
5
|
OPENCHAMBER_MEMORY_ACTIONS,
|
|
6
|
+
OPENCHAMBER_NOTIFY_ACTION_DEFINITIONS,
|
|
7
|
+
OPENCHAMBER_NOTIFY_ACTIONS,
|
|
6
8
|
resolveAgentToolAction,
|
|
7
9
|
OPENCHAMBER_WEB_ACTION_DEFINITIONS,
|
|
8
10
|
OPENCHAMBER_WEB_ACTIONS,
|
|
@@ -12,12 +14,18 @@ const TOOL_SCHEMA_VERSION = 1;
|
|
|
12
14
|
const PLUGIN_ID = 'openchamber-agent-tool';
|
|
13
15
|
// Everything either managed tool may ask for; the agent allowlist stays
|
|
14
16
|
// narrower than the full control surface.
|
|
15
|
-
const ACTIONS = new Set([
|
|
17
|
+
const ACTIONS = new Set([
|
|
18
|
+
...OPENCHAMBER_AGENT_TOOL_ACTIONS,
|
|
19
|
+
...OPENCHAMBER_WEB_ACTIONS,
|
|
20
|
+
...OPENCHAMBER_MEMORY_ACTIONS,
|
|
21
|
+
...OPENCHAMBER_NOTIFY_ACTIONS,
|
|
22
|
+
]);
|
|
16
23
|
const AGENT_TOOL_ACTION_TITLES = Object.fromEntries(
|
|
17
24
|
[
|
|
18
25
|
...OPENCHAMBER_AGENT_TOOL_ACTION_DEFINITIONS,
|
|
19
26
|
...OPENCHAMBER_WEB_ACTION_DEFINITIONS,
|
|
20
27
|
...OPENCHAMBER_MEMORY_ACTION_DEFINITIONS,
|
|
28
|
+
...OPENCHAMBER_NOTIFY_ACTION_DEFINITIONS,
|
|
21
29
|
].map(({ action, title }) => [action, title]),
|
|
22
30
|
);
|
|
23
31
|
|
|
@@ -28,7 +36,7 @@ const AGENT_TOOL_ACTION_TITLES = Object.fromEntries(
|
|
|
28
36
|
* in the other tool's schema, which is both misleading and paid for in context
|
|
29
37
|
* on every call.
|
|
30
38
|
*/
|
|
31
|
-
const WEB_PARAMETER_NAMES = ['url', 'selector', 'text', 'value', 'submit', 'direction', 'viewport', 'label'];
|
|
39
|
+
const WEB_PARAMETER_NAMES = ['url', 'selector', 'text', 'value', 'submit', 'direction', 'viewport', 'label', 'tabId'];
|
|
32
40
|
// `title` is shared with the control tool, so it is not listed here — only the
|
|
33
41
|
// names memory alone introduces are kept out of the other schemas.
|
|
34
42
|
const MEMORY_ONLY_PARAMETER_NAMES = ['body', 'scope', 'memoryId', 'type'];
|
|
@@ -87,6 +95,7 @@ const ALL_PARAMETER_PROPERTIES = {
|
|
|
87
95
|
direction: { type: 'string', enum: ['up', 'down', 'top', 'bottom'], description: 'Scroll direction for browser.scroll' },
|
|
88
96
|
viewport: { type: 'string', enum: ['mobile', 'tablet', 'desktop', 'fill'], description: 'Page layout size; snapshots report which one is in effect' },
|
|
89
97
|
label: { type: 'string', description: 'Short name for a browser.capture image, such as before-fix' },
|
|
98
|
+
tabId: { type: 'string', description: 'Browser tab to act on, an id from the tabs a browser.snapshot lists. Omit to use the tab the user is looking at' },
|
|
90
99
|
body: { type: 'string', description: 'Full text of the memory; state it so it still makes sense in a session that has none of this conversation' },
|
|
91
100
|
scope: { type: 'string', enum: ['global', 'project', 'both'], description: 'global is about the user and applies everywhere; project is about this codebase. both is only valid for memory.list' },
|
|
92
101
|
memoryId: { type: 'string', description: 'Memory ID from a memory.list or memory.read result' },
|
|
@@ -108,12 +117,22 @@ const MEMORY_PARAMETER_PROPERTIES = {
|
|
|
108
117
|
...MEMORY_PARAMETER_OVERRIDES,
|
|
109
118
|
};
|
|
110
119
|
|
|
120
|
+
// Its own names, not the shared map: `title` and `body` mean something else in
|
|
121
|
+
// the control and memory tools.
|
|
122
|
+
const NOTIFY_PARAMETER_PROPERTIES = {
|
|
123
|
+
title: { type: 'string', description: 'Short headline the user reads first, up to 120 characters' },
|
|
124
|
+
body: { type: 'string', description: 'One or two sentences of detail, up to 500 characters' },
|
|
125
|
+
showWhenFocused: { type: 'boolean', description: 'Show it even while the user is looking at OpenChamber. Only for something that cannot wait' },
|
|
126
|
+
};
|
|
127
|
+
|
|
111
128
|
const CONTROL_TOOL_DESCRIPTION = "Control OpenChamber projects, sessions, and scheduled tasks on the user's behalf. Sessions and scheduled tasks you create are for the user to follow and interact with. Do not decide on your own to hand parts of your current task to another session; when the user asks you to create a session, send a prompt to one, or schedule a task, do it, including when the work relates to your current task. Use one action per call. Scope with projectId or directory; omit both to use the current session directory. Session dispatches return immediately by default and you receive no notification when a dispatched session finishes, so never promise to report back on it; the user follows it in OpenChamber; a dispatched session needs no follow-up from you. If the user later asks how it went, use session.messages (add wait to block until it is idle, lastAssistant for just the final answer) — session.send always sends a NEW prompt and never just waits. Set wait only when the user asks or the next step requires the completed result. Session and worktree deletion are unavailable.";
|
|
112
129
|
|
|
113
130
|
const WEB_TOOL_DESCRIPTION = "Look at and interact with a web page in OpenChamber's browser panel, so you can check your own work rather than describing what you expect. Use one action per call. Open a page, snapshot it to read its text and its interactive elements, then click, type or scroll using the selectors the snapshot returned; snapshots also report any errors the page logged. Pass a selector to browser.snapshot to read one part of a long page. browser.inspect returns computed styles when the question is how something renders. Set viewport to check a layout at mobile, tablet or desktop size. The page runs with the user's real logins, so treat what you see as their live session.";
|
|
114
131
|
|
|
115
132
|
const MEMORY_TOOL_DESCRIPTION = "Keep what you learn across sessions, so the user does not have to explain the same thing twice. Use one action per call. The session already lists the titles of what is stored. A title is an abbreviation, not the memory: read the entry with memory.read once before acting on it (it then stays in your context; do not re-read it on later turns), because titles leave out the conditions and exceptions that decide how the memory applies, and the ones that look self-explanatory hide them most often. Save something only when it will still be true in a later session — a stable preference, a project convention, a decision and its reason, or a hard-won pointer. Do not save one-off task state, anything you can read from the code, secrets or credentials, or anything the user asked you not to keep; when the user explicitly asks you to remember something, save it, unless it is a secret or credential. Choose the scope deliberately: global is about the user and reaches every project, so put a project's conventions in project scope. Save in the moment, without asking first, when the user corrects how you work or states a preference, confirms that a non-obvious approach worked, or when you learn a project fact that took real effort to find. One fact per entry. The user can review and remove what you save, so save when it fits and mention it briefly.";
|
|
116
133
|
|
|
134
|
+
const NOTIFY_TOOL_DESCRIPTION = "Send the user a notification through OpenChamber, so they learn about something without watching the session. Use it when you finish work that took long enough for the user to step away, when you are blocked on something only the user can resolve, or when the user asked to be told about something. Do not use it for routine progress, for every finished step, or to repeat what your reply already says to a user who is present. Keep the title short and put detail in the body.";
|
|
135
|
+
|
|
117
136
|
const asNonEmptyString = (value) => {
|
|
118
137
|
if (typeof value !== 'string') return null;
|
|
119
138
|
const trimmed = value.trim();
|
|
@@ -240,7 +259,7 @@ const createToolEntry = ({ name, description, definitions, parameters }) => Stri
|
|
|
240
259
|
})
|
|
241
260
|
`;
|
|
242
261
|
|
|
243
|
-
const createPluginSource = ({ includeControl, includeWeb, includeMemory }) => {
|
|
262
|
+
const createPluginSource = ({ includeControl, includeWeb, includeMemory, includeNotify }) => {
|
|
244
263
|
const entries = [];
|
|
245
264
|
if (includeControl) {
|
|
246
265
|
entries.push(createToolEntry({
|
|
@@ -266,6 +285,14 @@ const createPluginSource = ({ includeControl, includeWeb, includeMemory }) => {
|
|
|
266
285
|
parameters: MEMORY_PARAMETER_PROPERTIES,
|
|
267
286
|
}));
|
|
268
287
|
}
|
|
288
|
+
if (includeNotify) {
|
|
289
|
+
entries.push(createToolEntry({
|
|
290
|
+
name: 'openchamber_notify',
|
|
291
|
+
description: NOTIFY_TOOL_DESCRIPTION,
|
|
292
|
+
definitions: OPENCHAMBER_NOTIFY_ACTION_DEFINITIONS,
|
|
293
|
+
parameters: NOTIFY_PARAMETER_PROPERTIES,
|
|
294
|
+
}));
|
|
295
|
+
}
|
|
269
296
|
|
|
270
297
|
// The callback carries the per-child token over plain HTTP. With a proxy in
|
|
271
298
|
// the child's environment, fetch would hand a non-loopback callback, token
|
|
@@ -329,13 +356,13 @@ export const createAgentToolRuntime = (dependencies) => {
|
|
|
329
356
|
* change while it runs, so the source on disk always matches the settings —
|
|
330
357
|
* the running OpenCode reloads the directory it already has configured.
|
|
331
358
|
*/
|
|
332
|
-
const materializePlugin = async ({ includeControl = true, includeWeb = true, includeMemory = true } = {}) => {
|
|
333
|
-
if (!includeControl && !includeWeb && !includeMemory) {
|
|
359
|
+
const materializePlugin = async ({ includeControl = true, includeWeb = true, includeMemory = true, includeNotify = false } = {}) => {
|
|
360
|
+
if (!includeControl && !includeWeb && !includeMemory && !includeNotify) {
|
|
334
361
|
throw new Error('At least one OpenChamber managed tool must be enabled to inject the plugin');
|
|
335
362
|
}
|
|
336
363
|
await fsPromises.mkdir(pluginDirectory, { recursive: true });
|
|
337
364
|
await fsPromises.writeFile(pluginManifestPath, PLUGIN_PACKAGE_JSON, { mode: 0o600 });
|
|
338
|
-
await fsPromises.writeFile(pluginPath, createPluginSource({ includeControl, includeWeb, includeMemory }), { mode: 0o600 });
|
|
365
|
+
await fsPromises.writeFile(pluginPath, createPluginSource({ includeControl, includeWeb, includeMemory, includeNotify }), { mode: 0o600 });
|
|
339
366
|
return pluginDirectory;
|
|
340
367
|
};
|
|
341
368
|
|
|
@@ -484,6 +511,7 @@ export const createAgentToolRuntime = (dependencies) => {
|
|
|
484
511
|
pluginDirectory,
|
|
485
512
|
materializePlugin,
|
|
486
513
|
createChildEnv,
|
|
514
|
+
authorizeRequest: authorize,
|
|
487
515
|
registerRoutes,
|
|
488
516
|
execute,
|
|
489
517
|
abortSession,
|
|
@@ -249,6 +249,21 @@ describe('managed agent tool runtime', () => {
|
|
|
249
249
|
expect(Object.keys(tool)).toEqual(['openchamber_memory']);
|
|
250
250
|
});
|
|
251
251
|
|
|
252
|
+
it('exposes notify as its own tool only when switched on', async () => {
|
|
253
|
+
const { runtime, dataDir } = await createRuntime();
|
|
254
|
+
await prepareManagedEnv(runtime, { includeControl: true, includeWeb: false, includeMemory: false, includeNotify: true });
|
|
255
|
+
const tool = await loadTools(dataDir, 'notify');
|
|
256
|
+
|
|
257
|
+
expect(Object.keys(tool)).toEqual(['openchamber', 'openchamber_notify']);
|
|
258
|
+
expect(Object.keys(tool.openchamber_notify.input.properties.parameters.properties).sort())
|
|
259
|
+
.toEqual(['body', 'showWhenFocused', 'title']);
|
|
260
|
+
expect(Object.keys(tool.openchamber.input.properties.parameters.properties)).not.toContain('showWhenFocused');
|
|
261
|
+
|
|
262
|
+
const { runtime: plain, dataDir: plainDir } = await createRuntime();
|
|
263
|
+
await prepareManagedEnv(plain, { includeControl: true, includeWeb: false, includeMemory: false });
|
|
264
|
+
expect(Object.keys(await loadTools(plainDir, 'nonotify'))).toEqual(['openchamber']);
|
|
265
|
+
});
|
|
266
|
+
|
|
252
267
|
it('refuses to inject a plugin with no tools in it', async () => {
|
|
253
268
|
const { runtime } = await createRuntime();
|
|
254
269
|
let failed = false;
|
|
@@ -46,8 +46,20 @@ itself; it can only ask and wait.
|
|
|
46
46
|
`browser.*` actions of the `openchamber_web` tool onto the router's
|
|
47
47
|
`request()` (same signature as the broker) and owns their parameter
|
|
48
48
|
validation.
|
|
49
|
-
- The client half is `packages/ui/src/lib/browser/controlClient.ts
|
|
50
|
-
|
|
49
|
+
- The client half is `packages/ui/src/lib/browser/controlClient.ts`. Every
|
|
50
|
+
mounted browser tab registers its pane under its context-panel tab id. An
|
|
51
|
+
action with `tabId` runs in that tab; without one it runs in the browser tab
|
|
52
|
+
the user last had in front of them (`setShownBrowserTab`, set by
|
|
53
|
+
`ContextPanel`), never in whichever pane registered last, and never switches
|
|
54
|
+
the user to the tab it acts in. `browser.open` without `tabId` never
|
|
55
|
+
navigates an existing tab: the registered opener (`ContextPanel`,
|
|
56
|
+
`useUIStore.openAgentBrowserTab`) makes a new background tab and the answer
|
|
57
|
+
carries its `tabId`. `browser.snapshot` answers carry `tabs`
|
|
58
|
+
(`id`, `title`, `url`, `active`). A client without the named tab waits
|
|
59
|
+
briefly, so the client that has it claims first, then claims and answers
|
|
60
|
+
"no such tab". `tabId` is validated and passed through by
|
|
61
|
+
`../openchamber-control/service.js` for every action, so an extension
|
|
62
|
+
provider receives it untouched (`BrowserTabTarget` in `@openchamber/sdk`).
|
|
51
63
|
|
|
52
64
|
## Invariants
|
|
53
65
|
|
|
@@ -43,7 +43,7 @@ The following functions are exported and used by the web server:
|
|
|
43
43
|
- `applyHunk(directory, filePath, options)`: Apply a single-hunk patch via `git apply`. `options.action` is `stage` (`git apply --cached`), `unstage` (`git apply --cached --reverse`), or `discard` (`git apply --reverse` in the working tree). Inside the index mutation queue, the server verifies that the complete patch exactly matches one current three-context-line hunk for that file and scope, then runs `--check` before applying. Applicability alone cannot prove an unstaged change: old staged or committed hunks can reverse cleanly too. Stale, historical and multi-file patches fail with a refresh error. Temporary patch files are removed on success and failure; hunk content retains CRLF bytes.
|
|
44
44
|
|
|
45
45
|
### Branch Operations
|
|
46
|
-
- `getBranchBase(directory, branch)`: Read a named creation source from reflog. After a rebase, the creation source is no longer a current parent record, so return `null` and let the user choose a base. Explicit per-runtime, directory, and branch choices in the shared UI outrank detection.
|
|
46
|
+
- `getBranchBase(directory, branch)`: Read a named creation source from reflog. After a rebase, the creation source is no longer a current parent record, so return `null` and let the user choose a base. A source that is the branch's own remote copy (`git switch feat` records `Created from refs/remotes/origin/feat`) is not a parent either and also returns `null`. Explicit per-runtime, directory, and branch choices in the shared UI outrank detection.
|
|
47
47
|
- `getBranches(directory)`: Get list of local and remote branches (filtered to active remote branches).
|
|
48
48
|
- `getUnpushedBranchCounts(directory, branchNames)`: Count commits ahead of each locally known upstream for up to five supplied local branches. This reads local refs only and omits branches without an upstream.
|
|
49
49
|
- `createBranch(directory, branchName, options)`: Create and checkout a new branch.
|
|
@@ -3097,6 +3097,21 @@ export function parseBranchCreationSource(reflogText) {
|
|
|
3097
3097
|
return null;
|
|
3098
3098
|
}
|
|
3099
3099
|
|
|
3100
|
+
async function isOwnRemoteCopy(git, source, branchName) {
|
|
3101
|
+
const fullName = await git
|
|
3102
|
+
.raw(['rev-parse', '--symbolic-full-name', source])
|
|
3103
|
+
.then((value) => String(value || '').trim())
|
|
3104
|
+
.catch(() => '');
|
|
3105
|
+
if (!fullName.startsWith('refs/remotes/')) return false;
|
|
3106
|
+
const upstream = await git
|
|
3107
|
+
.raw(['rev-parse', '--symbolic-full-name', `refs/heads/${branchName}@{upstream}`])
|
|
3108
|
+
.then((value) => String(value || '').trim())
|
|
3109
|
+
.catch(() => '');
|
|
3110
|
+
if (upstream && fullName === upstream) return true;
|
|
3111
|
+
// Upstream may be unset; a remote ref with the branch's own name is still its copy.
|
|
3112
|
+
return fullName.slice('refs/remotes/'.length).split('/').slice(1).join('/') === branchName;
|
|
3113
|
+
}
|
|
3114
|
+
|
|
3100
3115
|
/**
|
|
3101
3116
|
* Resolve the branch the given branch was created from, from its reflog.
|
|
3102
3117
|
* Returns { base: null } when git has no authoritative record (clone, detached
|
|
@@ -3130,6 +3145,13 @@ export async function getBranchBase(directory, branch) {
|
|
|
3130
3145
|
return { base: null };
|
|
3131
3146
|
}
|
|
3132
3147
|
|
|
3148
|
+
// `git switch feat` from a remote branch records "Created from
|
|
3149
|
+
// refs/remotes/origin/feat": the branch's own remote copy, not a parent.
|
|
3150
|
+
// Comparing against it hides every pushed commit.
|
|
3151
|
+
if (await isOwnRemoteCopy(git, source, branchName)) {
|
|
3152
|
+
return { base: null };
|
|
3153
|
+
}
|
|
3154
|
+
|
|
3133
3155
|
return { base: source };
|
|
3134
3156
|
}
|
|
3135
3157
|
|
|
@@ -2316,6 +2316,14 @@ describe.runIf(canRunGit())('getRangeDiff', () => {
|
|
|
2316
2316
|
}
|
|
2317
2317
|
});
|
|
2318
2318
|
|
|
2319
|
+
it('does not treat a branch checked out from its own remote copy as its base', async () => {
|
|
2320
|
+
const { repository } = createRepositoryWithRemote();
|
|
2321
|
+
runGit(repository, ['checkout', '-b', 'react', '--track', 'origin/react']);
|
|
2322
|
+
expect(await getBranchBase(repository, 'react')).toEqual({ base: null });
|
|
2323
|
+
runGit(repository, ['checkout', '--no-track', '-b', 'loose', 'origin/react']);
|
|
2324
|
+
expect(await getBranchBase(repository, 'loose')).toEqual({ base: 'origin/react' });
|
|
2325
|
+
});
|
|
2326
|
+
|
|
2319
2327
|
it('asks for a new base after restacking and compares against the selected parent', async () => {
|
|
2320
2328
|
const { repository } = createRepositoryWithRemote();
|
|
2321
2329
|
runGit(repository, ['checkout', '-b', 'child', 'origin/react']);
|
|
@@ -7,6 +7,7 @@ OpenChamber-owned install and static serve for iframe guests. This is not the Op
|
|
|
7
7
|
## Routes
|
|
8
8
|
|
|
9
9
|
- `POST /api/guests/:id/storage` accepts the SDK's `GuestStorageRequest` and returns `GuestStorageResult`. It requires an installed, enabled, fully approved guest with either a panel or background entry, but no additional capability. The UI host supplies the frame's own identity. Guest-scoped asset tokens cannot call this route. Data lives beside `extensions.json` in `guest-storage/<id>.json`. Each key is 1 to 128 characters, each JSON value at most 64 KiB UTF-8, the whole namespace at most 2 MiB and 2,000 keys. `storage.js` owns serialized authorization/read/write/removal; writes are atomic and failures preserve prior bytes. `uninstallGuest` removes storage for every install source. Missing keys return `found: false`, including after removal; stored JSON null returns `found: true`.
|
|
10
|
+
- `GET /api/guests` also exposes `statusEntry` and optional `statusTitle` / `statusHeight` for `contributes.statusSection`, the extension's Work Status section. Its HTML and built scripts pass the same install checks, and it may be the package's only frame: the storage route and the asset route's `hasRuntime` accept `entry`, `backgroundEntry`, or `statusEntry`.
|
|
10
11
|
- `GET /api/guests` also exposes `pageEntry` and optional `pageTitle` for `contributes.page`. Full-screen page HTML and its built scripts pass the same install checks as attach HTML. No new serving/auth path is required.
|
|
11
12
|
|
|
12
13
|
- `GET /api/guests` returns installed guests. `attach` is `"panel"` or `"dialog"` when declared, and `attachEntry` is the dialog's separate HTML. `version` is the package semver. `integration` is the public slice: name, description, `auth`, and settings; OAuth URLs and tokens stay on the server. `service` includes `runtime`, optional `permissions`, optional `socketBindings`, and `granted`. `capabilities` carries `{ requested, granted }`, derived through the SDK's `requestedGuestCapabilities`. `actions`, `commands`, `tools`, and `filesystem` retain their parsed declarations; UI owns menu placement, command collisions, and tool precedence. `entry` is the optional visible panel and `backgroundEntry` is independent on-demand execution HTML. Background-only extensions get no rail surface; tools-only extensions with neither entry mount no frame. A guest without every requested grant is inactive until approval. `enabled: false` pauses it. A failed listing is 500, never an empty list.
|
|
@@ -30,13 +31,13 @@ OpenChamber-owned install and static serve for iframe guests. This is not the Op
|
|
|
30
31
|
- `POST /api/guests/updates/check` — `{ force?: boolean }` → `{ updates: Record<guestId, { version }> }` for every git install whose origin now carries a newer `package.json` `version`. The check runs `git fetch --depth 1 origin <ref|HEAD>` inside the installed clone and reads `FETCH_HEAD:package.json` through the SDK manifest parser; the only signal is semver (`updates.js` `compareSemver`, prerelease below release), no commit hashes. Results sit in a memory cache per store file and guest id for `UPDATE_CHECK_TTL_MS` (one hour); `force` asks the network again. That cache is separate from the catalog cache, so a store write does not drop it. One guest's failed fetch never hides another's update. Folder and zip installs are never checked.
|
|
31
32
|
- `POST /api/guests/:id/update` — replace the installed git copy with a fresh clone of its stored origin. Answers `{ guest }` (the refreshed catalog row) or 400 `{ error }` with `not-git` (folder, zip, or no stored origin), `clone-failed`, `invalid-manifest` (also when the clone declares a different panel id), `missing-build`, `host-too-old` (body may include `required`), or `swap-failed`. Unknown id is 404. Grants, tokens, settings, and the paused flag are keyed by guest id and stay as they were; a version that asks for more capabilities shows up as needs-approval in the catalog and goes through the usual review dialog.
|
|
32
33
|
- `DELETE /api/guests/:id` — drops the store row, any service grant, and socket overrides; stops a running service. Path-install does not delete the user's folder. Zip and git copies under `{openchamberDataDir}/extensions/` are deleted. Unknown id is 404.
|
|
33
|
-
- `GET /api/guests/:id/{*filePath}` serves package-local files. Unknown IDs, escapes, missing files, and unknown types return 404. HTML and JS require
|
|
34
|
+
- `GET /api/guests/:id/{*filePath}` serves package-local files. Unknown IDs, escapes, missing files, and unknown types return 404. HTML and JS require `entry`, `backgroundEntry`, or `statusEntry`, expressed by `resolveGuestServedFile`'s `hasRuntime` option. Tools-only extensions still serve their SVG icons but no executable content. Guest HTML propagates the scoped `oc_url_token` onto relative script/link/image URLs. The token is minted for `guest:<id>` and works only under that guest's asset route, never `/api/fs/raw` or event streams. Every response carries `Content-Security-Policy: sandbox allow-scripts`, including direct document navigation. The host serves built files from disk and never compiles guest sources.
|
|
34
35
|
|
|
35
36
|
## Install
|
|
36
37
|
|
|
37
38
|
`contributes.background.entry` is optional package-local `.html`, separate from `panel.entry`. Install validates its HTML and every referenced built script using the same path confinement as visible panels. `backgroundEntry` is exposed on the catalog independently of `entry`; adding it does not create a rail icon or a visible page. Capabilities, services, integrations, and storage work with either execution entry. The SDK refuses visible contributions without `panel.entry` and all runtime contributions when neither entry exists. See `packages/sdk/DOCUMENTATION.md` for on-demand invocation ownership.
|
|
38
39
|
|
|
39
|
-
`html-styles.js` appends the SDK's shared scrollbar stylesheet to served HTML, including requests without an asset token. This applies to existing panel, page, and attach bundles in direct and relay mode; the relay loader retains the inline style in `srcDoc`. Appending preserves the doctype and avoids rewriting tag-like text inside scripts or comments. Authored CSP stays intact and can block inline styling. Package files on disk and non-HTML responses are unchanged. Scrollbar colors follow the SDK theme variables inside the frame.
|
|
40
|
+
`html-styles.js` appends the SDK's shared scrollbar stylesheet and its small inline activity script (`GUEST_SCROLLBAR_SCRIPT`: shows a scrollbar while its element scrolls) to served HTML, including requests without an asset token. An authored CSP that blocks inline scripts leaves hover-only scrollbars. This applies to existing panel, page, and attach bundles in direct and relay mode; the relay loader retains the inline style in `srcDoc`. Appending preserves the doctype and avoids rewriting tag-like text inside scripts or comments. Authored CSP stays intact and can block inline styling. Package files on disk and non-HTML responses are unchanged. Scrollbar colors follow the SDK theme variables inside the frame.
|
|
40
41
|
|
|
41
42
|
Built-ins ship with the app; user extensions are installed separately. Add a folder, local ZIP, HTTPS Git/ZIP URL, or SSH Git address from Settings → Extensions. The ZIP picker and drop zone upload the archive on web and remote desktop instances. A guest with a page must ship built classic-IIFE JavaScript, for example from `bunx openchamber-guest-bundle panel/main.ts panel/main.js`; the sandbox does not support ESM imports. `package.json` needs a semver version. A missing panel SVG or invalid manifest fails installation; page-less tools-only packages skip HTML/script checks. Optional `engines.openchamber` is checked against this host. Provider accounts are connected separately in Settings → Integrations.
|
|
42
43
|
|
|
@@ -63,7 +64,7 @@ A missing folder is omitted from the list. Other guests stay. A corrupt `extensi
|
|
|
63
64
|
- `contributes.attach` is copied as `"panel"` or `"dialog"`. The composer + menu and New Worktree read that field. Omitted guests stay off those menus. The object form's `entry` (dialog only) is checked at install like `panel.entry`: missing HTML is `invalid-manifest`, an unbuilt script it loads is `missing-build`; the catalog exposes it as `attachEntry` and the attach window loads that page instead of `panel.entry`. The optional attach `data` payload lives only in the UI's chip, queued context part, and session metadata snapshot; no server route parses it.
|
|
64
65
|
- `request` never leaves the declared `apiOrigin`. A 401 refreshes once. If that fails, tokens for that guest are dropped. Host Linear does not drop Linear auth on a failed GraphQL query. A paused guest never proxies `request` or `serviceRequest`.
|
|
65
66
|
- A service with `provides: ["browser"]` is also driven by the host (`../browser-control/provider.js`), not only by a panel: `proxyGuestServiceRequest` takes `timeoutMs`, `responseMax`, `idleStopMs`, and `signal` for that. A service that never became ready is `SERVICE_FAILED` (nothing was sent); a request that was sent and got no usable answer is `REQUEST_FAILED` (the service may have acted on it), and callers word their errors accordingly. `idleStopMs` arms a per-guest timer re-armed at the end of every request; when it fires with no request in flight the process is discarded (not a Pause: no epoch bump) and the next request respawns it. A user-facing stop clears the timer. Panel requests pass none of these and keep the SDK limits. The guest routes call `onGuestDeactivated({ guestId, guestName })` after a pause, a removal, or a withdrawn approval so a host role the extension held is handed back and the user told.
|
|
66
|
-
- `surface.js` hosts shared surfaces (`contributes.service.surface`). `/api/guests/:id/surface/ws` (URL-token WebSocket, allowlisted in `ui-auth.js` and `relay/tunnel-host.js`; upgrade refused with 404 unless `isSurfaceGuest`: enabled, fully approved, declares the surface) attaches a viewer to the extension's one session. The session holds the service (`holdGuestService`) and runs one pump: `GET /surface/frame?after=<seq>&wait=25000` through `openGuestServiceRequest`, newest frame kept, delivered per viewer only after that viewer acknowledged the previous one (`frame` text message + one binary message). Control is the session's: `none`, `agent` (set by `noteAgentActivity`, expires after `SURFACE_AGENT_HOLD_MS`), or a viewer id; the first deliberate input (anything but a button-less pointer move) from a viewer while nobody or the agent holds it takes it, `release` or the holder's disconnect gives it back, a second viewer's input is refused with a `control` message. Every change is broadcast (`mine` per connection) and posted to `POST /surface/control`. Input, control notices, resizes, and clipboard reads run through one promise chain per session, in socket order; work queued for an ended session is dropped, and an ended session's close handlers never call the service, so closing a panel after a pause, removal, or withdrawn approval cannot restart the process under the session's old authorization. When the last viewer leaves normally the session stays registered until its queue (including the final `none`) has drained, so a deactivation in that window still finds and cancels it; a viewer that reattaches meanwhile restarts the pump. Every hand-off (release, holder disconnect) bumps `session.handoffs`; an input batch remembers the count it arrived under and, if it no longer holds control, may take control only when nothing was handed off since, so a click queued behind a slow request cannot re-take control after the user let go, and a viewer that left (`gone`) never becomes the controller. `userControls` gates the browser provider; `endForGuest` (pause, removal, withdrawn approval) and a failed frame request end the session with an `ended` reason, and `stop()` closes every viewer on shutdown.
|
|
67
|
+
- `surface.js` hosts shared surfaces (`contributes.service.surface`). `/api/guests/:id/surface/ws` (URL-token WebSocket, allowlisted in `ui-auth.js` and `relay/tunnel-host.js`; upgrade refused with 404 unless `isSurfaceGuest`: enabled, fully approved, declares the surface) attaches a viewer to the extension's one session. The session holds the service (`holdGuestService`) and runs one pump: `GET /surface/frame?after=<seq>&wait=25000` through `openGuestServiceRequest`, newest frame kept, delivered per viewer only after that viewer acknowledged the previous one (`frame` text message + one binary message). Control is the session's: `none`, `agent` (set by `noteAgentActivity`, expires after `SURFACE_AGENT_HOLD_MS`), or a viewer id; the first deliberate input (anything but a button-less pointer move) from a viewer while nobody or the agent holds it takes it, `release` or the holder's disconnect gives it back, a second viewer's input is refused with a `control` message. Every change is broadcast (`mine` per connection) and posted to `POST /surface/control`. Input, control notices, resizes, and clipboard reads run through one promise chain per session, in socket order; work queued for an ended session is dropped, and an ended session's close handlers never call the service, so closing a panel after a pause, removal, or withdrawn approval cannot restart the process under the session's old authorization. When the last viewer leaves normally the session stays registered until its queue (including the final `none`) has drained, so a deactivation in that window still finds and cancels it; a viewer that reattaches meanwhile restarts the pump. Every hand-off (release, holder disconnect) bumps `session.handoffs`; an input batch remembers the count it arrived under and, if it no longer holds control, may take control only when nothing was handed off since, so a click queued behind a slow request cannot re-take control after the user let go, and a viewer that left (`gone`) never becomes the controller. Viewer ids are random UUIDs. Every input batch reaches the service with `x-surface-viewer` and `x-surface-frame-seq`: the service's own sequence number (kept apart from the host's bumped `seq`) of the frame that viewer last acknowledged, read when the batch arrives, not when the queue reaches it. A 409 answer becomes an `INPUT_STALE` error to that viewer. Control notices carry `viewer` for a user controller. `viewerHeaders(guestId, viewerId)` gives `/api/guests/:id/service/request` the same viewer, control, and frame headers when the panel names a live viewer of that extension (`viewerId` in the body, from `surface-viewers.ts` in the UI); an unknown id adds nothing. `userControls` gates the browser provider; `endForGuest` (pause, removal, withdrawn approval) and a failed frame request end the session with an `ended` reason, and `stop()` closes every viewer on shutdown.
|
|
67
68
|
- `serviceRequest` never leaves that guest's loopback port. Auth to the service is `Authorization: Bearer` with a host-minted token. The service env is an allowlist (PATH, HOME, temp, locale, Windows system variables) plus `OPENCHAMBER_SERVICE_*`; host secrets are not inherited. There is no sandbox: an allowed service has the user's full access, and the grant card says so. Ready is `GET /health` → 200. Parallel first requests share one spawn; they must not kill each other mid-start. Host quit stops every service. Disabling a guest stops its service without clearing OAuth or grants.
|
|
68
69
|
- File access is decided in `files.js` on canonical paths, never on the string the guest sent. `matchesFilesystemPattern`, `expandHome`, and `globToRegExp` are pure; `resolveGuestFilePath` and `runGuestFileOperation` take `fsPromises` / `nodePath` so tests can stub the OS. The project directory is whatever `resolveOptionalProjectDirectory` validated for this request, so a guest cannot name a project the UI did not open.
|
|
69
70
|
- Update swap (`updates.js` `updateGuest`): the new clone lands in `{dataDir}/extensions/.tmp-<id>-<random>` and is inspected exactly like an install before anything else moves. Only then: stop the guest's service, rename current → `.old-<id>`, rename temp → final, delete `.old-<id>`. Any failure before the swap deletes the temp dir and leaves the install untouched; a failed second rename moves `.old-<id>` back. The store row is not rewritten (same path, same id), the catalog cache and that guest's update cache entry are dropped.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
|
|
4
|
-
import { hasGuestPage, requestedGuestCapabilities, resolveAttachEntry, resolveAttachMode, resolvePageEntry, toPublicService, toPublicIntegration, hostMeetsOpenChamberEngine, openChamberEngineMinimum } from '@openchamber/sdk';
|
|
4
|
+
import { hasGuestPage, requestedGuestCapabilities, resolveAttachEntry, resolveAttachMode, resolvePageEntry, resolveStatusSectionEntry, toPublicService, toPublicIntegration, hostMeetsOpenChamberEngine, openChamberEngineMinimum } from '@openchamber/sdk';
|
|
5
5
|
import { parseManifestJson } from '@openchamber/sdk/schemas';
|
|
6
6
|
|
|
7
7
|
import { listRelativeGuestScriptHrefs, resolveGuestHtmlRelativePath } from './html-tokens.js';
|
|
@@ -247,6 +247,21 @@ export const inspectGuestPackage = async (packageRoot, { openchamberVersion, ski
|
|
|
247
247
|
const page = parsed.manifest.contributes.page;
|
|
248
248
|
if (page !== true && page?.title) guest.pageTitle = page.title;
|
|
249
249
|
}
|
|
250
|
+
// The Work Status section is checked like any other entry, and may be the
|
|
251
|
+
// package's only frame.
|
|
252
|
+
const statusEntry = resolveStatusSectionEntry(parsed.manifest.contributes);
|
|
253
|
+
if (statusEntry) {
|
|
254
|
+
if (!await resolveGuestAssetPath(packageRoot, statusEntry)) {
|
|
255
|
+
return { ok: false, code: 'invalid-manifest' };
|
|
256
|
+
}
|
|
257
|
+
if (!await guestBuiltScriptsReady(packageRoot, statusEntry)) {
|
|
258
|
+
return { ok: false, code: 'missing-build' };
|
|
259
|
+
}
|
|
260
|
+
guest.statusEntry = statusEntry;
|
|
261
|
+
const section = parsed.manifest.contributes.statusSection;
|
|
262
|
+
if (section !== true && section?.title) guest.statusTitle = section.title;
|
|
263
|
+
if (section !== true && section?.height !== undefined) guest.statusHeight = section.height;
|
|
264
|
+
}
|
|
250
265
|
if (parsed.manifest.contributes.capabilities?.length) {
|
|
251
266
|
guest.capabilities = [...parsed.manifest.contributes.capabilities];
|
|
252
267
|
}
|
|
@@ -324,6 +339,9 @@ export const toPublicGuest = (guest) => {
|
|
|
324
339
|
const attach = resolveAttachMode(guest.attach);
|
|
325
340
|
if (guest.pageEntry) row.pageEntry = guest.pageEntry;
|
|
326
341
|
if (guest.pageTitle) row.pageTitle = guest.pageTitle;
|
|
342
|
+
if (guest.statusEntry) row.statusEntry = guest.statusEntry;
|
|
343
|
+
if (guest.statusTitle) row.statusTitle = guest.statusTitle;
|
|
344
|
+
if (Number.isInteger(guest.statusHeight)) row.statusHeight = guest.statusHeight;
|
|
327
345
|
if (attach) {
|
|
328
346
|
row.attach = attach;
|
|
329
347
|
}
|
|
@@ -257,6 +257,28 @@ describe('page-less packages', () => {
|
|
|
257
257
|
expect(toPublicGuest(inspected.guest)).toMatchObject({ pageEntry: 'panel/page.html', pageTitle: 'Tasks' });
|
|
258
258
|
} finally { await fs.rm(dir, { recursive: true, force: true }); }
|
|
259
259
|
});
|
|
260
|
+
test('a status-section-only package validates its HTML and scripts and publishes title and height without a panel entry', async () => {
|
|
261
|
+
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'oc-status-'));
|
|
262
|
+
try {
|
|
263
|
+
await fs.writeFile(path.join(dir, 'package.json'), JSON.stringify({ version: '1.0.0', openchamber: {
|
|
264
|
+
apiVersion: 1, contributes: {
|
|
265
|
+
panel: { id: 'git-graph', name: 'Git graph', icon: 'git-commit' },
|
|
266
|
+
statusSection: { entry: 'status/index.html', title: 'Recent commits', height: 160 },
|
|
267
|
+
},
|
|
268
|
+
} }));
|
|
269
|
+
expect(await inspectGuestPackage(dir)).toMatchObject({ ok: false, code: 'invalid-manifest' });
|
|
270
|
+
await fs.mkdir(path.join(dir, 'status'));
|
|
271
|
+
await fs.writeFile(path.join(dir, 'status/index.html'), '<script src="main.js"></script>');
|
|
272
|
+
expect(await inspectGuestPackage(dir)).toMatchObject({ ok: false, code: 'missing-build' });
|
|
273
|
+
await fs.writeFile(path.join(dir, 'status/main.js'), 'console.log("status")');
|
|
274
|
+
const inspected = await inspectGuestPackage(dir);
|
|
275
|
+
expect(inspected.ok).toBe(true);
|
|
276
|
+
const row = toPublicGuest(inspected.guest);
|
|
277
|
+
expect(row).toMatchObject({ statusEntry: 'status/index.html', statusTitle: 'Recent commits', statusHeight: 160 });
|
|
278
|
+
expect(row).not.toHaveProperty('entry');
|
|
279
|
+
} finally { await fs.rm(dir, { recursive: true, force: true }); }
|
|
280
|
+
});
|
|
281
|
+
|
|
260
282
|
test('installs a tools-only package without entry, omits entry from the row, and never serves it a frame', async () => {
|
|
261
283
|
const dir = await fs.mkdtemp(path.join(os.tmpdir(), 'oc-guest-'));
|
|
262
284
|
const guestRoot = path.join(dir, 'tools-only');
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { GUEST_SCROLLBAR_CSS } from '@openchamber/sdk';
|
|
1
|
+
import { GUEST_SCROLLBAR_CSS, GUEST_SCROLLBAR_SCRIPT } from '@openchamber/sdk';
|
|
2
2
|
|
|
3
3
|
/** Append instead of matching tags inside untrusted comments, scripts, or templates.
|
|
4
|
-
* Browsers accept the style after the document; its doctype and authored CSP stay intact.
|
|
4
|
+
* Browsers accept the style and script after the document; its doctype and authored CSP stay intact.
|
|
5
|
+
* The script only marks scrolling elements so their scrollbars show while scrolling; an authored
|
|
6
|
+
* CSP that blocks inline scripts leaves the hover-only behavior of the stylesheet.
|
|
5
7
|
*/
|
|
6
|
-
export const injectGuestDocumentStyles = (html) => `${html}\n<style data-openchamber-guest-styles>${GUEST_SCROLLBAR_CSS}</style>`;
|
|
8
|
+
export const injectGuestDocumentStyles = (html) => `${html}\n<style data-openchamber-guest-styles>${GUEST_SCROLLBAR_CSS}</style>\n<script data-openchamber-guest-scrollbar>${GUEST_SCROLLBAR_SCRIPT}</script>`;
|
|
@@ -4,7 +4,7 @@ import os from 'node:os';
|
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import express from 'express';
|
|
6
6
|
import request from 'supertest';
|
|
7
|
-
import { GUEST_SCROLLBAR_CSS } from '@openchamber/sdk';
|
|
7
|
+
import { GUEST_SCROLLBAR_CSS, GUEST_SCROLLBAR_SCRIPT } from '@openchamber/sdk';
|
|
8
8
|
import { injectGuestDocumentStyles } from './html-styles.js';
|
|
9
9
|
import { registerGuestRoutes } from './routes.js';
|
|
10
10
|
import { writeExtensionStore } from './persist.js';
|
|
@@ -19,6 +19,7 @@ describe('guest document styles', () => {
|
|
|
19
19
|
expect(decorated.startsWith(html)).toBe(true);
|
|
20
20
|
expect(decorated).toContain(GUEST_SCROLLBAR_CSS);
|
|
21
21
|
expect(decorated).toContain('data-openchamber-guest-styles');
|
|
22
|
+
expect(decorated).toContain(`<script data-openchamber-guest-scrollbar>${GUEST_SCROLLBAR_SCRIPT}</script>`);
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
test('serves scrollbar defaults to existing guests with or without an asset token', async () => {
|
|
@@ -36,6 +37,7 @@ describe('guest document styles', () => {
|
|
|
36
37
|
expect(response.headers['content-security-policy']).toBe('sandbox allow-scripts');
|
|
37
38
|
expect(response.headers['cache-control']).toBe('no-store');
|
|
38
39
|
expect(response.text).toContain(GUEST_SCROLLBAR_CSS);
|
|
40
|
+
expect(response.text).toContain(GUEST_SCROLLBAR_SCRIPT);
|
|
39
41
|
expect(response.text.startsWith('<!doctype html>')).toBe(true);
|
|
40
42
|
expect(response.text).toContain(suffix ? 'main.js?oc_url_token=fixture-scope' : 'src="main.js"');
|
|
41
43
|
}
|
|
@@ -88,6 +88,12 @@ const requestBodySchema = z.object({
|
|
|
88
88
|
body: z.string().max(64_000).optional(),
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
+
const serviceRequestBodySchema = requestBodySchema.extend({
|
|
92
|
+
// The shared-surface viewer open in the same window, if any. The host
|
|
93
|
+
// resolves it; an id that is not a live viewer of this extension is ignored.
|
|
94
|
+
viewerId: z.string().min(1).max(128).optional(),
|
|
95
|
+
});
|
|
96
|
+
|
|
91
97
|
const fileBodySchema = z.object({
|
|
92
98
|
op: z.enum(['read', 'write', 'list', 'stat']),
|
|
93
99
|
path: z.string().min(1).max(GUEST_FILE_PATH_MAX),
|
|
@@ -196,6 +202,7 @@ export const registerGuestRoutes = (app, {
|
|
|
196
202
|
resolveOptionalProjectDirectory,
|
|
197
203
|
getSmallModelService,
|
|
198
204
|
onGuestDeactivated = async () => false,
|
|
205
|
+
surfaceViewerHeaders = () => null,
|
|
199
206
|
}) => {
|
|
200
207
|
const persistPath = extensionsPersistPath(openchamberDataDir);
|
|
201
208
|
const authPath = guestAuthPersistPath(openchamberDataDir);
|
|
@@ -547,7 +554,7 @@ export const registerGuestRoutes = (app, {
|
|
|
547
554
|
if (!guest?.service) {
|
|
548
555
|
return res.status(404).json({ error: 'not-found' });
|
|
549
556
|
}
|
|
550
|
-
const parsed =
|
|
557
|
+
const parsed = serviceRequestBodySchema.safeParse(req.body);
|
|
551
558
|
if (!parsed.success) {
|
|
552
559
|
return res.status(400).json({ error: 'invalid-request' });
|
|
553
560
|
}
|
|
@@ -562,6 +569,7 @@ export const registerGuestRoutes = (app, {
|
|
|
562
569
|
path: parsed.data.path,
|
|
563
570
|
query: parsed.data.query,
|
|
564
571
|
body: parsed.data.body,
|
|
572
|
+
headers: parsed.data.viewerId ? surfaceViewerHeaders(guest.id, parsed.data.viewerId) ?? undefined : undefined,
|
|
565
573
|
});
|
|
566
574
|
res.json(result);
|
|
567
575
|
} catch (error) {
|
|
@@ -580,7 +588,7 @@ export const registerGuestRoutes = (app, {
|
|
|
580
588
|
try {
|
|
581
589
|
const result = await runGuestStorage(persistPath, req.params.id, parsed.data, async () => {
|
|
582
590
|
const guest = await loadGuest(req.params.id);
|
|
583
|
-
if (!guest || guest.enabled === false || (!guest.entry && !guest.backgroundEntry)) throw new Error('Extension is unavailable.');
|
|
591
|
+
if (!guest || guest.enabled === false || (!guest.entry && !guest.backgroundEntry && !guest.statusEntry)) throw new Error('Extension is unavailable.');
|
|
584
592
|
if (!requestedGuestCapabilities(guest).every((capability) => guest.capabilityGrants.includes(capability))) throw new Error('Extension needs approval.');
|
|
585
593
|
});
|
|
586
594
|
return res.json(result);
|
|
@@ -814,7 +822,7 @@ export const registerGuestRoutes = (app, {
|
|
|
814
822
|
return res.status(404).end();
|
|
815
823
|
}
|
|
816
824
|
const served = await resolveGuestServedFile(guest.packageRoot, relativePath, {
|
|
817
|
-
hasRuntime: Boolean(guest.entry || guest.backgroundEntry),
|
|
825
|
+
hasRuntime: Boolean(guest.entry || guest.backgroundEntry || guest.statusEntry),
|
|
818
826
|
});
|
|
819
827
|
if (!served) {
|
|
820
828
|
return res.status(404).end();
|