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,154 +0,0 @@
|
|
|
1
|
-
<!-- 英文源文件由 scripts/gen-cordis-catalog.ts 生成;本中文文件是通过双语配对维护的经评审对侧。
|
|
2
|
-
更新时先运行 `pnpm run gen-cordis-catalog` 更新英文,再更新本文件并运行 `pnpm run verify-translation-pairing --write docs/cordis-api/registry.md` 重新记录配对。 -->
|
|
3
|
-
|
|
4
|
-
# 注册表
|
|
5
|
-
|
|
6
|
-
[English](registry.md) | 中文
|
|
7
|
-
|
|
8
|
-
插件加载与依赖注入。
|
|
9
|
-
|
|
10
|
-
### ctx.inject(deps, callback)
|
|
11
|
-
|
|
12
|
-
```ts cordis-catalog
|
|
13
|
-
/**
|
|
14
|
-
* Run a callback once the requested services are available.
|
|
15
|
-
*
|
|
16
|
-
* Shorthand for `ctx.plugin({ inject, apply: callback })`: the callback
|
|
17
|
-
* is unloaded and re-run whenever a required service changes.
|
|
18
|
-
*
|
|
19
|
-
* @param deps — required services, as an array or a name → config map.
|
|
20
|
-
* @param callback — plugin body called with `(ctx, config)`.
|
|
21
|
-
* @returns the fiber; awaiting it settles once loading finished.
|
|
22
|
-
*/
|
|
23
|
-
inject(deps: Inject, callback: Plugin.Function<void>): Fiber & PromiseLike<Fiber>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
请求的服务可用后,运行回调。
|
|
27
|
-
|
|
28
|
-
这是 `ctx.plugin({ inject, apply: callback })` 的简写形式:每当某个必需服务发生变化时,系统都会卸载并重新运行该回调。
|
|
29
|
-
|
|
30
|
-
- `deps`:必需服务,形式可以是数组,也可以是从名称到配置的映射。
|
|
31
|
-
- `callback`:以 `(ctx, config)` 调用的插件主体。
|
|
32
|
-
|
|
33
|
-
**返回** fiber;对其执行 await 会在加载完成后结束等待。
|
|
34
|
-
|
|
35
|
-
[源码](../../vendor/cordis/src/registry.ts#L176)
|
|
36
|
-
|
|
37
|
-
### ctx.plugin(plugin, ...args)
|
|
38
|
-
|
|
39
|
-
```ts cordis-catalog
|
|
40
|
-
/**
|
|
41
|
-
* Load a plugin in the current context.
|
|
42
|
-
*
|
|
43
|
-
* @param plugin — a function, class, or `{ apply }` object plugin.
|
|
44
|
-
* @param args — the plugin config, validated against its `Config` schema.
|
|
45
|
-
* @returns the fiber; awaiting it settles once loading finished
|
|
46
|
-
* (rejecting on config or startup errors).
|
|
47
|
-
*/
|
|
48
|
-
plugin<P extends Plugin>(plugin: P, ...args: Spread<GetPluginConfig<P>>): Fiber & PromiseLike<Fiber>
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
在当前上下文中加载插件。
|
|
52
|
-
|
|
53
|
-
- `plugin`:函数、类或 `{ apply }` 对象形式的插件。
|
|
54
|
-
- `args`:插件配置,会根据其 `Config` schema 进行校验。
|
|
55
|
-
|
|
56
|
-
**返回** fiber;对其执行 await 会在加载完成后结束等待(如果发生配置错误或启动错误,则会被拒绝)。
|
|
57
|
-
|
|
58
|
-
[源码](../../vendor/cordis/src/registry.ts#L185)
|
|
59
|
-
|
|
60
|
-
## Plugin
|
|
61
|
-
|
|
62
|
-
支持的插件入口点形式。
|
|
63
|
-
|
|
64
|
-
```ts cordis-catalog
|
|
65
|
-
/** Supported plugin entrypoint shapes. */
|
|
66
|
-
type Plugin<T = any> =
|
|
67
|
-
| Plugin.Function<T>
|
|
68
|
-
| Plugin.Constructor<T>
|
|
69
|
-
| Plugin.Object<T>
|
|
70
|
-
|
|
71
|
-
/** Types associated with plugin entrypoints and runtime records. */
|
|
72
|
-
namespace Plugin {
|
|
73
|
-
/** Shared metadata understood by the plugin registry and related tooling. */
|
|
74
|
-
export interface Base<T = any> {
|
|
75
|
-
/** Display name used for fiber diagnostics and logger names. */
|
|
76
|
-
name?: string
|
|
77
|
-
/** Standard-schema validator applied to config before the plugin starts. */
|
|
78
|
-
Config?: StandardSchemaV1<any, T>
|
|
79
|
-
/** Services the plugin requires; it only loads while all are available. */
|
|
80
|
-
inject?: Inject
|
|
81
|
-
/** Service name(s) the plugin provides (read by `Service` and by loaders). */
|
|
82
|
-
provide?: string | string[]
|
|
83
|
-
/** Service names whose intercept config the plugin declares it consumes. */
|
|
84
|
-
intercept?: Dict<boolean>
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export interface Transform<S, T> {
|
|
88
|
-
/** Marks the transform object as a schema/config transform. */
|
|
89
|
-
schema?: true
|
|
90
|
-
/** Convert user-facing config to runtime config. */
|
|
91
|
-
Config: (config: S) => T
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** Function plugin called with `(ctx, config)`. */
|
|
95
|
-
export interface Function<T = any> extends Base<T> {
|
|
96
|
-
(ctx: Context, config: T): any
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/** Class plugin constructed with `(ctx, config)`. */
|
|
100
|
-
export interface Constructor<T = any> extends Base<T> {
|
|
101
|
-
new (ctx: Context, config: T): any
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** Object plugin with an `apply(ctx, config)` method. */
|
|
105
|
-
export interface Object<T = any> extends Base<T> {
|
|
106
|
-
apply(ctx: Context, config: T): any
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/** Mutable registry record shared by all fibers of one plugin callback. */
|
|
110
|
-
export interface Runtime {
|
|
111
|
-
/** Display name copied from the first registered plugin shape. */
|
|
112
|
-
name?: string
|
|
113
|
-
/** Every live fiber of this plugin (one per `ctx.plugin()` call). */
|
|
114
|
-
fibers: DisposableList<Fiber>
|
|
115
|
-
/** The executable entrypoint all fibers share (registry identity key). */
|
|
116
|
-
callback: globalThis.Function
|
|
117
|
-
/** Standard-schema validator applied to each fiber's config. */
|
|
118
|
-
Config?: StandardSchemaV1
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
[源码](../../vendor/cordis/src/registry.ts#L92)
|
|
124
|
-
|
|
125
|
-
## Inject
|
|
126
|
-
|
|
127
|
-
插件和 `@Inject` 装饰器接受的服务依赖声明。
|
|
128
|
-
|
|
129
|
-
数组形式请求不带拦截配置的服务。对象形式将每个服务名称映射到插件上下文中可选的拦截配置。
|
|
130
|
-
|
|
131
|
-
```ts cordis-catalog
|
|
132
|
-
/**
|
|
133
|
-
* Service dependency declaration accepted by plugins and the `@Inject`
|
|
134
|
-
* decorator.
|
|
135
|
-
*
|
|
136
|
-
* Array form requests services without intercept config. Object form maps each
|
|
137
|
-
* service name to optional intercept config for the plugin context.
|
|
138
|
-
*/
|
|
139
|
-
type Inject<M = Dict> = (keyof M)[] | { [K in keyof M]?: M[K] }
|
|
140
|
-
|
|
141
|
-
/** Utilities for normalizing plugin dependency declarations. */
|
|
142
|
-
namespace Inject {
|
|
143
|
-
/**
|
|
144
|
-
* Convert array/object/class-inherited inject metadata into a plain map.
|
|
145
|
-
*
|
|
146
|
-
* @param inject — the declaration to normalize; `null`/`undefined` add nothing.
|
|
147
|
-
* @param result — the map to fill (service name → intercept config or `null`).
|
|
148
|
-
* @returns `result`.
|
|
149
|
-
*/
|
|
150
|
-
export function resolve(inject: Inject | null | undefined, result: Dict = Object.create(null))
|
|
151
|
-
}
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
[源码](../../vendor/cordis/src/registry.ts#L19)
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
<!-- Generated by scripts/gen-cordis-catalog.ts — do not edit by hand.
|
|
2
|
-
Run `pnpm run gen-cordis-catalog` to regenerate. -->
|
|
3
|
-
|
|
4
|
-
# Service
|
|
5
|
-
|
|
6
|
-
The base class for context services. A subclass loaded as a plugin registers itself as `ctx.<name>`.
|
|
7
|
-
|
|
8
|
-
Base class for services that expose a named API on `ctx`.
|
|
9
|
-
|
|
10
|
-
Subclasses call `super(ctx, name)` from their constructor. The service is registered immediately and is automatically removed with the owning fiber.
|
|
11
|
-
|
|
12
|
-
[Source](../../vendor/cordis/src/service.ts#L11)
|
|
13
|
-
|
|
14
|
-
### service.name
|
|
15
|
-
|
|
16
|
-
```ts cordis-catalog
|
|
17
|
-
/** The service name this instance is registered under. */
|
|
18
|
-
public name!: string
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
The service name this instance is registered under.
|
|
22
|
-
|
|
23
|
-
[Source](../../vendor/cordis/src/service.ts#L30)
|
|
24
|
-
|
|
25
|
-
## Static members
|
|
26
|
-
|
|
27
|
-
### Service.init
|
|
28
|
-
|
|
29
|
-
```ts cordis-catalog
|
|
30
|
-
/** Symbol key of an instance method run after construction (class plugins). */
|
|
31
|
-
static readonly init: unique symbol
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Symbol key of an instance method run after construction (class plugins).
|
|
35
|
-
|
|
36
|
-
[Source](../../vendor/cordis/src/service.ts#L13)
|
|
37
|
-
|
|
38
|
-
### Service.check
|
|
39
|
-
|
|
40
|
-
```ts cordis-catalog
|
|
41
|
-
/** Symbol key of the availability predicate passed to `ctx.provide()`. */
|
|
42
|
-
static readonly check: unique symbol
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Symbol key of the availability predicate passed to `ctx.provide()`.
|
|
46
|
-
|
|
47
|
-
[Source](../../vendor/cordis/src/service.ts#L15)
|
|
48
|
-
|
|
49
|
-
### Service.config
|
|
50
|
-
|
|
51
|
-
```ts cordis-catalog
|
|
52
|
-
/** Symbol key of the phantom intercept-config type parameter. */
|
|
53
|
-
static readonly config: unique symbol
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Symbol key of the phantom intercept-config type parameter.
|
|
57
|
-
|
|
58
|
-
[Source](../../vendor/cordis/src/service.ts#L17)
|
|
59
|
-
|
|
60
|
-
### Service.invoke
|
|
61
|
-
|
|
62
|
-
```ts cordis-catalog
|
|
63
|
-
/** Symbol key of the call body making a service callable (e.g. `ctx.logger()`). */
|
|
64
|
-
static readonly invoke: unique symbol
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Symbol key of the call body making a service callable (e.g. `ctx.logger()`).
|
|
68
|
-
|
|
69
|
-
[Source](../../vendor/cordis/src/service.ts#L19)
|
|
70
|
-
|
|
71
|
-
### Service.extend
|
|
72
|
-
|
|
73
|
-
```ts cordis-catalog
|
|
74
|
-
/** Symbol key of the helper deriving an extended service instance. */
|
|
75
|
-
static readonly extend: unique symbol
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
Symbol key of the helper deriving an extended service instance.
|
|
79
|
-
|
|
80
|
-
[Source](../../vendor/cordis/src/service.ts#L21)
|
|
81
|
-
|
|
82
|
-
### Service.tracker
|
|
83
|
-
|
|
84
|
-
```ts cordis-catalog
|
|
85
|
-
/** Symbol key of the tracker metadata used for context tracing. */
|
|
86
|
-
static readonly tracker: unique symbol
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Symbol key of the tracker metadata used for context tracing.
|
|
90
|
-
|
|
91
|
-
[Source](../../vendor/cordis/src/service.ts#L23)
|
|
92
|
-
|
|
93
|
-
### Service.resolveConfig
|
|
94
|
-
|
|
95
|
-
```ts cordis-catalog
|
|
96
|
-
/** Symbol key of the intercept-config resolution helper below. */
|
|
97
|
-
static readonly resolveConfig: unique symbol
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Symbol key of the intercept-config resolution helper below.
|
|
101
|
-
|
|
102
|
-
[Source](../../vendor/cordis/src/service.ts#L25)
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
<!-- 英文源文件由 scripts/gen-cordis-catalog.ts 生成;本中文文件是通过双语配对维护的经评审对侧。
|
|
2
|
-
更新时先运行 `pnpm run gen-cordis-catalog` 更新英文,再更新本文件并运行 `pnpm run verify-translation-pairing --write docs/cordis-api/service.md` 重新记录配对。 -->
|
|
3
|
-
|
|
4
|
-
# Service
|
|
5
|
-
|
|
6
|
-
[English](service.md) | 中文
|
|
7
|
-
|
|
8
|
-
上下文服务的基类。以插件形式加载的子类会将自身注册为 `ctx.<name>`。
|
|
9
|
-
|
|
10
|
-
用于在 `ctx` 上公开具名 API 的服务基类。
|
|
11
|
-
|
|
12
|
-
子类在构造函数中调用 `super(ctx, name)`。服务会立即注册,并随所属 fiber 自动移除。
|
|
13
|
-
|
|
14
|
-
[源码](../../vendor/cordis/src/service.ts#L11)
|
|
15
|
-
|
|
16
|
-
### service.name
|
|
17
|
-
|
|
18
|
-
```ts cordis-catalog
|
|
19
|
-
/** The service name this instance is registered under. */
|
|
20
|
-
public name!: string
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
此实例注册时使用的服务名称。
|
|
24
|
-
|
|
25
|
-
[源码](../../vendor/cordis/src/service.ts#L30)
|
|
26
|
-
|
|
27
|
-
## 静态成员
|
|
28
|
-
|
|
29
|
-
### Service.init
|
|
30
|
-
|
|
31
|
-
```ts cordis-catalog
|
|
32
|
-
/** Symbol key of an instance method run after construction (class plugins). */
|
|
33
|
-
static readonly init: unique symbol
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
构造完成后运行的实例方法所使用的符号键(类插件)。
|
|
37
|
-
|
|
38
|
-
[源码](../../vendor/cordis/src/service.ts#L13)
|
|
39
|
-
|
|
40
|
-
### Service.check
|
|
41
|
-
|
|
42
|
-
```ts cordis-catalog
|
|
43
|
-
/** Symbol key of the availability predicate passed to `ctx.provide()`. */
|
|
44
|
-
static readonly check: unique symbol
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
传给 `ctx.provide()` 的可用性谓词所使用的符号键。
|
|
48
|
-
|
|
49
|
-
[源码](../../vendor/cordis/src/service.ts#L15)
|
|
50
|
-
|
|
51
|
-
### Service.config
|
|
52
|
-
|
|
53
|
-
```ts cordis-catalog
|
|
54
|
-
/** Symbol key of the phantom intercept-config type parameter. */
|
|
55
|
-
static readonly config: unique symbol
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
虚设拦截配置类型参数所使用的符号键。
|
|
59
|
-
|
|
60
|
-
[源码](../../vendor/cordis/src/service.ts#L17)
|
|
61
|
-
|
|
62
|
-
### Service.invoke
|
|
63
|
-
|
|
64
|
-
```ts cordis-catalog
|
|
65
|
-
/** Symbol key of the call body making a service callable (e.g. `ctx.logger()`). */
|
|
66
|
-
static readonly invoke: unique symbol
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
使服务可被调用的调用体所使用的符号键(例如 `ctx.logger()`)。
|
|
70
|
-
|
|
71
|
-
[源码](../../vendor/cordis/src/service.ts#L19)
|
|
72
|
-
|
|
73
|
-
### Service.extend
|
|
74
|
-
|
|
75
|
-
```ts cordis-catalog
|
|
76
|
-
/** Symbol key of the helper deriving an extended service instance. */
|
|
77
|
-
static readonly extend: unique symbol
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
用于派生扩展服务实例的辅助方法所使用的符号键。
|
|
81
|
-
|
|
82
|
-
[源码](../../vendor/cordis/src/service.ts#L21)
|
|
83
|
-
|
|
84
|
-
### Service.tracker
|
|
85
|
-
|
|
86
|
-
```ts cordis-catalog
|
|
87
|
-
/** Symbol key of the tracker metadata used for context tracing. */
|
|
88
|
-
static readonly tracker: unique symbol
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
上下文追踪所用跟踪器元数据的符号键。
|
|
92
|
-
|
|
93
|
-
[源码](../../vendor/cordis/src/service.ts#L23)
|
|
94
|
-
|
|
95
|
-
### Service.resolveConfig
|
|
96
|
-
|
|
97
|
-
```ts cordis-catalog
|
|
98
|
-
/** Symbol key of the intercept-config resolution helper below. */
|
|
99
|
-
static readonly resolveConfig: unique symbol
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
下述拦截配置解析辅助方法所使用的符号键。
|
|
103
|
-
|
|
104
|
-
[源码](../../vendor/cordis/src/service.ts#L25)
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# 1. Your first plugin
|
|
2
|
-
|
|
3
|
-
English | [中文](01-first-plugin.zh.md)
|
|
4
|
-
|
|
5
|
-
In the loader configuration used here, a Cordis plugin module named-exports an `apply` function. When Cordis loads it, it calls `apply` with a **context** — the `ctx` object through which the plugin registers everything it contributes.
|
|
6
|
-
|
|
7
|
-
## Write the plugin
|
|
8
|
-
|
|
9
|
-
In your `tmp/cordis-tutorial` directory (see [setup](index.md#setup)), create `hello.ts`:
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
import type { Context } from '@deepseek-ai/cordis'
|
|
13
|
-
|
|
14
|
-
export const name = 'hello'
|
|
15
|
-
|
|
16
|
-
export function apply(ctx: Context) {
|
|
17
|
-
console.log('hello from my first plugin')
|
|
18
|
-
}
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
The `name` export is optional display metadata; it labels the plugin in diagnostics.
|
|
22
|
-
|
|
23
|
-
## Compose the app
|
|
24
|
-
|
|
25
|
-
This tutorial's launcher assembles the application from configuration. Create `cordis.yml`:
|
|
26
|
-
|
|
27
|
-
```yaml
|
|
28
|
-
- name: './hello.ts'
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The file is a list of plugin entries. `name` is a module specifier — a relative path or an npm package name — and the loader mounts every entry. Entries start concurrently, so list position guarantees nothing about which plugin loads first; ordering comes from service dependencies (`inject`, [chapter 3](03-services.md)), not from position in the file.
|
|
32
|
-
|
|
33
|
-
## Run it
|
|
34
|
-
|
|
35
|
-
```sh
|
|
36
|
-
node --import tsx ../../vendor/cordis/bin.js
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Expected output:
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
hello from my first plugin
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
The process exits on its own once nothing is left running. What happened:
|
|
46
|
-
|
|
47
|
-
1. The launcher created a root `Context` and mounted the **Loader** plugin.
|
|
48
|
-
2. The Loader read `cordis.yml`, resolved `./hello.ts`, and mounted it as a child plugin.
|
|
49
|
-
3. Cordis called your `apply(ctx)`.
|
|
50
|
-
|
|
51
|
-
There is no framework bootstrap code in your file: a plugin describes what it contributes, and `cordis.yml` composes the application. The [`dsh` base](../../packages/bundle/base/cordis.patch.yml), for example, is a longer plugin composition that deployment overlays patch.
|
|
52
|
-
|
|
53
|
-
## The two other plugin shapes
|
|
54
|
-
|
|
55
|
-
A function is the most common form, but Cordis accepts three:
|
|
56
|
-
|
|
57
|
-
```ts
|
|
58
|
-
import { Service, type Context } from '@deepseek-ai/cordis'
|
|
59
|
-
|
|
60
|
-
// 1. Function plugin (what you just wrote).
|
|
61
|
-
export function apply(ctx: Context) {}
|
|
62
|
-
|
|
63
|
-
// 2. Object plugin: an object with an `apply` method.
|
|
64
|
-
export const objectPlugin = {
|
|
65
|
-
name: 'object-plugin',
|
|
66
|
-
apply(ctx: Context) {},
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// 3. Class plugin: a Service subclass (covered in chapter 3).
|
|
70
|
-
export class MyService extends Service {
|
|
71
|
-
constructor(ctx: Context) {
|
|
72
|
-
super(ctx, 'myTutorialService')
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Use the function form until you need to expose a service; [chapter 3](03-services.md) covers when the class form earns its place.
|
|
78
|
-
|
|
79
|
-
## Try breaking it
|
|
80
|
-
|
|
81
|
-
Make `apply` throw:
|
|
82
|
-
|
|
83
|
-
```ts ignore-check
|
|
84
|
-
export function apply(ctx: Context) {
|
|
85
|
-
throw new Error('apply exploded')
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Run again: the process dies with your error. A plugin that fails to load is a loud failure, not a skipped entry.
|
|
90
|
-
|
|
91
|
-
One caveat worth knowing early: a config entry whose module cannot be **resolved** — a typo'd path or package name — is reported through the Cordis logger service instead of crashing the process, and at boot that report can be lost before a console exporter is watching. If a freshly added entry seems to do nothing, check the spelling first.
|
|
92
|
-
|
|
93
|
-
Next: [Lifecycle and effects](02-lifecycle-and-effects.md) — what happens when a plugin unloads.
|
|
94
|
-
|
|
95
|
-
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# 1. 编写第一个插件
|
|
2
|
-
|
|
3
|
-
[English](01-first-plugin.md) | 中文
|
|
4
|
-
|
|
5
|
-
在本教程使用的 loader 配置中,Cordis 插件模块通过命名导出提供 `apply` 函数。Cordis 加载模块时,会用一个 **上下文** 调用 `apply`;该上下文就是 `ctx` 对象,插件通过它注册自己贡献的所有内容。
|
|
6
|
-
|
|
7
|
-
## 编写插件
|
|
8
|
-
|
|
9
|
-
在 `tmp/cordis-tutorial` 目录中(参见[环境设置](index.zh.md#setup))创建 `hello.ts`:
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
import type { Context } from '@deepseek-ai/cordis'
|
|
13
|
-
|
|
14
|
-
export const name = 'hello'
|
|
15
|
-
|
|
16
|
-
export function apply(ctx: Context) {
|
|
17
|
-
console.log('hello from my first plugin')
|
|
18
|
-
}
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
`name` 导出项是可选的显示元数据;它用于在诊断信息中标识插件。
|
|
22
|
-
|
|
23
|
-
## 组合应用
|
|
24
|
-
|
|
25
|
-
本教程的启动器通过配置组装应用。创建 `cordis.yml`:
|
|
26
|
-
|
|
27
|
-
```yaml
|
|
28
|
-
- name: './hello.ts'
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
该文件是一组 Cordis 配置项的列表。`name` 是模块指定符,可以是相对路径或 NPM 包名;loader 会挂载每个配置项。各项会并发启动,因此它们在列表中的位置不保证插件的加载先后;顺序由服务依赖(`inject`,参见[第 3 章](03-services.zh.md))决定,而非文件中的位置。
|
|
32
|
-
|
|
33
|
-
## 运行
|
|
34
|
-
|
|
35
|
-
```sh
|
|
36
|
-
node --import tsx ../../vendor/cordis/bin.js
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
预期输出:
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
hello from my first plugin
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
当没有任何内容继续运行时,进程会自行退出。具体过程如下:
|
|
46
|
-
|
|
47
|
-
1. 启动器创建根 `Context`,并挂载 **Loader** 插件。
|
|
48
|
-
2. Loader 读取 `cordis.yml`,解析 `./hello.ts`,然后将其作为子插件挂载。
|
|
49
|
-
3. Cordis 调用你的 `apply(ctx)`。
|
|
50
|
-
|
|
51
|
-
你的文件中没有框架启动代码:插件描述自己的贡献,`cordis.yml` 则组合应用。例如,[`dsh` base](../../packages/bundle/base/cordis.patch.yml) 就是一份更长的插件组合,由部署 overlay 对它进行修补。
|
|
52
|
-
|
|
53
|
-
## 其他两种插件形态
|
|
54
|
-
|
|
55
|
-
函数是最常见的形式,但 Cordis 接受三种形式:
|
|
56
|
-
|
|
57
|
-
```ts
|
|
58
|
-
import { Service, type Context } from '@deepseek-ai/cordis'
|
|
59
|
-
|
|
60
|
-
// 1. Function plugin (what you just wrote).
|
|
61
|
-
export function apply(ctx: Context) {}
|
|
62
|
-
|
|
63
|
-
// 2. Object plugin: an object with an `apply` method.
|
|
64
|
-
export const objectPlugin = {
|
|
65
|
-
name: 'object-plugin',
|
|
66
|
-
apply(ctx: Context) {},
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// 3. Class plugin: a Service subclass (covered in chapter 3).
|
|
70
|
-
export class MyService extends Service {
|
|
71
|
-
constructor(ctx: Context) {
|
|
72
|
-
super(ctx, 'myTutorialService')
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
在你需要公开服务之前,请一直使用函数形态;[第 3 章](03-services.zh.md)介绍了何时应当使用类形态。
|
|
78
|
-
|
|
79
|
-
## 尝试制造错误
|
|
80
|
-
|
|
81
|
-
让 `apply` 抛出异常:
|
|
82
|
-
|
|
83
|
-
```ts ignore-check
|
|
84
|
-
export function apply(ctx: Context) {
|
|
85
|
-
throw new Error('apply exploded')
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
再次运行:进程会因该错误而终止。插件加载失败会明确报错,不会仅跳过该配置项。
|
|
90
|
-
|
|
91
|
-
还需要尽早了解一个例外:如果某个配置项的模块无法被 **解析**,例如路径或包名拼写错误,Cordis 会通过 logger 服务报告错误,而不会使进程崩溃。在启动阶段,这条报告可能在 console 导出器开始观察之前丢失。如果新增配置项似乎没有任何效果,请先检查拼写。
|
|
92
|
-
|
|
93
|
-
下一章:[生命周期与 effect](02-lifecycle-and-effects.zh.md):插件卸载时会发生什么。
|
|
94
|
-
|
|
95
|
-
[](https://github.com/deepseek-ai/deepseek-harness)
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# 2. Lifecycle and effects
|
|
2
|
-
|
|
3
|
-
English | [中文](02-lifecycle-and-effects.zh.md)
|
|
4
|
-
|
|
5
|
-
A Cordis plugin can be unloaded by a config edit, hot reload, explicit disposal, or loss of a required service. Registrations made through Cordis APIs are effects and are undone when their owning plugin unloads; resources managed outside those APIs must be wrapped in `ctx.effect()`.
|
|
6
|
-
|
|
7
|
-
## Effects
|
|
8
|
-
|
|
9
|
-
For a resource Cordis does not already manage — a timer, a connection, a watcher — wrap it in `ctx.effect()` and return a disposer:
|
|
10
|
-
|
|
11
|
-
Create `lifecycle.ts` in `tmp/cordis-tutorial`:
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import type { Context } from '@deepseek-ai/cordis'
|
|
15
|
-
|
|
16
|
-
export const name = 'lifecycle-demo'
|
|
17
|
-
|
|
18
|
-
function heartbeat(ctx: Context) {
|
|
19
|
-
console.log('heartbeat plugin loading')
|
|
20
|
-
ctx.effect(() => {
|
|
21
|
-
const timer = setInterval(() => console.log('tick'), 200)
|
|
22
|
-
return () => {
|
|
23
|
-
clearInterval(timer)
|
|
24
|
-
console.log('heartbeat cleaned up')
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function apply(ctx: Context) {
|
|
30
|
-
// Mount a child plugin and keep its fiber to dispose it later.
|
|
31
|
-
const fiber = ctx.plugin(heartbeat)
|
|
32
|
-
// The demo timer is itself an effect: if THIS plugin is unloaded first,
|
|
33
|
-
// the pending callback is cancelled instead of firing on a dead app.
|
|
34
|
-
ctx.effect(() => {
|
|
35
|
-
const timer = setTimeout(async () => {
|
|
36
|
-
await fiber.dispose()
|
|
37
|
-
console.log('disposed')
|
|
38
|
-
process.exit(0)
|
|
39
|
-
}, 700)
|
|
40
|
-
return () => clearTimeout(timer)
|
|
41
|
-
})
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Point `cordis.yml` at it:
|
|
46
|
-
|
|
47
|
-
```yaml
|
|
48
|
-
- name: './lifecycle.ts'
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Run (`node --import tsx ../../vendor/cordis/bin.js`) and you get:
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
heartbeat plugin loading
|
|
55
|
-
tick
|
|
56
|
-
tick
|
|
57
|
-
tick
|
|
58
|
-
heartbeat cleaned up
|
|
59
|
-
disposed
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Three things to notice:
|
|
63
|
-
|
|
64
|
-
- `ctx.plugin(heartbeat)` mounts a function **from code** as a plugin — the same operation the YAML loader performs for each config entry. A function plugin needs no `apply` method: Cordis calls the function directly and uses its name only for diagnostics. An `apply` method is required only for the object form, `ctx.plugin({ apply(ctx) { /* ... */ } })`. The call returns a **fiber**, the runtime handle for one loaded plugin instance.
|
|
65
|
-
- The effect body runs during load; the disposer it returns runs during unload. You never call the disposer yourself for a plugin-lifetime resource.
|
|
66
|
-
- `fiber.dispose()` resolves after all of the plugin's cleanup — including async disposers — has finished, and recursively unloads any child plugins it mounted.
|
|
67
|
-
|
|
68
|
-
## The fiber state machine
|
|
69
|
-
|
|
70
|
-
Every loaded plugin instance owns a fiber that moves through these states:
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
PENDING → LOADING → ACTIVE → UNLOADING → DISPOSED
|
|
74
|
-
↘ FAILED
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
- **PENDING** — declared, but a required service (chapter 3) is not available yet.
|
|
78
|
-
- **LOADING / ACTIVE** — `apply` is running / has completed.
|
|
79
|
-
- **FAILED** — `apply` or config validation threw.
|
|
80
|
-
- **UNLOADING / DISPOSED** — disposers are running / everything is torn down.
|
|
81
|
-
|
|
82
|
-
You will meet PENDING again in [chapter 6](06-composition-and-hmr.md), where it is the usual answer to "why does my plugin print nothing?".
|
|
83
|
-
|
|
84
|
-
## What is already an effect
|
|
85
|
-
|
|
86
|
-
You rarely write `ctx.effect()` yourself, because the built-in registration APIs are effects already:
|
|
87
|
-
|
|
88
|
-
- `ctx.on(event, listener)` — the listener is removed on unload ([chapter 4](04-events.md)).
|
|
89
|
-
- `ctx.plugin(child)` — the child is disposed with its parent.
|
|
90
|
-
- Service registrations are effects. Harness registries such as `ctx.tools.register(...)` also attach their returned disposers to the calling plugin, so they unwind automatically ([chapter 7](07-into-the-harness.md)).
|
|
91
|
-
|
|
92
|
-
For a resource Cordis does not manage, acquire it inside `ctx.effect()` and return a disposer that releases it. Cordis then invokes that release during unloading, including hot reload.
|
|
93
|
-
|
|
94
|
-
One ordering caveat: disposers start in reverse registration order, but multiple **async** disposers run concurrently. If teardown steps must run in sequence, keep them in one disposer and await them there.
|
|
95
|
-
|
|
96
|
-
Next: [Services](03-services.md) — how plugins share capabilities.
|
|
97
|
-
|
|
98
|
-
[](https://github.com/deepseek-ai/deepseek-harness)
|