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,206 @@
|
|
|
1
|
+
# Web 访问
|
|
2
|
+
|
|
3
|
+
[English](web.md) | 中文
|
|
4
|
+
|
|
5
|
+
Web 访问 seam 是一个[能力 seam](../../.agents/notes/implemented/architecture/2026-06-24-web-capability-seam.zh.md),在同一个 `ctx.web` 服务上横跨**两项操作**(search 与 fetch),并拆分到多个包:Service Definition([dsh-web](../../packages/web/web),`ctx.web` + 提供方注册表)、Service Provider([dsh-web-search-exa](../../packages/web/web-search-exa)、[dsh-web-search-perplexity](../../packages/web/web-search-perplexity)、[dsh-web-search-deepseek](../../packages/web/web-search-deepseek)、[dsh-web-fetch-http](../../packages/web/web-fetch-http))与 Consumer([dsh-tool-web](../../packages/web/tool-web),即 `web_search`/`web_fetch` 工具 schema)。Web 是**一项可选能力**,不属于 agent loop(智能体循环)主干,因此其词汇定义在此而非 [core.md](core.zh.md) 中。更换 search 提供方不会改变模型提交查询的方式,更换 fetch 提供方也不会改变模型请求 URL 的方式。
|
|
6
|
+
|
|
7
|
+
源码:[`packages/web/web/src/types.ts`](../../packages/web/web/src/types.ts)
|
|
8
|
+
|
|
9
|
+
## 为什么一项能力包含两项操作
|
|
10
|
+
|
|
11
|
+
搜索与抓取既不共享请求 schema,也不共享业务逻辑,但它们被有意设计为同一个 `ctx.web` 中间层:一个提供方选择策略的所有者、一套中止与错误词汇,以及一个面向产品的「此 harness 如何访问 Web」配置界面。代价是服务上并行的 `searchX`/`fetchX` 方法对;这种并行是有意为之,而不是遗漏了可抽取的共性。提供方注册的是**能力**(`WebSearchProvider` 或 `WebFetchProvider`),而非工具;面向模型的名称、schema、提示词引导与展示全部集中在唯一的消费方 `dsh-tool-web` 中。
|
|
12
|
+
|
|
13
|
+
## 搜索请求与结果
|
|
14
|
+
|
|
15
|
+
每个 seam 请求只携带一个 `query`。消费方 `dsh-tool-web` 接受必填的 `queries` 数组,并把它扇出为多个独立 seam 请求;单元素数组执行一次搜索。`maxResults` 是消费方自有的上限(`dsh-tool-web` 的 `searchMaxResults` 配置,默认 `8`),通过 seam 传递并在返回时强制执行——如果提供方返回超量,seam 截断 `sources[]` 并设置 `truncated`。
|
|
16
|
+
|
|
17
|
+
```ts type-equiv
|
|
18
|
+
/**
|
|
19
|
+
* What one search-capable backend is asked to search. Each request carries one
|
|
20
|
+
* query; a consumer may issue several requests. `maxResults` is a
|
|
21
|
+
* `dsh-tool-web`-layer bound passed through unchanged and enforced on the way
|
|
22
|
+
* back by the seam (see {@link WebSearchResult}).
|
|
23
|
+
*/
|
|
24
|
+
interface WebSearchRequest {
|
|
25
|
+
readonly query: string
|
|
26
|
+
/**
|
|
27
|
+
* Upper bound on returned sources; the seam truncates to it. Omitted = no
|
|
28
|
+
* bound. `dsh-tool-web` always sets it. A provider whose API supports a
|
|
29
|
+
* result-count control (Exa's `numResults`) should apply it at the request
|
|
30
|
+
* layer as a cost/latency optimization; the seam enforces the bound
|
|
31
|
+
* regardless.
|
|
32
|
+
*/
|
|
33
|
+
readonly maxResults?: number
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```ts type-equiv
|
|
38
|
+
/**
|
|
39
|
+
* Normalized search outcome. `content` is optional provider-generated answer
|
|
40
|
+
* text or summary (Exa and DeepSeek return none; Perplexity returns a
|
|
41
|
+
* generated answer).
|
|
42
|
+
* `sources[]` is the portable citation shape. `truncated` is set by the seam
|
|
43
|
+
* when it cut `sources[]` down to `maxResults`.
|
|
44
|
+
*/
|
|
45
|
+
interface WebSearchResult {
|
|
46
|
+
/** Optional provider-generated answer text, search context, or summary. */
|
|
47
|
+
readonly content?: string
|
|
48
|
+
/** Citeable sources, already truncated to the request's `maxResults`. */
|
|
49
|
+
readonly sources: readonly WebSearchSource[]
|
|
50
|
+
/** True when the seam dropped sources to honor `maxResults`. */
|
|
51
|
+
readonly truncated: boolean
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
```ts type-equiv
|
|
56
|
+
/**
|
|
57
|
+
* One citeable source. A source always has a URL; `title`, `snippet`, and
|
|
58
|
+
* `publishedAt` are optional because not every provider returns them — forcing
|
|
59
|
+
* adapters to invent them would make the seam lie (Perplexity citations may be
|
|
60
|
+
* URL-only). `dsh-tool-web` renders `title ?? hostname(url)` for display.
|
|
61
|
+
*/
|
|
62
|
+
interface WebSearchSource {
|
|
63
|
+
readonly url: string
|
|
64
|
+
readonly title?: string
|
|
65
|
+
readonly snippet?: string
|
|
66
|
+
/** Publication/crawl timestamp as a provider-supplied ISO-8601 string. */
|
|
67
|
+
readonly publishedAt?: string
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 抓取请求与结果
|
|
72
|
+
|
|
73
|
+
```ts type-equiv
|
|
74
|
+
/**
|
|
75
|
+
* What one fetch-capable backend is asked to retrieve. The request deliberately
|
|
76
|
+
* omits timeout, format, prompt, and extraction controls: cancellation is a
|
|
77
|
+
* direct execution argument, while presentation and higher-level LLM concerns
|
|
78
|
+
* belong outside safe retrieval.
|
|
79
|
+
*/
|
|
80
|
+
interface WebFetchRequest {
|
|
81
|
+
readonly url: string
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
HTTP 状态码是被抓取资源状态的一部分,不自动视为失败:即使一次成功的网络抓取收到 `404` 或 `500` 响应,也仍会产出一个 `WebFetchResult`,其中包含状态码和长度受限的已解码正文。`url` 是经过允许的重定向后的最终 URL。`WebError` 仅用于无法安全获取或表示资源的情况。
|
|
86
|
+
|
|
87
|
+
```ts type-equiv
|
|
88
|
+
/**
|
|
89
|
+
* Normalized fetch outcome. A successful network fetch of a non-2xx response is
|
|
90
|
+
* a result, not an error: the status code is part of the fetched resource
|
|
91
|
+
* state. {@link WebError} is reserved for failures to safely retrieve or
|
|
92
|
+
* represent the resource.
|
|
93
|
+
*/
|
|
94
|
+
interface WebFetchResult {
|
|
95
|
+
/** The final URL after allowed redirects (the request URL is in the request). */
|
|
96
|
+
readonly url: string
|
|
97
|
+
/** HTTP status code of the fetched response. */
|
|
98
|
+
readonly statusCode: number
|
|
99
|
+
/** Decoded body, classified by content kind. */
|
|
100
|
+
readonly body: WebFetchBody
|
|
101
|
+
/** True when the provider capped the decoded body. */
|
|
102
|
+
readonly truncated: boolean
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```ts type-equiv
|
|
107
|
+
/**
|
|
108
|
+
* The decoded body of a fetched resource. A CLOSED discriminated union owned by
|
|
109
|
+
* `dsh-web`: the provider decodes the kind and `dsh-tool-web` renders it, so a
|
|
110
|
+
* new kind is a coordinated change across known packages, not a plugin
|
|
111
|
+
* extension. Consumers `switch` on `kind` ending in `default: assertNever(...)`
|
|
112
|
+
* so adding a kind breaks compilation at every consumer until handled. Each arm
|
|
113
|
+
* stays its own object literal even where fields coincide, so an arm can gain
|
|
114
|
+
* fields the others lack.
|
|
115
|
+
*/
|
|
116
|
+
type WebFetchBody =
|
|
117
|
+
| { readonly kind: 'html'; readonly content: string }
|
|
118
|
+
| { readonly kind: 'text'; readonly content: string }
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## 提供方可用性
|
|
122
|
+
|
|
123
|
+
提供方的 `available(): boolean` 是一个廉价的本地检查(凭证是否存在、配置是否可解析),**禁止发起网络调用**。它是执行时选择提供方的输入,而不是健康检查系统:`search()`/`fetch()` 会读取它来选择可用的提供方。选择失败时,调用方会收到可据以分支处理的结构化 `WebError`;其错误代码和消息会说明缺失的 id 或存在歧义的候选集。
|
|
124
|
+
|
|
125
|
+
选择从不依赖注册顺序、配置顺序或 HMR(热模块替换)顺序:一项能力要么有显式的提供方 id(配置 `searchProvider`/`fetchProvider`,或填充同一字段的对应环境变量),要么在恰好只有一个可用提供方注册时自动选择;如果存在多个可用提供方却未配置 id,则抛出 `WEB_PROVIDER_AMBIGUOUS`,而不会选用最先注册的提供方。
|
|
126
|
+
|
|
127
|
+
## 抓取网络策略
|
|
128
|
+
|
|
129
|
+
已交付的 Cordis、Code 与 Standard preset 会在所有 sandbox 和审批模式下暴露 `web_fetch`,无需逐次确认。文件 sandbox preset 不管辖 Web 网络访问。需要确认步骤的部署必须添加 `tools/pre-execute` 策略或禁用抓取。
|
|
130
|
+
|
|
131
|
+
HTTP 提供方会解析每个实际请求,拒绝包括通过当前 DNS64 前缀抵达私有 IPv4 在内的非公开结果,固定已验证的地址集合,并在每次同源重定向时重复强制执行。跨源重定向需要新的工具调用和新的公开地址校验。这些检查会阻止通过 SSRF 访问非公开目的地址,但不会阻止模型把数据发送到公开 URL。
|
|
132
|
+
|
|
133
|
+
## 错误
|
|
134
|
+
|
|
135
|
+
`WebError extends HarnessError`([core.md](core.zh.md) 错误分类体系),带有 `code: string`(开放式,与其他 seam 的错误一致——`LlmError`、`SubagentError`),而非封闭联合类型:提供方可以在不修改 `dsh-web` 的情况下抛出自己的错误代码,消费方必须容忍未知错误代码。错误代码按所有者划分。共享的 `WebRuntime` 约定会抛出与 seam 无关的错误代码:`WEB_PROVIDER_UNAVAILABLE`、`WEB_PROVIDER_CONFIGURED_MISSING`、`WEB_PROVIDER_CONFIGURED_UNAVAILABLE`、`WEB_PROVIDER_AMBIGUOUS`、`WEB_DUPLICATE_PROVIDER`(注册时的编程错误,类似 `LlmRuntime` 的 `DUPLICATE_ADAPTER`)、`WEB_ABORTED`,以及 `WEB_PROVIDER_ERROR`(提供方自身故障经 seam 暴露时使用的兜底代码,包括 DNS、连接被拒绝、TLS 等网络或传输故障)。抓取传输层错误代码由 `dsh-web-fetch-http` 实现拥有,不同的抓取后端无需抛出它们:`WEB_INVALID_URL`、`WEB_BLOCKED_URL`、`WEB_REDIRECT_BLOCKED`、`WEB_FETCH_TOO_LARGE`、`WEB_FETCH_TIMEOUT`、`WEB_UNSUPPORTED_CONTENT_TYPE`。
|
|
136
|
+
|
|
137
|
+
## 服务
|
|
138
|
+
|
|
139
|
+
`WebRuntime` 注册搜索与抓取提供方,以 `WEB_DUPLICATE_PROVIDER` 拒绝重复 id,并在执行时以结构化的选择错误解析提供方。本地抓取后端仅接受 HTTP(S)、拒绝凭证、对每个 hostname 只解析一次、拒绝包含任一非公开 IPv4/IPv6 目的地址或经当前前缀转换到非公开 IPv4 的 NAT64 地址的解析结果、把请求连接固定到已验证地址、对每一次同源重定向跳转重复这些校验、限制重定向次数、字节数、字符数和时间,并解码正文;展示由工具负责。
|
|
140
|
+
|
|
141
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
142
|
+
|
|
143
|
+
<a id="cordis-surface"></a>
|
|
144
|
+
|
|
145
|
+
## Cordis API
|
|
146
|
+
|
|
147
|
+
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).
|
|
148
|
+
|
|
149
|
+
<a id="ctxweb--webruntime"></a>
|
|
150
|
+
|
|
151
|
+
### `ctx.web` — `WebRuntime`
|
|
152
|
+
|
|
153
|
+
The web access service. Registered as `ctx.web` (one instance per context).
|
|
154
|
+
|
|
155
|
+
Selection semantics (resolved at execution time, never order-dependent):
|
|
156
|
+
|
|
157
|
+
- A configured id that is registered and `available()` → that provider.
|
|
158
|
+
- A configured id not registered → `WEB_PROVIDER_CONFIGURED_MISSING`.
|
|
159
|
+
- A configured id registered but unavailable → `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`.
|
|
160
|
+
- No id configured, exactly one registered usable provider → that provider.
|
|
161
|
+
- No id configured, multiple usable providers → `WEB_PROVIDER_AMBIGUOUS`.
|
|
162
|
+
- No id configured, no usable provider → `WEB_PROVIDER_UNAVAILABLE`.
|
|
163
|
+
|
|
164
|
+
```ts cordis-catalog
|
|
165
|
+
/**
|
|
166
|
+
* Register a search provider. Throws {@link WebError} `WEB_DUPLICATE_PROVIDER`
|
|
167
|
+
* if its id is already registered for search. Returns a disposer; disposed
|
|
168
|
+
* with the calling fiber.
|
|
169
|
+
* @param provider - the provider; its `id` is the registry key.
|
|
170
|
+
* @returns the disposer that unregisters the provider.
|
|
171
|
+
*/
|
|
172
|
+
registerSearchProvider(provider: WebSearchProvider): () => void
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Register a fetch provider. Throws {@link WebError} `WEB_DUPLICATE_PROVIDER`
|
|
176
|
+
* if its id is already registered for fetch. Returns a disposer; disposed
|
|
177
|
+
* with the calling fiber.
|
|
178
|
+
* @param provider - the provider; its `id` is the registry key.
|
|
179
|
+
* @returns the disposer that unregisters the provider.
|
|
180
|
+
*/
|
|
181
|
+
registerFetchProvider(provider: WebFetchProvider): () => void
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Run one search through the selected provider. Resolves the provider at call
|
|
185
|
+
* time with the selection rules above; throws {@link WebError} when the
|
|
186
|
+
* capability cannot run. The seam enforces `request.maxResults` on the result:
|
|
187
|
+
* if the provider over-returns, `sources[]` is truncated and `truncated` set.
|
|
188
|
+
* @param request - the query and optional result limit.
|
|
189
|
+
* @param signal - optional cancellation signal forwarded to the provider.
|
|
190
|
+
* @returns the provider's results, capped to `request.maxResults`.
|
|
191
|
+
*/
|
|
192
|
+
async search(request: WebSearchRequest, signal?: AbortSignal): Promise<WebSearchResult>
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Retrieve one URL through the selected provider. Resolves the provider at
|
|
196
|
+
* call time with the selection rules above; throws {@link WebError} when the
|
|
197
|
+
* capability cannot run. A non-2xx response is a result, not a throw.
|
|
198
|
+
* @param request - the URL plus retrieval options.
|
|
199
|
+
* @param signal - optional cancellation signal forwarded to the provider.
|
|
200
|
+
* @returns the retrieval outcome; non-2xx responses resolve descriptively.
|
|
201
|
+
*/
|
|
202
|
+
async fetch(request: WebFetchRequest, signal?: AbortSignal): Promise<WebFetchResult>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Source: [`packages/web/web/src/index.ts`](../../packages/web/web/src/index.ts)
|
|
206
|
+
<!-- END GENERATED cordis-surface -->
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Webhook runtime
|
|
2
|
+
|
|
3
|
+
English | [中文](webhook.zh.md)
|
|
4
|
+
|
|
5
|
+
The Webhook subsystem turns authenticated external deliveries into optional ordinary root Sessions. Provider adapters own authentication and generic JSON intake; trusted programmatic rules own conditions and external calls; `ctx.webhookRuntime` owns callback lifetime plus Workspace-backed Session creation. The [implemented decision](../../.agents/notes/implemented/feature/2026-08-22-fire-and-forget-webhook-sessions.md) records why the runtime keeps no delivery or completion state.
|
|
6
|
+
|
|
7
|
+
## Shared values
|
|
8
|
+
|
|
9
|
+
`WebhookRuleId`, `WebhookSourceId`, and `WebhookDeliveryId` are opaque strings. A delivery id is provenance only: the runtime neither stores nor deduplicates it.
|
|
10
|
+
|
|
11
|
+
`WebhookEventMap` is merge-extensible by provider kind. `WebhookEventOf<K>` selects a known provider event and otherwise admits generic lossless JSON, allowing an out-of-tree adapter without changing the runtime package.
|
|
12
|
+
|
|
13
|
+
`VerifiedWebhookDelivery<K>` contains `kind`, configured `source`, provider `deliveryId`, normalized `event`, and non-negative safe-integer `receivedAt`. The runtime validates, detaches, and freezes the entire value before dispatching it to more than one rule.
|
|
14
|
+
|
|
15
|
+
`WebhookRule<K>` contains a unique id, provider kind, and `run(delivery, signal)`. The callback may execute arbitrary trusted code. It returns `null` or one `WebhookSessionRequest`, and it must observe the signal for asynchronous work that should stop when the registration unloads.
|
|
16
|
+
|
|
17
|
+
`WebhookSessionRequest` requires an absolute `workspacePath`, title, text prompt, agent preset, and permission preset. Optional `model` names an explicit provider/model route plus optional output-token cap and uses that adapter's reasoning default. Omission snapshots the complete current deployment selection, including reasoning effort, until the first request records its durable header.
|
|
18
|
+
|
|
19
|
+
## Fire-and-forget dispatch
|
|
20
|
+
|
|
21
|
+
`dispatch()` snapshots the matching rules, schedules each independently, and returns before any callback settles. Throws and rejections are contained per rule. Registration disposal removes the rule before aborting and draining its active calls, so no later delivery can enter code that is unloading.
|
|
22
|
+
|
|
23
|
+
The runtime has no queue, retry, deduplication, execution status, crash replay, Agent-status listener, or completion result. Repeated delivery may create repeated Sessions. The only active-operation table is private teardown bookkeeping and disappears with the process.
|
|
24
|
+
|
|
25
|
+
## Session creation
|
|
26
|
+
|
|
27
|
+
A non-null result is snapshotted before asynchronous preflight. The runtime validates permission and agent presets, resolves or creates the canonical Workspace, creates an Agent whose Session cwd equals the Workspace path, mounts the selected agent preset before publication, and durably attaches the Session before applying permission, title, and the initial follow-up.
|
|
28
|
+
|
|
29
|
+
The follow-up is a normal durable user-role message with `source.kind: "webhook"` and provider/source/delivery/rule provenance. Its accepted inbox insertion commits the webhook operation. The runtime does not specially flush or wait for the turn; ordinary Session persistence and Agent lifecycle apply afterward.
|
|
30
|
+
|
|
31
|
+
Failed attachment disposes the new Agent before a prompt exists. A failure between attachment and prompt admission attempts Workspace detach and Agent disposal without replacing the original error. A Workspace automatically created during preflight remains because another concurrent caller may already use it.
|
|
32
|
+
|
|
33
|
+
## GitHub adapter
|
|
34
|
+
|
|
35
|
+
`@deepseek-ai/dsh-webhook-github` registers an exact route on an injected WebServer, resolves its credential reference for each request, verifies the untouched `application/json` body before parsing, and returns `202` immediately after in-memory dispatch. Its normalized event guarantees a signed lossless-JSON object; rules validate the event-specific fields they consume.
|
|
36
|
+
|
|
37
|
+
The [GitHub review guide](../user/guide/github-review.md) mounts this route on an isolated second WebServer so exposing webhook ingress does not expose the browser API.
|
|
38
|
+
|
|
39
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
40
|
+
|
|
41
|
+
<a id="cordis-surface"></a>
|
|
42
|
+
|
|
43
|
+
## Cordis API
|
|
44
|
+
|
|
45
|
+
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).
|
|
46
|
+
|
|
47
|
+
<a id="ctxwebhookruntime--webhookruntime"></a>
|
|
48
|
+
|
|
49
|
+
### `ctx.webhookRuntime` — `WebhookRuntime`
|
|
50
|
+
|
|
51
|
+
Fire-and-forget rule runtime. Session creation is the only built-in action.
|
|
52
|
+
|
|
53
|
+
```ts cordis-catalog
|
|
54
|
+
/**
|
|
55
|
+
* Register one trusted programmatic rule.
|
|
56
|
+
* @param rule - unique id, provider kind, and arbitrary callback.
|
|
57
|
+
* @returns awaitable effect disposer that aborts and drains this rule's active callbacks.
|
|
58
|
+
*/
|
|
59
|
+
register<K extends string>(rule: WebhookRule<K>): () => Promise<void>
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Start every currently matching rule and return before any callback settles.
|
|
63
|
+
* @param delivery - authenticated provider data; snapshotted before dispatch.
|
|
64
|
+
* @throws synchronously when the runtime is closing or the delivery is malformed.
|
|
65
|
+
*/
|
|
66
|
+
dispatch<K extends string>(delivery: VerifiedWebhookDelivery<K>): void
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Source: [`packages/webhook/webhook/src/index.ts`](../../packages/webhook/webhook/src/index.ts)
|
|
70
|
+
<!-- END GENERATED cordis-surface -->
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Webhook runtime
|
|
2
|
+
|
|
3
|
+
[English](webhook.md) | 中文
|
|
4
|
+
|
|
5
|
+
Webhook 子系统会把已通过身份验证的外部交付转换为可选的普通根 Session。提供方适配器拥有身份验证与通用 JSON 接收;受信任的程序化规则拥有条件与外部调用;`ctx.webhookRuntime` 拥有回调生命周期以及基于 Workspace 的 Session 创建。[已实现决策](../../.agents/notes/implemented/feature/2026-08-22-fire-and-forget-webhook-sessions.zh.md)记录了 runtime 为何不保留交付或完成状态。
|
|
6
|
+
|
|
7
|
+
## 共享值
|
|
8
|
+
|
|
9
|
+
`WebhookRuleId`、`WebhookSourceId` 与 `WebhookDeliveryId` 是不透明字符串。交付 id 仅用于来源信息:runtime 既不存储也不对它去重。
|
|
10
|
+
|
|
11
|
+
`WebhookEventMap` 可按提供方种类合并扩展。`WebhookEventOf<K>` 会选择已知提供方事件,否则接纳通用无损 JSON,从而让树外适配器无需修改 runtime 包。
|
|
12
|
+
|
|
13
|
+
`VerifiedWebhookDelivery<K>` 包含 `kind`、已配置 `source`、提供方 `deliveryId`、规范化 `event` 与非负安全整数 `receivedAt`。runtime 会先验证、分离并冻结完整值,再把它分发给多个规则。
|
|
14
|
+
|
|
15
|
+
`WebhookRule<K>` 包含唯一 id、提供方种类与 `run(delivery, signal)`。回调可以执行任意受信任代码。它返回 `null` 或一个 `WebhookSessionRequest`,并且异步工作若应在注册卸载时停止,就必须观察 signal。
|
|
16
|
+
|
|
17
|
+
`WebhookSessionRequest` 要求绝对 `workspacePath`、标题、文本提示词、agent preset 与 permission preset。可选 `model` 会指定明确的提供方/模型路由与可选输出 token 上限,并使用该适配器的默认推理强度。省略时会快照包含推理强度的完整当前部署选择,直到首个请求记录持久 header。
|
|
18
|
+
|
|
19
|
+
## Fire-and-forget 分发
|
|
20
|
+
|
|
21
|
+
`dispatch()` 会快照匹配规则,彼此独立地调度每个规则,并在任何回调结算前返回。抛出与拒绝按规则分别被包含。注册 disposer 会先移除规则,再中止并排空活动调用,因此后续交付无法进入正在卸载的代码。
|
|
22
|
+
|
|
23
|
+
runtime 没有队列、重试、去重、执行状态、崩溃重放、Agent 状态监听器或完成结果。重复交付可能创建重复 Session。唯一的活动操作表是私有 teardown 记账,并随进程消失。
|
|
24
|
+
|
|
25
|
+
## Session 创建
|
|
26
|
+
|
|
27
|
+
非 `null` 结果会在异步预检前生成快照。runtime 会验证 permission 与 agent preset,解析或创建规范 Workspace,创建 Session cwd 等于 Workspace 路径的 Agent,在发布前挂载所选 agent preset,并在应用权限、标题与初始 follow-up 前持久附加 Session。
|
|
28
|
+
|
|
29
|
+
follow-up 是普通持久 user-role 消息,使用 `source.kind: "webhook"`,并携带提供方/来源/交付/规则来源信息。其 inbox 插入被接受时提交 webhook 操作。runtime 不执行特殊 flush,也不等待轮次;之后应用普通 Session persistence 与 Agent 生命周期。
|
|
30
|
+
|
|
31
|
+
附加失败会在提示词出现前释放新 Agent。附加之后、提示词接纳之前的失败会尝试脱离 Workspace 并释放 Agent,且不会取代原始错误。预检期间自动创建的 Workspace 会保留,因为另一个并发调用者可能已经使用它。
|
|
32
|
+
|
|
33
|
+
## GitHub 适配器
|
|
34
|
+
|
|
35
|
+
`@deepseek-ai/dsh-webhook-github` 在注入的 WebServer 上注册精确路由,为每次请求解析凭据引用,在解析前验证未改动的 `application/json` body,并在内存分发后立即返回 `202`。它的规范化事件保证为已签名的无损 JSON 对象;规则负责验证自己消费的事件特定字段。
|
|
36
|
+
|
|
37
|
+
[GitHub 评审指南](../user/guide/github-review.zh.md)把该路由挂载在隔离的第二个 WebServer 上,因此暴露 webhook 入口不会暴露浏览器 API。
|
|
38
|
+
|
|
39
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
40
|
+
|
|
41
|
+
<a id="cordis-surface"></a>
|
|
42
|
+
|
|
43
|
+
## Cordis API
|
|
44
|
+
|
|
45
|
+
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).
|
|
46
|
+
|
|
47
|
+
<a id="ctxwebhookruntime--webhookruntime"></a>
|
|
48
|
+
|
|
49
|
+
### `ctx.webhookRuntime` — `WebhookRuntime`
|
|
50
|
+
|
|
51
|
+
Fire-and-forget rule runtime. Session creation is the only built-in action.
|
|
52
|
+
|
|
53
|
+
```ts cordis-catalog
|
|
54
|
+
/**
|
|
55
|
+
* Register one trusted programmatic rule.
|
|
56
|
+
* @param rule - unique id, provider kind, and arbitrary callback.
|
|
57
|
+
* @returns awaitable effect disposer that aborts and drains this rule's active callbacks.
|
|
58
|
+
*/
|
|
59
|
+
register<K extends string>(rule: WebhookRule<K>): () => Promise<void>
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Start every currently matching rule and return before any callback settles.
|
|
63
|
+
* @param delivery - authenticated provider data; snapshotted before dispatch.
|
|
64
|
+
* @throws synchronously when the runtime is closing or the delivery is malformed.
|
|
65
|
+
*/
|
|
66
|
+
dispatch<K extends string>(delivery: VerifiedWebhookDelivery<K>): void
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Source: [`packages/webhook/webhook/src/index.ts`](../../packages/webhook/webhook/src/index.ts)
|
|
70
|
+
<!-- END GENERATED cordis-surface -->
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# Workflow
|
|
2
|
+
|
|
3
|
+
English | [中文](workflow.zh.md)
|
|
4
|
+
|
|
5
|
+
The workflow seam lets an agent run a model-written orchestration SCRIPT that starts subagents. Like [subagent](subagent.md) it is **one optional capability**, not part of the agent loop, so its types and operations live here rather than in [core.md](core.md). Like bash, it permits ONE engine implementation per context to provide `ctx.workflowEngine`; there is no named-provider registry (a second engine replaces the first through plugin configuration rather than running beside it).
|
|
6
|
+
|
|
7
|
+
Service Definition: [dsh-workflow](../../packages/workflow/workflow) (`ctx.workflowEngine` + the vocabulary below). The Service Provider is [dsh-workflow-worker-thread](../../packages/workflow/workflow-worker-thread) (a `node:worker_threads` engine — one worker per run, the script's vm context inside it); the model-facing Consumer is [dsh-tool-workflow](../../packages/workflow/tool-workflow). The proposal and rationale: [the dynamic-workflows Agent Note](../../.agents/notes/implemented/feature/2026-07-05-dynamic-workflows.md).
|
|
8
|
+
|
|
9
|
+
Sources: browser-safe vocabulary in [`packages/workflow/workflow/src/types.ts`](../../packages/workflow/workflow/src/types.ts), Host request and live-run handles in [`runtime-types.ts`](../../packages/workflow/workflow/src/runtime-types.ts).
|
|
10
|
+
|
|
11
|
+
## The start request
|
|
12
|
+
|
|
13
|
+
What a caller asks for when starting a run. The ordinary workflow tool builds this from the model's `{ script, meta, args }` call plus the calling agent; specialized consumers may also select one engine-wide `subagentProvider` and lower `maxTotalAgents` for the run, but the script cannot observe or replace either policy. `meta` and `args` are plain JSON DATA (the engine validates `meta` against its schema and rejects loud BEFORE anything runs — no script text is ever evaluated to obtain it). `parent` is REQUIRED — every child the script starts is attributed to it, and cwd, lineage, and depth pass through the [subagent seam](subagent.md).
|
|
14
|
+
|
|
15
|
+
```ts type-equiv
|
|
16
|
+
/**
|
|
17
|
+
* What a caller asks for when starting a workflow run. `meta` and `args` are
|
|
18
|
+
* plain JSON data by the seam contract. `parent` is required because every
|
|
19
|
+
* `agent()` spawned by the script is attributed to that live Agent.
|
|
20
|
+
*/
|
|
21
|
+
interface WorkflowStartRequest {
|
|
22
|
+
/** The plain-JS script body (top-level await allowed; ends with `return <json-value>`). */
|
|
23
|
+
script: string
|
|
24
|
+
/** The workflow's identity block, as plain JSON data (shape-validated by the engine). */
|
|
25
|
+
meta: WorkflowMeta
|
|
26
|
+
/** Optional input exposed verbatim to the script as the `args` global. */
|
|
27
|
+
args?: unknown
|
|
28
|
+
/** Optional engine-wide child-provider override for this run. */
|
|
29
|
+
subagentProvider?: string
|
|
30
|
+
/** Optional per-run total-child ceiling. */
|
|
31
|
+
maxTotalAgents?: number
|
|
32
|
+
/** The agent on whose behalf the run executes (parent of every child). */
|
|
33
|
+
parent: Agent
|
|
34
|
+
/** Cancels the run when aborted. */
|
|
35
|
+
signal?: AbortSignal
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## The workflow's identity: `WorkflowMeta`
|
|
40
|
+
|
|
41
|
+
The identity block carried as data on the start request (the tool's `meta` parameter; the field vocabulary matches the Claude Code dynamic-workflows meta block). `phases` is progress vocabulary only: `phase()` calls match titles for observers; no execution structure is implied.
|
|
42
|
+
|
|
43
|
+
```ts type-equiv
|
|
44
|
+
/**
|
|
45
|
+
* The script's identity block, provided as plain JSON data alongside the
|
|
46
|
+
* script body (the model-facing tool carries it as its `meta` parameter) and
|
|
47
|
+
* validated by the engine before the body runs. `name`/`description` are
|
|
48
|
+
* required; the rest is optional annotation. The field vocabulary matches the
|
|
49
|
+
* Claude Code dynamic-workflows meta block.
|
|
50
|
+
*/
|
|
51
|
+
interface WorkflowMeta {
|
|
52
|
+
/** Short kebab-case workflow name (display + persistence key). */
|
|
53
|
+
name: string
|
|
54
|
+
/** One-line description of what the workflow does. */
|
|
55
|
+
description: string
|
|
56
|
+
/** Optional guidance on when this workflow applies (shown in listings). */
|
|
57
|
+
whenToUse?: string
|
|
58
|
+
/** Optional phase declarations matched by `phase()` calls. */
|
|
59
|
+
phases?: WorkflowPhase[]
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## The terminal result: `WorkflowResult`
|
|
64
|
+
|
|
65
|
+
The outcome of one run, resolved by `WorkflowRun.result`. `value` is the script's materialized return value — plain host-realm JSON data (`null` when the script returned nothing) — meaningful only for `completed`. `stopReason` is a CLOSED union (engine-owned; consumers may exhaust it): `completed` | `cancelled` | `error`. A non-`completed` reason carries the failure in `error`, and the consumer maps it to an `isError` tool result rather than reporting partial output as success.
|
|
66
|
+
|
|
67
|
+
```ts type-equiv
|
|
68
|
+
/**
|
|
69
|
+
* The outcome resolved by a live workflow run. `value` is
|
|
70
|
+
* the script's materialized return value (plain host-realm JSON data; `null`
|
|
71
|
+
* when the script returned `undefined`) — meaningful only for `completed`.
|
|
72
|
+
* A non-`completed` reason carries the failure in `error`; the consumer maps
|
|
73
|
+
* it to an `isError` tool result rather than reporting partial output.
|
|
74
|
+
*/
|
|
75
|
+
interface WorkflowResult {
|
|
76
|
+
/** The script's return value (host JSON data; `null` for no return). */
|
|
77
|
+
value: unknown
|
|
78
|
+
/** Why the run settled. */
|
|
79
|
+
stopReason: WorkflowStopReason
|
|
80
|
+
/** The failure message (present iff `stopReason` is not `completed`). */
|
|
81
|
+
error?: string
|
|
82
|
+
/**
|
|
83
|
+
* How many `agent()` calls the run accepted over its whole lifetime. On a
|
|
84
|
+
* graceful settlement this is the script-side count (calls still queued for
|
|
85
|
+
* a concurrency slot included); on a termination path (grace force-settle,
|
|
86
|
+
* worker death) it degrades to the host-observed count — calls queued
|
|
87
|
+
* inside a terminated script are unknowable then.
|
|
88
|
+
*/
|
|
89
|
+
agentsStarted: number
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## A live run: `WorkflowRun`
|
|
94
|
+
|
|
95
|
+
The handle the consumer holds while a script executes. The consumer awaits `result`, may `cancel` mid-flight, and MUST `dispose` on every path. `result` does NOT reject — a script failure resolves with `stopReason: 'error'` — and once the run is cancelled it SETTLES within the engine's bounded grace even if the script itself never settles (the engine force-settles `cancelled`; the worker-thread engine then terminates the script's worker), so a consumer awaiting `result` is never wedged past a cancellation. `dispose()` = cancel + that bounded settle + child quiescence; it never hangs on a stuck script.
|
|
96
|
+
|
|
97
|
+
```ts type-equiv
|
|
98
|
+
/**
|
|
99
|
+
* Holder-owned live workflow. `result` never rejects; consumers may cancel
|
|
100
|
+
* and must call idempotent `dispose()` to await script and child quiescence.
|
|
101
|
+
*/
|
|
102
|
+
interface WorkflowRun {
|
|
103
|
+
readonly id: WorkflowRunId
|
|
104
|
+
/** The validated meta block available before the script body runs. */
|
|
105
|
+
readonly meta: WorkflowMeta
|
|
106
|
+
readonly result: Promise<WorkflowResult>
|
|
107
|
+
/** Cancel the run and its children. */
|
|
108
|
+
cancel(reason?: string): void
|
|
109
|
+
/** Cancel if needed and await bounded settlement and cleanup. */
|
|
110
|
+
dispose(): Promise<void>
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Failure discipline: `WorkflowError.fatal`
|
|
115
|
+
|
|
116
|
+
Hook misuse inside a script — bad arguments, unknown/deferred `agent()` options, a schema outside the [structured-output subset](../../packages/core/tools/README.md), a tripped cap, a seam start failure, cancellation — throws a `WorkflowError` with `fatal: true`. The `parallel()`/`pipeline()` combinators RE-THROW fatal errors instead of mapping the item to `null`: a typo'd option must kill the script loudly, never dissolve into something that reads as an ordinary child failure. The per-item `null` is reserved for child-run failures (a non-`completed` stop reason) and ordinary in-stage script errors.
|
|
117
|
+
|
|
118
|
+
## Events
|
|
119
|
+
|
|
120
|
+
The `workflow/*` events (`workflow/start`, `workflow/phase`, `workflow/log`, `workflow/agent-start`, `workflow/agent-end`, `workflow/end` — see the [events catalog](#cordis-surface)) are **observe-only** emits carrying DATA SNAPSHOTS: every payload starts with `WorkflowRunInfo` (id + meta), never the live `WorkflowRun`, so a subscriber cannot gain `cancel`/`dispose`, and `workflow/end` deliberately omits the result value (a listener observing outcomes must not receive a mutable alias of the caller's result). Every emit is per-listener contained — a throwing subscriber is logged, never propagated, and cannot starve the listeners registered after it — and every listener receives its own payload clone, so mutating it corrupts neither the engine nor other listeners; the containment mirrors `subagent/start`/`subagent/end`.
|
|
121
|
+
|
|
122
|
+
## Durable Chat records
|
|
123
|
+
|
|
124
|
+
The top-level `dsh-tool-workflow` consumer projects display facts into its calling parent Session without changing execution ownership. It writes `tool-workflow/run-start` after a run is accepted, pairs member start and end by `runId + seq`, and writes `tool-workflow/run-end` only after the result is known and disposal reaches quiescence. Nested transport calls write no record. The first append failure disables later writes for that run, so the log remains empty or a legal continuous prefix and the tool result is unchanged.
|
|
125
|
+
|
|
126
|
+
`dsh-tool-workflow/invariant` validates the same protocol before live commit and when a Session is loaded: one start per run, positive unique member sequences, paired member endings, no run ending with open members, and no updates after the run ending. A missing member ending or run ending at the log tail is valid interruption evidence rather than corruption.
|
|
127
|
+
|
|
128
|
+
`dsh-client-ui-workflow-run` folds the four events through the Conversation Node engine into one `workflow-run` Chat node anchored at the run-start sequence, after the original workflow tool node. Phase groups come only from actual member starts and preserve exact strings, including the distinction between an omitted phase and `''`. Closed Locations turn missing terminal facts into interrupted presentation. The [UI package README](../../packages/client/ui-workflow-run/README.md) owns disclosure, status, and same-parent local navigation behavior.
|
|
129
|
+
|
|
130
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
131
|
+
|
|
132
|
+
<a id="cordis-surface"></a>
|
|
133
|
+
|
|
134
|
+
## Cordis API
|
|
135
|
+
|
|
136
|
+
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).
|
|
137
|
+
|
|
138
|
+
<a id="ctxworkflowengine--workflowengine-abstract-seam"></a>
|
|
139
|
+
|
|
140
|
+
### `ctx.workflowEngine` — `WorkflowEngine` (abstract seam)
|
|
141
|
+
|
|
142
|
+
Workflow Service Definition contract. Invalid requests throw before publication; a live run is holder-owned, its result never rejects, cancellation and disposal are bounded, and disposal waits for child cleanup within that bound. Lifecycle listener failures are contained, and `workflow/end` fires exactly once as the result settles.
|
|
143
|
+
|
|
144
|
+
```ts cordis-catalog
|
|
145
|
+
/**
|
|
146
|
+
* Parse and execute a workflow script.
|
|
147
|
+
* @param request - the script, its `args`, the parent agent, and an
|
|
148
|
+
* optional cancel signal.
|
|
149
|
+
* @returns the live run; its `result` resolves when the script settles.
|
|
150
|
+
*/
|
|
151
|
+
abstract start(request: WorkflowStartRequest): WorkflowRun
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Source: [`packages/workflow/workflow/src/index.ts`](../../packages/workflow/workflow/src/index.ts)
|
|
155
|
+
|
|
156
|
+
<a id="workflow-events"></a>
|
|
157
|
+
|
|
158
|
+
### `workflow/*` events
|
|
159
|
+
|
|
160
|
+
<a id="workflowagent-end--emit"></a>
|
|
161
|
+
|
|
162
|
+
#### `workflow/agent-end` — emit
|
|
163
|
+
|
|
164
|
+
One `agent()` call settled (clean result, child failure, or run cancellation). Paired with Events['workflow/agent-start'] by `agent.seq`, exactly once per started call on every stop path — on an engine termination path (a worker killed past its grace) the end is engine-synthesized with outcome `'cancelled'`.
|
|
165
|
+
|
|
166
|
+
```ts cordis-catalog
|
|
167
|
+
/**
|
|
168
|
+
* One `agent()` call settled (clean result, child failure, or run
|
|
169
|
+
* cancellation). Paired with {@link Events['workflow/agent-start']} by
|
|
170
|
+
* `agent.seq`, exactly once per started call on every stop path — on an
|
|
171
|
+
* engine termination path (a worker killed past its grace) the end is
|
|
172
|
+
* engine-synthesized with outcome `'cancelled'`.
|
|
173
|
+
* @param info - the run's identity snapshot.
|
|
174
|
+
* @param agent - the call identity plus its outcome.
|
|
175
|
+
* @mode emit
|
|
176
|
+
*/
|
|
177
|
+
'workflow/agent-end'(info: WorkflowRunInfo, agent: WorkflowAgentEndInfo): void
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Source: [`packages/workflow/workflow/src/index.ts`](../../packages/workflow/workflow/src/index.ts)
|
|
181
|
+
|
|
182
|
+
<a id="workflowagent-start--emit"></a>
|
|
183
|
+
|
|
184
|
+
#### `workflow/agent-start` — emit
|
|
185
|
+
|
|
186
|
+
One `agent()` call established a published child run. Paired with Events['workflow/agent-end'] by `agent.seq`. A call that never receives a published run from the provider emits neither event in this pair.
|
|
187
|
+
|
|
188
|
+
```ts cordis-catalog
|
|
189
|
+
/**
|
|
190
|
+
* One `agent()` call established a published child run. Paired with
|
|
191
|
+
* {@link Events['workflow/agent-end']} by `agent.seq`. A call that never
|
|
192
|
+
* receives a published run from the provider emits neither
|
|
193
|
+
* event in this pair.
|
|
194
|
+
* @param info - the run's identity snapshot.
|
|
195
|
+
* @param agent - the call's sequence number, label, phase, and child id.
|
|
196
|
+
* @mode emit
|
|
197
|
+
*/
|
|
198
|
+
'workflow/agent-start'(info: WorkflowRunInfo, agent: WorkflowAgentInfo): void
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Source: [`packages/workflow/workflow/src/index.ts`](../../packages/workflow/workflow/src/index.ts)
|
|
202
|
+
|
|
203
|
+
<a id="workflowend--emit"></a>
|
|
204
|
+
|
|
205
|
+
#### `workflow/end` — emit
|
|
206
|
+
|
|
207
|
+
A workflow run settled (any stop reason). Fired when WorkflowRun.result resolves. Paired with Events['workflow/start'].
|
|
208
|
+
|
|
209
|
+
```ts cordis-catalog
|
|
210
|
+
/**
|
|
211
|
+
* A workflow run settled (any stop reason). Fired when
|
|
212
|
+
* {@link WorkflowRun.result} resolves. Paired with
|
|
213
|
+
* {@link Events['workflow/start']}.
|
|
214
|
+
* @param info - the run's identity snapshot.
|
|
215
|
+
* @param result - the outcome data (stop reason, error, agent count) —
|
|
216
|
+
* deliberately WITHOUT the result value (see {@link WorkflowResultInfo}).
|
|
217
|
+
* @mode emit
|
|
218
|
+
*/
|
|
219
|
+
'workflow/end'(info: WorkflowRunInfo, result: WorkflowResultInfo): void
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Source: [`packages/workflow/workflow/src/index.ts`](../../packages/workflow/workflow/src/index.ts)
|
|
223
|
+
|
|
224
|
+
<a id="workflowlog--emit"></a>
|
|
225
|
+
|
|
226
|
+
#### `workflow/log` — emit
|
|
227
|
+
|
|
228
|
+
The script emitted a narration line (a `log(message)` call).
|
|
229
|
+
|
|
230
|
+
```ts cordis-catalog
|
|
231
|
+
/**
|
|
232
|
+
* The script emitted a narration line (a `log(message)` call).
|
|
233
|
+
* @param info - the run's identity snapshot.
|
|
234
|
+
* @param message - the logged message, verbatim.
|
|
235
|
+
* @mode emit
|
|
236
|
+
*/
|
|
237
|
+
'workflow/log'(info: WorkflowRunInfo, message: string): void
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Source: [`packages/workflow/workflow/src/index.ts`](../../packages/workflow/workflow/src/index.ts)
|
|
241
|
+
|
|
242
|
+
<a id="workflowphase--emit"></a>
|
|
243
|
+
|
|
244
|
+
#### `workflow/phase` — emit
|
|
245
|
+
|
|
246
|
+
The script entered a phase (a `phase(title)` call) — progress grouping for observers; no execution semantics.
|
|
247
|
+
|
|
248
|
+
```ts cordis-catalog
|
|
249
|
+
/**
|
|
250
|
+
* The script entered a phase (a `phase(title)` call) — progress grouping
|
|
251
|
+
* for observers; no execution semantics.
|
|
252
|
+
* @param info - the run's identity snapshot.
|
|
253
|
+
* @param title - the phase title, verbatim.
|
|
254
|
+
* @mode emit
|
|
255
|
+
*/
|
|
256
|
+
'workflow/phase'(info: WorkflowRunInfo, title: string): void
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Source: [`packages/workflow/workflow/src/index.ts`](../../packages/workflow/workflow/src/index.ts)
|
|
260
|
+
|
|
261
|
+
<a id="workflowstart--emit"></a>
|
|
262
|
+
|
|
263
|
+
#### `workflow/start` — emit
|
|
264
|
+
|
|
265
|
+
A workflow run started — the script's meta block validated, the body about to execute. Paired with Events['workflow/end'].
|
|
266
|
+
|
|
267
|
+
```ts cordis-catalog
|
|
268
|
+
/**
|
|
269
|
+
* A workflow run started — the script's meta block validated, the body
|
|
270
|
+
* about to execute. Paired with {@link Events['workflow/end']}.
|
|
271
|
+
* @param info - the run's identity snapshot (id + meta).
|
|
272
|
+
* @mode emit
|
|
273
|
+
*/
|
|
274
|
+
'workflow/start'(info: WorkflowRunInfo): void
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Source: [`packages/workflow/workflow/src/index.ts`](../../packages/workflow/workflow/src/index.ts)
|
|
278
|
+
<!-- END GENERATED cordis-surface -->
|