dsh-plugin-guide 0.1.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/LICENSE +202 -0
- package/NOTICE.md +26 -0
- package/README.es.md +139 -0
- package/README.hi.md +138 -0
- package/README.md +165 -0
- package/README.pt.md +139 -0
- package/README.zh-CN.md +164 -0
- package/SKILL.md +69 -0
- package/cordis.patch.yml +4 -0
- package/guide/links.md +92 -0
- package/guide/plugin-dev-guide.md +429 -0
- package/guide/quick-reference.es.md +176 -0
- package/guide/quick-reference.hi.md +176 -0
- package/guide/quick-reference.md +176 -0
- package/guide/quick-reference.pt.md +176 -0
- package/guide/quick-reference.zh-CN.md +175 -0
- package/index.js +58 -0
- package/package.json +83 -0
- package/references/community-ecosystem.md +201 -0
- package/references/community-repo-deep-dive.md +695 -0
- package/references/cordis-paper-and-community.md +326 -0
- package/references/harness-repo.md +654 -0
- package/references/official-docs/AGENTS.md +149 -0
- package/references/official-docs/BENCHMARK.md +3 -0
- package/references/official-docs/CLAUDE.md +1 -0
- package/references/official-docs/CONTRIBUTING.i18n.yaml +6 -0
- package/references/official-docs/CONTRIBUTING.md +23 -0
- package/references/official-docs/CONTRIBUTING.zh.md +23 -0
- package/references/official-docs/LICENSE +21 -0
- package/references/official-docs/README.i18n.yaml +6 -0
- package/references/official-docs/README.md +35 -0
- package/references/official-docs/README.zh.md +74 -0
- package/references/official-docs/SNAPSHOT.md +16 -0
- package/references/official-docs/THIRD_PARTY_NOTICES.md +192 -0
- package/references/official-docs/docs/AGENTS.md +75 -0
- package/references/official-docs/docs/agent-lifecycle.i18n.yaml +6 -0
- package/references/official-docs/docs/agent-lifecycle.md +82 -0
- package/references/official-docs/docs/agent-lifecycle.zh.md +84 -0
- package/references/official-docs/docs/api-gateway.i18n.yaml +6 -0
- package/references/official-docs/docs/api-gateway.md +164 -0
- package/references/official-docs/docs/api-gateway.zh.md +164 -0
- package/references/official-docs/docs/architecture.i18n.yaml +6 -0
- package/references/official-docs/docs/architecture.md +129 -0
- package/references/official-docs/docs/architecture.zh.md +133 -0
- package/references/official-docs/docs/capability-seams.i18n.yaml +6 -0
- package/references/official-docs/docs/capability-seams.md +471 -0
- package/references/official-docs/docs/capability-seams.zh.md +473 -0
- package/references/official-docs/docs/config-catalog.i18n.yaml +6 -0
- package/references/official-docs/docs/config-catalog.md +3151 -0
- package/references/official-docs/docs/config-catalog.zh.md +3152 -0
- package/references/official-docs/docs/cookbook/adding-a-conversation-node.i18n.yaml +6 -0
- package/references/official-docs/docs/cookbook/adding-a-conversation-node.md +233 -0
- package/references/official-docs/docs/cookbook/adding-a-conversation-node.zh.md +233 -0
- package/references/official-docs/docs/cookbook/adding-a-package.i18n.yaml +6 -0
- package/references/official-docs/docs/cookbook/adding-a-package.md +118 -0
- package/references/official-docs/docs/cookbook/adding-a-package.zh.md +118 -0
- package/references/official-docs/docs/cookbook/adding-a-tool.i18n.yaml +6 -0
- package/references/official-docs/docs/cookbook/adding-a-tool.md +94 -0
- package/references/official-docs/docs/cookbook/adding-a-tool.zh.md +96 -0
- package/references/official-docs/docs/cookbook/adding-a-vendored-package.i18n.yaml +6 -0
- package/references/official-docs/docs/cookbook/adding-a-vendored-package.md +59 -0
- package/references/official-docs/docs/cookbook/adding-a-vendored-package.zh.md +59 -0
- package/references/official-docs/docs/cookbook/adding-an-llm-adapter.i18n.yaml +6 -0
- package/references/official-docs/docs/cookbook/adding-an-llm-adapter.md +43 -0
- package/references/official-docs/docs/cookbook/adding-an-llm-adapter.zh.md +43 -0
- package/references/official-docs/docs/cookbook/extension-cookbook.i18n.yaml +6 -0
- package/references/official-docs/docs/cookbook/extension-cookbook.md +129 -0
- package/references/official-docs/docs/cookbook/extension-cookbook.zh.md +131 -0
- package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.i18n.yaml +6 -0
- package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.md +64 -0
- package/references/official-docs/docs/cookbook/maintaining-dsh-code-review.zh.md +64 -0
- package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.i18n.yaml +6 -0
- package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.md +32 -0
- package/references/official-docs/docs/cookbook/responding-to-pr-review-on-a-stack.zh.md +32 -0
- package/references/official-docs/docs/cordis-api/context.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-api/context.md +364 -0
- package/references/official-docs/docs/cordis-api/context.zh.md +366 -0
- package/references/official-docs/docs/cordis-api/events.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-api/events.md +207 -0
- package/references/official-docs/docs/cordis-api/events.zh.md +209 -0
- package/references/official-docs/docs/cordis-api/fiber.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-api/fiber.md +375 -0
- package/references/official-docs/docs/cordis-api/fiber.zh.md +377 -0
- package/references/official-docs/docs/cordis-api/inherited.md +39 -0
- package/references/official-docs/docs/cordis-api/registry.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-api/registry.md +152 -0
- package/references/official-docs/docs/cordis-api/registry.zh.md +154 -0
- package/references/official-docs/docs/cordis-api/service.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-api/service.md +102 -0
- package/references/official-docs/docs/cordis-api/service.zh.md +104 -0
- package/references/official-docs/docs/cordis-primer.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-primer.md +44 -0
- package/references/official-docs/docs/cordis-primer.zh.md +50 -0
- package/references/official-docs/docs/cordis-tutorial/01-first-plugin.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-tutorial/01-first-plugin.md +95 -0
- package/references/official-docs/docs/cordis-tutorial/01-first-plugin.zh.md +95 -0
- package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
- package/references/official-docs/docs/cordis-tutorial/02-lifecycle-and-effects.zh.md +98 -0
- package/references/official-docs/docs/cordis-tutorial/03-services.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-tutorial/03-services.md +98 -0
- package/references/official-docs/docs/cordis-tutorial/03-services.zh.md +98 -0
- package/references/official-docs/docs/cordis-tutorial/04-events.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-tutorial/04-events.md +144 -0
- package/references/official-docs/docs/cordis-tutorial/04-events.zh.md +144 -0
- package/references/official-docs/docs/cordis-tutorial/05-config.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-tutorial/05-config.md +84 -0
- package/references/official-docs/docs/cordis-tutorial/05-config.zh.md +84 -0
- package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.md +113 -0
- package/references/official-docs/docs/cordis-tutorial/06-composition-and-hmr.zh.md +113 -0
- package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.md +107 -0
- package/references/official-docs/docs/cordis-tutorial/07-into-the-harness.zh.md +107 -0
- package/references/official-docs/docs/cordis-tutorial/index.i18n.yaml +6 -0
- package/references/official-docs/docs/cordis-tutorial/index.md +60 -0
- package/references/official-docs/docs/cordis-tutorial/index.zh.md +62 -0
- package/references/official-docs/docs/defensive-patterns.i18n.yaml +6 -0
- package/references/official-docs/docs/defensive-patterns.md +33 -0
- package/references/official-docs/docs/defensive-patterns.zh.md +33 -0
- package/references/official-docs/docs/development.i18n.yaml +6 -0
- package/references/official-docs/docs/development.md +171 -0
- package/references/official-docs/docs/development.zh.md +171 -0
- package/references/official-docs/docs/event-producer-consumer.i18n.yaml +6 -0
- package/references/official-docs/docs/event-producer-consumer.md +76 -0
- package/references/official-docs/docs/event-producer-consumer.zh.md +78 -0
- package/references/official-docs/docs/glossary.i18n.yaml +6 -0
- package/references/official-docs/docs/glossary.md +45 -0
- package/references/official-docs/docs/glossary.zh.md +45 -0
- package/references/official-docs/docs/graph-atlas.i18n.yaml +6 -0
- package/references/official-docs/docs/graph-atlas.md +24 -0
- package/references/official-docs/docs/graph-atlas.zh.md +26 -0
- package/references/official-docs/docs/i18n/README.i18n.yaml +6 -0
- package/references/official-docs/docs/i18n/README.md +60 -0
- package/references/official-docs/docs/i18n/README.zh.md +60 -0
- package/references/official-docs/docs/i18n/style-samples.md +87 -0
- package/references/official-docs/docs/i18n/terminology.md +214 -0
- package/references/official-docs/docs/i18n/translation-prompt.md +263 -0
- package/references/official-docs/docs/i18n/translation-rules.i18n.yaml +6 -0
- package/references/official-docs/docs/i18n/translation-rules.md +69 -0
- package/references/official-docs/docs/i18n/translation-rules.zh.md +69 -0
- package/references/official-docs/docs/module-graph.i18n.yaml +6 -0
- package/references/official-docs/docs/module-graph.md +1638 -0
- package/references/official-docs/docs/module-graph.zh.md +1640 -0
- package/references/official-docs/docs/persistence-catalog.i18n.yaml +6 -0
- package/references/official-docs/docs/persistence-catalog.md +944 -0
- package/references/official-docs/docs/persistence-catalog.zh.md +946 -0
- package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.i18n.yaml +6 -0
- package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.md +113 -0
- package/references/official-docs/docs/postmortem/0001-acp-default-export-drops-inject.zh.md +113 -0
- package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.i18n.yaml +6 -0
- package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.md +47 -0
- package/references/official-docs/docs/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +47 -0
- package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.i18n.yaml +6 -0
- package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.md +53 -0
- package/references/official-docs/docs/postmortem/0003-web-agent-gui-feedback-loop.zh.md +53 -0
- package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.i18n.yaml +6 -0
- package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +55 -0
- package/references/official-docs/docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +55 -0
- package/references/official-docs/docs/postmortem/README.i18n.yaml +6 -0
- package/references/official-docs/docs/postmortem/README.md +18 -0
- package/references/official-docs/docs/postmortem/README.zh.md +18 -0
- package/references/official-docs/docs/rescope.i18n.yaml +6 -0
- package/references/official-docs/docs/rescope.md +53 -0
- package/references/official-docs/docs/rescope.zh.md +53 -0
- package/references/official-docs/docs/subsystems/README.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/README.md +55 -0
- package/references/official-docs/docs/subsystems/README.zh.md +55 -0
- package/references/official-docs/docs/subsystems/approval.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/approval.md +170 -0
- package/references/official-docs/docs/subsystems/approval.zh.md +170 -0
- package/references/official-docs/docs/subsystems/attachment.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/attachment.md +115 -0
- package/references/official-docs/docs/subsystems/attachment.zh.md +115 -0
- package/references/official-docs/docs/subsystems/client-modules.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/client-modules.md +118 -0
- package/references/official-docs/docs/subsystems/client-modules.zh.md +118 -0
- package/references/official-docs/docs/subsystems/code-runtime.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/code-runtime.md +191 -0
- package/references/official-docs/docs/subsystems/code-runtime.zh.md +191 -0
- package/references/official-docs/docs/subsystems/commands.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/commands.md +187 -0
- package/references/official-docs/docs/subsystems/commands.zh.md +187 -0
- package/references/official-docs/docs/subsystems/compaction.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/compaction.md +238 -0
- package/references/official-docs/docs/subsystems/compaction.zh.md +238 -0
- package/references/official-docs/docs/subsystems/core.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/core.md +1070 -0
- package/references/official-docs/docs/subsystems/core.zh.md +1078 -0
- package/references/official-docs/docs/subsystems/credentials.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/credentials.md +133 -0
- package/references/official-docs/docs/subsystems/credentials.zh.md +133 -0
- package/references/official-docs/docs/subsystems/extensions.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/extensions.md +364 -0
- package/references/official-docs/docs/subsystems/extensions.zh.md +364 -0
- package/references/official-docs/docs/subsystems/feedback.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/feedback.md +266 -0
- package/references/official-docs/docs/subsystems/feedback.zh.md +266 -0
- package/references/official-docs/docs/subsystems/filesystem.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/filesystem.md +495 -0
- package/references/official-docs/docs/subsystems/filesystem.zh.md +495 -0
- package/references/official-docs/docs/subsystems/goal.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/goal.md +277 -0
- package/references/official-docs/docs/subsystems/goal.zh.md +277 -0
- package/references/official-docs/docs/subsystems/invariants.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/invariants.md +88 -0
- package/references/official-docs/docs/subsystems/invariants.zh.md +88 -0
- package/references/official-docs/docs/subsystems/jobs.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/jobs.md +290 -0
- package/references/official-docs/docs/subsystems/jobs.zh.md +290 -0
- package/references/official-docs/docs/subsystems/llm-streaming.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/llm-streaming.md +888 -0
- package/references/official-docs/docs/subsystems/llm-streaming.zh.md +894 -0
- package/references/official-docs/docs/subsystems/lsp.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/lsp.md +202 -0
- package/references/official-docs/docs/subsystems/lsp.zh.md +202 -0
- package/references/official-docs/docs/subsystems/permission-presets.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/permission-presets.md +131 -0
- package/references/official-docs/docs/subsystems/permission-presets.zh.md +131 -0
- package/references/official-docs/docs/subsystems/persistence.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/persistence.md +385 -0
- package/references/official-docs/docs/subsystems/persistence.zh.md +385 -0
- package/references/official-docs/docs/subsystems/plan.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/plan.md +87 -0
- package/references/official-docs/docs/subsystems/plan.zh.md +87 -0
- package/references/official-docs/docs/subsystems/sandbox.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/sandbox.md +218 -0
- package/references/official-docs/docs/subsystems/sandbox.zh.md +218 -0
- package/references/official-docs/docs/subsystems/schedule.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/schedule.md +186 -0
- package/references/official-docs/docs/subsystems/schedule.zh.md +186 -0
- package/references/official-docs/docs/subsystems/scope.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/scope.md +59 -0
- package/references/official-docs/docs/subsystems/scope.zh.md +59 -0
- package/references/official-docs/docs/subsystems/session-projection.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/session-projection.md +262 -0
- package/references/official-docs/docs/subsystems/session-projection.zh.md +262 -0
- package/references/official-docs/docs/subsystems/session-query.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/session-query.md +495 -0
- package/references/official-docs/docs/subsystems/session-query.zh.md +495 -0
- package/references/official-docs/docs/subsystems/session-reference.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/session-reference.md +108 -0
- package/references/official-docs/docs/subsystems/session-reference.zh.md +108 -0
- package/references/official-docs/docs/subsystems/session-telemetry.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/session-telemetry.md +194 -0
- package/references/official-docs/docs/subsystems/session-telemetry.zh.md +194 -0
- package/references/official-docs/docs/subsystems/session-title.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/session-title.md +204 -0
- package/references/official-docs/docs/subsystems/session-title.zh.md +204 -0
- package/references/official-docs/docs/subsystems/session.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/session.md +849 -0
- package/references/official-docs/docs/subsystems/session.zh.md +851 -0
- package/references/official-docs/docs/subsystems/settings.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/settings.md +310 -0
- package/references/official-docs/docs/subsystems/settings.zh.md +310 -0
- package/references/official-docs/docs/subsystems/shell.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/shell.md +303 -0
- package/references/official-docs/docs/subsystems/shell.zh.md +303 -0
- package/references/official-docs/docs/subsystems/skills.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/skills.md +331 -0
- package/references/official-docs/docs/subsystems/skills.zh.md +331 -0
- package/references/official-docs/docs/subsystems/spill.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/spill.md +117 -0
- package/references/official-docs/docs/subsystems/spill.zh.md +117 -0
- package/references/official-docs/docs/subsystems/storage.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/storage.md +229 -0
- package/references/official-docs/docs/subsystems/storage.zh.md +229 -0
- package/references/official-docs/docs/subsystems/subagent.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/subagent.md +734 -0
- package/references/official-docs/docs/subsystems/subagent.zh.md +736 -0
- package/references/official-docs/docs/subsystems/subprocess.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/subprocess.md +324 -0
- package/references/official-docs/docs/subsystems/subprocess.zh.md +324 -0
- package/references/official-docs/docs/subsystems/system-prompt.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/system-prompt.md +207 -0
- package/references/official-docs/docs/subsystems/system-prompt.zh.md +207 -0
- package/references/official-docs/docs/subsystems/terminal.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/terminal.md +184 -0
- package/references/official-docs/docs/subsystems/terminal.zh.md +184 -0
- package/references/official-docs/docs/subsystems/token-meter.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/token-meter.md +90 -0
- package/references/official-docs/docs/subsystems/token-meter.zh.md +90 -0
- package/references/official-docs/docs/subsystems/tools.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/tools.md +720 -0
- package/references/official-docs/docs/subsystems/tools.zh.md +720 -0
- package/references/official-docs/docs/subsystems/typert.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/typert.md +336 -0
- package/references/official-docs/docs/subsystems/typert.zh.md +336 -0
- package/references/official-docs/docs/subsystems/user-questions.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/user-questions.md +178 -0
- package/references/official-docs/docs/subsystems/user-questions.zh.md +178 -0
- package/references/official-docs/docs/subsystems/web-server.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/web-server.md +108 -0
- package/references/official-docs/docs/subsystems/web-server.zh.md +108 -0
- package/references/official-docs/docs/subsystems/web.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/web.md +199 -0
- package/references/official-docs/docs/subsystems/web.zh.md +199 -0
- package/references/official-docs/docs/subsystems/workflow.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/workflow.md +278 -0
- package/references/official-docs/docs/subsystems/workflow.zh.md +278 -0
- package/references/official-docs/docs/subsystems/workspace.i18n.yaml +6 -0
- package/references/official-docs/docs/subsystems/workspace.md +228 -0
- package/references/official-docs/docs/subsystems/workspace.zh.md +228 -0
- package/references/official-docs/docs/testing.i18n.yaml +6 -0
- package/references/official-docs/docs/testing.md +49 -0
- package/references/official-docs/docs/testing.zh.md +49 -0
- package/references/official-docs/docs/tool-catalog.i18n.yaml +6 -0
- package/references/official-docs/docs/tool-catalog.md +1873 -0
- package/references/official-docs/docs/tool-catalog.zh.md +1878 -0
- package/references/official-docs/docs/tool-execution-pipeline.i18n.yaml +6 -0
- package/references/official-docs/docs/tool-execution-pipeline.md +62 -0
- package/references/official-docs/docs/tool-execution-pipeline.zh.md +64 -0
- package/references/official-docs/docs/user/develop/basic/config.i18n.yaml +6 -0
- package/references/official-docs/docs/user/develop/basic/config.md +106 -0
- package/references/official-docs/docs/user/develop/basic/config.zh.md +106 -0
- package/references/official-docs/docs/user/develop/basic/index.i18n.yaml +6 -0
- package/references/official-docs/docs/user/develop/basic/index.md +144 -0
- package/references/official-docs/docs/user/develop/basic/index.zh.md +144 -0
- package/references/official-docs/docs/user/develop/basic/publish.i18n.yaml +6 -0
- package/references/official-docs/docs/user/develop/basic/publish.md +183 -0
- package/references/official-docs/docs/user/develop/basic/publish.zh.md +183 -0
- package/references/official-docs/docs/user/develop/basic/tool.i18n.yaml +6 -0
- package/references/official-docs/docs/user/develop/basic/tool.md +52 -0
- package/references/official-docs/docs/user/develop/basic/tool.zh.md +52 -0
- package/references/official-docs/docs/user/develop/framework/events.i18n.yaml +6 -0
- package/references/official-docs/docs/user/develop/framework/events.md +143 -0
- package/references/official-docs/docs/user/develop/framework/events.zh.md +143 -0
- package/references/official-docs/docs/user/develop/framework/index.i18n.yaml +6 -0
- package/references/official-docs/docs/user/develop/framework/index.md +137 -0
- package/references/official-docs/docs/user/develop/framework/index.zh.md +137 -0
- package/references/official-docs/docs/user/develop/framework/service.i18n.yaml +6 -0
- package/references/official-docs/docs/user/develop/framework/service.md +148 -0
- package/references/official-docs/docs/user/develop/framework/service.zh.md +150 -0
- package/references/official-docs/docs/user/develop/practice/index.i18n.yaml +6 -0
- package/references/official-docs/docs/user/develop/practice/index.md +155 -0
- package/references/official-docs/docs/user/develop/practice/index.zh.md +155 -0
- package/references/official-docs/docs/user/develop/practice/llm-adapter.i18n.yaml +6 -0
- package/references/official-docs/docs/user/develop/practice/llm-adapter.md +188 -0
- package/references/official-docs/docs/user/develop/practice/llm-adapter.zh.md +188 -0
- package/references/official-docs/docs/user/guide/index.i18n.yaml +6 -0
- package/references/official-docs/docs/user/guide/index.md +30 -0
- package/references/official-docs/docs/user/guide/index.zh.md +30 -0
- package/references/official-docs/docs/user/guide/providers-custom-form.png +0 -0
- package/references/official-docs/docs/user/guide/providers-custom-form.zh.png +0 -0
- package/references/official-docs/docs/user/guide/providers-models-page.png +0 -0
- package/references/official-docs/docs/user/guide/providers-models-page.zh.png +0 -0
- package/references/official-docs/docs/user/guide/providers.i18n.yaml +6 -0
- package/references/official-docs/docs/user/guide/providers.md +98 -0
- package/references/official-docs/docs/user/guide/providers.zh.md +98 -0
- package/references/official-docs/docs/user/guide/python-sdk.i18n.yaml +6 -0
- package/references/official-docs/docs/user/guide/python-sdk.md +104 -0
- package/references/official-docs/docs/user/guide/python-sdk.zh.md +104 -0
- package/references/official-docs/docs/user/index.i18n.yaml +6 -0
- package/references/official-docs/docs/user/index.md +11 -0
- package/references/official-docs/docs/user/index.zh.md +11 -0
- package/references/official-docs/docs/web-styling.i18n.yaml +6 -0
- package/references/official-docs/docs/web-styling.md +25 -0
- package/references/official-docs/docs/web-styling.zh.md +25 -0
- package/references/official-docs/examples/AGENTS.md +20 -0
- package/references/official-docs/packages/AGENTS.md +27 -0
- package/references/official-docs/packages/README.md +69 -0
- package/references/official-docs/vendor/README.md +60 -0
- package/references/official-docs/website-docs.ts +524 -0
- package/references/sources.md +137 -0
- package/references/upstream-cordis.md +594 -0
- package/references/website-pages.md +668 -0
- package/scripts/archive-discussions.ps1 +154 -0
- package/scripts/download-community-articles.ps1 +188 -0
- package/scripts/download-community-repos.ps1 +232 -0
- package/scripts/download-sources.ps1 +195 -0
- package/scripts/gen-topic-snapshot.ps1 +91 -0
- package/scripts/install-skill.ps1 +63 -0
- package/scripts/sync-official-docs.ps1 +130 -0
- package/scripts/verify-kit.ps1 +191 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write docs/tool-execution-pipeline.md
|
|
5
|
+
tool-execution-pipeline.md: d04d2e4e5093fee92f8921f0eb0112c960a81bb8
|
|
6
|
+
tool-execution-pipeline.zh.md: 15627023d3be6ac2b3aae70c2ef01ef9f1077d3e
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!-- Generated by scripts/gen-doc-graphs.ts - do not edit by hand.
|
|
2
|
+
Run `pnpm run gen-doc-graphs` to regenerate. -->
|
|
3
|
+
|
|
4
|
+
# Tool Execution Pipeline
|
|
5
|
+
|
|
6
|
+
This graph shows where policy, hooks, sandboxing, filesystem guards, result rewriting, final-outcome observation, and UI rendering run without changing the loop. The `tools/pre-execute` waterfall runs first, monotonic guards run next, and the `tools/execute` and `tools/post-execute` waterfalls follow; the three waterfalls may transform a call. Definition-owned `finalizeContent` and `tools/result` run afterward.
|
|
7
|
+
|
|
8
|
+
```mermaid
|
|
9
|
+
flowchart TD
|
|
10
|
+
model["Assistant message contains tool-call block"]
|
|
11
|
+
toolCall["Session event: <code>tool/call</code><br/>logged before execution"]
|
|
12
|
+
presentCall["UI pending card<br/>presentCall(args)"]
|
|
13
|
+
pre["<code>tools/pre-execute</code> waterfall<br/>hooks, permission, sandbox"]
|
|
14
|
+
guards["Registered monotonic guards<br/>deny or abstain; identity protected"]
|
|
15
|
+
denied["denied or approval refused<br/>tool body skipped"]
|
|
16
|
+
approval["<code>ctx.approval</code> one-shot prompt<br/>absent or unanswerable: deny"]
|
|
17
|
+
around["<code>tools/execute</code> waterfall<br/>timeout, retry, metrics (around dispatch)"]
|
|
18
|
+
toolBody["Registered tool execute() body"]
|
|
19
|
+
fsGate["<code>fs/write-intent</code> or <code>fs/edit-intent</code><br/>tool-fs mutations only"]
|
|
20
|
+
owned["Tool-owned session events<br/><code>todo/write</code>, <code>fs/observed</code>, <code>hook/invoked</code>, <code>hook/result</code>, <code>tool/code-dispatch</code>"]
|
|
21
|
+
post["<code>tools/post-execute</code> waterfall<br/>accept, block, replace, add context"]
|
|
22
|
+
normalized["Registry outer normalization<br/>pipeline/result snapshot throws become isError"]
|
|
23
|
+
finalize["ToolDefinition.finalizeContent<br/>last content-only invariant"]
|
|
24
|
+
final["<code>tools/result</code> synchronous notification<br/>frozen authoritative outcome"]
|
|
25
|
+
context["Active-batch additionalContexts FIFO<br/>injected user/message after recorded tool results"]
|
|
26
|
+
toolResult["Session event: <code>tool/result</code><br/>single model-facing outcome"]
|
|
27
|
+
allResults["Tool batch settled<br/>recorded tool/result events complete"]
|
|
28
|
+
presentResult["UI completed card<br/>presentResult(args, result)"]
|
|
29
|
+
model --> toolCall
|
|
30
|
+
toolCall --> presentCall
|
|
31
|
+
toolCall --> pre
|
|
32
|
+
pre -->|allow| guards
|
|
33
|
+
guards -->|allow| around
|
|
34
|
+
guards -->|deny| denied
|
|
35
|
+
guards -.->|throw| normalized
|
|
36
|
+
around --> toolBody
|
|
37
|
+
pre -->|deny| denied
|
|
38
|
+
pre -->|ask| approval
|
|
39
|
+
approval -->|allowed-once| guards
|
|
40
|
+
approval -->|rejected, cancelled, unavailable| denied
|
|
41
|
+
approval -.->|throw| normalized
|
|
42
|
+
denied --> post
|
|
43
|
+
pre -.->|throw| normalized
|
|
44
|
+
toolBody --> fsGate
|
|
45
|
+
fsGate --> toolBody
|
|
46
|
+
toolBody --> owned
|
|
47
|
+
toolBody --> around
|
|
48
|
+
around --> post
|
|
49
|
+
around -.->|wrapper throws| normalized
|
|
50
|
+
post -.->|throw| normalized
|
|
51
|
+
post --> finalize
|
|
52
|
+
normalized --> finalize
|
|
53
|
+
finalize --> final
|
|
54
|
+
final --> toolResult
|
|
55
|
+
toolResult --> presentResult
|
|
56
|
+
toolResult --> allResults
|
|
57
|
+
allResults --> context
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Filesystem read-before-edit checks stay below `tool-fs` on `fs/*` events. Generic pre/post waterfalls host hooks and approval policy; `ctx.approval` resolves asks before monotonic guards, and owner policy that must not be reordered remains a registered guard. Around-dispatch concerns such as timeouts wrap `tools/execute`. The registry losslessly snapshots the candidate result and normalizes a snapshot failure before the visible definition's snapshotted `finalizeContent` callback enforces its synchronous content-only invariant. `tools/result` then observes the immutable, lossless-JSON outcome. This lets hooks span tool families without coupling the tools to one policy service. Code Mode sends both the reserved `run_code` transport and its serialized sub-calls through the pipeline; sub-calls carry the parent token, log `tool/code-dispatch`, return denials as binding rejections, and omit `additionalContexts` to preserve call/result adjacency.
|
|
61
|
+
|
|
62
|
+
Maintenance mode: curated Mermaid flow; exact tool schemas and event signatures live in generated catalogs.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!-- 英文源文件由 scripts/gen-doc-graphs.ts 生成;本中文文件是通过双语配对维护的经评审对侧。
|
|
2
|
+
更新时先运行 `pnpm run gen-doc-graphs` 更新英文,再更新本文件并运行 `pnpm run verify-translation-pairing --write docs/tool-execution-pipeline.md` 重新记录配对。 -->
|
|
3
|
+
|
|
4
|
+
# 工具执行流水线
|
|
5
|
+
|
|
6
|
+
[English](tool-execution-pipeline.md) | 中文
|
|
7
|
+
|
|
8
|
+
此图展示策略、钩子、沙箱、文件系统守卫、结果重写、最终结果观察和 UI 渲染在不改变循环的情况下何时运行。`tools/pre-execute` waterfall(瀑布式事件)首先运行,随后是单调守卫,然后运行 `tools/execute` 和 `tools/post-execute` waterfall;这三个 waterfall 可以改写一次调用。由定义自身控制的 `finalizeContent` 和 `tools/result` 在此之后运行。
|
|
9
|
+
|
|
10
|
+
```mermaid
|
|
11
|
+
flowchart TD
|
|
12
|
+
model["Assistant message contains tool-call block"]
|
|
13
|
+
toolCall["Session event: <code>tool/call</code><br/>logged before execution"]
|
|
14
|
+
presentCall["UI pending card<br/>presentCall(args)"]
|
|
15
|
+
pre["<code>tools/pre-execute</code> waterfall<br/>hooks, permission, sandbox"]
|
|
16
|
+
guards["Registered monotonic guards<br/>deny or abstain; identity protected"]
|
|
17
|
+
denied["denied or approval refused<br/>tool body skipped"]
|
|
18
|
+
approval["<code>ctx.approval</code> one-shot prompt<br/>absent or unanswerable: deny"]
|
|
19
|
+
around["<code>tools/execute</code> waterfall<br/>timeout, retry, metrics (around dispatch)"]
|
|
20
|
+
toolBody["Registered tool execute() body"]
|
|
21
|
+
fsGate["<code>fs/write-intent</code> or <code>fs/edit-intent</code><br/>tool-fs mutations only"]
|
|
22
|
+
owned["Tool-owned session events<br/><code>todo/write</code>, <code>fs/observed</code>, <code>hook/invoked</code>, <code>hook/result</code>, <code>tool/code-dispatch</code>"]
|
|
23
|
+
post["<code>tools/post-execute</code> waterfall<br/>accept, block, replace, add context"]
|
|
24
|
+
normalized["Registry outer normalization<br/>pipeline/result snapshot throws become isError"]
|
|
25
|
+
finalize["ToolDefinition.finalizeContent<br/>last content-only invariant"]
|
|
26
|
+
final["<code>tools/result</code> synchronous notification<br/>frozen authoritative outcome"]
|
|
27
|
+
context["Active-batch additionalContexts FIFO<br/>injected user/message after recorded tool results"]
|
|
28
|
+
toolResult["Session event: <code>tool/result</code><br/>single model-facing outcome"]
|
|
29
|
+
allResults["Tool batch settled<br/>recorded tool/result events complete"]
|
|
30
|
+
presentResult["UI completed card<br/>presentResult(args, result)"]
|
|
31
|
+
model --> toolCall
|
|
32
|
+
toolCall --> presentCall
|
|
33
|
+
toolCall --> pre
|
|
34
|
+
pre -->|allow| guards
|
|
35
|
+
guards -->|allow| around
|
|
36
|
+
guards -->|deny| denied
|
|
37
|
+
guards -.->|throw| normalized
|
|
38
|
+
around --> toolBody
|
|
39
|
+
pre -->|deny| denied
|
|
40
|
+
pre -->|ask| approval
|
|
41
|
+
approval -->|allowed-once| guards
|
|
42
|
+
approval -->|rejected, cancelled, unavailable| denied
|
|
43
|
+
approval -.->|throw| normalized
|
|
44
|
+
denied --> post
|
|
45
|
+
pre -.->|throw| normalized
|
|
46
|
+
toolBody --> fsGate
|
|
47
|
+
fsGate --> toolBody
|
|
48
|
+
toolBody --> owned
|
|
49
|
+
toolBody --> around
|
|
50
|
+
around --> post
|
|
51
|
+
around -.->|wrapper throws| normalized
|
|
52
|
+
post -.->|throw| normalized
|
|
53
|
+
post --> finalize
|
|
54
|
+
normalized --> finalize
|
|
55
|
+
finalize --> final
|
|
56
|
+
final --> toolResult
|
|
57
|
+
toolResult --> presentResult
|
|
58
|
+
toolResult --> allResults
|
|
59
|
+
allResults --> context
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
文件系统的先读后编辑检查位于 `tool-fs` 之下,通过 `fs/*` 事件实现。通用的前置/后置 waterfall 承载钩子与审批策略;`ctx.approval` 在单调守卫之前处理询问,而不得重新排序的所有者策略仍作为已注册的守卫。超时等环绕分发关注点对 `tools/execute` 进行包装。注册表会对候选结果进行无损快照;如果快照失败,则会先将失败规范化,之后再由可见定义中已随快照固定的 `finalizeContent` 回调强制执行其同步且仅限内容的不变式。随后,`tools/result` 会观察不可变、可由 JSON 无损表示的结果。这样一来,钩子便可跨越不同工具系列,而无需让工具与某个策略服务耦合。Code Mode 会将保留的 `run_code` 传输及其序列化子调用都送入流水线;子调用携带父级 token、记录 `tool/code-dispatch`、将拒绝呈现为具有约束力的驳回,并省略 `additionalContexts`,以保持调用与结果相邻。
|
|
63
|
+
|
|
64
|
+
维护模式:英文源文件包含人工维护的 Mermaid 流程图,并由生成器写出;本中文文件作为经评审对侧通过双语配对维护。确切的工具 schema 与事件签名位于生成的目录中。
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write docs/user/develop/basic/config.md
|
|
5
|
+
config.md: 21ba39fd7de1795e9139aff3e2b11743eedd4833
|
|
6
|
+
config.zh.md: a882c4d59b0ac8e8ec27a5b32da5376b534a7f62
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Plugin configuration
|
|
2
|
+
|
|
3
|
+
English | [中文](config.zh.md)
|
|
4
|
+
|
|
5
|
+
Accept configuration supplied through `cordis.yml`.
|
|
6
|
+
|
|
7
|
+
## Define the Config type
|
|
8
|
+
|
|
9
|
+
Export a `Config` type and a same-named Schemastery schema. Put defaults directly on the schema fields:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
13
|
+
import Schema from '@deepseek-ai/schemastery'
|
|
14
|
+
|
|
15
|
+
export const name = 'my-plugin'
|
|
16
|
+
|
|
17
|
+
export interface Config {
|
|
18
|
+
greeting: string
|
|
19
|
+
maxRetries: number
|
|
20
|
+
verbose?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const Config: Schema<Config> = Schema.object({
|
|
24
|
+
greeting: Schema.string().default('Hello'),
|
|
25
|
+
maxRetries: Schema.number().default(3),
|
|
26
|
+
verbose: Schema.boolean().default(false),
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export function apply(ctx: Context, config: Config) {
|
|
30
|
+
console.log(config.greeting) // User value or schema default.
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Add the configuration to the inserted local plugin row in `scratch-plugin/cordis.yml`:
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
- insert:
|
|
38
|
+
- id: hello
|
|
39
|
+
name: './src/my-plugin.ts'
|
|
40
|
+
config:
|
|
41
|
+
greeting: 'Hi there'
|
|
42
|
+
maxRetries: 5
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
When loading the plugin, Cordis uses the exported schema to validate configuration and fill defaults. Do not export a plain object as `Config`; it does not implement the Standard Schema interface required by Cordis.
|
|
46
|
+
|
|
47
|
+
## Schema validation
|
|
48
|
+
|
|
49
|
+
Use Schemastery to express stricter validation:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
53
|
+
import Schema from '@deepseek-ai/schemastery'
|
|
54
|
+
|
|
55
|
+
export const name = 'validated-plugin'
|
|
56
|
+
|
|
57
|
+
export interface Config {
|
|
58
|
+
apiKey: string
|
|
59
|
+
timeout: number
|
|
60
|
+
mode: 'fast' | 'accurate'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const Config = Schema.object({
|
|
64
|
+
apiKey: Schema.string().required(),
|
|
65
|
+
timeout: Schema.number().default(30000),
|
|
66
|
+
mode: Schema.union(['fast', 'accurate']).default('fast'),
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
export function apply(ctx: Context, config: Config) {
|
|
70
|
+
// config is validated and type-safe.
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The schema runs while the plugin loads. Invalid configuration fails the load with an actionable error.
|
|
75
|
+
|
|
76
|
+
## Design principles
|
|
77
|
+
|
|
78
|
+
### Do not hardcode tunable values
|
|
79
|
+
|
|
80
|
+
Harness requires **anything that two deployments may want to set differently to be a configuration field**.
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
// Wrong: hardcoded timeout.
|
|
84
|
+
const TIMEOUT = 30000
|
|
85
|
+
|
|
86
|
+
// Correct: configurable.
|
|
87
|
+
export interface Config {
|
|
88
|
+
timeoutMs: number // Defaults to 30000.
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The test is whether `cordis.yml` can change the value without a code edit.
|
|
93
|
+
|
|
94
|
+
### Fail loudly on invalid configuration
|
|
95
|
+
|
|
96
|
+
Express self-contained constraints in the schema so invalid configuration fails while the plugin loads. References to services or registered resources require dependency injection; the [services tutorial](../framework/service.md) introduces that contract.
|
|
97
|
+
|
|
98
|
+
## Work with HMR
|
|
99
|
+
|
|
100
|
+
A configuration edit hot-replaces the plugin: the framework unloads the old instance and loads a new one. Because registrations are effects and clean themselves up, replacement does not retain the old instance's registrations.
|
|
101
|
+
|
|
102
|
+
## Next steps
|
|
103
|
+
|
|
104
|
+
- [Package and install a plugin](./publish.md) — ship the plugin as an installable package
|
|
105
|
+
- [Plugins and lifecycle](../framework/) — understand the full plugin lifecycle
|
|
106
|
+
- [Services and dependencies](../framework/service.md) — provide a service to other plugins
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# 插件配置
|
|
2
|
+
|
|
3
|
+
[English](config.md) | 中文
|
|
4
|
+
|
|
5
|
+
让你的插件接受用户在 `cordis.yml` 中传入的配置。
|
|
6
|
+
|
|
7
|
+
## 定义 Config 类型
|
|
8
|
+
|
|
9
|
+
在插件中导出一个 `Config` 类型和同名的 Schemastery schema;默认值直接写在 schema 中:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
13
|
+
import Schema from '@deepseek-ai/schemastery'
|
|
14
|
+
|
|
15
|
+
export const name = 'my-plugin'
|
|
16
|
+
|
|
17
|
+
export interface Config {
|
|
18
|
+
greeting: string
|
|
19
|
+
maxRetries: number
|
|
20
|
+
verbose?: boolean
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const Config: Schema<Config> = Schema.object({
|
|
24
|
+
greeting: Schema.string().default('Hello'),
|
|
25
|
+
maxRetries: Schema.number().default(3),
|
|
26
|
+
verbose: Schema.boolean().default(false),
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
export function apply(ctx: Context, config: Config) {
|
|
30
|
+
console.log(config.greeting) // User value or schema default.
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
在 `scratch-plugin/cordis.yml` 新插入的本地插件行中添加配置:
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
- insert:
|
|
38
|
+
- id: hello
|
|
39
|
+
name: './src/my-plugin.ts'
|
|
40
|
+
config:
|
|
41
|
+
greeting: 'Hi there'
|
|
42
|
+
maxRetries: 5
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
插件加载时,Cordis 会通过导出的 schema 校验配置,并填充未提供字段的默认值。不要导出普通对象作为 `Config`,因为它不满足 Cordis 要求的 Standard Schema 接口。
|
|
46
|
+
|
|
47
|
+
## Schema 校验
|
|
48
|
+
|
|
49
|
+
对于需要严格校验的场景,使用 Schemastery 定义 schema:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
53
|
+
import Schema from '@deepseek-ai/schemastery'
|
|
54
|
+
|
|
55
|
+
export const name = 'validated-plugin'
|
|
56
|
+
|
|
57
|
+
export interface Config {
|
|
58
|
+
apiKey: string
|
|
59
|
+
timeout: number
|
|
60
|
+
mode: 'fast' | 'accurate'
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const Config = Schema.object({
|
|
64
|
+
apiKey: Schema.string().required(),
|
|
65
|
+
timeout: Schema.number().default(30000),
|
|
66
|
+
mode: Schema.union(['fast', 'accurate']).default('fast'),
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
export function apply(ctx: Context, config: Config) {
|
|
70
|
+
// config is validated and type-safe.
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Schema 在插件加载时执行校验。如果配置不合法,插件会加载失败并给出明确错误信息。
|
|
75
|
+
|
|
76
|
+
## 设计原则
|
|
77
|
+
|
|
78
|
+
### 无硬编码可调参数
|
|
79
|
+
|
|
80
|
+
Harness 的约定:**凡是不同部署可能需要采用不同值的参数,都必须定义为配置字段**。
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
// Wrong: hardcoded timeout.
|
|
84
|
+
const TIMEOUT = 30000
|
|
85
|
+
|
|
86
|
+
// Correct: configurable.
|
|
87
|
+
export interface Config {
|
|
88
|
+
timeoutMs: number // Defaults to 30000.
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
检验标准:能否在 `cordis.yml` 中改变这个值,而不需要修改代码?
|
|
93
|
+
|
|
94
|
+
### 配置错误要响亮
|
|
95
|
+
|
|
96
|
+
在 schema 中表达自身完备的约束,使无效配置在插件加载时失败。对服务或已注册资源的引用需要依赖注入;[服务教程](../framework/service.md) 会介绍这项约定。
|
|
97
|
+
|
|
98
|
+
## 配合 HMR
|
|
99
|
+
|
|
100
|
+
配置变更会触发插件热替换:修改 `cordis.yml` 中某个插件的 `config` 后,框架会卸载旧实例并加载新实例。由于注册都属于 effect 并会自动清理,替换后不会保留旧实例的注册。
|
|
101
|
+
|
|
102
|
+
## 下一步
|
|
103
|
+
|
|
104
|
+
- [打包与安装插件](./publish.md) — 把插件以可安装包的形式交付
|
|
105
|
+
- [插件与生命周期](../framework/) — 深入了解插件的完整生命周期
|
|
106
|
+
- [服务与依赖](../framework/service.md) — 让你的插件对外提供服务
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write docs/user/develop/basic/index.md
|
|
5
|
+
index.md: 08199624e638aaf4a36b04446c39c228b2af6025
|
|
6
|
+
index.zh.md: c45a30d0bfffaf4a6c78303f9ca043c3397c8a08
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Your first plugin
|
|
2
|
+
|
|
3
|
+
English | [中文](index.zh.md)
|
|
4
|
+
|
|
5
|
+
This tutorial creates a minimal Harness plugin and loads it into the Web UI. Start from a repository checkout that has completed the [run-from-source path](../../../../README.md#run-from-source).
|
|
6
|
+
|
|
7
|
+
## Create a local project
|
|
8
|
+
|
|
9
|
+
From the repository root, create a scratch project for the tutorial:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
mkdir -p scratch-plugin/src
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## What is a plugin?
|
|
16
|
+
|
|
17
|
+
In Harness, a plugin is a TypeScript module that exports an `apply` function. The framework calls `apply` when loading the plugin and passes a `ctx` context object through which the plugin registers capabilities:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
21
|
+
|
|
22
|
+
export const name = 'my-plugin'
|
|
23
|
+
|
|
24
|
+
export function apply(ctx: Context) {
|
|
25
|
+
// Register capabilities here.
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
That is the complete configuration.
|
|
30
|
+
|
|
31
|
+
## Create the plugin file
|
|
32
|
+
|
|
33
|
+
Create `scratch-plugin/src/my-plugin.ts`:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
37
|
+
|
|
38
|
+
export const name = 'hello-plugin'
|
|
39
|
+
|
|
40
|
+
export function apply(ctx: Context) {
|
|
41
|
+
// Required dependencies are ready before apply runs.
|
|
42
|
+
console.log('[hello-plugin] plugin loaded!')
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Register it in cordis.yml
|
|
47
|
+
|
|
48
|
+
Run `pwd` from the repository root, then create `scratch-plugin/cordis.yml` as a Web overlay that inserts the local plugin. Replace `/absolute/path/to/deepseek-harness` below with the printed path:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
- insert:
|
|
52
|
+
- id: hello
|
|
53
|
+
name: '/absolute/path/to/deepseek-harness/scratch-plugin/src/my-plugin.ts'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The plugin path must be absolute. A patch file contributes configuration but does not change the profile directory from which the loader resolves module paths.
|
|
57
|
+
|
|
58
|
+
Start the Web UI with that overlay:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
pnpm dsh web --patch ./scratch-plugin/cordis.yml
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Open `http://127.0.0.1:3080`. The terminal prints `[hello-plugin] plugin loaded!` during startup.
|
|
65
|
+
|
|
66
|
+
## Automatic cleanup
|
|
67
|
+
|
|
68
|
+
Anything registered through `ctx`—event listeners, tools, or timers—is cleaned up when the plugin unloads. You do not need to call removeListener or clearInterval manually.
|
|
69
|
+
|
|
70
|
+
For a resource that needs explicit cleanup, such as a network connection, use `ctx.effect()` to provide its disposer:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
74
|
+
|
|
75
|
+
export function apply(ctx: Context) {
|
|
76
|
+
ctx.effect(() => {
|
|
77
|
+
const timer = setInterval(() => {
|
|
78
|
+
console.log('heartbeat')
|
|
79
|
+
}, 5000)
|
|
80
|
+
|
|
81
|
+
// The returned function runs when the plugin unloads.
|
|
82
|
+
return () => clearInterval(timer)
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Declare dependencies
|
|
88
|
+
|
|
89
|
+
If the plugin consumes another service such as `tools` or `llm`, declare it in `inject`:
|
|
90
|
+
|
|
91
|
+
```ts ignore-check
|
|
92
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
93
|
+
|
|
94
|
+
export const name = 'my-tool-plugin'
|
|
95
|
+
export const inject = ['tools']
|
|
96
|
+
|
|
97
|
+
export function apply(ctx: Context) {
|
|
98
|
+
// ctx.tools is ready here.
|
|
99
|
+
ctx.tools.register(/* ... */)
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The framework waits for every required service before loading the plugin.
|
|
104
|
+
|
|
105
|
+
## Three plugin forms
|
|
106
|
+
|
|
107
|
+
In addition to a function module, a plugin can use object or class form.
|
|
108
|
+
|
|
109
|
+
### Object form
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
113
|
+
|
|
114
|
+
export default {
|
|
115
|
+
name: 'my-plugin',
|
|
116
|
+
inject: ['tools'],
|
|
117
|
+
apply(ctx: Context) {
|
|
118
|
+
// ...
|
|
119
|
+
},
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Class form
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import { Service, type Context } from '@deepseek-ai/cordis'
|
|
127
|
+
|
|
128
|
+
export default class MyService extends Service {
|
|
129
|
+
static inject = ['tools']
|
|
130
|
+
|
|
131
|
+
constructor(ctx: Context) {
|
|
132
|
+
super(ctx, 'myService')
|
|
133
|
+
// Perform synchronous initialization in the constructor.
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Function form is sufficient in most cases. Use class form when the plugin provides a service to other plugins; see [services and dependencies](../framework/service.md).
|
|
139
|
+
|
|
140
|
+
## Next steps
|
|
141
|
+
|
|
142
|
+
- [Build a tool](./tool.md) — learn the tool definition DSL
|
|
143
|
+
- [Plugin configuration](./config.md) — accept user configuration
|
|
144
|
+
- [Cordis tutorial](../../../cordis-tutorial/index.md) — the plugin framework underneath, built from a scratch directory with no API key
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# 第一个插件
|
|
2
|
+
|
|
3
|
+
[English](index.md) | 中文
|
|
4
|
+
|
|
5
|
+
本教程会创建一个最小的 Harness 插件,并将其加载到 Web UI 中。请从已完成[从源码运行路径](../../../../README.md#run-from-source)的仓库检出开始。
|
|
6
|
+
|
|
7
|
+
## 创建本地项目
|
|
8
|
+
|
|
9
|
+
在仓库根目录创建本教程使用的临时项目:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
mkdir -p scratch-plugin/src
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 插件是什么
|
|
16
|
+
|
|
17
|
+
在 Harness 中,插件是一个导出 `apply` 函数的 TypeScript 模块。框架在加载时调用 `apply`,传入一个 `ctx`(上下文对象),你通过 `ctx` 注册能力:
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
21
|
+
|
|
22
|
+
export const name = 'my-plugin'
|
|
23
|
+
|
|
24
|
+
export function apply(ctx: Context) {
|
|
25
|
+
// Register capabilities here.
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
这就是完整配置。
|
|
30
|
+
|
|
31
|
+
## 创建插件文件
|
|
32
|
+
|
|
33
|
+
创建 `scratch-plugin/src/my-plugin.ts`:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
37
|
+
|
|
38
|
+
export const name = 'hello-plugin'
|
|
39
|
+
|
|
40
|
+
export function apply(ctx: Context) {
|
|
41
|
+
// Required dependencies are ready before apply runs.
|
|
42
|
+
console.log('[hello-plugin] plugin loaded!')
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 注册到 cordis.yml
|
|
47
|
+
|
|
48
|
+
在仓库根目录运行 `pwd`,然后创建 `scratch-plugin/cordis.yml`,作为插入本地插件的 Web 覆盖层。请将下文的 `/absolute/path/to/deepseek-harness` 替换为命令打印的路径:
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
- insert:
|
|
52
|
+
- id: hello
|
|
53
|
+
name: '/absolute/path/to/deepseek-harness/scratch-plugin/src/my-plugin.ts'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
插件路径必须是绝对路径。patch 文件只贡献配置,不会改变 loader 解析模块路径时使用的 profile 目录。
|
|
57
|
+
|
|
58
|
+
使用该覆盖层启动 Web UI:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
pnpm dsh web --patch ./scratch-plugin/cordis.yml
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
打开 `http://127.0.0.1:3080`。启动期间,终端会打印 `[hello-plugin] plugin loaded!`。
|
|
65
|
+
|
|
66
|
+
## 自动清理
|
|
67
|
+
|
|
68
|
+
通过 `ctx` 注册的任何东西——事件监听、工具、定时器——在插件卸载时都会被自动清理。你不需要手动 removeListener 或 clearInterval。
|
|
69
|
+
|
|
70
|
+
如果你有需要手动清理的资源(比如一个网络连接),用 `ctx.effect()` 告诉框架怎么清理:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
74
|
+
|
|
75
|
+
export function apply(ctx: Context) {
|
|
76
|
+
ctx.effect(() => {
|
|
77
|
+
const timer = setInterval(() => {
|
|
78
|
+
console.log('heartbeat')
|
|
79
|
+
}, 5000)
|
|
80
|
+
|
|
81
|
+
// The returned function runs when the plugin unloads.
|
|
82
|
+
return () => clearInterval(timer)
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 声明依赖
|
|
88
|
+
|
|
89
|
+
如果你的插件需要使用其他服务(如 `tools`、`llm`),需要声明 `inject`:
|
|
90
|
+
|
|
91
|
+
```ts ignore-check
|
|
92
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
93
|
+
|
|
94
|
+
export const name = 'my-tool-plugin'
|
|
95
|
+
export const inject = ['tools']
|
|
96
|
+
|
|
97
|
+
export function apply(ctx: Context) {
|
|
98
|
+
// ctx.tools is ready here.
|
|
99
|
+
ctx.tools.register(/* ... */)
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
框架会确保依赖的服务就绪后才加载你的插件。
|
|
104
|
+
|
|
105
|
+
## 插件的三种形态
|
|
106
|
+
|
|
107
|
+
除了函数形式,插件还支持对象形式和类形式:
|
|
108
|
+
|
|
109
|
+
### 对象形式
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
113
|
+
|
|
114
|
+
export default {
|
|
115
|
+
name: 'my-plugin',
|
|
116
|
+
inject: ['tools'],
|
|
117
|
+
apply(ctx: Context) {
|
|
118
|
+
// ...
|
|
119
|
+
},
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 类形式
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import { Service, type Context } from '@deepseek-ai/cordis'
|
|
127
|
+
|
|
128
|
+
export default class MyService extends Service {
|
|
129
|
+
static inject = ['tools']
|
|
130
|
+
|
|
131
|
+
constructor(ctx: Context) {
|
|
132
|
+
super(ctx, 'myService')
|
|
133
|
+
// Perform synchronous initialization in the constructor.
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
大多数情况下,函数形式足够了。当插件需要向其他插件提供服务时,可使用类形式(见 [服务与依赖](../framework/service.md))。
|
|
139
|
+
|
|
140
|
+
## 下一步
|
|
141
|
+
|
|
142
|
+
- [开发一个工具](./tool.md) — 了解工具定义 DSL
|
|
143
|
+
- [插件配置](./config.md) — 让插件接受用户配置
|
|
144
|
+
- [Cordis 框架教程](../../../cordis-tutorial/index.md) — 底层的插件框架,在临时目录中动手构建,无需 API 密钥
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write docs/user/develop/basic/publish.md
|
|
5
|
+
publish.md: 9548fe2f8e4636dd160c79cd0d50f01f8bdfd3d1
|
|
6
|
+
publish.zh.md: 2cff05edcca55bac5fde9d2e7d24ed9c8b48a6f5
|