@chatcode/chatcode-cli 3.0.5-rc.7 → 3.0.6-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +6 -6
- package/README.md +7 -0
- package/README.zh.md +7 -0
- package/lib/bin.js +19 -5
- package/lib/desktop-history-B0iUekXf.js +72 -0
- package/lib/desktop-history-DvgkONgj.js +2 -0
- package/lib/{dump-config-D8kXfdTs.js → dump-config-CgIYHBp2.js} +1 -1
- package/lib/dump-config-D6TruNva.js +2 -0
- package/lib/{dump-config-schema-CtZbroi6.js → dump-config-schema-GiAtkJwx.js} +2 -2
- package/lib/{plugin-CYw-MBRn.js → plugin-BACkrsVG.js} +1 -1
- package/lib/{profile-boot-CffsubnV.js → profile-boot-c5YKtUIb.js} +17 -4
- package/lib/profile-boot.js +1 -1
- package/lib/tui-compat.js +1 -1
- package/lib/types/args.d.ts +8 -1
- package/lib/types/desktop-history.d.ts +31 -0
- package/lib/types/installed-bin.d.ts +9 -0
- package/package.json +26 -26
- package/runtime/manifest.json +3 -2
- package/runtime/node_modules/@chatcode/runtime-client/README.md +225 -0
- package/runtime/node_modules/@chatcode/runtime-client/desktop-history-guard.mjs +65 -0
- package/runtime/node_modules/@chatcode/runtime-client/desktop-history.mjs +278 -0
- package/runtime/node_modules/@chatcode/runtime-client/desktop-permission-gate.mjs +28 -0
- package/runtime/node_modules/@chatcode/runtime-client/execution.mjs +593 -0
- package/runtime/node_modules/@chatcode/runtime-client/index.d.ts +449 -0
- package/runtime/node_modules/@chatcode/runtime-client/model-preferences.mjs +57 -0
- package/runtime/node_modules/@chatcode/runtime-client/package.json +53 -0
- package/runtime/node_modules/@chatcode/runtime-client/runtime-connector.mjs +736 -0
- package/runtime/node_modules/@chatcode/runtime-client/session-activity.mjs +121 -0
- package/runtime/node_modules/@chatcode/runtime-client/session-browser.mjs +122 -0
- package/runtime/node_modules/@chatcode/runtime-client/stdio-bridge.mjs +103 -0
- package/runtime/node_modules/@chatcode/runtime-client/user-questions.mjs +108 -0
- package/runtime/node_modules/@deepseek-ai/cordis-plugin-include/lib/types/journal.d.ts +69 -0
- package/runtime/node_modules/@deepseek-ai/cordis-plugin-include/lib/types/journal.d.ts.map +1 -0
- package/runtime/node_modules/@deepseek-ai/cordis-plugin-include/lib/types/patch.d.ts +68 -0
- package/runtime/node_modules/@deepseek-ai/cordis-plugin-include/lib/types/patch.d.ts.map +1 -0
- package/runtime/node_modules/@deepseek-ai/cordis-plugin-loader/lib/types/resolve.d.ts +9 -0
- package/runtime/node_modules/@deepseek-ai/cordis-plugin-loader/lib/types/resolve.d.ts.map +1 -0
- package/runtime/node_modules/@deepseek-ai/dsh-agent/lib/index.js +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-agent/lib/types/model-selection.d.ts +6 -0
- package/runtime/node_modules/@deepseek-ai/dsh-agent/lib/types/model-selection.js +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-agent/lib/types/runtime-types.d.ts +12 -3
- package/runtime/node_modules/@deepseek-ai/dsh-agent-default-model/lib/index.js +11 -0
- package/runtime/node_modules/@deepseek-ai/dsh-agent-default-model/lib/types/index.d.ts +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-agent-loop/lib/index.js +69 -17
- package/runtime/node_modules/@deepseek-ai/dsh-agent-loop/lib/invariant.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-agent-loop/lib/types/agent.d.ts +3 -1
- package/runtime/node_modules/@deepseek-ai/dsh-agent-loop/lib/types/inbox.d.ts +13 -0
- package/runtime/node_modules/@deepseek-ai/dsh-agent-preset-registry/lib/typert.host.js +5 -5
- package/runtime/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/access.d.ts +40 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-gateway/lib/types/access.js +164 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-remotes/lib/client.js +460 -79
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/index.js +636 -44
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.host.js +483 -55
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.remote-client.d.ts +19 -1
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/typert.remote-client.js +377 -40
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/agent.d.ts +24 -4
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/agent.js +97 -15
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/catalog.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/commands.d.ts +11 -2
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/commands.js +172 -18
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/continuation.d.ts +35 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/continuation.js +48 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/history/assistant-stream.d.ts +43 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/history/assistant-stream.js +80 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/history/controller.d.ts +104 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/history/controller.js +294 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/history/listener.d.ts +105 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/history/listener.js +297 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/history.js +4 -4
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/index.d.ts +88 -1
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/index.js +230 -6
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/login-token-store.d.ts +64 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/login-token-store.js +79 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/state/controller.d.ts +45 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/state/controller.js +289 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/state/listener.d.ts +40 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/state/listener.js +112 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/types.d.ts +93 -1
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/web/controller.d.ts +25 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/web/controller.js +139 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/package.json +9 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-terminal-controller/lib/typert.host.js +5 -5
- package/runtime/node_modules/@deepseek-ai/dsh-api-terminal-controller/lib/types/client/inventory.d.ts +42 -0
- package/runtime/node_modules/@deepseek-ai/dsh-api-terminal-controller/lib/types/client/inventory.js +101 -0
- package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/types/bundle-platform.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/types/startup-diagnostics.d.ts +38 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-connection/lib/types/client/socket.d.ts +50 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-connection/lib/types/connect-protocol.d.ts +6 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-connection/lib/types/peer.d.ts +36 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-file-upload/lib/typert.host.js +5 -5
- package/runtime/node_modules/@deepseek-ai/dsh-client-locale/lib/types/locales/de.d.ts +47 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-locale/lib/types/locales/es.d.ts +47 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-locale/lib/types/locales/fr.d.ts +47 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-locale/lib/types/locales/ja.d.ts +47 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-locale/lib/types/locales/pt.d.ts +47 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-locale/lib/types/locales/ru.d.ts +47 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-modules/lib/types/assets.d.ts +51 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-modules/lib/types/client/notify.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-modules/lib/types/client/release-change.d.ts +44 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/lib/types/client/CreatePluginMenuItem.d.ts +20 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/lib/types/client/analytics.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-approval/lib/types/client/ApprovalCard.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-approval/lib/types/client/ApprovalWarning.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-brand-official/lib/types/client/home-whale/PixelWhale.d.ts +14 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-brand-official/lib/types/client/home-whale/artwork.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-brand-official/lib/types/client/home-whale/code-fill.d.ts +21 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-brand-official/lib/types/client/home-whale/renderer.d.ts +20 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/chat/ChatFlow.d.ts +4 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/chat/ReasoningContent.d.ts +16 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/chat/RunningStatus.d.ts +18 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/chat/RunningWhaleTail.d.ts +6 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/chat/UserContent.d.ts +9 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/chat/flow-motion.d.ts +110 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/chat/text-interaction.d.ts +19 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/chat/text-selection.d.ts +20 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/contract/group-tree.d.ts +32 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/conversation-nodes/group-tree-segments.d.ts +42 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/file-path.d.ts +11 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/client/reasoning-text.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-chat/lib/types/index.d.ts +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-commands/lib/types/client/option-groups.d.ts +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/contract/text-interaction.d.ts +31 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/contract/user-text.d.ts +60 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/conversation/interaction-registry.d.ts +28 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/conversation/user-text-document.d.ts +21 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/conversation/user-text-registry.d.ts +26 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/draft.d.ts +23 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/input/editor/CommandChip.d.ts +13 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/input/editor/QuoteNode.d.ts +61 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/input/editor/command-chip-node.d.ts +87 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/input/editor/command-chip-selection.d.ts +20 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/input/prompt.d.ts +9 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/input/submission-analytics.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/user-text/UserText.d.ts +22 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/user-text/session-reference-rule.d.ts +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/user-text/whitespace-rules.d.ts +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/view-pins.d.ts +22 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/types/client/GoalCommandReference.d.ts +9 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/types/client/user-text-rules.d.ts +21 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/types/client/provider-order.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/lib/types/client/context-menus.d.ts +18 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/lib/types/client/open-toast.d.ts +40 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/lib/types/client/outcome.d.ts +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-open-in-app/lib/types/client/session-open-with.d.ts +14 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/lib/types/client/BundleDetailSection.d.ts +26 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/lib/types/client/PluginRefreshToast.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/lib/types/client/detail-store.d.ts +76 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/lib/types/client/header-scroll.d.ts +14 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/lib/types/client/sanitize-install-input.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/lib/types/client/tab-ledger.d.ts +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-plugin-manager/lib/types/client/versions.d.ts +33 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/AnimatedRows.module.css +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/CommandText.module.css +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/DetailDocument.module.css +67 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/InlineEditor.module.css +23 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/MenuGroup.module.css +37 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/QuotePreview.module.css +101 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/RowDragPreview.module.css +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/UserMessageBubble.module.css +11 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/ZoomControls.module.css +54 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/AnimatedRows.d.ts +49 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/CommandText.d.ts +16 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/DetailDocument.d.ts +78 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/DraggableImage.d.ts +19 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/HoverCardGroup.d.ts +25 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/InlineEditor.d.ts +23 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/MenuGroup.d.ts +22 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/MenuRow.d.ts +37 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/QuotePreview.d.ts +24 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/SubmenuPanel.d.ts +19 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/UserMessageBubble.d.ts +11 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/ZoomControls.d.ts +27 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/document-zoom.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/file-drag-actions.d.ts +32 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/icons/artwork.d.ts +426 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/image-drag.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/markdown/copy-tex.d.ts +14 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/markdown/quote-text.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/markdown/windows-path-destinations.d.ts +11 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/menu-submenu-position.d.ts +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/tooltip-placement.d.ts +35 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/use-clipboard-copy.d.ts +14 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/useMenuSubmenu.d.ts +43 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/useRowDragPreview.d.ts +20 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-reference/lib/types/client/FileReference.d.ts +29 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-reference/lib/types/client/user-text-rules.d.ts +18 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/types/client/NewSessionLimit.d.ts +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/types/client/RuleSelectRow.d.ts +22 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/types/client/ScheduleEmptyIllustration.d.ts +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/types/client/TaskEditorFields.d.ts +54 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/types/client/TaskRuleControls.d.ts +50 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/types/client/clear-ended.d.ts +33 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/types/client/editor-store.d.ts +32 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/types/client/editor-timing.d.ts +47 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-schedule/lib/types/client/task-record.d.ts +30 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/client.js +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/types/client/account-avatar.d.ts +37 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/types/client/browser-login.d.ts +33 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/types/client/notice-transition.d.ts +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/types/index.d.ts +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-account/lib/types/onboarding-settings.d.ts +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/types/client/DesktopChannelRow.d.ts +31 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/types/client/HostReleasePrompt.d.ts +24 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/types/client/desktop-channel-source.d.ts +43 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/types/client/ApiKeyInput.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/types/client/ModelReasoningEfforts.d.ts +43 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/types/client/useModelRows.d.ts +41 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/types/client/PanelIcon.d.ts +9 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/types/client/panel-pins.d.ts +21 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/types/client/scroll-handoff.d.ts +24 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/client.frontmatter-fields.js +5768 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/types/client/PreviewFrame.d.ts +34 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/types/client/image/pan.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/types/client/markdown/frontmatter-fields.d.ts +20 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/types/client/markdown/frontmatter.d.ts +13 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/lib/types/client/FileNavigator.d.ts +33 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/lib/types/client/FileTree.d.ts +114 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/lib/types/client/NavigatorToggle.d.ts +28 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/lib/types/client/navigator-layout.d.ts +6 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-files/lib/types/client/workspace-tree.d.ts +51 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/lib/types/client/shell/TabMenuContent.d.ts +13 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/lib/types/client/shell/flash.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/lib/types/client/tabs/guide/GuideMoreIcon.d.ts +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-right/lib/types/client/tabs/guide/guide-pins.d.ts +28 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-skill/lib/types/client/SkillReference.d.ts +19 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-skill/lib/types/client/user-text-rules.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-subagent/lib/types/client/slots.d.ts +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/types/client/FontFamilyRow.d.ts +19 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/types/client/FontSettingsGroup.d.ts +19 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/types/client/icon-sprite.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/types/client/tool/components/ExitCodeBadge.d.ts +9 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/types/client/tool/components/QuestionToolRow.d.ts +13 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/types/client/tool/file-menu.d.ts +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/types/client/tool/models/recorded-path.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-trajectory/lib/types/client/watch-tool-result.d.ts +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-trajectory/lib/types/types.d.ts +16 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-user-questions/lib/types/client/QuestionReplyView.d.ts +16 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-user-questions/lib/types/client/question-reply.d.ts +74 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/contract/toast.d.ts +67 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/path-suffix.d.ts +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/rows/WorkspaceDialogs.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/session-actions/SessionMenu.d.ts +6 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/session-actions/context-menus.d.ts +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/toast/Toast.d.ts +21 -0
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/toast/register.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-commands/lib/typert.host.js +5 -5
- package/runtime/node_modules/@deepseek-ai/dsh-commands/lib/types/builtin.d.ts +46 -0
- package/runtime/node_modules/@deepseek-ai/dsh-commands/lib/types/builtin.js +39 -0
- package/runtime/node_modules/@deepseek-ai/dsh-compaction-basic/lib/index.js +11 -8
- package/runtime/node_modules/@deepseek-ai/dsh-compaction-basic/lib/types/index.d.ts +3 -1
- package/runtime/node_modules/@deepseek-ai/dsh-cordis-host-runner/lib/typert.host.js +10 -10
- package/runtime/node_modules/@deepseek-ai/dsh-experimental-auto-review/lib/types/locales.d.ts +48 -0
- package/runtime/node_modules/@deepseek-ai/dsh-experimental-client-ui-voice-input/lib/types/client/MicrophonePicker.d.ts +6 -0
- package/runtime/node_modules/@deepseek-ai/dsh-experimental-client-ui-voice-input/lib/types/client/failure-text.d.ts +11 -0
- package/runtime/node_modules/@deepseek-ai/dsh-experimental-client-ui-voice-input/lib/types/client/microphone-device.d.ts +13 -0
- package/runtime/node_modules/@deepseek-ai/dsh-goal/lib/typert.host.js +5 -5
- package/runtime/node_modules/@deepseek-ai/dsh-headless/lib/{json-stream-Bh4BGGk9.js → json-stream-Dc3g2Bl1.js} +11 -7
- package/runtime/node_modules/@deepseek-ai/dsh-hmr/lib/types/module-files.d.ts +48 -0
- package/runtime/node_modules/@deepseek-ai/dsh-hmr/lib/types/package-manifest.d.ts +35 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/index.js +241 -64
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/typert.host.js +26 -11
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/typert.remote-client.js +3 -3
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/call-config.d.ts +19 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/call-config.js +5 -1
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/index.d.ts +30 -6
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/index.js +109 -8
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/message.d.ts +5 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/prompt-protocol-options.d.ts +5 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/prompt-protocol-options.js +32 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm/lib/types/types.d.ts +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/index.js +19 -7
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/config.d.ts +3 -3
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/credential.d.ts +34 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/listed-catalog.d.ts +56 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/listing-cache.d.ts +71 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/listing-config.d.ts +48 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/listing.d.ts +91 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocol-adapter.d.ts +3 -1
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek-account/lib/types/config.d.ts +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek-api-key/lib/types/config.d.ts +2 -2
- package/runtime/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +149 -28
- package/runtime/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/types/adapter.d.ts +3 -1
- package/runtime/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/types/prompt-options.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/types/provider-data.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/types/provider-data.generated.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/types/types.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-mcp-client/lib/types/credentials.d.ts +34 -0
- package/runtime/node_modules/@deepseek-ai/dsh-mcp-client/lib/types/deadline.d.ts +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-mcp-client/lib/types/diagnostic.d.ts +22 -0
- package/runtime/node_modules/@deepseek-ai/dsh-mcp-client/lib/types/generation.d.ts +42 -0
- package/runtime/node_modules/@deepseek-ai/dsh-mcp-client/lib/types/probe.d.ts +37 -0
- package/runtime/node_modules/@deepseek-ai/dsh-mcp-client/lib/types/status.d.ts +87 -0
- package/runtime/node_modules/@deepseek-ai/dsh-mcp-client/lib/types/templates.d.ts +37 -0
- package/runtime/node_modules/@deepseek-ai/dsh-mcp-client/lib/types/types.d.ts +85 -0
- package/runtime/node_modules/@deepseek-ai/dsh-permission-presets/lib/typert.host.js +4 -4
- package/runtime/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/bundle-detail.d.ts +40 -0
- package/runtime/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/bundle-detail.js +85 -0
- package/runtime/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/diagnostic.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/diagnostic.js +72 -0
- package/runtime/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/git-transport.d.ts +27 -0
- package/runtime/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/git-transport.js +65 -0
- package/runtime/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/official-install-target.d.ts +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/official-install-target.js +54 -0
- package/runtime/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/versions.d.ts +40 -0
- package/runtime/node_modules/@deepseek-ai/dsh-plugin-manager/lib/types/versions.js +61 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/config.d.ts +38 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/configuration.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/evaluators/async-function.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/evaluators/index.d.ts +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/evaluators/repl.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/evaluators/types.d.ts +68 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/evaluators/vm-script-await.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/evaluators/vm-script.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/execution.d.ts +66 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/imports/evaluation-ended.d.ts +7 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/imports/module-hooks.d.ts +37 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/imports/vm-modules.d.ts +35 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/persistent-process-entry.d.ts +2 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/persistent-process.d.ts +16 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/policy-processes.d.ts +30 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/rpc.d.ts +13 -0
- package/runtime/node_modules/@deepseek-ai/dsh-ptc-runtime-node/lib/types/worker.d.ts +66 -0
- package/runtime/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/lib/index.js +215 -9
- package/runtime/node_modules/@deepseek-ai/dsh-sandbox/lib/types/locales.d.ts +41 -0
- package/runtime/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/types/acl-skill.d.ts +19 -0
- package/runtime/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/{types-Ci-q7_aQ.js → types-DwkEVVWZ.js} +357 -81
- package/runtime/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-server/lib/types/query-activity.d.ts +43 -0
- package/runtime/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-server/lib/types/query-content.d.ts +21 -0
- package/runtime/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-server/lib/types/query-input.d.ts +12 -0
- package/runtime/node_modules/@deepseek-ai/dsh-sdk-jsonrpc-server/lib/types/user-questions.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-session/lib/index.js +2 -1
- package/runtime/node_modules/@deepseek-ai/dsh-session/lib/types/request-header.js +2 -0
- package/runtime/node_modules/@deepseek-ai/dsh-session/lib/types/types.d.ts +2 -0
- package/runtime/node_modules/@deepseek-ai/dsh-session-log-export/lib/types/client/CopyToast.d.ts +21 -0
- package/runtime/node_modules/@deepseek-ai/dsh-session-log-export/lib/types/client/copy-controller.d.ts +76 -0
- package/runtime/node_modules/@deepseek-ai/dsh-session-log-export/lib/types/markdown.d.ts +22 -0
- package/runtime/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/lib/worker.cjs +197 -9
- package/runtime/node_modules/@deepseek-ai/dsh-session-reference/lib/typert.host.js +5 -5
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/typert.host.js +5 -5
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/types/activation.d.ts +112 -0
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/types/activation.js +112 -0
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/types/manager.d.ts +232 -0
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/types/manager.js +1250 -0
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/types/names.d.ts +56 -0
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/types/names.js +96 -0
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/types/structured.d.ts +49 -0
- package/runtime/node_modules/@deepseek-ai/dsh-subagent/lib/types/structured.js +130 -0
- package/runtime/node_modules/@deepseek-ai/dsh-subprocess-local/lib/types/linux-scope-selector.d.ts +60 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tmux-context/lib/index.js +215 -9
- package/runtime/node_modules/@deepseek-ai/dsh-token-meter/lib/types/measurement-projection.d.ts +74 -0
- package/runtime/node_modules/@deepseek-ai/dsh-token-meter/lib/types/measurement-projection.js +94 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-ask-user/lib/types/timed.d.ts +13 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/api-catalog.js +31 -1
- package/runtime/node_modules/@deepseek-ai/dsh-tool-fs/lib/types/apply-patch-output.d.ts +140 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-fs/lib/types/apply-patch-presentation.d.ts +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-fs/lib/types/apply-patch.d.ts +10 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-fs/lib/types/mutation-result.d.ts +18 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-fs/lib/types/patch/execute.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-fs/lib/types/patch/index.d.ts +17 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-fs/lib/types/patch/plan.d.ts +52 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-fs/lib/types/patch/preflight.d.ts +18 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-fs/lib/types/patch/types.d.ts +106 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-subagent/lib/types/preset-selection.d.ts +36 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-subagent-control/lib/types/wait-agent.d.ts +8 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tool-subagent-control/lib/types/wait-agent.js +104 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tools/lib/types/batch.d.ts +26 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tools/lib/types/batch.js +246 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tools/lib/types/contracts.d.ts +376 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tools/lib/types/contracts.js +51 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tools/lib/types/events.d.ts +58 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tools/lib/types/events.js +2 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tools/lib/types/executor.d.ts +90 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tools/lib/types/executor.js +19 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tools/lib/types/pipeline.d.ts +154 -0
- package/runtime/node_modules/@deepseek-ai/dsh-tools/lib/types/pipeline.js +701 -0
- package/runtime/node_modules/@deepseek-ai/dsh-typert-protocol/lib/types/principal.d.ts +13 -0
- package/runtime/node_modules/@deepseek-ai/dsh-typert-protocol/lib/types/principal.js +15 -0
- package/runtime/node_modules/@deepseek-ai/dsh-typert-protocol/lib/types/remote-access.d.ts +32 -0
- package/runtime/node_modules/@deepseek-ai/dsh-typert-protocol/lib/types/remote-access.js +9 -0
- package/runtime/node_modules/@deepseek-ai/dsh-typert-protocol/lib/types/remote-info.d.ts +21 -0
- package/runtime/node_modules/@deepseek-ai/dsh-typert-protocol/lib/types/remote-info.js +143 -0
- package/runtime/node_modules/@deepseek-ai/dsh-user-questions/lib/types/projection.d.ts +85 -0
- package/runtime/node_modules/@deepseek-ai/dsh-user-questions/lib/types/projection.js +298 -0
- package/runtime/node_modules/@deepseek-ai/dsh-user-questions/lib/types/timed-wait.d.ts +37 -0
- package/runtime/node_modules/@deepseek-ai/dsh-user-questions/lib/types/timed-wait.js +85 -0
- package/runtime/node_modules/@deepseek-ai/dsh-util-time/lib/types/cron.d.ts +54 -0
- package/runtime/node_modules/@deepseek-ai/dsh-util-time/lib/types/duration.d.ts +61 -0
- package/runtime/node_modules/@deepseek-ai/dsh-util-time/lib/types/instant.d.ts +145 -0
- package/runtime/node_modules/@deepseek-ai/dsh-util-time/lib/types/recurrence.d.ts +38 -0
- package/runtime/node_modules/@deepseek-ai/dsh-util-time/lib/types/rrule.d.ts +34 -0
- package/runtime/node_modules/@deepseek-ai/dsh-util-values/lib/types/partial-json.d.ts +152 -0
- package/runtime/node_modules/@deepseek-ai/dsh-web-app/lib/types/public-url.d.ts +16 -0
- package/runtime/node_modules/@deepseek-ai/node-addon-system/lib/.tsbuildinfo +1 -1
- package/lib/dump-config-DuCc-QB7.js +0 -2
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/queue-mirror.d.ts +0 -26
- package/runtime/node_modules/@deepseek-ai/dsh-api-session-controller/lib/types/client/sessions/queue-mirror.js +0 -61
- package/runtime/node_modules/@deepseek-ai/dsh-app-boot/lib/types/watch-config.d.ts +0 -13
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-attachment/lib/types/ImageLightbox.d.ts +0 -27
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/contract/queue.d.ts +0 -9
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/types/client/input/queue-store.d.ts +0 -20
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/types/client/ProducedFiles.d.ts +0 -14
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/types/client/icons.d.ts +0 -8
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/OnboardingSurface.module.css +0 -29
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/types/OnboardingSurface.d.ts +0 -11
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings/lib/types/client/settings-contract.d.ts +0 -86
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings/lib/types/client/settings-scope.d.ts +0 -141
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/types/client/desktop-update-bridge.d.ts +0 -23
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/AgentLoopCard.d.ts +0 -12
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/BashCard.d.ts +0 -12
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/ConfigurablePluginsTab.d.ts +0 -19
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/PluginCard.d.ts +0 -42
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/PluginConfigForm.d.ts +0 -34
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/SubagentCard.d.ts +0 -12
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/SubagentLimitsFields.d.ts +0 -14
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/SubagentModelSelectionCard.d.ts +0 -12
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/SubagentModelSelectionFields.d.ts +0 -14
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/WebSearchCard.d.ts +0 -16
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/agent-loop-card-controller.d.ts +0 -43
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/bash-card-controller.d.ts +0 -45
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/card-form.d.ts +0 -171
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/fields.d.ts +0 -69
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/slot-contract.d.ts +0 -31
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/subagent-card-controller.d.ts +0 -32
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/subagent-limits-card-controller.d.ts +0 -33
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/subagent-model-selection-card-controller.d.ts +0 -129
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/tab-store.d.ts +0 -65
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/types/client/web-search-card-controller.d.ts +0 -93
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/types/client/code/languages.d.ts +0 -9
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/types/client/icons.d.ts +0 -14
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-documentpreview/lib/types/client/pdf/PdfBody.d.ts +0 -24
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-sidebar-terminal/lib/types/client/TerminalBody.d.ts +0 -14
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-subagent/lib/types/client/subagent-lineage.d.ts +0 -21
- package/runtime/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/types/client/subagent-lineage.d.ts +0 -21
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/defaults.d.ts +0 -24
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/file-id.d.ts +0 -19
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/file-store.d.ts +0 -86
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/files-api.d.ts +0 -111
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/image-tokens.d.ts +0 -34
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/messages-api.d.ts +0 -10
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/model-info.d.ts +0 -16
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/models.d.ts +0 -4
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/request-extensions.d.ts +0 -16
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/request-files.d.ts +0 -49
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/request-pricing.d.ts +0 -60
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/types.d.ts +0 -119
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/common/upload-index.d.ts +0 -68
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/chat-completions/adapter.d.ts +0 -45
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/chat-completions/serialize.d.ts +0 -78
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/chat-completions/sse.d.ts +0 -24
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/chat-completions/translate.d.ts +0 -37
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/chat-completions/types.d.ts +0 -178
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/messages/adapter.d.ts +0 -47
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/messages/images.d.ts +0 -35
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/messages/replay.d.ts +0 -27
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/messages/serialize.d.ts +0 -18
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/messages/sse.d.ts +0 -8
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/messages/translate.d.ts +0 -14
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/messages/transport.d.ts +0 -15
- package/runtime/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/types/protocols/messages/types.d.ts +0 -62
- package/runtime/node_modules/@deepseek-ai/dsh-schedule/lib/types/persistence.d.ts +0 -19
- package/runtime/node_modules/@deepseek-ai/dsh-schedule/lib/types/persistence.js +0 -30
- package/runtime/node_modules/@deepseek-ai/dsh-schedule/lib/types/projection.d.ts +0 -35
- package/runtime/node_modules/@deepseek-ai/dsh-schedule/lib/types/projection.js +0 -68
- package/runtime/node_modules/@deepseek-ai/dsh-schedule/lib/types/transaction.d.ts +0 -10
- package/runtime/node_modules/@deepseek-ai/dsh-schedule/lib/types/transaction.js +0 -22
- package/runtime/node_modules/@deepseek-ai/dsh-settings/lib/types/invariant.d.ts +0 -16
- package/runtime/node_modules/@deepseek-ai/dsh-settings/lib/types/invariant.js +0 -41
- package/runtime/node_modules/@deepseek-ai/dsh-subprocess-local/lib/runner-launch-DGV26RBf.js +0 -1525
- package/runtime/node_modules/@deepseek-ai/dsh-subprocess-local/lib/runner-launch-UEJ3Ntqn.js +0 -1511
- package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/fiber-state.d.ts +0 -28
- package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/fiber-state.js +0 -25
- package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/inspect.d.ts +0 -93
- package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/inspect.js +0 -303
- package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/prompt.d.ts +0 -3
- package/runtime/node_modules/@deepseek-ai/dsh-tool-cordis/lib/types/prompt.js +0 -5
- package/lib/{plugin-d65VulBk.js → plugin-BccFcAte.js} +1 -1
|
@@ -0,0 +1,736 @@
|
|
|
1
|
+
/** Node client for the chatcode-cli 3.0.3 Web Session protocol. */
|
|
2
|
+
import { spawn } from 'node:child_process'
|
|
3
|
+
import { randomUUID } from 'node:crypto'
|
|
4
|
+
import { once } from 'node:events'
|
|
5
|
+
import { mkdir } from 'node:fs/promises'
|
|
6
|
+
import { request as nodeRequest } from 'node:http'
|
|
7
|
+
import { resolve } from 'node:path'
|
|
8
|
+
import { isDeepStrictEqual } from 'node:util'
|
|
9
|
+
import WebSocket from 'ws'
|
|
10
|
+
import { readWorkspaceBaseline, readSessionSummaries, chronological, workspaceSessionTree } from './session-browser.mjs'
|
|
11
|
+
export { AccountModelPreferences } from './model-preferences.mjs'
|
|
12
|
+
export { DesktopHistoryHost, createDesktopHistoryClient } from './desktop-history.mjs'
|
|
13
|
+
|
|
14
|
+
async function bounded(promise, timeoutMs, label) {
|
|
15
|
+
let timer
|
|
16
|
+
try {
|
|
17
|
+
return await Promise.race([promise, new Promise((_, reject) => {
|
|
18
|
+
timer = setTimeout(() => reject(new Error(`${label} timed out`)), timeoutMs)
|
|
19
|
+
})])
|
|
20
|
+
} finally { clearTimeout(timer) }
|
|
21
|
+
}
|
|
22
|
+
function failure(message, code, details) {
|
|
23
|
+
return Object.assign(new Error(message), { code, details })
|
|
24
|
+
}
|
|
25
|
+
function redact(text) { return text.replace(/([?&]token=)[^\s&]+/gu, '$1[redacted]') }
|
|
26
|
+
|
|
27
|
+
const APP_ID_HEADER = 'x-chatcode-app-id'
|
|
28
|
+
const APP_SECRET_HEADER = 'x-chatcode-app-secret'
|
|
29
|
+
const APP_AUTHENTICATED_HEADER = 'x-chatcode-app-authenticated'
|
|
30
|
+
|
|
31
|
+
/** Owns one public-profile Runtime and one multiplexed WebSocket. */
|
|
32
|
+
export class RuntimeConnector {
|
|
33
|
+
#child
|
|
34
|
+
#exit
|
|
35
|
+
#starting
|
|
36
|
+
#closed = false
|
|
37
|
+
#closing
|
|
38
|
+
#origin
|
|
39
|
+
#cookie
|
|
40
|
+
#appCredentials
|
|
41
|
+
#socket
|
|
42
|
+
#connecting
|
|
43
|
+
#reconnecting
|
|
44
|
+
#failed
|
|
45
|
+
#requests = new Map()
|
|
46
|
+
#prompts = new Map()
|
|
47
|
+
#promptModelConfig
|
|
48
|
+
#followers = new Map()
|
|
49
|
+
#interactionClientId
|
|
50
|
+
#pendingInteractions = new Map()
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Configure one owned public-profile subprocess.
|
|
54
|
+
* @param options - Paths, overlays, child environment, application credentials, deadlines, and state callback.
|
|
55
|
+
*/
|
|
56
|
+
constructor(options) {
|
|
57
|
+
if (!options.nodePath || !options.launcherPath || !options.home) {
|
|
58
|
+
throw new Error('nodePath, launcherPath and home are required')
|
|
59
|
+
}
|
|
60
|
+
const { appCredentials, ...launchOptions } = options
|
|
61
|
+
if (appCredentials !== undefined) {
|
|
62
|
+
const { appId, secret } = appCredentials ?? {}
|
|
63
|
+
if (typeof appId !== 'string' || !appId || appId.length > 128 || /[^\x21-\x7e]/u.test(appId)
|
|
64
|
+
|| typeof secret !== 'string' || !secret || secret.length > 1024 || /[^\x21-\x7e]/u.test(secret)) {
|
|
65
|
+
throw failure('Application credentials require a valid appId and secret', 'runtime/app-credentials')
|
|
66
|
+
}
|
|
67
|
+
this.#appCredentials = { appId, secret }
|
|
68
|
+
}
|
|
69
|
+
this.options = {
|
|
70
|
+
startupTimeoutMs: 20000, requestTimeoutMs: 10000,
|
|
71
|
+
shutdownTimeoutMs: 10000, socketTimeoutMs: 10000, childReadyTimeoutMs: 1000,
|
|
72
|
+
...launchOptions, home: resolve(options.home), launcherPath: resolve(options.launcherPath),
|
|
73
|
+
}
|
|
74
|
+
if (!Number.isFinite(this.options.childReadyTimeoutMs) || this.options.childReadyTimeoutMs < 0)
|
|
75
|
+
throw new TypeError('childReadyTimeoutMs must be finite and nonnegative')
|
|
76
|
+
}
|
|
77
|
+
#state(type, error) {
|
|
78
|
+
this.#notify(this.options.onState, { type, ...(error ? { error } : {}) })
|
|
79
|
+
}
|
|
80
|
+
#notify(listener, value) {
|
|
81
|
+
try { listener?.(value) } catch (error) { console.error('RuntimeConnector listener failed', error) }
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Start once; subsequent calls reuse the same process and authentication.
|
|
86
|
+
* @returns Ready when the Runtime issues a cookie and confirms configured application credentials.
|
|
87
|
+
*/
|
|
88
|
+
start() {
|
|
89
|
+
if (this.#closed) return Promise.reject(new Error('Connector is closed; create a new instance'))
|
|
90
|
+
if (this.#failed) return Promise.reject(this.#failed)
|
|
91
|
+
if (this.#starting) return this.#starting
|
|
92
|
+
this.#starting = Promise.resolve().then(() => this.#boot()).catch(async error => {
|
|
93
|
+
this.#state('failed', error)
|
|
94
|
+
await this.close()
|
|
95
|
+
throw error
|
|
96
|
+
})
|
|
97
|
+
return this.#starting
|
|
98
|
+
}
|
|
99
|
+
async #boot() {
|
|
100
|
+
const options = this.options
|
|
101
|
+
const credentials = this.#appCredentials
|
|
102
|
+
await mkdir(options.home, { recursive: true })
|
|
103
|
+
if (this.#closed) throw new Error('Connector closed during startup')
|
|
104
|
+
this.#state('starting')
|
|
105
|
+
this.#assertActive()
|
|
106
|
+
const env = { ...(options.env ?? process.env), CHATCODE_CLI_HOME: options.home }
|
|
107
|
+
// The external Node process must not inherit Electron Node mode.
|
|
108
|
+
delete env.ELECTRON_RUN_AS_NODE
|
|
109
|
+
const child = spawn(options.nodePath, [options.launcherPath, '--profile', 'web',
|
|
110
|
+
...(options.patches ?? []).flatMap(path => ['--patch', resolve(path)]),
|
|
111
|
+
'--no-open', '--host', '127.0.0.1', '--port', '0',
|
|
112
|
+
], { cwd: options.processCwd ?? options.home, env, stdio: ['ignore', 'pipe', 'pipe'] })
|
|
113
|
+
this.#child = child
|
|
114
|
+
const ready = Promise.withResolvers()
|
|
115
|
+
let logs = ''
|
|
116
|
+
const readLines = () => {
|
|
117
|
+
let pending = ''
|
|
118
|
+
return text => {
|
|
119
|
+
logs = (logs + text).slice(-65536)
|
|
120
|
+
pending += text
|
|
121
|
+
let cut
|
|
122
|
+
while ((cut = pending.indexOf('\n')) >= 0) {
|
|
123
|
+
const line = pending.slice(0, cut).replace(/\r$/u, '')
|
|
124
|
+
pending = pending.slice(cut + 1)
|
|
125
|
+
const match = line.match(/^(?:chatcode-cli|cco) web: (http:\/\/[^\s\u001b]+)/u)
|
|
126
|
+
if (match) ready.resolve(match[1])
|
|
127
|
+
}
|
|
128
|
+
if (pending.length > 65536) ready.reject(new Error('Runtime startup line exceeds 64 KiB'))
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
child.stdout.setEncoding('utf8').on('data', readLines())
|
|
132
|
+
child.stderr.setEncoding('utf8').on('data', readLines())
|
|
133
|
+
child.on('error', ready.reject)
|
|
134
|
+
this.#exit = new Promise(resolveExit => child.once('close', (code, signal) => {
|
|
135
|
+
const safeLogs = credentials ? logs.replaceAll(credentials.secret, '[redacted]') : logs
|
|
136
|
+
const error = failure(`Runtime exited (${code}/${signal}): ${redact(safeLogs)}`, 'runtime/exited')
|
|
137
|
+
ready.reject(error)
|
|
138
|
+
if (!this.#closed) {
|
|
139
|
+
this.#failed = error
|
|
140
|
+
this.#state('failed', error)
|
|
141
|
+
this.#socket?.terminate()
|
|
142
|
+
}
|
|
143
|
+
resolveExit({ code, signal })
|
|
144
|
+
}))
|
|
145
|
+
const launchURL = new URL(await bounded(ready.promise, options.startupTimeoutMs, 'Runtime startup'))
|
|
146
|
+
if (launchURL.protocol !== 'http:' || launchURL.hostname !== '127.0.0.1') {
|
|
147
|
+
throw new Error('Runtime reported an unexpected non-loopback URL')
|
|
148
|
+
}
|
|
149
|
+
const auth = await this.#http(launchURL, undefined, credentials && {
|
|
150
|
+
[APP_ID_HEADER]: credentials.appId,
|
|
151
|
+
[APP_SECRET_HEADER]: credentials.secret,
|
|
152
|
+
})
|
|
153
|
+
if (credentials && (auth.status === 401 || auth.status === 403)) {
|
|
154
|
+
throw failure('Runtime rejected application authentication', 'runtime/app-auth')
|
|
155
|
+
}
|
|
156
|
+
if (auth.status !== 303 || !auth.headers['set-cookie']?.length) throw failure('Host authentication failed', 'runtime/auth')
|
|
157
|
+
if (credentials && auth.headers[APP_AUTHENTICATED_HEADER] !== '1') {
|
|
158
|
+
throw failure('Runtime did not confirm application authentication', 'runtime/app-auth-unsupported')
|
|
159
|
+
}
|
|
160
|
+
this.#cookie = auth.headers['set-cookie'].map(value => value.split(';')[0]).join('; ')
|
|
161
|
+
this.#origin = launchURL.origin
|
|
162
|
+
if (this.#closed || child.exitCode !== null || child.signalCode !== null) throw new Error('Runtime stopped during startup')
|
|
163
|
+
this.#state('ready')
|
|
164
|
+
this.#assertActive()
|
|
165
|
+
}
|
|
166
|
+
#assertActive() {
|
|
167
|
+
if (this.#closed) throw failure('Connector closed', 'runtime/closed')
|
|
168
|
+
if (this.#failed) throw this.#failed
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async #http(url, body, appAuthHeaders) {
|
|
172
|
+
this.#assertActive()
|
|
173
|
+
return await new Promise((resolveResponse, reject) => {
|
|
174
|
+
const bytes = body === undefined ? undefined : Buffer.from(JSON.stringify(body))
|
|
175
|
+
const req = nodeRequest(url, {
|
|
176
|
+
method: bytes ? 'POST' : 'GET',
|
|
177
|
+
...(appAuthHeaders ? { agent: false } : {}),
|
|
178
|
+
headers: {
|
|
179
|
+
...appAuthHeaders,
|
|
180
|
+
...(this.#cookie ? { cookie: this.#cookie } : {}),
|
|
181
|
+
...(bytes ? { 'content-type': 'application/json', 'content-length': bytes.length } : {}),
|
|
182
|
+
},
|
|
183
|
+
}, res => {
|
|
184
|
+
const chunks = []
|
|
185
|
+
res.on('data', chunk => chunks.push(chunk))
|
|
186
|
+
res.on('error', reject)
|
|
187
|
+
res.on('aborted', () => reject(new Error('HTTP response aborted')))
|
|
188
|
+
res.on('end', () => resolveResponse({ status: res.statusCode, headers: res.headers, text: Buffer.concat(chunks).toString('utf8') }))
|
|
189
|
+
})
|
|
190
|
+
req.on('error', reject)
|
|
191
|
+
// Abort the underlying request as well as bounding the caller's wait.
|
|
192
|
+
const timer = setTimeout(() => req.destroy(new Error('Runtime HTTP request timed out')), this.options.requestTimeoutMs)
|
|
193
|
+
const closed = new Promise(resolveClosed => req.once('close', () => {
|
|
194
|
+
clearTimeout(timer)
|
|
195
|
+
this.#requests.delete(req)
|
|
196
|
+
resolveClosed()
|
|
197
|
+
}))
|
|
198
|
+
this.#requests.set(req, closed)
|
|
199
|
+
req.end(bytes)
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
async #rpc(method, request) {
|
|
203
|
+
return this.#rpcArgs(method, { request })
|
|
204
|
+
}
|
|
205
|
+
async #rpcArgs(method, args) {
|
|
206
|
+
await this.start()
|
|
207
|
+
this.#assertActive()
|
|
208
|
+
const rpcId = randomUUID()
|
|
209
|
+
const response = await this.#http(new URL(`/api/${method}`, this.#origin), {
|
|
210
|
+
type: 'client-request', rpcId, method, payload: { args },
|
|
211
|
+
})
|
|
212
|
+
if (response.status !== 200) throw failure(`Host returned HTTP ${response.status}`, 'runtime/http')
|
|
213
|
+
const message = JSON.parse(response.text)
|
|
214
|
+
if (message.type !== 'server-response' || message.rpcId !== rpcId || typeof message.result?.ok !== 'boolean') {
|
|
215
|
+
throw failure('Invalid correlated RPC response', 'runtime/protocol')
|
|
216
|
+
}
|
|
217
|
+
if (!message.result.ok) {
|
|
218
|
+
const { code, message: text, details } = message.result.error
|
|
219
|
+
throw failure(text, code, details)
|
|
220
|
+
}
|
|
221
|
+
return message.result.value
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* With sessionId, restore that Session instead of minting a new one.
|
|
226
|
+
* @param request - Absolute workspace and optional persisted Session identity.
|
|
227
|
+
* @returns The Runtime-owned Session identity.
|
|
228
|
+
*/
|
|
229
|
+
/** Read safe model names and routes from the live Runtime registry. */
|
|
230
|
+
modelCatalog(options = {}) { return this.#rpcArgs(options.refresh ? 'session/refreshModelCatalog' : 'session/modelCatalog', {}) }
|
|
231
|
+
/** Select an available route for the next request on the same Session. */
|
|
232
|
+
selectModel(request) { return this.#rpc('session/selectModel', request) }
|
|
233
|
+
permissionCatalog() { return this.#rpcArgs('permissionPresets/catalog', {}) }
|
|
234
|
+
getWorkspaceAccess(sessionId) { return this.#rpc('session/workspaceAccess', { sessionId }) }
|
|
235
|
+
setWorkspaceAccess(request) { return this.#rpc('session/setWorkspaceAccess', request) }
|
|
236
|
+
/**
|
|
237
|
+
* Read the tools visible to this Session's actual Agent scope.
|
|
238
|
+
* @param sessionId - existing Session identity.
|
|
239
|
+
* @returns enabled tool names and descriptions without executing them.
|
|
240
|
+
*/
|
|
241
|
+
toolCatalog(sessionId) { return this.#rpc('session/toolCatalog', { sessionId }) }
|
|
242
|
+
/** Register an existing directory as a durable Workspace, idempotently by path. */
|
|
243
|
+
async createWorkspace(request) {
|
|
244
|
+
const value = await this.#rpc('workspace/create', request)
|
|
245
|
+
return { workspace: readWorkspaceBaseline({ items: [value.workspace], archivedSessionIds: [], pinnedSessionIds: [] }).items[0], created: value.created }
|
|
246
|
+
}
|
|
247
|
+
/** Read a complete Workspace baseline, then release this temporary subscription. */
|
|
248
|
+
async #workspaceBaseline(signal) {
|
|
249
|
+
let baseline
|
|
250
|
+
const off = await this.followWorkspaces(frame => { if (frame.type === 'baseline') baseline = readWorkspaceBaseline(frame.value) }, undefined, signal)
|
|
251
|
+
off()
|
|
252
|
+
if (!baseline) throw failure('Workspace baseline unavailable', 'runtime/protocol')
|
|
253
|
+
return baseline
|
|
254
|
+
}
|
|
255
|
+
/** List registered Workspaces in timestamp order, without activating Sessions. */
|
|
256
|
+
async listWorkspaces(options = {}) {
|
|
257
|
+
const baseline = await this.#workspaceBaseline(options.signal)
|
|
258
|
+
options.signal?.throwIfAborted()
|
|
259
|
+
return chronological(baseline.items, options.order ?? 'desc', row => row.workspaceId, row => row.updatedAt)
|
|
260
|
+
}
|
|
261
|
+
/** List workspace groups and Session summaries with deterministic time ordering. */
|
|
262
|
+
async listWorkspaceSessions(options = {}) {
|
|
263
|
+
options.signal?.throwIfAborted()
|
|
264
|
+
const [baseline, value] = await Promise.all([this.#workspaceBaseline(options.signal), this.#rpcArgs('session/list', { _request: {} })])
|
|
265
|
+
options.signal?.throwIfAborted()
|
|
266
|
+
return workspaceSessionTree(baseline, readSessionSummaries(value), options)
|
|
267
|
+
}
|
|
268
|
+
/** List ordinary Sessions, optionally restricting to one authoritative Workspace. */
|
|
269
|
+
async listSessions(options = {}) {
|
|
270
|
+
const tree = await this.listWorkspaceSessions(options)
|
|
271
|
+
if (options.workspaceId !== undefined) {
|
|
272
|
+
const group = tree.items.find(row => row.workspaceId === options.workspaceId)
|
|
273
|
+
if (!group) throw failure('Workspace not found', 'workspace/not-found', { workspaceId: options.workspaceId })
|
|
274
|
+
return group.sessions
|
|
275
|
+
}
|
|
276
|
+
return chronological([...tree.items.flatMap(row => row.sessions), ...tree.unassignedSessions],
|
|
277
|
+
options.order ?? 'desc', row => row.sessionId, row => row.updatedAt)
|
|
278
|
+
}
|
|
279
|
+
/** Restore an existing ordinary Session; a missing identity must never create a new Session. */
|
|
280
|
+
async resumeSession(request) {
|
|
281
|
+
if (typeof request.sessionId !== 'string' || !request.sessionId) throw new TypeError('sessionId is required to resume')
|
|
282
|
+
if (request.cwd === undefined && request.workspaceId === undefined
|
|
283
|
+
&& (request.provider !== undefined || request.model !== undefined)) {
|
|
284
|
+
return this.#rpc('session/resume', { sessionId: request.sessionId, provider: request.provider, model: request.model })
|
|
285
|
+
}
|
|
286
|
+
let location = request
|
|
287
|
+
if (request.workspaceId === undefined && request.cwd === undefined) {
|
|
288
|
+
const rows = await this.listSessions({ includeArchived: true })
|
|
289
|
+
const saved = rows.find(row => row.sessionId === request.sessionId)
|
|
290
|
+
if (!saved?.cwd) throw failure('Session not found', 'session/not-found', { sessionId: request.sessionId })
|
|
291
|
+
location = { ...request, cwd: saved.cwd }
|
|
292
|
+
}
|
|
293
|
+
return this.#rpc('session/create', { ...location, resumeOnly: true })
|
|
294
|
+
}
|
|
295
|
+
createSession(request) { return this.#rpc('session/create', request) }
|
|
296
|
+
/**
|
|
297
|
+
* Confirm this Runtime supports request-local prompt model configuration.
|
|
298
|
+
* @param options - require support for prompt API keys or unified model options.
|
|
299
|
+
* @returns A promise that rejects when the requested capability is unavailable.
|
|
300
|
+
*/
|
|
301
|
+
async assertPromptModelConfig(options = {}) {
|
|
302
|
+
const capability = await (this.#promptModelConfig ??= this.#rpcArgs('session/promptModelConfig', {}).then(value => {
|
|
303
|
+
if (value?.version !== 1) throw failure('Runtime does not support prompt model configuration', 'runtime/model-config-unsupported')
|
|
304
|
+
return value
|
|
305
|
+
}).catch(error => {
|
|
306
|
+
this.#promptModelConfig = undefined
|
|
307
|
+
if (error.code === 'gateway/method-unavailable' || error.code === 'gateway/invocation-unavailable') {
|
|
308
|
+
throw failure('Runtime does not support prompt model configuration', 'runtime/model-config-unsupported')
|
|
309
|
+
}
|
|
310
|
+
throw error
|
|
311
|
+
}))
|
|
312
|
+
if (options.apiKey && capability.requestApiKey !== true) {
|
|
313
|
+
throw failure('Runtime does not support API keys supplied with prompts', 'runtime/model-config-unsupported')
|
|
314
|
+
}
|
|
315
|
+
if (options.unifiedOptions && capability.unifiedOptions !== true) {
|
|
316
|
+
throw failure('Runtime does not support unified prompt model options', 'runtime/model-config-unsupported')
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Retain requestId when retrying an uncertain submission.
|
|
321
|
+
* @param request - Session, stable input identity, submission mode, and new user content.
|
|
322
|
+
* @returns Admission rather than turn completion.
|
|
323
|
+
*/
|
|
324
|
+
prompt(request) {
|
|
325
|
+
const key = JSON.stringify([request.sessionId, request.requestId])
|
|
326
|
+
const configured = request.modelConfig !== undefined
|
|
327
|
+
let payload
|
|
328
|
+
let wire
|
|
329
|
+
if (configured) {
|
|
330
|
+
try {
|
|
331
|
+
const config = request.modelConfig
|
|
332
|
+
const serialized = JSON.stringify(config)
|
|
333
|
+
if (config === null || typeof config !== 'object' || Array.isArray(config)
|
|
334
|
+
|| Buffer.byteLength(serialized) > 16384
|
|
335
|
+
|| !isDeepStrictEqual(config, JSON.parse(serialized))) throw new TypeError()
|
|
336
|
+
payload = JSON.stringify(request)
|
|
337
|
+
wire = JSON.parse(payload)
|
|
338
|
+
} catch (error) {
|
|
339
|
+
return Promise.reject(failure('modelConfig must be a JSON object of at most 16 KiB', 'runtime/invalid-request'))
|
|
340
|
+
}
|
|
341
|
+
} else {
|
|
342
|
+
payload = JSON.stringify(request)
|
|
343
|
+
wire = JSON.parse(payload)
|
|
344
|
+
}
|
|
345
|
+
const existing = this.#prompts.get(key)
|
|
346
|
+
if (existing) {
|
|
347
|
+
if (existing.payload !== payload && !isDeepStrictEqual(existing.wire, wire)) return Promise.reject(failure('A pending requestId was reused with different content', 'runtime/request-id-conflict'))
|
|
348
|
+
return existing.promise
|
|
349
|
+
}
|
|
350
|
+
const submit = () => this.#rpc('session/prompt', wire)
|
|
351
|
+
const promise = (configured ? this.assertPromptModelConfig({ apiKey: wire.modelConfig.apiKey !== undefined }).then(submit) : submit()).finally(() => this.#prompts.delete(key))
|
|
352
|
+
this.#prompts.set(key, { payload, wire, promise })
|
|
353
|
+
return promise
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Stop the active turn, preserving this Runtime and its Session.
|
|
357
|
+
* @param sessionId - Runtime-owned Session identity.
|
|
358
|
+
* @returns Cancellation admission.
|
|
359
|
+
*/
|
|
360
|
+
cancel(sessionId) { return this.#rpc('session/cancel', { sessionId }) }
|
|
361
|
+
/**
|
|
362
|
+
* Release one idle Session's native writer while retaining the shared Runtime.
|
|
363
|
+
* @param sessionId - owned ordinary Session identity.
|
|
364
|
+
* @returns acknowledgement after the Agent and persistence handle close.
|
|
365
|
+
*/
|
|
366
|
+
releaseSession(sessionId) { return this.#rpc('session/release', { sessionId }) }
|
|
367
|
+
/**
|
|
368
|
+
* Inject a ChatCode OAuth grant into the Runtime credentials service.
|
|
369
|
+
* The grant is persisted to the credentials store using the same key as
|
|
370
|
+
* ChatCodeAuthService, so the auth bundle reads it automatically.
|
|
371
|
+
* Token expiry is detected by API 401 responses — the LLM adapter returns API 401 naturally.
|
|
372
|
+
* @param request - ChatCode OAuth grant fields.
|
|
373
|
+
* @returns confirmation.
|
|
374
|
+
*/
|
|
375
|
+
setLoginToken(request) {
|
|
376
|
+
if (!request || typeof request.accessToken !== 'string' || !request.accessToken) {
|
|
377
|
+
return Promise.reject(failure('accessToken is required', 'runtime/invalid-request'))
|
|
378
|
+
}
|
|
379
|
+
return this.#rpc('session/setLoginToken', request)
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Remove the ChatCode OAuth token from the Runtime credentials service.
|
|
383
|
+
* @returns confirmation.
|
|
384
|
+
*/
|
|
385
|
+
clearLoginToken() {
|
|
386
|
+
return this.#rpc('session/clearLoginToken', {})
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Read earlier history using the cut from a follow snapshot.
|
|
390
|
+
* @param request - Address, inclusive snapshot cut, and optional backward cursor.
|
|
391
|
+
* @returns A history page with its remaining-history flag.
|
|
392
|
+
*/
|
|
393
|
+
page(request) { return this.#rpc('session/page', request) }
|
|
394
|
+
|
|
395
|
+
async #connect() {
|
|
396
|
+
this.#assertActive()
|
|
397
|
+
if (this.#socket?.readyState === WebSocket.OPEN) return
|
|
398
|
+
if (this.#connecting) return this.#connecting
|
|
399
|
+
const connection = (async () => {
|
|
400
|
+
await this.start()
|
|
401
|
+
this.#assertActive()
|
|
402
|
+
const socket = new WebSocket(this.#origin.replace('http:', 'ws:') + '/api/remote.mux', {
|
|
403
|
+
headers: { cookie: this.#cookie, origin: this.#origin },
|
|
404
|
+
handshakeTimeout: this.options.socketTimeoutMs,
|
|
405
|
+
})
|
|
406
|
+
this.#socket = socket
|
|
407
|
+
socket.on('error', () => {}) // once(open) rejects; later close publishes transport loss.
|
|
408
|
+
socket.on('message', data => {
|
|
409
|
+
if (this.#socket !== socket) return
|
|
410
|
+
try { this.#receive(JSON.parse(data.toString('utf8'))) }
|
|
411
|
+
catch (error) { this.#state('protocol-error', error); socket.terminate() }
|
|
412
|
+
})
|
|
413
|
+
socket.on('close', () => {
|
|
414
|
+
if (this.#socket !== socket) return
|
|
415
|
+
this.#socket = undefined
|
|
416
|
+
this.#resetInteractions('transport-lost')
|
|
417
|
+
const error = failure('Session stream disconnected', 'runtime/disconnected')
|
|
418
|
+
for (const follower of this.#followers.values()) follower.opening?.reject(error)
|
|
419
|
+
if (!this.#closed && !this.#failed) this.#state('disconnected', error)
|
|
420
|
+
})
|
|
421
|
+
try {
|
|
422
|
+
await bounded(once(socket, 'open'), this.options.socketTimeoutMs, 'WebSocket open')
|
|
423
|
+
this.#assertActive()
|
|
424
|
+
if (this.#socket !== socket) throw failure('WebSocket replaced during opening', 'runtime/disconnected')
|
|
425
|
+
for (const [streamId, follower] of this.#followers) this.#open(streamId, follower)
|
|
426
|
+
} catch (error) { socket.terminate(); throw error }
|
|
427
|
+
})()
|
|
428
|
+
this.#connecting = connection
|
|
429
|
+
try { await connection } finally { if (this.#connecting === connection) this.#connecting = undefined }
|
|
430
|
+
}
|
|
431
|
+
#open(streamId, follower) {
|
|
432
|
+
if (this.#socket?.readyState !== WebSocket.OPEN) throw failure('Stream is not connected', 'runtime/disconnected')
|
|
433
|
+
follower.opening?.reject(failure('Subscription opening replaced', 'runtime/disconnected'))
|
|
434
|
+
follower.opening = Promise.withResolvers()
|
|
435
|
+
void follower.opening.promise.catch(() => {})
|
|
436
|
+
follower.baseline = false
|
|
437
|
+
follower.cursor = undefined
|
|
438
|
+
follower.revision = undefined
|
|
439
|
+
this.#socket.send(JSON.stringify({
|
|
440
|
+
type: 'open', streamId, endpoint: follower.kind === 'interactions' ? '$events' : follower.kind === 'workspaces' ? 'workspace/follow' : 'session/follow',
|
|
441
|
+
payload: follower.kind === 'interactions' || follower.kind === 'workspaces' ? { args: {} } : { args: { request: { address: follower.address, assistantStream: true } } },
|
|
442
|
+
}))
|
|
443
|
+
}
|
|
444
|
+
#disposeFollower(streamId, error) {
|
|
445
|
+
const follower = this.#followers.get(streamId)
|
|
446
|
+
if (!follower) return
|
|
447
|
+
this.#followers.delete(streamId)
|
|
448
|
+
if (follower.kind === 'interactions') this.#resetInteractions('subscription-closed')
|
|
449
|
+
follower.signal?.removeEventListener('abort', follower.onAbort)
|
|
450
|
+
if (error) follower.opening?.reject(error)
|
|
451
|
+
else follower.opening?.resolve() // An unsubscribe removes this Session from a reconnect's snapshot wait.
|
|
452
|
+
if (this.#socket?.readyState === WebSocket.OPEN) this.#socket.send(JSON.stringify({ type: 'cancel', streamId }))
|
|
453
|
+
}
|
|
454
|
+
#receive(message) {
|
|
455
|
+
const follower = this.#followers.get(message.streamId)
|
|
456
|
+
if (!follower) return
|
|
457
|
+
if (message.type === 'error' || message.type === 'end') {
|
|
458
|
+
const remote = message.error
|
|
459
|
+
const error = remote ? failure(remote.message, remote.code, remote.details) : new Error('Session follow ended')
|
|
460
|
+
follower.opening.reject(error)
|
|
461
|
+
this.#disposeFollower(message.streamId, error)
|
|
462
|
+
this.#notify(follower.onFailure, error)
|
|
463
|
+
return
|
|
464
|
+
}
|
|
465
|
+
if (message.type !== 'item') throw new Error('Unknown stream carrier message')
|
|
466
|
+
const frame = message.value
|
|
467
|
+
if (follower.kind === 'interactions') return this.#receiveInteraction(follower, frame)
|
|
468
|
+
if (follower.kind === 'workspaces') {
|
|
469
|
+
if (frame?.type === 'baseline') readWorkspaceBaseline(frame.value)
|
|
470
|
+
else if (!follower.baseline || !['upsert', 'remove', 'order', 'archived', 'pinned'].includes(frame?.type))
|
|
471
|
+
throw failure('Invalid Workspace stream frame', 'runtime/protocol')
|
|
472
|
+
if (frame.type === 'baseline') follower.baseline = true
|
|
473
|
+
this.#notify(follower.onFrame, frame)
|
|
474
|
+
if (frame.type === 'baseline') follower.opening.resolve(frame)
|
|
475
|
+
return
|
|
476
|
+
}
|
|
477
|
+
if (frame?.type === 'snapshot') {
|
|
478
|
+
if (!Number.isSafeInteger(frame.cursor) || !Number.isSafeInteger(frame.assistantStream?.revision)) throw new Error('Invalid opening snapshot')
|
|
479
|
+
follower.cursor = frame.cursor
|
|
480
|
+
follower.revision = frame.assistantStream.revision
|
|
481
|
+
} else if (frame?.type === 'event') {
|
|
482
|
+
const seq = frame.event?.seq
|
|
483
|
+
if (!Number.isSafeInteger(seq) || follower.cursor === undefined) throw new Error('Invalid event sequence')
|
|
484
|
+
if (seq <= follower.cursor) return
|
|
485
|
+
if (seq !== follower.cursor + 1) throw new Error('Durable event sequence gap; reconnect to rebaseline')
|
|
486
|
+
follower.cursor = seq
|
|
487
|
+
} else if (frame?.type === 'assistant-stream') {
|
|
488
|
+
if (frame.frame?.revision !== follower.revision + 1) throw new Error('Assistant revision gap; reconnect to rebaseline')
|
|
489
|
+
follower.revision = frame.frame.revision
|
|
490
|
+
} else throw new Error('Unknown Session frame')
|
|
491
|
+
this.#notify(follower.onFrame, frame)
|
|
492
|
+
if (frame.type === 'snapshot') follower.opening.resolve(frame)
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* Attach before prompting; the signal also cancels a pending subscription opening.
|
|
496
|
+
* @param sessionId - Runtime-owned Session identity.
|
|
497
|
+
* @param onFrame - Snapshot, durable-event, and assistant-stream callback.
|
|
498
|
+
* @param onFailure - Terminal subscription failure callback.
|
|
499
|
+
* @param signal - Subscription lifetime.
|
|
500
|
+
* @returns Detach function after the opening snapshot arrives.
|
|
501
|
+
*/
|
|
502
|
+
follow(sessionId, onFrame, onFailure, signal) {
|
|
503
|
+
return this.followAddress({ kind: 'session', sessionId }, onFrame, onFailure, signal)
|
|
504
|
+
}
|
|
505
|
+
async followAddress(address, onFrame, onFailure, signal) {
|
|
506
|
+
const pending = error => address.kind === 'subagent' && error.code === 'subagent/catalog-diagnostic'
|
|
507
|
+
&& error.details?.reason === 'unavailable'
|
|
508
|
+
let deadline
|
|
509
|
+
for (;;) {
|
|
510
|
+
try {
|
|
511
|
+
return await this.#followAddressOnce(address, onFrame, error => {
|
|
512
|
+
if (!pending(error)) this.#notify(onFailure, error)
|
|
513
|
+
}, signal)
|
|
514
|
+
} catch (error) {
|
|
515
|
+
if (!pending(error)) throw error
|
|
516
|
+
deadline ??= Date.now() + this.options.childReadyTimeoutMs
|
|
517
|
+
if (Date.now() >= deadline) { this.#notify(onFailure, error); throw error }
|
|
518
|
+
await new Promise((resolveWait, reject) => {
|
|
519
|
+
const cleanup = () => { clearTimeout(timer); signal?.removeEventListener('abort', abort) }
|
|
520
|
+
const abort = () => { cleanup(); reject(signal.reason) }
|
|
521
|
+
const timer = setTimeout(() => { cleanup(); resolveWait() }, Math.min(20, deadline - Date.now()))
|
|
522
|
+
signal?.addEventListener('abort', abort, { once: true })
|
|
523
|
+
if (signal?.aborted) abort()
|
|
524
|
+
})
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
async #followAddressOnce(address, onFrame, onFailure, signal) {
|
|
529
|
+
signal?.throwIfAborted()
|
|
530
|
+
if (this.#reconnecting) await this.#reconnecting
|
|
531
|
+
await this.#connect()
|
|
532
|
+
this.#assertActive()
|
|
533
|
+
signal?.throwIfAborted()
|
|
534
|
+
const streamId = randomUUID()
|
|
535
|
+
const follower = { address, onFrame, onFailure, signal }
|
|
536
|
+
follower.onAbort = () => this.#disposeFollower(streamId, failure('Subscription aborted', 'runtime/subscription-aborted'))
|
|
537
|
+
this.#followers.set(streamId, follower)
|
|
538
|
+
signal?.addEventListener('abort', follower.onAbort, { once: true })
|
|
539
|
+
try {
|
|
540
|
+
this.#open(streamId, follower)
|
|
541
|
+
await bounded(follower.opening.promise, this.options.socketTimeoutMs, 'Session opening')
|
|
542
|
+
this.#assertActive()
|
|
543
|
+
signal?.throwIfAborted()
|
|
544
|
+
if (!this.#followers.has(streamId)) throw failure('Subscription removed', 'runtime/subscription-aborted')
|
|
545
|
+
} catch (error) { this.#disposeFollower(streamId, error); throw error }
|
|
546
|
+
return () => this.#disposeFollower(streamId)
|
|
547
|
+
}
|
|
548
|
+
/** Follow the Web Workspace registry; reconnect replaces the baseline. */
|
|
549
|
+
async followWorkspaces(onFrame, onFailure, signal) {
|
|
550
|
+
signal?.throwIfAborted()
|
|
551
|
+
if (this.#reconnecting) await this.#reconnecting
|
|
552
|
+
await this.#connect()
|
|
553
|
+
this.#assertActive()
|
|
554
|
+
signal?.throwIfAborted()
|
|
555
|
+
const streamId = randomUUID()
|
|
556
|
+
const follower = { kind: 'workspaces', onFrame, onFailure, signal }
|
|
557
|
+
follower.onAbort = () => this.#disposeFollower(streamId, failure('Subscription aborted', 'runtime/subscription-aborted'))
|
|
558
|
+
this.#followers.set(streamId, follower)
|
|
559
|
+
signal?.addEventListener('abort', follower.onAbort, { once: true })
|
|
560
|
+
try {
|
|
561
|
+
this.#open(streamId, follower)
|
|
562
|
+
await bounded(follower.opening.promise, this.options.socketTimeoutMs, 'Workspace opening')
|
|
563
|
+
this.#assertActive()
|
|
564
|
+
signal?.throwIfAborted()
|
|
565
|
+
if (!this.#followers.has(streamId)) throw failure('Subscription removed', 'runtime/subscription-aborted')
|
|
566
|
+
} catch (error) { this.#disposeFollower(streamId, error); throw error }
|
|
567
|
+
return () => this.#disposeFollower(streamId)
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Open the single Runtime-wide interaction stream and wait for ready.
|
|
571
|
+
* @param onFrame - Interaction requests, withdrawal, readiness, and invalidation callback.
|
|
572
|
+
* @param onFailure - Terminal subscription failure callback.
|
|
573
|
+
* @param signal - Interaction ownership lifetime.
|
|
574
|
+
* @returns Detach function after the interaction owner becomes ready.
|
|
575
|
+
*/
|
|
576
|
+
async followInteractions(onFrame, onFailure, signal) {
|
|
577
|
+
signal?.throwIfAborted()
|
|
578
|
+
if (this.#reconnecting) await this.#reconnecting
|
|
579
|
+
await this.#connect()
|
|
580
|
+
this.#assertActive()
|
|
581
|
+
signal?.throwIfAborted()
|
|
582
|
+
if ([...this.#followers.values()].some(value => value.kind === 'interactions')) {
|
|
583
|
+
throw failure('Only one interaction owner is supported', 'runtime/interaction-owner')
|
|
584
|
+
}
|
|
585
|
+
const streamId = randomUUID()
|
|
586
|
+
const follower = { kind: 'interactions', onFrame, onFailure, signal }
|
|
587
|
+
follower.onAbort = () => this.#disposeFollower(streamId, failure('Interaction subscription aborted', 'runtime/subscription-aborted'))
|
|
588
|
+
this.#followers.set(streamId, follower)
|
|
589
|
+
signal?.addEventListener('abort', follower.onAbort, { once: true })
|
|
590
|
+
try {
|
|
591
|
+
this.#open(streamId, follower)
|
|
592
|
+
await bounded(follower.opening.promise, this.options.socketTimeoutMs, 'Interaction readiness')
|
|
593
|
+
this.#assertActive()
|
|
594
|
+
signal?.throwIfAborted()
|
|
595
|
+
if (!this.#followers.has(streamId)) throw failure('Interaction subscription removed', 'runtime/subscription-aborted')
|
|
596
|
+
} catch (error) { this.#disposeFollower(streamId, error); throw error }
|
|
597
|
+
return () => this.#disposeFollower(streamId)
|
|
598
|
+
}
|
|
599
|
+
#resetInteractions(reason) {
|
|
600
|
+
const clientId = this.#interactionClientId
|
|
601
|
+
this.#interactionClientId = undefined
|
|
602
|
+
this.#pendingInteractions.clear()
|
|
603
|
+
if (clientId !== undefined) {
|
|
604
|
+
for (const follower of this.#followers.values()) {
|
|
605
|
+
if (follower.kind === 'interactions') this.#notify(follower.onFrame, { type: 'invalidated', clientId, reason })
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
#receiveInteraction(follower, frame) {
|
|
610
|
+
if (frame?.type === 'ready') {
|
|
611
|
+
if (typeof frame.clientId !== 'string' || !frame.clientId) throw new Error('Invalid interaction ready')
|
|
612
|
+
this.#resetInteractions('new-generation')
|
|
613
|
+
this.#interactionClientId = frame.clientId
|
|
614
|
+
this.#notify(follower.onFrame, frame)
|
|
615
|
+
follower.opening.resolve(frame)
|
|
616
|
+
return
|
|
617
|
+
}
|
|
618
|
+
if (!this.#interactionClientId) throw new Error('Interaction event before ready')
|
|
619
|
+
if (frame?.type === 'waterfall') {
|
|
620
|
+
if (typeof frame.eventId !== 'string' || typeof frame.event !== 'string'
|
|
621
|
+
|| typeof frame.agentId !== 'string' || !frame.request || typeof frame.request !== 'object') {
|
|
622
|
+
throw new Error('Invalid interaction request')
|
|
623
|
+
}
|
|
624
|
+
this.#pendingInteractions.set(frame.eventId, { clientId: this.#interactionClientId, frame })
|
|
625
|
+
this.#notify(follower.onFrame, { ...frame, clientId: this.#interactionClientId })
|
|
626
|
+
} else if (frame?.type === 'cancel') {
|
|
627
|
+
this.#pendingInteractions.delete(frame.eventId)
|
|
628
|
+
this.#notify(follower.onFrame, { ...frame, clientId: this.#interactionClientId })
|
|
629
|
+
} else if (frame?.type === 'emit') this.#notify(follower.onFrame, frame)
|
|
630
|
+
else throw new Error('Unknown interaction frame')
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Reply only to an event still owned by the active connection generation.
|
|
634
|
+
* @param reply - Current clientId/eventId and the event-specific outcome.
|
|
635
|
+
* @returns Runtime acknowledgement; stale replies reject locally.
|
|
636
|
+
*/
|
|
637
|
+
async replyInteraction({ clientId, eventId, outcome }) {
|
|
638
|
+
const pending = this.#pendingInteractions.get(eventId)
|
|
639
|
+
if (!pending || pending.clientId !== clientId || this.#interactionClientId !== clientId) {
|
|
640
|
+
throw failure('Interaction was cancelled or belongs to an old connection', 'runtime/stale-interaction')
|
|
641
|
+
}
|
|
642
|
+
if (outcome?.kind === 'result' && pending.frame.event === 'approval/request'
|
|
643
|
+
&& !['allowed-once', 'rejected', 'cancelled', 'unavailable'].includes(outcome.value)) {
|
|
644
|
+
throw failure('Invalid approval outcome', 'runtime/approval-outcome')
|
|
645
|
+
}
|
|
646
|
+
this.#pendingInteractions.delete(eventId)
|
|
647
|
+
return this.#rpcArgs('$events/result', { clientId, eventId, outcome })
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Share concurrent reconnections without creating another Session or resending prompts.
|
|
651
|
+
* @returns Ready after every surviving subscription receives its new baseline.
|
|
652
|
+
*/
|
|
653
|
+
reconnect() {
|
|
654
|
+
this.#assertActive()
|
|
655
|
+
if (this.#reconnecting) return this.#reconnecting
|
|
656
|
+
this.#reconnecting = this.#rebaseline().finally(() => { this.#reconnecting = undefined })
|
|
657
|
+
return this.#reconnecting
|
|
658
|
+
}
|
|
659
|
+
async #rebaseline() {
|
|
660
|
+
if (this.#connecting) await this.#connecting.catch(() => {})
|
|
661
|
+
this.#assertActive()
|
|
662
|
+
const previous = this.#socket
|
|
663
|
+
this.#resetInteractions('reconnect')
|
|
664
|
+
this.#socket = undefined
|
|
665
|
+
if (previous && previous.readyState !== WebSocket.CLOSED) {
|
|
666
|
+
const closed = new Promise(resolveClosed => previous.once('close', resolveClosed))
|
|
667
|
+
previous.terminate()
|
|
668
|
+
await closed
|
|
669
|
+
}
|
|
670
|
+
await this.#connect()
|
|
671
|
+
const openings = [...this.#followers.values()].map(follower => follower.opening.promise)
|
|
672
|
+
await bounded(Promise.all(openings), this.options.socketTimeoutMs, 'Session reconnect snapshots')
|
|
673
|
+
this.#assertActive()
|
|
674
|
+
this.#state('reconnected')
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Close subscriptions and wait for the owned Runtime process to exit.
|
|
678
|
+
* @returns Settled when requests, sockets, and the child have stopped.
|
|
679
|
+
*/
|
|
680
|
+
close() {
|
|
681
|
+
if (this.#closing) return this.#closing
|
|
682
|
+
this.#closed = true
|
|
683
|
+
this.#closing = Promise.resolve().then(async () => {
|
|
684
|
+
const reason = failure('Connector closed', 'runtime/closed')
|
|
685
|
+
this.#resetInteractions('connector-closed')
|
|
686
|
+
for (const streamId of this.#followers.keys()) this.#disposeFollower(streamId, reason)
|
|
687
|
+
const requests = [...this.#requests.entries()]
|
|
688
|
+
for (const [request] of requests) request.destroy(reason)
|
|
689
|
+
await Promise.allSettled(requests.map(([, closed]) => closed))
|
|
690
|
+
const socket = this.#socket
|
|
691
|
+
this.#socket = undefined
|
|
692
|
+
if (socket && socket.readyState !== WebSocket.CLOSED) {
|
|
693
|
+
const closed = new Promise(resolveClosed => socket.once('close', resolveClosed))
|
|
694
|
+
socket.terminate()
|
|
695
|
+
await closed
|
|
696
|
+
}
|
|
697
|
+
const child = this.#child
|
|
698
|
+
if (child && child.exitCode === null && child.signalCode === null) {
|
|
699
|
+
child.kill('SIGTERM')
|
|
700
|
+
try { await bounded(this.#exit, this.options.shutdownTimeoutMs, 'Runtime shutdown') }
|
|
701
|
+
catch (error) {
|
|
702
|
+
child.kill('SIGKILL')
|
|
703
|
+
await bounded(this.#exit, this.options.shutdownTimeoutMs, 'Runtime kill confirmation')
|
|
704
|
+
this.#state('forced-shutdown', error)
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
this.#state('closed')
|
|
708
|
+
})
|
|
709
|
+
return this.#closing
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Produce a current-version overlay; existing Sessions retain their own logged policies.
|
|
715
|
+
* @param mode - Core-only execution or host-owned user permissions.
|
|
716
|
+
* @returns YAML overlay for the public web profile.
|
|
717
|
+
*/
|
|
718
|
+
export function createIntegrationPatch(mode, options = {}) {
|
|
719
|
+
const access = options.workspaceAccess ?? 'workspace-write'
|
|
720
|
+
if (!['read-only', 'workspace-write', 'danger-full-access'].includes(access)) throw new Error('Unknown workspace access')
|
|
721
|
+
if (!['runtime-only', 'cherry-permissions'].includes(mode)) throw new Error('Unknown integration mode')
|
|
722
|
+
const preset = options.workspaceAccess ? access : mode === 'runtime-only' ? 'runtime-only' : 'workspace-write'
|
|
723
|
+
const approval = mode === 'runtime-only' ? 'never' : 'ask'
|
|
724
|
+
const gate = mode === 'cherry-permissions'
|
|
725
|
+
? `- insert:\n - id: desktop-permission-gate\n name: ${JSON.stringify(new URL('./desktop-permission-gate.mjs', import.meta.url).href)}\n`
|
|
726
|
+
: ''
|
|
727
|
+
const presets = ['runtime-only', 'read-only', 'workspace-write', 'danger-full-access'].map(name =>
|
|
728
|
+
` ${name}:\n sandbox: ${name === 'runtime-only' ? 'workspace-write' : name}\n approval: ${approval}\n`).join('')
|
|
729
|
+
return `- id: import-chatcode-cli\n disabled: true\n- id: permission\n config:\n presets:\n${presets} defaultPreset: ${preset}\n${gate}`
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
export { readAssistantText, readAssistantContent, readSessionActivity, readAssistantToolCalls } from './session-activity.mjs'
|
|
733
|
+
|
|
734
|
+
export { ExecutionStream, SessionExecution, readToolResultCallId } from './execution.mjs'
|
|
735
|
+
|
|
736
|
+
export { readUserQuestions, createUserQuestionAnswer } from './user-questions.mjs'
|