dsh-ptc-plus 0.4.10 → 0.5.1
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/README.en.md +65 -127
- package/README.md +65 -127
- package/assets/dsh-ptc-plus-banner-en.webp +0 -0
- package/assets/dsh-ptc-plus-banner-zh.webp +0 -0
- package/assets/ptc-plus-repl-workspace-en.png +0 -0
- package/assets/ptc-plus-repl-workspace-zh.png +0 -0
- package/assets/ptc-plus-settings-en.png +0 -0
- package/assets/ptc-plus-settings-zh.png +0 -0
- package/client.cjs +42702 -0
- package/cordis.patch.yml +1 -0
- package/docs/README.md +6 -2
- package/docs/adr/0005-temporary-rejected-cell-edit-transport.md +31 -198
- package/docs/adr/0008-define-agent-operating-contract.md +5 -1
- package/docs/adr/0009-bound-expensive-acceptance-default.md +2 -2
- package/docs/adr/0016-archive-resolved-review-findings.md +1 -1
- package/docs/adr/0017-track-the-latest-dsh-public-surface.md +4 -4
- package/docs/adr/0019-plugin-settings-and-kill-switch.md +1 -1
- package/docs/adr/0020-optional-cordis-tools-in-ptc-mode.md +1 -1
- package/docs/adr/0022-stage-npm-releases-with-oidc.md +4 -2
- package/docs/adr/0023-global-user-bindings.md +2 -0
- package/docs/adr/0026-persist-the-delivery-verdict-against-the-verified-candidate.md +2 -0
- package/docs/adr/0028-attach-to-the-host-ptc-execution-seam.md +25 -23
- package/docs/adr/0031-close-semantic-obligations-by-owner.md +1 -1
- package/docs/adr/0034-keep-program-values-separate-from-output-projections.md +29 -0
- package/docs/adr/0035-run-coverage-only-before-a-new-release.md +27 -0
- package/docs/adr/0036-separate-focused-development-from-delivery-verification.md +29 -0
- package/docs/adr/0037-keep-tool-hover-previews-passive.md +52 -0
- package/docs/adr/0038-freeze-session-capability-plans.md +71 -0
- package/docs/adr/0039-verify-documentation-without-runtime-suites.md +29 -0
- package/docs/adr/0040-separate-capability-configurations-from-session-observations.md +39 -0
- package/docs/adr/0041-record-cell-execution-directories.md +65 -0
- package/docs/adr/0042-persist-provider-availability-and-handback.md +41 -0
- package/docs/adr/0043-compose-capability-and-context-policies.md +37 -0
- package/docs/adr/0044-coexist-with-the-official-persistent-repl.md +35 -0
- package/docs/adr/README.md +8 -0
- package/docs/architecture.md +23 -25
- package/docs/capability-planning-components.md +93 -0
- package/docs/capability-projection.md +7 -0
- package/docs/client-ui.md +70 -23
- package/docs/client-visual-contract.md +26 -9
- package/docs/context-management.md +22 -0
- package/docs/context-optimization-plan.md +353 -0
- package/docs/context-public-interface-coverage.md +25 -0
- package/docs/durability-design.md +20 -15
- package/docs/evaluation.md +41 -6
- package/docs/evaluations/command-goat-deepseek-v4.1-flash-20261006.md +126 -0
- package/docs/evaluations/command-goat-deepseek-v4.1-flash.md +281 -0
- package/docs/installation.md +33 -10
- package/docs/program-data-plane.md +5 -3
- package/docs/publishing.md +7 -7
- package/docs/release-coverage.md +73 -0
- package/docs/release-notes.md +1 -1
- package/docs/review-procedure.md +56 -0
- package/docs/runtime-reference.md +53 -16
- package/docs/semantic-validation.md +14 -2
- package/docs/stateful-binding-updates-proposal.md +2 -2
- package/docs/user-bindings.md +1 -1
- package/docs/value-wire.md +11 -1
- package/docs/verification-optimization-work.md +26 -15
- package/docs/verification.md +30 -88
- package/index.js +146 -20
- package/internal/binding-toggle-receipt.js +24 -0
- package/internal/capability-command-receipt.js +31 -0
- package/internal/capability-environment.js +1253 -0
- package/internal/capability-plan.js +285 -0
- package/internal/capability-policy.js +96 -0
- package/internal/capability-statistics-store.js +180 -0
- package/internal/capability-statistics.js +214 -0
- package/internal/config-spec.js +89 -10
- package/internal/direct-surface-owner.js +27 -29
- package/internal/dynamic-environment-runtime.js +9 -9
- package/internal/edit-transport-owner.js +195 -140
- package/internal/execution-provider-owner.js +40 -12
- package/internal/execution-seam-compat.js +26 -8
- package/internal/kernel-worker.js +104 -32
- package/internal/native-root-dynamic.js +12 -13
- package/internal/official-repl-priority.js +51 -0
- package/internal/program-bindings.js +190 -0
- package/internal/recovery-tips.js +3 -2
- package/internal/rejected-cell-editor.js +8 -8
- package/internal/repl-observation-interest.js +11 -3
- package/internal/rpc-contract.js +1 -0
- package/internal/runtime-bridge-owner.js +275 -34
- package/internal/runtime-config.js +58 -0
- package/internal/runtime-contexts.js +74 -5
- package/internal/runtime-intrinsics.js +1 -0
- package/internal/runtime-messages.js +41 -0
- package/internal/sdk-projection.js +10 -82
- package/internal/session-cell-executor.js +42 -19
- package/internal/session-events.js +34 -0
- package/internal/session-journal-recovery.js +234 -11
- package/internal/session-journal-schema.js +6 -3
- package/internal/session-journal.js +31 -2
- package/internal/session-log-view.js +1 -1
- package/internal/session-runtime.js +119 -15
- package/internal/settings-compat.js +12 -5
- package/internal/stateful-module-compiler.js +3 -2
- package/internal/stateful-module-runtime.js +7 -3
- package/internal/stateful-root-runtime.js +9 -4
- package/internal/user-binding-authoring.js +2 -7
- package/internal/user-bindings-owner.js +19 -2
- package/internal/validated-parse-repair.js +1 -1
- package/internal/value-wire.js +68 -21
- package/internal/worker-cwd-virtualization.js +20 -18
- package/internal/worker-realm-surfaces.js +3 -3
- package/package.json +49 -30
- package/src/client-activity.js +3 -2
- package/src/client-authoring-view.js +67 -30
- package/src/client-binding-review.js +2 -1
- package/src/client-binding-toggle.js +18 -0
- package/src/client-capabilities-view.js +1555 -0
- package/src/client-capability-sort.js +29 -0
- package/src/client-copy.js +923 -8
- package/src/client-feature-gates.js +3 -0
- package/src/client-indicator-view.js +4 -6
- package/src/client-primitives.js +33 -2
- package/src/client-repl-view.js +20 -13
- package/src/client-settings-view.js +411 -41
- package/src/client-styles.js +112 -15
- package/src/client-tool-hover.js +185 -0
- package/src/client-tool-view.js +45 -9
- package/src/client-transport.js +44 -9
- package/src/client-workbench.js +6 -7
- package/src/client.js +76 -22
- package/client.js +0 -32479
package/README.en.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<img src="assets/dsh-ptc-plus-banner-en.webp" width="100%" alt="PTC Plus:
|
|
2
|
+
<img src="assets/dsh-ptc-plus-banner-v2-en.webp" width="100%" alt="PTC Plus: Tweak it, keep computing!">
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
5
|
<p align="center">
|
|
@@ -25,29 +25,25 @@ PTC Plus provides a stateful TypeScript computation environment for DSH's **PTC
|
|
|
25
25
|
- **Avoid routine call failures**: use familiar module syntax, recover from identifiable call omissions, and receive correction suggestions for verifiable syntax errors.
|
|
26
26
|
- **Reuse common capabilities**: save functions as global bindings, provide their interfaces and usage notes to the model, and use them across sessions.
|
|
27
27
|
|
|
28
|
-
[Quick start](#quick-start) · [Feature overview](#feature-overview) · [Continuous computation](#continuous-computation-and-language-extensions) · [Editing and
|
|
28
|
+
[Quick start](#quick-start) · [Feature overview](#feature-overview) · [Continuous computation](#continuous-computation-and-language-extensions) · [Editing and tolerance](#code-editing-and-call-tolerance) · [Global bindings](#global-bindings-reuse-functions-across-sessions) · [Interface and settings](#interface-and-settings) · [Values and recovery](#value-transfer-and-state-recovery) · [Development](#development)
|
|
29
29
|
|
|
30
30
|
## Quick start
|
|
31
31
|
|
|
32
|
-
Requires Node.js `^22.19.0 || >=24.0.0` and the latest available official DSH release
|
|
32
|
+
Requires Node.js `^22.19.0 || >=24.0.0` and the latest available official DSH release:
|
|
33
33
|
|
|
34
34
|
```sh
|
|
35
35
|
dsh plugin --profile <profile> add dsh-ptc-plus
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
Replace `<profile>` with your profile name
|
|
38
|
+
Replace `<profile>` with your profile name, restart DSH, and select **PTC mode** in the session. Continuous computation, call tolerance, and global bindings are on by default. To upgrade, run `dsh plugin --profile <profile> add dsh-ptc-plus@latest` and restart that Host; see the [installation guide](docs/installation.md) for other installation methods, Desktop, the local development launcher, and troubleshooting.
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
The plugin declares `engines.dsh: "*"` for the Host's compatibility preflight; public capability checks and packed tests against the latest official release verify compatibility.
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Once installed, describe your task to the model as usual. The `run_code` and `edit_run_code` examples below show how the model uses these features. See the [installation guide](docs/installation.md) for other installation methods, Desktop, the local development launcher, upgrades, and troubleshooting.
|
|
45
|
-
|
|
46
|
-
For Windows source testing, double-click `scripts\run-upstream-dsh.cmd` to fetch the official DSH default branch, reuse an isolated build cache, and load this plugin checkout. The first run installs dependencies and builds DSH; see [upstream source testing](docs/installation.md#upstream-source-development-launcher-windows).
|
|
42
|
+
The session shows a **REPL** tab, and wide screens show a **PTC Plus** header indicator. The sparkle button beside the composer opens the global binding menu, the session capability workbench, and **PTC Plus settings**; **Plugins → Installed → dsh-ptc-plus → Configure** in the sidebar is the same configuration.
|
|
47
43
|
|
|
48
44
|
## Feature overview
|
|
49
45
|
|
|
50
|
-
Default PTC mode starts every execution in a fresh environment:
|
|
46
|
+
Default PTC mode starts every execution in a fresh environment: the previous call's variables are gone, and a change that depends on earlier results means resending the setup code. PTC Plus turns `run_code` into a session-bound TypeScript REPL and closes those gaps.
|
|
51
47
|
|
|
52
48
|
| Scenario | Default PTC mode | With PTC Plus |
|
|
53
49
|
| --- | --- | --- |
|
|
@@ -56,24 +52,20 @@ Default PTC mode starts every execution in a fresh environment: variables from t
|
|
|
56
52
|
| Change a small part of the code | A one-line change means resending the complete source | Submit a delta through `edit_run_code`, then execute the complete revised cell |
|
|
57
53
|
| Use module syntax | Static `import` and `export` are invalid inside the function body | Write them directly in a cell; the plugin adapts the module syntax |
|
|
58
54
|
| Omit a call summary | Missing `run_code.description` fails validation | Supply a display summary automatically so otherwise valid code proceeds |
|
|
59
|
-
| Provider rejects malformed tool JSON | The whole turn ends with a provider error |
|
|
55
|
+
| Provider rejects malformed tool JSON | The whole turn ends with a provider error | A repairable call tail continues; anything else becomes a schema rejection result so the model can continue |
|
|
60
56
|
| Recover a misplaced top-level tool call | Undeclared top-level calls are rejected in PTC mode | Convert the call to `run_code` when the live tool definitions uniquely identify the target and validate its arguments |
|
|
61
57
|
| Locate a code error | Return the native error and stack | Map the error to the cell source; suggest an edit when a missing trailing delimiter has one verified correction |
|
|
62
|
-
| Work with the current
|
|
63
|
-
| Find tools and parameters | Read through the tool interfaces already supplied to the model |
|
|
58
|
+
| Work with the current directory | Execute in the directory resolved by the Host for the current call | Relative file operations and default child processes use the session's current directory when they run, and an in-cell `tools.working_directory({ cd })` applies to the rest of that cell; module imports keep the starting directory, and existing modules and import closures retain their source base |
|
|
59
|
+
| Find tools and parameters | Read through the tool interfaces already supplied to the model | Retrieve matching interfaces in one byte-budgeted `capabilities.search` response, or list and inspect members |
|
|
64
60
|
| Transfer data beyond plain JSON | JSON cannot fully represent `undefined`, BigInt, cycles, and similar values | Preserve supported special values and reference relationships for further computation and recovery |
|
|
65
|
-
| Inspect computation state | No reusable session variables remain after a call | View retained names, source definitions, reuse counts, and
|
|
61
|
+
| Inspect computation state | No reusable session variables remain after a call | View retained names, source definitions, reuse counts, and value previews in the REPL tab |
|
|
66
62
|
| Reuse functions across sessions | Save the code yourself and reload it in later calls | Save TypeScript global bindings and supply their interfaces and usage notes to the model |
|
|
67
63
|
| Author and test global bindings | No dedicated workbench for global bindings | Ask the model for a draft to review, or run unsaved source in the workbench |
|
|
68
64
|
| Continue after a restart | No computation state spans calls, so there is nothing to recover | Recover verifiable state from session records and report what cannot be recovered |
|
|
69
65
|
|
|
70
|
-
The following sections explain usage and limits. See the [runtime reference](docs/runtime-reference.md) for complete language rules, configuration fields, and diagnostics.
|
|
71
|
-
|
|
72
66
|
## Continuous computation and language extensions
|
|
73
67
|
|
|
74
|
-
The model executes the
|
|
75
|
-
|
|
76
|
-
First, define the data and a calculation:
|
|
68
|
+
The model executes the code below through `run_code`, and each call's code is a **cell**.
|
|
77
69
|
|
|
78
70
|
```ts
|
|
79
71
|
const amounts: number[] = [12, 8, 5]
|
|
@@ -83,56 +75,35 @@ function total() {
|
|
|
83
75
|
return total() // 25
|
|
84
76
|
```
|
|
85
77
|
|
|
86
|
-
|
|
78
|
+
The next call revises the data without redefining `total`:
|
|
87
79
|
|
|
88
80
|
```ts
|
|
89
81
|
const amounts = amounts.filter(value => value >= 8)
|
|
90
82
|
return total() // 20
|
|
91
83
|
```
|
|
92
84
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
The default **stateful semantics** (`bindingUpdates: 'stateful'`) extend JavaScript/TypeScript binding rules for continued revision:
|
|
96
|
-
|
|
97
|
-
- Variables, functions, classes, and import bindings in the same scope can be updated, including bindings declared with `const`. Same-name revisions also work within a single cell.
|
|
98
|
-
- Existing closures read updated bindings; a previously saved function value remains the original function.
|
|
99
|
-
- Blocks, functions, and loop iterations retain their separate scopes.
|
|
100
|
-
- Failed initialization does not permanently reserve a name that was never successfully established. Other changes made before the failure are not rolled back.
|
|
101
|
-
|
|
102
|
-
Cells support TypeScript, top-level `await` / `return`, and static `import` / `export`. To detect name overwrites instead, disable **Allow redeclarations and overrides** to select the `protected` policy. Protected runtime names such as `tools` remain unavailable for overwriting.
|
|
103
|
-
|
|
104
|
-
<details>
|
|
105
|
-
<summary>When static imports and local overrides take effect</summary>
|
|
106
|
-
|
|
107
|
-
Static imports take effect **before the entire cell body executes**. Assignments and ordinary declarations in the body can then override them. A static import in a later cell restores the binding's live module source. Writing an import below an ordinary declaration in the same cell does not restore it at that textual position. To retrieve the current exported value at a particular step, assign it explicitly:
|
|
108
|
-
|
|
109
|
-
```ts
|
|
110
|
-
join = (await import('node:path')).join
|
|
111
|
-
```
|
|
85
|
+
The default **stateful semantics** (`bindingUpdates: 'stateful'`) extend JavaScript/TypeScript binding rules for that continued revision:
|
|
112
86
|
|
|
113
|
-
|
|
87
|
+
- Variables, functions, classes, and import bindings in the same scope can be updated, including those declared with `const`, and same-name revisions also work inside one cell.
|
|
88
|
+
- Existing closures read the updated binding, a function value saved earlier is still the original function, and blocks, functions, and loop iterations keep their separate scopes.
|
|
89
|
+
- A failed initialization does not permanently reserve that name, and changes made before the failure are not rolled back.
|
|
114
90
|
|
|
115
|
-
|
|
91
|
+
Cells support TypeScript (including runtime `enum` and namespaces), top-level `await` / `return`, and static `import` / `export`; a static import takes effect before the whole cell body executes, and an assignment later in the body can override it. To detect name overwrites instead, disable **Allow redeclarations and overrides** and use the `protected` policy; protected runtime names such as `tools` can never be overwritten.
|
|
116
92
|
|
|
117
|
-
`run_code`, edited code, and the global binding workbench follow the same language policy
|
|
93
|
+
`run_code`, edited code, and the global binding workbench follow the same language policy, while explicit `eval`, `Function`, `node:vm`, and independent runtimes keep their own native boundaries. Scope, module interoperability, and historical session rules are in the [language reference](docs/runtime-reference.md#cell-semantics), and complete language rules, configuration fields, and diagnostics are in the [runtime reference](docs/runtime-reference.md).
|
|
118
94
|
|
|
119
95
|
## Code editing and call tolerance
|
|
120
96
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
The model can use `edit_run_code` to change the most recent editable cell in the current model turn without resending its complete source. If the second cell above has just completed and the same turn is still running, its filter can be changed to `value >= 10`:
|
|
97
|
+
The model can call `tools.edit_run_code` inside a new `run_code` cell to change the most recent editable cell of the current turn without resending its source:
|
|
124
98
|
|
|
125
99
|
```js
|
|
126
|
-
edit_run_code({
|
|
100
|
+
const receipt = await tools.edit_run_code({
|
|
127
101
|
edits: [{ old_string: 'value >= 8', new_string: 'value >= 10' }]
|
|
128
102
|
})
|
|
103
|
+
return receipt
|
|
129
104
|
```
|
|
130
105
|
|
|
131
|
-
An edit
|
|
132
|
-
|
|
133
|
-
Republishing a historical result as a compacted display entry is not another execution and does not make the older cell the new edit target. A newer failed cell remains available for correction.
|
|
134
|
-
|
|
135
|
-
### Recover from identifiable call problems
|
|
106
|
+
An `accepted: true, scheduled: true` receipt means the edit is scheduled: the entire target cell reruns after the outer cell finishes, and the next cell reads the revised value (`12` above). Reads later in the accepting cell still see the old state, earlier state changes are not rolled back, and a rerun of code that wrote files or called external services still needs to account for duplicate effects. Each regular-expression edit requires `pattern`, `flags`, `replacement`, and `expected_matches`; pass `""` explicitly when no flags are needed.
|
|
136
107
|
|
|
137
108
|
| Situation | PTC Plus behavior |
|
|
138
109
|
| --- | --- |
|
|
@@ -141,122 +112,89 @@ Republishing a historical result as a compacted display entry is not another exe
|
|
|
141
112
|
| Argument validation reports a missing `description` | Distinguish outer and nested tool arguments and provide correction guidance, saved as a complete message so session history remains loadable |
|
|
142
113
|
| Code fails to parse | Identify the source position; at EOF, suggest a target-bound edit if appending one or two closing delimiters has exactly one validated correction |
|
|
143
114
|
|
|
144
|
-
The first two behaviors
|
|
115
|
+
The first two behaviors are on by default and can be disabled in settings. Syntax suggestions never execute on their own, and they say nothing about whether the code matches the task's intent. A volatile state cannot be saved as a durable checkpoint, but a rejected save leaves the current variables usable; restore does not undo external effects or change global binding configuration.
|
|
145
116
|
|
|
146
117
|
## Project files and tool capabilities
|
|
147
118
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
The model can use Node.js directly to read files, process data, and run programs. Relative file paths and imports in session code resolve from the recorded session project directory. Child processes use that directory when `cwd` is omitted; an explicit directory still takes precedence.
|
|
119
|
+
The model can use Node.js directly to read files, process data, and run programs. Relative paths and child processes without an explicit `cwd` use the session's current directory when they run, so an in-cell `tools.working_directory({ cd })` applies to the rest of that cell and matches the Host tools. Module imports and `import.meta` keep the starting directory; loaded modules, escaped import closures, and captured `require` keep their original base, and `process.chdir` is unavailable inside a cell. File, network, and other external inputs stay usable in the live environment, but a restart is not guaranteed to recover them.
|
|
151
120
|
|
|
152
|
-
|
|
121
|
+
`capabilities.search()` finds and returns complete interfaces in one call, budgeted in bytes, with oversized entries kept complete and given an individual retrieval reference; `tree()`, `find()`, and `inspect()` remain available.
|
|
153
122
|
|
|
154
123
|
```ts
|
|
155
|
-
|
|
156
|
-
const manifest = JSON.parse(await readFile('package.json', 'utf8'))
|
|
157
|
-
const deps = Object.keys(manifest.dependencies ?? {})
|
|
158
|
-
return deps.length
|
|
124
|
+
return capabilities.search({ query: 'read file content', budgetBytes: 8192 })
|
|
159
125
|
```
|
|
160
126
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
```ts
|
|
164
|
-
return deps.map(dep => dep + '@' + manifest.dependencies[dep])
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
This does not reread the file: it uses `manifest` already in the session. Direct file, network, and other external inputs can remain usable in the live environment without being guaranteed recoverable after a restart.
|
|
168
|
-
|
|
169
|
-
### Discover tools as needed
|
|
170
|
-
|
|
171
|
-
The model can still use DSH's current native tools through `tools.*`. To discover available capabilities, `capabilities.tree()` lists the catalog, `find()` searches names and descriptions, and `inspect()` provides parameter information for selected interfaces:
|
|
172
|
-
|
|
173
|
-
```ts
|
|
174
|
-
const matches = await capabilities.find('read')
|
|
175
|
-
return capabilities.inspect({
|
|
176
|
-
symbols: matches.slice(0, 4).map(item => item.symbol),
|
|
177
|
-
budget: 4,
|
|
178
|
-
})
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
Search uses lexical matching, so short keywords such as `read` or `session` work best. A miss does not prove that a tool is unavailable. Discovery grants no additional authority; DSH still validates and schedules calls. See [capability discovery](docs/runtime-reference.md#capability-discovery).
|
|
127
|
+
Search uses English/Chinese lexical matching, and a miss does not prove that a tool is unavailable. Discovery grants no additional authority, DSH still validates and schedules calls, and more usage notes are in [capability discovery](docs/runtime-reference.md#capability-discovery).
|
|
182
128
|
|
|
183
129
|
## Global bindings: reuse functions across sessions
|
|
184
130
|
|
|
185
|
-
Session variables serve the current task
|
|
186
|
-
|
|
187
|
-
Global bindings and the sparkle shortcut default to on. Create entries manually, import `.ts` files, or ask the model to write and revise them:
|
|
131
|
+
Session variables serve the current task, and **global bindings** save common TypeScript functions for multiple sessions to load: after saving `textTools`, the model can call `textTools.clean(text)`. Create entries by hand, import `.ts` files, or ask the model:
|
|
188
132
|
|
|
189
133
|
```text
|
|
190
134
|
/binding new Create textTools to trim outer whitespace while preserving interior spaces
|
|
191
135
|
/binding edit <id> Add line-by-line trimming
|
|
192
136
|
```
|
|
193
137
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
### Author, review, and enable
|
|
197
|
-
|
|
198
|
-
The model can test with in-memory examples before submitting a draft. The draft floats above the composer; expanding or collapsing it leaves the conversation in place. Opening a draft from the composer menu or original request goes directly to the large dialog. Choose **Enlarge binding draft** to review the complete source in a large dialog with independent scrolling and save/discard actions at the bottom. The header separates resize and close controls; **Shrink binding draft** returns to preview. Review its source, interface, and model instructions, then choose **Save and enable**, **Save disabled**, or **Discard draft**. Submission alone neither saves nor enables a binding. If you close the panel, the sparkle button's draft badge lets you reopen it.
|
|
199
|
-
|
|
200
|
-
The sparkle menu lists and toggles entries even before the first message; these choices apply across sessions. Enabled entries appear first; the disabled group shows its count and starts collapsed. Only the binding list scrolls, keeping authoring, revision, management, and settings actions visible at the bottom. Enabled entries' interfaces and usage notes are provided to the model in new sessions. Changes during a session are delivered on its next allowed request.
|
|
201
|
-
|
|
202
|
-
### Interface guidance and independent trial runs
|
|
203
|
-
|
|
204
|
-
Each entry can derive its public interface from source and include purpose, input constraints, or examples. Editing only its instructions does not reset its loaded runtime state. Assignment or redeclaration in a session overrides only the corresponding name and does not rewrite the saved global entry.
|
|
138
|
+
The draft the model submits floats above the composer, and in the large dialog you read the complete source, interface, and model instructions before choosing **Save and enable**, **Save disabled**, or **Discard draft**; submitting a draft neither saves nor enables it. Enabled entries' interfaces and usage notes go to the model in new sessions, and a change made during a session takes effect on its next allowed request.
|
|
205
139
|
|
|
206
|
-
The workbench
|
|
140
|
+
The workbench runs unsaved source and keeps temporary variables between executions; its computation state is separate from the model's session, file and network operations still have real effects, and entries can be managed without an active PTC session. See the [global binding guide](docs/user-bindings.en.md) for source format, interface generation, storage, and the full workflow.
|
|
207
141
|
|
|
208
142
|
## Interface and settings
|
|
209
143
|
|
|
210
|
-
The **REPL tab**
|
|
211
|
-
|
|
212
|
-
Workbench controls provide visible keyboard focus and disabled feedback, and REPL names remain readable in light and dark themes. See the [visual contract](docs/client-visual-contract.md) for browser regression checks and their coverage limits.
|
|
144
|
+
The **REPL tab** lists the names kept in the session with their definitions, reuse counts, and value previews, and opens the global binding workbench. Hovering a collapsed execution card for 400 ms, or focusing it with the keyboard, shows an excerpt of its recorded source, result, and feature notices, and click, Enter/Space, or tap expands the full content and copies the code; “Preview execution content on hover” under Interface display turns this off.
|
|
213
145
|
|
|
214
146
|

|
|
215
147
|
|
|
216
|
-
The
|
|
217
|
-
|
|
218
|
-
| Group | What you can adjust |
|
|
219
|
-
| --- | --- |
|
|
220
|
-
| Plugin switch | Enable or disable PTC Plus |
|
|
221
|
-
| Tool call tolerance | Missing call summaries and identifiable misplaced native-tool calls |
|
|
222
|
-
| REPL syntax | Allow same-name revisions or choose name protection |
|
|
223
|
-
| State and recovery | Restart recovery, contextual tips, and their frequency |
|
|
224
|
-
| Tool extensions | Global bindings and their management entry, official Cordis tool integration |
|
|
225
|
-
| Interface display | Enhanced tool cards, the REPL tab, and the sparkle shortcut |
|
|
226
|
-
| Resource limits | Execution time, memory, and output budgets |
|
|
148
|
+
The settings window and the sidebar plugin configuration page are the same configuration, grouped like this:
|
|
227
149
|
|
|
228
|
-
|
|
150
|
+
| Functional module | Group | What you can adjust |
|
|
151
|
+
| --- | --- | --- |
|
|
152
|
+
| Plugin switch | PTC Plus title switch | Enable or disable PTC Plus |
|
|
153
|
+
| Core workspace | REPL syntax | Allow same-name revisions or choose name protection |
|
|
154
|
+
| Core workspace | State and recovery | Restart recovery, official REPL ownership, contextual tips, and their frequency |
|
|
155
|
+
| Extensions and tolerance | Tool extensions | Global bindings and their management entry, official Cordis tool integration |
|
|
156
|
+
| Extensions and tolerance | Tool call tolerance | Missing call summaries and identifiable misplaced native-tool calls |
|
|
157
|
+
| Interface and resources | Interface display | Enhanced tool cards, the REPL tab, and the sparkle shortcut |
|
|
158
|
+
| Interface and resources | Resource limits | Execution time, memory, and output budgets |
|
|
159
|
+
| Experimental | Capabilities and context | Experimental capability management (off by default), independent statistics, common baseline, individual choices, and presentation budgets |
|
|
229
160
|
|
|
230
|
-
|
|
161
|
+
Everyday computation features are on by default, and **Cordis development tools are off by default** so they can be enabled when inspecting or developing DSH plugins; see the [integration notes](docs/adr/0020-optional-cordis-tools-in-ptc-mode.md).
|
|
231
162
|
|
|
232
|
-
|
|
163
|
+
Capabilities and context is an experimental group, off by default. It selects availability and disclosure for Skills, tools, and MCP capabilities by category, source, or item, and it also covers Initial prompt, Prompt recovery, Output excerpts, and Usage statistics; the switch beside its title pauses the whole group while keeping every choice, and changes apply to new sessions or to a session after an explicit refresh. The sparkle menu also opens the session capability workbench, which views and adjusts the current session's capabilities by category, source, and state: edits live in one draft that you can apply to this session only or save as the global default. See the [configuration reference](docs/runtime-reference.md#configuration) for fields, defaults, and full limits.
|
|
233
164
|
|
|
234
|
-
|
|
165
|
+
Before a new session starts, capability and global binding changes only update its initial configuration; no change notices are sent or queued. The first request uses the resulting configuration.
|
|
235
166
|
|
|
236
|
-
|
|
167
|
+
The host execution provider must use TypeScript; changing it to another language during a reload withdraws the plugin and reports a diagnostic, and switching back re-enables it.
|
|
237
168
|
|
|
238
|
-
|
|
169
|
+
With DSH's official `executionMode: persistent-in-memory` enabled, **Prioritize the official REPL mode** under State and recovery chooses who owns the PTC session: disabled by default, so PTC Plus owns `run_code`; enabled, the official runtime owns execution and PTC Plus leaves execution, REPL state semantics, and observation to it. The setting has no effect while the official mode is off. Ownership changes take effect immediately and leaving plugin execution disposes its in-memory environment. Official in-memory state follows DSH's Agent/provider lifecycle; changing priority does not guarantee clearing it. Official-mode calls stay outside the plugin's records, so they never count as recoverable state after switching back to the plugin.
|
|
239
170
|
|
|
240
|
-
|
|
171
|
+

|
|
241
172
|
|
|
242
|
-
|
|
173
|
+
## Value transfer and state recovery
|
|
243
174
|
|
|
244
|
-
|
|
175
|
+
Stopping a background subagent preserves the parent session's REPL state, so calls triggered by its notification can continue using the parent's variables. If the parent session itself is disposed, later calls follow the recovery rules below.
|
|
245
176
|
|
|
246
|
-
|
|
177
|
+
Within the supported range of the plugin's graph IPC, program arguments, results, and recovery records keep `undefined`, BigInt, `NaN`, infinities, sparse arrays, cycles, and shared references, and supported values can be returned directly without writing `JSON.stringify` yourself (it drops object fields containing `undefined`, turns `NaN` and infinities into `null` and `-0` into `0`, and rejects BigInt). Functions, Promises, class instances, Date, Map, and Set are outside that range, and native `tools.*` JSON argument and result contracts do not change; see the [value contract](docs/value-wire.md).
|
|
247
178
|
|
|
248
|
-
|
|
179
|
+
Session state is not permanent memory: after a restart, a runtime reset, or context compaction, only state verifiable from session records whose provenance remains in the model's context is retained, and everything else is discarded with a diagnostic, continuing in an empty environment when necessary. Missing or damaged session records produce an explicit error instead of being treated as a successfully recovered empty session. Recovery neither redispatches recorded native-tool calls nor reverses historical external effects; see the [runtime reference](docs/runtime-reference.md) for its evidence and limits.
|
|
249
180
|
|
|
250
181
|
## Boundaries
|
|
251
182
|
|
|
252
|
-
- **Execution permissions**: primarily designed for `danger-full-access`. Code can
|
|
253
|
-
- **Failures and reruns**: a failed execution does not mean earlier statements had no effect. Process isolation, editing, and recovery do not
|
|
254
|
-
- **Errors and cost**: language adaptation and call tolerance do not guarantee that every program
|
|
183
|
+
- **Execution permissions**: primarily designed for `danger-full-access`. Code can reach Node.js and the operating system directly, and the plugin adds no security sandbox; native-tool permissions, approvals, cancellation, and sandbox policy stay with DSH.
|
|
184
|
+
- **Failures and reruns**: a failed execution does not mean earlier statements had no effect. Process isolation, editing, and recovery do not make an external operation safe to repeat, and a timeout or an output overflow can release the computation environment.
|
|
185
|
+
- **Errors and cost**: language adaptation and call tolerance do not guarantee that every program runs, and actual call counts and token usage depend on the task and model; the [evaluation notes](docs/evaluation.md#recorded-paired-observation) record one comparison and its limits.
|
|
255
186
|
|
|
256
187
|
PTC Plus is a community plugin, with no affiliation with or endorsement from DeepSeek or DSH.
|
|
257
188
|
|
|
258
|
-
##
|
|
189
|
+
## Development
|
|
190
|
+
|
|
191
|
+
Development happens in the repository root: `npm ci` installs dependencies and `npm run build` regenerates `client.cjs` and the compiler artifacts. Focused tests require an explicit selection:
|
|
192
|
+
|
|
193
|
+
```sh
|
|
194
|
+
npm run test:backend:focus -- --file test/<owner>.test.js --test-name-pattern="<case>"
|
|
195
|
+
npm run test:client:focus -- "<test name pattern>"
|
|
196
|
+
```
|
|
259
197
|
|
|
260
|
-
[
|
|
198
|
+
Before delivery, pick the check through [change classification](docs/verification.md#change-classification): documentation-only changes run `npm run verify:docs`, everything else runs `npm run check`, and both are followed by the [review procedure](docs/review-procedure.md). Architecture and the data plane are in [architecture and development](docs/architecture.md), the [documentation index](docs/README.md) lists everything, and installation and publishing are covered by the [installation guide](docs/installation.md) and the [publishing procedure](docs/publishing.md).
|
|
261
199
|
|
|
262
200
|
[MIT License](LICENSE)
|