@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,225 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Node.js client for persistent chatcode-cli Runtime sessions, streaming output, cancellation, and desktop approval forwarding."
|
|
3
|
+
kind: "package-library"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @chatcode/runtime-client
|
|
7
|
+
|
|
8
|
+
English | [中文](README.zh.md)
|
|
9
|
+
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
Use this package in an Electron main process or another Node.js backend to keep one chatcode-cli Runtime alive across messages. Create or restore Sessions, receive streaming output, cancel work, and forward user decisions through the public Web profile. The package does not depend on Cherry Studio or install the Runtime. Keep the Runtime launcher, external Node executable, stable home, and host UI under the application’s ownership.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Build and publish](#build-and-publish)
|
|
18
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
22
|
+
|
|
23
|
+
<a id="use-this-package"></a>
|
|
24
|
+
## Use this package
|
|
25
|
+
|
|
26
|
+
Install the published package into the host backend. An external Node executable must satisfy the package’s engines field; Electron process.execPath normally names Electron and is not the external Node path. Supply the separately installed @chatcode/chatcode-cli package’s scripts/launch.mjs. Tauri and Qt applications need a Node.js communication adapter.
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
pnpm add --save-exact @chatcode/runtime-client@0.1.0-integration.1 --registry=https://registry.npmjs.org/
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The application writes createIntegrationPatch(mode) to a file and passes its absolute path in patches. runtime-only retains workspace-write confinement and rejects actions that require approval. cherry-permissions adds the pre-execution permission plugin; the host owns policy checks, approval UI, structured user answers, and cancellation.
|
|
33
|
+
|
|
34
|
+
```js
|
|
35
|
+
const { RuntimeConnector } = await import('@chatcode/runtime-client')
|
|
36
|
+
const runtime = new RuntimeConnector({ nodePath, launcherPath, home, patches: [patchPath] })
|
|
37
|
+
await runtime.start()
|
|
38
|
+
const { sessionId } = await runtime.createSession({ cwd })
|
|
39
|
+
const off = await runtime.follow(sessionId, onFrame, onFailure)
|
|
40
|
+
await runtime.prompt({ sessionId, requestId, mode: 'queue', content: [{ type: 'text', text }] })
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The example’s paths, callbacks, stable requestId, and text come from the host. Persist home, cwd, mode, and sessionId; restore with createSession({ cwd, sessionId }) without resending history. In both modes, a host providing human questions must open one followInteractions subscription and receive ready before any prompt. Tool approval UI is enabled only in cherry-permissions mode. Map the root agentId to its returned sessionId, and reply only to the current clientId/eventId. Approval outcomes are allowed-once, rejected, cancelled, or unavailable.
|
|
44
|
+
|
|
45
|
+
Desktop execution views use `readAssistantContent` for separate body/reasoning, `readAssistantToolCalls` for partial arguments, and `readSessionActivity` for task-list replacements and parent-owned child catalogs. Follow verified children with `followAddress`; `toolCatalog(sessionId)` reads the actual scoped tools. Follow events retain native calls, results and nested PTC dispatches. Current tool results identify their call through `message.source.callId`; hosts preserve that identity and the original arguments when building cards. These projections add no model messages or authentication APIs.
|
|
46
|
+
|
|
47
|
+
Session callbacks receive snapshots, durable events, and assistant-stream frames. Convert these into the host’s message UI; readAssistantText only reconstructs body blocks. accepted means admission, and assistant-stream/end closes one model attempt rather than a whole turn. On transport loss, invalidate pending approvals and call reconnect() to obtain new baselines without resending prompts. off() detaches one conversation; cancel(sessionId) stops its active turn; await close() on application exit.
|
|
48
|
+
|
|
49
|
+
ChatCode account authentication is separate from tool approvals and local HTTP cookie authentication. When the host already owns a validated ChatCode account, pass its token only in the subprocess env field as CHATCODE_CLI_OAUTH_TOKEN. The host owns token validation, renewal, logout, and account isolation; restart the Connector after changing the token. This SDK version does not expose account login, status, or logout APIs. Neither createIntegrationPatch mode disables account authentication.
|
|
50
|
+
|
|
51
|
+
For application authentication, pass `appCredentials: { appId, secret }` to `new RuntimeConnector(options)` in the desktop backend. Both fields are required when the option is set. Use 1 to 128 printable ASCII characters for the ID and 1 to 1024 for the secret, without spaces. If the backend reads the secret from an environment variable, omit that variable from the subprocess `env` option. A distributed SDK or installer cannot protect a shared long-lived secret. An installation can use a credential provisioned separately by the operator or by an authorization service.
|
|
52
|
+
|
|
53
|
+
The SDK sends `X-ChatCode-App-Id` and `X-ChatCode-App-Secret` only on the loopback launch-token exchange. A supporting Runtime verifies the application before issuing the cookie and replies with the usual HTTP 303 and `Set-Cookie` plus `X-ChatCode-App-Authenticated: 1`. For later HTTP commands and WebSocket subscriptions, the Runtime uses the cookie to identify the verified application and checks permissions before dispatch. Protected operations require a cookie bound to an application. Use the existing RPC and subscription error frames to return an operation denial to the SDK.
|
|
54
|
+
|
|
55
|
+
Invalid configuration throws `runtime/app-credentials` during construction. HTTP 401 or 403 during the exchange rejects startup with `runtime/app-auth`. A cookie without the application authentication acknowledgment rejects startup with `runtime/app-auth-unsupported`. Omitting the option uses the regular local-cookie exchange. With application credentials configured, the SDK requires a Runtime version that implements the application exchange.
|
|
56
|
+
|
|
57
|
+
The current Web profile also checks ChatCode/CVP launch admission before binding HTTP. Both integration modes preserve this check. Prepare the Runtime’s required service access and credentials, then verify that its launcher starts; report admission failures as Runtime startup errors rather than tool approval requests.
|
|
58
|
+
|
|
59
|
+
See [public types](index.d.ts) for exact arguments. The Runtime cookie and credentials stay in the backend. External Node cannot load files that exist only inside Electron asar; unpack the Runtime and permission plugin for installers.
|
|
60
|
+
|
|
61
|
+
### Structured execution events
|
|
62
|
+
|
|
63
|
+
`SessionExecution` owns the root follow subscription, verifies child addresses through Runtime, subscribes recursively to descendants, and reconciles streamed prefixes with durable messages. `ExecutionEvent` is a discriminated union with `protocolVersion: 1`, `sessionId`, optional `parentSessionId`, and turn/step/attempt identifiers where available. Events cover text and model-supplied reasoning, partial and complete tool input, results and nested call relationships, task-list replacements, session status, and turn/step lifecycle. Only the root Session's `turn-end` ends the submitted task; child completion is independent. `seq` is a durable cursor and is not a unique identifier for transient deltas.
|
|
64
|
+
|
|
65
|
+
```js
|
|
66
|
+
import { SessionExecution } from '@chatcode/runtime-client'
|
|
67
|
+
|
|
68
|
+
const execution = new SessionExecution(runtime, { sessionId, onEvent, onFailure })
|
|
69
|
+
await execution.start()
|
|
70
|
+
await execution.prompt({ requestId, mode: 'queue', content: [{ type: 'text', text }] })
|
|
71
|
+
// When the user stops: await execution.cancel()
|
|
72
|
+
// When the view closes: await execution.close()
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The host supplies an already configured Connector, callbacks, and stable input IDs. `prompt` subscribes before submitting and never retries admission failures. `cancel` stops tracked active root and child turns; `close` awaits subscription cleanup without stopping the shared Runtime. `onSession` registers host-owned permission handlers before each subscription opens; its returned disposer runs on close. `ExecutionStream.resolveCall` waits for complete durable arguments with cancellation. Partial tool input remains display-only. Existing `followInteractions` and `replyInteraction` carry approvals and structured user responses; the host owns account checks, permission policy and UI. `beforeFrame` optionally vetoes a frame for host policy before publication. Listener exceptions are contained; `onFailure` reports transport/projection failures.
|
|
76
|
+
|
|
77
|
+
These APIs are in the local integration.2 source package, not the published integration.1. Install or pack this SDK directory for development; it has no Cherry, Electron or TUI dependency. `ExecutionStream` remains available for clients that already own their subscriptions. Snapshots reconcile current content; this observer does not replace paginated history import into a host database.
|
|
78
|
+
|
|
79
|
+
Live child registration may precede its first descriptor. `followAddress` retries only the Runtime live-child `unavailable` diagnostic, bounded by `childReadyTimeoutMs` (default 1000 ms), and releases every failed opening before retrying. Corruption, unsupported formats and unauthorized addresses are terminal.
|
|
80
|
+
|
|
81
|
+
### Workspace and Session browser
|
|
82
|
+
|
|
83
|
+
`createWorkspace({ path })` registers an existing directory and returns the same Workspace for a canonical equivalent path. `listWorkspaces()` lists registered Workspaces; `listWorkspaceSessions()` returns `{ items, unassignedSessions }`, with each Workspace item carrying its nested `sessions`. `listSessions({ workspaceId })` reads one Workspace's Sessions. These methods consume the Web registry's authoritative membership and cold-safe Session list; matching `cwd` alone never moves an unassigned Session into a Workspace. Empty Workspaces and newly created blank Sessions remain visible. Archived Sessions and subagent Sessions are excluded by default; opt in with `includeArchived` and `includeSubagents`.
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
const { workspace } = await runtime.createWorkspace({ path: cwd })
|
|
87
|
+
const created = await runtime.createSession({ workspaceId: workspace.workspaceId })
|
|
88
|
+
const tree = await runtime.listWorkspaceSessions({ order: 'desc' })
|
|
89
|
+
const restored = await runtime.resumeSession({
|
|
90
|
+
workspaceId: workspace.workspaceId,
|
|
91
|
+
sessionId: created.sessionId,
|
|
92
|
+
})
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
All list timestamps are epoch milliseconds. `order: 'desc'` (default) puts the newest first; `'asc'` puts the oldest first, with identity as a deterministic tie-break. Session `updatedAt` follows the Web last-human-input timestamp, falling back to creation before the first prompt. Workspace groups use `lastActivityAt`, the maximum of the Workspace mutation time and visible members' timestamps. Pins are metadata and do not override time order. A bare resume retains the stored timestamps; subsequent input advances activity. Titles are `null` until Runtime supplies a title.
|
|
96
|
+
|
|
97
|
+
`resumeSession` restores the exact existing identity and preset without replaying prompts. Without a location, it resolves the saved `cwd` from the Session list. An explicit Workspace must match that Session's original directory. The matching Runtime must support `SessionCreateRequest.resumeOnly`: missing or permanently deleted Sessions reject instead of creating replacements. `createSession` retains its legacy create-or-adopt semantics for explicit IDs. Persist the same Runtime home across restarts to keep Workspaces and Sessions available.
|
|
98
|
+
|
|
99
|
+
`followWorkspaces(onFrame, onFailure, signal)` exposes the Web baseline and ordered increments; reconnection replaces the baseline, and the returned function detaches the subscription. Its raw Workspace timestamps remain ISO strings. List methods use short-lived baseline subscriptions and release them after reading. Workspace and Session reads are separate observations, so refresh after concurrent mutations. The stdio bridge exposes `workspace.create`, `workspace.list`, `workspace.sessions`, `session.list`, and `session.resume` for non-Node desktop hosts.
|
|
100
|
+
|
|
101
|
+
### Human questions
|
|
102
|
+
|
|
103
|
+
Human questions are independent of tool approval mode. Both integration modes can answer `user-questions/request` through `followInteractions` and `replyInteraction`. Use `readUserQuestions(frame.request)` to normalize native questions, including optional choices and free-text-only prompts, and `createUserQuestionAnswer(questions, { answers })` to validate selected option arrays and custom text before replying. Stable question IDs identify answers even when question text repeats; option labels containing commas stay intact. Omitted answer IDs are returned as skipped. Hosts own the UI and must revoke pending questions on cancellation, logout and connection invalidation. Runtime-only hosts reject `approval/request` rather than treating a human answer as tool authorization.
|
|
104
|
+
|
|
105
|
+
### Desktop history handoff
|
|
106
|
+
|
|
107
|
+
The source package exposes `DesktopHistoryHost`, `createDesktopHistoryClient`, and `releaseSession`; published integration.1 lacks these additions. The host supplies verified account/configuration checks, discovery metadata, snapshot previews, exact native launch context, tool policy, and return synchronization. The CLI client discovers only running hosts through private Unix sockets and defers spawning until the current UI exits. The terminal uses a temporary configuration home with the original authoritative Session root; it retains the host-approved model routes, preset, directory, and account, disables both legacy and current automatic history import plus user asset discovery, and never copies credentials or replays the transcript. Keep the host running: account or host loss stops execution. Windows and offline continuation are unsupported. The host must reject unsupported input, tools, policy modes, and changed tool arguments.
|
|
108
|
+
|
|
109
|
+
Call `releaseSession(sessionId)` only after completing or cancelling pending work. It drains a controller-owned idle Session and releases its native writer without stopping other Sessions; active work, foreign lifecycle ownership, or another process's writer rejects. Released identities reject implicit prompt admission until explicit `createSession({ cwd, sessionId })` resumes them. On return, probe release before activation, import events idempotently through the public snapshot/page APIs, and reject a nonempty native inbox instead of automatically replaying pending work.
|
|
110
|
+
|
|
111
|
+
Beginning a return revokes terminal checks, heartbeats, and model-preference reads. Asynchronous callbacks revalidate the same active, unexpired lease before returning a decision. A failed return retains the reservation and remains revoked; the original lease may retry return even after expiry. `owns()` reports this reservation, not execution permission. These checks do not retract decisions already delivered or roll back tools already executing.
|
|
112
|
+
|
|
113
|
+
### Account model selection
|
|
114
|
+
|
|
115
|
+
The source SDK exposes `modelCatalog({ refresh: true })` and `selectModel({ sessionId, provider, model })`. The Runtime configuration plugin owns catalog access, credentials and request routing. Selection is Session-local, validated against the live registry, and takes effect on the next request without creating a Session or replaying history. Catalog refresh requires the matching source Runtime; integration.1 and CLI 3.0.3 do not ship these additions.
|
|
116
|
+
|
|
117
|
+
### Desktop integration model
|
|
118
|
+
|
|
119
|
+
Desktop AI workbenches that manage their own API keys and model catalog use the following integration pattern:
|
|
120
|
+
|
|
121
|
+
1. Call **`prompt({ ..., modelConfig })`** for each queued desktop message. The SDK probes Runtime support before submitting the message. `modelConfig` identifies a registered `provider` and `model` and carries one open JSON object in `options`. The optional `protocol` asserts the model route’s protocol.
|
|
122
|
+
|
|
123
|
+
2. **`resumeSession({ sessionId, provider?, model? })`** — Resume an existing Session that was previously persisted, optionally with provider/model overrides. Use this after Runtime restart to re-inject the model selection without creating a new Session. Throws `session/not-found` if the Session does not exist in persistence.
|
|
124
|
+
|
|
125
|
+
3. **`setLoginToken({ accessToken })`** / **`clearLoginToken()`** — Inject an OAuth login token. The token is persisted to the credentials service (encrypted, `0o600`) using the same mechanism as PlatformAccount, so `resolveToken()` reads it automatically. Token expiry is detected by API 401 responses — the LLM adapter returns API 401 naturally when the token expires, and the desktop re-authenticates.
|
|
126
|
+
|
|
127
|
+
**Typical desktop flow:**
|
|
128
|
+
```js
|
|
129
|
+
const runtime = new RuntimeConnector({ nodePath, launcherPath, home, patches: [patchPath] })
|
|
130
|
+
await runtime.start()
|
|
131
|
+
|
|
132
|
+
// Optionally inject an OAuth login token
|
|
133
|
+
// await runtime.setLoginToken({ accessToken })
|
|
134
|
+
|
|
135
|
+
// Create a new session with model choice
|
|
136
|
+
const { sessionId } = await runtime.createSession({ cwd, provider: 'openai', model: 'gpt-4o' })
|
|
137
|
+
|
|
138
|
+
// Or resume an existing one
|
|
139
|
+
// const { sessionId, selected } = await runtime.resumeSession({ sessionId: 'existing-id' })
|
|
140
|
+
|
|
141
|
+
// Prompt with request-local model configuration
|
|
142
|
+
await runtime.prompt({
|
|
143
|
+
sessionId, requestId, mode: 'queue', content: [{ type: 'text', text: 'Hello' }],
|
|
144
|
+
modelConfig: {
|
|
145
|
+
provider: 'openai', model: 'gpt-4o', protocol: 'openai-completions',
|
|
146
|
+
apiKey,
|
|
147
|
+
options: { temperature: 0, contextWindow: 128_000, maxTokens: 4096, top_p: 0.9 },
|
|
148
|
+
},
|
|
149
|
+
})
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The Runtime applies `contextWindow` to context budgeting, `maxTokens` and `temperature` to generation, and `reasoningEffort` to a reasoning level advertised by the route. Runtime passes the remaining keys in `options` to the registered protocol adapter. The pi-ai Chat Completions, Responses, Messages, and Google GenerateContent paths and the native DeepSeek adapter forward extra JSON generation fields. For example, use `reasoning_effort` for Chat Completions, `reasoning.effort` for Responses, or `output_config.effort` for Messages. Google puts these fields in `generationConfig` and maps `thinking_level` to `thinkingConfig.thinkingLevel`. Runtime owns routing, input, tools, streaming, transport, and authentication. The upstream model decides which extra fields it accepts. Configuration errors carry `session/invalid-model-config` and a field path. Reuse the same `requestId` and payload when retrying admission. Use `assertPromptModelConfig({ unifiedOptions: true })` before sending unified options to check Runtime support. Older clients may still send separate `protocolOptions` or use the top-level `provider` and `model` fields. When using separate objects, each key must occur in only one. Supply `modelConfig.apiKey` with each prompt that uses a desktop API key. The SDK checks Runtime support before sending. Runtime uses the key in memory for the submitted model and records only a credential-required marker. After restarting, retry a queued prompt with the same ID, content, configuration and key before resuming work. Supply ChatCode OAuth grants through `setLoginToken`.
|
|
153
|
+
|
|
154
|
+
`AccountModelPreferences` stores only provider, model and revision under a private per-user account directory. The caller derives its owner fingerprint from the server-validated account API origin and normalized email. It never accepts an environment token as identity proof. Cherry publishes its accepted choice; the official CLI adopts it while idle and checks before new input. A busy CLI finishes its current task first. Unavailable routes retain the current model and show a warning. Logout and different accounts do not share choices. Desktop handoff reads the preference through its original host lease and retains that host's allowed model routes. This feature does not share credentials, Session homes or permissions, and does not change other Cherry Agents' stored models.
|
|
155
|
+
|
|
156
|
+
<a id="build-and-publish"></a>
|
|
157
|
+
## Build and publish
|
|
158
|
+
|
|
159
|
+
This directory owns the independently versioned @chatcode/runtime-client workspace. From the repository root, use the package filter; do not publish the private root manifest. The native ESM files are published directly, so build checks their syntax and strict declarations without generating a second copy.
|
|
160
|
+
|
|
161
|
+
```sh
|
|
162
|
+
pnpm --filter @chatcode/runtime-client run build
|
|
163
|
+
pnpm --filter @chatcode/runtime-client test
|
|
164
|
+
node packages/sdk/runtime-client/tests/package-consumer.mjs
|
|
165
|
+
pnpm --filter @chatcode/runtime-client publish --dry-run --no-git-checks --access public --tag test --registry=https://registry.npmjs.org/
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
The dry run does not publish. To publish after reviewing the payload, remove --dry-run, use an account authorized for @chatcode, and complete registry authentication. Use a new version if the name/version is already published. Keep integration releases under test; prepublishOnly runs build and the owned tests before upload. Only ws is a runtime dependency; the Runtime is supplied separately.
|
|
169
|
+
|
|
170
|
+
The real-composition fixtures use a controlled local model and private temporary workspaces. Their test-only overlays isolate external CVP admission; they do not validate platform access. After installing product dependencies, run them from this package:
|
|
171
|
+
|
|
172
|
+
```sh
|
|
173
|
+
node tests/smoke.mjs ../../../apps/cli/src/bin.ts --source
|
|
174
|
+
node tests/permission-smoke.mjs ../../..
|
|
175
|
+
node tests/history-smoke.mjs ../../..
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The history fixture boots the real launcher against loopback model and CVP protocol fixtures, preserves launch checks, and checks native writer ownership and real file effects in both tool modes. It does not validate production accounts or platform admission. Add `--terminal` to exercise the actual interactive TUI in a private fixture. Add `--picker` to start an ordinary CLI and select the isolated desktop Session through `/resume`; `--inline` selects an inline parent terminal.
|
|
179
|
+
|
|
180
|
+
<a id="understand-the-implementation"></a>
|
|
181
|
+
## Understand the implementation
|
|
182
|
+
|
|
183
|
+
<details>
|
|
184
|
+
<summary>Implementation internals — click to expand</summary>
|
|
185
|
+
|
|
186
|
+
RuntimeConnector owns one public-profile subprocess, authenticated HTTP commands, and a multiplexed WebSocket. One shared interaction owner routes requests to the application’s conversation owners; reconnect replaces Session baselines and invalidates approval generations. The desktop-permission-gate function plugin awaits the existing approval service before allowing a tool. stdio-bridge is a core-Session carrier and does not expose the permission APIs.
|
|
187
|
+
|
|
188
|
+
No invariant companion is published because this client validates its own transport observations and owns no independent Runtime registry or persisted projection. The [Node lifecycle tests](tests/lifecycle.test.mjs) cover startup, concurrent reconnect, unsubscription, and quiescent disposal; [interaction tests](tests/interactions.test.mjs) cover reply ownership and permission decisions.
|
|
189
|
+
|
|
190
|
+
</details>
|
|
191
|
+
|
|
192
|
+
<a id="model-experience"></a>
|
|
193
|
+
## Model Experience
|
|
194
|
+
|
|
195
|
+
### Submitted user input and permission decisions
|
|
196
|
+
|
|
197
|
+
#### What the model sees
|
|
198
|
+
|
|
199
|
+
The client forwards new user content through `prompt` and host interaction decisions through `replyInteraction`. Runtime-owned Session events and approval policy determine their model-visible representation. The client does not inject desktop history or construct a separate system prompt.
|
|
200
|
+
|
|
201
|
+
#### Token effect
|
|
202
|
+
|
|
203
|
+
Newly submitted content and Runtime-rendered policy or decisions can add tokens. Transport envelopes and UI-only state are not submitted as model context. Restoring a binding does not resubmit prior user messages.
|
|
204
|
+
|
|
205
|
+
#### KV Cache effect
|
|
206
|
+
|
|
207
|
+
Reusing a Session preserves its Runtime-owned context. The client makes no provider cache-hit guarantee; configuration changes and Runtime compaction can change request prefixes.
|
|
208
|
+
|
|
209
|
+
## Known Limitations and Deferred Work
|
|
210
|
+
|
|
211
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
212
|
+
|
|
213
|
+
- The integration version targets the chatcode-cli 3.0.3 Web protocol and permission configuration. Runtime upgrades require rerunning the fixtures. Host UI, installer resources, real-model latency, and user-question cards need application-level acceptance.
|
|
214
|
+
- requestId coalescing only covers pending requests in one connector. Across restart or a lost receipt, the client does not promise exactly-once submission. The host owns reconnect scheduling and prevents implicit retries.
|
|
215
|
+
- The connector does not replace tool arguments after an approval. Hosts must reject changed arguments and initiate a new operation rather than approve the original input.
|
|
216
|
+
|
|
217
|
+
<a id="dev-note"></a>
|
|
218
|
+
### Dev Note
|
|
219
|
+
|
|
220
|
+
<details>
|
|
221
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
222
|
+
|
|
223
|
+
None.
|
|
224
|
+
|
|
225
|
+
</details>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** Policy and fixed-model guard for a handed-off native Session in the official TUI. */
|
|
2
|
+
import { desktopHistoryRequest } from './desktop-history.mjs'
|
|
3
|
+
|
|
4
|
+
export const name = 'chatcode-desktop-history-guard'
|
|
5
|
+
|
|
6
|
+
export function apply(ctx, config) {
|
|
7
|
+
const socketPath = process.env.CHATCODE_DESKTOP_HISTORY_SOCKET
|
|
8
|
+
const leaseId = process.env.CHATCODE_DESKTOP_HISTORY_LEASE
|
|
9
|
+
if (!socketPath || !leaseId || !config.sessionId || !config.provider || !config.model || !Array.isArray(config.tools)) throw new Error('Desktop handoff identity is incomplete')
|
|
10
|
+
const allowed = config.allowedModels ?? [{ provider: config.provider, model: config.model }]
|
|
11
|
+
const check = async (agent, operation) => {
|
|
12
|
+
if (!agent || agent.id !== config.sessionId) throw new Error('This terminal is restricted to the handed-off Session')
|
|
13
|
+
await desktopHistoryRequest(socketPath, { op: 'check', sessionId: config.sessionId, leaseId, operation })
|
|
14
|
+
}
|
|
15
|
+
ctx.on('agent/created', ({ agent }) => {
|
|
16
|
+
if (agent.id !== config.sessionId || agent.options.provider !== config.provider || agent.options.model !== config.model) {
|
|
17
|
+
throw new Error('This terminal can only resume the original desktop Session and model')
|
|
18
|
+
}
|
|
19
|
+
}, { global: true })
|
|
20
|
+
ctx.on('agent/pre-step', async (payload, next) => {
|
|
21
|
+
await check(payload.agent, { kind: 'model' })
|
|
22
|
+
const decision = await next()
|
|
23
|
+
if (decision.kind === 'enter' && decision.messages.some(message => !Array.isArray(message.content)
|
|
24
|
+
|| message.content.some(part => part.type !== 'text'))) throw new Error('Desktop history handoff supports text input only')
|
|
25
|
+
return decision
|
|
26
|
+
}, { global: true })
|
|
27
|
+
ctx.on('system-prompt/assemble', async (_assembly, context, next) => {
|
|
28
|
+
await check(context.agent, { kind: 'model' })
|
|
29
|
+
const result = await next()
|
|
30
|
+
return { ...result, tools: result.tools.filter(tool => config.tools.includes(tool.name)) }
|
|
31
|
+
}, { global: true })
|
|
32
|
+
ctx.on('agent/request', async (payload, next) => {
|
|
33
|
+
await check(payload.agent, { kind: 'model' })
|
|
34
|
+
const request = await next()
|
|
35
|
+
if (!allowed.some(route => route.provider === request.provider && route.model === request.model)) throw new Error('This Session requires its original desktop model')
|
|
36
|
+
await check(payload.agent, { kind: 'model', provider: request.provider, model: request.model })
|
|
37
|
+
return request
|
|
38
|
+
}, { global: true })
|
|
39
|
+
ctx.on('tools/pre-execute', async (exec, next) => {
|
|
40
|
+
const input = JSON.stringify(exec.arguments)
|
|
41
|
+
try {
|
|
42
|
+
await check(exec.agent, { kind: 'tool', name: exec.name, input: exec.arguments })
|
|
43
|
+
const earlier = await next()
|
|
44
|
+
if (earlier.kind !== 'allow') return earlier
|
|
45
|
+
if (JSON.stringify(exec.arguments) !== input) return { kind: 'deny', reason: 'Tool arguments changed; initiate a new call' }
|
|
46
|
+
await check(exec.agent, { kind: 'tool', name: exec.name, input: exec.arguments })
|
|
47
|
+
return earlier
|
|
48
|
+
} catch { return { kind: 'deny', reason: 'Desktop policy or account validation denied this tool' } }
|
|
49
|
+
}, { global: true })
|
|
50
|
+
ctx.effect(() => {
|
|
51
|
+
let checking = false
|
|
52
|
+
const timer = setInterval(() => {
|
|
53
|
+
if (checking) return
|
|
54
|
+
checking = true
|
|
55
|
+
void desktopHistoryRequest(socketPath, { op: 'check', sessionId: config.sessionId, leaseId,
|
|
56
|
+
operation: { kind: 'heartbeat' } }, 5000).catch(() => {
|
|
57
|
+
// Kernel writer ownership is released even if the launch helper was killed.
|
|
58
|
+
process.kill(process.pid, 'SIGTERM')
|
|
59
|
+
}).finally(() => { checking = false })
|
|
60
|
+
}, 2000)
|
|
61
|
+
timer.unref()
|
|
62
|
+
return () => clearInterval(timer)
|
|
63
|
+
})
|
|
64
|
+
ctx.provide('desktopHistoryReady', { version: 1 })
|
|
65
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/** Local, single-writer handoff between a desktop host and the official terminal. */
|
|
2
|
+
import { spawn } from 'node:child_process'
|
|
3
|
+
import { createHash, randomUUID } from 'node:crypto'
|
|
4
|
+
import { chmod, lstat, mkdir, mkdtemp, readFile, readdir, rename, rm, writeFile } from 'node:fs/promises'
|
|
5
|
+
import { createServer, request } from 'node:http'
|
|
6
|
+
import { homedir, tmpdir } from 'node:os'
|
|
7
|
+
import { join } from 'node:path'
|
|
8
|
+
|
|
9
|
+
const MAX_BODY = 2 * 1024 * 1024
|
|
10
|
+
const errorMessage = error => error instanceof Error ? error.message : 'Desktop history unavailable'
|
|
11
|
+
const directoryOf = directory => directory ?? join(homedir(), '.chatcode-cli', 'desktop-history', 'v1')
|
|
12
|
+
const keyOf = (hostId, sessionId) => `desktop-history:${hostId}:${encodeURIComponent(sessionId)}`
|
|
13
|
+
|
|
14
|
+
async function privateEntry(path, directory = false) {
|
|
15
|
+
const stat = await lstat(path)
|
|
16
|
+
if (stat.isSymbolicLink() || (directory ? !stat.isDirectory() : !stat.isFile())
|
|
17
|
+
|| (process.getuid && stat.uid !== process.getuid()) || (stat.mode & 0o077) !== 0) {
|
|
18
|
+
throw new Error('Desktop history discovery requires private, user-owned files')
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** Request the local host over its private socket; credentials never enter discovery records. */
|
|
23
|
+
export function desktopHistoryRequest(socketPath, body, timeoutMs = 10000) {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
const req = request({ socketPath, path: '/', method: 'POST', timeout: timeoutMs, agent: false,
|
|
26
|
+
headers: { 'content-type': 'application/json' } }, res => {
|
|
27
|
+
let text = ''
|
|
28
|
+
res.setEncoding('utf8')
|
|
29
|
+
res.on('data', part => { text += part; if (text.length > MAX_BODY) req.destroy(new Error('Desktop history response too large')) })
|
|
30
|
+
res.on('end', () => {
|
|
31
|
+
try {
|
|
32
|
+
const result = JSON.parse(text)
|
|
33
|
+
if (res.statusCode !== 200) throw new Error(result.error ?? 'Desktop history request failed')
|
|
34
|
+
resolve(result)
|
|
35
|
+
} catch (error) { reject(error) }
|
|
36
|
+
})
|
|
37
|
+
})
|
|
38
|
+
req.on('timeout', () => req.destroy(new Error('Desktop history host timed out')))
|
|
39
|
+
req.on('error', reject)
|
|
40
|
+
req.end(JSON.stringify(body))
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Owns discovery metadata, reservations and the desktop's policy callbacks. */
|
|
45
|
+
export class DesktopHistoryHost {
|
|
46
|
+
#server
|
|
47
|
+
#temporary
|
|
48
|
+
#record
|
|
49
|
+
#reservations = new Map()
|
|
50
|
+
#closing = false
|
|
51
|
+
#timer
|
|
52
|
+
|
|
53
|
+
constructor(options) { this.options = options }
|
|
54
|
+
|
|
55
|
+
async start() {
|
|
56
|
+
if (this.#server) return
|
|
57
|
+
if (process.platform === 'win32') throw new Error('Desktop history handoff currently requires a Unix-domain socket')
|
|
58
|
+
const directory = directoryOf(this.options.directory)
|
|
59
|
+
await mkdir(directory, { recursive: true, mode: 0o700 })
|
|
60
|
+
await privateEntry(directory, true)
|
|
61
|
+
this.#temporary = await mkdtemp(join(tmpdir(), 'chatcode-history-'))
|
|
62
|
+
await chmod(this.#temporary, 0o700)
|
|
63
|
+
const socketPath = join(this.#temporary, 'host.sock')
|
|
64
|
+
this.#server = createServer(async (req, res) => {
|
|
65
|
+
try {
|
|
66
|
+
if (req.method !== 'POST' || req.url !== '/') throw new Error('Unsupported desktop history request')
|
|
67
|
+
let text = ''
|
|
68
|
+
for await (const chunk of req) {
|
|
69
|
+
text += chunk
|
|
70
|
+
if (text.length > MAX_BODY) throw new Error('Desktop history request too large')
|
|
71
|
+
}
|
|
72
|
+
const result = await this.#dispatch(JSON.parse(text))
|
|
73
|
+
res.writeHead(200, { 'content-type': 'application/json' }).end(JSON.stringify(result))
|
|
74
|
+
} catch (error) {
|
|
75
|
+
res.writeHead(409, { 'content-type': 'application/json' }).end(JSON.stringify({ error: errorMessage(error) }))
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
await new Promise((resolve, reject) => {
|
|
79
|
+
this.#server.once('error', reject)
|
|
80
|
+
this.#server.listen(socketPath, resolve)
|
|
81
|
+
})
|
|
82
|
+
await chmod(socketPath, 0o600)
|
|
83
|
+
const hostId = createHash('sha256').update(this.options.hostId).digest('hex')
|
|
84
|
+
this.#record = join(directory, `${hostId}.json`)
|
|
85
|
+
const temporary = `${this.#record}.${randomUUID()}.tmp`
|
|
86
|
+
await writeFile(temporary, JSON.stringify({ v: 1, hostId, socketPath, pid: process.pid }), { mode: 0o600 })
|
|
87
|
+
await rename(temporary, this.#record)
|
|
88
|
+
this.#timer = setInterval(() => {
|
|
89
|
+
for (const [sessionId, lease] of this.#reservations) {
|
|
90
|
+
if (lease.phase !== 'preparing' && lease.expiresAt <= Date.now()) void this.#finish(sessionId, lease).catch(() => {})
|
|
91
|
+
}
|
|
92
|
+
}, 1000)
|
|
93
|
+
this.#timer.unref()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Reports a reservation, including revoked ownership awaiting return synchronization. */
|
|
97
|
+
owns(sessionId) { return this.#reservations.has(sessionId) }
|
|
98
|
+
|
|
99
|
+
#assertActive(sessionId, lease) {
|
|
100
|
+
if (this.#closing || this.#reservations.get(sessionId) !== lease
|
|
101
|
+
|| lease.phase !== 'active' || lease.expiresAt <= Date.now()) {
|
|
102
|
+
throw new Error('Terminal Session ownership has expired')
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async #dispatch(body) {
|
|
107
|
+
if (this.#closing && body.op !== 'return') throw new Error('Cherry Studio is closing; terminal ownership has ended')
|
|
108
|
+
if (body.op === 'list') return { items: await this.options.list() }
|
|
109
|
+
if (body.op === 'preview') return { items: await this.options.preview(body.sessionId) }
|
|
110
|
+
if (body.op === 'reserve') {
|
|
111
|
+
if (typeof body.sessionId !== 'string' || this.#reservations.has(body.sessionId)) throw new Error('This Session is already handed off')
|
|
112
|
+
const lease = { id: randomUUID(), expiresAt: Date.now() + 15000, phase: 'preparing' }
|
|
113
|
+
this.#reservations.set(body.sessionId, lease)
|
|
114
|
+
try {
|
|
115
|
+
const launch = await this.options.prepare(body.sessionId)
|
|
116
|
+
lease.phase = 'active'
|
|
117
|
+
lease.expiresAt = Date.now() + 15000
|
|
118
|
+
const terminalHome = join(this.#temporary, `${lease.id}-home`)
|
|
119
|
+
await mkdir(terminalHome, { mode: 0o700 })
|
|
120
|
+
const patchPath = join(this.#temporary, `${lease.id}.json`)
|
|
121
|
+
await writeFile(patchPath, JSON.stringify([
|
|
122
|
+
{ id: 'import-claude', disabled: true },
|
|
123
|
+
{ id: 'import-chatcode-cli', disabled: true },
|
|
124
|
+
{ id: 'chatcode-assets', disabled: true },
|
|
125
|
+
{ id: 'dsh-tui', config: { provider: launch.provider, model: launch.model, sessionId: body.sessionId } },
|
|
126
|
+
{ id: 'session-persistence-jsonl', config: { root: join(launch.home, 'sessions') } },
|
|
127
|
+
{ insert: [{ id: 'desktop-history-guard',
|
|
128
|
+
name: new URL('./desktop-history-guard.mjs', import.meta.url).href,
|
|
129
|
+
config: { sessionId: body.sessionId, provider: launch.provider, model: launch.model, tools: launch.tools, allowedModels: launch.allowedModels } }] }]), { mode: 0o600 })
|
|
130
|
+
return { ...launch, home: terminalHome, patches: [...launch.patches, patchPath], env: { ...launch.env,
|
|
131
|
+
CHATCODE_CLI_TUI_SESSION_ROOT: join(launch.home, 'sessions'),
|
|
132
|
+
CHATCODE_DESKTOP_HISTORY_SOCKET: join(this.#temporary, 'host.sock'),
|
|
133
|
+
CHATCODE_DESKTOP_HISTORY_LEASE: lease.id }, leaseId: lease.id }
|
|
134
|
+
} catch (error) {
|
|
135
|
+
this.#reservations.delete(body.sessionId)
|
|
136
|
+
await this.options.finish(body.sessionId).catch(() => {})
|
|
137
|
+
throw error
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const lease = this.#reservations.get(body.sessionId)
|
|
141
|
+
if (!lease || lease.phase === 'preparing' || lease.id !== body.leaseId) throw new Error('Terminal Session ownership has expired')
|
|
142
|
+
if (body.op === 'return') { await this.#finish(body.sessionId, lease); return { ok: true } }
|
|
143
|
+
this.#assertActive(body.sessionId, lease)
|
|
144
|
+
if (body.op === 'model-preference') {
|
|
145
|
+
if (!this.options.modelPreference) throw new Error('Desktop account model synchronization is unavailable')
|
|
146
|
+
const selection = await this.options.modelPreference(body.sessionId)
|
|
147
|
+
this.#assertActive(body.sessionId, lease)
|
|
148
|
+
return { selection }
|
|
149
|
+
}
|
|
150
|
+
if (body.op === 'pulse') {
|
|
151
|
+
await this.options.check(body.sessionId, { kind: 'heartbeat' })
|
|
152
|
+
this.#assertActive(body.sessionId, lease)
|
|
153
|
+
lease.expiresAt = Date.now() + 10000
|
|
154
|
+
return { ok: true }
|
|
155
|
+
}
|
|
156
|
+
if (body.op === 'check') {
|
|
157
|
+
await this.options.check(body.sessionId, body.operation)
|
|
158
|
+
this.#assertActive(body.sessionId, lease)
|
|
159
|
+
return { ok: true }
|
|
160
|
+
}
|
|
161
|
+
throw new Error('Unsupported desktop history operation')
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
async #finish(sessionId, lease) {
|
|
165
|
+
// Revocation survives failed synchronization; the reservation still excludes desktop writes.
|
|
166
|
+
lease.phase = 'returning'
|
|
167
|
+
if (lease.finishing) return lease.finishing
|
|
168
|
+
lease.finishing = (async () => {
|
|
169
|
+
// Keep the ownership fence while the desktop reconciles durable history.
|
|
170
|
+
await this.options.finish(sessionId)
|
|
171
|
+
if (this.#reservations.get(sessionId) === lease) this.#reservations.delete(sessionId)
|
|
172
|
+
await rm(join(this.#temporary, `${lease.id}.json`), { force: true })
|
|
173
|
+
await rm(join(this.#temporary, `${lease.id}-home`), { recursive: true, force: true })
|
|
174
|
+
})().catch(error => { lease.finishing = undefined; throw error })
|
|
175
|
+
return lease.finishing
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
async close() {
|
|
179
|
+
this.#closing = true
|
|
180
|
+
clearInterval(this.#timer)
|
|
181
|
+
if (this.#record) await rm(this.#record, { force: true })
|
|
182
|
+
const deadline = Date.now() + 8000
|
|
183
|
+
while (this.#reservations.size && Date.now() < deadline) {
|
|
184
|
+
await new Promise(resolve => setTimeout(resolve, 50))
|
|
185
|
+
}
|
|
186
|
+
await Promise.allSettled([...this.#reservations].map(([id, lease]) => this.#finish(id, lease)))
|
|
187
|
+
if (this.#server) await new Promise(resolve => this.#server.close(resolve))
|
|
188
|
+
this.#server = undefined
|
|
189
|
+
if (this.#temporary) await rm(this.#temporary, { recursive: true, force: true })
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** Official terminal discovery client; it never reads desktop credentials or native log files. */
|
|
194
|
+
export function createDesktopHistoryClient(options = {}) {
|
|
195
|
+
const hosts = new Map()
|
|
196
|
+
const sessions = new Map()
|
|
197
|
+
return {
|
|
198
|
+
async modelPreference(request) {
|
|
199
|
+
return (await desktopHistoryRequest(request.socketPath, { op: 'model-preference', sessionId: request.sessionId, leaseId: request.leaseId })).selection
|
|
200
|
+
},
|
|
201
|
+
async list() {
|
|
202
|
+
const directory = directoryOf(options.directory)
|
|
203
|
+
let files
|
|
204
|
+
try { await privateEntry(directory, true); files = await readdir(directory) }
|
|
205
|
+
catch (error) { if (error.code === 'ENOENT') return []; throw error }
|
|
206
|
+
const rows = []
|
|
207
|
+
for (const file of files.filter(file => /^[a-f0-9]{64}\.json$/u.test(file))) {
|
|
208
|
+
try {
|
|
209
|
+
const path = join(directory, file)
|
|
210
|
+
await privateEntry(path)
|
|
211
|
+
const record = JSON.parse(await readFile(path, 'utf8'))
|
|
212
|
+
if (record.v !== 1 || `${record.hostId}.json` !== file || typeof record.socketPath !== 'string') continue
|
|
213
|
+
const result = await desktopHistoryRequest(record.socketPath, { op: 'list' }, 3000)
|
|
214
|
+
hosts.set(record.hostId, record)
|
|
215
|
+
for (const row of result.items) {
|
|
216
|
+
const id = keyOf(record.hostId, row.sessionId)
|
|
217
|
+
sessions.set(id, { record, sessionId: row.sessionId })
|
|
218
|
+
rows.push({ ...row, id, source: 'Cherry Studio' })
|
|
219
|
+
}
|
|
220
|
+
} catch { /* A closed desktop is not a writable history host. */ }
|
|
221
|
+
}
|
|
222
|
+
return rows
|
|
223
|
+
},
|
|
224
|
+
async preview(id) {
|
|
225
|
+
const found = sessions.get(id)
|
|
226
|
+
if (!found) throw new Error('Refresh desktop history before opening this Session')
|
|
227
|
+
return (await desktopHistoryRequest(found.record.socketPath, { op: 'preview', sessionId: found.sessionId })).items
|
|
228
|
+
},
|
|
229
|
+
has(id) { return sessions.has(id) },
|
|
230
|
+
async prepare(id) {
|
|
231
|
+
const found = sessions.get(id)
|
|
232
|
+
if (!found) throw new Error('Refresh desktop history before resuming this Session')
|
|
233
|
+
const { record, sessionId } = found
|
|
234
|
+
const launch = await desktopHistoryRequest(record.socketPath, { op: 'reserve', sessionId }, 30000)
|
|
235
|
+
return async () => {
|
|
236
|
+
let child, timer, failure, stopping, killTimer
|
|
237
|
+
const requestLease = op => desktopHistoryRequest(record.socketPath, { op, sessionId, leaseId: launch.leaseId }, 5000)
|
|
238
|
+
const stop = () => {
|
|
239
|
+
if (!child?.pid || stopping || child.exitCode !== null || child.signalCode !== null) return
|
|
240
|
+
stopping = true
|
|
241
|
+
child.kill('SIGTERM')
|
|
242
|
+
killTimer = setTimeout(() => { if (child.exitCode === null && child.signalCode === null) child.kill('SIGKILL') }, 5000)
|
|
243
|
+
killTimer.unref()
|
|
244
|
+
}
|
|
245
|
+
try {
|
|
246
|
+
await requestLease('pulse')
|
|
247
|
+
const env = { ...launch.env, CHATCODE_CLI_HOME: launch.home, CHATCODE_CLI_TUI_RESUME_SESSION: sessionId }
|
|
248
|
+
delete env.ELECTRON_RUN_AS_NODE
|
|
249
|
+
// Resume is an exact native identity; no shell interpolation or full-history replay.
|
|
250
|
+
child = spawn(launch.nodePath, [launch.launcherPath, '--profile', 'cli',
|
|
251
|
+
...launch.patches.flatMap(path => ['--patch', path]), '--resume', sessionId],
|
|
252
|
+
{ cwd: launch.cwd, env, stdio: 'inherit' })
|
|
253
|
+
process.on('SIGTERM', stop)
|
|
254
|
+
process.on('SIGINT', stop)
|
|
255
|
+
let pulsing = false
|
|
256
|
+
timer = setInterval(() => {
|
|
257
|
+
if (pulsing) return
|
|
258
|
+
pulsing = true
|
|
259
|
+
void requestLease('pulse').catch(error => { failure = error; stop() }).finally(() => { pulsing = false })
|
|
260
|
+
}, 2000)
|
|
261
|
+
const code = await new Promise((resolve, reject) => {
|
|
262
|
+
child.once('error', reject)
|
|
263
|
+
child.once('exit', code => resolve(code ?? 1))
|
|
264
|
+
})
|
|
265
|
+
if (failure) throw new Error('Desktop ownership or account validation ended; terminal task stopped')
|
|
266
|
+
return code
|
|
267
|
+
} finally {
|
|
268
|
+
clearInterval(timer)
|
|
269
|
+
process.off('SIGTERM', stop)
|
|
270
|
+
process.off('SIGINT', stop)
|
|
271
|
+
stop()
|
|
272
|
+
clearTimeout(killTimer)
|
|
273
|
+
await requestLease('return').catch(() => {})
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
}
|
|
278
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Forces each owned tool through the desktop approval owner before execution. */
|
|
2
|
+
/** Loader identity for the optional desktop permission plugin. */
|
|
3
|
+
export const name = 'chatcode-desktop-permission-gate'
|
|
4
|
+
/** Runtime approval service required before mounting the listener. */
|
|
5
|
+
export const inject = ['approval']
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Mount in an interactive profile and register an effect-owned check before tool execution.
|
|
9
|
+
* @param ctx - Runtime plugin context with the declared approval service.
|
|
10
|
+
*/
|
|
11
|
+
export function apply(ctx) {
|
|
12
|
+
ctx.on('tools/pre-execute', async (exec, next) => {
|
|
13
|
+
const earlier = await next()
|
|
14
|
+
if (earlier.kind !== 'allow') return earlier
|
|
15
|
+
if (!exec.agent) return { kind: 'deny', reason: 'Desktop permission requires an owned Agent' }
|
|
16
|
+
const outcome = await ctx.approval.request({
|
|
17
|
+
agent: exec.agent,
|
|
18
|
+
toolName: exec.name,
|
|
19
|
+
callId: exec.callId,
|
|
20
|
+
input: exec.arguments,
|
|
21
|
+
reason: 'Review this operation using the desktop permission policy.',
|
|
22
|
+
signal: exec.signal,
|
|
23
|
+
})
|
|
24
|
+
if (outcome === 'allowed-once') return { kind: 'allow' }
|
|
25
|
+
if (outcome === 'cancelled') return { kind: 'cancel' }
|
|
26
|
+
return { kind: 'deny', reason: outcome === 'rejected' ? 'User permission denied' : 'Desktop permission unavailable' }
|
|
27
|
+
}, { global: true })
|
|
28
|
+
}
|