@jingyi0605/codingns4dsh 0.2.1-beta.4 → 0.2.1-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +134 -159
- package/README.md +128 -261
- package/assets/provider-icons/doubao.png +0 -0
- package/data/build/dist/client/account-bar.d.ts +1 -1
- package/data/build/dist/client/account-bar.d.ts.map +1 -1
- package/data/build/dist/client/account-bar.js +22 -14
- package/data/build/dist/client/account-bar.js.map +1 -1
- package/data/build/dist/client/adapter-catalog-watch.d.ts +8 -0
- package/data/build/dist/client/adapter-catalog-watch.d.ts.map +1 -0
- package/data/build/dist/client/adapter-catalog-watch.js +79 -0
- package/data/build/dist/client/adapter-catalog-watch.js.map +1 -0
- package/data/build/dist/client/avatar/catalog-panel.d.ts +1 -1
- package/data/build/dist/client/avatar/catalog-panel.d.ts.map +1 -1
- package/data/build/dist/client/avatar/catalog-panel.js +13 -11
- package/data/build/dist/client/avatar/catalog-panel.js.map +1 -1
- package/data/build/dist/client/avatar/engine.d.ts.map +1 -1
- package/data/build/dist/client/avatar/engine.js +26 -7
- package/data/build/dist/client/avatar/engine.js.map +1 -1
- package/data/build/dist/client/avatar/live2d.d.ts +2 -0
- package/data/build/dist/client/avatar/live2d.d.ts.map +1 -1
- package/data/build/dist/client/avatar/live2d.js +16 -6
- package/data/build/dist/client/avatar/live2d.js.map +1 -1
- package/data/build/dist/client/avatar/manager.d.ts.map +1 -1
- package/data/build/dist/client/avatar/manager.js +8 -2
- package/data/build/dist/client/avatar/manager.js.map +1 -1
- package/data/build/dist/client/avatar/slot.d.ts.map +1 -1
- package/data/build/dist/client/avatar/slot.js +4 -1
- package/data/build/dist/client/avatar/slot.js.map +1 -1
- package/data/build/dist/client/bundle.js +48459 -98385
- package/data/build/dist/client/bundle.js.map +1 -1
- package/data/build/dist/client/cli-catalog.d.ts +5 -0
- package/data/build/dist/client/cli-catalog.d.ts.map +1 -1
- package/data/build/dist/client/cli-catalog.js +15 -0
- package/data/build/dist/client/cli-catalog.js.map +1 -1
- package/data/build/dist/client/cli-slots.d.ts.map +1 -1
- package/data/build/dist/client/cli-slots.js +7 -45
- package/data/build/dist/client/cli-slots.js.map +1 -1
- package/data/build/dist/client/client.assistant-configuration-view.js +4526 -0
- package/data/build/dist/client/client.assistant-configuration-view.js.map +1 -0
- package/data/build/dist/client/client.assistant-debug-workbench.js +764 -0
- package/data/build/dist/client/client.assistant-debug-workbench.js.map +1 -0
- package/data/build/dist/client/client.assistant-prompt-editor.js +76 -0
- package/data/build/dist/client/client.assistant-prompt-editor.js.map +1 -0
- package/data/build/dist/client/client.assistant-prompts.js +44 -0
- package/data/build/dist/client/client.assistant-prompts.js.map +1 -0
- package/data/build/dist/client/client.assistant-voice-sessions.js +144 -0
- package/data/build/dist/client/client.assistant-voice-sessions.js.map +1 -0
- package/data/build/dist/client/client.assistant-workbench.js +2929 -0
- package/data/build/dist/client/client.assistant-workbench.js.map +1 -0
- package/data/build/dist/client/client.delegate-command.js +1315 -0
- package/data/build/dist/client/client.delegate-command.js.map +1 -0
- package/data/build/dist/client/client.editor-engine.js +32486 -0
- package/data/build/dist/client/client.editor-engine.js.map +1 -0
- package/data/build/dist/client/client.manager.js +3454 -0
- package/data/build/dist/client/client.manager.js.map +1 -0
- package/data/build/dist/client/client.model-catalog-cache.js +543 -0
- package/data/build/dist/client/client.model-catalog-cache.js.map +1 -0
- package/data/build/dist/client/client.native-workspace-store.js +689 -0
- package/data/build/dist/client/client.native-workspace-store.js.map +1 -0
- package/data/build/dist/client/client.primitives-adapter.js +333 -0
- package/data/build/dist/client/client.primitives-adapter.js.map +1 -0
- package/data/build/dist/client/client.react-dom.js +7286 -0
- package/data/build/dist/client/client.react-dom.js.map +1 -0
- package/data/build/dist/client/client.rolldown-runtime.js +59 -0
- package/data/build/dist/client/client.theme.js +386 -0
- package/data/build/dist/client/client.theme.js.map +1 -0
- package/data/build/dist/client/client.transport.js +3323 -0
- package/data/build/dist/client/client.transport.js.map +1 -0
- package/data/build/dist/client/client.xterm-engine.js +13064 -0
- package/data/build/dist/client/client.xterm-engine.js.map +1 -0
- package/data/build/dist/client/debug/ui.d.ts.map +1 -1
- package/data/build/dist/client/debug/ui.js +14 -5
- package/data/build/dist/client/debug/ui.js.map +1 -1
- package/data/build/dist/client/desktop-assistant.js +19 -5
- package/data/build/dist/client/editor-engine.d.ts +4 -0
- package/data/build/dist/client/editor-engine.d.ts.map +1 -0
- package/data/build/dist/client/editor-engine.js +50 -0
- package/data/build/dist/client/editor-engine.js.map +1 -0
- package/data/build/dist/client/engine-loader.d.ts +5 -0
- package/data/build/dist/client/engine-loader.d.ts.map +1 -0
- package/data/build/dist/client/engine-loader.js +35 -0
- package/data/build/dist/client/engine-loader.js.map +1 -0
- package/data/build/dist/client/features/assistant-configuration-loader.d.ts +14 -0
- package/data/build/dist/client/features/assistant-configuration-loader.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-configuration-loader.js +13 -0
- package/data/build/dist/client/features/assistant-configuration-loader.js.map +1 -0
- package/data/build/dist/client/features/assistant-configuration-session.d.ts.map +1 -1
- package/data/build/dist/client/features/assistant-configuration-session.js +13 -4
- package/data/build/dist/client/features/assistant-configuration-session.js.map +1 -1
- package/data/build/dist/client/features/assistant-configuration-view.d.ts +66 -0
- package/data/build/dist/client/features/assistant-configuration-view.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-configuration-view.js +133 -0
- package/data/build/dist/client/features/assistant-configuration-view.js.map +1 -0
- package/data/build/dist/client/features/assistant-debug-workbench.d.ts +4 -11
- package/data/build/dist/client/features/assistant-debug-workbench.d.ts.map +1 -1
- package/data/build/dist/client/features/assistant-debug-workbench.js +41 -68
- package/data/build/dist/client/features/assistant-debug-workbench.js.map +1 -1
- package/data/build/dist/client/features/assistant-display-store.d.ts +57 -0
- package/data/build/dist/client/features/assistant-display-store.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-display-store.js +189 -0
- package/data/build/dist/client/features/assistant-display-store.js.map +1 -0
- package/data/build/dist/client/features/assistant-prompt-editor.d.ts +12 -0
- package/data/build/dist/client/features/assistant-prompt-editor.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-prompt-editor.js +14 -0
- package/data/build/dist/client/features/assistant-prompt-editor.js.map +1 -0
- package/data/build/dist/client/features/assistant-view-loader.d.ts +17 -0
- package/data/build/dist/client/features/assistant-view-loader.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-view-loader.js +49 -0
- package/data/build/dist/client/features/assistant-view-loader.js.map +1 -0
- package/data/build/dist/client/features/assistant-workbench.d.ts +1 -60
- package/data/build/dist/client/features/assistant-workbench.d.ts.map +1 -1
- package/data/build/dist/client/features/assistant-workbench.js +41 -169
- package/data/build/dist/client/features/assistant-workbench.js.map +1 -1
- package/data/build/dist/client/features/cli-adapters.d.ts.map +1 -1
- package/data/build/dist/client/features/cli-adapters.js +44 -13
- package/data/build/dist/client/features/cli-adapters.js.map +1 -1
- package/data/build/dist/client/features/global-voice-assistant.d.ts.map +1 -1
- package/data/build/dist/client/features/global-voice-assistant.js +33 -27
- package/data/build/dist/client/features/global-voice-assistant.js.map +1 -1
- package/data/build/dist/client/features/peer-host.d.ts +2 -1
- package/data/build/dist/client/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/client/features/peer-host.js +124 -58
- package/data/build/dist/client/features/peer-host.js.map +1 -1
- package/data/build/dist/client/features/workspace-session-enhancement.d.ts.map +1 -1
- package/data/build/dist/client/features/workspace-session-enhancement.js +37 -10
- package/data/build/dist/client/features/workspace-session-enhancement.js.map +1 -1
- package/data/build/dist/client/file-management-dom.d.ts +3 -1
- package/data/build/dist/client/file-management-dom.d.ts.map +1 -1
- package/data/build/dist/client/file-management-dom.js +85 -79
- package/data/build/dist/client/file-management-dom.js.map +1 -1
- package/data/build/dist/client/git-management.d.ts +1 -1
- package/data/build/dist/client/git-management.d.ts.map +1 -1
- package/data/build/dist/client/git-management.js +46 -27
- package/data/build/dist/client/git-management.js.map +1 -1
- package/data/build/dist/client/locale.d.ts.map +1 -1
- package/data/build/dist/client/locale.js +10 -0
- package/data/build/dist/client/locale.js.map +1 -1
- package/data/build/dist/client/locales/assistantAvatar.d.ts +1 -1
- package/data/build/dist/client/locales/assistantAvatar.js +2 -2
- package/data/build/dist/client/locales/assistantAvatar.js.map +1 -1
- package/data/build/dist/client/locales/fileWorkspace.d.ts.map +1 -1
- package/data/build/dist/client/locales/fileWorkspace.js +2 -0
- package/data/build/dist/client/locales/fileWorkspace.js.map +1 -1
- package/data/build/dist/client/locales/peerHost.d.ts.map +1 -1
- package/data/build/dist/client/locales/peerHost.js +4 -0
- package/data/build/dist/client/locales/peerHost.js.map +1 -1
- package/data/build/dist/client/locales/peerHostWorkspace.js +2 -2
- package/data/build/dist/client/locales/peerHostWorkspace.js.map +1 -1
- package/data/build/dist/client/locales/usage.d.ts.map +1 -1
- package/data/build/dist/client/locales/usage.js +4 -0
- package/data/build/dist/client/locales/usage.js.map +1 -1
- package/data/build/dist/client/model-catalog-cache.d.ts.map +1 -1
- package/data/build/dist/client/model-catalog-cache.js +9 -2
- package/data/build/dist/client/model-catalog-cache.js.map +1 -1
- package/data/build/dist/client/peer-host-management-api.d.ts +2 -2
- package/data/build/dist/client/peer-host-management-api.d.ts.map +1 -1
- package/data/build/dist/client/peer-host-management-api.js +8 -5
- package/data/build/dist/client/peer-host-management-api.js.map +1 -1
- package/data/build/dist/client/provider-icon-assets.js +5 -39
- package/data/build/dist/client/provider-icon-assets.js.map +1 -1
- package/data/build/dist/client/provider-icon-bridge.d.ts +6 -0
- package/data/build/dist/client/provider-icon-bridge.d.ts.map +1 -0
- package/data/build/dist/client/provider-icon-bridge.js +65 -0
- package/data/build/dist/client/provider-icon-bridge.js.map +1 -0
- package/data/build/dist/client/provider-icons.d.ts +1 -0
- package/data/build/dist/client/provider-icons.d.ts.map +1 -1
- package/data/build/dist/client/provider-icons.js +2 -1
- package/data/build/dist/client/provider-icons.js.map +1 -1
- package/data/build/dist/client/remote-web-context.d.ts +2 -0
- package/data/build/dist/client/remote-web-context.d.ts.map +1 -1
- package/data/build/dist/client/remote-web-context.js +50 -2
- package/data/build/dist/client/remote-web-context.js.map +1 -1
- package/data/build/dist/client/rpc-call.d.ts +4 -0
- package/data/build/dist/client/rpc-call.d.ts.map +1 -0
- package/data/build/dist/client/rpc-call.js +23 -0
- package/data/build/dist/client/rpc-call.js.map +1 -0
- package/data/build/dist/client/serial-polling.d.ts +15 -0
- package/data/build/dist/client/serial-polling.d.ts.map +1 -0
- package/data/build/dist/client/serial-polling.js +48 -0
- package/data/build/dist/client/serial-polling.js.map +1 -0
- package/data/build/dist/client/session-adapter-cache.d.ts.map +1 -1
- package/data/build/dist/client/session-adapter-cache.js +11 -1
- package/data/build/dist/client/session-adapter-cache.js.map +1 -1
- package/data/build/dist/client/settings-section.js +8 -2
- package/data/build/dist/client/settings-section.js.map +1 -1
- package/data/build/dist/client/sherpa-voice-adapter.d.ts.map +1 -1
- package/data/build/dist/client/sherpa-voice-adapter.js +8 -8
- package/data/build/dist/client/sherpa-voice-adapter.js.map +1 -1
- package/data/build/dist/client/subscription-slot.d.ts +11 -0
- package/data/build/dist/client/subscription-slot.d.ts.map +1 -1
- package/data/build/dist/client/subscription-slot.js +42 -15
- package/data/build/dist/client/subscription-slot.js.map +1 -1
- package/data/build/dist/client/terminal/xterm-engine.d.ts +4 -0
- package/data/build/dist/client/terminal/xterm-engine.d.ts.map +1 -0
- package/data/build/dist/client/terminal/xterm-engine.js +5 -0
- package/data/build/dist/client/terminal/xterm-engine.js.map +1 -0
- package/data/build/dist/client/terminal/xterm-view.d.ts.map +1 -1
- package/data/build/dist/client/terminal/xterm-view.js +33 -25
- package/data/build/dist/client/terminal/xterm-view.js.map +1 -1
- package/data/build/dist/host/avatar/temporary-previews.d.ts +3 -1
- package/data/build/dist/host/avatar/temporary-previews.d.ts.map +1 -1
- package/data/build/dist/host/avatar/temporary-previews.js +7 -2
- package/data/build/dist/host/avatar/temporary-previews.js.map +1 -1
- package/data/build/dist/host/cli-adapters/acp-cli-driver.d.ts +1 -1
- package/data/build/dist/host/cli-adapters/acp-cli-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/acp-cli-driver.js +3 -10
- package/data/build/dist/host/cli-adapters/acp-cli-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/antigravity-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/antigravity-driver.js +2 -2
- package/data/build/dist/host/cli-adapters/antigravity-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/antigravity-subscription.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/antigravity-subscription.js +10 -10
- package/data/build/dist/host/cli-adapters/antigravity-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/binary-detection.d.ts +19 -0
- package/data/build/dist/host/cli-adapters/binary-detection.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/binary-detection.js +71 -0
- package/data/build/dist/host/cli-adapters/binary-detection.js.map +1 -0
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts +2 -0
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-driver.js +11 -5
- package/data/build/dist/host/cli-adapters/claude-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-model-options.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-model-options.js +2 -1
- package/data/build/dist/host/cli-adapters/claude-model-options.js.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-process.d.ts +7 -0
- package/data/build/dist/host/cli-adapters/claude-process.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/claude-process.js +59 -0
- package/data/build/dist/host/cli-adapters/claude-process.js.map +1 -0
- package/data/build/dist/host/cli-adapters/codebuddy-driver.d.ts +3 -0
- package/data/build/dist/host/cli-adapters/codebuddy-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/codebuddy-driver.js +26 -12
- package/data/build/dist/host/cli-adapters/codebuddy-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-driver.d.ts +0 -1
- package/data/build/dist/host/cli-adapters/command-code-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-driver.js +10 -32
- package/data/build/dist/host/cli-adapters/command-code-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/cursor-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/cursor-driver.js +4 -3
- package/data/build/dist/host/cli-adapters/cursor-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/delegate-dispatch.js +1 -1
- package/data/build/dist/host/cli-adapters/delegate-dispatch.js.map +1 -1
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.d.ts +2 -0
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.js +5 -0
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.js.map +1 -1
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.js +2 -4
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.js.map +1 -1
- package/data/build/dist/host/cli-adapters/doubao-app.d.ts +27 -0
- package/data/build/dist/host/cli-adapters/doubao-app.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-app.js +110 -0
- package/data/build/dist/host/cli-adapters/doubao-app.js.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-artifact-store.d.ts +16 -0
- package/data/build/dist/host/cli-adapters/doubao-artifact-store.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-artifact-store.js +142 -0
- package/data/build/dist/host/cli-adapters/doubao-artifact-store.js.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-artifacts.d.ts +16 -0
- package/data/build/dist/host/cli-adapters/doubao-artifacts.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-artifacts.js +34 -0
- package/data/build/dist/host/cli-adapters/doubao-artifacts.js.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-cdp.d.ts +49 -0
- package/data/build/dist/host/cli-adapters/doubao-cdp.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-cdp.js +177 -0
- package/data/build/dist/host/cli-adapters/doubao-cdp.js.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-driver.d.ts +33 -0
- package/data/build/dist/host/cli-adapters/doubao-driver.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-driver.js +291 -0
- package/data/build/dist/host/cli-adapters/doubao-driver.js.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-events.d.ts +21 -0
- package/data/build/dist/host/cli-adapters/doubao-events.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-events.js +126 -0
- package/data/build/dist/host/cli-adapters/doubao-events.js.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-runtime.d.ts +6 -0
- package/data/build/dist/host/cli-adapters/doubao-runtime.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-runtime.js +176 -0
- package/data/build/dist/host/cli-adapters/doubao-runtime.js.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-tools.d.ts +8 -0
- package/data/build/dist/host/cli-adapters/doubao-tools.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/doubao-tools.js +139 -0
- package/data/build/dist/host/cli-adapters/doubao-tools.js.map +1 -0
- package/data/build/dist/host/cli-adapters/driver.d.ts +4 -3
- package/data/build/dist/host/cli-adapters/driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/feature.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/feature.js +30 -36
- package/data/build/dist/host/cli-adapters/feature.js.map +1 -1
- package/data/build/dist/host/cli-adapters/grok-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/grok-driver.js +2 -1
- package/data/build/dist/host/cli-adapters/grok-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/json-rpc-process.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/json-rpc-process.js +3 -1
- package/data/build/dist/host/cli-adapters/json-rpc-process.js.map +1 -1
- package/data/build/dist/host/cli-adapters/kimi-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/kimi-driver.js +4 -3
- package/data/build/dist/host/cli-adapters/kimi-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.d.ts +2 -0
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.js +11 -0
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.js.map +1 -1
- package/data/build/dist/host/cli-adapters/log-files.d.ts +3 -0
- package/data/build/dist/host/cli-adapters/log-files.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/log-files.js +32 -0
- package/data/build/dist/host/cli-adapters/log-files.js.map +1 -0
- package/data/build/dist/host/cli-adapters/model-catalog.d.ts +2 -0
- package/data/build/dist/host/cli-adapters/model-catalog.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/model-catalog.js +10 -0
- package/data/build/dist/host/cli-adapters/model-catalog.js.map +1 -1
- package/data/build/dist/host/cli-adapters/native-team-subagent.js +1 -1
- package/data/build/dist/host/cli-adapters/native-team-subagent.js.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-driver.d.ts +11 -0
- package/data/build/dist/host/cli-adapters/opencode-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-driver.js +132 -49
- package/data/build/dist/host/cli-adapters/opencode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-v2-protocol.d.ts +29 -0
- package/data/build/dist/host/cli-adapters/opencode-v2-protocol.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/opencode-v2-protocol.js +471 -0
- package/data/build/dist/host/cli-adapters/opencode-v2-protocol.js.map +1 -0
- package/data/build/dist/host/cli-adapters/pi-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/pi-driver.js +2 -1
- package/data/build/dist/host/cli-adapters/pi-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/process-utils.d.ts +12 -4
- package/data/build/dist/host/cli-adapters/process-utils.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/process-utils.js +151 -17
- package/data/build/dist/host/cli-adapters/process-utils.js.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-driver.js +63 -100
- package/data/build/dist/host/cli-adapters/qoder-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-subscription.d.ts +6 -1
- package/data/build/dist/host/cli-adapters/qoder-subscription.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-subscription.js +37 -10
- package/data/build/dist/host/cli-adapters/qoder-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.d.ts +13 -21
- package/data/build/dist/host/cli-adapters/registry.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.js +102 -131
- package/data/build/dist/host/cli-adapters/registry.js.map +1 -1
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.d.ts +2 -10
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.js +1 -28
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.js.map +1 -1
- package/data/build/dist/host/cli-adapters/session-store.d.ts +5 -1
- package/data/build/dist/host/cli-adapters/session-store.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/session-store.js +68 -11
- package/data/build/dist/host/cli-adapters/session-store.js.map +1 -1
- package/data/build/dist/host/cli-adapters/standard-stream-driver.d.ts +3 -3
- package/data/build/dist/host/cli-adapters/standard-stream-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/standard-stream-driver.js +14 -38
- package/data/build/dist/host/cli-adapters/standard-stream-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/windows-command-environment.d.ts +12 -0
- package/data/build/dist/host/cli-adapters/windows-command-environment.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/windows-command-environment.js +53 -0
- package/data/build/dist/host/cli-adapters/windows-command-environment.js.map +1 -0
- package/data/build/dist/host/cli-bridge/dispatch.js +1 -1
- package/data/build/dist/host/cli-bridge/dispatch.js.map +1 -1
- package/data/build/dist/host/debug.d.ts.map +1 -1
- package/data/build/dist/host/debug.js +5 -4
- package/data/build/dist/host/debug.js.map +1 -1
- package/data/build/dist/host/dsh-runtime-version.d.ts +1 -1
- package/data/build/dist/host/dsh-runtime-version.d.ts.map +1 -1
- package/data/build/dist/host/dsh-runtime-version.js +22 -17
- package/data/build/dist/host/dsh-runtime-version.js.map +1 -1
- package/data/build/dist/host/features/assistant-avatar-runtime.d.ts.map +1 -1
- package/data/build/dist/host/features/assistant-avatar-runtime.js +43 -19
- package/data/build/dist/host/features/assistant-avatar-runtime.js.map +1 -1
- package/data/build/dist/host/features/assistant-background.d.ts +44 -0
- package/data/build/dist/host/features/assistant-background.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-background.js +116 -0
- package/data/build/dist/host/features/assistant-background.js.map +1 -0
- package/data/build/dist/host/features/assistant-index-updates.d.ts +5 -0
- package/data/build/dist/host/features/assistant-index-updates.d.ts.map +1 -1
- package/data/build/dist/host/features/assistant-index-updates.js +29 -6
- package/data/build/dist/host/features/assistant-index-updates.js.map +1 -1
- package/data/build/dist/host/features/assistant-source-cache.d.ts +12 -0
- package/data/build/dist/host/features/assistant-source-cache.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-source-cache.js +58 -0
- package/data/build/dist/host/features/assistant-source-cache.js.map +1 -0
- package/data/build/dist/host/features/global-voice-coordinator.d.ts.map +1 -1
- package/data/build/dist/host/features/global-voice-coordinator.js +15 -10
- package/data/build/dist/host/features/global-voice-coordinator.js.map +1 -1
- package/data/build/dist/host/features/global-voice-rpc.d.ts.map +1 -1
- package/data/build/dist/host/features/global-voice-rpc.js +288 -114
- package/data/build/dist/host/features/global-voice-rpc.js.map +1 -1
- package/data/build/dist/host/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/host/features/peer-host.js +61 -21
- package/data/build/dist/host/features/peer-host.js.map +1 -1
- package/data/build/dist/host/features/sherpa-voice-worker.d.ts +18 -0
- package/data/build/dist/host/features/sherpa-voice-worker.d.ts.map +1 -0
- package/data/build/dist/host/features/sherpa-voice-worker.js +40 -0
- package/data/build/dist/host/features/sherpa-voice-worker.js.map +1 -0
- package/data/build/dist/host/features/sherpa-worker-runtime.d.ts +41 -0
- package/data/build/dist/host/features/sherpa-worker-runtime.d.ts.map +1 -0
- package/data/build/dist/host/features/sherpa-worker-runtime.js +200 -0
- package/data/build/dist/host/features/sherpa-worker-runtime.js.map +1 -0
- package/data/build/dist/host/features/types.d.ts +6 -4
- package/data/build/dist/host/features/types.d.ts.map +1 -1
- package/data/build/dist/host/index.d.ts +1 -1
- package/data/build/dist/host/index.d.ts.map +1 -1
- package/data/build/dist/host/index.js +31 -21
- package/data/build/dist/host/index.js.map +1 -1
- package/data/build/dist/host/lan-access-dsh.d.ts.map +1 -1
- package/data/build/dist/host/lan-access-dsh.js +5 -22
- package/data/build/dist/host/lan-access-dsh.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/host-api-proxy-service.d.ts +6 -46
- package/data/build/dist/host/modules/peer-host/host-api-proxy-service.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/host-api-proxy-service.js +48 -28
- package/data/build/dist/host/modules/peer-host/host-api-proxy-service.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-diagnostics.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-diagnostics.js +1 -0
- package/data/build/dist/host/modules/peer-host/peer-host-diagnostics.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-handshake.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-handshake.js +4 -1
- package/data/build/dist/host/modules/peer-host/peer-host-handshake.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-session.d.ts +7 -1
- package/data/build/dist/host/modules/peer-host/peer-host-session.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-session.js +40 -13
- package/data/build/dist/host/modules/peer-host/peer-host-session.js.map +1 -1
- package/data/build/dist/host/provider-icon-assets.d.ts +5 -0
- package/data/build/dist/host/provider-icon-assets.d.ts.map +1 -0
- package/data/build/dist/host/provider-icon-assets.js +61 -0
- package/data/build/dist/host/provider-icon-assets.js.map +1 -0
- package/data/build/dist/host/rpc.js +2 -2
- package/data/build/dist/host/rpc.js.map +1 -1
- package/data/build/dist/host/session-migration-repair.d.ts +4 -0
- package/data/build/dist/host/session-migration-repair.d.ts.map +1 -1
- package/data/build/dist/host/session-migration-repair.js +75 -2
- package/data/build/dist/host/session-migration-repair.js.map +1 -1
- package/data/build/dist/host/terminal/backends/tmux-backend.d.ts +1 -1
- package/data/build/dist/host/terminal/backends/tmux-backend.d.ts.map +1 -1
- package/data/build/dist/host/terminal/backends/tmux-backend.js +15 -14
- package/data/build/dist/host/terminal/backends/tmux-backend.js.map +1 -1
- package/data/build/dist/shared/assistant-avatar-engine.d.ts +5 -0
- package/data/build/dist/shared/assistant-avatar-engine.d.ts.map +1 -1
- package/data/build/dist/shared/assistant-avatar-engine.js +14 -0
- package/data/build/dist/shared/assistant-avatar-engine.js.map +1 -1
- package/data/build/dist/shared/contracts/cli-adapter.d.ts +6 -0
- package/data/build/dist/shared/contracts/cli-adapter.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/errors.d.ts +1 -0
- package/data/build/dist/shared/contracts/errors.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/errors.js +1 -0
- package/data/build/dist/shared/contracts/errors.js.map +1 -1
- package/data/build/dist/shared/contracts/peer-host.d.ts +1 -0
- package/data/build/dist/shared/contracts/peer-host.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/peer-host.js +1 -0
- package/data/build/dist/shared/contracts/peer-host.js.map +1 -1
- package/data/build/dist/shared/contracts/version.d.ts +3 -1
- package/data/build/dist/shared/contracts/version.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/version.js +20 -7
- package/data/build/dist/shared/contracts/version.js.map +1 -1
- package/data/build/dist/shared/peer-host-http-routes.d.ts +62 -0
- package/data/build/dist/shared/peer-host-http-routes.d.ts.map +1 -0
- package/data/build/dist/shared/peer-host-http-routes.js +31 -0
- package/data/build/dist/shared/peer-host-http-routes.js.map +1 -0
- package/data/build/dist/shared/provider-icon-resources.d.ts +4 -0
- package/data/build/dist/shared/provider-icon-resources.d.ts.map +1 -0
- package/data/build/dist/shared/provider-icon-resources.js +24 -0
- package/data/build/dist/shared/provider-icon-resources.js.map +1 -0
- package/package.json +2 -2
- package/profile/README.md +2 -2
- package/profile/package.json +2 -2
- package/profile/version.json +1 -1
- package/version.json +1 -1
|
@@ -17,19 +17,12 @@ export declare class CodingNsCliAdapterRegistry {
|
|
|
17
17
|
private readonly probes;
|
|
18
18
|
private readonly executingSessions;
|
|
19
19
|
private readonly archivingSessions;
|
|
20
|
-
private readonly installedCacheTtlMs;
|
|
21
|
-
private readonly uninstalledCacheTtlMs;
|
|
22
|
-
private readonly modelCacheTtlMs;
|
|
23
|
-
private readonly modelRetryTtlMs;
|
|
24
20
|
private readonly detectionCache;
|
|
25
21
|
private readonly detectionRefreshes;
|
|
26
|
-
private readonly detectionTimers;
|
|
27
22
|
private readonly modelCache;
|
|
28
23
|
private readonly modelFailures;
|
|
29
24
|
private readonly modelRefreshes;
|
|
30
|
-
private readonly modelTimers;
|
|
31
25
|
private readonly modelGenerations;
|
|
32
|
-
private readonly requestedModelCatalogs;
|
|
33
26
|
/**
|
|
34
27
|
* 上次构建目录时驱动声明的 Provider 配置指纹。
|
|
35
28
|
*
|
|
@@ -47,6 +40,11 @@ export declare class CodingNsCliAdapterRegistry {
|
|
|
47
40
|
*/
|
|
48
41
|
private readonly segmentedTurns;
|
|
49
42
|
private cacheGeneration;
|
|
43
|
+
private startupTimer;
|
|
44
|
+
private readonly lifetime;
|
|
45
|
+
private readonly originalDetections;
|
|
46
|
+
private readonly detectionStates;
|
|
47
|
+
private readonly detectionTimes;
|
|
50
48
|
private disposed;
|
|
51
49
|
constructor(drivers: readonly CodingNsCliDriver[], enabled?: Readonly<Record<string, boolean>>, options?: {
|
|
52
50
|
readonly sessionStore?: CodingNsCliSessionStore;
|
|
@@ -55,6 +53,7 @@ export declare class CodingNsCliAdapterRegistry {
|
|
|
55
53
|
readonly missingConfirmationDelayMs?: number;
|
|
56
54
|
readonly providerProbeTimeoutMs?: number;
|
|
57
55
|
readonly providerProbeConcurrency?: number;
|
|
56
|
+
/** @deprecated 检测已改为启动一次和手动刷新,旧 TTL 参数仅兼容调用方。 */
|
|
58
57
|
readonly installedCacheTtlMs?: number;
|
|
59
58
|
readonly uninstalledCacheTtlMs?: number;
|
|
60
59
|
readonly modelCacheTtlMs?: number;
|
|
@@ -68,17 +67,14 @@ export declare class CodingNsCliAdapterRegistry {
|
|
|
68
67
|
private readonly preferences;
|
|
69
68
|
/** 设置服务更新必须按选择顺序落盘;并发 update 会让旧快照覆盖新模型/档位。 */
|
|
70
69
|
private preferenceWriteTail;
|
|
71
|
-
/**
|
|
72
|
-
* Host 启动后预热安装状态,并按驱动声明后台预热模型目录。
|
|
73
|
-
*
|
|
74
|
-
* 模型探测可能启动完整外部服务,必须留在后台;只有调用方显式请求
|
|
75
|
-
* `models()` 时才等待结果。未声明预热的驱动保持原有按需加载,避免启动时
|
|
76
|
-
* 同时拉起所有外部 CLI。
|
|
77
|
-
*/
|
|
70
|
+
/** 启动让出首屏,只检测一次;模型目录留到首次使用时异步加载。 */
|
|
78
71
|
warmCatalog(): void;
|
|
79
|
-
/**
|
|
80
|
-
private warmModelCatalog;
|
|
72
|
+
/** 普通目录查询只读内存,不等待 CLI,也不触发过期刷新。 */
|
|
81
73
|
catalog(): Promise<CodingNsCliAdapterDescriptor[]>;
|
|
74
|
+
/** 真正执行用户选择时,只等待这些目标的首轮检测,避免把 pending 误判成未安装。 */
|
|
75
|
+
catalogForUse(adapterIds: readonly CodingNsCliAdapterId[]): Promise<CodingNsCliAdapterDescriptor[]>;
|
|
76
|
+
/** 仅设置页显式重新检测;并发请求合并,已有模型在重新检测后按需刷新。 */
|
|
77
|
+
refreshCatalog(adapterId?: CodingNsCliAdapterId): Promise<CodingNsCliAdapterDescriptor[]>;
|
|
82
78
|
models(adapterId: CodingNsCliAdapterId): Promise<CodingNsCliModelCatalog>;
|
|
83
79
|
/** 读取当前外部会话绑定 Agent 的 Skill 目录;不把路径或文件内容暴露给 Client。 */
|
|
84
80
|
listSkills(sessionId: string, options?: Omit<CodingNsCliSkillListInput, 'sessionId'>): Promise<readonly CodingNsCliSkillDescriptor[]>;
|
|
@@ -158,10 +154,8 @@ export declare class CodingNsCliAdapterRegistry {
|
|
|
158
154
|
private readDetection;
|
|
159
155
|
/** 同一适配器只允许一个探测;刷新失败时保留最后一次可用状态。 */
|
|
160
156
|
private refreshDetection;
|
|
161
|
-
/**
|
|
157
|
+
/** 模型目录合并并发请求;缓存由手动检测或配置变化失效,不后台定时重跑。 */
|
|
162
158
|
private refreshModels;
|
|
163
|
-
private scheduleDetectionRefresh;
|
|
164
|
-
private scheduleModelRefresh;
|
|
165
159
|
private invalidateModelCache;
|
|
166
160
|
/**
|
|
167
161
|
* 比对驱动的 Provider 配置指纹,变化时立即作废该适配器的目录缓存。
|
|
@@ -174,8 +168,6 @@ export declare class CodingNsCliAdapterRegistry {
|
|
|
174
168
|
* 原行为,不把「无法判断」当成「已变化」,避免目录退化成每次都重新探测。
|
|
175
169
|
*/
|
|
176
170
|
private invalidateOnCatalogFingerprintChange;
|
|
177
|
-
private clearTimer;
|
|
178
|
-
private clearAllTimers;
|
|
179
171
|
private refreshProviderState;
|
|
180
172
|
private runProviderProbe;
|
|
181
173
|
private probeWithTimeout;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../../src/host/cli-adapters/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,6BAA6B,EAC7B,4BAA4B,EAC5B,oBAAoB,EACpB,uBAAuB,EACvB,+BAA+B,EAC/B,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EAEzB,0BAA0B,EAC1B,yBAAyB,
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../../src/host/cli-adapters/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,6BAA6B,EAC7B,4BAA4B,EAC5B,oBAAoB,EACpB,uBAAuB,EACvB,+BAA+B,EAC/B,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EAEzB,0BAA0B,EAC1B,yBAAyB,EAE1B,MAAM,uCAAuC,CAAA;AAK9C,OAAO,KAAK,EACV,iBAAiB,EAGlB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAG5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAA;AACtG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAA;AAC/F,OAAO,KAAK,EACV,uBAAuB,EACvB,2BAA2B,EAC3B,sBAAsB,EACtB,2BAA2B,EAC3B,yBAAyB,EACzB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,8BAA8B,EAC9B,4BAA4B,EAC5B,6BAA6B,EAC9B,MAAM,2BAA2B,CAAA;AA4BlC,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqD;IAC7E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8C;IACvE,OAAO,CAA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AAO,CAAC,8BAA8B,CAAC;IAIjI,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAI9I,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IA0ChF,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,+BAA+B,GAAG,OAAO,CAAC,IAAI,CAAC;IAO9F,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;IAO1F,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzE,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOjD,0CAA0C;IAC1C,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IASvC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;YAmBhB,aAAa;IAY3B,oCAAoC;IACpC,OAAO,CAAC,gBAAgB;IA0CxB,yCAAyC;IACzC,OAAO,CAAC,aAAa;IA8CrB,OAAO,CAAC,oBAAoB;IAQ5B;;;;;;;;;OASG;IACH,OAAO,CAAC,oCAAoC;YAW9B,oBAAoB;YAkBpB,gBAAgB;YAgChB,gBAAgB;IAsB9B,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,oBAAoB;IAqB5B,OAAO,CAAC,oBAAoB;IAM5B,OAAO,CAAC,cAAc;CAKvB"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
import { invalidateCommandEnvironment, withCommandSignal } from './process-utils.js';
|
|
2
|
+
import { failedDetection } from './binary-detection.js';
|
|
1
3
|
import { CodingNsRpcError } from '../rpc-table.js';
|
|
2
4
|
import { debugInfo } from '../../shared/debug.js';
|
|
3
5
|
import { CodingNsCliSessionStore } from './session-store.js';
|
|
4
6
|
import { readLegacyImportedAdapterPreferences } from './legacy-session-settings.js';
|
|
5
7
|
import { knownAntigravityContextWindow, knownCodexContextWindow, knownCommandCodeContextWindow } from './model-catalog.js';
|
|
6
|
-
const DEFAULT_INSTALLED_CACHE_TTL_MS = 5 * 60_000;
|
|
7
|
-
const DEFAULT_UNINSTALLED_CACHE_TTL_MS = 30_000;
|
|
8
|
-
const DEFAULT_MODEL_CACHE_TTL_MS = 10 * 60_000;
|
|
9
|
-
const DEFAULT_MODEL_RETRY_TTL_MS = 15_000;
|
|
10
8
|
export class CodingNsCliAdapterRegistry {
|
|
11
9
|
drivers = new Map();
|
|
12
10
|
sessions = new Map();
|
|
@@ -19,19 +17,12 @@ export class CodingNsCliAdapterRegistry {
|
|
|
19
17
|
probes = new Map();
|
|
20
18
|
executingSessions = new Set();
|
|
21
19
|
archivingSessions = new Set();
|
|
22
|
-
installedCacheTtlMs;
|
|
23
|
-
uninstalledCacheTtlMs;
|
|
24
|
-
modelCacheTtlMs;
|
|
25
|
-
modelRetryTtlMs;
|
|
26
20
|
detectionCache = new Map();
|
|
27
21
|
detectionRefreshes = new Map();
|
|
28
|
-
detectionTimers = new Map();
|
|
29
22
|
modelCache = new Map();
|
|
30
23
|
modelFailures = new Map();
|
|
31
24
|
modelRefreshes = new Map();
|
|
32
|
-
modelTimers = new Map();
|
|
33
25
|
modelGenerations = new Map();
|
|
34
|
-
requestedModelCatalogs = new Set();
|
|
35
26
|
/**
|
|
36
27
|
* 上次构建目录时驱动声明的 Provider 配置指纹。
|
|
37
28
|
*
|
|
@@ -49,6 +40,11 @@ export class CodingNsCliAdapterRegistry {
|
|
|
49
40
|
*/
|
|
50
41
|
segmentedTurns = new Map();
|
|
51
42
|
cacheGeneration = 0;
|
|
43
|
+
startupTimer;
|
|
44
|
+
lifetime = new AbortController();
|
|
45
|
+
originalDetections = new Map();
|
|
46
|
+
detectionStates = new Map();
|
|
47
|
+
detectionTimes = new Map();
|
|
52
48
|
disposed = false;
|
|
53
49
|
constructor(drivers, enabled = {}, options = {}) {
|
|
54
50
|
this.sessionStore = options.sessionStore;
|
|
@@ -58,10 +54,6 @@ export class CodingNsCliAdapterRegistry {
|
|
|
58
54
|
this.missingConfirmationDelayMs = options.missingConfirmationDelayMs ?? 2_000;
|
|
59
55
|
this.providerProbeTimeoutMs = Math.max(1, options.providerProbeTimeoutMs ?? 10_000);
|
|
60
56
|
this.providerProbeConcurrency = Math.max(1, Math.floor(options.providerProbeConcurrency ?? 4));
|
|
61
|
-
this.installedCacheTtlMs = positiveTtl(options.installedCacheTtlMs, DEFAULT_INSTALLED_CACHE_TTL_MS);
|
|
62
|
-
this.uninstalledCacheTtlMs = positiveTtl(options.uninstalledCacheTtlMs, DEFAULT_UNINSTALLED_CACHE_TTL_MS);
|
|
63
|
-
this.modelCacheTtlMs = positiveTtl(options.modelCacheTtlMs, DEFAULT_MODEL_CACHE_TTL_MS);
|
|
64
|
-
this.modelRetryTtlMs = positiveTtl(options.modelRetryTtlMs, DEFAULT_MODEL_RETRY_TTL_MS);
|
|
65
57
|
const configuredPreferences = options.settings?.get().agentAdapterPreferences;
|
|
66
58
|
const legacyPreferences = options.settings === undefined ? {} : readLegacyImportedAdapterPreferences();
|
|
67
59
|
const mergedPreferences = mergePreferenceRecords(legacyPreferences, configuredPreferences);
|
|
@@ -75,6 +67,9 @@ export class CodingNsCliAdapterRegistry {
|
|
|
75
67
|
if (this.drivers.has(driver.descriptor.id))
|
|
76
68
|
throw new Error(`重复 Agent: ${driver.descriptor.id}`);
|
|
77
69
|
this.drivers.set(driver.descriptor.id, driver);
|
|
70
|
+
// 驱动在模型查询和执行前的自检也必须复用同一缓存,不能绕过注册表反复启动 CLI。
|
|
71
|
+
this.originalDetections.set(driver.descriptor.id, driver.detect);
|
|
72
|
+
driver.detect = () => this.readDetection(driver);
|
|
78
73
|
this.enabled.set(driver.descriptor.id, enabled[driver.descriptor.id] !== false);
|
|
79
74
|
}
|
|
80
75
|
for (const record of this.sessionStore?.list({ includeArchived: true }) ?? []) {
|
|
@@ -88,47 +83,51 @@ export class CodingNsCliAdapterRegistry {
|
|
|
88
83
|
preferences = new Map();
|
|
89
84
|
/** 设置服务更新必须按选择顺序落盘;并发 update 会让旧快照覆盖新模型/档位。 */
|
|
90
85
|
preferenceWriteTail = Promise.resolve();
|
|
91
|
-
/**
|
|
92
|
-
* Host 启动后预热安装状态,并按驱动声明后台预热模型目录。
|
|
93
|
-
*
|
|
94
|
-
* 模型探测可能启动完整外部服务,必须留在后台;只有调用方显式请求
|
|
95
|
-
* `models()` 时才等待结果。未声明预热的驱动保持原有按需加载,避免启动时
|
|
96
|
-
* 同时拉起所有外部 CLI。
|
|
97
|
-
*/
|
|
86
|
+
/** 启动让出首屏,只检测一次;模型目录留到首次使用时异步加载。 */
|
|
98
87
|
warmCatalog() {
|
|
99
|
-
|
|
100
|
-
const adapterId = driver.descriptor.id;
|
|
101
|
-
this.scheduleDetectionRefresh(adapterId, 0);
|
|
102
|
-
if (driver.warmModelCatalog !== true || !this.isEnabled(adapterId))
|
|
103
|
-
continue;
|
|
104
|
-
this.requestedModelCatalogs.add(adapterId);
|
|
105
|
-
// 定时器把第一次 detect 也移出当前调用栈;某些 CLI 的版本探测仍是同步
|
|
106
|
-
// 子进程调用,不能让 warmCatalog() 本身承担这段启动时间。
|
|
107
|
-
const timer = setTimeout(() => {
|
|
108
|
-
if (!this.disposed)
|
|
109
|
-
void this.warmModelCatalog(driver).catch(() => undefined);
|
|
110
|
-
}, 0);
|
|
111
|
-
unrefTimer(timer);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/** 等安装探测完成后再刷新模型,避免为同一个 CLI 启动两次检测进程。 */
|
|
115
|
-
async warmModelCatalog(driver) {
|
|
116
|
-
if (this.disposed)
|
|
117
|
-
return;
|
|
118
|
-
const detection = await this.readDetection(driver);
|
|
119
|
-
if (this.disposed || !this.isEnabled(driver.descriptor.id) || !detection.installed)
|
|
88
|
+
if (this.disposed || this.startupTimer !== undefined)
|
|
120
89
|
return;
|
|
121
|
-
|
|
90
|
+
this.startupTimer = setTimeout(() => {
|
|
91
|
+
for (const driver of this.drivers.values())
|
|
92
|
+
void this.readDetection(driver);
|
|
93
|
+
}, 1_000);
|
|
94
|
+
unrefTimer(this.startupTimer);
|
|
122
95
|
}
|
|
96
|
+
/** 普通目录查询只读内存,不等待 CLI,也不触发过期刷新。 */
|
|
123
97
|
async catalog() {
|
|
124
|
-
return
|
|
125
|
-
const
|
|
126
|
-
|
|
98
|
+
return [...this.drivers.values()].map((driver) => {
|
|
99
|
+
const id = driver.descriptor.id;
|
|
100
|
+
const checkedAt = this.detectionTimes.get(id);
|
|
101
|
+
return {
|
|
102
|
+
...driver.descriptor, enabled: this.isEnabled(id),
|
|
103
|
+
...(this.detectionCache.get(id)?.value ?? { installed: false, version: null, command: null }),
|
|
104
|
+
detectionState: this.detectionStates.get(id) ?? 'pending',
|
|
105
|
+
...(checkedAt === undefined ? {} : { checkedAt }),
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/** 真正执行用户选择时,只等待这些目标的首轮检测,避免把 pending 误判成未安装。 */
|
|
110
|
+
async catalogForUse(adapterIds) {
|
|
111
|
+
await Promise.all([...new Set(adapterIds)].map((id) => {
|
|
112
|
+
const driver = this.drivers.get(id);
|
|
113
|
+
return driver === undefined || !this.isEnabled(id) ? undefined : this.readDetection(driver);
|
|
114
|
+
}));
|
|
115
|
+
return this.catalog();
|
|
116
|
+
}
|
|
117
|
+
/** 仅设置页显式重新检测;并发请求合并,已有模型在重新检测后按需刷新。 */
|
|
118
|
+
async refreshCatalog(adapterId) {
|
|
119
|
+
if (this.disposed)
|
|
120
|
+
throw new Error('Agent 注册表已关闭');
|
|
121
|
+
const drivers = adapterId === undefined ? [...this.drivers.values()] : [this.requireDriver(adapterId)];
|
|
122
|
+
invalidateCommandEnvironment();
|
|
123
|
+
await Promise.all(drivers.map(async (driver) => {
|
|
124
|
+
await this.refreshDetection(driver);
|
|
125
|
+
this.invalidateModelCache(driver.descriptor.id);
|
|
127
126
|
}));
|
|
127
|
+
return this.catalog();
|
|
128
128
|
}
|
|
129
129
|
async models(adapterId) {
|
|
130
130
|
const driver = this.requireEnabledDriver(adapterId);
|
|
131
|
-
this.requestedModelCatalogs.add(adapterId);
|
|
132
131
|
// Provider 配置(供应商、登录方式、默认档位)变化时必须先作废目录,否则
|
|
133
132
|
// 账号级判定会跟着 10 分钟 TTL 一起被沿用,界面上的档位开关等控件长期缺失。
|
|
134
133
|
if (this.invalidateOnCatalogFingerprintChange(adapterId, driver)) {
|
|
@@ -136,14 +135,10 @@ export class CodingNsCliAdapterRegistry {
|
|
|
136
135
|
}
|
|
137
136
|
const cached = this.modelCache.get(adapterId);
|
|
138
137
|
if (cached !== undefined) {
|
|
139
|
-
if (cached.expiresAt <= Date.now())
|
|
140
|
-
void this.refreshModels(driver).catch(() => undefined);
|
|
141
138
|
return cached.value;
|
|
142
139
|
}
|
|
143
140
|
const failure = this.modelFailures.get(adapterId);
|
|
144
141
|
if (failure !== undefined) {
|
|
145
|
-
if (failure.expiresAt <= Date.now())
|
|
146
|
-
void this.refreshModels(driver).catch(() => undefined);
|
|
147
142
|
throw failure.error;
|
|
148
143
|
}
|
|
149
144
|
return this.refreshModels(driver);
|
|
@@ -173,10 +168,6 @@ export class CodingNsCliAdapterRegistry {
|
|
|
173
168
|
this.enabled.set(adapterId, enabled);
|
|
174
169
|
if (previous === enabled)
|
|
175
170
|
return enabled;
|
|
176
|
-
if (!enabled)
|
|
177
|
-
this.clearTimer(this.modelTimers, adapterId);
|
|
178
|
-
else if (this.requestedModelCatalogs.has(adapterId))
|
|
179
|
-
this.scheduleModelRefresh(adapterId, 0);
|
|
180
171
|
return enabled;
|
|
181
172
|
}
|
|
182
173
|
applyEnabledSettings(settings) {
|
|
@@ -428,6 +419,9 @@ export class CodingNsCliAdapterRegistry {
|
|
|
428
419
|
// 除了 Client 的 session/set,Host 内部和未来的调用方也可能直接执行一轮。
|
|
429
420
|
// 最近使用应由真实执行参数更新,不能依赖某个 UI 一定先发 RPC。
|
|
430
421
|
this.rememberPreference(input.adapterId, input);
|
|
422
|
+
// 手动 next() 不会自动转发外层的 return();本轮持有的迭代器必须在 finally 关闭。
|
|
423
|
+
// 只有显式交给 segmentedTurns 的流才能跨 DSH step 保留。
|
|
424
|
+
let iterator;
|
|
431
425
|
try {
|
|
432
426
|
const stored = this.sessionStore?.get(input.sessionId);
|
|
433
427
|
if (stored?.status === 'archived') {
|
|
@@ -487,7 +481,6 @@ export class CodingNsCliAdapterRegistry {
|
|
|
487
481
|
catch { /* 切换适配器不能被旧驱动清理失败阻断 */ }
|
|
488
482
|
}
|
|
489
483
|
// 通用切分要在复用时立刻撤销登记,否则耗尽后的旧迭代器会被下一条用户消息再次消费。
|
|
490
|
-
let iterator;
|
|
491
484
|
if (resumingSegmentedTurn && suspended !== undefined && suspended.iterator !== null) {
|
|
492
485
|
this.segmentedTurns.delete(input.sessionId);
|
|
493
486
|
iterator = suspended.iterator;
|
|
@@ -497,8 +490,10 @@ export class CodingNsCliAdapterRegistry {
|
|
|
497
490
|
}
|
|
498
491
|
while (true) {
|
|
499
492
|
const next = await iterator.next();
|
|
500
|
-
if (next.done)
|
|
493
|
+
if (next.done) {
|
|
494
|
+
iterator = undefined;
|
|
501
495
|
break;
|
|
496
|
+
}
|
|
502
497
|
const event = next.value;
|
|
503
498
|
if (event.type === 'usage')
|
|
504
499
|
this.lastUsages.set(input.sessionId, usageSnapshot(event));
|
|
@@ -522,6 +517,9 @@ export class CodingNsCliAdapterRegistry {
|
|
|
522
517
|
providerState: 'available',
|
|
523
518
|
providerCheckedAt: new Date().toISOString(),
|
|
524
519
|
});
|
|
520
|
+
// 首次或重绑的 Provider ID 必须先落盘,避免崩溃后丢失续接身份。
|
|
521
|
+
if (providerIdentityChanged)
|
|
522
|
+
await this.sessionStore?.flush();
|
|
525
523
|
}
|
|
526
524
|
if (event.type === 'finish') {
|
|
527
525
|
this.segmentedTurns.delete(input.sessionId);
|
|
@@ -531,6 +529,7 @@ export class CodingNsCliAdapterRegistry {
|
|
|
531
529
|
// 直接交给 Feature,不能再次按工具完成事件切一遍。
|
|
532
530
|
if (event.type === 'step-boundary') {
|
|
533
531
|
await closeAgentIterator(iterator);
|
|
532
|
+
iterator = undefined;
|
|
534
533
|
// 驱动自己持有 Provider 进程与段状态:这里只登记续段意图,下一次
|
|
535
534
|
// llm/stream 再显式要求驱动恢复;注入失败时 discardSegmentedTurn
|
|
536
535
|
// 会同时丢弃 Registry 意图和驱动内的进程。
|
|
@@ -545,6 +544,8 @@ export class CodingNsCliAdapterRegistry {
|
|
|
545
544
|
// 先保存迭代器再 yield。即使调用方在工具事件后提前关闭流,
|
|
546
545
|
// 下一次 DSH step 仍能从同一个 Provider 进程继续读取正文。
|
|
547
546
|
this.segmentedTurns.set(input.sessionId, { adapterId: input.adapterId, iterator });
|
|
547
|
+
// 所有权交给续段表,当前调用结束不得关闭需要继续消费的 Provider 流。
|
|
548
|
+
iterator = undefined;
|
|
548
549
|
yield event;
|
|
549
550
|
yield { type: 'step-boundary' };
|
|
550
551
|
return;
|
|
@@ -562,6 +563,8 @@ export class CodingNsCliAdapterRegistry {
|
|
|
562
563
|
throw error;
|
|
563
564
|
}
|
|
564
565
|
finally {
|
|
566
|
+
if (iterator !== undefined)
|
|
567
|
+
await closeAgentIterator(iterator);
|
|
565
568
|
this.executingSessions.delete(input.sessionId);
|
|
566
569
|
try {
|
|
567
570
|
await this.nativeSessions?.flush(input.sessionId);
|
|
@@ -711,15 +714,16 @@ export class CodingNsCliAdapterRegistry {
|
|
|
711
714
|
if (this.disposed)
|
|
712
715
|
return;
|
|
713
716
|
this.disposed = true;
|
|
717
|
+
this.lifetime.abort();
|
|
714
718
|
this.cacheGeneration += 1;
|
|
715
|
-
|
|
716
|
-
|
|
719
|
+
clearTimeout(this.startupTimer);
|
|
720
|
+
for (const [id, detect] of this.originalDetections)
|
|
721
|
+
this.drivers.get(id).detect = detect;
|
|
717
722
|
this.detectionCache.clear();
|
|
718
723
|
this.modelCache.clear();
|
|
719
724
|
this.modelFailures.clear();
|
|
720
725
|
this.modelGenerations.clear();
|
|
721
726
|
this.catalogFingerprints.clear();
|
|
722
|
-
this.requestedModelCatalogs.clear();
|
|
723
727
|
await Promise.all([...this.segmentedTurns.values()].map(({ iterator }) => iterator === null ? Promise.resolve() : closeAgentIterator(iterator)));
|
|
724
728
|
this.segmentedTurns.clear();
|
|
725
729
|
this.lastUsages.clear();
|
|
@@ -730,9 +734,11 @@ export class CodingNsCliAdapterRegistry {
|
|
|
730
734
|
const adapterId = driver.descriptor.id;
|
|
731
735
|
const cached = this.detectionCache.get(adapterId);
|
|
732
736
|
if (cached !== undefined) {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
737
|
+
// 仅实际使用时重试失败状态,列表仍然只读;确实未安装的 Agent 不后台轮询。
|
|
738
|
+
const checkedAt = this.detectionTimes.get(adapterId);
|
|
739
|
+
const retry = this.detectionStates.get(adapterId) === 'error' && checkedAt !== undefined && Date.now() - Date.parse(checkedAt) >= 30_000;
|
|
740
|
+
if (!retry)
|
|
741
|
+
return cached.value;
|
|
736
742
|
}
|
|
737
743
|
return this.refreshDetection(driver);
|
|
738
744
|
}
|
|
@@ -742,36 +748,36 @@ export class CodingNsCliAdapterRegistry {
|
|
|
742
748
|
const running = this.detectionRefreshes.get(adapterId);
|
|
743
749
|
if (running !== undefined)
|
|
744
750
|
return running;
|
|
745
|
-
|
|
751
|
+
if (this.disposed)
|
|
752
|
+
return Promise.resolve(this.detectionCache.get(adapterId)?.value ?? { installed: false, version: null, command: null });
|
|
753
|
+
this.detectionStates.set(adapterId, 'running');
|
|
746
754
|
const generation = this.cacheGeneration;
|
|
747
755
|
const previous = this.detectionCache.get(adapterId);
|
|
748
756
|
const refresh = (async () => {
|
|
749
757
|
let detection;
|
|
750
758
|
let failed = false;
|
|
751
759
|
try {
|
|
752
|
-
const detected = await
|
|
760
|
+
const detected = await withCommandSignal(this.lifetime.signal, () => this.originalDetections.get(adapterId).call(driver));
|
|
753
761
|
const getDiagnostic = driver.getDiscoveryDiagnostic;
|
|
754
762
|
const diagnostic = getDiagnostic === undefined ? undefined : getDiagnostic.call(driver);
|
|
755
763
|
detection = diagnostic === undefined ? detected : { ...detected, diagnostic };
|
|
764
|
+
const failure = detected.detectionFailure ?? driver.getDiscoveryFailure?.();
|
|
765
|
+
if (!detected.installed && failure !== undefined) {
|
|
766
|
+
failed = true;
|
|
767
|
+
detection = detectionError(failure, previous?.value, diagnostic);
|
|
768
|
+
}
|
|
756
769
|
}
|
|
757
770
|
catch {
|
|
758
771
|
failed = true;
|
|
759
|
-
detection = previous?.value
|
|
772
|
+
detection = detectionError('launch', previous?.value);
|
|
760
773
|
}
|
|
761
774
|
if (this.disposed || generation !== this.cacheGeneration)
|
|
762
775
|
return detection;
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
? this.installedCacheTtlMs
|
|
767
|
-
: this.uninstalledCacheTtlMs;
|
|
768
|
-
this.detectionCache.set(adapterId, { value: detection, expiresAt: Date.now() + ttl });
|
|
769
|
-
this.scheduleDetectionRefresh(adapterId, ttl);
|
|
776
|
+
this.detectionCache.set(adapterId, { value: detection });
|
|
777
|
+
this.detectionStates.set(adapterId, failed ? 'error' : 'ready');
|
|
778
|
+
this.detectionTimes.set(adapterId, new Date().toISOString());
|
|
770
779
|
if (previous !== undefined && detectionFingerprint(previous.value) !== detectionFingerprint(detection)) {
|
|
771
780
|
this.invalidateModelCache(adapterId);
|
|
772
|
-
if (detection.installed && this.requestedModelCatalogs.has(adapterId) && this.isEnabled(adapterId)) {
|
|
773
|
-
this.scheduleModelRefresh(adapterId, 0);
|
|
774
|
-
}
|
|
775
781
|
}
|
|
776
782
|
return detection;
|
|
777
783
|
})().finally(() => {
|
|
@@ -781,27 +787,26 @@ export class CodingNsCliAdapterRegistry {
|
|
|
781
787
|
this.detectionRefreshes.set(adapterId, refresh);
|
|
782
788
|
return refresh;
|
|
783
789
|
}
|
|
784
|
-
/**
|
|
790
|
+
/** 模型目录合并并发请求;缓存由手动检测或配置变化失效,不后台定时重跑。 */
|
|
785
791
|
refreshModels(driver) {
|
|
786
792
|
const adapterId = driver.descriptor.id;
|
|
787
793
|
const running = this.modelRefreshes.get(adapterId);
|
|
788
794
|
if (running !== undefined)
|
|
789
795
|
return running;
|
|
790
|
-
this.clearTimer(this.modelTimers, adapterId);
|
|
791
796
|
const generation = this.cacheGeneration;
|
|
792
797
|
const modelGeneration = this.modelGenerations.get(adapterId) ?? 0;
|
|
793
798
|
const previous = this.modelCache.get(adapterId);
|
|
794
799
|
const refresh = (async () => {
|
|
800
|
+
const probeFingerprint = readCatalogFingerprint(driver);
|
|
795
801
|
try {
|
|
796
802
|
// 指纹必须在探测开始前捕获:若在 listModels() 返回后再读,探测期间发生的
|
|
797
803
|
// 第二次供应商切换会被记成“已应用”,而目录其实来自切换前的配置,之后
|
|
798
804
|
// 指纹比对会一直命中,旧判定又被锁进缓存。
|
|
799
|
-
const
|
|
800
|
-
const catalog = await driver.listModels();
|
|
805
|
+
const catalog = await withCommandSignal(this.lifetime.signal, () => driver.listModels());
|
|
801
806
|
if (this.disposed || generation !== this.cacheGeneration)
|
|
802
807
|
return previous?.value ?? catalog;
|
|
803
808
|
if (modelGeneration !== (this.modelGenerations.get(adapterId) ?? 0))
|
|
804
|
-
return this.
|
|
809
|
+
return this.models(adapterId);
|
|
805
810
|
this.modelFailures.delete(adapterId);
|
|
806
811
|
const hasModels = catalogHasModels(catalog);
|
|
807
812
|
const keepPrevious = !hasModels && previous !== undefined && catalogHasModels(previous.value);
|
|
@@ -809,9 +814,7 @@ export class CodingNsCliAdapterRegistry {
|
|
|
809
814
|
// 指纹与目录一起落库:只有真正代表这份目录的配置才会在下次比对时命中。
|
|
810
815
|
if (probeFingerprint !== undefined)
|
|
811
816
|
this.catalogFingerprints.set(adapterId, probeFingerprint);
|
|
812
|
-
|
|
813
|
-
this.modelCache.set(adapterId, { value, expiresAt: Date.now() + ttl });
|
|
814
|
-
this.scheduleModelRefresh(adapterId, ttl);
|
|
817
|
+
this.modelCache.set(adapterId, { value });
|
|
815
818
|
return value;
|
|
816
819
|
}
|
|
817
820
|
catch (error) {
|
|
@@ -821,14 +824,14 @@ export class CodingNsCliAdapterRegistry {
|
|
|
821
824
|
throw error;
|
|
822
825
|
}
|
|
823
826
|
if (modelGeneration !== (this.modelGenerations.get(adapterId) ?? 0))
|
|
824
|
-
return this.
|
|
827
|
+
return this.models(adapterId);
|
|
828
|
+
if (probeFingerprint !== undefined)
|
|
829
|
+
this.catalogFingerprints.set(adapterId, probeFingerprint);
|
|
825
830
|
if (previous !== undefined) {
|
|
826
|
-
this.modelCache.set(adapterId, { value: previous.value
|
|
827
|
-
this.scheduleModelRefresh(adapterId, this.modelRetryTtlMs);
|
|
831
|
+
this.modelCache.set(adapterId, { value: previous.value });
|
|
828
832
|
return previous.value;
|
|
829
833
|
}
|
|
830
|
-
this.modelFailures.set(adapterId, { error
|
|
831
|
-
this.scheduleModelRefresh(adapterId, this.modelRetryTtlMs);
|
|
834
|
+
this.modelFailures.set(adapterId, { error });
|
|
832
835
|
throw error;
|
|
833
836
|
}
|
|
834
837
|
})().finally(() => {
|
|
@@ -838,38 +841,12 @@ export class CodingNsCliAdapterRegistry {
|
|
|
838
841
|
this.modelRefreshes.set(adapterId, refresh);
|
|
839
842
|
return refresh;
|
|
840
843
|
}
|
|
841
|
-
scheduleDetectionRefresh(adapterId, delayMs) {
|
|
842
|
-
if (this.disposed)
|
|
843
|
-
return;
|
|
844
|
-
this.clearTimer(this.detectionTimers, adapterId);
|
|
845
|
-
const timer = setTimeout(() => {
|
|
846
|
-
this.detectionTimers.delete(adapterId);
|
|
847
|
-
const driver = this.drivers.get(adapterId);
|
|
848
|
-
if (driver !== undefined && !this.disposed)
|
|
849
|
-
void this.refreshDetection(driver);
|
|
850
|
-
}, delayMs);
|
|
851
|
-
unrefTimer(timer);
|
|
852
|
-
this.detectionTimers.set(adapterId, timer);
|
|
853
|
-
}
|
|
854
|
-
scheduleModelRefresh(adapterId, delayMs) {
|
|
855
|
-
if (this.disposed || !this.isEnabled(adapterId) || !this.requestedModelCatalogs.has(adapterId))
|
|
856
|
-
return;
|
|
857
|
-
this.clearTimer(this.modelTimers, adapterId);
|
|
858
|
-
const timer = setTimeout(() => {
|
|
859
|
-
this.modelTimers.delete(adapterId);
|
|
860
|
-
const driver = this.drivers.get(adapterId);
|
|
861
|
-
if (driver !== undefined && this.isEnabled(adapterId) && !this.disposed)
|
|
862
|
-
void this.refreshModels(driver).catch(() => undefined);
|
|
863
|
-
}, delayMs);
|
|
864
|
-
unrefTimer(timer);
|
|
865
|
-
this.modelTimers.set(adapterId, timer);
|
|
866
|
-
}
|
|
867
844
|
invalidateModelCache(adapterId) {
|
|
868
|
-
this.clearTimer(this.modelTimers, adapterId);
|
|
869
845
|
this.modelGenerations.set(adapterId, (this.modelGenerations.get(adapterId) ?? 0) + 1);
|
|
870
846
|
this.modelRefreshes.delete(adapterId);
|
|
871
847
|
this.modelCache.delete(adapterId);
|
|
872
848
|
this.modelFailures.delete(adapterId);
|
|
849
|
+
this.catalogFingerprints.delete(adapterId);
|
|
873
850
|
}
|
|
874
851
|
/**
|
|
875
852
|
* 比对驱动的 Provider 配置指纹,变化时立即作废该适配器的目录缓存。
|
|
@@ -893,17 +870,6 @@ export class CodingNsCliAdapterRegistry {
|
|
|
893
870
|
this.invalidateModelCache(adapterId);
|
|
894
871
|
return true;
|
|
895
872
|
}
|
|
896
|
-
clearTimer(timers, adapterId) {
|
|
897
|
-
const timer = timers.get(adapterId);
|
|
898
|
-
if (timer !== undefined)
|
|
899
|
-
clearTimeout(timer);
|
|
900
|
-
timers.delete(adapterId);
|
|
901
|
-
}
|
|
902
|
-
clearAllTimers(timers) {
|
|
903
|
-
for (const timer of timers.values())
|
|
904
|
-
clearTimeout(timer);
|
|
905
|
-
timers.clear();
|
|
906
|
-
}
|
|
907
873
|
async refreshProviderState(record, force) {
|
|
908
874
|
if (record.status === 'archived')
|
|
909
875
|
return;
|
|
@@ -1054,9 +1020,6 @@ async function forEachConcurrent(values, concurrency, task) {
|
|
|
1054
1020
|
});
|
|
1055
1021
|
await Promise.all(workers);
|
|
1056
1022
|
}
|
|
1057
|
-
function positiveTtl(value, fallback) {
|
|
1058
|
-
return Math.max(1, Math.floor(value ?? fallback));
|
|
1059
|
-
}
|
|
1060
1023
|
function detectionFingerprint(detection) {
|
|
1061
1024
|
return JSON.stringify([detection.installed, detection.command, detection.version, detection.diagnostic]);
|
|
1062
1025
|
}
|
|
@@ -1190,4 +1153,12 @@ function unrefTimer(timer) {
|
|
|
1190
1153
|
const nodeTimer = timer;
|
|
1191
1154
|
nodeTimer.unref?.();
|
|
1192
1155
|
}
|
|
1156
|
+
/** 短暂探测失败保留最后一次成功入口,失败原因始终来自本次探测。 */
|
|
1157
|
+
function detectionError(reason, previous, diagnostic) {
|
|
1158
|
+
return {
|
|
1159
|
+
...failedDetection(reason),
|
|
1160
|
+
...(previous?.installed ? { installed: true, version: previous.version, command: previous.command } : {}),
|
|
1161
|
+
...(diagnostic === undefined ? {} : { diagnostic }),
|
|
1162
|
+
};
|
|
1163
|
+
}
|
|
1193
1164
|
//# sourceMappingURL=registry.js.map
|