dsh-ptc-plus 0.4.10 → 0.5.0

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.
Files changed (122) hide show
  1. package/README.en.md +60 -130
  2. package/README.md +60 -130
  3. package/assets/dsh-ptc-plus-banner-en.webp +0 -0
  4. package/assets/dsh-ptc-plus-banner-zh.webp +0 -0
  5. package/assets/ptc-plus-repl-workspace-en.png +0 -0
  6. package/assets/ptc-plus-repl-workspace-zh.png +0 -0
  7. package/assets/ptc-plus-settings-en.png +0 -0
  8. package/assets/ptc-plus-settings-zh.png +0 -0
  9. package/client.cjs +42336 -0
  10. package/cordis.patch.yml +1 -0
  11. package/docs/README.md +6 -2
  12. package/docs/adr/0005-temporary-rejected-cell-edit-transport.md +31 -198
  13. package/docs/adr/0008-define-agent-operating-contract.md +5 -1
  14. package/docs/adr/0009-bound-expensive-acceptance-default.md +2 -2
  15. package/docs/adr/0016-archive-resolved-review-findings.md +1 -1
  16. package/docs/adr/0017-track-the-latest-dsh-public-surface.md +2 -2
  17. package/docs/adr/0019-plugin-settings-and-kill-switch.md +1 -1
  18. package/docs/adr/0020-optional-cordis-tools-in-ptc-mode.md +1 -1
  19. package/docs/adr/0022-stage-npm-releases-with-oidc.md +4 -2
  20. package/docs/adr/0023-global-user-bindings.md +2 -0
  21. package/docs/adr/0026-persist-the-delivery-verdict-against-the-verified-candidate.md +2 -0
  22. package/docs/adr/0028-attach-to-the-host-ptc-execution-seam.md +25 -23
  23. package/docs/adr/0031-close-semantic-obligations-by-owner.md +1 -1
  24. package/docs/adr/0034-keep-program-values-separate-from-output-projections.md +29 -0
  25. package/docs/adr/0035-run-coverage-only-before-a-new-release.md +27 -0
  26. package/docs/adr/0036-separate-focused-development-from-delivery-verification.md +29 -0
  27. package/docs/adr/0037-keep-tool-hover-previews-passive.md +52 -0
  28. package/docs/adr/0038-freeze-session-capability-plans.md +71 -0
  29. package/docs/adr/0039-verify-documentation-without-runtime-suites.md +29 -0
  30. package/docs/adr/0040-separate-capability-configurations-from-session-observations.md +39 -0
  31. package/docs/adr/0041-record-cell-execution-directories.md +65 -0
  32. package/docs/adr/0042-persist-provider-availability-and-handback.md +41 -0
  33. package/docs/adr/0043-compose-capability-and-context-policies.md +37 -0
  34. package/docs/adr/README.md +6 -0
  35. package/docs/architecture.md +23 -25
  36. package/docs/capability-planning-components.md +93 -0
  37. package/docs/capability-projection.md +7 -0
  38. package/docs/client-ui.md +70 -23
  39. package/docs/client-visual-contract.md +26 -9
  40. package/docs/context-management.md +22 -0
  41. package/docs/context-optimization-plan.md +353 -0
  42. package/docs/context-public-interface-coverage.md +25 -0
  43. package/docs/durability-design.md +20 -15
  44. package/docs/evaluation.md +41 -6
  45. package/docs/evaluations/command-goat-deepseek-v4.1-flash-20261006.md +126 -0
  46. package/docs/evaluations/command-goat-deepseek-v4.1-flash.md +281 -0
  47. package/docs/installation.md +31 -10
  48. package/docs/program-data-plane.md +5 -3
  49. package/docs/publishing.md +5 -5
  50. package/docs/release-coverage.md +73 -0
  51. package/docs/release-notes.md +1 -1
  52. package/docs/review-procedure.md +56 -0
  53. package/docs/runtime-reference.md +48 -16
  54. package/docs/semantic-validation.md +14 -2
  55. package/docs/stateful-binding-updates-proposal.md +2 -2
  56. package/docs/user-bindings.md +1 -1
  57. package/docs/value-wire.md +11 -1
  58. package/docs/verification-optimization-work.md +26 -15
  59. package/docs/verification.md +30 -88
  60. package/index.js +123 -20
  61. package/internal/binding-toggle-receipt.js +24 -0
  62. package/internal/capability-command-receipt.js +29 -0
  63. package/internal/capability-environment.js +1247 -0
  64. package/internal/capability-plan.js +285 -0
  65. package/internal/capability-policy.js +96 -0
  66. package/internal/capability-statistics-store.js +180 -0
  67. package/internal/capability-statistics.js +210 -0
  68. package/internal/config-spec.js +79 -9
  69. package/internal/direct-surface-owner.js +27 -29
  70. package/internal/dynamic-environment-runtime.js +9 -9
  71. package/internal/edit-transport-owner.js +180 -139
  72. package/internal/execution-provider-owner.js +15 -12
  73. package/internal/execution-seam-compat.js +8 -8
  74. package/internal/kernel-worker.js +104 -32
  75. package/internal/native-root-dynamic.js +12 -13
  76. package/internal/program-bindings.js +190 -0
  77. package/internal/recovery-tips.js +3 -2
  78. package/internal/rejected-cell-editor.js +8 -8
  79. package/internal/repl-observation-interest.js +11 -3
  80. package/internal/rpc-contract.js +1 -0
  81. package/internal/runtime-bridge-owner.js +272 -34
  82. package/internal/runtime-config.js +58 -0
  83. package/internal/runtime-contexts.js +74 -5
  84. package/internal/runtime-intrinsics.js +1 -0
  85. package/internal/runtime-messages.js +41 -0
  86. package/internal/sdk-projection.js +10 -82
  87. package/internal/session-cell-executor.js +42 -19
  88. package/internal/session-events.js +34 -0
  89. package/internal/session-journal-recovery.js +234 -11
  90. package/internal/session-journal-schema.js +6 -3
  91. package/internal/session-journal.js +31 -2
  92. package/internal/session-log-view.js +1 -1
  93. package/internal/session-runtime.js +119 -15
  94. package/internal/settings-compat.js +12 -5
  95. package/internal/stateful-module-compiler.js +3 -2
  96. package/internal/stateful-module-runtime.js +7 -3
  97. package/internal/stateful-root-runtime.js +9 -4
  98. package/internal/user-binding-authoring.js +2 -7
  99. package/internal/user-bindings-owner.js +41 -2
  100. package/internal/validated-parse-repair.js +1 -1
  101. package/internal/value-wire.js +68 -21
  102. package/internal/worker-cwd-virtualization.js +20 -18
  103. package/internal/worker-realm-surfaces.js +3 -3
  104. package/package.json +47 -29
  105. package/src/client-authoring-view.js +67 -30
  106. package/src/client-binding-review.js +2 -1
  107. package/src/client-binding-toggle.js +18 -0
  108. package/src/client-capabilities-view.js +1341 -0
  109. package/src/client-capability-sort.js +29 -0
  110. package/src/client-copy.js +871 -8
  111. package/src/client-feature-gates.js +3 -0
  112. package/src/client-indicator-view.js +4 -6
  113. package/src/client-primitives.js +33 -2
  114. package/src/client-repl-view.js +20 -13
  115. package/src/client-settings-view.js +411 -41
  116. package/src/client-styles.js +108 -15
  117. package/src/client-tool-hover.js +185 -0
  118. package/src/client-tool-view.js +37 -8
  119. package/src/client-transport.js +44 -9
  120. package/src/client-workbench.js +6 -7
  121. package/src/client.js +76 -22
  122. package/client.js +0 -32479
package/cordis.patch.yml CHANGED
@@ -10,6 +10,7 @@
10
10
  await: false
11
11
  config:
12
12
  originalEntryId: ptc-runtime
13
+ serviceName: ptcRuntime
13
14
  isolation: ptc-plus-original
14
15
  - id: ptc-plus
15
16
  name: dsh-ptc-plus
package/docs/README.md CHANGED
@@ -6,10 +6,12 @@
6
6
  - [Global binding guide](user-bindings.en.md) ([中文](user-bindings.md)): author, review, save, configure, and test reusable helpers.
7
7
  - [Runtime Reference](runtime-reference.md): cell behavior, capability discovery, configuration, diagnostics, and limits.
8
8
  - [Evaluation](evaluation.md): paired ordinary-task protocol, metrics, configuration, and limitations.
9
+ - [Command Goat / DeepSeek V4.1 Flash evaluation](evaluations/command-goat-deepseek-v4.1-flash.md): paid main/child acceptance, two retained A/B cohorts, independent audits, measured benefits and limits.
9
10
 
10
11
  ## Design
11
12
 
12
13
  - [Architecture](architecture.md): ownership boundaries, prompt-prefix stability, runtime lifecycle, journals, and recovery.
14
+ - [Context management](context-management.md): model-facing layers, evidence limits, progressive disclosure, and measured optimization rules.
13
15
  - [Capability Surface](capability-projection.md): typed program bindings and progressive discovery.
14
16
  - [Program Data Plane](program-data-plane.md): canonical values and result completeness.
15
17
  - [Durable / Volatile Recovery](durability-design.md): replay model and external-input boundaries.
@@ -22,10 +24,12 @@
22
24
 
23
25
  ## Maintenance
24
26
 
25
- - [Deterministic Verification](verification.md): complete checks, backend test concurrency, coverage, and focused diagnostics.
27
+ - [Verification selection](verification.md): documentation checks, selection-required diagnostics and complete behavioral validation; read the applicable procedure before its action as routed by [the agent contract](../AGENTS.md).
28
+ - [Findings and independent review](review-procedure.md): findings lifecycle, lane evidence, source proof and commit authorization.
29
+ - [Release coverage](release-coverage.md): release-only coverage commands and verification implementation details.
26
30
  - [Client Visual Contract](client-visual-contract.md): browser prerequisites, control and state coverage, fault counterexamples, and packed Host evidence boundaries.
27
31
  - [Incremental Review Verdict](adr/0026-persist-the-delivery-verdict-against-the-verified-candidate.md): predeclared parallel lanes, dependency-scoped invalidation, and the composite commit verdict.
28
- - [Focused Verification](verification-optimization-work.md): bounded coverage diagnostics and their relationship to the final verification gate.
32
+ - [Focused Verification](verification-optimization-work.md): bounded coverage diagnostics during new-version release preparation.
29
33
  - [Semantic Validation](semantic-validation.md): pinned Test262 cases, dialect contracts, native differential matrices and their limits.
30
34
  - [Publishing](publishing.md): release checks, package contents, permissions, and platform validation.
31
35
  - [GitHub Release Notes](release-notes.md): user-perspective priority order, required sections, bilingual style, and a worked example for release notes.
@@ -1,208 +1,41 @@
1
- # Register Edit And Run As A Truthful Composite Tool
1
+ # Execute Rejected-Cell Edits Through The PTC Program SDK
2
2
 
3
- A small correction to a long `run_code` cell should not require the model to emit the complete
4
- source again. This applies both to cells rejected by the runtime and to cells that completed but did
5
- not achieve the intended result. PTC Plus therefore registers `edit_run_code` as a real DSH tool:
3
+ A small correction to a long `run_code` cell should require only a delta. The official PTC presentation admits `run_code` as its sole top-level tool and exposes registered native tools inside its program SDK. PTC Plus registers `edit_run_code` in the agent scope before the first prompt assembly. Models call it through `tools.edit_run_code` in any ordinary JavaScript expression inside a `run_code` cell; aliases and computed member access retain the same meaning. The plugin does not use the unpublished `both` presentation or add a top-level editor schema.
6
4
 
7
5
  ```ts
8
- edit_run_code({
9
- edits: Array<{ old_string: string; new_string: string }>,
10
- expected_target_call_seq?: number
11
- })
12
-
13
- edit_run_code({
14
- regex_edits: Array<{
15
- pattern: string
16
- flags: string
17
- replacement: string
18
- expected_matches: number
19
- }>,
20
- expected_target_call_seq?: number
6
+ await tools.edit_run_code({
7
+ edits: [{ old_string: 'value >= 8', new_string: 'value >= 10' }],
8
+ expected_target_call_seq: 12, // optional stale-target guard
21
9
  })
22
10
  ```
23
11
 
24
- PTC mode requests using the code-only direct-tool projection expose `[run_code, edit_run_code]` in
25
- that order. The first conclusive prompt assembly creates one per-agent composition owner before any
26
- plugin-owned presentation effect changes the nearest DSH scope. A non-empty `tools:ptc-only`
27
- section proves `ptc`, an empty section proves `both`, and the preceding generation's
28
- `tools:code-only` alias proves the same composition; the current section wins when both appear, and
29
- only a missing owner signal permits a tool-shape inference. For a code composition, the same owner
30
- registers `edit_run_code` through `agent.ctx.tools.register()` and uses the same scope's
31
- `tools.presentAs('both')` to admit both direct calls. It retains both exact disposers and releases
32
- registration and presentation together with the owning session, agent, or plugin. Native-mode and unrelated agent
33
- scopes never inherit the tool. Unrelated native tools remain in the program SDK. A top-level native call is outside that
34
- valid direct protocol. The stream canonicalizer may deliberately replace it with the equivalent
35
- `run_code` transport when the live schema uniquely proves the native member; otherwise the call
36
- remains unchanged for host diagnosis. A nested native call from a cell continues through the
37
- ordinary DSH pipeline. Each assembly derives its `native`, `code`, or `both` presentation from the
38
- lifecycle owner rather than inferring composition mode again from the plugin-modified scope. Only
39
- `code` collapses direct tools, normalizes top-level native calls, or
40
- rejects native dispatch. Both PTC presentations adapt `run_code`, append the program SDK, and
41
- project session runtime contexts, while `both` also preserves native direct calls. The initial
42
- transport-only shape may bootstrap the first scoped registration, but the resulting
43
- `tools.presentAs('both')` declaration is only the executor-enabling effect for the two transports
44
- and cannot become a second mode owner. Each completed prompt assembly therefore preserves the
45
- agent composition's direct projection without releasing the per-agent registration. The
46
- model stream binds every complete tool call's session and call ID to that assembly policy, and
47
- execution consumes this stable relation even when another public wrapper replaces the cancellation
48
- signal. A settled result retires the relation. The retained registration does not authorize the
49
- tool outside a code composition, and one shared session lifecycle revokes outstanding request and
50
- call records on session, agent, or plugin disposal.
51
-
52
- The code composition deliberately retains a complete native registry and nested
53
- SDK while the public assembly hook projects only the two direct transports.
54
- This is an accepted exception to the Host recommendation that assembly hooks
55
- should not change the visible tool list; registry and model-visible lists need
56
- not be identical. Requiring stock `ptc` collapse would reject the editor, and
57
- restricting the registry to the two transports would remove native program
58
- bindings. Live-schema-proven native-call normalization is therefore retained
59
- before persistence and Host dispatch, preserving call identity and native JSON
60
- arguments through ordinary DSH validation, policy and approval. Stable
61
- configuration still requires byte-stable plugin text and ordered schemas.
62
-
63
- An unchanged native root call, including one left unchanged when canonicalization
64
- is disabled, is rejected by the plugin's execution hook. Because Host
65
- pre-execution approval precedes that hook, such a call can prompt for approval
66
- before rejection; this ordering is an accepted limitation, not a registry-level
67
- admission guarantee. Acceptance does not establish a new public direct-set API.
68
- Revisit the projection if the official Host changes the assembly contract or
69
- provides independent direct-tool admission without narrowing the nested SDK.
70
-
71
- `edit_run_code` targets the most recent editable cell in the current turn when its persisted
72
- `tool/call` event is recorded. Execution resolves that snapshot through the event sequence rather
73
- than reading the latest target when the handler begins. Intervening inspection tools do not erase
74
- the target, and later settlements or handler scheduling do not retarget the in-flight edit. A call
75
- that could otherwise edit a cell but lacks a unique persisted event is rejected instead of using
76
- the latest target. The derived cell enters replay history at the outer `tool/result` event, so a
77
- delayed handler is recovered after every cell that settled before it executed. A successful edit
78
- creates a new derived cell, which
79
- becomes the next editable source, so successive small adjustments do not require a full resend.
80
- Invalid edit arguments return `{ edited: false, reason }` and leave the target unchanged.
81
- Process-local target claims distinguish executing and settled derived dispatches. A rejection,
82
- cancellation, or result without a valid PTC journal releases the claim because no owned fact proves
83
- that the derived cell entered the runtime. A journaled dispatch retains the claim through outer
84
- result projection, closing the interval before the session log exposes the derived edit as the new
85
- target. If final policy removes that private metadata, `tools/result` releases the claim. The
86
- session-log projection captures the eligible target at the edit call event and accepts a derived
87
- source only when its target sequence matches that snapshot and its journal is valid and non-noop,
88
- so live and recovered eligibility derive from the same persisted relation.
89
-
90
- The public schema is one closed object with optional `edits`, `regex_edits`, and
91
- `expected_target_call_seq` properties, avoiding duplicated object alternatives in the provider
92
- prompt. Runtime validation still requires exactly one of `edits` or `regex_edits`, plus an optional
93
- non-negative `expected_target_call_seq` precondition. The precondition must equal the call sequence of the target
94
- captured for the persisted edit event; a mismatch returns an unedited result before derived
95
- dispatch. Ordinary model-authored edits omit it and retain latest-target selection. Exact edits
96
- contain at most 16 items; each
97
- non-empty `old_string` must differ from `new_string` and occur exactly once in the target. Regular
98
- expression edits also contain at most 16 items, use unique `gimsu` flags, reject zero-length matches,
99
- and require an exact `expected_matches` count. All ranges resolve against the original target and
100
- must not overlap. Search work, match count, capture records, replacement templates, expansion,
101
- materialized replacement text, final source size, and regular-expression CPU time have fixed
102
- budgets.
103
-
104
- `internal/rejected-cell-editor.js` owns the schema, validation, range collection, replacement
105
- semantics, budgets, and atomic linear assembly. The registered tool passes the materialized source
106
- to DSH's public `tools.execute()` as a derived `run_code`. DSH remains the owner of validation,
107
- authorization, scheduling, cancellation, execution, and result projection.
108
-
109
- The session history preserves the model-authored call:
110
-
111
- ```text
112
- assistant/tool-call: edit_run_code(delta)
113
- tool/result: { edited: true, value?, error?, logs }
114
- ```
12
+ ## Public integration status
13
+
14
+ DSH's published `ptc` mode owns the top-level `run_code` transport and the nested tool scheduler. The editor's registration is agent-scoped, and the official SDK includes its schema before the first model request. Nested dispatch passes the original tool name and JSON arguments through DSH validation, policy, scheduling, cancellation and result projection. The same configured agent has a stable `run_code`-only direct schema across requests. The first and later prompt assemblies must expose the same editor SDK contract.
15
+
16
+ ## Edit and settlement
17
+
18
+ The editor captures the most recent eligible cell at the persisted `tool/ptc-dispatch-start` event. It identifies that event by root, parent and sub-call IDs, exact arguments and sequence. Intervening native calls do not change the target. An optional `expected_target_call_seq` must match the captured target. An unavailable target, invalid edit or mismatched guard returns `{ accepted: false, scheduled: false, reason }`; no derived source executes.
19
+
20
+ The editor accepts exactly one `edits` or `regex_edits` array. Exact edits require unique nonempty `old_string` matches. Each regex edit requires `pattern`, `flags`, `replacement` and `expected_matches`; replacement uses JavaScript `$1`, `$<name>` and `$$` syntax. At most 16 nonoverlapping edits are applied atomically. `internal/rejected-cell-editor.js` owns matching, expansion and CPU/source budgets.
21
+
22
+ For an accepted edit, the nested SDK call returns `{ accepted: true, scheduled: true, target_call_seq }`. This is an acceptance receipt, not the revised computation's value or an idempotence promise. The current outer cell continues with its existing state and original return value or error. After that cell releases its worker, but before its top-level `run_code` result settles, PTC Plus dispatches the complete revised source through DSH's real `tools.execute({ name: 'run_code', ... })` pipeline. The root result retains that outer canonical value or error and forwards the derived result's Host-rendered content, images, additional contexts and, for a successful root result, turn-conclusion flag. The definition-owned `projectContent` callback is installed before dispatch starts, so derived content reaches root post-policy; `exec.deferContext` and `exec.concludeTurn` carry contexts and the successful root conclusion. Root policy may replace or block that presentation. The runtime bridge preserves existing callbacks and their property descriptors, restores only its own installed callbacks on disposal, and unwinds partial installation on failure. The next cell sees the revised bindings. A nested receipt rejected or changed before acceptance prevents dispatch; cancellation or disposal before dispatch does likewise. Removal of the final root metadata after a derived run has executed invalidates recovery evidence but cannot undo its effects.
23
+
24
+ The model-authored outer `run_code` remains the sole top-level call in assistant history. Official nested events retain the editor's real name, arguments and settled receipt. The plugin records its actual derived `tools.execute` call through public `Session.append`: the start carries losslessly detached arguments, a distinct sub-call identity, the original root ID and that still-running root's ID as its parent. The actual execution uses the root's real token as `parent`. Its settled event records the canonical error status and metadata; rendered content passes through the public scoped `tools/ptc-dispatch-log` waterfall with the real root execution. A throwing log projector falls back to the original settled content. These records describe actual executions and do not invent an assistant call, parent or completion. Recovery proves exactly one start and one later settlement for each editor and actual derived sub-call identity within its root-call/final-result window. A metadata start sequence alone cannot resolve duplicate dispatch identities; settled ID reuse outside that window remains independent.
25
+
26
+ If the public Host never invokes `presentationMeta` for this owned nested success, the bridge may capture its canonical frozen value and tentative settlement through the read-only pre-policy `projectContent` callback. Private evidence is admissible only for the exact execution token, session, parent and continuation, with no initial plugin journal, no subsequent projector call, unchanged base metadata, final success and the same canonical value object. Host value replacement, block/error, missing capture or removal of already projected metadata rejects it. The sidecar supplies only the plugin-owned actual derived settlement and root relation; it never changes the Host result or restores pre-policy content. Final root metadata remains required. The proof comes from public canonical value identity and the before/after policy callbacks, without a Host version branch.
27
+
28
+
29
+ The root result's private `dshPtcPlusPostEdit` evidence keeps the editor cause in `startSeq` and the actual derived execution in `executionStartSeq`, alongside the derived source, journal and target sequence. Recovery validates both start/settle pairs, the root journal's accepted editor arguments and receipt, the canonical derived outcome and the transform against the captured target. It folds the derived journal after the root cell using the actual execution-start sequence. Model-visible provenance comes from the root source and the original target's source; raw dispatch records alone do not prove it. Losing either source or a required execution fact contracts the derived binding frontier. A failed start append prevents dispatch; a failed settlement append invalidates future recovery evidence without repeating or undoing an execution. Cold replay uses recorded nested results and does not redispatch the editor or repeat external effects. A successfully published derived source becomes the next editable target through its own execution-start sequence.
30
+
31
+ The derived source itself may contain an editor call. Such a call does not gain a fresh root edit authority during the derived execution: it receives an unavailable receipt rather than recursively scheduling another derived run. Each model-authored root call can accept at most one deferred edit. This bounds recursion and prevents a derived call from resetting the root edit lifecycle.
32
+
33
+ ## Provider and diagnostic handling
34
+
35
+ The stream adapter only repairs an exact invalid-tool-JSON `MALFORMED_RESPONSE`. A trusted complete `run_code` block may lose one extra final `}` when the resulting object passes its live schema. Otherwise complete consistent calls keep their identity and arguments for DSH validation. Incomplete or inconsistent buffered tool material becomes a deterministic schema-rejected `run_code` call, allowing the model another step without executing partial code. This rule never promotes an undeclared top-level `edit_run_code` into an executable call.
115
36
 
116
- The complete derived source, its journal, and its target call sequence are stored only in private tool-result metadata, including
117
- when the derived cell fails after entering the runtime. Cold
118
- recovery folds that explicitly marked derived run into the durable REPL history. The source is not
119
- copied into the model-visible edit result. Valid assistant stream chunks for the two declared
120
- transports pass through unchanged.
121
- Consequently the UI and later model requests do not attribute a generated `run_code` call to the
122
- model.
123
-
124
- The stream owner handles one bounded provider protocol failure before DSH assembles the assistant
125
- message. It buffers tool-call material until the terminal event. If the response reports the exact
126
- invalid-tool-JSON `MALFORMED_RESPONSE` as a terminal chunk or stream exception, it changes that
127
- terminal reason to `tool-calls`.
128
- DSH's existing Agent Loop
129
- then preserves an unparseable argument as a string and routes it through ordinary tool validation,
130
- execution, and result recording, after which the model receives another step. A malformed tool argument therefore
131
- cannot become a turn-ending provider failure merely because this adapter parses it earlier than the
132
- Agent Loop.
133
-
134
- The stream owner preserves calls only when the buffered body consists entirely of
135
- tool-call-specific framing plus at most one `usage` event. When that trusted body contains exactly
136
- one complete, internally consistent declared `run_code` or `edit_run_code` block, the stream owner
137
- first considers one correction: delete exactly one final `}`. The block index, call ID, name,
138
- concatenated deltas, and final arguments must agree, and the candidate must parse as an object
139
- accepted by that request's live direct-tool schema. A successful correction changes the final delta
140
- and final block arguments before the same `tool-calls` settlement. Without that proof, trusted
141
- internally consistent complete blocks retain their original identity and argument bytes for the
142
- ordinary tool-error path. The owner re-emits those calls with canonical
143
- `block-start`, full-argument delta, and `block-end` framing so provider variants tolerated by the
144
- assembler also satisfy DSH's stream invariant. A final `block-end` is canonical even when the
145
- provider emitted no deltas; when deltas exist, their supplied identity fields and accumulated
146
- arguments must agree with it. An already visible open text or reasoning block is closed from its
147
- accumulated content before the synthetic call. If any tool block is incomplete or inconsistent, or no tool block was
148
- emitted, more than one usage event appears, or any other event occurs in the buffered body, the owner
149
- removes unsafe block and unknown events, retains at most the first protocol-valid `usage`, and emits
150
- one deterministic `run_code` call with an argument string that cannot parse as a JSON object. That
151
- call can only fail DSH's ordinary schema
152
- validation, so no untrusted partial call executes and the model still receives another step. Valid streams and every
153
- other provider failure pass through unchanged. The rule does not insert missing delimiters, search
154
- arbitrary edits, reinterpret native calls, or retry effects.
155
-
156
- No edit-specific runtime context is emitted. The truthful call/result pair already carries the
157
- operation and outcome; changing an aggregate runtime-context snapshot merely to restate that fact
158
- would repeat unrelated policy context. Rewrite feedback and unrelated recovery tips retain their
159
- own independently justified lifecycles.
160
-
161
- A live `PTC-C001` at the exact source EOF may carry a validated one-call repair. The analyzer tries
162
- only the 12 suffixes of one or two closing tokens drawn from `}`, `)`, and `]` against the same
163
- binding catalog, reserved bindings, redeclaration mode, rewrite policy, and import state as the
164
- rejected cell. Exactly one candidate across both lengths must complete preparation without a binding
165
- collision, and the existing exact editor must be able to express it from a bounded unique source suffix. The rejected call must also have a
166
- persistent event sequence. The diagnostic then renders those already-validated
167
- `edit_run_code({ edits: [...], expected_target_call_seq })` arguments on one help line. At dispatch,
168
- the precondition binds the proof to that rejected cell even if another matching source has become
169
- editable. This evidence takes precedence over the generic source-length recommendation, but remains
170
- conditional on
171
- `edit_run_code` being declared for that request. Zero or multiple candidates, non-EOF errors,
172
- editor budget failures, missing target identity, and candidates rejected later in preparation
173
- retain the generic guidance.
174
- The plugin never applies this repair itself: syntax/preflight acceptance does not prove model
175
- intent, and explicit edit dispatch preserves DSH authority and truthful history.
176
-
177
- ## Alternatives considered
178
-
179
- **Rewrite `edit_run_code` to `run_code` before persistence.** This reuses DSH's default `run_code`-only
180
- transport, but falsifies the model-authored history, duplicates complete source in model context,
181
- and requires later prose to reinterpret the stored call. It is rejected.
182
-
183
- **Return the materialized source in the edit result.** This makes the derivation visible, but sends
184
- the same large source back into the next model request. Private derived metadata gives recovery the
185
- required bytes without paying that context cost.
186
-
187
- **Limit editing to pre-execution failures.** That avoids retrying an effectful failed cell, but it
188
- also prevents the common case where execution succeeded and only the intended result needs a small
189
- adjustment. The tool edits the recorded source and performs a new explicit execution; it does not
190
- claim that the earlier execution was undone or idempotent.
191
-
192
- **Forbid all stream normalization.** A valid declared call and an invalid
193
- out-of-surface call are different protocol facts. Rewriting a real `edit_run_code` destroys a valid
194
- identity; normalizing a live-schema-proven native miscall to the declared `run_code` transport gives
195
- an otherwise invalid call its executable representation. Native-call canonicalization therefore
196
- remains available. The bounded malformed-input correction likewise retains a declared call's identity.
197
- Fallback settlement preserves arguments for trusted complete internally consistent blocks. Unsafe,
198
- partial, or mixed buffered material is replaced by a validation-rejected `run_code` call only after
199
- the provider itself reports the exact terminal protocol failure.
37
+ At exact source EOF, a `PTC-C001` diagnostic may prove one closing-delimiter correction using the current preparation context and editor budget. It reports `tools.edit_run_code({ edits: [...], expected_target_call_seq })` arguments for use inside a new `run_code` cell. The correction is advisory: the model still selects whether to rerun a possibly effectful target. A failed or cancelled historical effect is neither undone nor safe to retry merely because the edit is syntactically valid.
200
38
 
201
39
  ## Consequences
202
40
 
203
- Tool name, schema, and order remain stable regardless of target availability. `edit_run_code` is a
204
- normal provider tool call, not a synthetic wire alias. The derived run is auditable and replayable,
205
- but is explicitly host-generated and excluded from model-visible history. This adds no editor DSL,
206
- authority layer, or retry guarantee; it only avoids re-emitting source already owned by the session.
207
- Provable top-level native-call repair remains a separate, intentionally history-normalizing transport
208
- feature.
41
+ DSH retains authority over tools and the top-level PTC transport. The editor receipt is intentionally distinct from the later derived computation, and only the latter may establish revised bindings. The private evidence links source, nested dispatch, journal and model-visible ancestry without duplicating the full revised source in the model request.
@@ -6,7 +6,7 @@ PTC Plus needs a tracked instruction surface for product boundaries, source owne
6
6
 
7
7
  ## Decision
8
8
 
9
- `AGENTS.md` contains only obligations whose subject is PTC Plus: DSH authority, runtime and journal invariants, public source ownership, checkout-local review state, deterministic verification, documentation parity, generated-material exclusions, and delivery safety. It links the canonical product and architecture documents rather than duplicating their detailed behavior.
9
+ `AGENTS.md` contains only obligations whose subject is PTC Plus: DSH authority, runtime and journal invariants, public source ownership, checkout-local review state, deterministic verification, documentation parity, generated-material exclusions, and delivery safety. It links the canonical product and architecture documents rather than duplicating their detailed behavior. The default entry retains invariant summaries, common focused commands, and explicit read-before-action links. [Verification](../verification.md) selects checks by change scope, [review procedures](../review-procedure.md) own findings and commit authorization, and [release coverage](../release-coverage.md) owns release diagnostics; paid evaluation setup lives in [evaluation](../evaluation.md). Their requirements apply whenever the corresponding action is taken, including documentation-only work. Loading is conditional on the task; applicability is not optional.
10
10
 
11
11
  Reusable maintenance methods remain outside tracked project sources. Local editor state and branch topology also remain checkout-owned. They may guide an individual maintainer, but project code, tests, hooks, and acceptance do not require their names, installation, or presence.
12
12
 
@@ -20,6 +20,10 @@ The tracked findings-ledger and review-plan templates and their lifecycle script
20
20
 
21
21
  **Keep generic methods as optional tracked references.** Optional wording does not change their public ownership or maintenance cost. Methods without a PTC Plus-specific executable consequence stay outside the repository.
22
22
 
23
+ **Repeat every procedure in the default entry.** This loads review-state internals and release diagnostics into unrelated development tasks and gives the same procedure multiple maintenance locations. Explicit entry conditions keep the required procedure reachable before its first action.
24
+
23
25
  ## Consequences
24
26
 
25
27
  Contributors can determine the obligations needed to preserve PTC Plus without adopting a maintainer's agent stack, editor, model route, or branch workflow. Product semantics retain their canonical owners, while the public operating contract remains small enough to audit for contradictions and private-environment leakage.
28
+
29
+ Task context names the concrete language or runtime operation and preserves exact interfaces and relevant failure evidence. Less repeated reference text reduces default context size; it does not establish model-token savings, task-quality gains, or a change in provider acceptance behavior. Those claims require their own observations.
@@ -10,9 +10,9 @@ Each descriptor in `scripts/expensive-acceptance-scenarios.json` owns whether it
10
10
 
11
11
  Every expensive scenario and A/B task declares machine budgets for model requests, direct calls, source characters, repeated source, result characters, assistant characters, token traffic, and aggregate runtime-context characters. A model request is one logical loop step recorded by durable `step/start`; `request/header` records an initial, resume, or changed header epoch and is counted separately. Neither metric claims to count provider adapter attempts, because retries can make multiple attempts within one logical step without a distinct durable event. The shared acceptance contract treats an exceeded budget as a failure. It also attributes every aggregate runtime snapshot by named section, enforces allowed PTC Plus contribution names and bounds, and verifies required append, update, and clearance transitions. Edit-specific narration is never allowed.
12
12
 
13
- For a trajectory whose configuration, model route, and native capability view remain stable, the shared acceptance contract canonicalizes every `request/header` by DSH rules and compares exact system text and ordered complete tool schemas. An initial epoch establishes the baseline, an equal resume epoch reaffirms it, and every unapproved change epoch fails acceptance. A scenario that changes route, configuration, or capability declares the exact condition and epoch in `headerPolicy.allowedTransitions`; a scenario that replaces history declares the exact `headerPolicy.historyReplacements` count without relaxing header equality. Fingerprints are report metadata only; acceptance compares the canonical values and reports the first differing field.
13
+ For a trajectory whose configuration, model route, and native capability view remain stable, the shared acceptance contract compares exact ordered system text from the public message surface and canonicalizes every `request/header` to compare ordered complete tool schemas. Current system text is carried by formal `system/message`, independently of header epochs; historical `header.system` is evidence only for its recorded older Session format. An initial epoch establishes the header baseline, an equal resume epoch reaffirms it, and every unapproved change fails acceptance. A scenario that changes route, configuration, or capability declares the exact condition and epoch in `headerPolicy.allowedTransitions`; a scenario that replaces history declares the exact `headerPolicy.historyReplacements` count without relaxing header or system-text equality. Fingerprints are report metadata only; acceptance compares the canonical values and reports the first differing field. [Evaluation](../evaluation.md) owns the current restoration, projection and request-boundary evidence details.
14
14
 
15
- The edit canary covers both a completed cell whose result needs adjustment and a runtime-rejected cell in one session. It requires the model-visible direct sequence `[run_code, edit_run_code, run_code, edit_run_code]`, each exact delta, private target and derived-run metadata, and no model-authored retransmission of either materialized source. Successful static-import and mixed-redeclaration rewrites retain result provenance without creating runtime-context transitions. The typed program-surface task requires focused discovery, schema inspection, native reading, and isolated execution in that order while rejecting unrelated capability expansion.
15
+ The edit canary covers both a completed cell whose result needs adjustment and a runtime-rejected cell in one session. The current canary requires four model-visible `run_code` calls: execute each source, then invoke `tools.edit_run_code` once inside the following program. Each edit must preserve its exact delta, accepted nested receipt, actual derived execution pair, private target and derived-run metadata, without model-authored retransmission of either materialized source. The earlier direct-editor sequence remains historical transport evidence. Successful static-import and mixed-redeclaration rewrites retain result provenance without creating runtime-context transitions. The typed program-surface task requires focused discovery, schema inspection, native reading, and isolated execution in that order while rejecting unrelated capability expansion.
16
16
 
17
17
  Both model-backed runners complete keyless verification and resolved-config validation before model invocation. They then run one complete representative canary sequentially and audit its process result, session log, tool transport, runtime contexts, budgets, and task oracle before scheduling broader scenarios, replicates, or concurrency. A canary failure stops the run without starting the remaining paid work. Deterministic tests remain the authority for AST rewrite variants and the acceptance contract itself. The ordinary-task A/B canary is the stable fixture's fixed, cheap, machine-checkable transport task rather than a full repository test run; see ADR 0018.
18
18
 
@@ -10,7 +10,7 @@ An ignored root `REVIEW_FINDINGS.md` prevents unresolved review findings from be
10
10
 
11
11
  Review output and ledger mutation follow task authority. A read-only review reports records in the ledger's semantic fields without writing checkout state. Every implementation preserves an active ledger, but an ordinary change with no finding does not create one. `npm run review:new` creates the ignored root ledger only when a task authorizes capture or resolution of at least one finding; implementation imports those findings before editing their fixes. Archives move under Git's local `review-findings/archive` metadata path, so they cannot enter a commit and remain associated with the checkout.
12
12
 
13
- Ledger validation, readiness, deterministic verification, archive, and commit proof are distinct states with one implementation. `npm run review:validate` checks schema and tracked-file safety while accepting a valid open ledger. `npm run review:gate` is read-only: it blocks an open ledger, validates durable owners for accepted findings, and never archives. `npm run verify` performs schema validation before syntax and coverage checks, so open-ledger work can collect evidence. `npm run check` applies the readiness gate first, then materializes the current tracked and non-ignored checkout through Git's clean and index semantics in a temporary Git administrative directory. Git selects that directory's default index through `--git-dir` and reads the target checkout through `--work-tree`; it never receives an alternate-index environment path that could fall back to the real repository index. The temporary object database reads the repository's objects through a relative alternates entry and stores new fingerprint objects locally. The resulting tree object ID includes canonical blobs, symlink identity, and file modes while remaining independent of staged content. Sparse checkouts retain skip-worktree paths from the `HEAD` baseline and apply clean conversion only to materialized paths, so an absent out-of-cone file is neither lost nor mistaken for a deletion. Every path discovered by Git is reapplied through NUL-delimited literal input. The command separately snapshots the ignored ledger, runs `verify`, rejects changed source or ledger state, and refreshes the proof before archiving a resolved ledger. Repository scripts that launch npm as a child use one command resolver: an invoking npm process supplies its CLI path and Node executable, while direct script invocation falls back to the platform npm executable. A successful later check without an active ledger also refreshes an older proof. The pre-commit hook rejects open and unverified resolved ledgers, requires a verification proof for the current `HEAD`, requires equal source and index tree fingerprints, and requires the composite independent-review plan, lane verdicts, and final verdict defined by ADR 0026. Staging the complete verified tree permits repeated commit attempts; partial staging, additional staged content, mode-only changes, later checkout changes, uncovered paths, or invalidated lane dependencies require reconciliation before commit.
13
+ Ledger validation, readiness, deterministic verification, archive, and commit proof are distinct states with one implementation. `npm run review:validate` checks schema and tracked-file safety while accepting a valid open ledger. `npm run review:gate` is read-only: it blocks an open ledger, validates durable owners for accepted findings, and never archives. `npm run verify` performs schema validation before syntax and complete backend checks without coverage (coverage scheduling is owned by [ADR 0035](0035-run-coverage-only-before-a-new-release.md)), so open-ledger work can collect evidence. `npm run check` applies the readiness gate first, then materializes the current tracked and non-ignored checkout through Git's clean and index semantics in a temporary Git administrative directory. Git selects that directory's default index through `--git-dir` and reads the target checkout through `--work-tree`; it never receives an alternate-index environment path that could fall back to the real repository index. The temporary object database reads the repository's objects through a relative alternates entry and stores new fingerprint objects locally. The resulting tree object ID includes canonical blobs, symlink identity, and file modes while remaining independent of staged content. Sparse checkouts retain skip-worktree paths from the `HEAD` baseline and apply clean conversion only to materialized paths, so an absent out-of-cone file is neither lost nor mistaken for a deletion. Every path discovered by Git is reapplied through NUL-delimited literal input. The command separately snapshots the ignored ledger, selects documentation checks or full `verify` under [ADR 0039](0039-verify-documentation-without-runtime-suites.md), rejects changed source, HEAD or ledger state, and refreshes the proof before archiving a resolved ledger. Repository scripts that launch npm as a child use one command resolver: an invoking npm process supplies its CLI path and Node executable, while direct script invocation falls back to the platform npm executable. A successful later check without an active ledger also refreshes an older proof. The pre-commit hook rejects open and unverified resolved ledgers, requires a verification proof for the current `HEAD`, requires equal source and index tree fingerprints, and requires the composite independent-review plan, lane verdicts, and final verdict defined by ADR 0026. Staging the complete verified tree permits repeated commit attempts; partial staging, additional staged content, mode-only changes, later checkout changes, uncovered paths, or invalidated lane dependencies require reconciliation before commit.
14
14
 
15
15
  Hook installation is explicit. `npm run hooks:install` selects the tracked hook path only when the effective `core.hooksPath` is unset or already `.githooks`. Before the first switch from Git's default hooks directory, installation rejects any non-sample hook file there; it also rejects an incompatible configured path instead of disabling another hook owner. Dependency installation has no Git-configuration side effect.
16
16
 
@@ -10,9 +10,9 @@ PTC Plus must remain independently installable on unmodified official DSH distri
10
10
 
11
11
  The compatibility target is the latest available DSH release. Production behavior, configuration, tests, installation guidance, and current compatibility claims depend on public extension contracts and observed live schemas, never on a DSH version allowlist or comparison. An upstream default projection is not an extension ceiling: when public scoped registration and presentation support a plugin-owned capability, PTC Plus preserves that capability and its model-visible identity instead of deleting or renaming it to match the default. Deterministic normalization remains valid for a call that is outside the declared direct surface when the live schema proves one native target and the lowering preserves arguments, call identity, authority, and result semantics. Deterministic tests exercise the consumed contracts; model-backed and packaging acceptance runners use the installed DSH and record `dsh --version` in generated reports so failures remain attributable without turning the observed value into policy. Concrete DSH release numbers may appear only in source comments that identify historical integration or evaluation evidence and cannot influence execution or acceptance.
12
12
 
13
- Release discovery is separated from candidate verification. The root manifest declares the official `next` channel for the DSH packages used by development and freezes the resolved cohort in the root lockfile. `compat/latest` declares only the official DSH meta-package on `latest` and freezes that complete graph in its own lockfile. Resolved versions in these generated lock snapshots are reproducibility evidence selected by the channel declarations; they are not compatibility allowlists or runtime branches. Ordinary `verify` and `check` runs make no registry request and fail quickly when the installed root graph differs from the root lock.
13
+ Release discovery is separated from candidate verification. The root manifest declares the official `next` channel for the DSH packages used by development and freezes the resolved cohort in the root lockfile. `compat/latest` declares only the official DSH meta-package on `latest` and freezes that complete graph in its own lockfile. Resolved versions in these generated lock snapshots are reproducibility evidence selected by the channel declarations; they are not compatibility allowlists or runtime branches. `compat/current` separately freezes the cohort of the newest published official GitHub release, including prereleases. Its generated manifest selects the matching official npm channel, and `release.json` records the discovery provenance. This published-release identity, rather than a fixed list of channel names, owns the current target. Ordinary `verify` and the full branch of `check` make no registry request and fail quickly when the installed root graph differs from the root lock; they also validate the published cohort against its frozen provenance.
14
14
 
15
- The scheduled baseline refresh queries the official registry. When either channel moves, it updates both lock snapshots on an automation-owned branch, opens or updates one pull request, and dispatches the normal CI workflow once for that frozen candidate. GitHub suppresses workflow runs from branch and pull-request events produced by the workflow's `GITHUB_TOKEN`, so the explicit dispatch is the candidate's only CI run. If neither tag moved, it does not resolve or install the dependency graph. The Host contract suite tests the packed plugin against the root `next` graph and creates a repository-external consumer from the tracked `latest` lock. That consumer exposes the public packages from the selected Host graph to the plugin and runs the execution-seam, RPC-codec, and compressed Session persistence contracts. No compatibility run independently selects tags for DSH service packages, because their dist-tags need not move as one cohort.
15
+ The scheduled baseline refresh queries the official registry. It also queries official GitHub releases and matches the newest non-draft DSH release to the official meta-package dist-tags. A missing distribution fails discovery instead of silently using an older Host. When either channel or the published-release cohort moves, it updates the affected lock snapshots on an automation-owned branch, opens or updates one pull request, and dispatches the normal CI workflow once for that frozen candidate. GitHub suppresses workflow runs from branch and pull-request events produced by the workflow's `GITHUB_TOKEN`, so the explicit dispatch is the candidate's only CI run. If neither tag nor the published-release cohort moved, it does not resolve or install the dependency graph. The Host contract suite tests the packed plugin against the root `next` graph and creates a repository-external consumer from the tracked `latest` lock. That consumer exposes the public packages from the selected Host graph to the plugin and runs the execution-seam, RPC-codec, and compressed Session persistence contracts. The suite also creates a repository-external consumer from `compat/current` and tests the packed plugin on that unmodified published graph. `npm run test:host-contract -- current` selects this object alone. No compatibility run independently selects tags for DSH service packages, because their dist-tags need not move as one cohort.
16
16
 
17
17
  Preceding public contracts remain supported where capability detection is
18
18
  unambiguous. Tools presentation is selected by the installed public schema;
@@ -16,7 +16,7 @@ PTC Plus registers one DSH settings namespace `ptc-plus` with the same field lis
16
16
 
17
17
  The settings card belongs to plugin configuration. Current DSH renders a bundle's own configuration on the sidebar Plugins → Installed page through `plugins.row.config` (keyed, root) as `<bundle package name>#<row id>` and reserves `plugins.item` for the host-plane pages DSH itself ships. Historical, unfrozen Hosts use `settings.plugin.item` (keyed, root) in the Settings panel, keyed by the served namespace. `src/client-host-compat.js` publishes to these plugin configuration seats through `ctx.slots.inject`, which waits until the owning page declares its slot. General settings may coexist with plugin configuration and is not a seat for this card. The composer shortcut opens an application-modal rendering of the same complete form, so direct access does not depend on a host page's component-local navigation state; its hover hint names the observed native plugin configuration seat. The package's top-level `icon` field points to a packaged SVG; DSH owns loading and displaying it on the installed bundle and row pages.
18
18
 
19
- The settings card places the plugin switch first, then groups controls by purpose: tool call tolerance, REPL syntax, state and recovery, tool extensions, interface display, and resource limits. Recovery tips and their thresholds stay together, and global binding management appears directly below its enable switch. `CONFIG_GROUPS` owns this presentation order independently of Host schema field order and defaults. `autoDescribeRunCode` defaults to true and controls only a request-bound local execution policy. When enabled, a call that omits the outer `description` uses derived arguments for local DSH validation, and the fallback summary enters presentation metadata only; when disabled, DSH validates the original arguments. Both states produce byte-stable model-visible tool schemas, order, and system sections with the required `description` declaration. Original call arguments, explicit summaries, cell source, and nested native-tool arguments remain unchanged.
19
+ The settings form groups controls into core workspace (REPL syntax, state and recovery), extensions and tolerance (tool extensions, tool call tolerance), interface and resources (interface display, resource limits), and experimental (capabilities and context). Page and dialog navigation integrate the single main switch into a borderless PTC Plus title row without a duplicate enabled badge; static module captions differ from section links with icons, arrows and selected markers. The legacy disclosure card retains its first switch section. Experimental controls remain last and carry an explicit marker. The wide settings dialog presents the groups as a two-column workbench with independently scrolling navigation and content; settings wheel scrolling and section selection leave the rail and shared modal frame in place. Narrow viewports use horizontal navigation above independently scrolling content. Recovery tips and their thresholds stay together, and global binding management appears directly below its enable switch. `CONFIG_MODULES` and `CONFIG_GROUPS` own this presentation grouping and order independently of Host schema field order and defaults. The session capability-plan section inside capabilities and context shows effective selections and pending configuration changes only while capability management is enabled; disabling it cancels plan inspection and discards stale replies while manual configuration and catalog reads remain available. Capabilities and context uses four tabs for manual preferences, statistics, budgets and session plans. MCP lists group tools/resources under a server master switch; closing the server preserves child strategies and takes precedence when the frozen plan is derived. Typed catalog rows keep common preferences, manual strategies and selected frozen-session results separate, with source/strategy/common/availability filters and stable within-group sorting. Display names and source metadata belong only to the catalog RPC view: Skill provider/source and public MCP server directory and captured MCP owner sections supply evidence, while ordinary tools are attributed to the Host registry without guessing their package origin. Catalog errors preserve last-observed entries as unconfirmed, and unavailable saved preferences remain editable/removable. The core execution surface is read-only. Capability controls serialize structured selections and retain invalid numeric drafts without committing them; saving capability settings affects new sessions, while existing sessions retain their frozen plan until `/capabilities refresh` as defined by [ADR 0038](0038-freeze-session-capability-plans.md). The sparkle menu refreshes its current session through the authenticated Host command; settings require an explicit target from a read-only active-PTC identity view. This identity view does not prepare or inspect plans and remains available with capability management off so users can synchronize the disabled configuration. Reloading catalog/plans is read-only. Global binding disablement hides binding actions while settings and capability refresh remain accessible; the plugin switch and configured sparkle visibility still gate the menu. Refresh receipts preserve Host outcomes, and cancellation stops waiting without claiming rollback. `autoDescribeRunCode` defaults to true and controls only a request-bound local execution policy. When enabled, a call that omits the outer `description` uses derived arguments for local DSH validation, and the fallback summary enters presentation metadata only; when disabled, DSH validates the original arguments. Both states produce byte-stable model-visible tool schemas, order, and system sections with the required `description` declaration. Original call arguments, explicit summaries, cell source, and nested native-tool arguments remain unchanged.
20
20
 
21
21
  The configurable set is the Host runtime configuration plus `enabled: boolean` (default true). `enabled` is the kill switch: when false the Host keeps the settings namespace, client card, and passive message cleanup defined in [ADR 0010](0010-session-log-derived-recovery-tips.md). The next permitted accepted step may clear earlier PTC declarations. It does not install the runtime bridge, edit transport, direct-surface owner, system prompt section, tool registrations, or execution hooks, and does not read binding storage. When true the same runtime as pre-settings PTC Plus is installed. On the generations that expose a section installer, every field is live when its owner can reconcile it: the Host observes the settings scope and installs, uninstalls, or reconfigures owners without replacing existing session-bound bindings. The volatile-only settings shape exposed by both frozen Host graphs has no section installer and serves only fields marked volatile in the plugin's exported `Config`; the Host provides the form and commits volatile-only changes into the live references, notifying the owning fiber through the public `loader/volatile-update` event. The plugin subscribes and reconciles through its existing update path instead of running a per-field settings watch. Node fixes a worker's V8 `maxOldGenerationSizeMb` limit at construction, so changing that field while a session worker is active or a submitted cell is preparing to execute is rejected and the settings provider is restored to the previous value; other reconfiguration failures use the same compensation path. The TypeScript language check occurs at activation, allowing disabled settings to load on a host using another code runtime while rejecting and rolling back an enable attempt. If the settings service is absent, the Host falls back to composition config and enables the runtime.
22
22
 
@@ -20,7 +20,7 @@ The Skill provider and official Cordis child fiber form one reversible mount. Bo
20
20
 
21
21
  The official plugin also registers Host inspect providers in the process-global `cordisInspect` service. Per-agent fibers therefore acquire owner-scoped leases for identical provider manifests instead of registering the same provider ID independently. Queries delegate to a registration from a still-live official fiber, and the process-global provider is removed when the final lease is released. A manifest mismatch remains a configuration error rather than silently choosing one contract.
22
22
 
23
- Cordis tools remain native program bindings under `tools.*`. The PTC code-only direct-tool projection remains exactly `[run_code, edit_run_code]`; native agents and unrelated scopes do not inherit this option.
23
+ Cordis tools remain native program bindings under `tools.*`. The PTC code-only direct-tool projection remains exactly `[run_code]`, with the registered editor called through `tools.edit_run_code` in the program SDK; native agents and unrelated scopes do not inherit this option.
24
24
 
25
25
  Cordis definitions and Runs are process-local, while PTC journals replay every settled program binding as a recorded value without redispatch. On the first prompt for an agent or a new Cordis enable generation, PTC Plus derives whether normalized journals contain a Cordis transcript. If they do, it emits the fixed `tools:ptc-plus-cordis-recovery` runtime context: recorded values remain journal data, but the model must perform a live read-only Cordis Inspect before relying on prior IDs, state, approvals, or capability observations. The context remains until a newly settled successful `cordis_inspect*` call appears in the session log. It neither asserts that live state was lost nor reruns a mutating call.
26
26
 
@@ -8,7 +8,9 @@ The npm registry is retiring long-lived bypass-2FA credentials as a direct publi
8
8
 
9
9
  The `Release` GitHub Actions workflow is the only automated npm publication path. A maintainer explicitly dispatches it from an annotated `v<package.version>` tag ref; there is no independent tag input. Before obtaining npm authority, the workflow proves that its `GITHUB_REF`, provenance-bearing `GITHUB_SHA`, annotated tag target, checked-out commit, manifest version, and the successful `main` push run of `.github/workflows/ci.yml` all identify the same commit. Normal CI does not run for tag pushes.
10
10
 
11
- The npm Trusted Publisher is bound to the exact repository, `release.yml` workflow filename, and `npm-release` GitHub environment. Its allowed action is only `npm stage publish`; direct `npm publish` and reusable npm write tokens are absent from the workflow. The package uses npm's most restrictive recommended publishing-access policy even when npm documentation and the live UI use different labels for it. After the OIDC staging path is proven, maintainers revoke every remaining reusable token capable of publishing or staging this package rather than treating the selected UI label as evidence that no such credentials remain. The release job receives only `contents: read` and `id-token: write`, uses a GitHub-hosted runner without a package-manager cache, revalidates the dispatch ref and SHA after the environment boundary, builds and smoke-tests one tarball, and sends that same file to npm staging with provenance.
11
+ The npm Trusted Publisher is bound to the exact repository, `release.yml` workflow filename, and `npm-release` GitHub environment. Its allowed action is only `npm stage publish`; direct `npm publish` and reusable npm write tokens are absent from the workflow. The package uses npm's most restrictive recommended publishing-access policy even when npm documentation and the live UI use different labels for it. After the OIDC staging path is proven, maintainers revoke every remaining reusable token capable of publishing or staging this package rather than treating the selected UI label as evidence that no such credentials remain. The release job receives only `contents: read` and `id-token: write`, uses a GitHub-hosted runner without a package-manager cache, revalidates the dispatch ref and SHA after the environment boundary, runs the release-only coverage gate from [ADR 0035](0035-run-coverage-only-before-a-new-release.md), builds and smoke-tests one tarball against the installed frozen Host peer cohort, and sends that same file to npm staging with provenance.
12
+
13
+ The clean-consumer install supplies the exact versions of required peers resolved from the verified installed Host alongside the tarball in one npm transaction. Independent dist-tag resolution of shared service packages can mix incompatible cohorts and is not release evidence. This constrains the verification consumer, while the plugin keeps unrestricted required peer ranges and Host-owned service instances.
12
14
 
13
15
  Promotion is separate from staging. A maintainer reviews the staged metadata and downloadable tarball, then approves or rejects it through npm with interactive 2FA. A successful approval is not treated as immediate availability because npm publish-time scanning may delay or block registry visibility. GitHub Release publication follows observed availability of the exact npm version.
14
16
 
@@ -20,7 +22,7 @@ npm 12 install-time restrictions remain enabled for the release job. The manifes
20
22
 
21
23
  **Publish directly with OIDC after a GitHub Environment approval.** This removes long-lived credentials but substitutes a GitHub approval for npm proof-of-presence. Stage-only authority keeps CI compromise from making a version public and remains compatible with npm's dual-use publication requirements if they apply.
22
24
 
23
- **Run the full platform matrix again inside the release workflow.** Revalidation of an immutable SHA repeats expensive deterministic work without changing the artifact identity. The release workflow instead verifies the successful CI run for that exact SHA, then performs npm 12 installation, build, package lint, audit, pack, checksum, and clean-consumer smoke on the release artifact.
25
+ **Run the full platform matrix again inside the release workflow.** Revalidation of an immutable SHA repeats expensive deterministic work without changing the artifact identity. The release workflow instead verifies the successful CI run for that exact SHA, then performs npm 12 installation, build, release-only coverage, package lint, audit, pack, checksum, and clean-consumer smoke on the release artifact.
24
26
 
25
27
  **Publish a locally generated tarball after CI.** Interactive local publishing provides 2FA but separates the published bytes from the workflow identity and makes provenance, repeatability, and artifact review depend on workstation state.
26
28
 
@@ -77,6 +77,8 @@ The existing REPL supplies execution feedback; the handoff accepts final source
77
77
 
78
78
  The first validated candidate becomes one disabled memory draft. Private `dshPtcPlusBindingDraft` metadata version 2 contains the generation, opaque locator, and the accepted candidate with request ID, command ID, version, mode, and complete source-owned entry. Later results carry `candidate: null`; version 1 remains readable. The `ptcPlusBindingDraft` projection, state version 4, pairs command and turn lifecycle with acceptance, retains read-only history across seeds and owner generations, and never revives a historical locator. Malformed historical presentation cannot block subsequent valid execution. The management Remote uses the authenticated Host Gateway and provides no caller/session identity, so draft operations require the locator rather than a payload session ID. The `draft-review` endpoint serves the accepted source and any completed action while its owning lifecycle remains available.
79
79
 
80
+ Confirmed enable/disable of a saved binding prepares a separate `ptc-binding-toggle/v1` receipt. If the Session already has its Host system head, the owner appends it through public `Session.append('user/message', message, {surfaceOp: 'append'})`; otherwise it supplies the pending receipt only with an accepted `agent/pre-step` message batch, after the Host establishes its first system node. Rejected or cancelled steps do not publish it, and the public `session/event` commit notification retires each pending receipt by message identity, so later compaction cannot resurrect it. The receipt describes configuration persistence, never catalog delivery or worker initialization, and never wakes an Agent. Before first acceptance the management result supplies immediate UI feedback; pending history is process-local and does not claim durability before publication. Storage failure emits no success receipt.
81
+
80
82
  After a user save or discard completes, the Host consumes the writable locator and appends a structured plugin notice through public `Session.append('user/message', ..., {surfaceOp: 'append', sourceEventSeqs: [acceptingResultSeq]})`. The notice contains only request ID, entry ID, saved/discarded state, and enabled state. It asserts persistence, never session activation, and contains no source or locator. The projection accepts it only when identity and the accepting source relation match. Card remounts use this historical source and action, never a later store entry with the same ID. A failed notice append cannot undo the write or restore save eligibility; missing durable evidence remains unknown after restart. In-flight storage settlement cannot resurrect a locator already revoked by lifecycle cleanup. Clearing an unsaved draft alone does not append a persistence notice.
81
83
 
82
84
  Catalog revision conflicts refresh the catalog, draft, and review independently. A still-valid draft stays inspectable and retryable by the user; an authoritative empty draft revokes the actions. No conflict automatically repeats a write. Agent disposal invalidates only that exact Agent's locators and in-memory reviews; session disposal, feature disablement, and owner disposal revoke all affected access. Durable history proves a past action, not current activation or model knowledge.
@@ -18,6 +18,8 @@ After all lanes are effective, `npm run check` produces the existing whole-sourc
18
18
 
19
19
  `REVIEW_FINDINGS.md`, `REVIEW_PLAN.json`, reports, lane records, plans, proofs, and aggregate verdicts remain checkout-local. The two root working files are installed into `.git/info/exclude`; reports must stay outside the checkout or be ignored. The old `dsh-review-verdict/v1` single-report format and `verdict` command are rejected rather than treated as composite evidence.
20
20
 
21
+ [ADR 0039](0039-verify-documentation-without-runtime-suites.md) selects documentation or full behavioral verification within `check`. Both scopes keep the proof, review and index identities defined here; documentation proof does not establish runtime test success. The action-specific commands live in [review procedures](../review-procedure.md).
22
+
21
23
  ## Alternatives considered
22
24
 
23
25
  **Repeat one complete-tree review after every fix.** This binds review to exact bytes but discards unaffected independent evidence and serializes work that has explicit semantic boundaries.
@@ -4,15 +4,15 @@
4
4
 
5
5
  PTC Plus supplies the session-bound REPL by taking over the program-execution
6
6
  seam DSH uses for `run_code`. DSH registers that seam as a Cordis service and
7
- has renamed it between releases: a historical request-only generation published
8
- `ctx.codeRuntime` (`@deepseek-ai/dsh-code-runtime`) and the current one publishes
7
+ has renamed it between releases: the request-only contract publishes
8
+ `ctx.codeRuntime` (`@deepseek-ai/dsh-code-runtime`) and the resolved-spec contract publishes
9
9
  `ctx.ptcRuntime` (`@deepseek-ai/dsh-ptc-runtime`). A plugin that declares the
10
- removed name as a required injection never applies on the current host. Cordis
10
+ absent name as a required injection never applies on that host. Cordis
11
11
  does not fail such a plugin: the fiber stays pending, the plugin's entry points
12
12
  are never registered, and `run_code` silently keeps executing in the host's own
13
13
  runtime instead of the session REPL.
14
14
 
15
- The current seam also differs in more than its name. It resolves a request before
15
+ The resolved-spec seam also differs in more than its name. It resolves a request before
16
16
  running it (`resolve(request)` → `run(spec)`), it publishes provider descriptors
17
17
  (`executionInstructions`, `sandboxMode`, `timeout`) that gate host inputs, and it
18
18
  reports file-confinement facts on the result. Its provider resolves a file policy
@@ -33,7 +33,7 @@ original entry through public Loader resolution and injection, then registers a
33
33
  plugin-owned global provider through Cordis. The main plugin installs its
34
34
  execution callback only in that provider's private entry. The original service
35
35
  is never modified and may be frozen or sealed. Custom compositions configure
36
- the original entry ID and matching isolation explicitly. Entry IDs resolve in the
36
+ the original entry ID, service name and matching isolation explicitly. `codeRuntime` takes requests directly; `ptcRuntime` requires `resolve(request)` before `run(spec)`. The selected service contract, rather than release chronology, determines delegation. Entry IDs resolve in the
37
37
  provider row’s owning Loader tree, including the profile’s Include subtree;
38
38
  they are not assumed to be root-tree IDs.
39
39
 
@@ -61,21 +61,21 @@ session runtime. The subscription and its disposer belong to the injected contro
61
61
  **Selection is a live capability.** The plugin's static injection names only the
62
62
  services both generations provide; the seam owner waits through `inject` for
63
63
  whichever execution service the host registers, in a scope that also requires the
64
- plugin's own services, and owns one live attachment at a time. When both are registered, the current
65
- generation wins, including when it appears after a preceding-generation attachment.
64
+ plugin's own services, and owns one live attachment at a time. When both are registered, the resolved-spec
65
+ contract wins, including when it appears after a request-only attachment.
66
66
  That transition first disposes the legacy injected fiber and its complete effect
67
- tree, then attaches in the current service's scope; cleanup from the retired scope
68
- cannot clear the new owner. If that attach fails, the owner marks the current
69
- service object unusable, re-arms the preceding-generation attachment
67
+ tree, then attaches in the resolved-spec service's scope; cleanup from the retired scope
68
+ cannot clear the new owner. If that attach fails, the owner marks the resolved-spec
69
+ service object unusable, re-arms the request-only attachment
70
70
  immediately, and reports the failure instead of leaving the plugin with no
71
- execution seam; the failed object is never retried, while a replacement current
72
- service supersedes the restored attachment. The preceding generation therefore
73
- attaches only when the current one is absent or is the recorded unusable object.
71
+ execution seam; the failed object is never retried, while a replacement resolved-spec
72
+ service supersedes the restored attachment. The request-only contract therefore
73
+ attaches only when the resolved-spec one is absent or is the recorded unusable object.
74
74
  Attachment runs in the injected scope, so
75
75
  the plugin is unloaded when the host unregisters that service and reattaches when
76
76
  it is registered again. A service that satisfies the name but not the contract
77
77
  (`run` or `resolve` missing) follows the same path and is reported as a load
78
- failure naming the service; when a preceding-generation attachment exists, the
78
+ failure naming the service; when a request-only attachment exists, the
79
79
  report accompanies its restoration so `run_code` never silently returns to the
80
80
  host provider.
81
81
 
@@ -88,7 +88,8 @@ and returns its disposer. The plugin's entry receives the complete input.
88
88
  provider, retaining its object identity, cwd, deadline, sandbox policy and future
89
89
  execution fields. Non-session callers use this path without resolving again.
90
90
  Fresh isolated requests still use `invokeUpstream(request)`. Session cells consume
91
- their program, bindings and signal under the session's own execution contract;
91
+ their program, bindings, signal and resolved cwd under the session's own execution contract;
92
+ [ADR 0041](0041-record-cell-execution-directories.md) records per-cell directory ownership;
92
93
  the boundary never drops fields before choosing which consumer owns execution.
93
94
 
94
95
  **The seam describes the execution the plugin performs.** While the plugin owns
@@ -102,7 +103,7 @@ resolution, and sandbox escalation on those descriptors, so withholding them kee
102
103
  DSH's authority decisions with DSH instead of accepting an input the plugin would
103
104
  then ignore. Withdrawal is unconditional rather than generation-conditional,
104
105
  because the rule belongs to the plugin's execution rather than to a generation:
105
- the preceding generation's contract defines none of these members and nothing in
106
+ the request-only contract defines none of these members and nothing in
106
107
  its install closure reads them, so withdrawing there is inert. These values are
107
108
  derived getters on the plugin provider, not replacement descriptors on the
108
109
  original. Releasing the private callback restores native delegation and its
@@ -150,8 +151,8 @@ semantics for callers that never reach its REPL.
150
151
  not grant mutation ownership. Such attachment fails on frozen providers and
151
152
  cannot establish a durable extension contract; it is not a compatibility fallback.
152
153
 
153
- **Forward the resolved spec's directory, deadline, and policy to the session
154
- kernel.** The kernel has its own directory, budgets, and journal semantics; a
154
+ **Forward the resolved spec's deadline and policy to the session
155
+ kernel.** Current directory is integrated separately by ADR 0041. The kernel has its own budgets and journal semantics; a
155
156
  per-call host deadline would have to be reconciled with the configured budget,
156
157
  and confinement the plugin cannot enforce would be reported as if it applied.
157
158
 
@@ -161,9 +162,10 @@ escalation it thinks it is offering.
161
162
 
162
163
  ## Consequences
163
164
 
164
- The frozen Host graphs exercise the `ptcRuntime` resolve/run shape. The
165
- `codeRuntime` request-only shape is a historical compatibility branch with
166
- fixture coverage, not a second frozen Host generation. The evidence boundary is
165
+ The default bundle and current official base profile use the `ptcRuntime`
166
+ resolve/run shape, also exercised by the frozen Host graphs. Explicit
167
+ `codeRuntime` request-only compositions retain public Loader fixture coverage
168
+ for request identity, replacement and bundle removal. The evidence boundary is
167
169
  recorded in [Installation](../installation.md#compatibility-evidence).
168
170
  Seam tests cover selection and input preservation for both shapes. Real public
169
171
  Loader tests cover frozen originals, exact configuration and spec delegation,
@@ -175,8 +177,8 @@ pending: the host awaits loader settlement before it becomes usable, so an
175
177
  unbounded wait would park every agent, native tool, and unrelated plugin rather
176
178
  than failing this entry.
177
179
 
178
- A current-generation service that fails to attach cannot leave the plugin
179
- unattached while the preceding service is still registered: the preceding
180
+ A resolved-spec service that fails to attach cannot leave the plugin
181
+ unattached while the request-only service is still registered: the request-only
180
182
  attachment is restored and the failure is reported through the plugin's own
181
183
  logger in addition to the injected fiber's activation result.
182
184