dsh-plugin-dev-kb 1.5.2 → 1.8.0
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/CHANGELOG.md +51 -0
- package/README.en.md +31 -9
- package/README.md +42 -14
- package/kb/INDEX.md +3 -3
- package/kb/README.md +9 -4
- package/kb/extra/AGENTS.md +1 -1
- package/kb/extra/cli-help.md +15 -7
- package/kb/extra/cli-help.zh.md +15 -7
- package/kb/extra/cookbook/adding-a-plugin-preview.md +18 -25
- package/kb/extra/cookbook/adding-a-plugin-preview.zh.md +18 -25
- package/kb/extra/cookbook/reviewing-persistence-type-changes.md +1 -1
- package/kb/extra/cookbook/reviewing-persistence-type-changes.zh.md +1 -1
- package/kb/extra/cookbook/reviewing-ui-design.md +166 -0
- package/kb/extra/cookbook/reviewing-ui-design.zh.md +166 -0
- package/kb/extra/deepseek-llm-api-wire-extensions.md +2 -2
- package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +2 -2
- package/kb/extra/defensive-patterns/conversation-and-session.md +2 -2
- package/kb/extra/defensive-patterns/conversation-and-session.zh.md +2 -2
- package/kb/extra/defensive-patterns/general.md +2 -0
- package/kb/extra/defensive-patterns/general.zh.md +2 -0
- package/kb/extra/defensive-patterns/package-surface.md +1 -0
- package/kb/extra/defensive-patterns/package-surface.zh.md +1 -0
- package/kb/extra/defensive-patterns/remote-and-api.md +5 -3
- package/kb/extra/defensive-patterns/remote-and-api.zh.md +5 -3
- package/kb/extra/development.md +16 -9
- package/kb/extra/development.zh.md +16 -9
- package/kb/extra/event-producer-consumer.md +64 -51
- package/kb/extra/event-producer-consumer.zh.md +64 -51
- package/kb/extra/i18n/README.md +2 -0
- package/kb/extra/i18n/README.zh.md +2 -0
- package/kb/extra/module-graph.md +204 -92
- package/kb/extra/module-graph.zh.md +204 -92
- package/kb/extra/persistence-changes/2026-10-13-liveshare-share-viewer-principal.md +60 -0
- package/kb/extra/persistence-changes/2026-10-13-liveshare-share-viewer-principal.zh.md +60 -0
- package/kb/extra/persistence-changes/2026-10-19-session-team-mode.md +48 -0
- package/kb/extra/persistence-changes/2026-10-19-session-team-mode.zh.md +48 -0
- package/kb/extra/persistence-changes/2026-10-22-action-card-status.md +60 -0
- package/kb/extra/persistence-changes/2026-10-22-action-card-status.zh.md +60 -0
- package/kb/extra/persistence-changes/2026-10-25-skill-catalog-incomplete.md +60 -0
- package/kb/extra/persistence-changes/2026-10-25-skill-catalog-incomplete.zh.md +60 -0
- package/kb/extra/persistence-changes/2026-10-27-retry-control-input.md +60 -0
- package/kb/extra/persistence-changes/2026-10-27-retry-control-input.zh.md +60 -0
- package/kb/extra/persistence-changes/2026-10-27-subagent-settlement-attribution.md +60 -0
- package/kb/extra/persistence-changes/2026-10-27-subagent-settlement-attribution.zh.md +60 -0
- package/kb/extra/persistence-changes/2026-11-02-subagent-catalog-names.md +48 -0
- package/kb/extra/persistence-changes/2026-11-02-subagent-catalog-names.zh.md +48 -0
- package/kb/extra/persistence-changes/2026-11-02-team-task-owner-names.md +48 -0
- package/kb/extra/persistence-changes/2026-11-02-team-task-owner-names.zh.md +48 -0
- package/kb/extra/persistence-changes/README.md +2 -0
- package/kb/extra/persistence-changes/README.zh.md +2 -0
- package/kb/extra/persistence-changes/historical-formats/README.md +1 -1
- package/kb/extra/persistence-changes/historical-formats/README.zh.md +1 -1
- package/kb/extra/rescope.md +7 -5
- package/kb/extra/rescope.zh.md +7 -5
- package/kb/extra/subsystems/agent-team.md +38 -75
- package/kb/extra/subsystems/agent-team.zh.md +38 -75
- package/kb/extra/subsystems/attachment.md +36 -13
- package/kb/extra/subsystems/attachment.zh.md +36 -13
- package/kb/extra/subsystems/boot.md +179 -5
- package/kb/extra/subsystems/boot.zh.md +179 -5
- package/kb/extra/subsystems/computer-use.md +78 -0
- package/kb/extra/subsystems/computer-use.zh.md +78 -0
- package/kb/extra/subsystems/deliverables.md +2 -0
- package/kb/extra/subsystems/deliverables.zh.md +2 -0
- package/kb/extra/subsystems/forge.md +1226 -0
- package/kb/extra/subsystems/forge.zh.md +1226 -0
- package/kb/extra/subsystems/liveshare.md +158 -0
- package/kb/extra/subsystems/liveshare.zh.md +158 -0
- package/kb/extra/subsystems/mcp.md +96 -1
- package/kb/extra/subsystems/mcp.zh.md +96 -1
- package/kb/extra/subsystems/worktrees.md +54 -3
- package/kb/extra/subsystems/worktrees.zh.md +54 -3
- package/kb/extra/testing.md +1 -1
- package/kb/extra/testing.zh.md +1 -1
- package/kb/extra/ui-design-review-cases.md +445 -0
- package/kb/extra/ui-design-review-cases.zh.md +445 -0
- package/kb/extra/ui-radius.md +3 -1
- package/kb/extra/ui-radius.zh.md +3 -1
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.md +1 -1
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.zh.md +1 -1
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/cordis-timer-wrappers/guide.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/cordis-timer-wrappers/guide.zh.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-manager-view-fields/guide.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-manager-view-fields/guide.zh.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.4/model-switch-compaction/guide.md +30 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.4/model-switch-compaction/guide.zh.md +30 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.4/session-model-selection/guide.md +28 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.4/session-model-selection/guide.zh.md +28 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.1/agent-instructions-chain-budgets/guide.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.1/agent-instructions-chain-budgets/guide.zh.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.1/subagent-control-tools/guide.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.1/subagent-control-tools/guide.zh.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-runtime-owner/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-runtime-owner/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-team-subagents/guide.md +31 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/agent-team-subagents/guide.zh.md +31 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/approval-projection-dependency/guide.md +34 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/approval-projection-dependency/guide.zh.md +34 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-shutdown/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-shutdown/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-user-sources/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/auto-review-user-sources/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/built-in-japanese/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/built-in-japanese/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/conditional-tools/guide.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/conditional-tools/guide.zh.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/context-menu-services/guide.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/context-menu-services/guide.zh.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-consent-storage/guide.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-consent-storage/guide.zh.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-preset-scope/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-preset-scope/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-relative-coordinates/guide.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/cua-relative-coordinates/guide.zh.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/file-drag-callbacks/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/file-drag-callbacks/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/headless-policy-composition/guide.md +27 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/headless-policy-composition/guide.zh.md +27 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/model-badge-package-removal/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/model-badge-package-removal/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/new-session-blank-reuse/guide.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/new-session-blank-reuse/guide.zh.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/node-24/guide.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/node-24/guide.zh.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/official-bundle-lists/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/official-bundle-lists/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/persistent-terminal-controls/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/persistent-terminal-controls/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-default-capacities/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-default-capacities/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-model-catalog/guide.md +53 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-model-catalog/guide.zh.md +53 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-protocol-replay/guide.md +30 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/pi-ai-protocol-replay/guide.zh.md +30 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/ptc-script-format/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/ptc-script-format/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-desktop-context/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-desktop-context/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-minimal-checkpoints/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/sdk-minimal-checkpoints/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-projection-handles/guide.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-projection-handles/guide.zh.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-store-writes/guide.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-store-writes/guide.zh.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-team-mode/guide.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/session-team-mode/guide.zh.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-activation-options/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-activation-options/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-service-methods/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-service-methods/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-user-controls/guide.md +26 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/subagent-user-controls/guide.zh.md +26 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/tool-executor-plugins/guide.md +35 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/tool-executor-plugins/guide.zh.md +35 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/web-fetch-private-destinations/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/web-fetch-private-destinations/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/webserver-index-peer/guide.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.2/webserver-index-peer/guide.zh.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/attachment-read-access/guide.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/attachment-read-access/guide.zh.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/computer-use-helper-permissions/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/computer-use-helper-permissions/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/cua-bundle-id-consent/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/cua-bundle-id-consent/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/generated-worktree-names/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/generated-worktree-names/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/inbox-only-agent-wait/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/inbox-only-agent-wait/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/independent-session-forks/guide.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/independent-session-forks/guide.zh.md +23 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/ptc-caller-cancellation/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/ptc-caller-cancellation/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/session-follow-activation/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/session-follow-activation/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/subagent-runtime-ownership/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/subagent-runtime-ownership/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-mode-menu/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-mode-menu/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-projection/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/team-projection/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-file-downloads/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-file-downloads/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-search-defaults/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.3/web-search-defaults/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.4/model-listing-refresh/guide.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.4/model-listing-refresh/guide.zh.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.4/reasoning-body-props/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-rc.4/reasoning-body-props/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/context-menu-target/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/context-menu-target/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cordis-loader-entry-trees/guide.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cordis-loader-entry-trees/guide.zh.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/css-anchored-menus/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/css-anchored-menus/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cua-source-dev-helper/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/cua-source-dev-helper/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/desktop-stable-channel/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-git-permissions/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-git-permissions/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-worktree-entry/guide.md +29 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/forge-worktree-entry/guide.zh.md +29 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.md +29 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/fs-observation-policy-default-off/guide.zh.md +29 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-request-purpose-declarations/guide.md +29 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/llm-request-purpose-declarations/guide.zh.md +29 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/pi-ai-request-image-count/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/pi-ai-request-image-count/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-event-frames/guide.md +32 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-event-frames/guide.zh.md +32 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-released-checkpoint/guide.md +30 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-released-checkpoint/guide.zh.md +30 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-snapshot-scope/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/projection-snapshot-scope/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/retained-ptc-timeout/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/retained-ptc-timeout/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-agent-tools/guide.md +37 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-agent-tools/guide.zh.md +37 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-remote-host-tasks/guide.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/schedule-remote-host-tasks/guide.zh.md +22 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/sdk-run-commands/guide.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/sdk-run-commands/guide.zh.md +24 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/session-header-menu/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/session-header-menu/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/subagent-explicit-reasoning/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/subagent-explicit-reasoning/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-credential-modes/guide.zh.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-default-provider/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.2/web-search-default-provider/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.3/chat-process-activity-context/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.3/chat-process-activity-context/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.3/subagent-names/guide.md +29 -0
- package/kb/extra/upgrade-guide/v0.2.2-alpha.3/subagent-names/guide.zh.md +29 -0
- package/kb/extra/web-styling.md +19 -1
- package/kb/extra/web-styling.zh.md +19 -1
- package/kb/meta/search-index.json +1272 -1098
- package/kb/meta/source.json +8 -4
- package/kb/site/develop/cordis-tutorial/04-events.md +1 -1
- package/kb/site/develop/cordis-tutorial/07-into-the-harness.md +5 -4
- package/kb/site/develop/framework/events.md +1 -1
- package/kb/site/develop/practice/dynamic-cordis.md +1 -1
- package/kb/site/en/develop/cordis-tutorial/04-events.md +1 -1
- package/kb/site/en/develop/cordis-tutorial/07-into-the-harness.md +5 -4
- package/kb/site/en/develop/framework/events.md +1 -1
- package/kb/site/en/develop/practice/dynamic-cordis.md +1 -1
- package/kb/site/en/guide/network-proxy.md +1 -1
- package/kb/site/en/guide/plugin-market.md +10 -10
- package/kb/site/en/guide/providers.md +5 -1
- package/kb/site/en/guide/python-sdk.md +17 -2
- package/kb/site/en/guide/schedule.md +45 -26
- package/kb/site/en/reference/agent-lifecycle.md +3 -1
- package/kb/site/en/reference/api-gateway.md +4 -4
- package/kb/site/en/reference/capability-seams.md +65 -17
- package/kb/site/en/reference/config-catalog.md +560 -238
- package/kb/site/en/reference/cookbook/adding-a-package.md +4 -2
- package/kb/site/en/reference/cookbook/extension-cookbook.md +1 -1
- package/kb/site/en/reference/cordis-api/context.md +1 -1
- package/kb/site/en/reference/cordis-api/events.md +9 -9
- package/kb/site/en/reference/cordis-api/fiber.md +85 -32
- package/kb/site/en/reference/cordis-api/inherited.md +10 -9
- package/kb/site/en/reference/experimental-persistence-catalog.md +3 -0
- package/kb/site/en/reference/index.md +14 -8
- package/kb/site/en/reference/persistence-catalog.md +532 -246
- package/kb/site/en/reference/subsystems/client-modules.md +19 -11
- package/kb/site/en/reference/subsystems/compaction.md +1 -1
- package/kb/site/en/reference/subsystems/conversation.md +2 -0
- package/kb/site/en/reference/subsystems/core.md +119 -65
- package/kb/site/en/reference/subsystems/filesystem.md +202 -28
- package/kb/site/en/reference/subsystems/index.md +3 -1
- package/kb/site/en/reference/subsystems/llm-streaming.md +92 -4
- package/kb/site/en/reference/subsystems/persistence.md +17 -7
- package/kb/site/en/reference/subsystems/plan.md +4 -4
- package/kb/site/en/reference/subsystems/ptc-runtime.md +12 -5
- package/kb/site/en/reference/subsystems/sandbox.md +11 -4
- package/kb/site/en/reference/subsystems/schedule.md +194 -430
- package/kb/site/en/reference/subsystems/session-projection.md +186 -44
- package/kb/site/en/reference/subsystems/session-reference.md +4 -3
- package/kb/site/en/reference/subsystems/session.md +119 -31
- package/kb/site/en/reference/subsystems/sidebar-right.md +12 -11
- package/kb/site/en/reference/subsystems/skills.md +4 -4
- package/kb/site/en/reference/subsystems/slots.md +30 -3
- package/kb/site/en/reference/subsystems/storage.md +26 -9
- package/kb/site/en/reference/subsystems/subagent.md +119 -102
- package/kb/site/en/reference/subsystems/system-prompt.md +13 -11
- package/kb/site/en/reference/subsystems/token-meter.md +45 -0
- package/kb/site/en/reference/subsystems/tools.md +222 -82
- package/kb/site/en/reference/subsystems/typert.md +21 -11
- package/kb/site/en/reference/subsystems/user-questions.md +22 -6
- package/kb/site/en/reference/subsystems/web-client.md +1 -1
- package/kb/site/en/reference/subsystems/web-server.md +68 -23
- package/kb/site/en/reference/subsystems/web.md +79 -21
- package/kb/site/en/reference/tool-catalog.md +270 -395
- package/kb/site/en/reference/tool-execution-pipeline.md +5 -4
- package/kb/site/guide/network-proxy.md +1 -1
- package/kb/site/guide/plugin-market.md +10 -10
- package/kb/site/guide/providers.md +5 -1
- package/kb/site/guide/python-sdk.md +17 -2
- package/kb/site/guide/schedule.md +45 -26
- package/kb/site/reference/agent-lifecycle.md +3 -1
- package/kb/site/reference/api-gateway.md +4 -4
- package/kb/site/reference/capability-seams.md +65 -17
- package/kb/site/reference/config-catalog.md +560 -238
- package/kb/site/reference/cookbook/adding-a-package.md +4 -2
- package/kb/site/reference/cookbook/extension-cookbook.md +1 -1
- package/kb/site/reference/cordis-api/context.md +1 -1
- package/kb/site/reference/cordis-api/events.md +9 -9
- package/kb/site/reference/cordis-api/fiber.md +87 -32
- package/kb/site/reference/cordis-api/inherited.md +10 -9
- package/kb/site/reference/experimental-persistence-catalog.md +3 -0
- package/kb/site/reference/index.md +14 -8
- package/kb/site/reference/persistence-catalog.md +532 -246
- package/kb/site/reference/subsystems/client-modules.md +19 -11
- package/kb/site/reference/subsystems/compaction.md +1 -1
- package/kb/site/reference/subsystems/conversation.md +4 -0
- package/kb/site/reference/subsystems/core.md +119 -65
- package/kb/site/reference/subsystems/filesystem.md +202 -28
- package/kb/site/reference/subsystems/index.md +3 -1
- package/kb/site/reference/subsystems/llm-streaming.md +92 -4
- package/kb/site/reference/subsystems/persistence.md +17 -7
- package/kb/site/reference/subsystems/plan.md +4 -4
- package/kb/site/reference/subsystems/ptc-runtime.md +12 -5
- package/kb/site/reference/subsystems/sandbox.md +11 -4
- package/kb/site/reference/subsystems/schedule.md +197 -433
- package/kb/site/reference/subsystems/session-projection.md +186 -44
- package/kb/site/reference/subsystems/session-reference.md +4 -3
- package/kb/site/reference/subsystems/session.md +119 -31
- package/kb/site/reference/subsystems/sidebar-right.md +12 -11
- package/kb/site/reference/subsystems/skills.md +4 -4
- package/kb/site/reference/subsystems/slots.md +30 -3
- package/kb/site/reference/subsystems/storage.md +26 -9
- package/kb/site/reference/subsystems/subagent.md +119 -102
- package/kb/site/reference/subsystems/system-prompt.md +13 -11
- package/kb/site/reference/subsystems/token-meter.md +45 -0
- package/kb/site/reference/subsystems/tools.md +222 -82
- package/kb/site/reference/subsystems/typert.md +21 -11
- package/kb/site/reference/subsystems/user-questions.md +22 -6
- package/kb/site/reference/subsystems/web-client.md +1 -1
- package/kb/site/reference/subsystems/web-server.md +68 -23
- package/kb/site/reference/subsystems/web.md +79 -21
- package/kb/site/reference/tool-catalog.md +273 -399
- package/kb/site/reference/tool-execution-pipeline.md +4 -3
- package/lib/index.js +268 -11
- package/lib/kb-search.js +261 -0
- package/lib/kb-version.js +118 -0
- package/package.json +5 -3
- package/scripts/refresh-kb.mjs +153 -0
- package/scripts/selfcheck.mjs +28 -0
- package/scripts/smoke.mjs +77 -0
- package/skills/dsh-plugin-dev-kb.md +8 -7
- package/skills/dsh-plugin-starter.md +65 -0
- package/skills/dsh-upgrade-assistant.md +62 -0
- package/kb/extra/agent-lifecycle.md +0 -91
- package/kb/extra/agent-lifecycle.zh.md +0 -93
- package/kb/extra/api-gateway.md +0 -172
- package/kb/extra/api-gateway.zh.md +0 -178
- package/kb/extra/architecture.md +0 -165
- package/kb/extra/architecture.zh.md +0 -169
- package/kb/extra/capability-seams.md +0 -714
- package/kb/extra/capability-seams.zh.md +0 -716
- package/kb/extra/config-catalog.md +0 -4801
- package/kb/extra/config-catalog.zh.md +0 -4803
- package/kb/extra/cookbook/adding-a-package.md +0 -170
- package/kb/extra/cookbook/adding-a-package.zh.md +0 -170
- package/kb/extra/cookbook/adding-a-settings-card.md +0 -72
- package/kb/extra/cookbook/adding-a-settings-card.zh.md +0 -72
- package/kb/extra/cookbook/adding-a-tool.md +0 -101
- package/kb/extra/cookbook/adding-a-tool.zh.md +0 -103
- package/kb/extra/cookbook/adding-an-llm-adapter.md +0 -43
- package/kb/extra/cookbook/adding-an-llm-adapter.zh.md +0 -43
- package/kb/extra/cookbook/extension-cookbook.md +0 -132
- package/kb/extra/cookbook/extension-cookbook.zh.md +0 -136
- package/kb/extra/cordis-api/context.md +0 -364
- package/kb/extra/cordis-api/context.zh.md +0 -366
- package/kb/extra/cordis-api/events.md +0 -207
- package/kb/extra/cordis-api/events.zh.md +0 -209
- package/kb/extra/cordis-api/fiber.md +0 -375
- package/kb/extra/cordis-api/fiber.zh.md +0 -377
- package/kb/extra/cordis-api/inherited.md +0 -38
- package/kb/extra/cordis-api/registry.md +0 -152
- package/kb/extra/cordis-api/registry.zh.md +0 -154
- package/kb/extra/cordis-api/service.md +0 -102
- package/kb/extra/cordis-api/service.zh.md +0 -104
- package/kb/extra/cordis-tutorial/01-first-plugin.md +0 -95
- package/kb/extra/cordis-tutorial/01-first-plugin.zh.md +0 -95
- package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.md +0 -98
- package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.zh.md +0 -98
- package/kb/extra/cordis-tutorial/03-services.md +0 -98
- package/kb/extra/cordis-tutorial/03-services.zh.md +0 -98
- package/kb/extra/cordis-tutorial/04-events.md +0 -144
- package/kb/extra/cordis-tutorial/04-events.zh.md +0 -144
- package/kb/extra/cordis-tutorial/05-config.md +0 -111
- package/kb/extra/cordis-tutorial/05-config.zh.md +0 -111
- package/kb/extra/cordis-tutorial/06-composition-and-hmr.md +0 -113
- package/kb/extra/cordis-tutorial/06-composition-and-hmr.zh.md +0 -113
- package/kb/extra/cordis-tutorial/07-into-the-harness.md +0 -108
- package/kb/extra/cordis-tutorial/07-into-the-harness.zh.md +0 -108
- package/kb/extra/cordis-tutorial/index.md +0 -60
- package/kb/extra/cordis-tutorial/index.zh.md +0 -62
- package/kb/extra/experimental-persistence-catalog.md +0 -17
- package/kb/extra/experimental-persistence-catalog.zh.md +0 -17
- package/kb/extra/persistence-catalog.md +0 -9140
- package/kb/extra/persistence-catalog.zh.md +0 -9142
- package/kb/extra/subsystems/README.md +0 -76
- package/kb/extra/subsystems/README.zh.md +0 -76
- package/kb/extra/subsystems/approval.md +0 -170
- package/kb/extra/subsystems/approval.zh.md +0 -170
- package/kb/extra/subsystems/client-modules.md +0 -198
- package/kb/extra/subsystems/client-modules.zh.md +0 -198
- package/kb/extra/subsystems/client-resources.md +0 -92
- package/kb/extra/subsystems/client-resources.zh.md +0 -92
- package/kb/extra/subsystems/commands.md +0 -223
- package/kb/extra/subsystems/commands.zh.md +0 -223
- package/kb/extra/subsystems/compaction.md +0 -284
- package/kb/extra/subsystems/compaction.zh.md +0 -284
- package/kb/extra/subsystems/conversation.md +0 -301
- package/kb/extra/subsystems/conversation.zh.md +0 -303
- package/kb/extra/subsystems/core.md +0 -1113
- package/kb/extra/subsystems/core.zh.md +0 -1125
- package/kb/extra/subsystems/credentials.md +0 -493
- package/kb/extra/subsystems/credentials.zh.md +0 -493
- package/kb/extra/subsystems/filesystem.md +0 -530
- package/kb/extra/subsystems/filesystem.zh.md +0 -530
- package/kb/extra/subsystems/goal.md +0 -313
- package/kb/extra/subsystems/goal.zh.md +0 -313
- package/kb/extra/subsystems/jobs.md +0 -554
- package/kb/extra/subsystems/jobs.zh.md +0 -554
- package/kb/extra/subsystems/llm-streaming.md +0 -1196
- package/kb/extra/subsystems/llm-streaming.zh.md +0 -1202
- package/kb/extra/subsystems/lsp.md +0 -202
- package/kb/extra/subsystems/lsp.zh.md +0 -202
- package/kb/extra/subsystems/permission-presets.md +0 -167
- package/kb/extra/subsystems/permission-presets.zh.md +0 -167
- package/kb/extra/subsystems/persistence.md +0 -418
- package/kb/extra/subsystems/persistence.zh.md +0 -418
- package/kb/extra/subsystems/plan.md +0 -87
- package/kb/extra/subsystems/plan.zh.md +0 -87
- package/kb/extra/subsystems/ptc-runtime.md +0 -250
- package/kb/extra/subsystems/ptc-runtime.zh.md +0 -250
- package/kb/extra/subsystems/sandbox.md +0 -221
- package/kb/extra/subsystems/sandbox.zh.md +0 -221
- package/kb/extra/subsystems/schedule.md +0 -550
- package/kb/extra/subsystems/schedule.zh.md +0 -550
- package/kb/extra/subsystems/scope.md +0 -59
- package/kb/extra/subsystems/scope.zh.md +0 -61
- package/kb/extra/subsystems/session-projection.md +0 -356
- package/kb/extra/subsystems/session-projection.zh.md +0 -356
- package/kb/extra/subsystems/session-query.md +0 -511
- package/kb/extra/subsystems/session-query.zh.md +0 -511
- package/kb/extra/subsystems/session-reference.md +0 -224
- package/kb/extra/subsystems/session-reference.zh.md +0 -224
- package/kb/extra/subsystems/session-telemetry.md +0 -212
- package/kb/extra/subsystems/session-telemetry.zh.md +0 -212
- package/kb/extra/subsystems/session-title.md +0 -213
- package/kb/extra/subsystems/session-title.zh.md +0 -213
- package/kb/extra/subsystems/session.md +0 -1339
- package/kb/extra/subsystems/session.zh.md +0 -1343
- package/kb/extra/subsystems/settings.md +0 -155
- package/kb/extra/subsystems/settings.zh.md +0 -155
- package/kb/extra/subsystems/shell.md +0 -314
- package/kb/extra/subsystems/shell.zh.md +0 -314
- package/kb/extra/subsystems/sidebar-right.md +0 -160
- package/kb/extra/subsystems/sidebar-right.zh.md +0 -160
- package/kb/extra/subsystems/skills.md +0 -352
- package/kb/extra/subsystems/skills.zh.md +0 -352
- package/kb/extra/subsystems/slots.md +0 -200
- package/kb/extra/subsystems/slots.zh.md +0 -204
- package/kb/extra/subsystems/spill.md +0 -124
- package/kb/extra/subsystems/spill.zh.md +0 -124
- package/kb/extra/subsystems/storage.md +0 -259
- package/kb/extra/subsystems/storage.zh.md +0 -259
- package/kb/extra/subsystems/subagent.md +0 -686
- package/kb/extra/subsystems/subagent.zh.md +0 -688
- package/kb/extra/subsystems/subprocess.md +0 -321
- package/kb/extra/subsystems/subprocess.zh.md +0 -321
- package/kb/extra/subsystems/system-prompt.md +0 -254
- package/kb/extra/subsystems/system-prompt.zh.md +0 -254
- package/kb/extra/subsystems/terminal.md +0 -184
- package/kb/extra/subsystems/terminal.zh.md +0 -184
- package/kb/extra/subsystems/token-meter.md +0 -106
- package/kb/extra/subsystems/token-meter.zh.md +0 -106
- package/kb/extra/subsystems/tools.md +0 -747
- package/kb/extra/subsystems/tools.zh.md +0 -747
- package/kb/extra/subsystems/typert.md +0 -690
- package/kb/extra/subsystems/typert.zh.md +0 -690
- package/kb/extra/subsystems/user-questions.md +0 -307
- package/kb/extra/subsystems/user-questions.zh.md +0 -307
- package/kb/extra/subsystems/web-client.md +0 -100
- package/kb/extra/subsystems/web-client.zh.md +0 -100
- package/kb/extra/subsystems/web-server.md +0 -302
- package/kb/extra/subsystems/web-server.zh.md +0 -302
- package/kb/extra/subsystems/web.md +0 -206
- package/kb/extra/subsystems/web.zh.md +0 -206
- package/kb/extra/subsystems/workflow.md +0 -278
- package/kb/extra/subsystems/workflow.zh.md +0 -278
- package/kb/extra/subsystems/workspace.md +0 -647
- package/kb/extra/subsystems/workspace.zh.md +0 -647
- package/kb/extra/tool-catalog.md +0 -2824
- package/kb/extra/tool-catalog.zh.md +0 -2832
- package/kb/extra/tool-execution-pipeline.md +0 -65
- package/kb/extra/tool-execution-pipeline.zh.md +0 -67
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
# Cookbook: adding a workspace package
|
|
2
|
-
|
|
3
|
-
English | [中文](adding-a-package.zh.md)
|
|
4
|
-
|
|
5
|
-
The file-by-file checklist for a new `@deepseek-ai/dsh-<name>` package. This checklist is validated against the bash and adapter packages as templates; if it drifts from them, fix it here.
|
|
6
|
-
|
|
7
|
-
## 1. Create the package
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
packages/<group>/<pkg>/
|
|
11
|
-
package.json # copy from packages/core/tools, adjust name/description/deps
|
|
12
|
-
tsconfig.json # extends ../../../tsconfig.base.json, rootDir src,
|
|
13
|
-
# outDir lib/types, references: ../../../vendor/cosmokit,
|
|
14
|
-
# ../../../vendor/cordis (+ ../../../vendor/schemastery if
|
|
15
|
-
# you use Config, + ../../<group>/<dep> for each dsh dep)
|
|
16
|
-
src/index.ts # service default export or plugin (name/inject/apply/Config)
|
|
17
|
-
locale/en.json # optional display metadata: meta.title and meta.description
|
|
18
|
-
locale/zh.json # translations using the same fields
|
|
19
|
-
README.md # service API, events, extension points, design notes,
|
|
20
|
-
# + gated Model Experience context blocks or short form
|
|
21
|
-
# + the gated "Known Limitations and Deferred Work" section
|
|
22
|
-
# (or a whitelist entry in scripts/verify-package-readme-limitations.ts)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Choose an existing group when one matches the package's role (`core`, `llm`, `shell`, `compaction`, `subagent`, `todo`, `session`, `client`/`host`, `util`, or `test-support`). A new group is allowed, but it is a pure container: no `package.json`, no source files, and packages still sit exactly one level below it.
|
|
26
|
-
|
|
27
|
-
package.json invariants (enforced by `pnpm run constraints` / `scripts/check-workspace-constraints.ts`): `private: true`, a `version` matching the root `package.json`, `type: module`, `main: "lib/index.js"`, `types: "lib/types/index.d.ts"`, `exports["."].types: "./lib/types/index.d.ts"`, `exports["."].default: "./lib/index.js"`, `@deepseek-ai/cordis` in BOTH peerDependencies and devDependencies (same range). Mirror every dsh peer dependency in devDependencies. `@deepseek-ai/schemastery` goes in `dependencies` (it is a runtime validator), matching agent-loop. The `files` list contains exactly `lib/index.js`, `lib/types/**/*.d.ts`, and package-specific runtime artifacts recognized by the gate. A package whose runtime export points into the emitted tree also includes `lib/types/**/*.js`. Do not publish `src`, declaration maps, JS maps, or stale root declaration files. CLI app packages with a package `bin` include `lib/bin.js` immediately after `lib/index.js` in `files`.
|
|
28
|
-
|
|
29
|
-
In-package relative imports use explicit `.ts` specifiers in source (for example, `export * from './types.ts'`). The compiler rewrites those to `.js` in emitted JS and leaves explicit `.ts` specifiers in declarations, which standard NodeNext/Node16 TypeScript consumers resolve to the sibling `.d.ts` files.
|
|
30
|
-
|
|
31
|
-
## 2. Register it in the root configs
|
|
32
|
-
|
|
33
|
-
| File | Change |
|
|
34
|
-
|---|---|
|
|
35
|
-
| `tsconfig.base.json` | no edit for an existing group; for a new group, add a `./packages/<group>/*/src` candidate to the `@deepseek-ai/dsh-*` wildcard |
|
|
36
|
-
| `tsconfig.host.json` (Host package) or `tsconfig.client.json` (Client package) | add `{ "path": "./packages/<group>/<pkg>" }` to `references` — an ordinary package belongs to exactly one aggregate, never both. `api/remotes` uses a repository-specific split because the Host generates a contract that the Client consumes in a later phase; new packages must not copy it ([layout](../development.md#typescript-project-layout)) |
|
|
37
|
-
|
|
38
|
-
A `packages/client/*` package additionally extends `tsconfig.base.client.json` instead of `tsconfig.base.json`, and a client plugin package declares `dsh.client` in package.json, exports `./client`, and calls the shared tsdown preset (`packages/client/tsdown.client.ts`) — see [packages/client/AGENTS.md](../../packages/client/AGENTS.md) for the client-side contract.
|
|
39
|
-
|
|
40
|
-
Covered automatically by globs or package-manifest discovery — no edits needed: root `package.json` workspaces, `scripts/publint-all.ts`, `tsdown.config.ts`, `.oxlintrc.json`, `scripts/check-workspace-constraints.ts`.
|
|
41
|
-
|
|
42
|
-
## 3. Decide the package topology
|
|
43
|
-
|
|
44
|
-
For a swappable capability, separate Service Definition / Service Provider / Consumer roles into packages when they evolve independently (see docs/architecture.md § "Capability seams" — the shell trio is the template). A single-purpose plugin stays one package.
|
|
45
|
-
|
|
46
|
-
### Name the role that exists
|
|
47
|
-
|
|
48
|
-
Name the stable current responsibility. Do not name the first implementation, a possible future expansion, or the Cordis base class. An interface package names the capability. An implementation package adds the mechanism, protocol, environment, or vendor that distinguishes it. Use `local` only when same-host execution is part of the contract.
|
|
49
|
-
|
|
50
|
-
Use a singular `ctx` key for one engine, runtime, policy, controller, resolver, store, or current configuration. Use a plural key for a registry or a service that owns multiple named members. The class role and key number must agree. Do not reuse one Cordis `Context` key for incompatible host and client declarations. TypeScript declaration merging sees both faces even when they use separate runtime contexts. Add the role suffix when the natural plural already belongs to another face.
|
|
51
|
-
|
|
52
|
-
| Word | Use it when | Do not use it when |
|
|
53
|
-
|---|---|---|
|
|
54
|
-
| `Controller` | It accepts commands or user intent and changes one existing domain or presentation state. | It executes arbitrary work, owns a provider fleet, or only converts values for display. |
|
|
55
|
-
| `Store` | It owns one data set and mainly offers CRUD, snapshot, or subscription operations for that data. | It validates a state machine, arbitrates authority, dispatches work, or owns provider precedence. A map does not make a class a store. |
|
|
56
|
-
| `Directory` | It exposes entries and metadata for discovery or selection. | Producers register arbitrary implementations into it, or callers execute work through it. |
|
|
57
|
-
| `Presenter` | It is a pure conversion from domain values or tool arguments to render intent. | It performs I/O, subscribes, mutates state, or owns lifecycle. |
|
|
58
|
-
| `Registry` | It owns a dynamic set of named registrations, including lookup, duplicate or precedence rules, lifetime, and disposal. | Its main contract is dispatch, execution, cancellation, policy, or orchestration. |
|
|
59
|
-
| `Runtime` | It runs live work and owns dispatch, cancellation, provider coordination, or operation lifecycle across calls. | It only stores records, returns a catalog, resolves one value, or holds configuration. |
|
|
60
|
-
| `Resolver` | It computes or locates one answer from supplied inputs without owning that answer's lifecycle. | It owns a mutable collection or long-running execution. |
|
|
61
|
-
| `Binder` | It attaches one declared interface to a caller context or lifecycle and returns the bound value. | It owns the value as a collection, controls its domain state, or only converts data. |
|
|
62
|
-
| `Engine` | It implements a domain algorithm or stateful execution model. | It only selects a provider or forwards across a protocol boundary. |
|
|
63
|
-
| `Policy` | It decides what is allowed, selected, limited, or observed. | It performs the mechanism that the decision permits. |
|
|
64
|
-
| `Executor` | It runs one explicit request or resolved specification in one capability. | It owns a broad application lifecycle or provider catalog. |
|
|
65
|
-
| `Gateway` | It adapts a process, network, RPC, or API boundary. | It only registers same-process services or stores metadata. |
|
|
66
|
-
| `Provider` | It supplies one implementation of a capability definition. Add a mechanism or vendor qualifier when several can exist. | It is the capability definition, provider registry, or consumer runtime. |
|
|
67
|
-
| `Backend` | It implements replaceable lower-level persistence, transport, or execution behind a defined interface. | It is a user-facing service or one returned live-resource reference. |
|
|
68
|
-
| `Handle` | It refers to one live resource and controls or observes that resource. | It creates and manages the complete resource pool. |
|
|
69
|
-
| `Config` | It owns one resolved configuration value or one tightly bounded record and its update contract. | It stores a general collection, executes work, or exposes unrelated settings. |
|
|
70
|
-
| `Service` | It owns a cohesive domain service that no sharper role above states honestly. | The name exists only because the class extends Cordis `Service`. |
|
|
71
|
-
|
|
72
|
-
Use `SDK` only for the JSON-RPC client/server protocol used by the supported Python and TypeScript SDKs. DeepSeek Harness itself is an agent harness, not an SDK project. Use the canonical product spelling `Typert`, never `TypeRT` or `typeRT`.
|
|
73
|
-
|
|
74
|
-
<a id="4-write-the-package-readme"></a>
|
|
75
|
-
|
|
76
|
-
## 4. Write the package README
|
|
77
|
-
|
|
78
|
-
Keep package-specific service API, config, events, extension points, and design notes first. Choose the frontmatter `kind` from the four kind labels in the [dsh-doc metadata reference](../../.agents/skills/dsh-doc/references/metadata-links-i18n.md#the-kind-system) — group, reference, library, or bundle — matching the package's repository position and entry shape; each kind selects one README template. The limitations section records durable consumer gaps and non-obvious maintainer constraints owned by this package; ordinary cleanup stays in its source TODO or Agent Note. An indirect Model Experience sentence may name the consumer that surfaces this package's contribution, but it does not restate that consumer's implementation. End a package README with this canonical sequence:
|
|
79
|
-
|
|
80
|
-
````markdown
|
|
81
|
-
## Model Experience
|
|
82
|
-
|
|
83
|
-
### Request context and condition
|
|
84
|
-
|
|
85
|
-
#### What the model sees
|
|
86
|
-
|
|
87
|
-
The exact data-dependent fields, an anchored generated-catalog link, or an introduction to the verbatim literal below.
|
|
88
|
-
|
|
89
|
-
##### Verbatim text for this field, when needed
|
|
90
|
-
|
|
91
|
-
```markdown
|
|
92
|
-
Stable system-prompt prose of any length, or another long non-generated literal, copied exactly from source.
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
#### Token effect
|
|
96
|
-
|
|
97
|
-
Fixed, conditional, retained, replaced, capped, or zero-direct token effect.
|
|
98
|
-
|
|
99
|
-
#### KV Cache effect
|
|
100
|
-
|
|
101
|
-
Append-only, prefix-stable, replacing, or independent behavior, including the exact conditions that may invalidate reuse.
|
|
102
|
-
|
|
103
|
-
## Known Limitations and Deferred Work
|
|
104
|
-
|
|
105
|
-
- **Consumer-visible gap** — exact missing operation or case, its consequence, and any maintainer constraint.
|
|
106
|
-
````
|
|
107
|
-
|
|
108
|
-
Fill Model Experience from the implementation. Use one H3 per direct, conditional, capped, lifetime, or auxiliary model-context entry, with the three ordered H4 fields shown above and one prose paragraph under each. Quote stable text owned by the package: system-prompt prose goes in a titled H5 plus `markdown` fence under the field that introduces it—normally `What the model sees`—other short literals stay inline with named placeholders, and other long literals use the same nested form. Summarize only data-dependent or provider-owned text. A tool-schema entry links its anchored section in the generated [tool catalog](../tool-catalog.md) and states only deltas absent there. Keep prompt and schema entries separate when scoping can hide one without the other. In `KV Cache effect`, distinguish append-only growth, a stable repeated prefix, replacement of earlier request tokens, and an independent model request, then name the package-owned changes that can invalidate reuse. “Does not invalidate” means the package preserves an already-reusable prefix; provider cache availability and eviction remain outside the package contract. The [prose standard](../../.agents/skills/dsh-prose-standard/SKILL.md) governs completeness and ownership; the verifier enforces the required section structure.
|
|
109
|
-
|
|
110
|
-
A package with no context effect or one consumer-owned path uses the audited `None, as ` or `Indirectly, through ` sentence in [`SENTENCE_MODEL_EXPERIENCE`](../../scripts/verify-package-readme-model-experience.ts), followed by a `KV Cache effect` H4 and one non-empty paragraph; a model-agnostic generic package may instead join `NO_MODEL_EXPERIENCE_SECTION`. Do not expand either case into a description of another package's work. The limitations [allowlist](../../scripts/verify-package-readme-limitations.ts) is independent. The [archived Model Experience Agent Note](../../.agents/notes/archived/process/2026-07-12-package-model-experience-contract.md) records the rationale.
|
|
111
|
-
|
|
112
|
-
<a id="plugin-display-metadata"></a>
|
|
113
|
-
|
|
114
|
-
## 5. Add optional plugin display metadata
|
|
115
|
-
|
|
116
|
-
For an npm package plugin, define its title and description in `locale/en.json`. Other language files, such as `locale/zh.json`, use the same fields:
|
|
117
|
-
|
|
118
|
-
```json
|
|
119
|
-
{
|
|
120
|
-
"meta": {
|
|
121
|
-
"title": "Workspace Tools",
|
|
122
|
-
"description": "Tools for your workspace."
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Merge these entries into `package.json`, retaining existing runtime exports and publication files:
|
|
128
|
-
|
|
129
|
-
```json
|
|
130
|
-
{
|
|
131
|
-
"exports": {
|
|
132
|
-
"./package.json": "./package.json",
|
|
133
|
-
"./locale/*.json": "./locale/*.json"
|
|
134
|
-
},
|
|
135
|
-
"files": ["locale/*.json"]
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
Keep language files together in `locale/`, with `en.json` as the discovery entry. Fields are optional; present values must be non-empty strings. Missing files or fields permit fallback, while malformed JSON or invalid fields produce a per-plugin diagnostic.
|
|
140
|
-
|
|
141
|
-
Fields fall back independently before view-specific name formatting, using the existing locale language chain first:
|
|
142
|
-
|
|
143
|
-
- Title: locale `meta.title` → `package.json.name` for a package-root plugin → complete Cordis plugin name.
|
|
144
|
-
- Description: locale `meta.description` → `package.json.description` for a package-root plugin → no description.
|
|
145
|
-
|
|
146
|
-
Export `<package name>/locale/en.json` for locale lookup; expose `<package name>/package.json` for package-field fallback or an icon declaration. A subpath plugin such as `<package name>/search` is not a package and never reads a `package.json`, even one exported at `./search/package.json`; it uses `./search/locale/*.json` for text and `./search/icon` for its image.
|
|
147
|
-
|
|
148
|
-
For an image on bundle cards, details, and component rows, a package-root plugin sets top-level `"icon": "./icon.svg"` in its exported manifest, or exports `./icon` when that field is omitted. A subpath plugin exports its own icon, such as `"./search/icon": "./search.svg"`. Include each image in `files`. A manifest `icon` is relative to the manifest's directory; absolute paths, URLs, paths outside that directory, and symlinks resolving outside it are rejected. An exported icon resolves through Node exports like locale resources and must remain inside its package. SVG, PNG, JPEG (`.jpg`/`.jpeg`), and WebP files are supported up to 256 KiB. Images must be self-contained; SVG is rendered as an image, not inline HTML. The Host returns a data URL without activating the plugin. Invalid declarations or unreadable files produce a metadata diagnostic while retaining valid text, without trying the export; missing or undecodable images use the panel's default artwork.
|
|
149
|
-
|
|
150
|
-
Installed bundle cards and details, component lists and configuration details, and Settings' plugin inventory display this metadata, including disabled and preset plugins. Reads do not activate plugins.
|
|
151
|
-
|
|
152
|
-
Only Settings shortens literal package-name and module-name fallbacks by removing npm scope and Cordis/DSH prefixes; Plugin Manager keeps complete names. Locale titles and descriptions remain unchanged. A row configuration page can use its registered summary when the plugin has no display description.
|
|
153
|
-
|
|
154
|
-
The Install view still uses npm registry information from `pnpm view`, not locale metadata.
|
|
155
|
-
|
|
156
|
-
Verify the result:
|
|
157
|
-
|
|
158
|
-
1. Run `pnpm run verify-package-meta` from the repository root to check fields, resource exports, and publication coverage.
|
|
159
|
-
2. Switch an installed plugin's applicable Plugin Manager and Settings entries between English and Chinese; check the title, description, per-field fallback, and Settings-only compact technical names.
|
|
160
|
-
|
|
161
|
-
## 6. Verify
|
|
162
|
-
|
|
163
|
-
```sh
|
|
164
|
-
pnpm install # registers the workspace
|
|
165
|
-
pnpm run doc-sync
|
|
166
|
-
pnpm run constraints && pnpm run typecheck && pnpm run lint
|
|
167
|
-
pnpm run build && pnpm run hygiene
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
Follow the [repository testing policy](../testing.md) for the behavior-specific checks and coverage required by the new package.
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
# 实操手册:添加 workspace 包
|
|
2
|
-
|
|
3
|
-
[English](adding-a-package.md) | 中文
|
|
4
|
-
|
|
5
|
-
为新建 `@deepseek-ai/dsh-<name>` 包提供的逐文件清单。本清单以 bash 和适配器这两个包为模板进行验证;如果清单与模板有出入,请在此修正。
|
|
6
|
-
|
|
7
|
-
## 1. 创建包
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
packages/<group>/<pkg>/
|
|
11
|
-
package.json # copy from packages/core/tools, adjust name/description/deps
|
|
12
|
-
tsconfig.json # extends ../../../tsconfig.base.json, rootDir src,
|
|
13
|
-
# outDir lib/types, references: ../../../vendor/cosmokit,
|
|
14
|
-
# ../../../vendor/cordis (+ ../../../vendor/schemastery if
|
|
15
|
-
# you use Config, + ../../<group>/<dep> for each dsh dep)
|
|
16
|
-
src/index.ts # service default export or plugin (name/inject/apply/Config)
|
|
17
|
-
locale/en.json # optional display metadata: meta.title and meta.description
|
|
18
|
-
locale/zh.json # translations using the same fields
|
|
19
|
-
README.md # service API, events, extension points, design notes,
|
|
20
|
-
# + gated Model Experience context blocks or short form
|
|
21
|
-
# + the gated "Known Limitations and Deferred Work" section
|
|
22
|
-
# (or a whitelist entry in scripts/verify-package-readme-limitations.ts)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
当已有分组与包的角色匹配时,选择该分组(`core`、`llm`、`shell`、`compaction`、`subagent`、`todo`、`session`、`client`/`host`、`util` 或 `test-support`)。允许新建分组,但分组只是纯容器:没有 `package.json`,没有源文件,包仍然恰好位于其下一层。
|
|
26
|
-
|
|
27
|
-
package.json 不变式(由 `pnpm run constraints` / `scripts/check-workspace-constraints.ts` 强制执行):`private: true`,`version` 与根 `package.json` 一致,`type: module`,`main: "lib/index.js"`,`types: "lib/types/index.d.ts"`,`exports["."].types: "./lib/types/index.d.ts"`,`exports["."].default: "./lib/index.js"`,`@deepseek-ai/cordis` 同时出现在 peerDependencies 和 devDependencies 中(相同范围)。每个 dsh 对等依赖(peer dependency)都要在 devDependencies 中镜像。`@deepseek-ai/schemastery` 放在 `dependencies` 中(它是运行时校验器),与 agent-loop 保持一致。`files` 列表精确包含 `lib/index.js`、`lib/types/**/*.d.ts` 以及门禁认可的包专用运行时产物。如果包的运行时 export 指向输出树,还要包含 `lib/types/**/*.js`。不要发布 `src`、声明映射、JS map 或陈旧的根声明文件。带有 `bin` 的 CLI 应用包在 `files` 中将 `lib/bin.js` 紧跟在 `lib/index.js` 之后。
|
|
28
|
-
|
|
29
|
-
包内的相对导入在源码中使用显式 `.ts` 后缀(例如 `export * from './types.ts'`)。编译器在输出的 JS 中将其重写为 `.js`,在声明文件中保留显式 `.ts` 后缀;标准的 NodeNext/Node16 TypeScript 消费方会将其解析到同目录的 `.d.ts` 文件。
|
|
30
|
-
|
|
31
|
-
## 2. 在根配置中注册
|
|
32
|
-
|
|
33
|
-
| 文件 | 变更 |
|
|
34
|
-
|---|---|
|
|
35
|
-
| `tsconfig.base.json` | 已有分组无需编辑;新分组需为 `@deepseek-ai/dsh-*` 通配符添加 `./packages/<group>/*/src` 候选路径 |
|
|
36
|
-
| `tsconfig.host.json`(Host 包)或 `tsconfig.client.json`(Client 包) | 在 `references` 中添加 `{ "path": "./packages/<group>/<pkg>" }`——普通包恰好属于一个 aggregate,绝不两个都加。`api/remotes` 因 Host 生成约定与 Client 消费约定之间存在顺序依赖而使用仓库专属拆分,新增包不得仿照([布局](../development.zh.md#typescript-project-layout)) |
|
|
37
|
-
|
|
38
|
-
`packages/client/*` 包改为 extends `tsconfig.base.client.json`(而非 `tsconfig.base.json`);client 插件包还需在 package.json 声明 `dsh.client`、导出 `./client`、调用共享 tsdown preset(`packages/client/tsdown.client.ts`)——client 侧见 [packages/client/AGENTS.md](../../packages/client/AGENTS.md)。
|
|
39
|
-
|
|
40
|
-
以下内容由 glob 或包 manifest(元数据清单)发现机制自动覆盖,无需手动编辑:根 `package.json` workspaces、`scripts/publint-all.ts`、`tsdown.config.ts`、`.oxlintrc.json`、`scripts/check-workspace-constraints.ts`。
|
|
41
|
-
|
|
42
|
-
## 3. 确定包拓扑
|
|
43
|
-
|
|
44
|
-
对于可替换的能力,当 Service Definition/Service Provider/Consumer 角色需要独立演进时,将它们拆分到不同包中(见 docs/architecture.md § "Capability seams"——shell 三组件是模板)。单一用途的插件保持为一个包。
|
|
45
|
-
|
|
46
|
-
### 使用符合实际的角色名称
|
|
47
|
-
|
|
48
|
-
名称必须描述当前稳定职责。不要用首个实现、可能的未来扩展或 Cordis 基类命名。接口包使用能力名称。实现包加上能够区分实现的机制、协议、环境或厂商限定词。只有同主机执行属于约定时,才使用 `local`。
|
|
49
|
-
|
|
50
|
-
一个 engine、runtime、policy、controller、resolver、store 或当前配置使用单数 `ctx` key。registry 或拥有多个具名成员的服务使用复数 key。类的角色与 key 的单复数必须一致。不得让不兼容的 host 与 client 声明复用同一个 Cordis `Context` key。即使二者使用独立的运行时 context,TypeScript 声明合并仍会同时看到两种类型。如果自然复数已经属于另一个端面,就增加职责后缀。
|
|
51
|
-
|
|
52
|
-
| 词 | 适用条件 | 不适用条件 |
|
|
53
|
-
|---|---|---|
|
|
54
|
-
| `Controller` | 接受命令或用户意图,并改变一项既有领域状态或展示状态。 | 执行任意工作、拥有一组 provider,或只把值转换为展示形式。 |
|
|
55
|
-
| `Store` | 拥有一组数据,主要提供该数据的 CRUD、snapshot 或 subscription 操作。 | 校验状态机、裁决权限、分派工作或拥有 provider 优先级。类中有 map 不等于 store。 |
|
|
56
|
-
| `Directory` | 暴露供发现或选择的条目及其元数据。 | producer 向其中注册任意实现,或调用方通过它执行工作。 |
|
|
57
|
-
| `Presenter` | 将领域值或工具参数纯转换为渲染意图。 | 执行 I/O、订阅、修改状态或拥有生命周期。 |
|
|
58
|
-
| `Registry` | 拥有一组动态具名注册,以及查询、重复项或优先级规则、生命周期和释放。 | 主要约定是分派、执行、取消、策略或编排。 |
|
|
59
|
-
| `Runtime` | 运行实时工作,并跨调用拥有分派、取消、provider 协调或操作生命周期。 | 只存储记录、返回目录、解析一个值或保存配置。 |
|
|
60
|
-
| `Resolver` | 根据输入计算或定位一个答案,但不拥有该答案的生命周期。 | 拥有可变集合或长时间运行的执行过程。 |
|
|
61
|
-
| `Binder` | 把一个已声明接口绑定到调用方的 context 或生命周期,并返回绑定值。 | 把该值作为集合持有、控制其领域状态,或只转换数据。 |
|
|
62
|
-
| `Engine` | 实现领域算法或有状态执行模型。 | 只选择 provider 或跨协议边界转发请求。 |
|
|
63
|
-
| `Policy` | 决定允许、选择、限制或观察什么。 | 执行该决定所允许的机制。 |
|
|
64
|
-
| `Executor` | 在一项能力中运行一个明确请求或已解析 spec。 | 拥有广泛应用生命周期或 provider 目录。 |
|
|
65
|
-
| `Gateway` | 适配进程、网络、RPC 或 API 边界。 | 只注册同进程服务或存储元数据。 |
|
|
66
|
-
| `Provider` | 提供一项能力定义的一个实现。存在多个实现时,加上机制或厂商限定词。 | 表示能力定义、provider registry 或消费方 runtime。 |
|
|
67
|
-
| `Backend` | 在已定义接口之后实现可替换的底层持久化、传输或执行。 | 表示面向用户的服务或一个已返回的实时资源引用。 |
|
|
68
|
-
| `Handle` | 引用一个实时资源,并控制或观察该资源。 | 创建并管理完整资源池。 |
|
|
69
|
-
| `Config` | 拥有一个已解析配置值,或一项边界严格的配置记录及其更新约定。 | 存储通用集合、执行工作或暴露无关设置。 |
|
|
70
|
-
| `Service` | 拥有一项无法用以上更精确角色诚实描述的内聚领域服务。 | 只因为类继承 Cordis `Service` 而使用该名称。 |
|
|
71
|
-
|
|
72
|
-
只对受支持的 Python 与 TypeScript SDK 所使用的 JSON-RPC 客户端/服务器协议使用 `SDK`。DeepSeek Harness 本身是 agent harness,不是 SDK 项目。产品拼写统一使用 `Typert`,不得使用 `TypeRT` 或 `typeRT`。
|
|
73
|
-
|
|
74
|
-
<a id="4-write-the-package-readme"></a>
|
|
75
|
-
|
|
76
|
-
## 4. 编写包 README
|
|
77
|
-
|
|
78
|
-
将包特有的服务 API、配置、事件、扩展点和设计说明放在前面。根据 [dsh-doc 元数据参考](../../.agents/skills/dsh-doc/references/metadata-links-i18n.md#the-kind-system)中的四种 kind 标签——组、参考、库或 bundle——选择 frontmatter 的 `kind`,使其匹配包在仓库中的位置与入口形态;每个 kind 恰好对应一个 README 模板。limitations 部分记录持久的消费方缺口和本包拥有的非显而易见的维护者约束;日常清理事项留在源码 TODO 或 Agent Note 中。间接的 Model Experience 语句可以点名暴露本包贡献的消费方,但不重述该消费方的实现。包 README 以如下规范序列结尾:
|
|
79
|
-
|
|
80
|
-
````markdown
|
|
81
|
-
## Model Experience
|
|
82
|
-
|
|
83
|
-
### Request context and condition
|
|
84
|
-
|
|
85
|
-
#### What the model sees
|
|
86
|
-
|
|
87
|
-
The exact data-dependent fields, an anchored generated-catalog link, or an introduction to the verbatim literal below.
|
|
88
|
-
|
|
89
|
-
##### Verbatim text for this field, when needed
|
|
90
|
-
|
|
91
|
-
```markdown
|
|
92
|
-
Stable system-prompt prose of any length, or another long non-generated literal, copied exactly from source.
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
#### Token effect
|
|
96
|
-
|
|
97
|
-
Fixed, conditional, retained, replaced, capped, or zero-direct token effect.
|
|
98
|
-
|
|
99
|
-
#### KV Cache effect
|
|
100
|
-
|
|
101
|
-
Append-only, prefix-stable, replacing, or independent behavior, including the exact conditions that may invalidate reuse.
|
|
102
|
-
|
|
103
|
-
## Known Limitations and Deferred Work
|
|
104
|
-
|
|
105
|
-
- **Consumer-visible gap** — exact missing operation or case, its consequence, and any maintainer constraint.
|
|
106
|
-
````
|
|
107
|
-
|
|
108
|
-
根据实现填写 Model Experience。每个直接、条件、上限、生命周期或辅助的模型上下文条目使用一个 H3,包含上述三个有序 H4 字段,每个字段下有一个正文段落。引用包拥有的稳定文本:系统提示词放在引出它的字段下,用带标题的 H5 加 `markdown` 围栏表示,通常归入 `What the model sees`;其他短文本以命名占位符内联,其他长文本使用相同的嵌套形式。仅概述数据依赖或提供方拥有的文本。工具 schema 条目链接到生成的[工具目录](../tool-catalog.zh.md)中对应的锚定章节,仅说明该处缺失的差异。当作用域可以隐藏 prompt 或 schema 其中之一而不影响另一个时,将二者分开。填写 `KV Cache effect` 时,应区分仅追加增长、稳定重复的前缀、替换既有请求 token 和独立模型请求,并列出会使缓存复用失效、且由本包拥有的变化。“不使缓存失效”仅表示本包保留了已有的可复用前缀;缓存是否可用以及何时淘汰不属于本包约定。[行文标准](../../.agents/skills/dsh-prose-standard/SKILL.md)约束完整性与归属;验证器强制执行所需章节结构。
|
|
109
|
-
|
|
110
|
-
没有上下文效果或仅有消费方拥有路径的包使用 [`SENTENCE_MODEL_EXPERIENCE`](../../scripts/verify-package-readme-model-experience.ts) 中经过审计的 `None, as ` 或 `Indirectly, through ` 语句,随后添加 `KV Cache effect` H4 和一个非空正文段落;与模型无关的通用包可以改为加入 `NO_MODEL_EXPERIENCE_SECTION`。两种情况都不要展开为对另一个包工作的描述。limitations [allowlist](../../scripts/verify-package-readme-limitations.ts) 独立管理。[已归档的Model Experience Agent Note](../../.agents/notes/archived/process/2026-07-12-package-model-experience-contract.md) 记录了设计动机。
|
|
111
|
-
|
|
112
|
-
<a id="plugin-display-metadata"></a>
|
|
113
|
-
|
|
114
|
-
## 5. 添加可选的插件展示元信息
|
|
115
|
-
|
|
116
|
-
对于 npm 包插件,在 `locale/en.json` 中定义标题和描述。其他语言文件(如 `locale/zh.json`)使用相同字段:
|
|
117
|
-
|
|
118
|
-
```json
|
|
119
|
-
{
|
|
120
|
-
"meta": {
|
|
121
|
-
"title": "Workspace Tools",
|
|
122
|
-
"description": "Tools for your workspace."
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
将以下条目合并进 `package.json`,保留已有的运行时 exports 和发布文件:
|
|
128
|
-
|
|
129
|
-
```json
|
|
130
|
-
{
|
|
131
|
-
"exports": {
|
|
132
|
-
"./package.json": "./package.json",
|
|
133
|
-
"./locale/*.json": "./locale/*.json"
|
|
134
|
-
},
|
|
135
|
-
"files": ["locale/*.json"]
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
语言文件统一放在 `locale/`,并保留 `en.json` 作为发现入口。字段可选,填写时必须是非空字符串。文件或字段缺失时允许回退,JSON 损坏或字段无效时显示单插件诊断。
|
|
140
|
-
|
|
141
|
-
各字段先独立回退,再按页面规则格式化技术名称;回退优先经过现有 locale 语言链:
|
|
142
|
-
|
|
143
|
-
- 标题:locale `meta.title` → 包根插件的 `package.json.name` → 完整 Cordis 插件名。
|
|
144
|
-
- 描述:locale `meta.description` → 包根插件的 `package.json.description` → 不显示描述。
|
|
145
|
-
|
|
146
|
-
导出 `<包名>/locale/en.json` 供 locale 查询;需要包字段回退或声明图标时,开放 `<包名>/package.json`。`<包名>/search` 这样的子路径插件不是包,从不读取 `package.json`,即使导出了 `./search/package.json`;它用 `./search/locale/*.json` 提供文本,用 `./search/icon` 提供图片。
|
|
147
|
-
|
|
148
|
-
要在组合包卡片、详情和组件行显示图片,包根插件在导出清单顶层设置 `"icon": "./icon.svg"`,或在省略该字段时导出 `./icon`。子路径插件导出自己的图标,例如 `"./search/icon": "./search.svg"`。将每张图片加入 `files`。清单 `icon` 相对于清单所在目录;绝对路径、URL、目录外路径,以及解析到目录外的符号链接均被拒绝。导出的图标像 locale 资源一样经 Node exports 解析,且必须位于所属包内。支持不超过 256 KiB 的 SVG、PNG、JPEG(`.jpg`/`.jpeg`)和 WebP 文件。图片必须自包含;SVG 作为图片渲染,不作为内联 HTML。Host 返回 data URL,不激活插件。声明无效或文件不可读时,显示元信息诊断并保留有效文本,不再尝试导出的图标;图片缺失或无法解码时使用面板的默认插画。
|
|
149
|
-
|
|
150
|
-
已安装 bundle 的卡片和详情、组件列表与配置详情、设置中的插件清单都展示这些元信息,包括禁用插件和预设内插件。读取时不激活插件。
|
|
151
|
-
|
|
152
|
-
仅设置页会移除字面包名和模块名回退值的 npm scope 与 Cordis/DSH 前缀;插件管理页保留完整名称。locale 标题和描述保持原样。插件没有展示描述时,行配置页可以使用注册组件的摘要。
|
|
153
|
-
|
|
154
|
-
Install 界面仍使用 `pnpm view` 返回的 npm registry 信息,不用 locale 元信息替换。
|
|
155
|
-
|
|
156
|
-
验证结果:
|
|
157
|
-
|
|
158
|
-
1. 在仓库根目录运行 `pnpm run verify-package-meta`,检查字段、资源 exports 和发布文件覆盖。
|
|
159
|
-
2. 对已安装插件,在适用的插件管理页与设置条目中切换中英文,检查标题、描述、逐字段回退,以及仅设置页使用的技术短名。
|
|
160
|
-
|
|
161
|
-
## 6. 验证
|
|
162
|
-
|
|
163
|
-
```sh
|
|
164
|
-
pnpm install # registers the workspace
|
|
165
|
-
pnpm run doc-sync
|
|
166
|
-
pnpm run constraints && pnpm run typecheck && pnpm run lint
|
|
167
|
-
pnpm run build && pnpm run hygiene
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
请遵循[仓库测试政策](../testing.zh.md),执行新包所需的行为专项检查并达到相应覆盖率。
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# Cookbook: live configuration forms
|
|
2
|
-
|
|
3
|
-
English | [中文](adding-a-settings-card.zh.md)
|
|
4
|
-
|
|
5
|
-
Declare live fields in the plugin Config schema and expose them through a product-owned settings card. The exported `Config` interface describes the values received by the plugin, including each `Volatile<T>` reference.
|
|
6
|
-
|
|
7
|
-
## 1. Declare live fields
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
import type { Context, Volatile } from '@deepseek-ai/cordis'
|
|
11
|
-
import z from '@deepseek-ai/schemastery'
|
|
12
|
-
|
|
13
|
-
export interface Config {
|
|
14
|
-
endpoint: Volatile<string | undefined>
|
|
15
|
-
retries: Volatile<number>
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Config = z.object({
|
|
19
|
-
endpoint: z.string().volatile(),
|
|
20
|
-
retries: z.number().step(1).min(0).default(3).volatile(),
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export function apply(ctx: Context, config: Config): void {
|
|
24
|
-
ctx.on('loader/volatile-update', () => {
|
|
25
|
-
ctx.logger.info('Retry limit: %d', config.retries.get())
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Read `.get()` when starting an operation. A request that needs a consistent snapshot captures its values once. Use `.check()` for cross-field Config validation; these checks run on the Host before persistence and are omitted from serialized form schemas.
|
|
31
|
-
|
|
32
|
-
## 2. Compose the plugin
|
|
33
|
-
|
|
34
|
-
Give each instance a unique profile entry id. The base bundle mounts settings and config-editor. For custom profiles, see their package READMEs before mounting the same services.
|
|
35
|
-
|
|
36
|
-
`role('secret')` keeps a value out of form responses. Use credential references for values managed by the credentials domain. Ordinary fields stay out of the settings schema.
|
|
37
|
-
|
|
38
|
-
## 3. Verify editing
|
|
39
|
-
|
|
40
|
-
Change a field in Plugins and save. Verify the profile patch, the next consumer operation, unchanged plugin instance identity, and restoration after restart. Reject an invalid value and verify that neither the file nor the live value changed.
|
|
41
|
-
|
|
42
|
-
Custom plugin pages receive `form.state` and `form.mutate(operations, expectedRevision)` from the Plugins page owner. The Host validates full Config and applies edits through ConfigEditor and volatile HMR. The [plugin settings package](../../packages/client/ui-settings-plugins/README.md) owns the existing card examples.
|
|
43
|
-
|
|
44
|
-
## 4. Contribute to another plugin's page
|
|
45
|
-
|
|
46
|
-
A plugin with something to say about a bundle, a row, or an official plugin it does not own registers into `plugins.detail.actions` (a control at the head of the page), `plugins.detail.badge` (a tag beside the title), or `plugins.detail.section` (a section under the page's own content). Every entry is rendered with the page's `subject` — `{ kind: 'bundle', pkg }`, `{ kind: 'row', pkg, row }`, or `{ kind: 'item', id }` — and returns null for a subject it has nothing for:
|
|
47
|
-
|
|
48
|
-
```tsx ignore-check
|
|
49
|
-
ctx.slots.inject('plugins.detail.badge', () => ctx.slots.register({
|
|
50
|
-
name: 'plugins.detail.badge',
|
|
51
|
-
id: 'acme-update',
|
|
52
|
-
locale: 'acmeUpdate',
|
|
53
|
-
}, ({ t, subject }) => subject.kind === 'bundle' && hasUpdate(subject.pkg) ? <Tag tone="info">{t('update')}</Tag> : null))
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## 5. Where the browser half rides
|
|
57
|
-
|
|
58
|
-
The browser half is served to the page by the [client module system](../../packages/client/modules), which scans the enabled Loader entries for packages declaring `dsh.client` and serves each one's built `./client` export — but it attaches a package's half to the Loader row whose specifier is the bare package name. A row mounted from a subpath export never carries a half, so a bundle that splits one package into several rows keeps its half on the root row, and every page it registers goes away when that row is switched off. A sub-plugin whose page must outlive the other rows ships as its own package.
|
|
59
|
-
|
|
60
|
-
The built `./client` file must be in the client module system's lazy-CJS factory format: one script that registers the package name and a `factory(require)` with the page's module loader, described in the [client module system's README](../../packages/client/modules/README.md). The `clientBundle` tsdown preset that emits it lives in `packages/client/tsdown.client.ts` rather than in a published package, so a package outside this repository reproduces that build itself.
|
|
61
|
-
|
|
62
|
-
```jsonc
|
|
63
|
-
{
|
|
64
|
-
"exports": {
|
|
65
|
-
".": { "types": "./lib/types/index.d.ts", "default": "./lib/index.js" },
|
|
66
|
-
"./client": { "types": "./lib/types/client/index.d.ts", "default": "./lib/client.js" }
|
|
67
|
-
},
|
|
68
|
-
"dsh": { "client": { "platform": "web", "inject": ["@deepseek-ai/dsh-client-ui-settings"] } }
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
A companion package for a built-in namespace is the same browser half in a client-only package with an empty Host `apply`, listed in the web composition's plugin roster ([`packages/bundle/web-app/cordis.patch.yml`](../../packages/bundle/web-app/cordis.patch.yml)) and registering into `plugins.item` through `ctx.configForms.whileServed`, so the page exists exactly while the Host serves the namespace.
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# 实践指南:即时配置表单
|
|
2
|
-
|
|
3
|
-
[English](adding-a-settings-card.md) | 中文
|
|
4
|
-
|
|
5
|
-
在插件 Config schema 中声明即时字段,并通过产品所属的设置卡片提供编辑入口。导出的 `Config` 接口描述插件收到的值,包括每个 `Volatile<T>` 引用。
|
|
6
|
-
|
|
7
|
-
## 1. 声明即时字段
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
import type { Context, Volatile } from '@deepseek-ai/cordis'
|
|
11
|
-
import z from '@deepseek-ai/schemastery'
|
|
12
|
-
|
|
13
|
-
export interface Config {
|
|
14
|
-
endpoint: Volatile<string | undefined>
|
|
15
|
-
retries: Volatile<number>
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const Config = z.object({
|
|
19
|
-
endpoint: z.string().volatile(),
|
|
20
|
-
retries: z.number().step(1).min(0).default(3).volatile(),
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export function apply(ctx: Context, config: Config): void {
|
|
24
|
-
ctx.on('loader/volatile-update', () => {
|
|
25
|
-
ctx.logger.info('Retry limit: %d', config.retries.get())
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
在操作开始时读取 `.get()`。需要一致快照的请求一次性捕获所需值。使用 `.check()` 进行跨字段 Config 验证;这些检查在持久化前由 Host 执行,不进入序列化的表单 schema。
|
|
31
|
-
|
|
32
|
-
## 2. 组合插件
|
|
33
|
-
|
|
34
|
-
为每个实例分配唯一的 profile 条目 id。基础组合包挂载 settings 和 config-editor。自定义 profile 挂载这些服务前,请阅读相应包的 README。
|
|
35
|
-
|
|
36
|
-
`role('secret')` 阻止值进入表单响应。对于凭据域管理的值,使用凭据引用。普通字段不进入设置 schema。
|
|
37
|
-
|
|
38
|
-
## 3. 验证编辑
|
|
39
|
-
|
|
40
|
-
在插件页面修改字段并保存。验证 profile patch、消费者下一次操作、插件实例标识不变,以及重启后的恢复。提交无效值,并确认文件和即时值均未改变。
|
|
41
|
-
|
|
42
|
-
自定义插件页面从 Plugins 页面所有者接收 `form.state` 和 `form.mutate(operations, expectedRevision)`。Host 校验完整 Config,并通过 ConfigEditor 和 volatile HMR 应用修改。[插件设置包](../../packages/client/ui-settings-plugins/README.zh.md) 提供现有卡片示例。
|
|
43
|
-
|
|
44
|
-
## 4. 向其他插件的页面贡献内容
|
|
45
|
-
|
|
46
|
-
对某个不属于自己的组合包、行或官方插件有话要说的插件,注册进 `plugins.detail.actions`(页头的控件)、`plugins.detail.badge`(标题旁的标签)或 `plugins.detail.section`(页面自身内容之下的区块)。每个条目都以页面的 `subject` 渲染——`{ kind: 'bundle', pkg }`、`{ kind: 'row', pkg, row }` 或 `{ kind: 'item', id }`——对无话可说的 subject 返回 null:
|
|
47
|
-
|
|
48
|
-
```tsx ignore-check
|
|
49
|
-
ctx.slots.inject('plugins.detail.badge', () => ctx.slots.register({
|
|
50
|
-
name: 'plugins.detail.badge',
|
|
51
|
-
id: 'acme-update',
|
|
52
|
-
locale: 'acmeUpdate',
|
|
53
|
-
}, ({ t, subject }) => subject.kind === 'bundle' && hasUpdate(subject.pkg) ? <Tag tone="info">{t('update')}</Tag> : null))
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
## 5. 浏览器半侧挂在哪里
|
|
57
|
-
|
|
58
|
-
浏览器半侧由[客户端模块系统](../../packages/client/modules)送到页面:它扫描已启用的 Loader 条目,找出声明了 `dsh.client` 的包,送出每个包构建好的 `./client` 导出——但它只把一个包的半侧挂在说明符恰为裸包名的那一行上。从子路径导出挂载的行永远不带半侧,因此把一个包拆成多行的组合包,其半侧留在根行上,它注册的每个页面都随根行关闭而消失。需要在其他行关闭时仍保留页面的子插件,应作为独立的包发布。
|
|
59
|
-
|
|
60
|
-
构建出的 `./client` 文件必须是客户端模块系统的 lazy-CJS factory 格式:一段脚本,向页面的模块加载器登记包名和一个 `factory(require)`,见[客户端模块系统的 README](../../packages/client/modules/README.zh.md)。生成它的 `clientBundle` tsdown 预设位于 `packages/client/tsdown.client.ts`,而不在任何已发布的包里,因此仓库之外的包要自己复刻这一步构建。
|
|
61
|
-
|
|
62
|
-
```jsonc
|
|
63
|
-
{
|
|
64
|
-
"exports": {
|
|
65
|
-
".": { "types": "./lib/types/index.d.ts", "default": "./lib/index.js" },
|
|
66
|
-
"./client": { "types": "./lib/types/client/index.d.ts", "default": "./lib/client.js" }
|
|
67
|
-
},
|
|
68
|
-
"dsh": { "client": { "platform": "web", "inject": ["@deepseek-ai/dsh-client-ui-settings"] } }
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
内置命名空间的伴生包就是同样的浏览器半侧放在一个纯客户端包里,宿主 `apply` 为空,列入 Web 组合的插件花名册([`packages/bundle/web-app/cordis.patch.yml`](../../packages/bundle/web-app/cordis.patch.yml)),并通过 `ctx.configForms.whileServed` 注册进 `plugins.item`,页面因此恰好在 Host 服务该命名空间期间存在。
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
# Tool authoring reference
|
|
2
|
-
|
|
3
|
-
English | [中文](adding-a-tool.zh.md)
|
|
4
|
-
|
|
5
|
-
Reference for the contracts a model-facing tool must satisfy. For an ordered first tool, follow [Build a tool](../user/develop/basic/tool.md). `packages/shell/tool-bash` is the production-grade three-package example.
|
|
6
|
-
|
|
7
|
-
## The minimal shape
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
import { readFile } from 'node:fs/promises'
|
|
11
|
-
import type { Context } from '@deepseek-ai/cordis'
|
|
12
|
-
import { defineTool } from '@deepseek-ai/dsh-tools'
|
|
13
|
-
|
|
14
|
-
export const name = 'my-tool'
|
|
15
|
-
export const inject = ['tools']
|
|
16
|
-
|
|
17
|
-
export function apply(ctx: Context) {
|
|
18
|
-
ctx.tools.register(defineTool({
|
|
19
|
-
name: 'read_file',
|
|
20
|
-
description: 'Read a file from disk.', // what the model sees
|
|
21
|
-
parameters: {
|
|
22
|
-
path: { type: 'string', required: true, description: 'Absolute path' },
|
|
23
|
-
limit: { type: 'number' }, // optional by default
|
|
24
|
-
},
|
|
25
|
-
output: {
|
|
26
|
-
schema: { type: 'string' },
|
|
27
|
-
render: (_args, value) => [{ type: 'text', text: value }],
|
|
28
|
-
},
|
|
29
|
-
async execute(args, exec) {
|
|
30
|
-
// args is TYPED from the schema: { path: string; limit?: number }
|
|
31
|
-
// exec carries immutable identity + token; signal is the operational field
|
|
32
|
-
return readFile(args.path, { encoding: 'utf8', signal: exec.signal })
|
|
33
|
-
},
|
|
34
|
-
}))
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Registration is effect-based: disposing the plugin fiber unregisters the tool. Schemas flow into the system-prompt assembly automatically.
|
|
39
|
-
|
|
40
|
-
## Rules of the execute() contract
|
|
41
|
-
|
|
42
|
-
- **Args are validated for you.** `defineTool` validates model-generated `arguments` against the unified `ParameterSchemaSpec` before `execute` runs (types, required keys, literal constraints, exact-one unions, and nested values), so inside `execute` the args match `InferArgs`. Explicit object nodes declare `additionalProperties: true | false`; the implicit parameter root stays open. You still hand-check constraints the DSL does not express, such as non-empty strings, positive numbers, or cross-field rules. Raw JSON-Schema tools registered directly own their input validation.
|
|
43
|
-
- **Registration borrows your readonly definition.** A typed same-process contribution is not a serialization boundary; do not mutate its schema or replace callbacks after registration. `schemas()` materializes only the explicit model-facing projection. To hot-swap a tool, dispose its owning effect and register the replacement; mutable state inside the callback's closure remains ordinary plugin state.
|
|
44
|
-
- **Execution identity is protected.** The registry materializes `arguments` as detached lossless JSON in one recursive pass, freezes that value before policy starts, and assigns an opaque `exec.token`; `callId`, `name`, `arguments`, `agent`, `token`, the required caller-owned `signal`, and an optional enclosing-transport `parent` token stay immutable through dispatch. `parent` is identity-only and exposes no live outer execution. Treat `args` as readonly input. Only an around-dispatch wrapper receives a mutable view, and it may replace and restore the required `exec.signal` to impose a deadline but cannot remove it.
|
|
45
|
-
- **Declare and return one canonical JSON value.** `output.schema` uses `ValueSchemaSpec` and may have an object, array, scalar, or null root. `execute` returns only the inferred value; the registry snapshots it as lossless JSON, validates it, freezes it, and passes it to `output.render(args, value)`. Do not return content blocks from the body or make callers parse prose for ids and fields.
|
|
46
|
-
- **Throwing or returning an invalid value means `isError`.** The registry catches throws and contains schema, renderer, metadata-projector, and lossless-JSON failures before observers run. Throw for infrastructure failures. Represent a successful domain outcome in the canonical value even when its Native renderer explains a non-ideal state, such as a non-zero process exit.
|
|
47
|
-
- **Honor `exec.signal`.** Cancel in-flight work when it fires.
|
|
48
|
-
- **Project durable card data with `presentationMeta` (optional).** `output.presentationMeta(args, value)` derives replayable JSON from the same canonical value. The core persists it on `tool/result` and hands it to `presentResult`, so a card that needs result-time facts—such as `write`/`edit` applied hunks—survives replay without persisting the canonical value. The projector is skipped for nested Code dispatches because they have no cards.
|
|
49
|
-
- **Use `exec.agent` for async notifications.** `agent.inject({ content, source: { kind: 'my-plugin' } })` appends durable context the NEXT model request sees — it is not a wake-up (an idle agent stays idle). Declare that `kind` through [`MessageSourceMap`](../subsystems/llm-streaming.md#content-blocks-and-messages) in your plugin: session format V4 rejects the retired `{ kind: 'plugin', plugin: '<name>' }` wrapper at message admission. Guard against disposed agents (try/catch).
|
|
50
|
-
|
|
51
|
-
## Long-running work
|
|
52
|
-
|
|
53
|
-
Gate `run_in_background` with producer config, then register through `ctx.jobs.start({ kind, label, owner: exec.agent, run })`. The registry rejects a pre-aborted invocation before the producer body; the runtime validates ownership and task-controller availability before `run()` starts work, then supplies the id, session fence, generic control tools, notices, and owner cleanup. A successful background branch returns a typed canonical handle such as `{ kind: 'background', jobId }`; its Native renderer may keep human prose such as `started background job bash-1`, but PTC mode must never parse that prose to recover the id.
|
|
54
|
-
|
|
55
|
-
The spec supplies synchronous `cancel`, a non-rejecting `done` that settles after resource cleanup, and either pull `output` sources the registry pumps into the job's output ring or pushes through the `JobHandle` its starter receives; `dsh-tool-jobs` renders the model's consuming read from that ring. A pre-aborted call is a failure because no task exists whose id could satisfy the successful output schema. Once `ctx.jobs.start()` publishes the id, use a task-owned cancellation signal rather than `exec.signal`: later outer-call cancellation stops waiting for the call but does not kill published work; `job_kill`, owner disposal, and service teardown own that lifetime. Foreground work remains coupled to `exec.signal`. See the [background job runtime reference](../../packages/jobs/jobs/README.md) and `dsh-tool-bash` for a stream producer.
|
|
56
|
-
|
|
57
|
-
## Execution policy and observation
|
|
58
|
-
|
|
59
|
-
Prefer not to build deployment policy into the tool. Use `tools/pre-execute` for extensible allow/deny/ask policy (the [permission-gate example](extension-cookbook.md#a-hook-plugin-permission-gate-example)), `ctx.tools.guard()` for a final monotonic deny that later listeners cannot undo, `tools/execute` to wrap dispatch with a deadline, retry, or metrics collection, `tools/post-execute` to replace presentation content or the returned value, block the result, or attach model-facing context, and `tools/result` to observe the immutable normalized outcome. A content replacement leaves programmatic access to `value` intact; confidentiality policy blocks or replaces the value. A sandboxing implementation can also run inside the tool's executor implementation; the [`dsh-tools` README](../../packages/core/tools/README.md#extension-points) defines each extension point's inputs, order, return values, and failure behavior.
|
|
60
|
-
|
|
61
|
-
## PTC mode reaches your tool for free
|
|
62
|
-
|
|
63
|
-
In [PTC mode](../../packages/core/tools/README.md), every visible registered tool is available as `await tools.<name>(args)` without extra integration. The generated `ToolArgsMap` and `ToolOutputMap` derive exact argument and canonical-return types from the same schemas, and calls re-enter the normal execution pipeline. A successful call resolves to the final canonical JSON value after policy, not to rendered Native content. A failed call rejects with the real `ToolCallError`; programs can inspect only its `name`, `toolName`, and human-readable `message`, not internal error codes or a failure union.
|
|
64
|
-
|
|
65
|
-
Design `output.schema` as a useful programmatic API: return handles and fields directly, allow scalar/array/null roots when they are the honest value, and keep human explanation in `output.render`. Intermediate values are execution-local, are not persisted or prompt-truncated, and have no byte cap, so the producer's truthful acquisition bounds and process memory still matter. Only the outer `run_code` logs/result cross the configurable output cap and model-facing spill pipeline.
|
|
66
|
-
|
|
67
|
-
## How your tool renders in a UI
|
|
68
|
-
|
|
69
|
-
Your tool's `output.render` returns model-facing content; its **UI card** is a separate concern declared through pure presentation projections and optional `presentCall` / `presentResult` methods. Design these alongside the canonical value. A tool with no UI presentation falls back to a generic card (title = tool name, raw args as input).
|
|
70
|
-
|
|
71
|
-
Both methods return a **`card`-tagged render intent** — pick the card kind that matches what your tool does:
|
|
72
|
-
|
|
73
|
-
- `presentCall(args)` → a `ToolCallView` (the PENDING card):
|
|
74
|
-
- `{ card: 'generic', title, kind?, rawInput?, content?, locations? }` — the default. Set `kind` for an icon (`read`/`search`/…); set `locations: [{ path, line? }]` for any file your tool touches so a capable editor follows along / jumps to it.
|
|
75
|
-
- `{ card: 'terminal', title, description?, cwd? }` — your call IS a shell command. `title` is the command, `description` renders above the terminal card. (tool-bash.)
|
|
76
|
-
- `{ card: 'diff', title, diffs, locations? }` — your call creates or modifies a file. `diffs: [{ path, oldText, newText }]` (`oldText: null` for a new file) renders as an inline diff card. (tool-fs `write`/`edit`.)
|
|
77
|
-
- `presentResult(args, { content, isError, meta? })` returns the completed card:
|
|
78
|
-
- `generic` supplies an optional title and content.
|
|
79
|
-
- `terminal` supplies raw output and optional exit metadata; each UI renders its capable or fallback view.
|
|
80
|
-
- `diff` supplies applied hunks, often derived by `output.presentationMeta` and carried in persisted `result.meta` so replay reproduces them. Mutation tools keep a diff result because the completed view replaces the pending card.
|
|
81
|
-
- `read` supplies a completed file window reconstructed from persisted `result.meta`: the file `path`, a 1-based `offset`, the returned `lines` (each keeping its file line number), `totalLines`, and an optional `lang` highlight hint; a UI without the `read` capability falls back to the raw result content. There is no `read` call view — a read call's pending state stays a generic card, since content exists only after `execute`. (tool-fs `read`.)
|
|
82
|
-
- `search` supplies a discovery result reconstructed from persisted `result.meta`: grouped-by-file matches (`shape: 'matches'`, grep) or a flat path list (`shape: 'paths'`, glob), plus `truncated`/`total` so a UI never presents a capped result as complete. The view carries no result text (a UI without a search card falls back to the raw result content), and there is no `search` call view — a discovery call's pending state stays a generic card, since matches exist only after `execute`. (tool-fs-search `grep`/`glob`.)
|
|
83
|
-
- `web` supplies a completed web retrieval, discriminated by `kind: 'search' | 'fetch'` (the structured search sources or the fetch summary), derived from `result.meta`; it carries no body copy, so a UI without the `web` capability falls back to the raw result content. (tool-web `web_search`/`web_fetch`.)
|
|
84
|
-
|
|
85
|
-
Hard rules (they bite if broken):
|
|
86
|
-
|
|
87
|
-
- **Purity.** These run on live streaming AND on session-log REPLAY, so they must be pure functions of `args` (+ the result) — NO I/O, NO reading session state, NO clock/random. A diff is derived from the args (`write` uses `oldText: null` because a call-time presenter has no prior file content); the UI adapter, not the tool, supplies session context. If you find yourself wanting the file's old content or the working directory inside `presentCall`, stop — that belongs in durable result metadata or the adapter, not the presenter.
|
|
88
|
-
- **UI-only formatting stays out of the model result.** A fenced ` ```console ` block, a diff, a relativized path—none of these belongs in the canonical value or Native content merely to serve a UI. `output.render` owns model-facing prose; `presentationMeta` plus the card presenters own replayable UI state. A `terminal` result view carries raw output and the adapter adds any fallback framing.
|
|
89
|
-
- **`defineTool` soft-validates the display path.** Malformed or older logged arguments make the wrapper return `undefined` (a generic fallback) rather than throw — display must never crash a replay.
|
|
90
|
-
|
|
91
|
-
The neutral vocabulary lives in `dsh-tools`; tools never import a UI or transport type. Consumers of this API map each `card` into their own view. The design and the why are in [the render-intent-union Agent Note](../../.agents/notes/implemented/architecture/2026-07-02-tool-render-intent-union.md); `dsh-tool-fs` (generic/diff) and `dsh-tool-bash` (terminal) are the reference implementations.
|
|
92
|
-
|
|
93
|
-
## Web Client presentation
|
|
94
|
-
|
|
95
|
-
The built-in Web Client does not consume `presentCall` or `presentResult`. Session `page` and `follow` transport raw `tool/call` and `tool/result` events, including persisted `result.meta`. A Client plugin registers its wire tool name in the `tool.call.toolview` keyed slot and derives component props from the `ToolCallBlock` arguments, content, error, metadata, existing PTC dispatch `parentCallId`, and Session path facts. It validates these wire values locally and returns the generic row for malformed or unsupported input.
|
|
96
|
-
|
|
97
|
-
Use `output.presentationMeta(args, value)` when an existing Web card needs bounded structured result facts that model-facing content cannot preserve losslessly. Do not store React props or a selected card in metadata, import a Host tool implementation into a browser bundle, or create another Client presenter registry. Defining Host presentation methods alone does not add a specialized Web card. The [Client-derived presentation Agent Note](../../.agents/notes/implemented/architecture/2026-08-23-client-derived-tool-presentation.md) defines ownership, fallback, and equivalence requirements.
|
|
98
|
-
|
|
99
|
-
## Verification
|
|
100
|
-
|
|
101
|
-
Follow the [repository testing policy](../testing.md) and the owning package's test documentation. A shipped model- or UI-visible change requires the assembled coverage specified there.
|