better-dsh 0.2.3 → 0.2.4
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/cordis.patch.yml +1 -1
- package/docs/50_test-reports/2026-09-06-write/345/267/245/345/205/267sandbox/345/215/207/347/272/247/351/200/217/344/274/240bug/345/244/215/345/217/221/345/217/212/346/214/202/350/265/267-/344/272/213/344/273/266/346/212/245/345/221/212.md +176 -0
- package/docs/50_test-reports/2026-09-08-hashline-edit-E_RANGE_UNVERIFIED/350/267/250/350/275/256/344/274/232/350/257/235/351/224/256/345/244/261/346/225/210-/350/257/212/346/226/255/346/212/245/345/221/212.md +226 -0
- package/docs/50_test-reports/2026-09-11-control-prompt-into-eval-description/345/256/236/346/265/213/346/212/245/345/221/212.md +222 -0
- package/docs/50_test-reports/2026-09-12-fs-scheme-resolution-/345/256/236/346/265/213/346/212/245/345/221/212.md +81 -0
- package/docs/50_test-reports/2026-09-12-url-schemes-grammar-matrix/344/270/216catalog-centralize-/345/256/236/346/265/213/346/212/245/345/221/212.md +234 -0
- package/docs/50_test-reports/2026-09-12-url-schemes-recallable-context-design/351/252/214/350/257/201/346/212/245/345/221/212.md +160 -0
- package/docs/50_test-reports/2026-09-12-url-schemes-recallable-context-/345/256/236/346/265/213/345/211/247/346/234/254.md +44 -0
- package/docs/50_test-reports/2026-09-12-url-schemes-recallable-context-/345/256/236/346/265/213/346/212/245/345/221/212.md +89 -0
- package/docs/50_test-reports/2026-09-12-url-schemes-/345/205/255scheme/345/206/222/347/203/237/344/270/216/350/276/271/347/225/214/345/256/236/346/265/213/346/212/245/345/221/212.md +198 -0
- package/docs/50_test-reports/2026-09-13-hashline-off/344/270/213scheme/345/217/257/350/276/276/346/200/247/345/267/245/345/205/267/351/235/242/344/270/215/345/257/271/347/247/260-/345/256/236/346/265/213/346/212/245/345/221/212.md +246 -0
- package/docs/50_test-reports/2026-09-13-preact-ui-shell/345/256/236/346/265/213/346/212/245/345/221/212.md +50 -0
- package/docs/50_test-reports/2026-09-14-4999-skill/346/270/205/345/215/225/344/270/216lsp-gate/345/256/236/346/265/213/346/212/245/345/221/212.md +63 -0
- package/docs/50_test-reports/upstream-dsh-0.1.3-alpha.2-local-test-report.md +44 -0
- package/docs/50_test-reports/upstream-dsh-0.1.3-alpha.2-report.md +110 -0
- package/docs/50_test-reports/upstream-dsh-0.1.5-rc.2-local-test-report.md +79 -0
- package/docs/50_test-reports/v0.2.3b-hashline-content-locator/345/256/236/346/265/213/346/212/245/345/221/212.md +73 -0
- package/docs/50_test-reports/v0.2.3c-mobile-wave/345/256/236/346/265/213/346/212/245/345/221/212.md +47 -0
- package/docs/50_test-reports/v0.2.4-ios-focus-zoom-suppression/345/256/236/346/265/213/346/212/245/345/221/212.md +158 -0
- package/docs/specs/agent/spec.md +54 -0
- package/docs/specs/ast/spec.md +34 -0
- package/docs/specs/compaction-recall/spec.md +46 -0
- package/docs/specs/ctx/spec.md +107 -0
- package/docs/specs/dsh/spec.md +47 -0
- package/docs/specs/dvc/spec.md +87 -0
- package/docs/specs/escalation-guidance/spec.md +44 -0
- package/docs/specs/fs-scheme-resolution/spec.md +37 -0
- package/docs/specs/hash-edit/spec.md +41 -0
- package/docs/specs/http-read/spec.md +73 -0
- package/docs/specs/kernel-provisioning/spec.md +53 -0
- package/docs/specs/lsp/spec.md +121 -0
- package/docs/specs/mobile-layout/spec.md +108 -0
- package/docs/specs/model-failover/spec.md +20 -0
- package/docs/specs/preact-ui-shell/spec.md +22 -0
- package/docs/specs/repl-dispatch-resilience/spec.md +21 -0
- package/docs/specs/skill/spec.md +58 -0
- package/docs/specs/tool-surface/spec.md +222 -0
- package/docs/specs/url-schema/spec.md +148 -0
- package/docs/specs/web-trust-fence/spec.md +43 -0
- package/docs/upstream-dsh-0.1.5-rc.2-report.md +156 -0
- package/dsh-docs/AGENTS.md +75 -0
- package/dsh-docs/agent-lifecycle.md +84 -0
- package/dsh-docs/agent-lifecycle.zh.md +86 -0
- package/dsh-docs/api-gateway.md +164 -0
- package/dsh-docs/api-gateway.zh.md +164 -0
- package/dsh-docs/architecture.md +150 -0
- package/dsh-docs/architecture.zh.md +154 -0
- package/dsh-docs/capability-seams.md +543 -0
- package/dsh-docs/capability-seams.zh.md +545 -0
- package/dsh-docs/config-catalog.md +3473 -0
- package/dsh-docs/config-catalog.zh.md +3474 -0
- package/dsh-docs/cookbook/adding-a-package.md +117 -0
- package/dsh-docs/cookbook/adding-a-package.zh.md +119 -0
- package/dsh-docs/cookbook/adding-a-remote-api.md +197 -0
- package/dsh-docs/cookbook/adding-a-remote-api.zh.md +197 -0
- package/dsh-docs/cookbook/adding-a-session-format-version.md +109 -0
- package/dsh-docs/cookbook/adding-a-session-format-version.zh.md +109 -0
- package/dsh-docs/cookbook/adding-a-settings-card.md +102 -0
- package/dsh-docs/cookbook/adding-a-settings-card.zh.md +102 -0
- package/dsh-docs/cookbook/adding-a-tool.md +101 -0
- package/dsh-docs/cookbook/adding-a-tool.zh.md +103 -0
- package/dsh-docs/cookbook/adding-a-vendored-package.md +59 -0
- package/dsh-docs/cookbook/adding-a-vendored-package.zh.md +59 -0
- package/dsh-docs/cookbook/adding-an-llm-adapter.md +43 -0
- package/dsh-docs/cookbook/adding-an-llm-adapter.zh.md +43 -0
- package/dsh-docs/cookbook/extension-cookbook.md +132 -0
- package/dsh-docs/cookbook/extension-cookbook.zh.md +136 -0
- package/dsh-docs/cookbook/maintaining-dsh-code-review.md +64 -0
- package/dsh-docs/cookbook/maintaining-dsh-code-review.zh.md +64 -0
- package/dsh-docs/cookbook/responding-to-pr-review-on-a-stack.md +32 -0
- package/dsh-docs/cookbook/responding-to-pr-review-on-a-stack.zh.md +32 -0
- package/dsh-docs/cordis-api/context.md +364 -0
- package/dsh-docs/cordis-api/context.zh.md +366 -0
- package/dsh-docs/cordis-api/events.md +207 -0
- package/dsh-docs/cordis-api/events.zh.md +209 -0
- package/dsh-docs/cordis-api/fiber.md +375 -0
- package/dsh-docs/cordis-api/fiber.zh.md +377 -0
- package/dsh-docs/cordis-api/inherited.md +39 -0
- package/dsh-docs/cordis-api/registry.md +152 -0
- package/dsh-docs/cordis-api/registry.zh.md +154 -0
- package/dsh-docs/cordis-api/service.md +102 -0
- package/dsh-docs/cordis-api/service.zh.md +104 -0
- package/dsh-docs/cordis-primer.md +45 -0
- package/dsh-docs/cordis-primer.zh.md +51 -0
- package/dsh-docs/cordis-tutorial/01-first-plugin.md +95 -0
- package/dsh-docs/cordis-tutorial/01-first-plugin.zh.md +95 -0
- package/dsh-docs/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
- package/dsh-docs/cordis-tutorial/02-lifecycle-and-effects.zh.md +98 -0
- package/dsh-docs/cordis-tutorial/03-services.md +98 -0
- package/dsh-docs/cordis-tutorial/03-services.zh.md +98 -0
- package/dsh-docs/cordis-tutorial/04-events.md +144 -0
- package/dsh-docs/cordis-tutorial/04-events.zh.md +144 -0
- package/dsh-docs/cordis-tutorial/05-config.md +84 -0
- package/dsh-docs/cordis-tutorial/05-config.zh.md +84 -0
- package/dsh-docs/cordis-tutorial/06-composition-and-hmr.md +113 -0
- package/dsh-docs/cordis-tutorial/06-composition-and-hmr.zh.md +113 -0
- package/dsh-docs/cordis-tutorial/07-into-the-harness.md +108 -0
- package/dsh-docs/cordis-tutorial/07-into-the-harness.zh.md +108 -0
- package/dsh-docs/cordis-tutorial/index.md +60 -0
- package/dsh-docs/cordis-tutorial/index.zh.md +62 -0
- package/dsh-docs/deepseek-llm-api-wire-extensions.md +163 -0
- package/dsh-docs/deepseek-llm-api-wire-extensions.zh.md +163 -0
- package/dsh-docs/defensive-patterns.md +33 -0
- package/dsh-docs/defensive-patterns.zh.md +35 -0
- package/dsh-docs/development.md +167 -0
- package/dsh-docs/development.zh.md +173 -0
- package/dsh-docs/event-producer-consumer.md +86 -0
- package/dsh-docs/event-producer-consumer.zh.md +88 -0
- package/dsh-docs/glossary.md +45 -0
- package/dsh-docs/glossary.zh.md +45 -0
- package/dsh-docs/graph-atlas.md +22 -0
- package/dsh-docs/graph-atlas.zh.md +24 -0
- package/dsh-docs/i18n/README.md +60 -0
- package/dsh-docs/i18n/README.zh.md +62 -0
- package/dsh-docs/i18n/style-samples.md +87 -0
- package/dsh-docs/i18n/terminology.md +214 -0
- package/dsh-docs/i18n/translation-prompt.md +263 -0
- package/dsh-docs/i18n/translation-rules.md +69 -0
- package/dsh-docs/i18n/translation-rules.zh.md +69 -0
- package/dsh-docs/module-graph.md +1411 -0
- package/dsh-docs/module-graph.zh.md +1413 -0
- package/dsh-docs/persistence-catalog.md +1075 -0
- package/dsh-docs/persistence-catalog.zh.md +1077 -0
- package/dsh-docs/postmortem/0001-acp-default-export-drops-inject.md +113 -0
- package/dsh-docs/postmortem/0001-acp-default-export-drops-inject.zh.md +113 -0
- package/dsh-docs/postmortem/0002-js-expression-disabled-filesystem-tools.md +47 -0
- package/dsh-docs/postmortem/0002-js-expression-disabled-filesystem-tools.zh.md +47 -0
- package/dsh-docs/postmortem/0003-web-agent-gui-feedback-loop.md +53 -0
- package/dsh-docs/postmortem/0003-web-agent-gui-feedback-loop.zh.md +53 -0
- package/dsh-docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.md +55 -0
- package/dsh-docs/postmortem/0004-landlock-partial-notice-misclassified-child-failures.zh.md +55 -0
- package/dsh-docs/postmortem/README.md +18 -0
- package/dsh-docs/postmortem/README.zh.md +18 -0
- package/dsh-docs/rescope.md +53 -0
- package/dsh-docs/rescope.zh.md +53 -0
- package/dsh-docs/session-format-status.md +47 -0
- package/dsh-docs/session-format-status.zh.md +47 -0
- package/dsh-docs/subsystems/README.md +61 -0
- package/dsh-docs/subsystems/README.zh.md +61 -0
- package/dsh-docs/subsystems/agent-team.md +207 -0
- package/dsh-docs/subsystems/agent-team.zh.md +207 -0
- package/dsh-docs/subsystems/approval.md +170 -0
- package/dsh-docs/subsystems/approval.zh.md +170 -0
- package/dsh-docs/subsystems/attachment.md +351 -0
- package/dsh-docs/subsystems/attachment.zh.md +351 -0
- package/dsh-docs/subsystems/client-modules.md +168 -0
- package/dsh-docs/subsystems/client-modules.zh.md +168 -0
- package/dsh-docs/subsystems/client-resources.md +91 -0
- package/dsh-docs/subsystems/client-resources.zh.md +91 -0
- package/dsh-docs/subsystems/code-runtime.md +195 -0
- package/dsh-docs/subsystems/code-runtime.zh.md +195 -0
- package/dsh-docs/subsystems/commands.md +219 -0
- package/dsh-docs/subsystems/commands.zh.md +219 -0
- package/dsh-docs/subsystems/compaction.md +238 -0
- package/dsh-docs/subsystems/compaction.zh.md +238 -0
- package/dsh-docs/subsystems/conversation.md +258 -0
- package/dsh-docs/subsystems/conversation.zh.md +258 -0
- package/dsh-docs/subsystems/core.md +1209 -0
- package/dsh-docs/subsystems/core.zh.md +1219 -0
- package/dsh-docs/subsystems/credentials.md +329 -0
- package/dsh-docs/subsystems/credentials.zh.md +329 -0
- package/dsh-docs/subsystems/extensions.md +382 -0
- package/dsh-docs/subsystems/extensions.zh.md +382 -0
- package/dsh-docs/subsystems/feedback.md +266 -0
- package/dsh-docs/subsystems/feedback.zh.md +266 -0
- package/dsh-docs/subsystems/filesystem.md +505 -0
- package/dsh-docs/subsystems/filesystem.zh.md +505 -0
- package/dsh-docs/subsystems/goal.md +277 -0
- package/dsh-docs/subsystems/goal.zh.md +277 -0
- package/dsh-docs/subsystems/invariants.md +88 -0
- package/dsh-docs/subsystems/invariants.zh.md +88 -0
- package/dsh-docs/subsystems/jobs.md +290 -0
- package/dsh-docs/subsystems/jobs.zh.md +290 -0
- package/dsh-docs/subsystems/llm-streaming.md +1080 -0
- package/dsh-docs/subsystems/llm-streaming.zh.md +1086 -0
- package/dsh-docs/subsystems/lsp.md +202 -0
- package/dsh-docs/subsystems/lsp.zh.md +202 -0
- package/dsh-docs/subsystems/permission-presets.md +131 -0
- package/dsh-docs/subsystems/permission-presets.zh.md +131 -0
- package/dsh-docs/subsystems/persistence.md +395 -0
- package/dsh-docs/subsystems/persistence.zh.md +395 -0
- package/dsh-docs/subsystems/plan.md +87 -0
- package/dsh-docs/subsystems/plan.zh.md +87 -0
- package/dsh-docs/subsystems/sandbox.md +220 -0
- package/dsh-docs/subsystems/sandbox.zh.md +220 -0
- package/dsh-docs/subsystems/schedule.md +192 -0
- package/dsh-docs/subsystems/schedule.zh.md +192 -0
- package/dsh-docs/subsystems/scope.md +59 -0
- package/dsh-docs/subsystems/scope.zh.md +59 -0
- package/dsh-docs/subsystems/session-projection.md +354 -0
- package/dsh-docs/subsystems/session-projection.zh.md +354 -0
- package/dsh-docs/subsystems/session-query.md +509 -0
- package/dsh-docs/subsystems/session-query.zh.md +509 -0
- package/dsh-docs/subsystems/session-reference.md +219 -0
- package/dsh-docs/subsystems/session-reference.zh.md +219 -0
- package/dsh-docs/subsystems/session-telemetry.md +194 -0
- package/dsh-docs/subsystems/session-telemetry.zh.md +194 -0
- package/dsh-docs/subsystems/session-title.md +204 -0
- package/dsh-docs/subsystems/session-title.zh.md +204 -0
- package/dsh-docs/subsystems/session.md +1155 -0
- package/dsh-docs/subsystems/session.zh.md +1159 -0
- package/dsh-docs/subsystems/settings.md +405 -0
- package/dsh-docs/subsystems/settings.zh.md +405 -0
- package/dsh-docs/subsystems/shell.md +303 -0
- package/dsh-docs/subsystems/shell.zh.md +303 -0
- package/dsh-docs/subsystems/sidebar-right.md +148 -0
- package/dsh-docs/subsystems/sidebar-right.zh.md +148 -0
- package/dsh-docs/subsystems/skills.md +354 -0
- package/dsh-docs/subsystems/skills.zh.md +354 -0
- package/dsh-docs/subsystems/slots.md +175 -0
- package/dsh-docs/subsystems/slots.zh.md +175 -0
- package/dsh-docs/subsystems/spill.md +117 -0
- package/dsh-docs/subsystems/spill.zh.md +117 -0
- package/dsh-docs/subsystems/storage.md +260 -0
- package/dsh-docs/subsystems/storage.zh.md +260 -0
- package/dsh-docs/subsystems/subagent.md +766 -0
- package/dsh-docs/subsystems/subagent.zh.md +770 -0
- package/dsh-docs/subsystems/subprocess.md +324 -0
- package/dsh-docs/subsystems/subprocess.zh.md +324 -0
- package/dsh-docs/subsystems/system-prompt.md +220 -0
- package/dsh-docs/subsystems/system-prompt.zh.md +220 -0
- package/dsh-docs/subsystems/terminal.md +184 -0
- package/dsh-docs/subsystems/terminal.zh.md +184 -0
- package/dsh-docs/subsystems/todo.md +32 -0
- package/dsh-docs/subsystems/todo.zh.md +32 -0
- package/dsh-docs/subsystems/token-meter.md +105 -0
- package/dsh-docs/subsystems/token-meter.zh.md +105 -0
- package/dsh-docs/subsystems/tools.md +720 -0
- package/dsh-docs/subsystems/tools.zh.md +720 -0
- package/dsh-docs/subsystems/typert.md +343 -0
- package/dsh-docs/subsystems/typert.zh.md +343 -0
- package/dsh-docs/subsystems/user-questions.md +178 -0
- package/dsh-docs/subsystems/user-questions.zh.md +178 -0
- package/dsh-docs/subsystems/web-client.md +95 -0
- package/dsh-docs/subsystems/web-client.zh.md +95 -0
- package/dsh-docs/subsystems/web-server.md +154 -0
- package/dsh-docs/subsystems/web-server.zh.md +154 -0
- package/dsh-docs/subsystems/web.md +206 -0
- package/dsh-docs/subsystems/web.zh.md +206 -0
- package/dsh-docs/subsystems/webhook.md +70 -0
- package/dsh-docs/subsystems/webhook.zh.md +70 -0
- package/dsh-docs/subsystems/workflow.md +278 -0
- package/dsh-docs/subsystems/workflow.zh.md +278 -0
- package/dsh-docs/subsystems/workspace.md +321 -0
- package/dsh-docs/subsystems/workspace.zh.md +321 -0
- package/dsh-docs/testing.md +54 -0
- package/dsh-docs/testing.zh.md +54 -0
- package/dsh-docs/tool-catalog.md +2225 -0
- package/dsh-docs/tool-catalog.zh.md +2233 -0
- package/dsh-docs/tool-execution-pipeline.md +62 -0
- package/dsh-docs/tool-execution-pipeline.zh.md +64 -0
- package/dsh-docs/user/develop/basic/config.md +106 -0
- package/dsh-docs/user/develop/basic/config.zh.md +106 -0
- package/dsh-docs/user/develop/basic/index.md +144 -0
- package/dsh-docs/user/develop/basic/index.zh.md +144 -0
- package/dsh-docs/user/develop/basic/publish.md +183 -0
- package/dsh-docs/user/develop/basic/publish.zh.md +183 -0
- package/dsh-docs/user/develop/basic/tool.md +52 -0
- package/dsh-docs/user/develop/basic/tool.zh.md +52 -0
- package/dsh-docs/user/develop/framework/events.md +143 -0
- package/dsh-docs/user/develop/framework/events.zh.md +143 -0
- package/dsh-docs/user/develop/framework/index.md +137 -0
- package/dsh-docs/user/develop/framework/index.zh.md +137 -0
- package/dsh-docs/user/develop/framework/service.md +148 -0
- package/dsh-docs/user/develop/framework/service.zh.md +150 -0
- package/dsh-docs/user/develop/practice/dynamic-cordis.md +15 -0
- package/dsh-docs/user/develop/practice/dynamic-cordis.zh.md +15 -0
- package/dsh-docs/user/develop/practice/index.md +155 -0
- package/dsh-docs/user/develop/practice/index.zh.md +155 -0
- package/dsh-docs/user/develop/practice/llm-adapter.md +189 -0
- package/dsh-docs/user/develop/practice/llm-adapter.zh.md +189 -0
- package/dsh-docs/user/guide/github-review.md +102 -0
- package/dsh-docs/user/guide/github-review.zh.md +102 -0
- package/dsh-docs/user/guide/index.md +30 -0
- package/dsh-docs/user/guide/index.zh.md +30 -0
- package/dsh-docs/user/guide/mcp-memory.md +101 -0
- package/dsh-docs/user/guide/mcp-memory.zh.md +101 -0
- package/dsh-docs/user/guide/network-proxy.md +85 -0
- package/dsh-docs/user/guide/network-proxy.zh.md +85 -0
- package/dsh-docs/user/guide/providers.md +190 -0
- package/dsh-docs/user/guide/providers.zh.md +190 -0
- package/dsh-docs/user/guide/python-sdk.md +150 -0
- package/dsh-docs/user/guide/python-sdk.zh.md +150 -0
- package/dsh-docs/user/guide/schedule.md +21 -0
- package/dsh-docs/user/guide/schedule.zh.md +21 -0
- package/dsh-docs/user/index.md +11 -0
- package/dsh-docs/user/index.zh.md +11 -0
- package/dsh-docs/web-styling.md +29 -0
- package/dsh-docs/web-styling.zh.md +29 -0
- package/eval-description.md +33 -0
- package/lib/client/index.js +327 -88
- package/lib/fs-aware/sandbox-plugin.d.ts +71 -0
- package/lib/fs-aware/sandbox-plugin.js +249 -0
- package/lib/index.d.ts +22 -22
- package/lib/index.js +3095 -3204
- package/lib/lsp-server-registry-DkaYmTwt.js +972 -0
- package/lib/lsp-server-registry-_hk-Wcia.js +3 -0
- package/lib/py-sdk-Chvy92MB.js +178 -0
- package/lib/py-sdk.d.ts +19 -2
- package/lib/py-sdk.js +2 -2
- package/lib/wrap-JFjcWwZf.js +747 -0
- package/package.json +9 -3
- package/url-schemes-instruction.md +22 -0
- package/control-prompt.md +0 -37
- package/docs/50_test-reports/v0.1.8d_artifacts/README.md +0 -138
- package/docs/50_test-reports/v0.1.8d_artifacts/code-mode-repl-only.observation.md +0 -74
- package/docs/50_test-reports/v0.1.8d_artifacts/dsh-session-session-4a293388-9ae1-474b-87a0-9e17bb556d94.jsonl +0 -3890
- package/docs/50_test-reports/v0.1.8d_artifacts/dsh-session-session-4a293388-9ae1-474b-87a0-9e17bb556d94.w-sample-0435.jsonl +0 -544
- package/docs/50_test-reports/v0.1.8d_artifacts/functions.json +0 -592
- package/docs/50_test-reports/v0.1.8d_artifacts/skills-catalog.snapshot.md +0 -30
- package/docs/50_test-reports/v0.1.8d_artifacts/tools-sdk.output-schemas.json +0 -1236
- package/docs/50_test-reports/v0.1.8d_artifacts/tools-sdk.python.txt +0 -592
- package/docs/50_test-reports/v0.1.8d_artifacts/tools-sdk.typescript.txt +0 -516
- package/docs/50_test-reports/v0.1.8d_artifacts/wire-vs-transcription.diff.md +0 -54
- package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/Cargo.lock +0 -7
- package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/Cargo.toml +0 -6
- package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/src/bin/messy.rs +0 -8
- package/docs/50_test-reports/v0.2.0b_artifacts/f2probe/src/main.rs +0 -4
- package/docs/50_test-reports/v0.2.0b_artifacts/hashline-probe.md +0 -5
- package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/Cargo.lock +0 -7
- package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/Cargo.toml +0 -7
- package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/build.rs +0 -4
- package/docs/50_test-reports/v0.2.0b_artifacts/slowprobe/src/main.rs +0 -13
- package/docs/60_exploration-and-research/cordis-research.md +0 -350
- package/docs/60_exploration-and-research/dsh-web-profile-package-map.md +0 -186
- package/docs/60_exploration-and-research/dsh-web-ui-slot-system-research.md +0 -310
- package/docs/60_exploration-and-research/dsh-webui-strip-boundary-research.md +0 -300
- package/docs/60_exploration-and-research/ios-chat-app-bridge-research.md +0 -324
- package/docs/60_exploration-and-research/web-frontend-composability-research.md +0 -191
- package/docs/REPL-/345/267/245/345/205/267/350/260/203/347/224/250-/346/210/252/346/226/255/350/257/212/346/226/255.md +0 -110
- package/docs/adr/0001-bridge-tool-layer-not-service-layer.md +0 -14
- package/docs/adr/0002-masking-is-presentation-only.md +0 -15
- package/docs/plans/A2A-messaging-channel-test-archive.md +0 -256
- package/docs/plans/code-mode-vs-rlm-ipython-comparison.md +0 -137
- package/docs/plans/dashr-blueprint-review.md +0 -201
- package/docs/plans/dashr-blueprint.md +0 -561
- package/docs/plans/dashr-compaction-window-and-archive.md +0 -307
- package/docs/plans/dashr-profile-layer-feasibility.md +0 -367
- package/docs/plans/dashr-sandbox-escalation-semantics-gap.md +0 -171
- package/docs/plans/dashr-security-sandbox-analysis.md +0 -187
- package/docs/plans/dashr-surface-invariant-and-omp-imports.md +0 -97
- package/docs/plans/ipython-kernel-interactive-interface-test-report.md +0 -152
- package/docs/plans/kernel-refactoring/Dash-IPython-Control-Prompt-draft.md +0 -146
- package/docs/plans/kernel-refactoring/Dash-IPython-Control-Prompt-draft_v3.md +0 -50
- package/docs/plans/kernel-refactoring/Dash-IPython-Control-Prompt-draft_v4.md +0 -79
- package/docs/plans/kernel-refactoring/Dash-vs-PrimeAgent-systemprompt-toolcatalog-comparison.md +0 -138
- package/docs/plans/kernel-refactoring/RLM-system-prompt-injection-gap-report.md +0 -161
- package/docs/plans/kernel-refactoring/V0.1.5-development-plan.md +0 -109
- package/docs/plans/kernel-refactoring/actinoable-surface-to-llm-in-agent-runtime_dsh.md +0 -50
- package/docs/plans/kernel-refactoring/actinoable-surface-to-llm-in-agent-runtime_prime.md +0 -113
- package/docs/plans/recallable-compaction.md +0 -147
- package/docs/plans/spike-tag-repro.mjs +0 -102
- package/docs/plans/upstream-analysis.md +0 -128
- package/docs/v0.1.8-improved-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -142
- package/docs/v0.1.8-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -193
- package/docs/v0.1.8b-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -96
- package/docs/v0.1.8c-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -127
- package/docs/v0.1.8d-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -150
- package/docs/v0.1.8d_artifacts/README.md +0 -138
- package/docs/v0.1.8d_artifacts/code-mode-repl-only.observation.md +0 -74
- package/docs/v0.1.8d_artifacts/dsh-session-session-4a293388-9ae1-474b-87a0-9e17bb556d94.jsonl +0 -3890
- package/docs/v0.1.8d_artifacts/dsh-session-session-4a293388-9ae1-474b-87a0-9e17bb556d94.w-sample-0435.jsonl +0 -544
- package/docs/v0.1.8d_artifacts/functions.json +0 -592
- package/docs/v0.1.8d_artifacts/skills-catalog.snapshot.md +0 -30
- package/docs/v0.1.8d_artifacts/tools-sdk.output-schemas.json +0 -1236
- package/docs/v0.1.8d_artifacts/tools-sdk.python.txt +0 -592
- package/docs/v0.1.8d_artifacts/tools-sdk.typescript.txt +0 -516
- package/docs/v0.1.8d_artifacts/wire-vs-transcription.diff.md +0 -54
- package/docs/v0.1.8e-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -224
- package/docs/v0.1.9a-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -168
- package/docs/v0.2.0b-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -123
- package/docs/v0.2.0b_artifacts/f2probe/Cargo.lock +0 -7
- package/docs/v0.2.0b_artifacts/f2probe/Cargo.toml +0 -6
- package/docs/v0.2.0b_artifacts/f2probe/src/bin/messy.rs +0 -8
- package/docs/v0.2.0b_artifacts/f2probe/src/main.rs +0 -4
- package/docs/v0.2.0b_artifacts/hashline-probe.md +0 -5
- package/docs/v0.2.0b_artifacts/slowprobe/Cargo.lock +0 -7
- package/docs/v0.2.0b_artifacts/slowprobe/Cargo.toml +0 -7
- package/docs/v0.2.0b_artifacts/slowprobe/build.rs +0 -4
- package/docs/v0.2.0b_artifacts/slowprobe/src/main.rs +0 -13
- package/docs/v0.2.1-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -110
- package/docs/v0.2.1b-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -86
- package/docs/v0.2.1c-/345/256/236/346/265/213/346/212/245/345/221/212.md +0 -66
- package/lib/py-sdk-BCaOGYz7.d.ts +0 -125
- package/lib/py-sdk-CbgYiX8O.js +0 -691
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# 代码运行时
|
|
2
|
+
|
|
3
|
+
[English](code-runtime.md) | 中文
|
|
4
|
+
|
|
5
|
+
代码执行 seam 是一个[能力 seam](../../.agents/notes/implemented/architecture/2026-06-13-capability-seams.zh.md):其 Service Definition([dsh-code-runtime](../../packages/code-runtime/code-runtime),`ctx.codeRuntime`)使用宿主提供的异步绑定运行一段模型编写的程序,并报告其打印内容与返回值。代码执行是**一项可选能力**,不属于 agent loop(智能体循环)主干,因此其词汇定义在此而非 [core.md](core.zh.md) 中。各后端的执行基底与源语言不同,这两项均为服务上的只读描述符;worker-thread Service Provider 与工具注册表 Consumer 的约定见 [PTC mode 基础设计](../../.agents/notes/implemented/feature/2026-06-15-ptc.zh.md) 和[类型化返回约定](../../.agents/notes/implemented/feature/2026-07-20-ptc-typed-tool-returns.zh.md)。
|
|
6
|
+
|
|
7
|
+
源码:[`packages/code-runtime/code-runtime/src/types.ts`](../../packages/code-runtime/code-runtime/src/types.ts)
|
|
8
|
+
|
|
9
|
+
## 运行:请求进,结果出
|
|
10
|
+
|
|
11
|
+
`CodeRunRequest` 携带**运行时要处理的一切内容**。按照「包边界处显式优于隐式」的规则,默认值(时间预算、输出上限)来自实现的已校验配置,绝不是 `run()` 内部隐藏的 `??`:
|
|
12
|
+
|
|
13
|
+
```ts type-equiv
|
|
14
|
+
/**
|
|
15
|
+
* One run: the program source plus everything the runtime acts on. Per the
|
|
16
|
+
* explicit-over-implicit convention, defaulting (time budgets, output caps)
|
|
17
|
+
* is the implementation's validated config — a request carries no optional
|
|
18
|
+
* tuning knobs for a hidden `??` to fill in.
|
|
19
|
+
*/
|
|
20
|
+
interface CodeRunRequest {
|
|
21
|
+
/**
|
|
22
|
+
* The program source, in the runtime's {@link ../index.ts | language}. It
|
|
23
|
+
* runs as the body of an async function: top-level `await` and `return`
|
|
24
|
+
* are available, and the completion value becomes
|
|
25
|
+
* {@link CodeRunResult.value}.
|
|
26
|
+
*/
|
|
27
|
+
program: string
|
|
28
|
+
/** Host functions exposed to the program, one global object per namespace. */
|
|
29
|
+
bindings: CodeBindingNamespace[]
|
|
30
|
+
/**
|
|
31
|
+
* Abort the run: the runtime stops the program (hard, even mid-loop) and
|
|
32
|
+
* resolves with a {@link CodeRunFailure} of kind `'abort'`. In-flight
|
|
33
|
+
* binding calls are the CALLER's to settle — the runtime only stops asking.
|
|
34
|
+
*/
|
|
35
|
+
signal?: AbortSignal
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
结果将错误报告为一个**字段**,而不是让 `run()` 返回被拒绝的 Promise。报告程序失败是调用方的职责,不走异常路径(与 `ShellExecutor.run` 失败时仍正常完成的约定一致):
|
|
40
|
+
|
|
41
|
+
```ts type-equiv
|
|
42
|
+
/**
|
|
43
|
+
* The outcome of one run. An error is a FIELD on a resolved result, never a
|
|
44
|
+
* rejection of `run()` — reporting a failed program is the caller's job, not
|
|
45
|
+
* an exception path.
|
|
46
|
+
*/
|
|
47
|
+
interface CodeRunResult {
|
|
48
|
+
/**
|
|
49
|
+
* The program's completion value (its top-level `return`), when it ran to
|
|
50
|
+
* completion and the value crossed the runtime's lossless-JSON boundary.
|
|
51
|
+
* Invalid or over-limit completions fail the run instead of substituting a
|
|
52
|
+
* rendered string; a failed or value-less run leaves this absent.
|
|
53
|
+
*/
|
|
54
|
+
value?: CodeJsonValue
|
|
55
|
+
/**
|
|
56
|
+
* Captured text. Each source channel preserves emission order; interleaving
|
|
57
|
+
* across independent channels is backend-dependent. Bounded only as part of
|
|
58
|
+
* the outer result.
|
|
59
|
+
*/
|
|
60
|
+
logs: string[]
|
|
61
|
+
/** Present iff the run failed; see {@link CodeRunFailure} for the taxonomy. */
|
|
62
|
+
error?: CodeRunFailure
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 绑定:宿主函数作为程序全局变量
|
|
67
|
+
|
|
68
|
+
每个 `CodeBindingNamespace` 在程序内成为一个由异步可调用函数组成的全局对象(PTC mode Consumer 传入一个:`tools`)。参数与返回值必须是无损 JSON,且跨越边界时不受 seam 层字节上限约束;运行时可以通过结构化克隆桥接它们。命名空间可以声明程序可见的错误类,而无需让运行时知道 Consumer 的名称:运行时会注入真实构造函数,并将被拒绝的调用转为该类的实例。运行时也将绑定名视为不可信输入(`__proto__` 是普通自有属性,绝不会发生原型碰撞):
|
|
69
|
+
|
|
70
|
+
```ts type-equiv
|
|
71
|
+
/**
|
|
72
|
+
* Program-visible typed rejection for one binding namespace. The runtime
|
|
73
|
+
* injects a real error constructor under `name`; rejected member calls become
|
|
74
|
+
* its instances and expose the exact member name through
|
|
75
|
+
* `memberNameProperty`. Both strings are runtime data rather than knowledge
|
|
76
|
+
* of a particular consumer such as PTC mode.
|
|
77
|
+
*/
|
|
78
|
+
interface CodeBindingErrorClass {
|
|
79
|
+
/** Constructor global and resulting `Error.name`; same portable identifier rule as {@link CodeBindingNamespace.global}. */
|
|
80
|
+
name: string
|
|
81
|
+
/**
|
|
82
|
+
* Non-empty own property for the member name. The portable exclusion set is
|
|
83
|
+
* `RESERVED_ERROR_MEMBERS` plus dunder-form names (`__x__`, non-empty
|
|
84
|
+
* middle), enforced identically by every backend; any other name —
|
|
85
|
+
* identifiers or not — is accepted everywhere.
|
|
86
|
+
*/
|
|
87
|
+
memberNameProperty: string
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```ts type-equiv
|
|
92
|
+
/**
|
|
93
|
+
* A named group of {@link CodeBindingFunction}s the runtime exposes to the
|
|
94
|
+
* program as one global object (e.g. `tools`). Function names are arbitrary
|
|
95
|
+
* strings — a runtime must treat names like `__proto__` or `constructor` as
|
|
96
|
+
* ordinary own properties (null-prototype construction), never as prototype
|
|
97
|
+
* collisions.
|
|
98
|
+
*/
|
|
99
|
+
interface CodeBindingNamespace {
|
|
100
|
+
/**
|
|
101
|
+
* The global identifier the program sees. Must match the LANGUAGE-PORTABLE
|
|
102
|
+
* identifier subset `[A-Za-z_][A-Za-z0-9_]*` and no language's reserved
|
|
103
|
+
* words, so the same namespace list works against every backend regardless
|
|
104
|
+
* of `language` — a JS-only spelling like `$tools` is rejected by design,
|
|
105
|
+
* not just by the Python backend. Names that satisfy the identifier rule but
|
|
106
|
+
* name a backend-owned slot (`RESERVED_BINDING_GLOBALS`, e.g. `console`,
|
|
107
|
+
* `__dsh_main__`) are also refused everywhere; see its declaration for the
|
|
108
|
+
* exact set and why each entry is reserved.
|
|
109
|
+
*/
|
|
110
|
+
global: string
|
|
111
|
+
/** The callable members, keyed by the exact name the program calls. */
|
|
112
|
+
functions: Record<string, CodeBindingFunction>
|
|
113
|
+
/** Optional program-visible typed rejection contract for this namespace. */
|
|
114
|
+
errorClass?: CodeBindingErrorClass
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
```ts type-equiv
|
|
119
|
+
/** A lossless JSON value transferable through the dependency-light Service Definition. */
|
|
120
|
+
type CodeJsonValue = null | boolean | number | string | CodeJsonValue[] | { [key: string]: CodeJsonValue }
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```ts type-equiv
|
|
124
|
+
/**
|
|
125
|
+
* One host-side function exposed to the program as an async callable. The
|
|
126
|
+
* runtime bridges calls to it (possibly across a serialization boundary), so
|
|
127
|
+
* `args` and the resolution value MUST be lossless JSON. A runtime rejects a
|
|
128
|
+
* lossy or non-cloneable value with a descriptive error rather than corrupting
|
|
129
|
+
* the run. No seam-level byte cap applies to a binding resolution. A rejection
|
|
130
|
+
* of this function surfaces inside the program as a rejection of the
|
|
131
|
+
* corresponding call.
|
|
132
|
+
*/
|
|
133
|
+
type CodeBindingFunction = (args: unknown) => Promise<CodeJsonValue>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## 捕获的输出与失败分类体系
|
|
137
|
+
|
|
138
|
+
日志是纯字符串。每个来源通道保留自身的发出顺序;由于通道元数据不属于 seam,相互独立的通道如何交错由后端决定。运行时捕获程序的 console 与流输出,Consumer 只渲染文本。实现会对序列化后的外层日志数组,以及完成值或失败消息的组合载荷设置上限;固定的结果封装语法与 Consumer 展示空白不计入这份可变载荷计量。超限会显式失败,而不会在值中插入替代内容。
|
|
139
|
+
|
|
140
|
+
失败类型是**正交的结果,独立报告**(见 [defensive-patterns](../defensive-patterns.zh.md)):预算耗尽不是异常,中止不是超时,基底崩溃(如 OOM)也不是二者中的任何一个:
|
|
141
|
+
|
|
142
|
+
```ts type-equiv
|
|
143
|
+
/**
|
|
144
|
+
* Why a run failed. The kinds are orthogonal outcomes reported independently
|
|
145
|
+
* (per docs/defensive-patterns.md): a budget expiry is not an exception, an
|
|
146
|
+
* abort is not a timeout, and a substrate death is neither.
|
|
147
|
+
*
|
|
148
|
+
* - `'exception'` — the program threw or failed to parse/transform.
|
|
149
|
+
* - `'timeout'` — an implementation-owned budget expired; the message says which.
|
|
150
|
+
* - `'abort'` — {@link CodeRunRequest.signal} fired.
|
|
151
|
+
* - `'worker-exit'` — the execution substrate died without settling (e.g. OOM).
|
|
152
|
+
* - `'invalid-output'` — the completion value was not lossless JSON.
|
|
153
|
+
* - `'output-limit'` — the serialized outer logs/value/diagnostic exceeded the configured cap.
|
|
154
|
+
*/
|
|
155
|
+
interface CodeRunFailure {
|
|
156
|
+
/** The failure class (see the interface doc for each kind's meaning). */
|
|
157
|
+
kind: 'exception' | 'timeout' | 'abort' | 'worker-exit' | 'invalid-output' | 'output-limit'
|
|
158
|
+
/** Human-readable detail, suitable for feeding back to a model to self-correct. */
|
|
159
|
+
message: string
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## 服务
|
|
164
|
+
|
|
165
|
+
`CodeRuntime`(`ctx.codeRuntime`,抽象服务,定义于 [`packages/code-runtime/code-runtime/src/index.ts`](../../packages/code-runtime/code-runtime/src/index.ts))由 `run(request)` 加两个只读描述符组成:`language`(程序必须使用的语言,已知值为 `'typescript'` 与 `'python'`,即 `dsh-tools` 能呈现的那些,TypeScript 后端已发布、Python 后端为实验性且私有(未发布);生成语言相关展示的 Consumer 据此切换,遇到无法展示的语言时应显式报错)和 `isolation`(执行基底,`'worker-thread'`、`'process'`、`'container'`;仅为诊断标签,**不构成安全承诺**)。实现必须保证各次运行彼此隔离(无跨运行状态),并在 dispose(资源释放)时等待系统完全停稳:teardown 要等到所有进行中的运行均已终止并结算后才完成。
|
|
166
|
+
|
|
167
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
168
|
+
|
|
169
|
+
<a id="cordis-surface"></a>
|
|
170
|
+
|
|
171
|
+
## Cordis API
|
|
172
|
+
|
|
173
|
+
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
|
|
174
|
+
|
|
175
|
+
<a id="ctxcoderuntime--coderuntime-abstract-seam"></a>
|
|
176
|
+
|
|
177
|
+
### `ctx.codeRuntime` — `CodeRuntime` (abstract seam)
|
|
178
|
+
|
|
179
|
+
Registers one `ctx.codeRuntime` implementation. Program, budget, abort, and substrate failures resolve in CodeRunResult; only Service Definition contract misuse rejects. Implementations bridge structured-cloneable bindings, materialize each declared namespace rejection class, treat programs as hostile peers, isolate runs from one another, and terminate and await in-flight runs during disposal.
|
|
180
|
+
|
|
181
|
+
```ts cordis-catalog
|
|
182
|
+
/**
|
|
183
|
+
* Execute one program against the request's bindings and capture what it
|
|
184
|
+
* emitted. See the class doc for the resolution contract (error is a result
|
|
185
|
+
* field; rejection means Service Definition contract misuse only).
|
|
186
|
+
* @param request - the program, its bindings, and the abort signal; the
|
|
187
|
+
* request carries everything the runtime acts on, with no hidden defaults.
|
|
188
|
+
* @returns the run's outcome: completion value (when transferable), the
|
|
189
|
+
* ordered log capture, and the failure (if any).
|
|
190
|
+
*/
|
|
191
|
+
abstract run(request: CodeRunRequest): Promise<CodeRunResult>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Source: [`packages/code-runtime/code-runtime/src/index.ts`](../../packages/code-runtime/code-runtime/src/index.ts)
|
|
195
|
+
<!-- END GENERATED cordis-surface -->
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Human Commands
|
|
2
|
+
|
|
3
|
+
English | [中文](commands.zh.md)
|
|
4
|
+
|
|
5
|
+
The human-command registry service from [`dsh-commands`](../../packages/interaction/commands). Interactive adapters use it to discover and directly execute plugin-owned commands for an exact agent without creating a model message. The [command Agent Note](../../.agents/notes/implemented/feature/2026-07-19-plugin-command-registration.md) owns dispatch and lifecycle rationale; the [package README](../../packages/interaction/commands/README.md) owns composition and limitations.
|
|
6
|
+
|
|
7
|
+
Source: [`packages/interaction/commands/src/index.ts`](../../packages/interaction/commands/src/index.ts)
|
|
8
|
+
|
|
9
|
+
## Input metadata
|
|
10
|
+
|
|
11
|
+
The service exposes one optional unstructured-input descriptor: a hint plus an attachment-acceptance flag. Command availability follows plugin composition: every adapter consuming the registry sees every effective definition.
|
|
12
|
+
|
|
13
|
+
```ts type-equiv
|
|
14
|
+
/** Immutable metadata for a command's optional unstructured input. */
|
|
15
|
+
interface CommandInputDescriptor {
|
|
16
|
+
/** Placeholder shown before the user supplies free-form input. */
|
|
17
|
+
readonly hint: string
|
|
18
|
+
/**
|
|
19
|
+
* Whether composer attachments may accompany an invocation. Absent or
|
|
20
|
+
* false = the executor rejects an invocation carrying attachments and capable
|
|
21
|
+
* composers refuse the submission before dispatch. A declaring command's
|
|
22
|
+
* handler receives the admitted durable blocks and owns every further
|
|
23
|
+
* grammar decision, including rejecting sub-commands that cannot use them.
|
|
24
|
+
*/
|
|
25
|
+
readonly attachments?: boolean
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Definition
|
|
30
|
+
|
|
31
|
+
`CommandDefinition` is the plugin-authored registration. The registry validates and freezes a detached effective definition.
|
|
32
|
+
|
|
33
|
+
```ts type-equiv
|
|
34
|
+
/** Plugin-owned command registration. */
|
|
35
|
+
interface CommandDefinition {
|
|
36
|
+
/** Lowercase command name without the leading slash. */
|
|
37
|
+
readonly name: string
|
|
38
|
+
/** Human-readable summary used in discovery UI. */
|
|
39
|
+
readonly description: string
|
|
40
|
+
/** Optional free-form input hint advertised to capable clients. */
|
|
41
|
+
readonly input?: CommandInputDescriptor
|
|
42
|
+
/**
|
|
43
|
+
* Whether `command/run` records `rawInput`. Defaults to true. A command
|
|
44
|
+
* whose domain event owns the payload sets this false to avoid duplicating
|
|
45
|
+
* that payload in the session log.
|
|
46
|
+
*/
|
|
47
|
+
readonly recordInput?: boolean
|
|
48
|
+
/** Execute against the receiving agent without sending the command to the model. */
|
|
49
|
+
readonly handler: (invocation: CommandInvocation) => CommandResult | Promise<CommandResult>
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Invocation and result
|
|
54
|
+
|
|
55
|
+
The adapter owns cancellation and passes the exact target agent. `rawInput` begins immediately after the parsed name and retains the adapter-delivered separator and suffix. Results are direct UI outcomes, not tool results or session events.
|
|
56
|
+
|
|
57
|
+
```ts type-equiv
|
|
58
|
+
/** Invocation passed to one registered command handler. */
|
|
59
|
+
interface CommandInvocation {
|
|
60
|
+
/** Pairing id already written to this invocation's `command/run` event. */
|
|
61
|
+
readonly commandId: CommandId
|
|
62
|
+
/** Exact agent whose UI received the command. */
|
|
63
|
+
readonly agent: Agent
|
|
64
|
+
/** Exact text following the registered command name, including separator whitespace. */
|
|
65
|
+
readonly rawInput: string
|
|
66
|
+
/**
|
|
67
|
+
* Durably admitted image and file blocks accompanying this invocation, in submission
|
|
68
|
+
* order; empty unless the definition declares `input.attachments`. The handler
|
|
69
|
+
* owns their model-visible use — the registry never schedules them itself —
|
|
70
|
+
* and a handler whose grammar cannot use them in this invocation returns an
|
|
71
|
+
* error so the dispatching composer retains the originals.
|
|
72
|
+
*/
|
|
73
|
+
readonly attachments: readonly (ImageBlock | FileBlock)[]
|
|
74
|
+
/** Cancellation signal owned by the dispatching UI request. */
|
|
75
|
+
readonly signal: AbortSignal
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```ts type-equiv
|
|
80
|
+
/** Expected command outcome rendered directly by the dispatching UI. */
|
|
81
|
+
type CommandResult =
|
|
82
|
+
| {
|
|
83
|
+
readonly kind: 'success'
|
|
84
|
+
readonly text?: string
|
|
85
|
+
/** Earlier authoritative domain event that owns a richer presentation. */
|
|
86
|
+
readonly sourceEventSeq?: SessionSeq
|
|
87
|
+
}
|
|
88
|
+
| { readonly kind: 'error'; readonly text: string }
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`sourceEventSeq` is optional and success-only. When present, it names an earlier non-command event in the receiving session log; `command/done` persists the same reference so a client can combine the command lifecycle with that domain projection without parsing `text` or relying on adjacent rows.
|
|
92
|
+
|
|
93
|
+
## Discovery and parsing views
|
|
94
|
+
|
|
95
|
+
Adapters receive handler-free immutable descriptors after scope resolution. `parseCommand()` returns `ParsedCommand` before registry resolution; syntax-valid input can still name an unavailable command.
|
|
96
|
+
|
|
97
|
+
```ts type-equiv
|
|
98
|
+
/** Handler-free immutable command view returned to UI adapters. */
|
|
99
|
+
interface CommandDescriptor {
|
|
100
|
+
/** Lowercase command name without the leading slash. */
|
|
101
|
+
readonly name: string
|
|
102
|
+
/** Human-readable summary used in discovery UI. */
|
|
103
|
+
readonly description: string
|
|
104
|
+
/** Optional free-form input hint advertised to capable clients. */
|
|
105
|
+
readonly input?: CommandInputDescriptor
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```ts type-equiv
|
|
110
|
+
/** Syntactically valid slash command before registry resolution. */
|
|
111
|
+
interface ParsedCommand {
|
|
112
|
+
/** Lowercase command name without the leading slash. */
|
|
113
|
+
readonly name: string
|
|
114
|
+
/** Exact text following the command name. */
|
|
115
|
+
readonly rawInput: string
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
120
|
+
|
|
121
|
+
<a id="cordis-surface"></a>
|
|
122
|
+
|
|
123
|
+
## Cordis API
|
|
124
|
+
|
|
125
|
+
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
|
|
126
|
+
|
|
127
|
+
<a id="ctxcommands--commandruntime"></a>
|
|
128
|
+
|
|
129
|
+
### `ctx.commands` — `CommandRuntime`
|
|
130
|
+
|
|
131
|
+
Human-command registry. Plain-context definitions are global; definitions registered through a command-injected child of an agent context shadow globals for that agent.
|
|
132
|
+
|
|
133
|
+
```ts cordis-catalog
|
|
134
|
+
/**
|
|
135
|
+
* Register a global or calling-agent-scoped command.
|
|
136
|
+
* @param definition - discovery metadata and direct UI handler.
|
|
137
|
+
* @returns the exact effect disposer that unregisters this definition.
|
|
138
|
+
*/
|
|
139
|
+
register(definition: CommandDefinition): () => void
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Register the sole authority that resolves staged file receipts for command submissions.
|
|
143
|
+
* @param resolver - Session-aware receipt resolver.
|
|
144
|
+
* @returns disposer that removes this exact resolver.
|
|
145
|
+
*/
|
|
146
|
+
registerFileReceiptResolver(resolver: CommandFileReceiptResolver): () => void
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* List the effective immutable command descriptors for one agent.
|
|
150
|
+
* @param agent - exact receiving agent and scoped-layer key.
|
|
151
|
+
* @returns name-sorted descriptors after scoped shadowing.
|
|
152
|
+
*/
|
|
153
|
+
@Remote list(agent: Agent): readonly CommandDescriptor[]
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Resolve one effective command definition.
|
|
157
|
+
* @param agent - exact receiving agent and scoped-layer key.
|
|
158
|
+
* @param name - command name without a slash.
|
|
159
|
+
* @returns the scoped shadow or global definition.
|
|
160
|
+
*/
|
|
161
|
+
find(agent: Agent, name: string): CommandDefinition | undefined
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Parse and execute a known command without sending it to the model.
|
|
165
|
+
*
|
|
166
|
+
* A resolved command's lifecycle is logged: `command/run` is appended
|
|
167
|
+
* before the handler is invoked and `command/done` after settlement (a
|
|
168
|
+
* thrown or aborted handler settles as `kind: 'error'`). Both are direct
|
|
169
|
+
* log-only appends — no turn wraps them, and persistence drains them at
|
|
170
|
+
* ordinary checkpoints. Admission misses (syntax or unknown name) log
|
|
171
|
+
* nothing — they never entered a handler. A `command/run` append failure
|
|
172
|
+
* fails the execution loud; a `command/done` append failure on the
|
|
173
|
+
* handler-failure path is contained so the handler's own error stays the
|
|
174
|
+
* reported failure.
|
|
175
|
+
*
|
|
176
|
+
* Attachment admission is enforced here, not in the composer: attachments sent to a
|
|
177
|
+
* command that does not declare `input.attachments`, an absent attachment store,
|
|
178
|
+
* and an exceeded image limit each settle as an error result before
|
|
179
|
+
* the handler runs. Validation rejection starts no attachment writes;
|
|
180
|
+
* a storage failure can leave only unreachable content-addressed objects
|
|
181
|
+
* for deferred collection.
|
|
182
|
+
*
|
|
183
|
+
* @param agent - exact receiving agent.
|
|
184
|
+
* @param line - complete slash-command line.
|
|
185
|
+
* @param submittedAttachments - encoded images and staged file receipts accompanying the line,
|
|
186
|
+
* in submission order; empty for a plain invocation.
|
|
187
|
+
* @param signal - cancellation signal owned by the UI request.
|
|
188
|
+
* @returns the settled execution (result + lifecycle pairing id), or
|
|
189
|
+
* `undefined` when syntax or name does not resolve.
|
|
190
|
+
*/
|
|
191
|
+
@Remote async execute( agent: Agent, line: string, submittedAttachments: readonly CommandSubmitAttachment[], signal: AbortSignal, ): Promise<CommandExecution | undefined>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Types: [Agent](core.md)
|
|
195
|
+
|
|
196
|
+
Source: [`packages/interaction/commands/src/index.ts`](../../packages/interaction/commands/src/index.ts)
|
|
197
|
+
|
|
198
|
+
<a id="commands-events"></a>
|
|
199
|
+
|
|
200
|
+
### `commands/*` events
|
|
201
|
+
|
|
202
|
+
<a id="commandschange--emit"></a>
|
|
203
|
+
|
|
204
|
+
#### `commands/change` — emit
|
|
205
|
+
|
|
206
|
+
A command was registered or unregistered. This is an unfiltered registry notification because a global or scoped change may affect any UI view. Observer failures are contained and cannot veto the registry mutation.
|
|
207
|
+
|
|
208
|
+
```ts cordis-catalog
|
|
209
|
+
/**
|
|
210
|
+
* A command was registered or unregistered. This is an unfiltered registry
|
|
211
|
+
* notification because a global or scoped change may affect any UI view.
|
|
212
|
+
* Observer failures are contained and cannot veto the registry mutation.
|
|
213
|
+
* @mode emit
|
|
214
|
+
*/
|
|
215
|
+
'commands/change'(): void
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Source: [`packages/interaction/commands/src/types.ts`](../../packages/interaction/commands/src/types.ts)
|
|
219
|
+
<!-- END GENERATED cordis-surface -->
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# 用户命令
|
|
2
|
+
|
|
3
|
+
[English](commands.md) | 中文
|
|
4
|
+
|
|
5
|
+
[`dsh-commands`](../../packages/interaction/commands) 提供的用户命令注册表服务。交互式适配器用它发现插件拥有的命令,并针对确切的 agent(智能体)直接执行这些命令,而不创建模型消息。[命令 Agent Note](../../.agents/notes/implemented/feature/2026-07-19-plugin-command-registration.zh.md) 负责分发与生命周期的决策依据;[包 README](../../packages/interaction/commands/README.zh.md) 负责组合方式与限制。
|
|
6
|
+
|
|
7
|
+
来源:[`packages/interaction/commands/src/index.ts`](../../packages/interaction/commands/src/index.ts)
|
|
8
|
+
|
|
9
|
+
## 输入元数据
|
|
10
|
+
|
|
11
|
+
该服务公开一个可选的非结构化输入描述符:提示文本加附件接受标志。命令的可用性由插件组合决定:每个消费注册表的适配器都会看到全部生效定义。
|
|
12
|
+
|
|
13
|
+
```ts type-equiv
|
|
14
|
+
/** Immutable metadata for a command's optional unstructured input. */
|
|
15
|
+
interface CommandInputDescriptor {
|
|
16
|
+
/** Placeholder shown before the user supplies free-form input. */
|
|
17
|
+
readonly hint: string
|
|
18
|
+
/**
|
|
19
|
+
* Whether composer attachments may accompany an invocation. Absent or
|
|
20
|
+
* false = the executor rejects an invocation carrying attachments and capable
|
|
21
|
+
* composers refuse the submission before dispatch. A declaring command's
|
|
22
|
+
* handler receives the admitted durable blocks and owns every further
|
|
23
|
+
* grammar decision, including rejecting sub-commands that cannot use them.
|
|
24
|
+
*/
|
|
25
|
+
readonly attachments?: boolean
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 定义
|
|
30
|
+
|
|
31
|
+
`CommandDefinition` 是由插件编写的注册定义。注册表会验证并冻结一份与原始注册对象脱离的生效定义。
|
|
32
|
+
|
|
33
|
+
```ts type-equiv
|
|
34
|
+
/** Plugin-owned command registration. */
|
|
35
|
+
interface CommandDefinition {
|
|
36
|
+
/** Lowercase command name without the leading slash. */
|
|
37
|
+
readonly name: string
|
|
38
|
+
/** Human-readable summary used in discovery UI. */
|
|
39
|
+
readonly description: string
|
|
40
|
+
/** Optional free-form input hint advertised to capable clients. */
|
|
41
|
+
readonly input?: CommandInputDescriptor
|
|
42
|
+
/**
|
|
43
|
+
* Whether `command/run` records `rawInput`. Defaults to true. A command
|
|
44
|
+
* whose domain event owns the payload sets this false to avoid duplicating
|
|
45
|
+
* that payload in the session log.
|
|
46
|
+
*/
|
|
47
|
+
readonly recordInput?: boolean
|
|
48
|
+
/** Execute against the receiving agent without sending the command to the model. */
|
|
49
|
+
readonly handler: (invocation: CommandInvocation) => CommandResult | Promise<CommandResult>
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 调用与结果
|
|
54
|
+
|
|
55
|
+
取消由适配器负责,适配器会传入确切的目标 agent。`rawInput` 紧接在解析后的名称之后,并保留适配器传入的分隔符与后缀。结果会直接呈现给 UI,而不是工具结果或会话事件。
|
|
56
|
+
|
|
57
|
+
```ts type-equiv
|
|
58
|
+
/** Invocation passed to one registered command handler. */
|
|
59
|
+
interface CommandInvocation {
|
|
60
|
+
/** Pairing id already written to this invocation's `command/run` event. */
|
|
61
|
+
readonly commandId: CommandId
|
|
62
|
+
/** Exact agent whose UI received the command. */
|
|
63
|
+
readonly agent: Agent
|
|
64
|
+
/** Exact text following the registered command name, including separator whitespace. */
|
|
65
|
+
readonly rawInput: string
|
|
66
|
+
/**
|
|
67
|
+
* Durably admitted image and file blocks accompanying this invocation, in submission
|
|
68
|
+
* order; empty unless the definition declares `input.attachments`. The handler
|
|
69
|
+
* owns their model-visible use — the registry never schedules them itself —
|
|
70
|
+
* and a handler whose grammar cannot use them in this invocation returns an
|
|
71
|
+
* error so the dispatching composer retains the originals.
|
|
72
|
+
*/
|
|
73
|
+
readonly attachments: readonly (ImageBlock | FileBlock)[]
|
|
74
|
+
/** Cancellation signal owned by the dispatching UI request. */
|
|
75
|
+
readonly signal: AbortSignal
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
```ts type-equiv
|
|
80
|
+
/** Expected command outcome rendered directly by the dispatching UI. */
|
|
81
|
+
type CommandResult =
|
|
82
|
+
| {
|
|
83
|
+
readonly kind: 'success'
|
|
84
|
+
readonly text?: string
|
|
85
|
+
/** Earlier authoritative domain event that owns a richer presentation. */
|
|
86
|
+
readonly sourceEventSeq?: SessionSeq
|
|
87
|
+
}
|
|
88
|
+
| { readonly kind: 'error'; readonly text: string }
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`sourceEventSeq` 是可选字段,且只用于成功结果。存在时,它指向接收会话日志中更早的一条非命令事件;`command/done` 会持久化同一引用,让客户端能够将命令生命周期与该领域投影合并,而无须解析 `text` 或依赖相邻行。
|
|
92
|
+
|
|
93
|
+
## 发现与解析视图
|
|
94
|
+
|
|
95
|
+
作用域解析后,适配器会获得不含处理器的不可变描述符。`parseCommand()` 在注册表解析前返回 `ParsedCommand`;语法有效的输入仍可能指向不可用的命令。
|
|
96
|
+
|
|
97
|
+
```ts type-equiv
|
|
98
|
+
/** Handler-free immutable command view returned to UI adapters. */
|
|
99
|
+
interface CommandDescriptor {
|
|
100
|
+
/** Lowercase command name without the leading slash. */
|
|
101
|
+
readonly name: string
|
|
102
|
+
/** Human-readable summary used in discovery UI. */
|
|
103
|
+
readonly description: string
|
|
104
|
+
/** Optional free-form input hint advertised to capable clients. */
|
|
105
|
+
readonly input?: CommandInputDescriptor
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```ts type-equiv
|
|
110
|
+
/** Syntactically valid slash command before registry resolution. */
|
|
111
|
+
interface ParsedCommand {
|
|
112
|
+
/** Lowercase command name without the leading slash. */
|
|
113
|
+
readonly name: string
|
|
114
|
+
/** Exact text following the command name. */
|
|
115
|
+
readonly rawInput: string
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
120
|
+
|
|
121
|
+
<a id="cordis-surface"></a>
|
|
122
|
+
|
|
123
|
+
## Cordis API
|
|
124
|
+
|
|
125
|
+
Generated from source by `scripts/gen-cordis-catalog.ts` (verified fresh by `pnpm run verify-cordis-catalog` in doc-sync; regenerate with `pnpm run gen-cordis-catalog`) — the language sides differ only in locale-specific paired document paths. Signature blocks use a `ts cordis-catalog` fence and keep the original source JSDoc; dispatch modes are defined in the [primer](../cordis-primer.zh.md#dispatch-modes), and the framework-inherited `ctx` API lives in [cordis-api/inherited.md](../cordis-api/inherited.md).
|
|
126
|
+
|
|
127
|
+
<a id="ctxcommands--commandruntime"></a>
|
|
128
|
+
|
|
129
|
+
### `ctx.commands` — `CommandRuntime`
|
|
130
|
+
|
|
131
|
+
Human-command registry. Plain-context definitions are global; definitions registered through a command-injected child of an agent context shadow globals for that agent.
|
|
132
|
+
|
|
133
|
+
```ts cordis-catalog
|
|
134
|
+
/**
|
|
135
|
+
* Register a global or calling-agent-scoped command.
|
|
136
|
+
* @param definition - discovery metadata and direct UI handler.
|
|
137
|
+
* @returns the exact effect disposer that unregisters this definition.
|
|
138
|
+
*/
|
|
139
|
+
register(definition: CommandDefinition): () => void
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Register the sole authority that resolves staged file receipts for command submissions.
|
|
143
|
+
* @param resolver - Session-aware receipt resolver.
|
|
144
|
+
* @returns disposer that removes this exact resolver.
|
|
145
|
+
*/
|
|
146
|
+
registerFileReceiptResolver(resolver: CommandFileReceiptResolver): () => void
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* List the effective immutable command descriptors for one agent.
|
|
150
|
+
* @param agent - exact receiving agent and scoped-layer key.
|
|
151
|
+
* @returns name-sorted descriptors after scoped shadowing.
|
|
152
|
+
*/
|
|
153
|
+
@Remote list(agent: Agent): readonly CommandDescriptor[]
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Resolve one effective command definition.
|
|
157
|
+
* @param agent - exact receiving agent and scoped-layer key.
|
|
158
|
+
* @param name - command name without a slash.
|
|
159
|
+
* @returns the scoped shadow or global definition.
|
|
160
|
+
*/
|
|
161
|
+
find(agent: Agent, name: string): CommandDefinition | undefined
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Parse and execute a known command without sending it to the model.
|
|
165
|
+
*
|
|
166
|
+
* A resolved command's lifecycle is logged: `command/run` is appended
|
|
167
|
+
* before the handler is invoked and `command/done` after settlement (a
|
|
168
|
+
* thrown or aborted handler settles as `kind: 'error'`). Both are direct
|
|
169
|
+
* log-only appends — no turn wraps them, and persistence drains them at
|
|
170
|
+
* ordinary checkpoints. Admission misses (syntax or unknown name) log
|
|
171
|
+
* nothing — they never entered a handler. A `command/run` append failure
|
|
172
|
+
* fails the execution loud; a `command/done` append failure on the
|
|
173
|
+
* handler-failure path is contained so the handler's own error stays the
|
|
174
|
+
* reported failure.
|
|
175
|
+
*
|
|
176
|
+
* Attachment admission is enforced here, not in the composer: attachments sent to a
|
|
177
|
+
* command that does not declare `input.attachments`, an absent attachment store,
|
|
178
|
+
* and an exceeded image limit each settle as an error result before
|
|
179
|
+
* the handler runs. Validation rejection starts no attachment writes;
|
|
180
|
+
* a storage failure can leave only unreachable content-addressed objects
|
|
181
|
+
* for deferred collection.
|
|
182
|
+
*
|
|
183
|
+
* @param agent - exact receiving agent.
|
|
184
|
+
* @param line - complete slash-command line.
|
|
185
|
+
* @param submittedAttachments - encoded images and staged file receipts accompanying the line,
|
|
186
|
+
* in submission order; empty for a plain invocation.
|
|
187
|
+
* @param signal - cancellation signal owned by the UI request.
|
|
188
|
+
* @returns the settled execution (result + lifecycle pairing id), or
|
|
189
|
+
* `undefined` when syntax or name does not resolve.
|
|
190
|
+
*/
|
|
191
|
+
@Remote async execute( agent: Agent, line: string, submittedAttachments: readonly CommandSubmitAttachment[], signal: AbortSignal, ): Promise<CommandExecution | undefined>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Types: [Agent](core.zh.md)
|
|
195
|
+
|
|
196
|
+
Source: [`packages/interaction/commands/src/index.ts`](../../packages/interaction/commands/src/index.ts)
|
|
197
|
+
|
|
198
|
+
<a id="commands-events"></a>
|
|
199
|
+
|
|
200
|
+
### `commands/*` events
|
|
201
|
+
|
|
202
|
+
<a id="commandschange--emit"></a>
|
|
203
|
+
|
|
204
|
+
#### `commands/change` — emit
|
|
205
|
+
|
|
206
|
+
A command was registered or unregistered. This is an unfiltered registry notification because a global or scoped change may affect any UI view. Observer failures are contained and cannot veto the registry mutation.
|
|
207
|
+
|
|
208
|
+
```ts cordis-catalog
|
|
209
|
+
/**
|
|
210
|
+
* A command was registered or unregistered. This is an unfiltered registry
|
|
211
|
+
* notification because a global or scoped change may affect any UI view.
|
|
212
|
+
* Observer failures are contained and cannot veto the registry mutation.
|
|
213
|
+
* @mode emit
|
|
214
|
+
*/
|
|
215
|
+
'commands/change'(): void
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Source: [`packages/interaction/commands/src/types.ts`](../../packages/interaction/commands/src/types.ts)
|
|
219
|
+
<!-- END GENERATED cordis-surface -->
|