@openchamber/web 2.0.0 → 2.0.2
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-CmKmyb9T.js} +1 -1
- package/dist/assets/DiffView-8-PFpZ2p.js +4 -0
- package/dist/assets/FilesView-0Ie20mEk.js +17 -0
- package/dist/assets/{GitView-DY4pelsO.js → GitView-DNUSu00w.js} +4 -4
- package/dist/assets/{GuestAttachDialog-D6mHDTB2.js → GuestAttachDialog-Cv6QzjHC.js} +1 -1
- package/dist/assets/GuestSurfacePane-Bt3jB_Ye.js +1 -0
- package/dist/assets/{JsonTreeView-DEXI2NvJ.js → JsonTreeView-BlyHTRhM.js} +1 -1
- package/dist/assets/{LinearIssuesView-BTNc-4dN.js → LinearIssuesView-CSl2MUfA.js} +1 -1
- package/dist/assets/MarkdownImageGallery-2UXJF-5B.js +1 -0
- package/dist/assets/MarkdownRendererImpl-DVHqZoug.js +12 -0
- package/dist/assets/{OnboardingScreen-FJUreEgI.js → OnboardingScreen-CIdXJpfc.js} +1 -1
- package/dist/assets/{PatchDiff-C0oOkKnO.js → PatchDiff-ByvnbG5T.js} +1 -1
- package/dist/assets/{PierreDiffViewer-asuSQAsf.js → PierreDiffViewer-BXieg0mH.js} +3 -3
- package/dist/assets/{PlanView-DGbasNHP.js → PlanView-DEIi3Q7M.js} +4 -4
- package/dist/assets/PluginPane-BEPUWVho.js +3 -0
- package/dist/assets/SettingsView-CiNh-RbW.js +30 -0
- package/dist/assets/{SettingsWindow-By4cqnqy.js → SettingsWindow-BIz224xs.js} +1 -1
- package/dist/assets/{SubmoduleDiffSummary-C0P2tXLU.js → SubmoduleDiffSummary-CXKmlps9.js} +1 -1
- package/dist/assets/{ToolOutputDialog-Cayc-yIM.js → ToolOutputDialog-BsgAK8xu.js} +6 -6
- package/dist/assets/{ToolPartDiffPreview-B0jmpPQz.js → ToolPartDiffPreview-vdPObXOf.js} +2 -2
- package/dist/assets/{VirtualizedFileDiff-DsOpvWZD.js → VirtualizedFileDiff-BkFNKWS5.js} +1 -1
- package/dist/assets/{WalkthroughView-CCakjyn9.js → WalkthroughView-6oE-MuDL.js} +2 -2
- package/dist/assets/{appThemeRegistry-Bw5oTm41.js → appThemeRegistry-aHUNHoqP.js} +1 -1
- package/dist/assets/changesTree-CePHbFcj.js +1 -0
- package/dist/assets/commitAndPush-Bon9r94r.js +1 -0
- package/dist/assets/{computeVirtualFileMetrics-B-4aLf4A.js → computeVirtualFileMetrics-DKqr_1AQ.js} +2 -2
- package/dist/assets/de-CgAJ51z7.js +10 -0
- package/dist/assets/es-zGi_ravM.js +16 -0
- package/dist/assets/fr-CPfogrWx.js +14 -0
- package/dist/assets/index-CHfphYL3.js +41 -0
- package/dist/assets/{index-B6r0Kv-B.js → index-DpFttslC.js} +1 -1
- package/dist/assets/index-DvMJ3w6V.css +1 -0
- package/dist/assets/{isDiffPlainText-Ok-kgtJA.js → isDiffPlainText-kzAgpIgi.js} +1 -1
- package/dist/assets/{isFilePlainText-0dLnkYm8.js → isFilePlainText-Uj6y-jzz.js} +1 -1
- package/dist/assets/ja-DMk6wd-U.js +16 -0
- package/dist/assets/ko-BFpzJ8jc.js +16 -0
- package/dist/assets/{main-CjXBM_Xe.js → main-CbfMxn-I.js} +2 -2
- package/dist/assets/main-anyZFMIs.js +896 -0
- package/dist/assets/{markdown-shiki.worker-CahLvHIq.js → markdown-shiki.worker-Bg8SoAJJ.js} +8 -5
- package/dist/assets/markdownCore-CmM47cAE.js +7 -0
- package/dist/assets/{miniChat-DZ3OAeLN.js → miniChat-CiAKBC10.js} +2 -2
- package/dist/assets/{mobile-CH0LOIF-.js → mobile-CsT4sJwC.js} +2 -2
- package/dist/assets/patchFileDiff-DeaE08W0.js +13 -0
- package/dist/assets/pl-VdRPcZrB.js +16 -0
- package/dist/assets/pt-BR-BRys_lOW.js +16 -0
- package/dist/assets/{renderElectronMiniChatApp-CB1uLYvh.js → renderElectronMiniChatApp-C5677jy0.js} +2 -2
- package/dist/assets/renderMobileApp-D4dBBAqQ.js +25 -0
- package/dist/assets/runtimeEndpointReset-5r0hkd-2.js +27 -0
- package/dist/assets/scheduledTasksApi-BZCNJ588.js +1 -0
- package/dist/assets/{shikiHighlight-CocY80VR.js → shikiHighlight-BSUEa3yF.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-CF77r8FA.js → textMateThemeFromAppTheme-CsATFZIV.js} +1 -1
- package/dist/assets/tr-CA9ckNnm.js +7 -0
- package/dist/assets/uk-byjR-y8D.js +16 -0
- package/dist/assets/{useAppFontEffects-Dc5nTHi8.js → useAppFontEffects-BWQZ5DeI.js} +161 -157
- package/dist/assets/{useInlineCommentController-Dbza5c8l.js → useInlineCommentController-DlFyVfBu.js} +2 -2
- package/dist/assets/{useRootScrollLock-CSCLv396.js → useRootScrollLock-Cp1eFoM2.js} +2 -2
- package/dist/assets/{vendor-codemirror-language-data-CkmYWcRI.js → vendor-codemirror-language-data-BwwommM0.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-D3Yjr4Zx.js} +1 -1
- package/dist/assets/zh-CN-DRabgxdG.js +16 -0
- package/dist/assets/zh-TW-rbY5c9UK.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 +82 -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/event-stream/global-hub.js +23 -1
- package/server/lib/event-stream/global-hub.test.js +35 -0
- package/server/lib/event-stream/global-ws-bridge.js +3 -1
- package/server/lib/event-stream/upstream-reader.js +3 -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 +37 -24
- package/server/lib/opencode/bootstrap-runtime.js +14 -1
- package/server/lib/opencode/compatibility.js +6 -3
- package/server/lib/opencode/compatibility.test.js +8 -0
- package/server/lib/opencode/config-entity-v2.test.js +27 -0
- package/server/lib/opencode/config-paths.test.js +12 -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 +20 -4
- package/server/lib/opencode/core-routes.test.js +41 -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/mcp.js +7 -2
- package/server/lib/opencode/openchamber-routes.js +29 -11
- package/server/lib/opencode/openchamber-routes.test.js +18 -0
- package/server/lib/opencode/project-directory-runtime.js +8 -0
- package/server/lib/opencode/project-directory-runtime.test.js +13 -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/proxy.js +38 -2
- package/server/lib/opencode/routes-upgrade.test.js +1 -1
- package/server/lib/opencode/routes.js +36 -1
- package/server/lib/opencode/server-utils-runtime.js +5 -0
- package/server/lib/opencode/settings-helpers.js +10 -0
- package/server/lib/opencode/settings-helpers.test.js +2 -2
- package/server/lib/opencode/settings-registry.json +17 -0
- package/server/lib/opencode/settings-runtime.js +1 -0
- package/server/lib/opencode/shared.js +49 -4
- package/server/lib/opencode/shared.test.js +79 -1
- package/server/lib/opencode/shutdown-runtime.js +3 -0
- 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/watcher.js +3 -1
- package/server/lib/opencode/websearch-config.js +13 -1
- package/server/lib/quota/providers/kimi.js +1 -1
- package/server/lib/realtime-proxy.js +5 -1
- package/server/lib/realtime-proxy.test.js +29 -0
- package/server/lib/relay/tunnel-host.js +4 -1
- package/server/lib/relay/tunnel-host.test.js +11 -0
- 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/server/lib/small-model/DOCUMENTATION.md +11 -10
- package/server/lib/small-model/index.js +27 -32
- package/server/lib/small-model/index.test.js +28 -16
- package/server/lib/spaces/DOCUMENTATION.md +381 -20
- package/server/lib/spaces/code-in-bait.js +145 -6
- package/server/lib/spaces/code-in.js +10 -150
- package/server/lib/spaces/code-in.test.js +7 -83
- package/server/lib/spaces/code-out.js +1819 -0
- package/server/lib/spaces/code-out.test.js +3945 -0
- package/server/lib/spaces/code-transfer.js +173 -0
- package/server/lib/spaces/command-stream.test.js +181 -0
- package/server/lib/spaces/dispatcher.js +670 -0
- package/server/lib/spaces/dispatcher.test.js +582 -0
- package/server/lib/spaces/gatekeeper-channel.js +2 -0
- package/server/lib/spaces/gatekeeper-channel.test.js +9 -3
- package/server/lib/spaces/gatekeeper-program.cjs +4 -1
- package/server/lib/spaces/gatekeeper-program.test.js +3 -0
- package/server/lib/spaces/hardening.js +20 -4
- package/server/lib/spaces/hardening.test.js +18 -3
- package/server/lib/spaces/host-git.js +7 -4
- package/server/lib/spaces/host-git.test.js +6 -2
- package/server/lib/spaces/host.js +304 -0
- package/server/lib/spaces/host.test.js +273 -0
- package/server/lib/spaces/journey.js +393 -0
- package/server/lib/spaces/journey.test.js +384 -0
- package/server/lib/spaces/layout.js +26 -2
- package/server/lib/spaces/manager.js +4 -3
- package/server/lib/spaces/manager.test.js +6 -0
- package/server/lib/spaces/places/code-out.docker.live.test.js +412 -0
- package/server/lib/spaces/places/contract-suite.js +36 -0
- package/server/lib/spaces/places/dispatcher.docker.live.test.js +296 -0
- package/server/lib/spaces/places/docker.js +15 -3
- package/server/lib/spaces/places/docker.test.js +33 -2
- package/server/lib/spaces/places/escape-suite.js +86 -14
- package/server/lib/spaces/places/memory-place.js +24 -1
- package/server/lib/spaces/places/registry.js +1 -1
- package/server/lib/spaces/places/server.docker.live.test.js +69 -33
- package/server/lib/spaces/places/sessions.docker.live.test.js +220 -0
- package/server/lib/spaces/routes.js +207 -0
- package/server/lib/spaces/routes.test.js +211 -0
- package/server/lib/spaces/run-command.js +261 -8
- package/server/lib/spaces/run-command.test.js +193 -3
- package/server/lib/spaces/space-events.js +153 -0
- package/server/lib/spaces/space-events.test.js +160 -0
- package/server/lib/spaces/space-records.js +98 -0
- package/server/lib/spaces/space-records.test.js +73 -0
- package/server/lib/spaces/space-sessions.js +210 -0
- package/server/lib/spaces/space-sessions.test.js +161 -0
- package/server/lib/spaces/websocket.js +329 -0
- package/server/lib/spaces/websocket.test.js +345 -0
- package/server/lib/ui-auth/ui-auth.js +8 -2
- package/server/lib/ui-auth/ui-auth.test.js +29 -0
- package/server/opencode-proxy.test.js +113 -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/MarkdownImageGallery-wcUUcf8l.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
|
@@ -764,13 +764,13 @@ describe('settings registry gate', () => {
|
|
|
764
764
|
desktopLanAccessEnabled: true, desktopKeepAwakeEnabled: true, desktopMinimizeToTrayEnabled: true, desktopMacMenuBarEnabled: true,
|
|
765
765
|
desktopUiPassword: 'secret', githubClientId: 'client', githubScopes: 'repo', skillCatalogs: [{ id: 'c', label: 'C', source: 'https://x' }],
|
|
766
766
|
defaultGitIdentityId: 'global', permissionAutoAccept: { sessions: { s: true }, revision: 1 },
|
|
767
|
-
agentControlToolEnabled: true, agentWebToolEnabled: true, browserProvider: 'builtin', agentMemoryToolEnabled: true, openCodeUpdateToastDismissedVersion: '1.0.0',
|
|
767
|
+
agentControlToolEnabled: true, agentWebToolEnabled: true, browserProvider: 'builtin', agentMemoryToolEnabled: true, agentNotifyToolEnabled: true, isolatedSpacesEnabled: true, openCodeUpdateToastDismissedVersion: '1.0.0',
|
|
768
768
|
autoDeleteEnabled: true, autoDeleteAfterDays: 30, sessionRetentionOnlyArchived: false, sessionRetentionAction: 'archive', terminalShell: 'zsh', terminalLoginShells: ['zsh'],
|
|
769
769
|
openInAppId: 'vscode', dictationEnabled: true, sttProvider: 'local', sttServerUrl: 'http://localhost:8001/v1', sttModel: 'm', sttLocalModel: 'm', sttLanguage: 'en',
|
|
770
770
|
tunnelProvider: 'cloudflare', tunnelMode: 'quick', tunnelBootstrapTtlMs: 600000, tunnelSessionTtlMs: 86400000, managedLocalTunnelConfigPath: '/tmp/x',
|
|
771
771
|
managedRemoteTunnelHostname: 'x.example', managedRemoteTunnelToken: 'token', managedRemoteTunnelPresets: [{ id: 'a', name: 'A', hostname: 'a.example' }],
|
|
772
772
|
managedRemoteTunnelSelectedPresetId: 'a', managedRemoteTunnelPresetTokens: { a: 'token' },
|
|
773
|
-
sidebarProjectDisplayMode: 'all', sidebarViewMode: 'timeline', sidebarProjectSortOrder: 'manual', sidebarShowRecentSection: true,
|
|
773
|
+
sidebarProjectDisplayMode: 'all', sidebarViewMode: 'timeline', sidebarProjectSortOrder: 'manual', sidebarWorktreeSortOrder: 'recent', sidebarShowRecentSection: true,
|
|
774
774
|
workStatusPanelEnabled: true, workStatusHiddenSections: ['mcp'], workStatusHiddenSectionsExplicit: true, workStatusSectionOrder: ['mcp', 'session'],
|
|
775
775
|
showReasoningTraces: true, streamingAutoFollowEnabled: true, collapsibleThinkingBlocks: true, showTextJustificationActivity: true,
|
|
776
776
|
chatRenderMode: 'live', activityRenderMode: 'summary', mermaidRenderingMode: 'svg', userMessageRenderingMode: 'markdown', collapsibleUserMessages: true,
|
|
@@ -123,9 +123,15 @@
|
|
|
123
123
|
"browserProvider": {
|
|
124
124
|
"scope": "instance"
|
|
125
125
|
},
|
|
126
|
+
"agentNotifyToolEnabled": {
|
|
127
|
+
"scope": "instance"
|
|
128
|
+
},
|
|
126
129
|
"agentMemoryToolEnabled": {
|
|
127
130
|
"scope": "instance"
|
|
128
131
|
},
|
|
132
|
+
"isolatedSpacesEnabled": {
|
|
133
|
+
"scope": "instance"
|
|
134
|
+
},
|
|
129
135
|
"agentMemoryFeatureAvailable": {
|
|
130
136
|
"scope": "instance",
|
|
131
137
|
"computed": true
|
|
@@ -222,6 +228,9 @@
|
|
|
222
228
|
"sidebarProjectSortOrder": {
|
|
223
229
|
"scope": "profile"
|
|
224
230
|
},
|
|
231
|
+
"sidebarWorktreeSortOrder": {
|
|
232
|
+
"scope": "profile"
|
|
233
|
+
},
|
|
225
234
|
"sidebarShowRecentSection": {
|
|
226
235
|
"scope": "profile"
|
|
227
236
|
},
|
|
@@ -674,6 +683,14 @@
|
|
|
674
683
|
"scope": "device",
|
|
675
684
|
"local": true
|
|
676
685
|
},
|
|
686
|
+
"diffFileListMode": {
|
|
687
|
+
"scope": "device",
|
|
688
|
+
"local": true
|
|
689
|
+
},
|
|
690
|
+
"diffFileTreeWidth": {
|
|
691
|
+
"scope": "device",
|
|
692
|
+
"local": true
|
|
693
|
+
},
|
|
677
694
|
"linearIssueListStatus": {
|
|
678
695
|
"scope": "device",
|
|
679
696
|
"local": true
|
|
@@ -280,11 +280,16 @@ function readConfigLayer(filePath) {
|
|
|
280
280
|
function readConfigLayers(workingDirectory) {
|
|
281
281
|
const { userPaths, projectPath, customPath } = getConfigPaths(workingDirectory);
|
|
282
282
|
const userPath = getPrimaryUserConfigPath(userPaths);
|
|
283
|
+
// OpenCode loads every global config file in order, so an `opencode.jsonc`
|
|
284
|
+
// next to `opencode.json` overrides it. New entries still go to the primary
|
|
285
|
+
// file; entries found in the override are edited where they live.
|
|
286
|
+
const userOverridePath = userPaths.find((candidate) => candidate !== userPath && fs.existsSync(candidate)) ?? null;
|
|
283
287
|
const userLayer = readConfigLayer(userPath);
|
|
288
|
+
const userOverrideLayer = readConfigLayer(userOverridePath);
|
|
284
289
|
const projectLayer = readConfigLayer(projectPath);
|
|
285
290
|
const customLayer = readConfigLayer(customPath);
|
|
286
291
|
const mergedConfig = mergeConfigs(
|
|
287
|
-
mergeConfigs(userLayer.config, projectLayer.config),
|
|
292
|
+
mergeConfigs(mergeConfigs(userLayer.config, userOverrideLayer.config), projectLayer.config),
|
|
288
293
|
customLayer.config,
|
|
289
294
|
);
|
|
290
295
|
|
|
@@ -292,6 +297,9 @@ function readConfigLayers(workingDirectory) {
|
|
|
292
297
|
if (userLayer.error) {
|
|
293
298
|
layerErrors.push({ path: userPath, code: userLayer.error.code, message: userLayer.error.message });
|
|
294
299
|
}
|
|
300
|
+
if (userOverrideLayer.error && userOverridePath) {
|
|
301
|
+
layerErrors.push({ path: userOverridePath, code: userOverrideLayer.error.code, message: userOverrideLayer.error.message });
|
|
302
|
+
}
|
|
295
303
|
if (projectLayer.error && projectPath) {
|
|
296
304
|
layerErrors.push({ path: projectPath, code: projectLayer.error.code, message: projectLayer.error.message });
|
|
297
305
|
}
|
|
@@ -301,10 +309,11 @@ function readConfigLayers(workingDirectory) {
|
|
|
301
309
|
|
|
302
310
|
return {
|
|
303
311
|
userConfig: userLayer.config,
|
|
312
|
+
userOverrideConfig: userOverrideLayer.config,
|
|
304
313
|
projectConfig: projectLayer.config,
|
|
305
314
|
customConfig: customLayer.config,
|
|
306
315
|
mergedConfig,
|
|
307
|
-
paths: { userPath, projectPath, customPath },
|
|
316
|
+
paths: { userPath, userOverridePath, projectPath, customPath },
|
|
308
317
|
layerErrors,
|
|
309
318
|
};
|
|
310
319
|
}
|
|
@@ -407,6 +416,12 @@ function getJsonEntrySource(layers, sectionKind, entryName) {
|
|
|
407
416
|
if (project) return project;
|
|
408
417
|
}
|
|
409
418
|
|
|
419
|
+
if (paths.userOverridePath) {
|
|
420
|
+
throwIfLayerError(layers, paths.userOverridePath);
|
|
421
|
+
const userOverride = found(layers.userOverrideConfig, paths.userOverridePath);
|
|
422
|
+
if (userOverride) return userOverride;
|
|
423
|
+
}
|
|
424
|
+
|
|
410
425
|
throwIfLayerError(layers, paths.userPath);
|
|
411
426
|
const user = found(userConfig, paths.userPath);
|
|
412
427
|
if (user) return user;
|
|
@@ -509,7 +524,20 @@ function walkSkillMdFiles(rootDir) {
|
|
|
509
524
|
if (!rootDir || !fs.existsSync(rootDir)) return [];
|
|
510
525
|
|
|
511
526
|
const results = [];
|
|
527
|
+
// Real paths of the directories on the current walk path. Links (symlinks and
|
|
528
|
+
// Windows junctions) are followed at any depth; a link back to one of its own
|
|
529
|
+
// ancestors is skipped instead of recursing forever. Two links to the same
|
|
530
|
+
// target elsewhere in the tree are both walked, as the top level always did.
|
|
531
|
+
const ancestors = new Set();
|
|
512
532
|
const walk = (dir) => {
|
|
533
|
+
let realDir;
|
|
534
|
+
try {
|
|
535
|
+
realDir = fs.realpathSync(dir);
|
|
536
|
+
} catch {
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
if (ancestors.has(realDir)) return;
|
|
540
|
+
|
|
513
541
|
let entries = [];
|
|
514
542
|
try {
|
|
515
543
|
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
@@ -517,16 +545,33 @@ function walkSkillMdFiles(rootDir) {
|
|
|
517
545
|
return;
|
|
518
546
|
}
|
|
519
547
|
|
|
548
|
+
ancestors.add(realDir);
|
|
549
|
+
|
|
520
550
|
for (const entry of entries) {
|
|
521
551
|
const fullPath = path.join(dir, entry.name);
|
|
522
|
-
|
|
552
|
+
// Junctions report as links, not directories. A link whose target cannot be
|
|
553
|
+
// stat'ed is skipped, the way an unreadable directory is, instead of failing
|
|
554
|
+
// the whole scan.
|
|
555
|
+
let isDirectoryEntry = entry.isDirectory();
|
|
556
|
+
let isFileEntry = entry.isFile();
|
|
557
|
+
if (entry.isSymbolicLink()) {
|
|
558
|
+
try {
|
|
559
|
+
const target = fs.statSync(fullPath);
|
|
560
|
+
isDirectoryEntry = target.isDirectory();
|
|
561
|
+
isFileEntry = target.isFile();
|
|
562
|
+
} catch {
|
|
563
|
+
continue;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
if (isDirectoryEntry) {
|
|
523
567
|
walk(fullPath);
|
|
524
568
|
continue;
|
|
525
569
|
}
|
|
526
|
-
if (
|
|
570
|
+
if (isFileEntry && entry.name === 'SKILL.md') {
|
|
527
571
|
results.push(fullPath);
|
|
528
572
|
}
|
|
529
573
|
}
|
|
574
|
+
ancestors.delete(realDir);
|
|
530
575
|
};
|
|
531
576
|
|
|
532
577
|
walk(rootDir);
|
|
@@ -3,7 +3,7 @@ import fs from 'fs';
|
|
|
3
3
|
import os from 'os';
|
|
4
4
|
import path from 'path';
|
|
5
5
|
|
|
6
|
-
import { parseMdFile, writeMdFile, readConfigFile, readConfigLayers, writeConfig } from './shared.js';
|
|
6
|
+
import { parseMdFile, writeMdFile, readConfigFile, readConfigLayers, writeConfig, walkSkillMdFiles } from './shared.js';
|
|
7
7
|
import { updateAgent } from './agents.js';
|
|
8
8
|
import { updateMcpConfig } from './mcp.js';
|
|
9
9
|
|
|
@@ -388,3 +388,81 @@ describe('readConfigFile / writeConfig JSONC safety (issue #2923)', () => {
|
|
|
388
388
|
}
|
|
389
389
|
});
|
|
390
390
|
});
|
|
391
|
+
|
|
392
|
+
describe('walkSkillMdFiles', () => {
|
|
393
|
+
beforeEach(() => {
|
|
394
|
+
fs.rmSync(FIXTURE_DIR, { recursive: true, force: true });
|
|
395
|
+
fs.mkdirSync(FIXTURE_DIR, { recursive: true });
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
afterEach(() => {
|
|
399
|
+
fs.rmSync(FIXTURE_DIR, { recursive: true, force: true });
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
const writeSkill = (relativeDir) => writeFixture(path.join(relativeDir, 'SKILL.md'), STANDARD_MD);
|
|
403
|
+
// A junction needs no elevation on Windows, which is what Skills Manager deploys;
|
|
404
|
+
// the type argument is ignored on POSIX.
|
|
405
|
+
const linkDirectory = (target, relativeLink) =>
|
|
406
|
+
fs.symlinkSync(target, path.join(FIXTURE_DIR, relativeLink), process.platform === 'win32' ? 'junction' : 'dir');
|
|
407
|
+
const foundRelative = () =>
|
|
408
|
+
walkSkillMdFiles(FIXTURE_DIR)
|
|
409
|
+
.map((found) => path.relative(FIXTURE_DIR, found).split(path.sep).join('/'))
|
|
410
|
+
.sort();
|
|
411
|
+
|
|
412
|
+
it('walks a skill deployed as a link inside the scanned root', () => {
|
|
413
|
+
writeSkill('real-skill');
|
|
414
|
+
fs.mkdirSync(path.join(FIXTURE_DIR, 'collection'), { recursive: true });
|
|
415
|
+
writeSkill(path.join('collection', 'nested-skill'));
|
|
416
|
+
linkDirectory(path.join(FIXTURE_DIR, 'real-skill'), 'linked-skill');
|
|
417
|
+
linkDirectory(path.join(FIXTURE_DIR, 'collection'), 'collection-link');
|
|
418
|
+
|
|
419
|
+
expect(foundRelative()).toEqual([
|
|
420
|
+
'collection-link/nested-skill/SKILL.md',
|
|
421
|
+
'collection/nested-skill/SKILL.md',
|
|
422
|
+
'linked-skill/SKILL.md',
|
|
423
|
+
'real-skill/SKILL.md',
|
|
424
|
+
]);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
it('ends on a link that points back into the scanned tree', () => {
|
|
428
|
+
fs.mkdirSync(path.join(FIXTURE_DIR, 'loopdir'), { recursive: true });
|
|
429
|
+
writeSkill('loopdir');
|
|
430
|
+
linkDirectory(FIXTURE_DIR, path.join('loopdir', 'back'));
|
|
431
|
+
|
|
432
|
+
expect(foundRelative()).toEqual(['loopdir/SKILL.md']);
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
it('skips a link whose target is gone and keeps the rest of the scan', () => {
|
|
436
|
+
writeSkill('real-skill');
|
|
437
|
+
fs.mkdirSync(path.join(FIXTURE_DIR, 'gone-skill'), { recursive: true });
|
|
438
|
+
linkDirectory(path.join(FIXTURE_DIR, 'gone-skill'), 'dangling-link');
|
|
439
|
+
fs.rmSync(path.join(FIXTURE_DIR, 'gone-skill'), { recursive: true, force: true });
|
|
440
|
+
|
|
441
|
+
expect(foundRelative()).toEqual(['real-skill/SKILL.md']);
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
it('follows a link nested below the top level of the scanned root', () => {
|
|
445
|
+
const outside = `${FIXTURE_DIR}-outside`;
|
|
446
|
+
fs.rmSync(outside, { recursive: true, force: true });
|
|
447
|
+
fs.mkdirSync(path.join(outside, 'deep-skill'), { recursive: true });
|
|
448
|
+
fs.writeFileSync(path.join(outside, 'deep-skill', 'SKILL.md'), STANDARD_MD);
|
|
449
|
+
fs.mkdirSync(path.join(FIXTURE_DIR, 'group'), { recursive: true });
|
|
450
|
+
try {
|
|
451
|
+
linkDirectory(path.join(outside, 'deep-skill'), path.join('group', 'linked'));
|
|
452
|
+
expect(foundRelative()).toEqual(['group/linked/SKILL.md']);
|
|
453
|
+
} finally {
|
|
454
|
+
fs.rmSync(outside, { recursive: true, force: true });
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
it('ends on a nested link loop between two directories', () => {
|
|
459
|
+
fs.mkdirSync(path.join(FIXTURE_DIR, 'a'), { recursive: true });
|
|
460
|
+
fs.mkdirSync(path.join(FIXTURE_DIR, 'b'), { recursive: true });
|
|
461
|
+
writeSkill('a');
|
|
462
|
+
linkDirectory(path.join(FIXTURE_DIR, 'b'), path.join('a', 'to-b'));
|
|
463
|
+
linkDirectory(path.join(FIXTURE_DIR, 'a'), path.join('b', 'to-a'));
|
|
464
|
+
|
|
465
|
+
expect(foundRelative()).toEqual(['a/SKILL.md', 'b/to-a/SKILL.md']);
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
|
|
@@ -38,6 +38,7 @@ export const createGracefulShutdownRuntime = (dependencies) => {
|
|
|
38
38
|
getDictationRuntime,
|
|
39
39
|
getRelayService,
|
|
40
40
|
getRelayReconcileTimer,
|
|
41
|
+
getSpacesHost = () => null,
|
|
41
42
|
} = dependencies;
|
|
42
43
|
|
|
43
44
|
let shutdownPromise = null;
|
|
@@ -74,6 +75,8 @@ export const createGracefulShutdownRuntime = (dependencies) => {
|
|
|
74
75
|
() => clearInterval(getRelayReconcileTimer()),
|
|
75
76
|
() => getGuestSurfaceRuntime()?.stop(),
|
|
76
77
|
() => getRealtimeProxyRuntime()?.stop(),
|
|
78
|
+
// The isolated-spaces host, when the switch is on: its connections into spaces end here.
|
|
79
|
+
() => getSpacesHost()?.close(),
|
|
77
80
|
() => getRelayService()?.stop(),
|
|
78
81
|
() => getDictationRuntime()?.stop(),
|
|
79
82
|
() => openCodeWatcherRuntime.stop(),
|
|
@@ -125,9 +125,12 @@ export const registerSkillRoutes = (app, dependencies) => {
|
|
|
125
125
|
return { scope: SKILL_SCOPE.USER, source };
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
+
// Returns null when OpenCode's list could not be read (not running, error,
|
|
129
|
+
// timeout, malformed payload) so callers can tell a failed fetch from a
|
|
130
|
+
// genuinely empty list.
|
|
128
131
|
const fetchOpenCodeDiscoveredSkills = async (workingDirectory) => {
|
|
129
132
|
if (!getOpenCodePort()) {
|
|
130
|
-
return
|
|
133
|
+
return null;
|
|
131
134
|
}
|
|
132
135
|
|
|
133
136
|
try {
|
|
@@ -145,13 +148,19 @@ export const registerSkillRoutes = (app, dependencies) => {
|
|
|
145
148
|
const response = await client.skill.list();
|
|
146
149
|
const payload = response?.data;
|
|
147
150
|
if (!Array.isArray(payload)) {
|
|
148
|
-
return
|
|
151
|
+
return null;
|
|
149
152
|
}
|
|
150
153
|
|
|
151
154
|
return payload
|
|
152
155
|
.map((item) => {
|
|
153
156
|
const name = typeof item?.name === 'string' ? item.name.trim() : '';
|
|
154
|
-
|
|
157
|
+
// OpenCode v1's skill payload used `location`; v2 renamed the field
|
|
158
|
+
// to `path`. Accept both, or the whole authoritative list is dropped
|
|
159
|
+
// and the panel falls back to the (smaller) local disk scan.
|
|
160
|
+
const rawLocation = typeof item?.path === 'string' ? item.path : (typeof item?.location === 'string' ? item.location : '');
|
|
161
|
+
// v1 marked built-in skills with `<built-in>`; v2 gives them a synthetic
|
|
162
|
+
// `/builtin/<id>.md` path. Normalize so they stay read-only in the panel.
|
|
163
|
+
const location = rawLocation.startsWith('/builtin/') ? '<built-in>' : rawLocation;
|
|
155
164
|
const description = typeof item?.description === 'string' ? item.description : '';
|
|
156
165
|
const content = typeof item?.content === 'string' ? item.content : '';
|
|
157
166
|
if (!name || !location) {
|
|
@@ -183,7 +192,7 @@ export const registerSkillRoutes = (app, dependencies) => {
|
|
|
183
192
|
.filter(Boolean);
|
|
184
193
|
} catch (error) {
|
|
185
194
|
console.error('Failed to list OpenCode skills:', error);
|
|
186
|
-
return
|
|
195
|
+
return null;
|
|
187
196
|
}
|
|
188
197
|
};
|
|
189
198
|
|
|
@@ -244,7 +253,7 @@ export const registerSkillRoutes = (app, dependencies) => {
|
|
|
244
253
|
}
|
|
245
254
|
const openCodeSkills = await fetchOpenCodeDiscoveredSkills(directory);
|
|
246
255
|
const localSkills = discoverSkills(directory);
|
|
247
|
-
const skills = mergeDiscoveredSkills(openCodeSkills, localSkills);
|
|
256
|
+
const skills = mergeDiscoveredSkills(openCodeSkills ?? [], localSkills);
|
|
248
257
|
|
|
249
258
|
const enrichedSkills = skills.map((skill) => {
|
|
250
259
|
const sources = getSkillSources(skill.name, directory, skill);
|
|
@@ -268,7 +277,7 @@ export const registerSkillRoutes = (app, dependencies) => {
|
|
|
268
277
|
// OpenCode's own skill-list endpoint is not usable for this: on 1.18.14
|
|
269
278
|
// it returns only global and builtin skills, omitting the project
|
|
270
279
|
// `.agents`/`.claude` skills the agent demonstrably has.
|
|
271
|
-
|
|
280
|
+
const body = {
|
|
272
281
|
skills: enrichedSkills,
|
|
273
282
|
externalSkills: {
|
|
274
283
|
// `OPENCODE_DISABLE_CLAUDE_CODE` is the broad switch; the specific
|
|
@@ -277,7 +286,14 @@ export const registerSkillRoutes = (app, dependencies) => {
|
|
|
277
286
|
|| isEnvFlagEnabled(process.env.OPENCODE_DISABLE_CLAUDE_CODE_SKILLS),
|
|
278
287
|
allDisabled: isEnvFlagEnabled(process.env.OPENCODE_DISABLE_EXTERNAL_SKILLS),
|
|
279
288
|
},
|
|
280
|
-
}
|
|
289
|
+
};
|
|
290
|
+
// The list is only the disk scan when OpenCode's own list failed:
|
|
291
|
+
// built-in skills and anything OpenCode finds only through its config
|
|
292
|
+
// are missing, so the client must not treat this as complete.
|
|
293
|
+
if (openCodeSkills === null) {
|
|
294
|
+
body.openCodeSkillsUnavailable = true;
|
|
295
|
+
}
|
|
296
|
+
res.json(body);
|
|
281
297
|
} catch (error) {
|
|
282
298
|
console.error('Failed to list skills:', error);
|
|
283
299
|
res.status(500).json({ error: 'Failed to list skills' });
|
|
@@ -366,7 +382,7 @@ export const registerSkillRoutes = (app, dependencies) => {
|
|
|
366
382
|
}
|
|
367
383
|
|
|
368
384
|
const resolvedDiscovered = mergeDiscoveredSkills(
|
|
369
|
-
await fetchOpenCodeDiscoveredSkills(directory),
|
|
385
|
+
(await fetchOpenCodeDiscoveredSkills(directory)) ?? [],
|
|
370
386
|
discoverSkills(directory),
|
|
371
387
|
);
|
|
372
388
|
const installedByName = new Map(resolvedDiscovered.map((s) => [s.name, s]));
|
|
@@ -538,7 +554,7 @@ export const registerSkillRoutes = (app, dependencies) => {
|
|
|
538
554
|
if (error) {
|
|
539
555
|
return res.status(400).json({ error });
|
|
540
556
|
}
|
|
541
|
-
const discoveredSkill = (await fetchOpenCodeDiscoveredSkills(directory))
|
|
557
|
+
const discoveredSkill = ((await fetchOpenCodeDiscoveredSkills(directory)) ?? [])
|
|
542
558
|
.find((skill) => skill.name === skillName) || null;
|
|
543
559
|
const sources = getSkillSources(skillName, directory, discoveredSkill);
|
|
544
560
|
|
|
@@ -567,7 +583,7 @@ export const registerSkillRoutes = (app, dependencies) => {
|
|
|
567
583
|
return res.status(400).json({ error });
|
|
568
584
|
}
|
|
569
585
|
|
|
570
|
-
const discoveredSkill = (await fetchOpenCodeDiscoveredSkills(directory))
|
|
586
|
+
const discoveredSkill = ((await fetchOpenCodeDiscoveredSkills(directory)) ?? [])
|
|
571
587
|
.find((skill) => skill.name === skillName) || null;
|
|
572
588
|
const sources = getSkillSources(skillName, directory, discoveredSkill);
|
|
573
589
|
if (!sources.md.exists || !sources.md.dir) {
|
|
@@ -661,7 +677,7 @@ export const registerSkillRoutes = (app, dependencies) => {
|
|
|
661
677
|
return res.status(400).json({ error });
|
|
662
678
|
}
|
|
663
679
|
|
|
664
|
-
const discoveredSkill = (await fetchOpenCodeDiscoveredSkills(directory))
|
|
680
|
+
const discoveredSkill = ((await fetchOpenCodeDiscoveredSkills(directory)) ?? [])
|
|
665
681
|
.find((skill) => skill.name === skillName) || null;
|
|
666
682
|
const sources = getSkillSources(skillName, directory, discoveredSkill);
|
|
667
683
|
if (!sources.md.exists || !sources.md.dir) {
|
|
@@ -695,7 +711,7 @@ export const registerSkillRoutes = (app, dependencies) => {
|
|
|
695
711
|
return res.status(400).json({ error });
|
|
696
712
|
}
|
|
697
713
|
|
|
698
|
-
const discoveredSkill = (await fetchOpenCodeDiscoveredSkills(directory))
|
|
714
|
+
const discoveredSkill = ((await fetchOpenCodeDiscoveredSkills(directory)) ?? [])
|
|
699
715
|
.find((skill) => skill.name === skillName) || null;
|
|
700
716
|
const sources = getSkillSources(skillName, directory, discoveredSkill);
|
|
701
717
|
if (!sources.md.exists || !sources.md.dir) {
|
|
@@ -28,7 +28,7 @@ const createTempProject = () => {
|
|
|
28
28
|
return projectRoot;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
const startSkillsApp = ({ projectRoot }) => {
|
|
31
|
+
const startSkillsApp = ({ projectRoot, overrides = {} }) => {
|
|
32
32
|
const app = express();
|
|
33
33
|
app.use(express.json());
|
|
34
34
|
|
|
@@ -76,6 +76,7 @@ const startSkillsApp = ({ projectRoot }) => {
|
|
|
76
76
|
fetchGitHubRepoMetas: async () => ({}),
|
|
77
77
|
getProfiles: () => [],
|
|
78
78
|
getProfile: () => null,
|
|
79
|
+
...overrides,
|
|
79
80
|
});
|
|
80
81
|
|
|
81
82
|
const server = app.listen(0);
|
|
@@ -213,4 +214,123 @@ describe('skill-routes directory soft fallback', () => {
|
|
|
213
214
|
});
|
|
214
215
|
}
|
|
215
216
|
});
|
|
217
|
+
|
|
218
|
+
it('lists OpenCode skills reported with the v2 `path` field and keeps the v1 `location` fallback', async () => {
|
|
219
|
+
projectRoot = createTempProject();
|
|
220
|
+
|
|
221
|
+
// OpenCode v2's skill payload renamed `location` to `path`. The route maps
|
|
222
|
+
// the fetch result to { name, path, ... }; with the old field only, the
|
|
223
|
+
// whole authoritative list was dropped and the panel fell back to the
|
|
224
|
+
// smaller local disk scan. Serve a v2-style payload from a stub.
|
|
225
|
+
const stub = express();
|
|
226
|
+
stub.get('/api/skill', (_req, res) => {
|
|
227
|
+
res.json({
|
|
228
|
+
location: { directory: projectRoot },
|
|
229
|
+
data: [
|
|
230
|
+
{
|
|
231
|
+
id: 'v2-path-skill',
|
|
232
|
+
name: 'v2-path-skill',
|
|
233
|
+
path: path.join(projectRoot, '.agents', 'skills', 'v2-path-skill'),
|
|
234
|
+
description: 'Delivered with the v2 path field',
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
id: 'v1-location-skill',
|
|
238
|
+
name: 'v1-location-skill',
|
|
239
|
+
location: path.join(projectRoot, '.agents', 'skills', 'v1-location-skill'),
|
|
240
|
+
description: 'Delivered with the legacy location field',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
id: 'opencode',
|
|
244
|
+
name: 'OpenCode',
|
|
245
|
+
path: '/builtin/opencode.md',
|
|
246
|
+
description: 'v2 built-in skill with a synthetic path',
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
id: 'unlocated-skill',
|
|
250
|
+
name: 'unlocated-skill',
|
|
251
|
+
description: 'Has neither field; must be dropped',
|
|
252
|
+
},
|
|
253
|
+
],
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
const stubServer = await new Promise((resolve) => {
|
|
257
|
+
const server = stub.listen(0, () => resolve(server));
|
|
258
|
+
});
|
|
259
|
+
const stubPort = stubServer.address().port;
|
|
260
|
+
|
|
261
|
+
try {
|
|
262
|
+
appHandle = startSkillsApp({
|
|
263
|
+
projectRoot,
|
|
264
|
+
overrides: {
|
|
265
|
+
buildOpenCodeUrl: () => `http://127.0.0.1:${stubPort}/`,
|
|
266
|
+
getOpenCodePort: () => stubPort,
|
|
267
|
+
getOpenCodeAuthHeaders: () => ({}),
|
|
268
|
+
},
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
const listResponse = await fetch(
|
|
272
|
+
`${appHandle.baseUrl}/api/config/skills?directory=${encodeURIComponent(projectRoot)}`,
|
|
273
|
+
);
|
|
274
|
+
expect(listResponse.status).toBe(200);
|
|
275
|
+
const payload = await listResponse.json();
|
|
276
|
+
const byName = new Map(payload.skills.map((skill) => [skill.name, skill]));
|
|
277
|
+
|
|
278
|
+
expect(byName.has('v2-path-skill')).toBe(true);
|
|
279
|
+
expect(byName.get('v2-path-skill').path).toContain('v2-path-skill');
|
|
280
|
+
|
|
281
|
+
expect(byName.has('v1-location-skill')).toBe(true);
|
|
282
|
+
expect(byName.get('v1-location-skill').path).toContain('v1-location-skill');
|
|
283
|
+
|
|
284
|
+
expect(byName.get('OpenCode')?.path).toBe('<built-in>');
|
|
285
|
+
expect(byName.get('OpenCode')?.renamable).toBe(false);
|
|
286
|
+
|
|
287
|
+
expect(byName.has('unlocated-skill')).toBe(false);
|
|
288
|
+
} finally {
|
|
289
|
+
stubServer.close();
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
it('flags the list as partial when OpenCode skill list fails, and not when it succeeds', async () => {
|
|
293
|
+
projectRoot = createTempProject();
|
|
294
|
+
fs.mkdirSync(path.join(projectRoot, '.agents', 'skills', 'disk-skill'), { recursive: true });
|
|
295
|
+
fs.writeFileSync(
|
|
296
|
+
path.join(projectRoot, '.agents', 'skills', 'disk-skill', 'SKILL.md'),
|
|
297
|
+
'---\nname: disk-skill\ndescription: On disk\n---\nBody\n',
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
let failing = true;
|
|
301
|
+
const stub = express();
|
|
302
|
+
stub.get('/api/skill', (_req, res) => {
|
|
303
|
+
if (failing) {
|
|
304
|
+
res.status(500).json({ error: 'boom' });
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
res.json({ data: [] });
|
|
308
|
+
});
|
|
309
|
+
const stubServer = await new Promise((resolve) => {
|
|
310
|
+
const server = stub.listen(0, () => resolve(server));
|
|
311
|
+
});
|
|
312
|
+
const stubPort = stubServer.address().port;
|
|
313
|
+
|
|
314
|
+
try {
|
|
315
|
+
appHandle = startSkillsApp({
|
|
316
|
+
projectRoot,
|
|
317
|
+
overrides: {
|
|
318
|
+
buildOpenCodeUrl: () => `http://127.0.0.1:${stubPort}/`,
|
|
319
|
+
getOpenCodePort: () => stubPort,
|
|
320
|
+
},
|
|
321
|
+
});
|
|
322
|
+
const url = `${appHandle.baseUrl}/api/config/skills?directory=${encodeURIComponent(projectRoot)}`;
|
|
323
|
+
|
|
324
|
+
const failed = await (await fetch(url)).json();
|
|
325
|
+
expect(failed.openCodeSkillsUnavailable).toBe(true);
|
|
326
|
+
expect(failed.skills.map((skill) => skill.name)).toContain('disk-skill');
|
|
327
|
+
|
|
328
|
+
failing = false;
|
|
329
|
+
const complete = await (await fetch(url)).json();
|
|
330
|
+
expect(complete.openCodeSkillsUnavailable).toBeUndefined();
|
|
331
|
+
expect(complete.skills.map((skill) => skill.name)).toContain('disk-skill');
|
|
332
|
+
} finally {
|
|
333
|
+
stubServer.close();
|
|
334
|
+
}
|
|
335
|
+
});
|
|
216
336
|
});
|
|
@@ -1,23 +1,9 @@
|
|
|
1
|
-
// TEMPORARY WORKAROUND — Windows ARM64: native opencode.exe fails with a Bun
|
|
2
|
-
// FFI/TinyCC dlopen error (https://github.com/anomalyco/opencode/issues/19130).
|
|
3
|
-
// Disable OpenCode self-upgrade on ARM64 so it can't overwrite the working x64
|
|
4
|
-
// binary with the broken ARM64 build. Remove when the upstream issue is resolved.
|
|
5
|
-
const isWindowsArm64 = () => process.platform === 'win32' && process.arch === 'arm64';
|
|
6
|
-
|
|
7
1
|
export const resolveOpenCodeUpgradeCapability = ({
|
|
8
2
|
isExternal,
|
|
9
3
|
hasManagedProcess,
|
|
10
4
|
activeBinary,
|
|
11
5
|
isBundledBinary,
|
|
12
6
|
}) => {
|
|
13
|
-
if (isWindowsArm64()) {
|
|
14
|
-
return {
|
|
15
|
-
supported: false,
|
|
16
|
-
manager: 'openchamber',
|
|
17
|
-
reason: 'windows-arm64-workaround',
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
|
|
21
7
|
if (isExternal) {
|
|
22
8
|
return {
|
|
23
9
|
supported: false,
|
|
@@ -21,14 +21,16 @@
|
|
|
21
21
|
* seen v2 activity. Every visited session gets its `session_message` rows
|
|
22
22
|
* deleted and replaced by the V1 transform, so a migrated session that was
|
|
23
23
|
* continued in v2 would lose that conversation.
|
|
24
|
-
* 3.
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
24
|
+
* 3. Only 1.x activity since the last completed import triggers a new one.
|
|
25
|
+
* A v2 delete removes the `session_v2` row but leaves the legacy `session`
|
|
26
|
+
* row behind, so "missing from v2" alone would bring deleted sessions back
|
|
27
|
+
* on every start. A legacy session counts as missing only when its
|
|
28
|
+
* `time_updated` is newer than the completion stamp OpenCode writes on
|
|
29
|
+
* `migration.v1-v2`: only OpenCode 1.x writes that table, so an unchanged
|
|
30
|
+
* table means nobody ran 1.x since and the top-up skips. Decided by the
|
|
31
|
+
* maintainer (2026-09-24). When 1.x was used again, OpenCode still walks
|
|
32
|
+
* every id below the cursor, so a deleted session sorting below a fresh one
|
|
33
|
+
* comes back with it; that needs an import route taking an explicit list.
|
|
32
34
|
*
|
|
33
35
|
* The loop OpenCode runs is `SELECT id FROM session WHERE id < cursor ORDER BY
|
|
34
36
|
* id DESC LIMIT 1`, one session at a time, so the cursor has to be strictly
|
|
@@ -196,11 +198,15 @@ const findRevisitedSessionsWithV2Activity = (db, cursor, completedAt) =>
|
|
|
196
198
|
return parsed.success ? [parsed.data.id] : [];
|
|
197
199
|
});
|
|
198
200
|
|
|
199
|
-
/**
|
|
200
|
-
|
|
201
|
+
/**
|
|
202
|
+
* A legacy session with no `session_v2` twin that 1.x touched after the last
|
|
203
|
+
* completed import (see rule 3). Bound parameter: the completion timestamp.
|
|
204
|
+
*/
|
|
205
|
+
const MISSING_CONDITION = 'id NOT IN (SELECT id FROM session_v2) AND time_updated > ?';
|
|
201
206
|
|
|
202
|
-
const countMissingSessions = (db) =>
|
|
203
|
-
firstRow(countRowSchema, db.all(`SELECT COUNT(*) AS value FROM session WHERE ${MISSING_CONDITION}
|
|
207
|
+
const countMissingSessions = (db, completedAt) =>
|
|
208
|
+
firstRow(countRowSchema, db.all(`SELECT COUNT(*) AS value FROM session WHERE ${MISSING_CONDITION}`, [completedAt]))
|
|
209
|
+
?.value ?? 0;
|
|
204
210
|
|
|
205
211
|
const countRevisitedSessions = (db, cursor) =>
|
|
206
212
|
firstRow(
|
|
@@ -244,12 +250,12 @@ export const topUpV1Migration = (options = {}) => {
|
|
|
244
250
|
const migration = readCompletedMigration(db);
|
|
245
251
|
if (!migration) return outcome('skipped', 'migration-not-completed');
|
|
246
252
|
|
|
247
|
-
const missingCount = countMissingSessions(db);
|
|
253
|
+
const missingCount = countMissingSessions(db, migration.completedAt);
|
|
248
254
|
if (missingCount === 0) return outcome('skipped', 'nothing-missing');
|
|
249
255
|
|
|
250
256
|
const maxMissing = firstRow(
|
|
251
257
|
nullableIdRowSchema,
|
|
252
|
-
db.all(`SELECT MAX(id) AS id FROM session WHERE ${MISSING_CONDITION}
|
|
258
|
+
db.all(`SELECT MAX(id) AS id FROM session WHERE ${MISSING_CONDITION}`, [migration.completedAt]),
|
|
253
259
|
)?.id;
|
|
254
260
|
if (!maxMissing) return outcome('skipped', 'nothing-missing');
|
|
255
261
|
|
|
@@ -271,7 +277,7 @@ export const topUpV1Migration = (options = {}) => {
|
|
|
271
277
|
MIGRATION_STATE_KEY,
|
|
272
278
|
]);
|
|
273
279
|
logger.log(
|
|
274
|
-
`[OpenCode] Scheduled the import of ${missingCount} OpenCode 1.x session(s)
|
|
280
|
+
`[OpenCode] Scheduled the import of ${missingCount} OpenCode 1.x session(s) changed since the last v2 import; ` +
|
|
275
281
|
`OpenCode will re-import ${revisitedCount} untouched session(s) on the way.`,
|
|
276
282
|
);
|
|
277
283
|
return outcome('scheduled', undefined, missingCount, revisitedCount);
|