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,184 @@
|
|
|
1
|
+
# 持久 PTY 会话
|
|
2
|
+
|
|
3
|
+
[English](terminal.md) | 中文
|
|
4
|
+
|
|
5
|
+
PTY 后端、`ctx.terminals` 与面向模型的消费方共享的类型。[持久 PTY Agent Note](../../.agents/notes/implemented/feature/2026-07-16-persistent-pty-sessions.zh.md) 负责记录决策依据;本页记录来自 [`packages/terminal/terminal/src/types.ts`](../../packages/terminal/terminal/src/types.ts) 的跨包词汇。
|
|
6
|
+
|
|
7
|
+
## 标识与就绪
|
|
8
|
+
|
|
9
|
+
`TerminalSessionId` 是由服务铸造的branded id。可选名称是拥有者本地的显示元数据;授权比较的是拥有该会话的确切 `Agent`,而不是名称或猜测的 id。
|
|
10
|
+
|
|
11
|
+
`TerminalWaitReason` 说明一次发送为何返回。它与 `TerminalSessionStatus` 无关:一次发送可能因静默或超时而返回,但顶层 shell 仍然存活;`session_exit` 表示该 shell 已退出,而不是某个任意的前台子进程已退出。
|
|
12
|
+
|
|
13
|
+
```ts type-equiv
|
|
14
|
+
/** Why one interactive send returned control to its caller. */
|
|
15
|
+
type TerminalWaitReason = 'stdin_read' | 'inferred_idle' | 'timeout' | 'session_exit'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```ts type-equiv
|
|
19
|
+
/** Top-level PTY process status, independent of a send's wait reason. */
|
|
20
|
+
type TerminalSessionStatus =
|
|
21
|
+
| { kind: 'running' }
|
|
22
|
+
| { kind: 'exited'; exitCode: number | null; signal: NodeJS.Signals | null }
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 后端与活跃会话
|
|
26
|
+
|
|
27
|
+
后端负责启动某种已注册类型的会话并检测其就绪状态。`TerminalSessionService` 只在初始化成功后才发布返回的会话,随后负责 id 授权与清理。无法清理部分启动资源时,后端会以 `TerminalBackendCleanupError` 拒绝启动;这样,资源释放流程既能保留清理失败,也不会用它替换调用方的取消原因。后端会话拥有终端状态,并负责让已捕获的资源完全停稳。
|
|
28
|
+
|
|
29
|
+
```ts type-equiv
|
|
30
|
+
/** Replaceable provider for one PTY session type. */
|
|
31
|
+
interface TerminalBackend {
|
|
32
|
+
/** Stable type selected by {@link TerminalSpawnRequest.type}. */
|
|
33
|
+
readonly type: string
|
|
34
|
+
/** Create an unpublished session or reject after cleaning partial resources; cleanup failure uses {@link TerminalBackendCleanupError}. */
|
|
35
|
+
spawn(spec: TerminalBackendSpawnSpec): Promise<TerminalBackendSession>
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
```ts type-equiv
|
|
40
|
+
/** Backend-owned live session retained by {@link TerminalSessionService}. */
|
|
41
|
+
interface TerminalBackendSession {
|
|
42
|
+
/** Initial bounded terminal output returned from `terminal_open`. */
|
|
43
|
+
readonly motd: string
|
|
44
|
+
/** Top-level process id when one exists. */
|
|
45
|
+
readonly pid?: number
|
|
46
|
+
/** Start one exclusive send operation. */
|
|
47
|
+
startSend(request: TerminalSendRequest): TerminalSendOperation
|
|
48
|
+
/** Read one bounded page from retained scrollback. */
|
|
49
|
+
read(request: TerminalReadRequest): TerminalReadResult
|
|
50
|
+
/** Signal the verified foreground process group. */
|
|
51
|
+
signal(signal: TerminalSignal): Promise<TerminalSignalResult>
|
|
52
|
+
/** Observe top-level process status. */
|
|
53
|
+
status(): TerminalSessionStatus
|
|
54
|
+
/** Idempotently close the captured owned process tree and await quiescence. */
|
|
55
|
+
close(reason: string): Promise<void>
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 发送与保留输出
|
|
60
|
+
|
|
61
|
+
一个活跃会话同时只接受一个活动发送。该操作向通用后台任务提供读取后即推进的输出游标,并向前台调用方提供最终结果。`TerminalReadResult` 则为有界的会话 scrollback 单独分页。
|
|
62
|
+
|
|
63
|
+
```ts type-equiv
|
|
64
|
+
/** Live backend-owned send; exactly one may be active per PTY session. */
|
|
65
|
+
interface TerminalSendOperation {
|
|
66
|
+
/** Resolves after readiness, timeout, cancellation, or top-level process exit. */
|
|
67
|
+
done: Promise<TerminalSendResult>
|
|
68
|
+
/** Consume output produced since the prior call. */
|
|
69
|
+
readOutput(): TerminalSendRead
|
|
70
|
+
/** Request `SIGINT`; returns false after the operation settled. */
|
|
71
|
+
cancel(): boolean
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```ts type-equiv
|
|
76
|
+
/** Settled result for one foreground or background send. */
|
|
77
|
+
interface TerminalSendResult {
|
|
78
|
+
/** Bounded rendered terminal delta remaining at settlement. */
|
|
79
|
+
viewport: string
|
|
80
|
+
/** Why the wait returned; this does not imply arbitrary child-process exit. */
|
|
81
|
+
waitReason: TerminalWaitReason
|
|
82
|
+
/** Top-level session status observed at settlement. */
|
|
83
|
+
sessionStatus: TerminalSessionStatus
|
|
84
|
+
/** Whether output was dropped from the operation or retained scrollback. */
|
|
85
|
+
truncated: boolean
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 归属与持久性
|
|
90
|
+
|
|
91
|
+
`TerminalSessionService` 会将一项等待完成的清理附加到确切的拥有者作用域,拒绝其他拥有者的操作,并让会话在后端或工具插件重载期间保持存活。PTY 状态与原始字节仍局限在进程内。模型输入与有界返回输出通过现有 `tool/call`、`tool/result` 和任务结果路径持久保存,而不是重复记录 PTY 会话事件。
|
|
92
|
+
|
|
93
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
94
|
+
|
|
95
|
+
<a id="cordis-surface"></a>
|
|
96
|
+
|
|
97
|
+
## Cordis API
|
|
98
|
+
|
|
99
|
+
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).
|
|
100
|
+
|
|
101
|
+
<a id="ctxterminals--terminalsessionservice"></a>
|
|
102
|
+
|
|
103
|
+
### `ctx.terminals` — `TerminalSessionService`
|
|
104
|
+
|
|
105
|
+
In-process registry for replaceable PTY backends and exact-Agent sessions.
|
|
106
|
+
|
|
107
|
+
```ts cordis-catalog
|
|
108
|
+
/**
|
|
109
|
+
* Register one backend type for this effect scope.
|
|
110
|
+
* @param backend - provider with a non-empty unique type.
|
|
111
|
+
* @returns disposer that removes exactly this contribution.
|
|
112
|
+
*/
|
|
113
|
+
registerBackend(backend: TerminalBackend): () => void
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* List registered backend types in registration order.
|
|
117
|
+
* @returns fresh backend type names.
|
|
118
|
+
*/
|
|
119
|
+
listBackends(): string[]
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Create and publish one owner-scoped session after backend setup succeeds.
|
|
123
|
+
* @param owner - exact registered Agent that owns access and cleanup.
|
|
124
|
+
* @param request - backend type plus optional owner-local name and cwd.
|
|
125
|
+
* @param signal - cancellation of unpublished setup.
|
|
126
|
+
* @returns published identity, metadata, status, and MOTD.
|
|
127
|
+
*/
|
|
128
|
+
async spawn(owner: Agent, request: TerminalSpawnRequest, signal?: AbortSignal): Promise<TerminalSpawnResult>
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Test whether an exact owner has a published session or unpublished spawn.
|
|
132
|
+
* @param owner - exact live owner to inspect.
|
|
133
|
+
* @returns true across the entire spawn-to-close interval, with no publication gap.
|
|
134
|
+
*/
|
|
135
|
+
hasOwnerActivity(owner: Agent): boolean
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Start one exclusive interactive send.
|
|
139
|
+
* @param owner - exact session owner.
|
|
140
|
+
* @param id - target PTY identity.
|
|
141
|
+
* @param request - explicit text, submit behavior, and cancellation.
|
|
142
|
+
* @returns live operation handle for foreground await or task registration.
|
|
143
|
+
*/
|
|
144
|
+
startSend(owner: Agent, id: TerminalSessionId, request: TerminalSendRequest): TerminalSendOperation
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Read one bounded scrollback page from an owned session.
|
|
148
|
+
* @param owner - exact session owner.
|
|
149
|
+
* @param id - target PTY identity.
|
|
150
|
+
* @param request - optional newest-relative offset and line count.
|
|
151
|
+
* @returns bounded retained text and pagination metadata.
|
|
152
|
+
*/
|
|
153
|
+
read(owner: Agent, id: TerminalSessionId, request: TerminalReadRequest = {}): TerminalReadResult
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Deliver an allowed signal through an owned backend session.
|
|
157
|
+
* @param owner - exact session owner.
|
|
158
|
+
* @param id - target PTY identity.
|
|
159
|
+
* @param signal - allowed POSIX signal name.
|
|
160
|
+
* @returns delivered foreground process-group identity.
|
|
161
|
+
*/
|
|
162
|
+
signal(owner: Agent, id: TerminalSessionId, signal: TerminalSignal): Promise<TerminalSignalResult>
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Close one owned session and remove it only after quiescent backend cleanup.
|
|
166
|
+
* @param owner - exact session owner.
|
|
167
|
+
* @param id - target PTY identity.
|
|
168
|
+
* @param reason - diagnostic cleanup reason.
|
|
169
|
+
* @returns true for a newly closed session, false when the same close is already in flight.
|
|
170
|
+
*/
|
|
171
|
+
async kill(owner: Agent, id: TerminalSessionId, reason: string = 'model request'): Promise<boolean>
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* List fresh snapshots for exactly one owner.
|
|
175
|
+
* @param owner - exact owner whose sessions are visible.
|
|
176
|
+
* @returns owner-visible snapshots in publication order.
|
|
177
|
+
*/
|
|
178
|
+
list(owner: Agent): TerminalSessionSnapshot[]
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Types: [Agent](core.zh.md)
|
|
182
|
+
|
|
183
|
+
Source: [`packages/terminal/terminal/src/index.ts`](../../packages/terminal/terminal/src/index.ts)
|
|
184
|
+
<!-- END GENERATED cordis-surface -->
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Todo
|
|
2
|
+
|
|
3
|
+
English | [中文](todo.zh.md)
|
|
4
|
+
|
|
5
|
+
The durable todo vocabulary owned by [`@deepseek-ai/dsh-tool-todo`](../../packages/todo/tool-todo/README.md). The model-facing tool replaces one agent session's whole list; the package also owns the event declaration, replay projection, and invariant companion. Tool behavior and configuration are on the [package README](../../packages/todo/tool-todo/README.md).
|
|
6
|
+
|
|
7
|
+
Source: [`packages/todo/tool-todo/src/types.ts`](../../packages/todo/tool-todo/src/types.ts)
|
|
8
|
+
|
|
9
|
+
## `TodoItem` — one list entry
|
|
10
|
+
|
|
11
|
+
```ts type-equiv
|
|
12
|
+
/**
|
|
13
|
+
* One entry in an agent's todo list — the unit of the `todo/write`
|
|
14
|
+
* whole-list snapshot declared by this package.
|
|
15
|
+
*
|
|
16
|
+
* Deliberately minimal: a human-readable `content` line and a three-state
|
|
17
|
+
* `status`. No id, priority, or `activeForm` — the list is replaced wholesale
|
|
18
|
+
* on every write (last-write-wins), so entries need no stable identity. The
|
|
19
|
+
* three statuses describe the complete portable lifecycle needed by model and
|
|
20
|
+
* UI consumers.
|
|
21
|
+
*/
|
|
22
|
+
interface TodoItem {
|
|
23
|
+
/** What this task is — a short imperative line shown in the UI. */
|
|
24
|
+
content: string
|
|
25
|
+
/** Lifecycle state. `in_progress` marks a task being worked now; parallel work may mark several. */
|
|
26
|
+
status: 'pending' | 'in_progress' | 'completed'
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Durable event and invariant
|
|
31
|
+
|
|
32
|
+
The package declaration-merges `todo/write: { todos: TodoItem[] }` into `SessionEventMap`. The event is log-only and carries the complete replacement list; the generated [persistence catalog](../persistence-catalog.md#todowrite--log-only) records its declaration site. The package's invariant companion validates existing and newly announced sessions in one pass, then tracks committed turn boundaries incrementally so every live `todo/write` is checked before append without rescanning the log.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Todo
|
|
2
|
+
|
|
3
|
+
[English](todo.md) | 中文
|
|
4
|
+
|
|
5
|
+
本页记录 [`@deepseek-ai/dsh-tool-todo`](../../packages/todo/tool-todo/README.zh.md) 拥有的持久 todo 词汇。面向模型的工具会整体替换一个 agent(智能体)会话的列表;该包还拥有事件声明、回放投影和不变量配套插件。工具行为与配置见[包 README](../../packages/todo/tool-todo/README.zh.md)。
|
|
6
|
+
|
|
7
|
+
源码:[`packages/todo/tool-todo/src/types.ts`](../../packages/todo/tool-todo/src/types.ts)
|
|
8
|
+
|
|
9
|
+
## `TodoItem`:一条列表项
|
|
10
|
+
|
|
11
|
+
```ts type-equiv
|
|
12
|
+
/**
|
|
13
|
+
* One entry in an agent's todo list — the unit of the `todo/write`
|
|
14
|
+
* whole-list snapshot declared by this package.
|
|
15
|
+
*
|
|
16
|
+
* Deliberately minimal: a human-readable `content` line and a three-state
|
|
17
|
+
* `status`. No id, priority, or `activeForm` — the list is replaced wholesale
|
|
18
|
+
* on every write (last-write-wins), so entries need no stable identity. The
|
|
19
|
+
* three statuses describe the complete portable lifecycle needed by model and
|
|
20
|
+
* UI consumers.
|
|
21
|
+
*/
|
|
22
|
+
interface TodoItem {
|
|
23
|
+
/** What this task is — a short imperative line shown in the UI. */
|
|
24
|
+
content: string
|
|
25
|
+
/** Lifecycle state. `in_progress` marks a task being worked now; parallel work may mark several. */
|
|
26
|
+
status: 'pending' | 'in_progress' | 'completed'
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## 持久事件与不变量
|
|
31
|
+
|
|
32
|
+
该包通过声明合并把 `todo/write: { todos: TodoItem[] }` 加入 `SessionEventMap`。此事件仅写入日志,并携带完整替换列表;生成的[持久化目录](../persistence-catalog.zh.md#todowrite--log-only)会记录其声明位置。该包的不变量配套插件会单次遍历校验现有会话和新发布的会话,随后增量追踪已提交的轮次边界,使每个实时 `todo/write` 都能在追加前得到校验,而无需重新扫描日志。
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Token Meter
|
|
2
|
+
|
|
3
|
+
English | [中文](token-meter.zh.md)
|
|
4
|
+
|
|
5
|
+
`@deepseek-ai/dsh-token-meter` exposes one detached replay snapshot for request pressure and positional surface pricing. `logRevision` is the number of durable events consumed for every field in the measurement.
|
|
6
|
+
|
|
7
|
+
Source: [`packages/llm/token-meter/src/types.ts`](../../packages/llm/token-meter/src/types.ts)
|
|
8
|
+
|
|
9
|
+
## `TokenMeasurement`
|
|
10
|
+
|
|
11
|
+
```ts type-equiv
|
|
12
|
+
/** Detached immutable request-pressure and surface snapshot at one consumed log revision. */
|
|
13
|
+
interface TokenMeasurement {
|
|
14
|
+
/** Number of durable events consumed; equal to the next unread event seq. */
|
|
15
|
+
readonly logRevision: SessionLogOffset
|
|
16
|
+
/** Provider or heuristic anchor used for this measurement. */
|
|
17
|
+
readonly baseline: TokenMeasurementBaseline
|
|
18
|
+
/** Signed repricing of current surface content relative to the baseline anchor. */
|
|
19
|
+
readonly surfaceDeltaTokens: number
|
|
20
|
+
/** Non-negative current request-and-response pressure. */
|
|
21
|
+
readonly totalTokens: number
|
|
22
|
+
/** Total route-priced request tokens across the current surface; equals the sum of the node prices. */
|
|
23
|
+
readonly surfaceTokens: number
|
|
24
|
+
/** Current surface nodes in positional head-to-tail order. */
|
|
25
|
+
readonly nodes: readonly TokenSurfaceNode[]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Every measurement resolves the effective envelope's routed provider/model to that route's declared request-image pricing through `ctx.llm`, so image occurrences are priced as the visual tokens plus model-visible text the request actually sends; routes and compositions without declared pricing keep the fixed heuristic. `baseline.kind === 'usage'` means the latest successful provider call has the same canonical request envelope and its total is no lower than that call's full route-priced anchor. `estimated` means no reusable conservative usage anchor exists, so the service priced the complete envelope and surface itself. A later successful request replaces the earlier anchor; signed `surfaceDeltaTokens` preserves growth and shrinkage relative to a matching anchor, repricing both sides under the same route. `totalTokens` remains request-and-response pressure, while `surfaceTokens` is the surface-only route-priced total and equals the sum of the node prices.
|
|
30
|
+
|
|
31
|
+
## `TokenSurfaceNode`
|
|
32
|
+
|
|
33
|
+
```ts type-equiv
|
|
34
|
+
/** One token-priced node in the current ordered session surface. */
|
|
35
|
+
interface TokenSurfaceNode {
|
|
36
|
+
/** Durable sequence number of the surface event. */
|
|
37
|
+
readonly seq: SessionSeq
|
|
38
|
+
/**
|
|
39
|
+
* Request-pressure tokens for the exact message projected by this node under
|
|
40
|
+
* the measured route: image occurrences carry the route's declared visual
|
|
41
|
+
* price when the routed adapter declares one, and the fixed heuristic
|
|
42
|
+
* otherwise. Trigger, retention, and range selection all read this price.
|
|
43
|
+
*/
|
|
44
|
+
readonly tokens: number
|
|
45
|
+
/**
|
|
46
|
+
* Fixed-heuristic tokens for the same message, independent of any route.
|
|
47
|
+
* The shadow-price protocol prices replacements with this value so the O(1)
|
|
48
|
+
* projection fold stays in agreement with its own appends.
|
|
49
|
+
*/
|
|
50
|
+
readonly heuristicTokens: number
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Surface order is authoritative; replacement nodes can have higher durable seqs than later positional nodes. The snapshot is immutable and does not grow when the underlying replay fold advances.
|
|
55
|
+
|
|
56
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
57
|
+
|
|
58
|
+
<a id="cordis-surface"></a>
|
|
59
|
+
|
|
60
|
+
## Cordis API
|
|
61
|
+
|
|
62
|
+
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).
|
|
63
|
+
|
|
64
|
+
<a id="ctxtokenmeter--tokenmeter"></a>
|
|
65
|
+
|
|
66
|
+
### `ctx.tokenMeter` — `TokenMeter`
|
|
67
|
+
|
|
68
|
+
Replay owner for one service-wide estimator and isolated per-session folds.
|
|
69
|
+
|
|
70
|
+
```ts cordis-catalog
|
|
71
|
+
/**
|
|
72
|
+
* Measure current request pressure and surface through the durable tail.
|
|
73
|
+
*
|
|
74
|
+
* The effective envelope's routed provider/model selects the request-image
|
|
75
|
+
* pricing every node is priced under: a route whose adapter declares image
|
|
76
|
+
* pricing charges each retained image its visual tokens plus its
|
|
77
|
+
* model-visible text, while other routes keep the fixed heuristic. Provider
|
|
78
|
+
* usage is reused only when the latest successful call's canonical request
|
|
79
|
+
* envelope matches `requestHeader` and its total is no lower than that
|
|
80
|
+
* call's full route-priced anchor; otherwise the complete envelope and
|
|
81
|
+
* surface are repriced.
|
|
82
|
+
*
|
|
83
|
+
* `requestHeader` replaces the latest logged envelope for pressure and node
|
|
84
|
+
* pricing; the node set always describes the current session surface. Every
|
|
85
|
+
* call clones those positional nodes, so measurement is O(surface).
|
|
86
|
+
*
|
|
87
|
+
* @param session - session to replay through its current durable tail.
|
|
88
|
+
* @param requestHeader - optional effective request envelope replacing the latest logged header.
|
|
89
|
+
* @returns a detached deeply immutable pressure and surface measurement.
|
|
90
|
+
*/
|
|
91
|
+
measure(session: Session, requestHeader?: EpochHeader): TokenMeasurement
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Heuristically price one model-visible message (instance face of the pure
|
|
95
|
+
* `estimateMessage` export from `estimate.ts`).
|
|
96
|
+
* @param message - message to price without mutation.
|
|
97
|
+
* @returns content and role-framing tokens under the fixed service heuristic.
|
|
98
|
+
*/
|
|
99
|
+
estimateMessage(message: Message): number
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Types: [EpochHeader](session.md) · [Message](llm-streaming.md) · [Session](session.md)
|
|
103
|
+
|
|
104
|
+
Source: [`packages/llm/token-meter/src/index.ts`](../../packages/llm/token-meter/src/index.ts)
|
|
105
|
+
<!-- END GENERATED cordis-surface -->
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Token 计量
|
|
2
|
+
|
|
3
|
+
[English](token-meter.md) | 中文
|
|
4
|
+
|
|
5
|
+
`@deepseek-ai/dsh-token-meter` 公开一个独立的回放快照,用于表示请求压力与按位置计算的表层定价。`logRevision` 表示生成该计量中每个字段时所消费的持久事件数量。
|
|
6
|
+
|
|
7
|
+
来源:[`packages/llm/token-meter/src/types.ts`](../../packages/llm/token-meter/src/types.ts)
|
|
8
|
+
|
|
9
|
+
## `TokenMeasurement`
|
|
10
|
+
|
|
11
|
+
```ts type-equiv
|
|
12
|
+
/** Detached immutable request-pressure and surface snapshot at one consumed log revision. */
|
|
13
|
+
interface TokenMeasurement {
|
|
14
|
+
/** Number of durable events consumed; equal to the next unread event seq. */
|
|
15
|
+
readonly logRevision: SessionLogOffset
|
|
16
|
+
/** Provider or heuristic anchor used for this measurement. */
|
|
17
|
+
readonly baseline: TokenMeasurementBaseline
|
|
18
|
+
/** Signed repricing of current surface content relative to the baseline anchor. */
|
|
19
|
+
readonly surfaceDeltaTokens: number
|
|
20
|
+
/** Non-negative current request-and-response pressure. */
|
|
21
|
+
readonly totalTokens: number
|
|
22
|
+
/** Total route-priced request tokens across the current surface; equals the sum of the node prices. */
|
|
23
|
+
readonly surfaceTokens: number
|
|
24
|
+
/** Current surface nodes in positional head-to-tail order. */
|
|
25
|
+
readonly nodes: readonly TokenSurfaceNode[]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
每次计量都会通过 `ctx.llm` 把生效信封的路由 provider/model 解析为该路由声明的请求图片定价,因此图片出现处按请求实际发送的视觉 token 加模型可见文本计价;未声明定价的路由与组合保持固定启发式规则。`baseline.kind === 'usage'` 表示最近一次成功的提供方调用具有相同的规范请求 envelope,且该调用的总量不低于其完整路由定价锚点。`estimated` 表示不存在可复用的保守 usage 锚点,因此服务自行对完整信封和表层定价。后续成功请求会替换早先的锚点;有符号的 `surfaceDeltaTokens` 会保留相对于匹配锚点的增长与缩减,且两侧按同一路由重新定价。`totalTokens` 仍表示请求与响应压力,`surfaceTokens` 则是表层的路由定价总量,等于所有节点价格之和。
|
|
30
|
+
|
|
31
|
+
## `TokenSurfaceNode`
|
|
32
|
+
|
|
33
|
+
```ts type-equiv
|
|
34
|
+
/** One token-priced node in the current ordered session surface. */
|
|
35
|
+
interface TokenSurfaceNode {
|
|
36
|
+
/** Durable sequence number of the surface event. */
|
|
37
|
+
readonly seq: SessionSeq
|
|
38
|
+
/**
|
|
39
|
+
* Request-pressure tokens for the exact message projected by this node under
|
|
40
|
+
* the measured route: image occurrences carry the route's declared visual
|
|
41
|
+
* price when the routed adapter declares one, and the fixed heuristic
|
|
42
|
+
* otherwise. Trigger, retention, and range selection all read this price.
|
|
43
|
+
*/
|
|
44
|
+
readonly tokens: number
|
|
45
|
+
/**
|
|
46
|
+
* Fixed-heuristic tokens for the same message, independent of any route.
|
|
47
|
+
* The shadow-price protocol prices replacements with this value so the O(1)
|
|
48
|
+
* projection fold stays in agreement with its own appends.
|
|
49
|
+
*/
|
|
50
|
+
readonly heuristicTokens: number
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
表层顺序具有权威性;替换节点的持久 seq 可能高于位置排在其后的节点。该快照不可变,不会随底层回放折叠推进而增长。
|
|
55
|
+
|
|
56
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
57
|
+
|
|
58
|
+
<a id="cordis-surface"></a>
|
|
59
|
+
|
|
60
|
+
## Cordis API
|
|
61
|
+
|
|
62
|
+
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).
|
|
63
|
+
|
|
64
|
+
<a id="ctxtokenmeter--tokenmeter"></a>
|
|
65
|
+
|
|
66
|
+
### `ctx.tokenMeter` — `TokenMeter`
|
|
67
|
+
|
|
68
|
+
Replay owner for one service-wide estimator and isolated per-session folds.
|
|
69
|
+
|
|
70
|
+
```ts cordis-catalog
|
|
71
|
+
/**
|
|
72
|
+
* Measure current request pressure and surface through the durable tail.
|
|
73
|
+
*
|
|
74
|
+
* The effective envelope's routed provider/model selects the request-image
|
|
75
|
+
* pricing every node is priced under: a route whose adapter declares image
|
|
76
|
+
* pricing charges each retained image its visual tokens plus its
|
|
77
|
+
* model-visible text, while other routes keep the fixed heuristic. Provider
|
|
78
|
+
* usage is reused only when the latest successful call's canonical request
|
|
79
|
+
* envelope matches `requestHeader` and its total is no lower than that
|
|
80
|
+
* call's full route-priced anchor; otherwise the complete envelope and
|
|
81
|
+
* surface are repriced.
|
|
82
|
+
*
|
|
83
|
+
* `requestHeader` replaces the latest logged envelope for pressure and node
|
|
84
|
+
* pricing; the node set always describes the current session surface. Every
|
|
85
|
+
* call clones those positional nodes, so measurement is O(surface).
|
|
86
|
+
*
|
|
87
|
+
* @param session - session to replay through its current durable tail.
|
|
88
|
+
* @param requestHeader - optional effective request envelope replacing the latest logged header.
|
|
89
|
+
* @returns a detached deeply immutable pressure and surface measurement.
|
|
90
|
+
*/
|
|
91
|
+
measure(session: Session, requestHeader?: EpochHeader): TokenMeasurement
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Heuristically price one model-visible message (instance face of the pure
|
|
95
|
+
* `estimateMessage` export from `estimate.ts`).
|
|
96
|
+
* @param message - message to price without mutation.
|
|
97
|
+
* @returns content and role-framing tokens under the fixed service heuristic.
|
|
98
|
+
*/
|
|
99
|
+
estimateMessage(message: Message): number
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Types: [EpochHeader](session.zh.md) · [Message](llm-streaming.zh.md) · [Session](session.zh.md)
|
|
103
|
+
|
|
104
|
+
Source: [`packages/llm/token-meter/src/index.ts`](../../packages/llm/token-meter/src/index.ts)
|
|
105
|
+
<!-- END GENERATED cordis-surface -->
|