dsh-ptc-plus 0.4.2 → 0.4.3

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 (83) hide show
  1. package/README.en.md +166 -76
  2. package/README.md +167 -77
  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-icon.svg +5 -0
  6. package/client.js +593 -306
  7. package/compiler-core.cjs +162 -160
  8. package/compiler-core.cjs.map +3 -3
  9. package/docs/README.md +3 -1
  10. package/docs/adr/0005-temporary-rejected-cell-edit-transport.md +8 -7
  11. package/docs/adr/0008-define-agent-operating-contract.md +2 -2
  12. package/docs/adr/0010-session-log-derived-recovery-tips.md +7 -0
  13. package/docs/adr/0016-archive-resolved-review-findings.md +3 -3
  14. package/docs/adr/0019-plugin-settings-and-kill-switch.md +3 -3
  15. package/docs/adr/0020-optional-cordis-tools-in-ptc-mode.md +2 -0
  16. package/docs/adr/0021-separate-host-bootstrap-from-session-runtime.md +14 -3
  17. package/docs/adr/0023-global-user-bindings.md +1 -1
  18. package/docs/adr/0026-persist-the-delivery-verdict-against-the-verified-candidate.md +23 -7
  19. package/docs/adr/0027-run-the-session-kernel-in-a-killable-helper-process.md +4 -0
  20. package/docs/adr/0028-attach-to-the-host-ptc-execution-seam.md +26 -6
  21. package/docs/adr/0031-close-semantic-obligations-by-owner.md +29 -0
  22. package/docs/adr/README.md +4 -4
  23. package/docs/architecture.md +6 -5
  24. package/docs/binding-review-placement-design.md +1 -1
  25. package/docs/client-ui.md +8 -4
  26. package/docs/durability-design.md +7 -7
  27. package/docs/installation.md +26 -8
  28. package/docs/runtime-reference.md +18 -11
  29. package/docs/semantic-validation.md +7 -3
  30. package/docs/user-bindings.en.md +7 -6
  31. package/docs/user-bindings.md +6 -5
  32. package/docs/value-wire.md +1 -1
  33. package/docs/verification.md +38 -1
  34. package/index.js +39 -34
  35. package/internal/async-local-storage-intrinsics.js +12 -7
  36. package/internal/callable-source-facts.js +37 -1
  37. package/internal/cell-analysis.js +64 -9
  38. package/internal/config-spec.js +1 -1
  39. package/internal/cordis-tools-owner.js +20 -10
  40. package/internal/edit-transport-owner.js +80 -20
  41. package/internal/execution-seam-compat.js +192 -30
  42. package/internal/kernel-worker.js +162 -72
  43. package/internal/message-sources.js +14 -0
  44. package/internal/module-compilation.js +2 -1
  45. package/internal/repl-memory-projection.js +10 -0
  46. package/internal/repl-scope-normalizer.js +72 -35
  47. package/internal/repl-value-observer.js +141 -45
  48. package/internal/runtime-config.js +62 -2
  49. package/internal/runtime-intrinsics.js +3 -0
  50. package/internal/runtime-messages.js +6 -4
  51. package/internal/session-cell-executor.js +24 -1
  52. package/internal/session-journal-recovery.js +267 -67
  53. package/internal/session-journal.js +466 -40
  54. package/internal/session-log-view.js +5 -4
  55. package/internal/session-runtime.js +45 -21
  56. package/internal/session-state.js +7 -29
  57. package/internal/settings-compat.js +66 -1
  58. package/internal/source-position-map.js +19 -0
  59. package/internal/user-binding-console-worker.js +23 -9
  60. package/internal/user-binding-draft-projection.js +3 -2
  61. package/internal/user-bindings-owner.js +2 -1
  62. package/internal/user-bindings.js +6 -1
  63. package/internal/validated-parse-repair.js +6 -2
  64. package/internal/value-wire.js +95 -30
  65. package/internal/worker-client.js +99 -8
  66. package/internal/worker-cwd-virtualization.js +10 -9
  67. package/internal/worker-output-capture.js +187 -0
  68. package/internal/worker-output-fence.js +26 -0
  69. package/internal/worker-realm-surfaces.js +197 -0
  70. package/internal/worker-repl-realm.js +10 -4
  71. package/package.json +36 -4
  72. package/src/client-activity.js +4 -1
  73. package/src/client-authoring-view.js +121 -62
  74. package/src/client-console.js +4 -2
  75. package/src/client-copy.js +4 -2
  76. package/src/client-feature-gates.js +7 -9
  77. package/src/client-host-compat.js +104 -27
  78. package/src/client-repl-view.js +3 -1
  79. package/src/client-styles.js +12 -1
  80. package/src/client-tool-view.js +3 -1
  81. package/src/client-transport.js +2 -2
  82. package/src/client-workbench.js +4 -3
  83. package/src/client.js +56 -17
package/README.en.md CHANGED
@@ -1,24 +1,13 @@
1
1
  <p align="center">
2
- <img src="assets/dsh-ptc-plus-banner-en.webp" width="100%" alt="dsh-ptc-plus banner">
2
+ <img src="assets/dsh-ptc-plus-banner-en.webp" width="100%" alt="PTC Plus: No need to start over! Update it. Keep computing!">
3
3
  </p>
4
4
 
5
5
  <p align="center">
6
- <a href="README.md">简体中文</a> ·
7
- <strong>English</strong>
8
- </p>
9
-
10
- <p align="center">
11
- <a href="#what-default-ptc-mode-gets-wrong">Problems</a> ·
12
- <a href="#three-scenes-that-matter-most">Scenes</a> ·
13
- <a href="#settings">Settings</a> ·
14
- <a href="#scope">Scope</a> ·
15
- <a href="#install">Install</a> ·
16
- <a href="#documentation">Docs</a>
6
+ <a href="README.md">简体中文</a> · <strong>English</strong>
17
7
  </p>
18
8
 
19
9
  <p align="center">
20
10
  <a href="https://github.com/deepseek-ai/deepseek-harness"><img alt="DeepSeek Harness PTC mode" src="https://img.shields.io/badge/DeepSeek%20Harness-PTC%20mode-4b6bfb"></a>
21
- <a href="package.json"><img alt="Node.js ^22.19.0 || >=24.0.0" src="https://img.shields.io/badge/Node.js-%5E22.19.0%20%7C%7C%20%3E%3D24.0.0-5fa04e?logo=nodedotjs&logoColor=white"></a>
22
11
  <a href="https://www.npmjs.com/package/dsh-ptc-plus"><img alt="npm version" src="https://img.shields.io/npm/v/dsh-ptc-plus?logo=npm"></a>
23
12
  <a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg"></a>
24
13
  </p>
@@ -27,53 +16,132 @@
27
16
  <a href="https://awesome-dsh-plugin.com/"><img alt="Awesome DSH Plugin" src="https://awesome-dsh-plugin.com/badge.svg"></a>
28
17
  </p>
29
18
 
30
- ---
19
+ **Let the model keep computing and revise its work within a session, with less repeated setup and fewer avoidable tool-call errors.**
31
20
 
32
- **PTC Plus gives DSH PTC mode a persistent TypeScript REPL.** Variables, imports, and computed results from one `run_code` remain available to the next. By default, revise names directly: existing closures observe updated bindings, imports can be overridden and re-imported, and failed declarations do not permanently occupy a name.
21
+ PTC Plus provides a stateful TypeScript computation environment for DSH's **PTC mode**. Built on a REPL, it keeps variables, functions, imports, and intermediate results available across tool calls. It extends declaration update rules and adapts module syntax, with call tolerance and code editing designed for models that repeatedly write and revise code.
33
22
 
34
- > [!NOTE]
35
- > Community plugin, with no affiliation with or endorsement from DeepSeek or DSH.
23
+ - **Keep computing**: reuse data already loaded and processed in the session.
24
+ - **Revise directly**: update a variable or function under the same name; existing closures read the updated binding. Small changes can be sent as code deltas.
25
+ - **Avoid routine call failures**: use familiar module syntax, recover from identifiable call omissions, and receive correction suggestions for verifiable syntax errors.
26
+ - **Reuse common capabilities**: save functions as global bindings, provide their interfaces and usage notes to the model, and use them across sessions.
36
27
 
37
- > [!IMPORTANT]
38
- > Built for `danger-full-access`: code can access Node.js and the operating system directly. The plugin adds no sandbox. Use it where that permission scope is acceptable.
28
+ [Quick start](#quick-start) · [Feature overview](#feature-overview) · [Continuous computation](#continuous-computation-and-language-extensions) · [Editing and call 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)
39
29
 
40
- ## Install
30
+ ## Quick start
41
31
 
42
- Requires Node.js `^22.19.0 || >=24.0.0` and official DSH with TypeScript PTC mode. Install into your profile, restart DSH, and select PTC mode:
32
+ Requires Node.js `^22.19.0 || >=24.0.0` and the latest available official DSH release. Install into the profile you actually use:
43
33
 
44
34
  ```sh
45
35
  dsh plugin --profile <profile> add dsh-ptc-plus
46
36
  ```
47
37
 
48
- No DSH modifications or custom build are required. See the [installation guide](docs/installation.md) for other installation methods, upgrades, and troubleshooting.
38
+ Replace `<profile>` with your profile name. Restart DSH and select **PTC mode** in the session. Continuous computation, call tolerance, and global bindings default to on. Explicitly disabled options in an existing configuration stay disabled.
49
39
 
50
- ## What default PTC mode gets wrong
40
+ With the default interface settings, the session has a **REPL** tab; wide screens also show a green **PTC Plus** header indicator. The sparkle button beside the composer opens the global binding menu and **PTC Plus settings**. You can also open **Plugins → Installed → dsh-ptc-plus → Configure** in the sidebar to check the main switch and all plugin settings.
51
41
 
52
- Default PTC mode starts each execution in a fresh environment, so the model must resend setup code. PTC Plus keeps the session's computation state available for subsequent calls.
42
+ 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.
43
+
44
+ ## Feature overview
45
+
46
+ Default PTC mode starts every execution in a fresh environment: variables from the previous call 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 the gaps below.
53
47
 
54
48
  | Scenario | Default PTC mode | With PTC Plus |
55
49
  | --- | --- | --- |
56
- | Continue a calculation | Each call starts fresh and needs the setup code again | Reuse existing variables, functions, imports, and results directly |
57
- | Fix one mistake | Resend the complete corrected code | Send only the changes with `edit_run_code`, then execute the complete corrected cell |
58
- | Use module syntax | Static `import` and `export` are invalid inside the function body | Write them directly in cells; the plugin adapts them |
59
- | Pass special values | JSON cannot fully represent `undefined`, BigInt, cycles, and similar values | Preserve supported special values and reference relationships for further computation and recovery |
60
- | Find an available tool | Look through the tool interfaces supplied to the model | List and search tools from code, then inspect their parameters as needed |
61
- | Omit a call summary | Missing `run_code.description` fails validation | Supply a display summary automatically so valid code can proceed |
62
- | Recover a top-level tool miscall | Undeclared top-level calls are rejected in PTC mode | Convert a miscall to `run_code` when current tool definitions uniquely identify its target and validate the arguments |
63
- | Access project files | Relative Node paths depend on the host process directory | Resolve file paths, modules, and the default child-process directory from the recorded session project |
64
- | Locate a code error | Return the native error and stack | Map errors to cell source positions; suggest an edit when a single missing closing delimiter has one verified correction |
65
- | Inspect computation state | No reusable session variables remain after execution | Inspect retained variables, definitions, and bounded value previews in the REPL tab |
66
- | Author and reuse helpers | Save the code yourself and load it again in later calls | Author drafts with `/binding`, review them above the composer, and save; enabled bindings work across sessions and supply their interfaces to the model |
67
- | Try a helper manually | No dedicated code workbench for global bindings | Run unsaved source, test it across successive inputs, and inspect results in a workbench with temporary state separate from the Agent session |
68
- | Continue after a restart | No computation state spans calls for recovery | Restore verifiable state from the session record and report what could not be recovered |
50
+ | Continue processing data | Each call starts fresh, so setup code must be sent again | Variables, functions, imports, and intermediate results stay in the session for the next call |
51
+ | Revise an existing name | No established binding can be updated, so the whole cell has to be resent | Revise variables, functions, classes, and import bindings under the same names; existing closures read updated bindings |
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 |
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 |
54
+ | Omit a call summary | Missing `run_code.description` fails validation | Supply a display summary automatically so otherwise valid code proceeds |
55
+ | 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 |
56
+ | 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 |
57
+ | Work with the current project | Relative Node paths depend on the host process directory | Resolve file paths, session module imports, and default child-process directories from the session project directory |
58
+ | Find tools and parameters | Read through the tool interfaces already supplied to the model | List and search current capabilities in code, then inspect relevant interfaces on demand |
59
+ | 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 |
60
+ | Inspect computation state | No reusable session variables remain after a call | View retained names, source definitions, reuse counts, and bounded value previews in the REPL tab |
61
+ | 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 |
62
+ | 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 |
63
+ | 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 |
64
+
65
+ The following sections explain usage and limits. See the [runtime reference](docs/runtime-reference.md) for complete language rules, configuration fields, and diagnostics.
66
+
67
+ ## Continuous computation and language extensions
68
+
69
+ The model executes the following code through `run_code`. Each call's code is a **cell**.
70
+
71
+ First, define the data and a calculation:
72
+
73
+ ```ts
74
+ const amounts: number[] = [12, 8, 5]
75
+ function total() {
76
+ return amounts.reduce((sum, value) => sum + value, 0)
77
+ }
78
+ return total() // 25
79
+ ```
80
+
81
+ In the next call, revise the data and reuse the function:
82
+
83
+ ```ts
84
+ const amounts = amounts.filter(value => value >= 8)
85
+ return total() // 20
86
+ ```
87
+
88
+ There is no need to redefine `total` or invent another variable name to avoid a redeclaration error. `total()` reads the updated `amounts`.
89
+
90
+ The default **stateful semantics** (`bindingUpdates: 'stateful'`) extend JavaScript/TypeScript binding rules for continued revision:
91
+
92
+ - 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.
93
+ - Existing closures read updated bindings; a previously saved function value remains the original function.
94
+ - Blocks, functions, and loop iterations retain their separate scopes.
95
+ - Failed initialization does not permanently reserve a name that was never successfully established. Other changes made before the failure are not rolled back.
96
+
97
+ 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.
98
+
99
+ <details>
100
+ <summary>When static imports and local overrides take effect</summary>
101
+
102
+ 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:
69
103
 
70
- Global bindings must be enabled in settings. See [Settings](#settings) and [Scope](#scope) below for optional behavior and recovery limits.
104
+ ```ts
105
+ join = (await import('node:path')).join
106
+ ```
107
+
108
+ This captures the function value at that moment; a static import follows its module source. See the [runtime reference](docs/runtime-reference.md#cell-semantics) for more language rules.
109
+
110
+ </details>
111
+
112
+ `run_code`, edited code, and the global binding workbench follow the same language policy; the workbench's temporary state is separate from the model's session. Explicit `eval`, `Function`, `node:vm`, and independent runtimes retain their corresponding native boundaries. See the [language reference](docs/runtime-reference.md#cell-semantics) for scope, module interoperability, and historical session rules.
113
+
114
+ ## Code editing and call tolerance
115
+
116
+ ### Send only the change
117
+
118
+ 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`:
119
+
120
+ ```js
121
+ edit_run_code({
122
+ edits: [{ old_string: 'value >= 8', new_string: 'value >= 10' }]
123
+ })
124
+ ```
125
+
126
+ An edit **reruns the entire cell**; this example returns `12`. Earlier state changes are not rolled back. If the code writes files or calls external services, rerunning still requires considering duplicate effects. Edits can repair failed code or refine a successful computation.
71
127
 
72
- ## Three scenes that matter most
128
+ ### Recover from identifiable call problems
73
129
 
74
- ### State carries over
130
+ | Situation | PTC Plus behavior |
131
+ | --- | --- |
132
+ | `run_code` omits its outer `description` | Supply a display summary so code with otherwise valid arguments can execute |
133
+ | The model calls a native tool outside the PTC direct-tool list | Convert it to the corresponding `run_code` when current tool definitions uniquely identify the target and validate the arguments |
134
+ | 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 |
75
135
 
76
- The model first executes:
136
+ The first two behaviors default to on and can be disabled in settings. Syntax suggestions do not execute automatically or establish that the code matches the task's intent.
137
+
138
+ ## Project files and tool capabilities
139
+
140
+ ### Start from the session project directory
141
+
142
+ 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.
143
+
144
+ For example, in a project containing `package.json`, the first call reads its dependencies:
77
145
 
78
146
  ```ts
79
147
  import { readFile } from 'node:fs/promises'
@@ -82,79 +150,101 @@ const deps = Object.keys(manifest.dependencies ?? {})
82
150
  return deps.length
83
151
  ```
84
152
 
85
- The next call continues directly:
153
+ The next call works directly with the loaded data:
86
154
 
87
155
  ```ts
88
156
  return deps.map(dep => dep + '@' + manifest.dependencies[dep])
89
157
  ```
90
158
 
91
- `deps` and `manifest` remain in the current session. No repeated setup is needed.
159
+ 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.
92
160
 
93
- ### Fix without resending
161
+ ### Discover tools as needed
94
162
 
95
- The model can submit just the replacement:
163
+ 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:
96
164
 
97
165
  ```ts
98
- edit_run_code({ edits: [{ old_string: 'deps.length', new_string: 'deps' }] })
166
+ const matches = await capabilities.find('read')
167
+ return capabilities.inspect({
168
+ symbols: matches.slice(0, 4).map(item => item.symbol),
169
+ budget: 4,
170
+ })
99
171
  ```
100
172
 
101
- Editing reruns the entire cell. Code that has written files or called external services still requires a safe retry. Syntax errors identify the location; an unambiguous missing closing delimiter can also receive a correction suggestion.
173
+ 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).
102
174
 
103
- ![Rejected run_code followed by an edit_run_code correction](assets/ptc-plus-repair-en.png)
175
+ ## Global bindings: reuse functions across sessions
104
176
 
105
- ### Have the Agent author a reusable helper
177
+ Session variables serve the current task. **Global bindings** save common TypeScript functions for multiple sessions to load. For example, after saving a binding named `textTools`, the model can call `textTools.clean(text)`.
106
178
 
107
- Enable **Global User Bindings** in settings, then enter:
179
+ Global bindings and the sparkle shortcut default to on. Create entries manually, import `.ts` files, or ask the model to write and revise them:
108
180
 
109
181
  ```text
110
182
  /binding new Create textTools to trim outer whitespace while preserving interior spaces
111
183
  /binding edit <id> Add line-by-line trimming
112
184
  ```
113
185
 
114
- The Agent can test and revise the helper incrementally with in-memory REPL examples before submitting a draft. Authoring tests must not modify external files or services. The draft opens above the composer, where you can inspect its source and model prompt, then choose **Save as disabled**, **Save and enable**, or **Discard draft**. Testing and submission do not save a global binding.
186
+ `<id>` is the entry's identifier in the workbench. You can also select the binding to revise from the sparkle menu.
187
+
188
+ ### Author, review, and enable
189
+
190
+ The model can test with in-memory examples before submitting a draft. The draft appears above the composer, where you 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.
115
191
 
116
- The panel can be collapsed or closed; the sparkle button's badge reopens it. A successful save or discard closes the panel automatically. The original request retains its source and outcome in history.
192
+ The sparkle menu lists and toggles entries even before the first message; these choices apply across sessions. 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.
117
193
 
118
- Before the first message, hover over or click the sparkle button to view and toggle global bindings. These choices apply to all sessions. The shortcut appears only while the current session uses the `ptc` or compatible `code` preset. The menu also provides new-binding authoring, existing-binding revision, full management, and a PTC Plus settings shortcut. The settings shortcut opens an in-app dialog containing every plugin setting, while its hover hint still names the host's native settings path. The reusable REPL binding list shows per-binding and total reuse counts, and a redeclaration never resets them.
194
+ ### Interface guidance and independent trial runs
119
195
 
120
- Enabled binding interfaces are supplied to the model in new sessions and updated at the next permitted request in an existing session. A source-derived interface retains standard global types, referenced local types, representable class heritage, and class instance fields used by its public signatures; abstract classes remain non-constructable, and an imported type that cannot form a self-contained interface produces an explicit error before save. Each binding can include a separate usage prompt or omit its interface. Changing only the prompt preserves the helper's runtime state. Assigning or redeclaring one name in a session overrides only that name; the entry's other names keep working, and the session-local override never writes back to the saved entry. See the [global binding guide](docs/user-bindings.en.md) for details.
196
+ 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.
121
197
 
122
- ## Settings
198
+ The workbench can run unsaved source and retain temporary variables across executions. Its computation state is separate from the model's session, making it useful for manual function checks; file and network operations still have real effects. 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.
123
199
 
124
- Choose **PTC Plus settings** in the sparkle menu beside the composer to open the complete settings dialog directly. The host's native entry remains available. Depending on the DSH interface, find the plugin on the side-bar **Plugins** page and choose **Configure**, or open **Settings → Plugin configuration → PTC Plus**. The main switch controls the plugin; other settings are grouped by purpose:
200
+ ## Interface and settings
125
201
 
126
- - **Tool call tolerance**: accept `run_code` without a summary and repair uniquely identifiable top-level native-tool miscalls.
127
- - **REPL syntax**: `bindingUpdates` defaults to `stateful`, allowing cross-cell updates of variables, functions, classes, and import aliases, and letting a repeated declaration in one logical scope of one cell update the same identity; choose `protected` to keep name protection. `tools` and the injected error classes can be neither redeclared nor written: a declaration collision reports `PTC-N001`, and a failed assignment names the affected binding. Existing configurations that still contain five separate switches appear as pending migration, and the settings page lets you choose either unified policy directly. Module syntax is enabled by default.
128
- - **Module interoperability**: PTC-managed namespaces support live reads and local overrides, including when passed to external functions. External code independently importing a compiled module through native APIs does not receive the same namespace or writable-export guarantee. See the [runtime reference](docs/runtime-reference.md#cell-semantics).
129
- - **State and recovery**: control restart recovery and contextual error tips.
130
- - **Tool extensions**: enable global bindings or official Cordis tools for advanced use.
131
- - **Interface display**: control enhanced tool cards, the REPL tab, and the binding authoring shortcut.
132
- - **Resource limits**: adjust execution time, memory, and output limits.
202
+ The **REPL tab** lets you search retained names, inspect definitions, see reuse counts and bounded value previews, and open the global binding workbench. Previews have type and size limits; missing, incomplete, or unreadable previews are identified explicitly, and display does not invoke user getters. The green **PTC Plus** header indicator offers a quick binding list on wide screens; use the REPL tab on narrow screens.
133
203
 
134
- Global bindings and Cordis tools default to off. Settings generally apply immediately; a worker's memory limit cannot change while it is active. See the [configuration reference](docs/runtime-reference.md#configuration) for fields, defaults, and limits.
204
+ ![Session state and the global binding workbench in the REPL tab](assets/ptc-plus-repl-workspace-en.png)
135
205
 
136
- `run_code`, `edit_run_code`, binding workbench runs, and user binding execution follow the same stateful semantics. Within each computation environment, cells, PTC-managed modules, `require`, and binding modules share the worker's Node realm, so `Error` subclass checks and `globalThis` writes retain Node behavior. Explicit use of `eval`, `Function`, `node:vm`, or an independent runtime retains its native boundary. Changing the binding update policy does not rewrite the execution environment of existing closures and functions. See the [runtime reference](docs/runtime-reference.md#cell-semantics) for scope, source observation, module interoperability, and recorded-session compatibility rules.
206
+ The sparkle menu beside the composer groups binding authoring, entry management, and **PTC Plus settings**. Its settings dialog and the sidebar plugin configuration page share the same configuration:
207
+
208
+ | Group | What you can adjust |
209
+ | --- | --- |
210
+ | Plugin switch | Enable or disable PTC Plus |
211
+ | Tool call tolerance | Missing call summaries and identifiable misplaced native-tool calls |
212
+ | REPL syntax | Allow same-name revisions or choose name protection |
213
+ | State and recovery | Restart recovery, contextual tips, and their frequency |
214
+ | Tool extensions | Global bindings and their management entry, official Cordis tool integration |
215
+ | Interface display | Enhanced tool cards, the REPL tab, and the sparkle shortcut |
216
+ | Resource limits | Execution time, memory, and output budgets |
217
+
218
+ Everyday computation features default to on. **Cordis development tools default to off** and can be enabled when inspecting or developing DSH plugins; see the [integration notes](docs/adr/0020-optional-cordis-tools-in-ptc-mode.md). Explicitly disabled options stay disabled, and each saved binding keeps its own enabled state.
219
+
220
+ Settings usually apply immediately. A worker's memory limit cannot be changed while that worker is active. See the [configuration reference](docs/runtime-reference.md#configuration) for fields, defaults, and full limits.
137
221
 
138
222
  ![PTC Plus settings card](assets/ptc-plus-settings-en.png)
139
223
 
140
- The **REPL** tab lets you search session bindings, inspect definitions, and manage global bindings. The global binding workbench's code console can run unsaved source with independent temporary state. File and network operations performed there still have real effects.
224
+ ## Value transfer and state recovery
225
+
226
+ ### Preserve values beyond plain JSON
227
+
228
+ Within the supported value domain, tool arguments, results, and recovery records preserve `undefined`, BigInt, `NaN`, infinities, sparse arrays, cycles, and shared references. Ordinary JSON results remain structured values; special values are displayed as readable text to the model, separately from their program values.
141
229
 
142
- ![REPL workspace with session inspection and global binding management](assets/ptc-plus-repl-workspace-en.png)
230
+ This does not make every JavaScript object transferable or persistent: functions, Promises, class instances, Date, Map, and Set are outside the value-transfer domain. Keeping a function in the REPL for later calls is different from returning that function as a tool result. Reuse session variables for continued computation; see the [value-transfer specification](docs/value-wire.md) for the complete supported domain.
143
231
 
144
- On wide screens, the green **PTC Plus** header indicator offers a quick binding list. On narrow screens, use the **REPL** tab:
232
+ ### Recover state with verifiable history
145
233
 
146
- ![Reusable REPL bindings](assets/ptc-plus-bindings-en.png)
234
+ Session state is not permanent memory. After a restart, runtime reset, or context compaction, only state verifiable from session records whose provenance remains in the model's context can be retained. Direct file or network inputs, damaged history, and compacted source provenance can reduce what remains available.
147
235
 
148
- ## Scope
236
+ Unverifiable state is discarded with a diagnostic; if necessary, the current computation continues in an empty environment. Recovery neither redispatches recorded native-tool calls nor reverses historical external effects. See the [runtime reference](docs/runtime-reference.md) for recovery evidence and limits.
149
237
 
150
- DSH continues to own tool permissions, approvals, cancellation, and sandbox policy. PTC Plus evaluates session code in a reclaimable helper process, so stuck or unresponsive computation can be terminated without ending DSH; this process boundary is not a security sandbox. Electron Desktop compatibility does not change the environment visible to evaluated code or its child processes. PTC Plus cannot recover every state across restarts: external inputs, unverifiable history, and context compaction can reduce the recovered state. Recovery neither repeats nor reverses historical external operations.
238
+ ## Boundaries
151
239
 
152
- Value previews have size and type limits; objects that cannot be read reliably appear as unavailable. An enabled binding can also fail initialization, with failures reported in execution results. See the [runtime reference](docs/runtime-reference.md) for details.
240
+ - **Execution permissions**: primarily designed for `danger-full-access`. Code can access Node.js and the operating system directly; the plugin adds no security sandbox. DSH continues to own native-tool permissions, approvals, cancellation, and sandbox policy.
241
+ - **Failures and reruns**: a failed execution does not mean earlier statements had no effect. Process isolation, editing, and recovery do not guarantee that external operations are safe to repeat. Timeouts or output overflow can also release the computation environment.
242
+ - **Errors and cost**: language adaptation and call tolerance do not guarantee that every program succeeds. Actual call counts and token usage depend on the task and model; see the [evaluation notes](docs/evaluation.md#recorded-paired-observation) for a recorded comparison and its limitations.
153
243
 
154
- Model calls and token usage depend on the task and model. A recorded paired observation and its limitations are in the [evaluation guide](docs/evaluation.md#recorded-paired-observation).
244
+ PTC Plus is a community plugin, with no affiliation with or endorsement from DeepSeek or DSH.
155
245
 
156
- ## Documentation
246
+ ## Further reading
157
247
 
158
- [Global binding guide](docs/user-bindings.en.md) · [Installation and upgrades](docs/installation.md) · [Runtime reference](docs/runtime-reference.md) · [Development and architecture](docs/architecture.md) · [Verification and test concurrency](docs/verification.md) · [All documentation](docs/README.md)
248
+ [Installation and upgrades](docs/installation.md) · [Global bindings](docs/user-bindings.en.md) · [Runtime reference](docs/runtime-reference.md) · [Architecture and development](docs/architecture.md) · [Verification](docs/verification.md) · [All documentation](docs/README.md)
159
249
 
160
- [MIT License](LICENSE).
250
+ [MIT License](LICENSE)