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,351 @@
|
|
|
1
|
+
# 持久附件
|
|
2
|
+
|
|
3
|
+
[English](attachment.md) | 中文
|
|
4
|
+
|
|
5
|
+
附件 seam 将二进制图片和通用文件的所有权与会话日志分离。生产方把字节交给 [`ctx.attachments`](#ctxattachments--attachmentstore-abstract-seam);只有对象完成持久化后,该服务才会发布不可变的内容寻址引用。会话事件和模型可见的附件块包含该引用及其元数据,绝不包含浏览器对象 URL、宿主临时路径、提供方 URL 或 base64 数据。独立的 [`ctx.fileUploads`](#ctxfileuploads--fileuploads) 服务把浏览器文件传输与暂存凭证绑定到接收方 Agent。
|
|
6
|
+
|
|
7
|
+
未发送的浏览器草稿可以保留在内存中,原生客户端也可以将其暂存于操作系统临时存储。浏览器通用文件取得暂存 prompt 凭证前会完成持久化。宿主接受用户消息后,会先把消息中的图片移到 `<DSH_HOME>/attachments/v1` 下,再追加用户事件。结构化模型图片输出遵循同样的先持久化、后追加事件规则。
|
|
8
|
+
|
|
9
|
+
来源:[`packages/attachment/attachment/src/types.ts`](../../packages/attachment/attachment/src/types.ts)
|
|
10
|
+
|
|
11
|
+
## 标识与经过校验的元数据
|
|
12
|
+
|
|
13
|
+
`AttachmentId` 是带类型标记的不透明字符串。本地后端目前生成 `sha256:<digest>`,但消费方既不能解析这种表示,也不能据此派生文件系统路径。消费方可以通过 `imageHostPath()` 询问附件提供方所持对象的位置,然后必须由当前执行文件系统判断模型工具能否读取该宿主路径。
|
|
14
|
+
|
|
15
|
+
```ts type-equiv
|
|
16
|
+
/** Raster image formats accepted by the version-one attachment path. */
|
|
17
|
+
type ImageMediaType = 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif'
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```ts type-equiv
|
|
21
|
+
/** Durable, serializable reference to one immutable normalized image. */
|
|
22
|
+
interface ImageAttachmentRef {
|
|
23
|
+
/** Opaque storage identifier; never a filesystem path or bearer URL. */
|
|
24
|
+
attachmentId: AttachmentId
|
|
25
|
+
/** Media type verified from the stored bytes. */
|
|
26
|
+
mediaType: ImageMediaType
|
|
27
|
+
/** Exact encoded byte length. */
|
|
28
|
+
bytes: number
|
|
29
|
+
/** Intrinsic encoded width in pixels. */
|
|
30
|
+
width: number
|
|
31
|
+
/** Intrinsic encoded height in pixels. */
|
|
32
|
+
height: number
|
|
33
|
+
/** Optional display name stripped of local path information. */
|
|
34
|
+
name?: string
|
|
35
|
+
/**
|
|
36
|
+
* Input dimensions after applying EXIF orientation and before normalization
|
|
37
|
+
* scaling. Present only when normalization reduced the image.
|
|
38
|
+
*/
|
|
39
|
+
originalDimensions?: {
|
|
40
|
+
width: number
|
|
41
|
+
height: number
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
```ts type-equiv
|
|
47
|
+
/** Deployment-resolved limits used by upload admission and request buffering. */
|
|
48
|
+
interface ImageAttachmentLimits {
|
|
49
|
+
maxImageBytes: number
|
|
50
|
+
maxImagesPerMessage: number
|
|
51
|
+
maxMessageImageBytes: number
|
|
52
|
+
maxImagePixels: number
|
|
53
|
+
/** Maximum intrinsic width and maximum intrinsic height in pixels for one image. */
|
|
54
|
+
maxImageDimension: number
|
|
55
|
+
mediaTypes: readonly ImageMediaType[]
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
本地后端每条消息最多准入 20 张图片,源图编码数据总量不超过 200 MiB。单张源图不得超过 20 MiB、64,000,000 像素和单边 8192 像素。这些源文件限制先于独立的规范化阶段执行;该阶段默认把长边限制为 2048 像素,把编码数据限制为 4 MiB。
|
|
60
|
+
|
|
61
|
+
引用记录固有尺寸和编码长度,使客户端无需先解码即可排布历史记录;每次权威读取仍会根据对象重新校验摘要、媒体签名、尺寸和元数据。
|
|
62
|
+
|
|
63
|
+
## 提交与经校验读取的数据
|
|
64
|
+
|
|
65
|
+
```ts type-equiv
|
|
66
|
+
/**
|
|
67
|
+
* Browser-submitted prompt content accepted by Host prompt endpoints; the
|
|
68
|
+
* accepting Host promotes image parts to durable references through
|
|
69
|
+
* `ctx.attachments.admitPromptContent()` before any message is created, so a wire caller can
|
|
70
|
+
* never cite an attachment it did not upload.
|
|
71
|
+
*/
|
|
72
|
+
type PromptContentPart =
|
|
73
|
+
| { readonly type: 'text'; readonly text: string }
|
|
74
|
+
| {
|
|
75
|
+
readonly type: 'image'
|
|
76
|
+
readonly mediaType: ImageMediaType
|
|
77
|
+
readonly data: string
|
|
78
|
+
readonly name?: string
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```ts type-equiv
|
|
83
|
+
/** Host prompt content whose file receipts are resolved and whose image bytes await admission. */
|
|
84
|
+
type AttachmentAdmissionPart =
|
|
85
|
+
| PromptContentPart
|
|
86
|
+
| { readonly type: 'file'; readonly attachment: FileAttachmentRef }
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
```ts type-equiv
|
|
90
|
+
/** Host-admitted prompt content with every attachment represented by its durable reference. */
|
|
91
|
+
type AdmittedPromptContentPart =
|
|
92
|
+
| { readonly type: 'text'; readonly text: string }
|
|
93
|
+
| { readonly type: 'image'; readonly attachment: ImageAttachmentRef }
|
|
94
|
+
| { readonly type: 'file'; readonly attachment: FileAttachmentRef }
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
```ts type-equiv
|
|
98
|
+
/** Base64-encoded image upload accompanying one wire request. */
|
|
99
|
+
interface EncodedImageAttachment {
|
|
100
|
+
/** Declared media type, verified against the decoded bytes during admission. */
|
|
101
|
+
mediaType: ImageMediaType
|
|
102
|
+
/** Canonical base64 encoding of the image bytes. */
|
|
103
|
+
data: string
|
|
104
|
+
/** Optional display name; it is never interpreted as a path. */
|
|
105
|
+
name?: string
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```ts type-equiv
|
|
110
|
+
/** Request to validate and durably commit one image. */
|
|
111
|
+
interface SaveImageAttachment {
|
|
112
|
+
data: Uint8Array
|
|
113
|
+
/** Caller-declared media type, checked against fully decoded bytes. */
|
|
114
|
+
mediaType: ImageMediaType
|
|
115
|
+
/** Optional browser/provider display name; it is never interpreted as a path. */
|
|
116
|
+
name?: string
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```ts type-equiv
|
|
121
|
+
/** Stored image bytes returned after reference and digest verification. */
|
|
122
|
+
interface StoredImageAttachment {
|
|
123
|
+
ref: ImageAttachmentRef
|
|
124
|
+
data: Uint8Array
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```ts type-equiv
|
|
129
|
+
/** Deterministic request-image policy selected by one exact model route. */
|
|
130
|
+
interface ImageRequestPolicy {
|
|
131
|
+
/** Maximum width multiplied by height after aspect-preserving projection. */
|
|
132
|
+
maxPixels: number
|
|
133
|
+
/** Encoded-byte target before base64 expansion or Files API upload; the smallest quality-ladder output is kept when no quality fits. */
|
|
134
|
+
maxBytes: number
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```ts type-equiv
|
|
139
|
+
/** Cached request version derived from one provider-independent normalized attachment. */
|
|
140
|
+
interface RequestImageAttachment {
|
|
141
|
+
/** Cache and upload-index key over the attachment id, policy, and fixed encoder parameters. */
|
|
142
|
+
variantId: ImageVariantId
|
|
143
|
+
/** Durable normalized attachment from which this request version was derived. */
|
|
144
|
+
attachment: ImageAttachmentRef
|
|
145
|
+
/** Encoded request bytes. */
|
|
146
|
+
data: Uint8Array
|
|
147
|
+
mediaType: ImageMediaType
|
|
148
|
+
bytes: number
|
|
149
|
+
width: number
|
|
150
|
+
height: number
|
|
151
|
+
/** Provider-compatible sample depth proven after request encoding. */
|
|
152
|
+
depth: 'uchar'
|
|
153
|
+
/** Provider-compatible color space proven after request encoding. */
|
|
154
|
+
space: 'srgb'
|
|
155
|
+
/** Whether the encoded request version retains an alpha channel. */
|
|
156
|
+
hasAlpha: boolean
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
`saveImage()` 准备并原子提交提供方无关的规范化附件,然后直接返回 `ImageAttachmentRef`。`saveImages()` 在发布批次前为每个成员各准备一次经过验证的附件,因此校验拒绝不会留下部分对象,发布也不会重复解码或选择质量。`admitPromptContent()` 在文件凭证解析后接收完整且有序的 Host prompt,把 base64 图片上传替换为持久引用,并让持久文件引用原样通过。`admitEncodedImages()` 支持其他 wire 入口,把张数、聚合字节和有序批量准入交给 `saveImages()`。`admitEncodedFile()` 让编码协议适配器使用服务拥有的规范 base64 准入,`isAttachmentError()` 让这些适配器无需导入实现辅助函数即可识别稳定的附件错误。`readImage()` 校验来自已授权会话路径的规范化附件。`imageHostPath()` 只公开提供方所持对象的宿主位置,不判断当前工具执行环境能否读取它。`readImageRequest()` 按确切路由的像素和字节预算派生并缓存确定性请求版本。该版本包含编码字节和元数据,不包含执行环境路径。新条目在发布前完整解码,缓存命中只做有界元数据探测。调用方需要有序批次时,对单数方法使用 `Promise.all`。本地实现按需编码首选候选、合并相同请求身份的并发任务、允许每个等待方单独取消、没有等待方时停止共享任务,并通过实例级限流器限制全部变换,默认同时执行两项。该服务不规定保留策略:恢复和 fork 后的会话可能共享对象,因此基于引用的垃圾回收会延期实现,不与单个会话的删除绑定。
|
|
161
|
+
|
|
162
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
163
|
+
|
|
164
|
+
<a id="cordis-surface"></a>
|
|
165
|
+
|
|
166
|
+
## Cordis API
|
|
167
|
+
|
|
168
|
+
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).
|
|
169
|
+
|
|
170
|
+
<a id="ctxattachments--attachmentstore-abstract-seam"></a>
|
|
171
|
+
|
|
172
|
+
### `ctx.attachments` — `AttachmentStore` (abstract seam)
|
|
173
|
+
|
|
174
|
+
Immutable binary attachment service. Implementations validate bytes before publishing a reference.
|
|
175
|
+
|
|
176
|
+
```ts cordis-catalog
|
|
177
|
+
/**
|
|
178
|
+
* Validate one image without persisting it.
|
|
179
|
+
* Batch callers validate every member before saving any member.
|
|
180
|
+
* @param input - encoded bytes, declared media type, and optional display name.
|
|
181
|
+
* @returns completion after the encoded raster has been fully decoded.
|
|
182
|
+
*/
|
|
183
|
+
abstract validateImage(input: SaveImageAttachment): Promise<void>
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Validate and durably commit one ordered image batch.
|
|
187
|
+
* @param inputs - encoded images in owning-message order.
|
|
188
|
+
* @returns durable normalized attachment references in the same order after every member succeeds.
|
|
189
|
+
*/
|
|
190
|
+
async saveImages(inputs: readonly SaveImageAttachment[]): Promise<readonly ImageAttachmentRef[]>
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Admit one Host prompt and replace each uploaded image with its durable reference.
|
|
194
|
+
* Text and durable file references pass through unchanged. A prompt without image parts performs no storage operation.
|
|
195
|
+
* @param content - prompt parts in message order after file receipt resolution.
|
|
196
|
+
* @returns admitted prompt parts in the same order as `content`.
|
|
197
|
+
* @throws AttachmentError when the image batch is refused.
|
|
198
|
+
*/
|
|
199
|
+
async admitPromptContent( content: readonly AttachmentAdmissionPart[], ): Promise<AdmittedPromptContentPart[]>
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Decode and durably commit one canonical base64 file upload.
|
|
203
|
+
* @param input - canonical base64 bytes and optional display name.
|
|
204
|
+
* @returns the durable content-addressed file reference.
|
|
205
|
+
* @throws AttachmentError when the encoding or storage operation is refused.
|
|
206
|
+
*/
|
|
207
|
+
admitEncodedFile(input: EncodedFileAttachment): Promise<FileAttachmentRef>
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Identify a failure emitted by this attachment capability by its stable code.
|
|
211
|
+
* @param error - value caught from an attachment operation.
|
|
212
|
+
* @returns whether the value is an attachment failure.
|
|
213
|
+
*/
|
|
214
|
+
isAttachmentError(error: unknown): error is AttachmentError
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Validate and durably commit one image before its owning session event is appended.
|
|
218
|
+
* The returned reference describes the persisted normalized image. When
|
|
219
|
+
* normalization reduces the raster, its `originalDimensions` records the
|
|
220
|
+
* orientation-applied input dimensions.
|
|
221
|
+
* @param input - encoded bytes, declared media type, and optional display name.
|
|
222
|
+
* @returns the durable content-addressed normalized image reference.
|
|
223
|
+
*/
|
|
224
|
+
abstract saveImage(input: SaveImageAttachment): Promise<ImageAttachmentRef>
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Read one image and verify that bytes still match the recorded reference.
|
|
228
|
+
* @param ref - durable reference from the session log.
|
|
229
|
+
* @param signal - optional cancellation for backend read and verification work.
|
|
230
|
+
* @returns the verified bytes and normalized attachment reference.
|
|
231
|
+
* @throws the signal reason when aborted, or a storage error when verification fails.
|
|
232
|
+
*/
|
|
233
|
+
abstract readImage(ref: ImageAttachmentRef, signal?: AbortSignal): Promise<StoredImageAttachment>
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Locate the provider-owned normalized object in the harness host filesystem.
|
|
237
|
+
* @param ref - durable normalized attachment reference.
|
|
238
|
+
* @returns an absolute host path, or undefined when this backend is not host-file-backed.
|
|
239
|
+
* @throws an AttachmentError when the durable reference is invalid.
|
|
240
|
+
*/
|
|
241
|
+
imageHostPath(ref: ImageAttachmentRef): string | undefined
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Durably commit one file byte-for-byte before its owning session event is
|
|
245
|
+
* appended. Files carry no admission limits: any byte content and length is
|
|
246
|
+
* accepted, and the stored object is the exact submitted bytes. Backends
|
|
247
|
+
* without verbatim file storage keep this default rejection.
|
|
248
|
+
* @param input - exact bytes and optional display name.
|
|
249
|
+
* @returns the durable content-addressed file reference.
|
|
250
|
+
*/
|
|
251
|
+
saveFile(input: SaveFileAttachment): Promise<FileAttachmentRef>
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Durably commit one file byte-for-byte from bounded chunks. Providers must
|
|
255
|
+
* apply backpressure and must not collect the complete file in memory.
|
|
256
|
+
* Backends without streamed verbatim storage keep this default rejection.
|
|
257
|
+
* @param input - ordered exact bytes, optional cancellation, and display name.
|
|
258
|
+
* @returns the durable content-addressed file reference.
|
|
259
|
+
*/
|
|
260
|
+
saveFileStream(input: SaveFileStreamAttachment): Promise<FileAttachmentRef>
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Read and verify one verbatim stored file as bounded chunks. Providers must
|
|
264
|
+
* not collect the complete file in memory. Backends without verbatim file
|
|
265
|
+
* reads keep this default rejection.
|
|
266
|
+
* @param ref - durable reference from the session log.
|
|
267
|
+
* @param signal - optional cancellation for backend reads and verification work.
|
|
268
|
+
* @returns exact file bytes in order; integrity failures reject the iteration.
|
|
269
|
+
*/
|
|
270
|
+
async *readFileStream( ref: FileAttachmentRef, signal?: AbortSignal, ): AsyncIterable<Uint8Array>
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Locate the verbatim stored file object in the harness host filesystem.
|
|
274
|
+
* @param ref - durable file reference.
|
|
275
|
+
* @returns an absolute host path, or undefined when this backend is not host-file-backed.
|
|
276
|
+
* @throws an AttachmentError when the durable reference is invalid.
|
|
277
|
+
*/
|
|
278
|
+
fileHostPath(ref: FileAttachmentRef): string | undefined
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Generate or read one deterministic model-request version from the stored normalized image.
|
|
282
|
+
* @param ref - durable provider-independent normalized attachment reference.
|
|
283
|
+
* @param policy - exact route pixel budget and encoded-byte target; a target no ladder quality meets yields the smallest ladder output.
|
|
284
|
+
* @param signal - optional cancellation.
|
|
285
|
+
* @returns request bytes and the cache/upload identity covering every transform input.
|
|
286
|
+
*/
|
|
287
|
+
readImageRequest( ref: ImageAttachmentRef, policy: ImageRequestPolicy, signal?: AbortSignal, ): Promise<RequestImageAttachment>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Source: [`packages/attachment/attachment/src/index.ts`](../../packages/attachment/attachment/src/index.ts)
|
|
291
|
+
|
|
292
|
+
<a id="ctxfileuploads--fileuploads"></a>
|
|
293
|
+
|
|
294
|
+
### `ctx.fileUploads` — `FileUploads`
|
|
295
|
+
|
|
296
|
+
Host service owning upload storage and Agent-scoped staged receipts.
|
|
297
|
+
|
|
298
|
+
```ts cordis-catalog
|
|
299
|
+
/**
|
|
300
|
+
* Register the ordinary-Session resolver used when a raw upload addresses a cold Session.
|
|
301
|
+
* @param resolve - resolver that returns the exact live Agent or throws a Remote error.
|
|
302
|
+
* @returns disposer removing this resolver.
|
|
303
|
+
*/
|
|
304
|
+
registerAgentResolver(resolve: AgentResolver): () => void
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Persist one encoded upload and stage it under the Agent receiver selected by Typert.
|
|
308
|
+
* @param agent - receiving Agent resolved from the Remote Agent scope.
|
|
309
|
+
* @param request - canonical base64 bytes and optional display name.
|
|
310
|
+
* @param signal - caller cancellation before storage begins.
|
|
311
|
+
* @returns the staged receipt and durable file reference.
|
|
312
|
+
*/
|
|
313
|
+
@Remote('upload') upload(agent: Agent, request: EncodedFileUploadRequest, signal: AbortSignal): Promise<FileUploadValue>
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Persist raw chunks for one Session without aggregating the upload.
|
|
317
|
+
* @param request - Session identity, ordered bytes, cancellation, and optional display name.
|
|
318
|
+
* @returns the staged receipt and durable file reference.
|
|
319
|
+
*/
|
|
320
|
+
async uploadStream(request: { readonly sessionId: SessionId readonly data: AsyncIterable<Uint8Array> readonly signal?: AbortSignal readonly name?: string }): Promise<FileUploadValue>
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Resolve one staged receipt inside its receiving Agent scope.
|
|
324
|
+
* @param agent - receiving Agent.
|
|
325
|
+
* @param receiptId - opaque receipt minted for one completed upload.
|
|
326
|
+
* @returns durable file reference, or `undefined` for an unknown or foreign receipt.
|
|
327
|
+
*/
|
|
328
|
+
resolve(agent: Agent, receiptId: FileUploadReceiptId): FileAttachmentRef | undefined
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Bind receipts while one prompt enters an Agent inbox.
|
|
332
|
+
* Disposal restores every prior binding unless the caller commits successful delivery.
|
|
333
|
+
* @param agent - receiving Agent.
|
|
334
|
+
* @param receiptIds - distinct staged receipts referenced by the prompt.
|
|
335
|
+
* @param requestId - prompt identity later observed in queue or history.
|
|
336
|
+
* @returns binding kept after commit until queue or history observation retires its receipts.
|
|
337
|
+
*/
|
|
338
|
+
bindPrompt( agent: Agent, receiptIds: readonly FileUploadReceiptId[], requestId: string, ): PromptFileBinding
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Retire every receipt accepted by one removed queue occurrence.
|
|
342
|
+
* @param agent - receiving Agent.
|
|
343
|
+
* @param requestId - prompt identity carried by the queue occurrence.
|
|
344
|
+
*/
|
|
345
|
+
retirePrompt(agent: Agent, requestId: string): void
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Types: [Agent](core.zh.md) · [SessionId](core.zh.md)
|
|
349
|
+
|
|
350
|
+
Source: [`packages/client/file-upload/src/index.ts`](../../packages/client/file-upload/src/index.ts)
|
|
351
|
+
<!-- END GENERATED cordis-surface -->
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Client Modules
|
|
2
|
+
|
|
3
|
+
English | [中文](client-modules.zh.md)
|
|
4
|
+
|
|
5
|
+
The web plugin table: the Node half of the client module system in [dsh-client-modules](../../packages/client/modules), provided as `ctx.clientModules` (`ClientModuleRegistry`). It scans the host Loader's entries for packages declaring `dsh.client`, composes the `window.__DSH_BOOT__` entry graph, serves versioned one-or-more-resource combo scripts under `/plugins`, and answers every index-injection collection with the boot protocol rows — the four faces of one service. It is an optional capability of the web GUI stack, not part of the agent-loop spine, and it is a consumer of [dsh-host-webserver](../../packages/host/webserver): the carrier described in [web-server.md](web-server.md) supplies the prefix route and the `webserver/index-inject` event this service answers. The same package's browser half (`ctx.modules`, the lazy-CJS module table that fetches and materializes these bundles) is kernel machinery documented in the [package README](../../packages/client/modules/README.md), not here.
|
|
6
|
+
|
|
7
|
+
Source: [`packages/client/modules/src/client/manifest.ts`](../../packages/client/modules/src/client/manifest.ts)
|
|
8
|
+
|
|
9
|
+
## The wire
|
|
10
|
+
|
|
11
|
+
The graph is the wire single source between the Node and browser halves. The host composes `WebBootEntry` rows and `WebBootBatch` descriptors from scanned packages, then contributes the registration facade, application preloads, bootstrap scripts, and graph global to the structured index-injection table before the Vite entry. The `global` row renders as `globalThis["__DSH_BOOT__"]` with `<` escaped so plugin-controlled strings cannot break out of the script element. A page without a valid manifest cannot boot: the browser parser rejects malformed rows or batches, unknown members, and entries without exactly one initial combo descriptor.
|
|
12
|
+
|
|
13
|
+
```ts type-equiv
|
|
14
|
+
/**
|
|
15
|
+
* One composed client entry pushed by the host (a graph row). Wire
|
|
16
|
+
* single source: the host node half (package root) produces this same shape.
|
|
17
|
+
* `immediately` marks stage-one prefetch. `inject` names package rows whose
|
|
18
|
+
* factories must arrive before this row materializes, while Cordis separately
|
|
19
|
+
* uses the same package edges to compose entries. `external` carries exact
|
|
20
|
+
* non-inject module requests (see {@link WebBootGraph.entries}).
|
|
21
|
+
*/
|
|
22
|
+
interface WebBootEntry {
|
|
23
|
+
/** Entry name == package name. */
|
|
24
|
+
id: string
|
|
25
|
+
/** Revisioned single-resource combo endpoint used by HMR. */
|
|
26
|
+
url: string
|
|
27
|
+
/** Opaque plugin-artifact revision used for HMR cache busting. */
|
|
28
|
+
rev: string
|
|
29
|
+
/** Package-name dependency edges used for factory arrival and plugin composition. */
|
|
30
|
+
inject?: string[]
|
|
31
|
+
/** Stage-one prefetch mark: load the script for factory registration during module-face boot. */
|
|
32
|
+
immediately?: boolean
|
|
33
|
+
/** Non-baseline module specifiers this row requests; omitted when it requests none. */
|
|
34
|
+
external?: string[]
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
```ts type-equiv
|
|
39
|
+
/** Initial scheduling phase for one content-addressed combo script. */
|
|
40
|
+
type WebBootBatchPhase = 'bootstrap' | 'application'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```ts type-equiv
|
|
44
|
+
/** One initial combo script; a scheduling phase may span several descriptors. */
|
|
45
|
+
interface WebBootBatch {
|
|
46
|
+
/** Parser-blocking bootstrap or preloaded application scheduling. */
|
|
47
|
+
phase: WebBootBatchPhase
|
|
48
|
+
/** Content-addressed combo script endpoint. */
|
|
49
|
+
url: string
|
|
50
|
+
/** Revision over the combined plugin script bytes and indexed source map. */
|
|
51
|
+
rev: string
|
|
52
|
+
/** Graph entry ids whose factories the script registers, in execution order. */
|
|
53
|
+
entries: string[]
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
```ts type-equiv
|
|
58
|
+
/** The composed client entry graph the host injects as `window.__DSH_BOOT__`. */
|
|
59
|
+
interface WebBootGraph {
|
|
60
|
+
/** Consistency anchor over the whole graph (content + bundle hashes). */
|
|
61
|
+
rev: string
|
|
62
|
+
/**
|
|
63
|
+
* Composed entries in module-graph order — a dynamic package row precedes
|
|
64
|
+
* rows whose `external` requests that package. Cordis activation order is
|
|
65
|
+
* unrelated and remains owned by fiber service waiting.
|
|
66
|
+
*/
|
|
67
|
+
entries: WebBootEntry[]
|
|
68
|
+
/** Initial combo descriptors; every entry belongs to exactly one descriptor. */
|
|
69
|
+
batches: WebBootBatch[]
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Each initial row's `rev` is an opaque process nonce plus sequence, so graph composition does not hash every plugin artifact. After HMR observes a change, that row's revision becomes the hash of its new bundle and available source map. The initial descriptors partition rows into bootstrap and application scheduling phases, and either phase may contain several descriptors. Their URLs contain only the ordered package-resource list and revision; phase names do not enter the route. Graph composition preserves row order while greedily splitting before the map-form URL exceeds 3 KiB. Startup combo revisions hash the combined plugin script bytes and indexed source map, and the graph revision hashes both rows and descriptors. `immediately` marks the stage-one registration barrier; rows within one combo share its script transport, while separate combos load independently.
|
|
74
|
+
|
|
75
|
+
## The scan
|
|
76
|
+
|
|
77
|
+
A package joins the table by declaring `dsh.client` (`platform: 'web'`, optional `inject` edges, optional `immediately`) in its package.json and exporting its built bundle at `exports["./client"]`. Each live row resolves from its own Loader specifier and owning-tree `baseUrl`, through the same `loader.internal.resolveSync` implementation that imports its Host face when available. The nearest owning package manifest supplies the browser module id, so relative source and built overlays retain the package identity. Distinct active Loader sources resolving to one package name fail composition; after one source unloads, the surviving source supplies the row without a fiber restart.
|
|
78
|
+
|
|
79
|
+
Scanning is incremental per package; there is no full-rescan code path. Every cordis `internal/plugin` emission (fiber construction or disposal) marks the fiber's entry name dirty, and a microtask flush reconciles each dirty name against the live loader entries. The activation pass seeds the same dirty set with all current entries and flushes synchronously, so first scan and steady state share one implementation — with opposite failure postures. At activation, a malformed declaration or missing bundle among the already-loaded entries aggregates into one loud `AggregateError` listing every broken package: the fiber FAILS and the boot's fail-loud sweep reports it. In steady state, a broken package logs a warning and must not poison the others.
|
|
80
|
+
|
|
81
|
+
Package metadata — including the negative "not a client package" verdict — is cached per Loader specifier and owning-tree base URL until restart. A fiber restart from the same source reuses its row and rev untouched; bundle content changes reach the graph only through `rebuilt()`.
|
|
82
|
+
|
|
83
|
+
## The bundle route and index injection
|
|
84
|
+
|
|
85
|
+
`GET`/`HEAD /plugins/??<package-a>/client.js,<package-b>/client.js&rev=<rev>` serves an exact generated combo script; a one-resource request uses the same form and is the HMR path. Its absolute `sourceMappingURL` changes every resource suffix in parallel, yielding `/plugins/??<package-a>/client.js.map,<package-b>/client.js.map&rev=<rev>`. The map is Indexed Source Map v3 even for one resource. An authored component map supplies its section; a component without one receives an identity section whose `sourcesContent` is the generated bundle and whose source name is its packaged `sourceURL` or plugin route. Every startup request URL is at most 3 KiB measured as UTF-8 bytes; partitioning uses the longer map form. All application URLs are preloaded, and all bootstrap URLs execute before the graph global and Vite entry. All advertised responses use long-lived immutable caching. Unknown or altered resource lists, missing revisions, and stale revisions answer 404 rather than serving different bytes or letting the SPA fallback return HTML as JavaScript; other methods are 405. The injection rows carry the current graph on every index render, so a reload always boots against the live composition.
|
|
86
|
+
|
|
87
|
+
## The service
|
|
88
|
+
|
|
89
|
+
```ts type-equiv
|
|
90
|
+
/** Filesystem baseline captured before a client artifact snapshot is read. */
|
|
91
|
+
interface ClientArtifactBaseline {
|
|
92
|
+
/** Absolute path of the client bundle. */
|
|
93
|
+
readonly path: string
|
|
94
|
+
/** Bundle modification time in milliseconds. */
|
|
95
|
+
readonly mtimeMs: number
|
|
96
|
+
/** Bundle size in bytes. */
|
|
97
|
+
readonly size: number
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`ClientModuleRegistry` (`ctx.clientModules`, defined in [`packages/client/modules/src/index.ts`](../../packages/client/modules/src/index.ts)) exposes reads and the rebuild face; signatures are in the generated [service catalog](#ctxclientmodules--clientmoduleregistry). `graph()` returns the current composed graph (a stable object between changes), `clientPath(id)` returns the bundle's absolute path, and `artifactBaseline(id)` returns the bundle stat values captured before the current snapshot was read. `rebuilt(id)` is the only entry point through which changed bundle content reaches the graph: it re-hashes the bundle together with its current source map, and only a real rev change recomposes the graph and notifies. `onRebuilt` fires per changed bundle with the new rev; `onGraphChanged` fires after any flush that recomposed the graph (row added or removed, or a rebuilt rev change) and is pull-model — listeners re-read `graph()`. Both notification paths contain listener exceptions so one throwing subscriber cannot skip later subscribers or kill whatever triggered the flush.
|
|
102
|
+
|
|
103
|
+
In development, [dsh-client-hmr](../../packages/client/hmr/README.md) is the registry's watch driver: its node half stat-polls every graph row's bundle from the module host's pre-read baseline, calls `rebuilt(id)` only for a changed or dirty row, resyncs its watch set through `onGraphChanged`, and broadcasts rev changes to the browser half over SSE. Source-map changes alone do not trigger a reload; the current map joins the snapshot when a bundle change does. Production graphs omit the HMR row entirely; the module host itself never watches files.
|
|
104
|
+
|
|
105
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
106
|
+
|
|
107
|
+
<a id="cordis-surface"></a>
|
|
108
|
+
|
|
109
|
+
## Cordis API
|
|
110
|
+
|
|
111
|
+
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).
|
|
112
|
+
|
|
113
|
+
<a id="ctxclientmodules--clientmoduleregistry"></a>
|
|
114
|
+
|
|
115
|
+
### `ctx.clientModules` — `ClientModuleRegistry`
|
|
116
|
+
|
|
117
|
+
The web plugin table service: incremental `dsh.client` scan + wire composition + bundle route + index injection rows. Construction runs the activation scan synchronously — a malformed declaration or missing bundle among the already-loaded entries aggregates into one loud throw (FAILED fiber; the boot activation audit reports it).
|
|
118
|
+
|
|
119
|
+
```ts cordis-catalog
|
|
120
|
+
/**
|
|
121
|
+
* Current composed entry graph (stable object between changes).
|
|
122
|
+
* @returns the graph served as `window.__DSH_BOOT__`.
|
|
123
|
+
*/
|
|
124
|
+
graph(): WebBootGraph
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Absolute path of an entry's client bundle.
|
|
128
|
+
* @param id - entry id (package name).
|
|
129
|
+
* @returns the path, or undefined for an unknown id.
|
|
130
|
+
*/
|
|
131
|
+
clientPath(id: string): string | undefined
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Filesystem baseline captured before an entry's current bytes were read.
|
|
135
|
+
* HMR compares it with the live files when installing a watch, so a write
|
|
136
|
+
* between startup composition and watch installation cannot disappear into
|
|
137
|
+
* the watcher's initial state.
|
|
138
|
+
* @param id - entry id (package name).
|
|
139
|
+
* @returns the path and baseline, or undefined for an unknown id.
|
|
140
|
+
*/
|
|
141
|
+
artifactBaseline(id: string): ClientArtifactBaseline | undefined
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Re-hash one bundle (the HMR watch's registration hook — the only entry
|
|
145
|
+
* point through which bundle content changes reach the graph).
|
|
146
|
+
* @param id - entry id (package name).
|
|
147
|
+
* @returns the new rev, or undefined for an unknown id.
|
|
148
|
+
*/
|
|
149
|
+
rebuilt(id: string): string | undefined
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Subscribe to bundle rebuilds; fires only when the re-hash changed the rev.
|
|
153
|
+
* @param listener - receives the entry id and its new bundle rev.
|
|
154
|
+
* @returns the unsubscriber.
|
|
155
|
+
*/
|
|
156
|
+
onRebuilt(listener: (id: string, rev: string) => void): () => void
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Fires after any flush that recomposed the graph (row added/removed, or a
|
|
160
|
+
* rebuilt rev change). Pull model: listeners re-read {@link graph}.
|
|
161
|
+
* @param listener - notified with no payload.
|
|
162
|
+
* @returns the unsubscriber.
|
|
163
|
+
*/
|
|
164
|
+
onGraphChanged(listener: () => void): () => void
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Source: [`packages/client/modules/src/index.ts`](../../packages/client/modules/src/index.ts)
|
|
168
|
+
<!-- END GENERATED cordis-surface -->
|