dsh-plugin-dev-kb 1.4.0 → 1.5.2
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/CHANGELOG.md +25 -0
- package/README.en.md +6 -6
- package/README.md +10 -5
- package/kb/INDEX.md +8 -4
- package/kb/extra/AGENTS.md +4 -3
- package/kb/extra/agent-lifecycle.md +91 -0
- package/kb/extra/agent-lifecycle.zh.md +93 -0
- package/kb/extra/api-gateway.md +172 -0
- package/kb/extra/api-gateway.zh.md +178 -0
- package/kb/extra/architecture.md +165 -0
- package/kb/extra/architecture.zh.md +169 -0
- package/kb/extra/capability-seams.md +714 -0
- package/kb/extra/capability-seams.zh.md +716 -0
- package/kb/extra/cli-help.md +203 -0
- package/kb/extra/cli-help.zh.md +205 -0
- package/kb/extra/config-catalog.md +4801 -0
- package/kb/extra/config-catalog.zh.md +4803 -0
- package/kb/extra/cookbook/adding-a-package.md +170 -0
- package/kb/extra/cookbook/adding-a-package.zh.md +170 -0
- package/kb/extra/cookbook/adding-a-plugin-preview.md +52 -0
- package/kb/extra/cookbook/adding-a-plugin-preview.zh.md +52 -0
- package/kb/extra/cookbook/adding-a-session-format-version.md +7 -5
- package/kb/extra/cookbook/adding-a-session-format-version.zh.md +7 -5
- package/kb/extra/cookbook/adding-a-settings-card.md +72 -0
- package/kb/extra/cookbook/adding-a-settings-card.zh.md +72 -0
- package/kb/extra/cookbook/adding-a-tool.md +101 -0
- package/kb/extra/cookbook/adding-a-tool.zh.md +103 -0
- package/kb/extra/cookbook/adding-an-llm-adapter.md +43 -0
- package/kb/extra/cookbook/adding-an-llm-adapter.zh.md +43 -0
- package/kb/extra/cookbook/extension-cookbook.md +132 -0
- package/kb/extra/cookbook/extension-cookbook.zh.md +136 -0
- package/kb/extra/cookbook/reviewing-persistence-type-changes.md +11 -9
- package/kb/extra/cookbook/reviewing-persistence-type-changes.zh.md +11 -9
- package/kb/extra/cordis-api/context.md +364 -0
- package/kb/extra/cordis-api/context.zh.md +366 -0
- package/kb/extra/cordis-api/events.md +207 -0
- package/kb/extra/cordis-api/events.zh.md +209 -0
- package/kb/extra/cordis-api/fiber.md +375 -0
- package/kb/extra/cordis-api/fiber.zh.md +377 -0
- package/kb/extra/cordis-api/inherited.md +38 -0
- package/kb/extra/cordis-api/registry.md +152 -0
- package/kb/extra/cordis-api/registry.zh.md +154 -0
- package/kb/extra/cordis-api/service.md +102 -0
- package/kb/extra/cordis-api/service.zh.md +104 -0
- package/kb/extra/cordis-tutorial/01-first-plugin.md +95 -0
- package/kb/extra/cordis-tutorial/01-first-plugin.zh.md +95 -0
- package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.md +98 -0
- package/kb/extra/cordis-tutorial/02-lifecycle-and-effects.zh.md +98 -0
- package/kb/extra/cordis-tutorial/03-services.md +98 -0
- package/kb/extra/cordis-tutorial/03-services.zh.md +98 -0
- package/kb/extra/cordis-tutorial/04-events.md +144 -0
- package/kb/extra/cordis-tutorial/04-events.zh.md +144 -0
- package/kb/extra/cordis-tutorial/05-config.md +111 -0
- package/kb/extra/cordis-tutorial/05-config.zh.md +111 -0
- package/kb/extra/cordis-tutorial/06-composition-and-hmr.md +113 -0
- package/kb/extra/cordis-tutorial/06-composition-and-hmr.zh.md +113 -0
- package/kb/extra/cordis-tutorial/07-into-the-harness.md +108 -0
- package/kb/extra/cordis-tutorial/07-into-the-harness.zh.md +108 -0
- package/kb/extra/cordis-tutorial/index.md +60 -0
- package/kb/extra/cordis-tutorial/index.zh.md +62 -0
- package/kb/extra/deepseek-llm-api-wire-extensions.md +5 -5
- package/kb/extra/deepseek-llm-api-wire-extensions.zh.md +5 -5
- package/kb/extra/defensive-patterns/README.md +25 -0
- package/kb/extra/defensive-patterns/README.zh.md +27 -0
- package/kb/extra/defensive-patterns/client-components.md +493 -0
- package/kb/extra/defensive-patterns/client-components.zh.md +495 -0
- package/kb/extra/defensive-patterns/conversation-and-session.md +316 -0
- package/kb/extra/defensive-patterns/conversation-and-session.zh.md +316 -0
- package/kb/extra/defensive-patterns/general.md +222 -0
- package/kb/extra/defensive-patterns/general.zh.md +252 -0
- package/kb/extra/defensive-patterns/package-surface.md +231 -0
- package/kb/extra/defensive-patterns/package-surface.zh.md +231 -0
- package/kb/extra/defensive-patterns/remote-and-api.md +115 -0
- package/kb/extra/defensive-patterns/remote-and-api.zh.md +115 -0
- package/kb/extra/development.md +31 -11
- package/kb/extra/development.zh.md +32 -11
- package/kb/extra/event-producer-consumer.md +40 -39
- package/kb/extra/event-producer-consumer.zh.md +40 -39
- package/kb/extra/experimental-persistence-catalog.md +17 -0
- package/kb/extra/experimental-persistence-catalog.zh.md +17 -0
- package/kb/extra/glossary.md +1 -0
- package/kb/extra/glossary.zh.md +1 -0
- package/kb/extra/i18n/style-samples.md +2 -2
- package/kb/extra/i18n/terminology.md +1 -0
- package/kb/extra/module-graph.md +274 -195
- package/kb/extra/module-graph.zh.md +274 -195
- package/kb/extra/persistence-catalog.md +9140 -0
- package/kb/extra/persistence-catalog.zh.md +9142 -0
- package/kb/extra/persistence-changes/2026-09-13-working-directory.md +48 -0
- package/kb/extra/persistence-changes/2026-09-13-working-directory.zh.md +48 -0
- package/kb/extra/persistence-changes/2026-09-16-session-format-v4.md +2 -2
- package/kb/extra/persistence-changes/2026-09-16-session-format-v4.zh.md +2 -2
- package/kb/extra/persistence-changes/2026-09-19-external-subagent-catalog.md +48 -0
- package/kb/extra/persistence-changes/2026-09-19-external-subagent-catalog.zh.md +48 -0
- package/kb/extra/persistence-changes/2026-09-30-job-session-lifecycle.md +52 -0
- package/kb/extra/persistence-changes/2026-09-30-job-session-lifecycle.zh.md +52 -0
- package/kb/extra/persistence-changes/2026-10-05-ptc-operation-metadata.md +48 -0
- package/kb/extra/persistence-changes/2026-10-05-ptc-operation-metadata.zh.md +48 -0
- package/kb/extra/persistence-changes/2026-10-05-working-directory-attribution.md +60 -0
- package/kb/extra/persistence-changes/2026-10-05-working-directory-attribution.zh.md +60 -0
- package/kb/extra/persistence-changes/2026-10-07-title-reasoning-effort.md +48 -0
- package/kb/extra/persistence-changes/2026-10-07-title-reasoning-effort.zh.md +48 -0
- package/kb/extra/persistence-changes/2026-10-13-deepseek-search-thinking.md +48 -0
- package/kb/extra/persistence-changes/2026-10-13-deepseek-search-thinking.zh.md +48 -0
- package/kb/extra/persistence-changes/2026-10-13-user-rpc-principal.md +60 -0
- package/kb/extra/persistence-changes/2026-10-13-user-rpc-principal.zh.md +60 -0
- package/kb/extra/persistence-changes/README.md +12 -10
- package/kb/extra/persistence-changes/README.zh.md +12 -10
- package/kb/extra/persistence-changes/historical-formats/README.md +1 -1
- package/kb/extra/persistence-changes/historical-formats/README.zh.md +1 -1
- package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.2.md +50 -50
- package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.2.zh.md +50 -50
- package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.3.md +14 -14
- package/kb/extra/persistence-changes/releases/dsh-v0.0.1-rc.3.zh.md +14 -14
- package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.7.md +3 -3
- package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.7.zh.md +3 -3
- package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.8.md +10 -10
- package/kb/extra/persistence-changes/releases/dsh-v0.1.0-rc.8.zh.md +10 -10
- package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.1.md +3 -3
- package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.1.zh.md +3 -3
- package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.2.md +13 -13
- package/kb/extra/persistence-changes/releases/dsh-v0.1.1-rc.2.zh.md +13 -13
- package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.1.md +63 -63
- package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.1.zh.md +63 -63
- package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.2.md +54 -54
- package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.2.zh.md +54 -54
- package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.4.md +7 -7
- package/kb/extra/persistence-changes/releases/dsh-v0.1.2-alpha.4.zh.md +7 -7
- package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.1.md +27 -27
- package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.1.zh.md +27 -27
- package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.2.md +4 -4
- package/kb/extra/persistence-changes/releases/dsh-v0.1.3-alpha.2.zh.md +4 -4
- package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.1.md +27 -27
- package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.1.zh.md +27 -27
- package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.2.md +7 -7
- package/kb/extra/persistence-changes/releases/dsh-v0.1.5-alpha.2.zh.md +7 -7
- package/kb/extra/session-format-status.md +6 -6
- package/kb/extra/session-format-status.zh.md +6 -6
- package/kb/extra/subsystems/README.md +76 -0
- package/kb/extra/subsystems/README.zh.md +76 -0
- package/kb/extra/subsystems/agent-team.md +10 -10
- package/kb/extra/subsystems/agent-team.zh.md +10 -10
- package/kb/extra/subsystems/approval.md +170 -0
- package/kb/extra/subsystems/approval.zh.md +170 -0
- package/kb/extra/subsystems/boot.md +128 -4
- package/kb/extra/subsystems/boot.zh.md +128 -4
- package/kb/extra/subsystems/claude-code-mods.md +1 -1
- package/kb/extra/subsystems/claude-code-mods.zh.md +1 -1
- package/kb/extra/subsystems/client-modules.md +198 -0
- package/kb/extra/subsystems/client-modules.zh.md +198 -0
- package/kb/extra/subsystems/client-resources.md +92 -0
- package/kb/extra/subsystems/client-resources.zh.md +92 -0
- package/kb/extra/subsystems/commands.md +223 -0
- package/kb/extra/subsystems/commands.zh.md +223 -0
- package/kb/extra/subsystems/compaction.md +284 -0
- package/kb/extra/subsystems/compaction.zh.md +284 -0
- package/kb/extra/subsystems/computer-use.md +3 -0
- package/kb/extra/subsystems/computer-use.zh.md +3 -0
- package/kb/extra/subsystems/conversation.md +301 -0
- package/kb/extra/subsystems/conversation.zh.md +303 -0
- package/kb/extra/subsystems/core.md +1113 -0
- package/kb/extra/subsystems/core.zh.md +1125 -0
- package/kb/extra/subsystems/credentials.md +493 -0
- package/kb/extra/subsystems/credentials.zh.md +493 -0
- package/kb/extra/subsystems/filesystem.md +530 -0
- package/kb/extra/subsystems/filesystem.zh.md +530 -0
- package/kb/extra/subsystems/goal.md +313 -0
- package/kb/extra/subsystems/goal.zh.md +313 -0
- package/kb/extra/subsystems/jobs.md +554 -0
- package/kb/extra/subsystems/jobs.zh.md +554 -0
- package/kb/extra/subsystems/llm-streaming.md +1196 -0
- package/kb/extra/subsystems/llm-streaming.zh.md +1202 -0
- package/kb/extra/subsystems/lsp.md +202 -0
- package/kb/extra/subsystems/lsp.zh.md +202 -0
- package/kb/extra/subsystems/permission-presets.md +167 -0
- package/kb/extra/subsystems/permission-presets.zh.md +167 -0
- package/kb/extra/subsystems/persistence.md +418 -0
- package/kb/extra/subsystems/persistence.zh.md +418 -0
- package/kb/extra/subsystems/plan.md +87 -0
- package/kb/extra/subsystems/plan.zh.md +87 -0
- package/kb/extra/subsystems/product-telemetry.md +4 -2
- package/kb/extra/subsystems/product-telemetry.zh.md +4 -2
- package/kb/extra/subsystems/ptc-runtime.md +250 -0
- package/kb/extra/subsystems/ptc-runtime.zh.md +250 -0
- package/kb/extra/subsystems/sandbox.md +221 -0
- package/kb/extra/subsystems/sandbox.zh.md +221 -0
- package/kb/extra/subsystems/schedule.md +550 -0
- package/kb/extra/subsystems/schedule.zh.md +550 -0
- package/kb/extra/subsystems/scope.md +59 -0
- package/kb/extra/subsystems/scope.zh.md +61 -0
- package/kb/extra/subsystems/session-projection.md +356 -0
- package/kb/extra/subsystems/session-projection.zh.md +356 -0
- package/kb/extra/subsystems/session-query.md +511 -0
- package/kb/extra/subsystems/session-query.zh.md +511 -0
- package/kb/extra/subsystems/session-reference.md +224 -0
- package/kb/extra/subsystems/session-reference.zh.md +224 -0
- package/kb/extra/subsystems/session-telemetry.md +212 -0
- package/kb/extra/subsystems/session-telemetry.zh.md +212 -0
- package/kb/extra/subsystems/session-title.md +213 -0
- package/kb/extra/subsystems/session-title.zh.md +213 -0
- package/kb/extra/subsystems/session.md +1339 -0
- package/kb/extra/subsystems/session.zh.md +1343 -0
- package/kb/extra/subsystems/settings.md +155 -0
- package/kb/extra/subsystems/settings.zh.md +155 -0
- package/kb/extra/subsystems/shell.md +314 -0
- package/kb/extra/subsystems/shell.zh.md +314 -0
- package/kb/extra/subsystems/sidebar-right.md +160 -0
- package/kb/extra/subsystems/sidebar-right.zh.md +160 -0
- package/kb/extra/subsystems/skills.md +352 -0
- package/kb/extra/subsystems/skills.zh.md +352 -0
- package/kb/extra/subsystems/slots.md +200 -0
- package/kb/extra/subsystems/slots.zh.md +204 -0
- package/kb/extra/subsystems/spill.md +124 -0
- package/kb/extra/subsystems/spill.zh.md +124 -0
- package/kb/extra/subsystems/ssh.md +22 -11
- package/kb/extra/subsystems/ssh.zh.md +22 -11
- package/kb/extra/subsystems/storage.md +259 -0
- package/kb/extra/subsystems/storage.zh.md +259 -0
- package/kb/extra/subsystems/subagent.md +686 -0
- package/kb/extra/subsystems/subagent.zh.md +688 -0
- package/kb/extra/subsystems/subprocess.md +321 -0
- package/kb/extra/subsystems/subprocess.zh.md +321 -0
- package/kb/extra/subsystems/system-prompt.md +254 -0
- package/kb/extra/subsystems/system-prompt.zh.md +254 -0
- package/kb/extra/subsystems/terminal.md +184 -0
- package/kb/extra/subsystems/terminal.zh.md +184 -0
- package/kb/extra/subsystems/token-meter.md +106 -0
- package/kb/extra/subsystems/token-meter.zh.md +106 -0
- package/kb/extra/subsystems/tools.md +747 -0
- package/kb/extra/subsystems/tools.zh.md +747 -0
- package/kb/extra/subsystems/translation.md +103 -0
- package/kb/extra/subsystems/translation.zh.md +103 -0
- package/kb/extra/subsystems/typert.md +690 -0
- package/kb/extra/subsystems/typert.zh.md +690 -0
- package/kb/extra/subsystems/user-questions.md +307 -0
- package/kb/extra/subsystems/user-questions.zh.md +307 -0
- package/kb/extra/subsystems/web-client.md +100 -0
- package/kb/extra/subsystems/web-client.zh.md +100 -0
- package/kb/extra/subsystems/web-server.md +302 -0
- package/kb/extra/subsystems/web-server.zh.md +302 -0
- package/kb/extra/subsystems/web.md +206 -0
- package/kb/extra/subsystems/web.zh.md +206 -0
- package/kb/extra/subsystems/webhook.md +1 -1
- package/kb/extra/subsystems/webhook.zh.md +1 -1
- package/kb/extra/subsystems/workflow.md +278 -0
- package/kb/extra/subsystems/workflow.zh.md +278 -0
- package/kb/extra/subsystems/working-directory.md +64 -0
- package/kb/extra/subsystems/working-directory.zh.md +64 -0
- package/kb/extra/subsystems/workspace.md +647 -0
- package/kb/extra/subsystems/workspace.zh.md +647 -0
- package/kb/extra/subsystems/worktrees.md +76 -0
- package/kb/extra/subsystems/worktrees.zh.md +76 -0
- package/kb/extra/testing.md +1 -1
- package/kb/extra/testing.zh.md +1 -1
- package/kb/extra/tool-catalog.md +2824 -0
- package/kb/extra/tool-catalog.zh.md +2832 -0
- package/kb/extra/tool-execution-pipeline.md +65 -0
- package/kb/extra/tool-execution-pipeline.zh.md +67 -0
- package/kb/extra/ui-radius.md +6 -4
- package/kb/extra/ui-radius.zh.md +6 -4
- package/kb/extra/upgrade-guide/v0.2.0-rc.2/bundled-python-tests/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.0-rc.2/bundled-python-tests/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.0-rc.2/primary-runtime-python-aliases/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.0-rc.2/primary-runtime-python-aliases/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/deepseek-model-discovery/guide.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/deepseek-model-discovery/guide.zh.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/desktop-test-auth-popup/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/desktop-test-auth-popup/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/experimental-package-composition/guide.md +28 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/experimental-package-composition/guide.zh.md +28 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/instruction-home-override/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/instruction-home-override/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/job-id-identity/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/job-id-identity/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/jsonl-persistence-plugin/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/jsonl-persistence-plugin/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/mock-messages-events/guide.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/mock-messages-events/guide.zh.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/native-subagent-bundle-tools/guide.md +31 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/native-subagent-bundle-tools/guide.zh.md +31 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/new-session-generations/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/new-session-generations/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/plugin-option-placement/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/plugin-option-placement/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-optional-resources/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-optional-resources/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/python-ptc-sandbox/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-adapters/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-adapters/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-provider-strategy/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/session-title-provider-strategy/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/ssh-helper-launch/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/ssh-helper-launch/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-activations/guide.md +59 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-activations/guide.zh.md +59 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-preset-composition/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/subagent-preset-composition/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/team-direct-inbox/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/terminal-command-labels/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/terminal-command-labels/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/tool-presentation-mode/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/tool-presentation-mode/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/web-listener-trust-config/guide.md +36 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/web-listener-trust-config/guide.zh.md +36 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/working-directory/guide.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.1/working-directory/guide.zh.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-identity-watch/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-identity-watch/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-model-catalog/guide.md +27 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/deepseek-account-model-catalog/guide.zh.md +27 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/desktop-font-size-shortcuts/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/desktop-font-size-shortcuts/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/from-default-profile-replaces-target/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/from-default-profile-replaces-target/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/operator-connect/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/operator-connect/guide.zh.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-azure-provider/guide.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-azure-provider/guide.zh.md +19 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-model-discovery/guide.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/pi-ai-model-discovery/guide.zh.md +17 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-install-over-installed/guide.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/plugin-install-over-installed/guide.zh.md +20 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/sdk-minimal-image-compaction/guide.md +32 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/sdk-minimal-image-compaction/guide.zh.md +32 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/stored-credentials-precedence/guide.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.2/stored-credentials-precedence/guide.zh.md +25 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.3/plugin-engines-dsh/guide.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.3/plugin-engines-dsh/guide.zh.md +21 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.4/account-notification-fields/guide.md +18 -0
- package/kb/extra/upgrade-guide/v0.2.1-alpha.4/account-notification-fields/guide.zh.md +18 -0
- package/kb/meta/search-index.json +1932 -366
- package/kb/meta/source.json +9 -8
- package/kb/site/develop/basic/publish.md +3 -1
- package/kb/site/en/develop/basic/publish.md +3 -1
- package/kb/site/en/guide/github-review.md +7 -10
- package/kb/site/en/guide/plugin-market.md +151 -0
- package/kb/site/en/guide/providers.md +27 -4
- package/kb/site/en/guide/public-deployments.md +10 -6
- package/kb/site/en/guide/python-sdk.md +8 -9
- package/kb/site/en/reference/api-gateway.md +10 -3
- package/kb/site/en/reference/capability-seams.md +71 -24
- package/kb/site/en/reference/config-catalog.md +452 -191
- package/kb/site/en/reference/experimental-persistence-catalog.md +20 -0
- package/kb/site/en/reference/index.md +11 -12
- package/kb/site/en/reference/persistence-catalog.md +552 -192
- package/kb/site/en/reference/subsystems/client-modules.md +14 -0
- package/kb/site/en/reference/subsystems/conversation.md +14 -0
- package/kb/site/en/reference/subsystems/core.md +3 -1
- package/kb/site/en/reference/subsystems/credentials.md +13 -12
- package/kb/site/en/reference/subsystems/index.md +4 -1
- package/kb/site/en/reference/subsystems/jobs.md +62 -7
- package/kb/site/en/reference/subsystems/llm-streaming.md +82 -15
- package/kb/site/en/reference/subsystems/persistence.md +2 -0
- package/kb/site/en/reference/subsystems/plan.md +1 -1
- package/kb/site/en/reference/subsystems/ptc-runtime.md +24 -6
- package/kb/site/en/reference/subsystems/session-query.md +2 -0
- package/kb/site/en/reference/subsystems/session-title.md +14 -5
- package/kb/site/en/reference/subsystems/session.md +59 -14
- package/kb/site/en/reference/subsystems/sidebar-right.md +2 -0
- package/kb/site/en/reference/subsystems/skills.md +2 -2
- package/kb/site/en/reference/subsystems/slots.md +80 -83
- package/kb/site/en/reference/subsystems/subagent.md +175 -247
- package/kb/site/en/reference/subsystems/system-prompt.md +32 -2
- package/kb/site/en/reference/subsystems/tools.md +3 -3
- package/kb/site/en/reference/subsystems/typert.md +222 -17
- package/kb/site/en/reference/subsystems/web-client.md +1 -1
- package/kb/site/en/reference/subsystems/web-server.md +87 -11
- package/kb/site/en/reference/subsystems/web.md +2 -2
- package/kb/site/en/reference/subsystems/workflow.md +1 -1
- package/kb/site/en/reference/subsystems/workspace.md +25 -37
- package/kb/site/en/reference/tool-catalog.md +156 -51
- package/kb/site/guide/github-review.md +7 -10
- package/kb/site/guide/plugin-market.md +151 -0
- package/kb/site/guide/providers.md +27 -4
- package/kb/site/guide/public-deployments.md +10 -6
- package/kb/site/guide/python-sdk.md +8 -9
- package/kb/site/reference/api-gateway.md +16 -3
- package/kb/site/reference/capability-seams.md +71 -24
- package/kb/site/reference/config-catalog.md +452 -191
- package/kb/site/reference/experimental-persistence-catalog.md +20 -0
- package/kb/site/reference/index.md +11 -12
- package/kb/site/reference/persistence-catalog.md +552 -192
- package/kb/site/reference/subsystems/client-modules.md +14 -0
- package/kb/site/reference/subsystems/conversation.md +16 -0
- package/kb/site/reference/subsystems/core.md +5 -1
- package/kb/site/reference/subsystems/credentials.md +13 -12
- package/kb/site/reference/subsystems/index.md +4 -1
- package/kb/site/reference/subsystems/jobs.md +62 -7
- package/kb/site/reference/subsystems/llm-streaming.md +82 -15
- package/kb/site/reference/subsystems/persistence.md +2 -0
- package/kb/site/reference/subsystems/plan.md +1 -1
- package/kb/site/reference/subsystems/ptc-runtime.md +24 -6
- package/kb/site/reference/subsystems/scope.md +2 -0
- package/kb/site/reference/subsystems/session-query.md +2 -0
- package/kb/site/reference/subsystems/session-title.md +14 -5
- package/kb/site/reference/subsystems/session.md +59 -14
- package/kb/site/reference/subsystems/sidebar-right.md +2 -0
- package/kb/site/reference/subsystems/skills.md +2 -2
- package/kb/site/reference/subsystems/slots.md +84 -83
- package/kb/site/reference/subsystems/subagent.md +177 -251
- package/kb/site/reference/subsystems/system-prompt.md +32 -2
- package/kb/site/reference/subsystems/tools.md +3 -3
- package/kb/site/reference/subsystems/typert.md +222 -17
- package/kb/site/reference/subsystems/web-client.md +1 -1
- package/kb/site/reference/subsystems/web-server.md +87 -11
- package/kb/site/reference/subsystems/web.md +2 -2
- package/kb/site/reference/subsystems/workflow.md +1 -1
- package/kb/site/reference/subsystems/workspace.md +25 -37
- package/kb/site/reference/tool-catalog.md +160 -55
- package/package.json +2 -2
- package/skills/dsh-dev-sandbox.md +70 -0
- package/kb/extra/defensive-patterns.md +0 -33
- package/kb/extra/defensive-patterns.zh.md +0 -35
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](product-telemetry.md) | 中文
|
|
4
4
|
|
|
5
|
-
[产品埋点插件](../../packages/host/product-telemetry-otel/README.zh.md) 通过 OTLP/HTTP 发送明确选定的分析事件。`productTelemetry` 服务仅负责提交;产品消费方决定事件发生时机与获准采集的字段。导出器不自动采集 Session 数据或标识。[桌面埋点消费方](../../packages/client/product-analytics/README.zh.md)
|
|
5
|
+
[产品埋点插件](../../packages/host/product-telemetry-otel/README.zh.md) 通过 OTLP/HTTP 发送明确选定的分析事件。`productTelemetry` 服务仅负责提交;产品消费方决定事件发生时机与获准采集的字段。导出器不自动采集 Session 数据或标识。[桌面埋点消费方](../../packages/client/product-analytics/README.zh.md)选择交互与实时压缩事件,补充缓存的静态环境和可用的登录身份,并遵守桌面启动时的采集开关。普通 Web 客户端不采集产品事件。
|
|
6
6
|
|
|
7
7
|
`ProductTelemetryRecord` 要求事件名称、字符串 body 和 Unix 毫秒时间戳。属性接受字符串、数字、布尔标量,以及这些值组成的单层对象(`ProductTelemetryScalar`)。可选的严重程度使用 OTel 严重程度数字,默认为 INFO。记录入队时填写观测时间。
|
|
8
8
|
|
|
@@ -51,7 +51,9 @@ Authenticated event intake; disabled instances do not inspect identity or accept
|
|
|
51
51
|
@Remote({ mode: 'stream' }) async *watchPolicy(signal: AbortSignal): AsyncIterable<boolean>
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
* Submit selected Desktop fields
|
|
54
|
+
* Submit selected Desktop fields with cached static environment and fresh identity.
|
|
55
|
+
* The first intake waits for bounded environment queries; concurrent intakes share them.
|
|
56
|
+
* Missing identity is omitted; failed environment fields carry fixed reasons.
|
|
55
57
|
* @param event - typed product event without message contents or credentials.
|
|
56
58
|
* @returns after local submission; no delivery or warehouse acknowledgement.
|
|
57
59
|
*/
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# PTC runtime
|
|
2
|
+
|
|
3
|
+
English | [中文](ptc-runtime.zh.md)
|
|
4
|
+
|
|
5
|
+
The PTC execution [capability seam](../../.agents/notes/implemented/architecture/2026-06-13-capability-seams.md) supplies `ctx.ptcRuntime` through [dsh-ptc-runtime](../../packages/ptc-runtime/ptc-runtime). It runs one program against host bindings and reports output, failure and applicable sandbox facts. PTC execution is optional rather than part of [the agent-loop spine](core.md). The [PTC foundation](../../.agents/notes/implemented/feature/2026-06-15-ptc.md) owns registry presentation, the [typed-return contract](../../.agents/notes/implemented/feature/2026-07-20-ptc-typed-tool-returns.md) owns binding values, and the [sandboxed Node decision](../../.agents/notes/implemented/architecture/2026-09-11-sandboxed-node-ptc-runtime.md) owns the shipped execution provider.
|
|
6
|
+
|
|
7
|
+
Source: [`packages/ptc-runtime/ptc-runtime/src/types.ts`](../../packages/ptc-runtime/ptc-runtime/src/types.ts)
|
|
8
|
+
|
|
9
|
+
## The run: request in, result out
|
|
10
|
+
|
|
11
|
+
`PtcRunRequest` contains the program, bindings, cancellation and optional execution choices. The provider's `resolve` validates supported choices and applies its deployment defaults; `run` receives a `PtcRunSpec` with an explicit directory and deadline choice. An omitted timeout uses provider defaults, a number requests a capped elapsed budget, and `null` requests no elapsed deadline. Providers reject unsupported choices before execution:
|
|
12
|
+
|
|
13
|
+
```ts type-equiv
|
|
14
|
+
/**
|
|
15
|
+
* Caller inputs for one program. The provider's resolve method validates supported
|
|
16
|
+
* options and supplies directory, deadline, and authority before execution.
|
|
17
|
+
*/
|
|
18
|
+
interface PtcRunRequest {
|
|
19
|
+
/**
|
|
20
|
+
* The program source, in the runtime's {@link ../index.ts | language}. It
|
|
21
|
+
* follows the provider's programFormat: an async function body supports
|
|
22
|
+
* top-level `await` and `return`; a REPL supports top-level declarations,
|
|
23
|
+
* `await`, and a final expression. The completion value becomes
|
|
24
|
+
* {@link PtcRunResult.value}.
|
|
25
|
+
*/
|
|
26
|
+
program: string
|
|
27
|
+
/**
|
|
28
|
+
* Object-identity owner for optional in-memory state. Omission requests a fresh
|
|
29
|
+
* environment. Consumers must await runtime.release(owner) when the owner ends.
|
|
30
|
+
* Stateless providers ignore this field; retained state is never durable.
|
|
31
|
+
*/
|
|
32
|
+
stateOwner?: object
|
|
33
|
+
/** Host functions exposed to the program, one global object per namespace. */
|
|
34
|
+
bindings: PtcBindingNamespace[]
|
|
35
|
+
/** Working directory in the mounted filesystem and subprocess execution world. */
|
|
36
|
+
cwd?: string
|
|
37
|
+
/**
|
|
38
|
+
* Elapsed execution budget in milliseconds. Omission uses provider defaults;
|
|
39
|
+
* null requests no deadline. Providers validate and cap numeric budgets or reject unsupported choices.
|
|
40
|
+
*/
|
|
41
|
+
timeoutMs?: number | null
|
|
42
|
+
/** Resolved authority for this execution. Providers without confinement reject an explicit policy. */
|
|
43
|
+
sandboxPolicy?: SandboxExecutionPolicy
|
|
44
|
+
/**
|
|
45
|
+
* Abort the run: the runtime stops the program (hard, even mid-loop) and
|
|
46
|
+
* resolves with a {@link PtcRunFailure} of kind `'abort'`. In-flight
|
|
47
|
+
* binding calls are the CALLER's to settle — the runtime only stops asking.
|
|
48
|
+
*/
|
|
49
|
+
signal?: AbortSignal
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```ts type-equiv
|
|
54
|
+
/** Fully resolved execution inputs; run never supplies a missing directory or deadline choice. */
|
|
55
|
+
interface PtcRunSpec extends PtcRunRequest {
|
|
56
|
+
/** Absolute directory in the provider's execution world. */
|
|
57
|
+
cwd: string
|
|
58
|
+
/** Positive finite elapsed budget in milliseconds after provider capping, or null for no deadline. */
|
|
59
|
+
timeoutMs: number | null
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```ts type-equiv
|
|
64
|
+
/** File confinement applied to a program, independently of its terminal outcome. */
|
|
65
|
+
interface PtcRunSandbox {
|
|
66
|
+
/** File-effect mode used for this execution. */
|
|
67
|
+
mode: SandboxMode
|
|
68
|
+
/** Program failure text matched backend diagnostics; not enforcement proof or an exhaustive denial record. */
|
|
69
|
+
denied: boolean
|
|
70
|
+
/** Completeness reported by the selected confining backend; absent for full access. */
|
|
71
|
+
enforcement?: SandboxEnforcement
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Program failures resolve through `PtcRunResult.error`; invalid caller inputs may reject before execution. Sandbox mode, observed denial and enforcement completeness are separate facts, so a successful program does not by itself prove that every requested restriction was enforced:
|
|
76
|
+
|
|
77
|
+
```ts type-equiv
|
|
78
|
+
/**
|
|
79
|
+
* The outcome of one run. An error is a FIELD on a resolved result, never a
|
|
80
|
+
* rejection of `run()` — reporting a failed program is the caller's job, not
|
|
81
|
+
* an exception path.
|
|
82
|
+
*/
|
|
83
|
+
interface PtcRunResult {
|
|
84
|
+
/** Applied file policy and observed denial, when the provider enforces file policy. */
|
|
85
|
+
sandbox?: PtcRunSandbox
|
|
86
|
+
/**
|
|
87
|
+
* The program's completion value (a return or final REPL expression), when it ran to
|
|
88
|
+
* completion and the value crossed the runtime's lossless-JSON boundary.
|
|
89
|
+
* Invalid or over-limit completions fail the run instead of substituting a
|
|
90
|
+
* rendered string; a failed or value-less run leaves this absent.
|
|
91
|
+
*/
|
|
92
|
+
value?: PtcJsonValue
|
|
93
|
+
/**
|
|
94
|
+
* Captured text. Each source channel preserves emission order; interleaving
|
|
95
|
+
* across independent channels is backend-dependent. Bounded only as part of
|
|
96
|
+
* the outer result.
|
|
97
|
+
*/
|
|
98
|
+
logs: string[]
|
|
99
|
+
/** Present iff the run failed; see {@link PtcRunFailure} for the taxonomy. */
|
|
100
|
+
error?: PtcRunFailure
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
`programFormat` distinguishes async function bodies from REPL statements. `stateOwner` is an in-process object identity for optional retained memory; distinct objects remain isolated. Consumers await `release(owner)` when that owner ends; cleanup failures reject that call. Omitted owners are one-shot, and stateless providers ignore ownership. The [persistent Node provider](../../packages/ptc-runtime/ptc-runtime-node/README.md#persistent-repl) defines reset and recovery behavior; no retained object enters the durable Session format.
|
|
105
|
+
|
|
106
|
+
## Bindings: host functions as program globals
|
|
107
|
+
|
|
108
|
+
Each `PtcBindingNamespace` becomes a global object of async callables; PTC passes `tools`. Arguments and resolutions must be lossless JSON. Providers enforce their own transport caps; the seam sets no uniform binding-byte limit. An optional error-class descriptor creates program-visible typed rejections without naming a consumer inside the runtime. Binding names are own properties, so `__proto__` cannot traverse a prototype:
|
|
109
|
+
|
|
110
|
+
```ts type-equiv
|
|
111
|
+
/**
|
|
112
|
+
* Program-visible typed rejection for one binding namespace. The runtime
|
|
113
|
+
* injects a real error constructor under `name`; rejected member calls become
|
|
114
|
+
* its instances and expose the exact member name through
|
|
115
|
+
* `memberNameProperty`. Both strings are runtime data rather than knowledge
|
|
116
|
+
* of a particular consumer such as PTC mode.
|
|
117
|
+
*/
|
|
118
|
+
interface PtcBindingErrorClass {
|
|
119
|
+
/** Constructor global and resulting `Error.name`; same portable identifier rule as {@link PtcBindingNamespace.global}. */
|
|
120
|
+
name: string
|
|
121
|
+
/**
|
|
122
|
+
* Non-empty own property for the member name. The portable exclusion set is
|
|
123
|
+
* `RESERVED_ERROR_MEMBERS` plus dunder-form names (`__x__`, non-empty
|
|
124
|
+
* middle), enforced identically by every backend; any other name —
|
|
125
|
+
* identifiers or not — is accepted everywhere.
|
|
126
|
+
*/
|
|
127
|
+
memberNameProperty: string
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```ts type-equiv
|
|
132
|
+
/**
|
|
133
|
+
* A named group of {@link PtcBindingFunction}s the runtime exposes to the
|
|
134
|
+
* program as one global object (e.g. `tools`). Function names are arbitrary
|
|
135
|
+
* strings — a runtime must treat names like `__proto__` or `constructor` as
|
|
136
|
+
* ordinary own properties (null-prototype construction), never as prototype
|
|
137
|
+
* collisions.
|
|
138
|
+
*/
|
|
139
|
+
interface PtcBindingNamespace {
|
|
140
|
+
/**
|
|
141
|
+
* The global identifier the program sees. Must match the LANGUAGE-PORTABLE
|
|
142
|
+
* identifier subset `[A-Za-z_][A-Za-z0-9_]*` and no language's reserved
|
|
143
|
+
* words, so the same namespace list works against every backend regardless
|
|
144
|
+
* of `language` — a JS-only spelling like `$tools` is rejected by design,
|
|
145
|
+
* not just by the Python backend. Names that satisfy the identifier rule but
|
|
146
|
+
* name a backend-owned slot (`RESERVED_BINDING_GLOBALS`, e.g. `console`,
|
|
147
|
+
* `__dsh_main__`) are also refused everywhere; see its declaration for the
|
|
148
|
+
* exact set and why each entry is reserved.
|
|
149
|
+
*/
|
|
150
|
+
global: string
|
|
151
|
+
/** The callable members, keyed by the exact name the program calls. */
|
|
152
|
+
functions: Record<string, PtcBindingFunction>
|
|
153
|
+
/** Optional program-visible typed rejection contract for this namespace. */
|
|
154
|
+
errorClass?: PtcBindingErrorClass
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```ts type-equiv
|
|
159
|
+
/** A lossless JSON value transferable through the dependency-light Service Definition. */
|
|
160
|
+
type PtcJsonValue = null | boolean | number | string | PtcJsonValue[] | { [key: string]: PtcJsonValue }
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
```ts type-equiv
|
|
164
|
+
/**
|
|
165
|
+
* One host-side function exposed to the program as an async callable. The
|
|
166
|
+
* runtime bridges calls to it (possibly across a serialization boundary), so
|
|
167
|
+
* `args` and the resolution value MUST be lossless JSON. A runtime rejects a
|
|
168
|
+
* lossy or non-cloneable value with a descriptive error rather than corrupting
|
|
169
|
+
* the run. No seam-level byte cap applies to a binding resolution. A rejection
|
|
170
|
+
* of this function surfaces inside the program as a rejection of the
|
|
171
|
+
* corresponding call.
|
|
172
|
+
*/
|
|
173
|
+
type PtcBindingFunction = (args: unknown) => Promise<PtcJsonValue>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Captured output and the failure taxonomy
|
|
177
|
+
|
|
178
|
+
Logs are plain strings. Each source channel preserves emission order, while interleaving across independent channels is backend-dependent because channel metadata is not part of the seam. The runtime captures the program's console and stream output, and consumers render only the text. Implementations cap the serialized outer log-array plus completion-value or failure-message payload; fixed result-envelope syntax and consumer presentation whitespace are not part of that variable-payload ledger. Overflow is an explicit failure rather than in-band value substitution.
|
|
179
|
+
|
|
180
|
+
Failure kinds are **orthogonal outcomes reported independently** (per [defensive-patterns](../defensive-patterns/general.md)): a budget expiry is not an exception, an abort is not a timeout, and a substrate death (e.g. OOM) is neither:
|
|
181
|
+
|
|
182
|
+
```ts type-equiv
|
|
183
|
+
/**
|
|
184
|
+
* Why a run failed. The kinds are orthogonal outcomes reported independently
|
|
185
|
+
* (per docs/defensive-patterns/general.md): a budget expiry is not an exception, an
|
|
186
|
+
* abort is not a timeout, and a substrate death is neither.
|
|
187
|
+
*
|
|
188
|
+
* - `'exception'` — the program threw or failed to parse/transform.
|
|
189
|
+
* - `'timeout'` — an implementation-owned budget expired; the message says which.
|
|
190
|
+
* - `'abort'` — {@link PtcRunRequest.signal} fired.
|
|
191
|
+
* - `'worker-exit'` — the execution substrate died without settling (e.g. OOM).
|
|
192
|
+
* - `'invalid-output'` — the completion value was not lossless JSON.
|
|
193
|
+
* - `'output-limit'` — the serialized outer logs/value/diagnostic exceeded the configured cap.
|
|
194
|
+
* - `'protocol'` — the program sent invalid or over-budget control traffic.
|
|
195
|
+
* - `'sandbox-unavailable'` — required confinement could not be established.
|
|
196
|
+
*/
|
|
197
|
+
interface PtcRunFailure {
|
|
198
|
+
/** The failure class (see the interface doc for each kind's meaning). */
|
|
199
|
+
kind: 'exception' | 'timeout' | 'abort' | 'worker-exit' | 'invalid-output' | 'output-limit' | 'protocol' | 'sandbox-unavailable'
|
|
200
|
+
/** Human-readable detail, suitable for feeding back to a model to self-correct. */
|
|
201
|
+
message: string
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## The service
|
|
206
|
+
|
|
207
|
+
`PtcRuntime` is defined in [`src/index.ts`](../../packages/ptc-runtime/ptc-runtime/src/index.ts). `resolve(request)` returns complete execution inputs, and `run(spec)` executes them. `executionInstructions` supplies provider-owned usage guidance for consumer presentation. `timeout` reports the configured elapsed-time default and maximum when per-call overrides are supported; `resolve` still validates and caps each request. `language` selects supported program presentation; `isolation` describes the substrate without claiming security. `sandboxMode` advertises file-policy support, with `undefined` for a provider that does not supply confinement. Each implementation keeps program state separate between runs and terminates and awaits active executions during disposal.
|
|
208
|
+
|
|
209
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
210
|
+
|
|
211
|
+
<a id="cordis-surface"></a>
|
|
212
|
+
|
|
213
|
+
## Cordis API
|
|
214
|
+
|
|
215
|
+
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).
|
|
216
|
+
|
|
217
|
+
<a id="ctxptcruntime--ptcruntime-abstract-seam"></a>
|
|
218
|
+
|
|
219
|
+
### `ctx.ptcRuntime` — `PtcRuntime` (abstract seam)
|
|
220
|
+
|
|
221
|
+
Registers one `ctx.ptcRuntime` implementation. Program, budget, abort, and substrate failures resolve in PtcRunResult; only Service Definition contract misuse rejects. Implementations bridge structured-cloneable bindings, materialize each declared namespace rejection class, treat programs as hostile peers, isolate distinct state owners, and terminate and await in-flight runs during disposal.
|
|
222
|
+
|
|
223
|
+
```ts cordis-catalog
|
|
224
|
+
/**
|
|
225
|
+
* Release an owner's retained environment and await its execution resources.
|
|
226
|
+
* Stateless providers have no retained resources to release.
|
|
227
|
+
* @param owner - The exact object supplied as the request's state owner.
|
|
228
|
+
* @returns Completion after all owned execution resources have been released.
|
|
229
|
+
* @throws When managed resource cleanup fails.
|
|
230
|
+
*/
|
|
231
|
+
release(owner: object): Promise<void>
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Resolve supported options and provider defaults before execution.
|
|
235
|
+
* @param request - Program, bindings, cancellation and optional execution choices.
|
|
236
|
+
* @returns Complete directory, deadline and supported authority for run.
|
|
237
|
+
* @throws When an explicit choice is invalid or unsupported by this provider.
|
|
238
|
+
*/
|
|
239
|
+
abstract resolve(request: PtcRunRequest): PtcRunSpec
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Execute resolved inputs; program outcomes resolve as result fields.
|
|
243
|
+
* @param spec - directory, deadline, program, bindings, cancellation and supported policy.
|
|
244
|
+
* @returns Captured output and the execution outcome.
|
|
245
|
+
*/
|
|
246
|
+
abstract run(spec: PtcRunSpec): Promise<PtcRunResult>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Source: [`packages/ptc-runtime/ptc-runtime/src/index.ts`](../../packages/ptc-runtime/ptc-runtime/src/index.ts)
|
|
250
|
+
<!-- END GENERATED cordis-surface -->
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# PTC 运行时
|
|
2
|
+
|
|
3
|
+
[English](ptc-runtime.md) | 中文
|
|
4
|
+
|
|
5
|
+
PTC 执行[能力 seam](../../.agents/notes/implemented/architecture/2026-06-13-capability-seams.zh.md)通过 [dsh-ptc-runtime](../../packages/ptc-runtime/ptc-runtime) 提供 `ctx.ptcRuntime`。它针对 Host 绑定运行一个程序,报告输出、失败与适用的沙箱事实。PTC 执行是可选能力,不属于[智能体循环主干](core.zh.md)。[PTC 基础](../../.agents/notes/implemented/feature/2026-06-15-ptc.zh.md)负责注册表呈现,[类型化返回约定](../../.agents/notes/implemented/feature/2026-07-20-ptc-typed-tool-returns.zh.md)负责绑定值,[沙箱 Node 决策](../../.agents/notes/implemented/architecture/2026-09-11-sandboxed-node-ptc-runtime.zh.md)负责已发布的执行提供方。
|
|
6
|
+
|
|
7
|
+
源码:[`packages/ptc-runtime/ptc-runtime/src/types.ts`](../../packages/ptc-runtime/ptc-runtime/src/types.ts)
|
|
8
|
+
|
|
9
|
+
## 运行:请求进,结果出
|
|
10
|
+
|
|
11
|
+
`PtcRunRequest` 包含程序、绑定、取消和可选执行选择。提供方的 `resolve` 验证支持的选择并应用部署默认值;`run` 接收目录与截止选择明确的 `PtcRunSpec`。省略 timeout 使用提供方默认值,数值请求封顶的经过时间预算,`null` 请求不设经过时间截止。提供方在执行前拒绝不支持的选择:
|
|
12
|
+
|
|
13
|
+
```ts type-equiv
|
|
14
|
+
/**
|
|
15
|
+
* Caller inputs for one program. The provider's resolve method validates supported
|
|
16
|
+
* options and supplies directory, deadline, and authority before execution.
|
|
17
|
+
*/
|
|
18
|
+
interface PtcRunRequest {
|
|
19
|
+
/**
|
|
20
|
+
* The program source, in the runtime's {@link ../index.ts | language}. It
|
|
21
|
+
* follows the provider's programFormat: an async function body supports
|
|
22
|
+
* top-level `await` and `return`; a REPL supports top-level declarations,
|
|
23
|
+
* `await`, and a final expression. The completion value becomes
|
|
24
|
+
* {@link PtcRunResult.value}.
|
|
25
|
+
*/
|
|
26
|
+
program: string
|
|
27
|
+
/**
|
|
28
|
+
* Object-identity owner for optional in-memory state. Omission requests a fresh
|
|
29
|
+
* environment. Consumers must await runtime.release(owner) when the owner ends.
|
|
30
|
+
* Stateless providers ignore this field; retained state is never durable.
|
|
31
|
+
*/
|
|
32
|
+
stateOwner?: object
|
|
33
|
+
/** Host functions exposed to the program, one global object per namespace. */
|
|
34
|
+
bindings: PtcBindingNamespace[]
|
|
35
|
+
/** Working directory in the mounted filesystem and subprocess execution world. */
|
|
36
|
+
cwd?: string
|
|
37
|
+
/**
|
|
38
|
+
* Elapsed execution budget in milliseconds. Omission uses provider defaults;
|
|
39
|
+
* null requests no deadline. Providers validate and cap numeric budgets or reject unsupported choices.
|
|
40
|
+
*/
|
|
41
|
+
timeoutMs?: number | null
|
|
42
|
+
/** Resolved authority for this execution. Providers without confinement reject an explicit policy. */
|
|
43
|
+
sandboxPolicy?: SandboxExecutionPolicy
|
|
44
|
+
/**
|
|
45
|
+
* Abort the run: the runtime stops the program (hard, even mid-loop) and
|
|
46
|
+
* resolves with a {@link PtcRunFailure} of kind `'abort'`. In-flight
|
|
47
|
+
* binding calls are the CALLER's to settle — the runtime only stops asking.
|
|
48
|
+
*/
|
|
49
|
+
signal?: AbortSignal
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```ts type-equiv
|
|
54
|
+
/** Fully resolved execution inputs; run never supplies a missing directory or deadline choice. */
|
|
55
|
+
interface PtcRunSpec extends PtcRunRequest {
|
|
56
|
+
/** Absolute directory in the provider's execution world. */
|
|
57
|
+
cwd: string
|
|
58
|
+
/** Positive finite elapsed budget in milliseconds after provider capping, or null for no deadline. */
|
|
59
|
+
timeoutMs: number | null
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
```ts type-equiv
|
|
64
|
+
/** File confinement applied to a program, independently of its terminal outcome. */
|
|
65
|
+
interface PtcRunSandbox {
|
|
66
|
+
/** File-effect mode used for this execution. */
|
|
67
|
+
mode: SandboxMode
|
|
68
|
+
/** Program failure text matched backend diagnostics; not enforcement proof or an exhaustive denial record. */
|
|
69
|
+
denied: boolean
|
|
70
|
+
/** Completeness reported by the selected confining backend; absent for full access. */
|
|
71
|
+
enforcement?: SandboxEnforcement
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
程序失败通过 `PtcRunResult.error` 返回;无效调用输入可能在执行前拒绝。沙箱模式、观察到的拒绝与强制完整性是独立事实,因此程序成功本身不能证明每项请求限制均已强制执行:
|
|
76
|
+
|
|
77
|
+
```ts type-equiv
|
|
78
|
+
/**
|
|
79
|
+
* The outcome of one run. An error is a FIELD on a resolved result, never a
|
|
80
|
+
* rejection of `run()` — reporting a failed program is the caller's job, not
|
|
81
|
+
* an exception path.
|
|
82
|
+
*/
|
|
83
|
+
interface PtcRunResult {
|
|
84
|
+
/** Applied file policy and observed denial, when the provider enforces file policy. */
|
|
85
|
+
sandbox?: PtcRunSandbox
|
|
86
|
+
/**
|
|
87
|
+
* The program's completion value (a return or final REPL expression), when it ran to
|
|
88
|
+
* completion and the value crossed the runtime's lossless-JSON boundary.
|
|
89
|
+
* Invalid or over-limit completions fail the run instead of substituting a
|
|
90
|
+
* rendered string; a failed or value-less run leaves this absent.
|
|
91
|
+
*/
|
|
92
|
+
value?: PtcJsonValue
|
|
93
|
+
/**
|
|
94
|
+
* Captured text. Each source channel preserves emission order; interleaving
|
|
95
|
+
* across independent channels is backend-dependent. Bounded only as part of
|
|
96
|
+
* the outer result.
|
|
97
|
+
*/
|
|
98
|
+
logs: string[]
|
|
99
|
+
/** Present iff the run failed; see {@link PtcRunFailure} for the taxonomy. */
|
|
100
|
+
error?: PtcRunFailure
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
`programFormat` 区分异步函数体与 REPL 语句。`stateOwner` 是标识可选保留内存的进程内对象身份;不同对象相互隔离。消费者在所有者结束时等待 `release(owner)`;清理失败时该调用拒绝。省略所有者时仅执行一次,无状态提供方忽略所有权。[持久 Node 提供方](../../packages/ptc-runtime/ptc-runtime-node/README.zh.md#persistent-repl)定义重置和恢复行为;保留对象不会进入持久 Session 格式。
|
|
105
|
+
|
|
106
|
+
## 绑定:宿主函数作为程序全局变量
|
|
107
|
+
|
|
108
|
+
每个 `PtcBindingNamespace` 成为一个异步可调用函数的全局对象;PTC 传入 `tools`。参数与返回值必须是无损 JSON。提供方强制各自的传输上限;seam 不设统一的绑定字节上限。可选错误类描述符创建程序可见的类型化拒绝,无需在运行时内点名消费方。绑定名是自有属性,因此 `__proto__` 不能遍历原型:
|
|
109
|
+
|
|
110
|
+
```ts type-equiv
|
|
111
|
+
/**
|
|
112
|
+
* Program-visible typed rejection for one binding namespace. The runtime
|
|
113
|
+
* injects a real error constructor under `name`; rejected member calls become
|
|
114
|
+
* its instances and expose the exact member name through
|
|
115
|
+
* `memberNameProperty`. Both strings are runtime data rather than knowledge
|
|
116
|
+
* of a particular consumer such as PTC mode.
|
|
117
|
+
*/
|
|
118
|
+
interface PtcBindingErrorClass {
|
|
119
|
+
/** Constructor global and resulting `Error.name`; same portable identifier rule as {@link PtcBindingNamespace.global}. */
|
|
120
|
+
name: string
|
|
121
|
+
/**
|
|
122
|
+
* Non-empty own property for the member name. The portable exclusion set is
|
|
123
|
+
* `RESERVED_ERROR_MEMBERS` plus dunder-form names (`__x__`, non-empty
|
|
124
|
+
* middle), enforced identically by every backend; any other name —
|
|
125
|
+
* identifiers or not — is accepted everywhere.
|
|
126
|
+
*/
|
|
127
|
+
memberNameProperty: string
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```ts type-equiv
|
|
132
|
+
/**
|
|
133
|
+
* A named group of {@link PtcBindingFunction}s the runtime exposes to the
|
|
134
|
+
* program as one global object (e.g. `tools`). Function names are arbitrary
|
|
135
|
+
* strings — a runtime must treat names like `__proto__` or `constructor` as
|
|
136
|
+
* ordinary own properties (null-prototype construction), never as prototype
|
|
137
|
+
* collisions.
|
|
138
|
+
*/
|
|
139
|
+
interface PtcBindingNamespace {
|
|
140
|
+
/**
|
|
141
|
+
* The global identifier the program sees. Must match the LANGUAGE-PORTABLE
|
|
142
|
+
* identifier subset `[A-Za-z_][A-Za-z0-9_]*` and no language's reserved
|
|
143
|
+
* words, so the same namespace list works against every backend regardless
|
|
144
|
+
* of `language` — a JS-only spelling like `$tools` is rejected by design,
|
|
145
|
+
* not just by the Python backend. Names that satisfy the identifier rule but
|
|
146
|
+
* name a backend-owned slot (`RESERVED_BINDING_GLOBALS`, e.g. `console`,
|
|
147
|
+
* `__dsh_main__`) are also refused everywhere; see its declaration for the
|
|
148
|
+
* exact set and why each entry is reserved.
|
|
149
|
+
*/
|
|
150
|
+
global: string
|
|
151
|
+
/** The callable members, keyed by the exact name the program calls. */
|
|
152
|
+
functions: Record<string, PtcBindingFunction>
|
|
153
|
+
/** Optional program-visible typed rejection contract for this namespace. */
|
|
154
|
+
errorClass?: PtcBindingErrorClass
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
```ts type-equiv
|
|
159
|
+
/** A lossless JSON value transferable through the dependency-light Service Definition. */
|
|
160
|
+
type PtcJsonValue = null | boolean | number | string | PtcJsonValue[] | { [key: string]: PtcJsonValue }
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
```ts type-equiv
|
|
164
|
+
/**
|
|
165
|
+
* One host-side function exposed to the program as an async callable. The
|
|
166
|
+
* runtime bridges calls to it (possibly across a serialization boundary), so
|
|
167
|
+
* `args` and the resolution value MUST be lossless JSON. A runtime rejects a
|
|
168
|
+
* lossy or non-cloneable value with a descriptive error rather than corrupting
|
|
169
|
+
* the run. No seam-level byte cap applies to a binding resolution. A rejection
|
|
170
|
+
* of this function surfaces inside the program as a rejection of the
|
|
171
|
+
* corresponding call.
|
|
172
|
+
*/
|
|
173
|
+
type PtcBindingFunction = (args: unknown) => Promise<PtcJsonValue>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 捕获的输出与失败分类体系
|
|
177
|
+
|
|
178
|
+
日志是纯字符串。每个来源通道保留自身的发出顺序;由于通道元数据不属于 seam,相互独立的通道如何交错由后端决定。运行时捕获程序的 console 与流输出,Consumer 只渲染文本。实现会对序列化后的外层日志数组,以及完成值或失败消息的组合载荷设置上限;固定的结果封装语法与 Consumer 展示空白不计入这份可变载荷计量。超限会显式失败,而不会在值中插入替代内容。
|
|
179
|
+
|
|
180
|
+
失败类型是**正交的结果,独立报告**(见 [defensive-patterns](../defensive-patterns/general.zh.md)):预算耗尽不是异常,中止不是超时,基底崩溃(如 OOM)也不是二者中的任何一个:
|
|
181
|
+
|
|
182
|
+
```ts type-equiv
|
|
183
|
+
/**
|
|
184
|
+
* Why a run failed. The kinds are orthogonal outcomes reported independently
|
|
185
|
+
* (per docs/defensive-patterns/general.md): a budget expiry is not an exception, an
|
|
186
|
+
* abort is not a timeout, and a substrate death is neither.
|
|
187
|
+
*
|
|
188
|
+
* - `'exception'` — the program threw or failed to parse/transform.
|
|
189
|
+
* - `'timeout'` — an implementation-owned budget expired; the message says which.
|
|
190
|
+
* - `'abort'` — {@link PtcRunRequest.signal} fired.
|
|
191
|
+
* - `'worker-exit'` — the execution substrate died without settling (e.g. OOM).
|
|
192
|
+
* - `'invalid-output'` — the completion value was not lossless JSON.
|
|
193
|
+
* - `'output-limit'` — the serialized outer logs/value/diagnostic exceeded the configured cap.
|
|
194
|
+
* - `'protocol'` — the program sent invalid or over-budget control traffic.
|
|
195
|
+
* - `'sandbox-unavailable'` — required confinement could not be established.
|
|
196
|
+
*/
|
|
197
|
+
interface PtcRunFailure {
|
|
198
|
+
/** The failure class (see the interface doc for each kind's meaning). */
|
|
199
|
+
kind: 'exception' | 'timeout' | 'abort' | 'worker-exit' | 'invalid-output' | 'output-limit' | 'protocol' | 'sandbox-unavailable'
|
|
200
|
+
/** Human-readable detail, suitable for feeding back to a model to self-correct. */
|
|
201
|
+
message: string
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## 服务
|
|
206
|
+
|
|
207
|
+
`PtcRuntime` 定义于 [`src/index.ts`](../../packages/ptc-runtime/ptc-runtime/src/index.ts)。`resolve(request)` 返回完整执行输入,`run(spec)` 执行它们。`executionInstructions` 提供由运行时拥有的使用说明,供消费方呈现。支持逐次覆盖时,`timeout` 报告配置的经过时间默认值和上限;每次请求仍由 `resolve` 验证并截断。`language` 选择支持的程序呈现;`isolation` 描述执行基底,不作安全声明。`sandboxMode` 声明文件策略支持,不提供约束的提供方返回 `undefined`。每个实现将各次运行的程序状态分离,并在资源释放期间终止且等待活跃执行。
|
|
208
|
+
|
|
209
|
+
<!-- BEGIN GENERATED cordis-surface (gen-cordis-catalog.ts) — do not edit between markers -->
|
|
210
|
+
|
|
211
|
+
<a id="cordis-surface"></a>
|
|
212
|
+
|
|
213
|
+
## Cordis API
|
|
214
|
+
|
|
215
|
+
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).
|
|
216
|
+
|
|
217
|
+
<a id="ctxptcruntime--ptcruntime-abstract-seam"></a>
|
|
218
|
+
|
|
219
|
+
### `ctx.ptcRuntime` — `PtcRuntime` (abstract seam)
|
|
220
|
+
|
|
221
|
+
Registers one `ctx.ptcRuntime` implementation. Program, budget, abort, and substrate failures resolve in PtcRunResult; only Service Definition contract misuse rejects. Implementations bridge structured-cloneable bindings, materialize each declared namespace rejection class, treat programs as hostile peers, isolate distinct state owners, and terminate and await in-flight runs during disposal.
|
|
222
|
+
|
|
223
|
+
```ts cordis-catalog
|
|
224
|
+
/**
|
|
225
|
+
* Release an owner's retained environment and await its execution resources.
|
|
226
|
+
* Stateless providers have no retained resources to release.
|
|
227
|
+
* @param owner - The exact object supplied as the request's state owner.
|
|
228
|
+
* @returns Completion after all owned execution resources have been released.
|
|
229
|
+
* @throws When managed resource cleanup fails.
|
|
230
|
+
*/
|
|
231
|
+
release(owner: object): Promise<void>
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Resolve supported options and provider defaults before execution.
|
|
235
|
+
* @param request - Program, bindings, cancellation and optional execution choices.
|
|
236
|
+
* @returns Complete directory, deadline and supported authority for run.
|
|
237
|
+
* @throws When an explicit choice is invalid or unsupported by this provider.
|
|
238
|
+
*/
|
|
239
|
+
abstract resolve(request: PtcRunRequest): PtcRunSpec
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Execute resolved inputs; program outcomes resolve as result fields.
|
|
243
|
+
* @param spec - directory, deadline, program, bindings, cancellation and supported policy.
|
|
244
|
+
* @returns Captured output and the execution outcome.
|
|
245
|
+
*/
|
|
246
|
+
abstract run(spec: PtcRunSpec): Promise<PtcRunResult>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Source: [`packages/ptc-runtime/ptc-runtime/src/index.ts`](../../packages/ptc-runtime/ptc-runtime/src/index.ts)
|
|
250
|
+
<!-- END GENERATED cordis-surface -->
|