dsh-ptc-plus 0.5.2 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.en.md +4 -2
  2. package/README.md +4 -2
  3. package/client.cjs +3392 -2811
  4. package/compiler-core.cjs +127 -127
  5. package/compiler-core.cjs.map +2 -2
  6. package/docs/README.md +1 -0
  7. package/docs/adr/0017-track-the-latest-dsh-public-surface.md +4 -2
  8. package/docs/adr/0019-plugin-settings-and-kill-switch.md +2 -2
  9. package/docs/adr/0023-global-user-bindings.md +12 -0
  10. package/docs/adr/0028-attach-to-the-host-ptc-execution-seam.md +1 -1
  11. package/docs/adr/0030-serve-both-typert-codec-generations-from-one-codec.md +2 -2
  12. package/docs/adr/0044-coexist-with-the-official-persistent-repl.md +4 -4
  13. package/docs/adr/0046-gate-the-commit-with-the-semantic-evidence-tier.md +1 -1
  14. package/docs/adr/0048-supersede-a-rewritten-cell.md +48 -0
  15. package/docs/adr/0049-prove-a-settlement-against-its-published-record.md +53 -0
  16. package/docs/adr/0050-read-host-surfaces-through-their-published-contract.md +48 -0
  17. package/docs/adr/README.md +7 -1
  18. package/docs/architecture.md +1 -1
  19. package/docs/capability-planning-components.md +6 -6
  20. package/docs/capability-projection.md +1 -1
  21. package/docs/capability-surface.md +133 -0
  22. package/docs/client-ui.md +17 -15
  23. package/docs/client-visual-contract.md +7 -7
  24. package/docs/durability-design.md +9 -2
  25. package/docs/installation.md +17 -10
  26. package/docs/panel-concept.md +171 -0
  27. package/docs/releases/v0.5.2.md +26 -14
  28. package/docs/releases/v0.5.3.md +77 -0
  29. package/docs/releases/v0.5.4.md +75 -0
  30. package/docs/runtime-reference.md +21 -1
  31. package/docs/user-bindings.en.md +15 -0
  32. package/docs/user-bindings.md +15 -0
  33. package/docs/v0.5.3-goals.md +117 -0
  34. package/docs/verification.md +4 -4
  35. package/index.js +176 -41
  36. package/internal/binding-adoption.js +228 -0
  37. package/internal/capability-command-receipt.js +106 -8
  38. package/internal/capability-environment.js +1109 -312
  39. package/internal/capability-plan.js +18 -2
  40. package/internal/capability-policy.js +13 -0
  41. package/internal/capability-selection.js +330 -0
  42. package/internal/config-spec.js +14 -5
  43. package/internal/cordis-tools-owner.js +2 -1
  44. package/internal/direct-surface-owner.js +44 -17
  45. package/internal/edit-transport-owner.js +6 -5
  46. package/internal/execution-provider-owner.js +6 -0
  47. package/internal/execution-seam-compat.js +25 -0
  48. package/internal/host-tool-sdk.js +308 -0
  49. package/internal/message-sources.js +21 -0
  50. package/internal/official-repl-priority.js +31 -10
  51. package/internal/program-bindings.js +25 -5
  52. package/internal/repl-memory-projection.js +21 -2
  53. package/internal/runtime-bridge-owner.js +118 -9
  54. package/internal/runtime-config.js +10 -0
  55. package/internal/runtime-messages.js +5 -0
  56. package/internal/session-journal-recovery.js +210 -32
  57. package/internal/session-journal-schema.js +3 -0
  58. package/internal/session-journal.js +46 -9
  59. package/internal/session-log-view.js +69 -7
  60. package/internal/session-runtime.js +106 -39
  61. package/internal/settings-compat.js +6 -0
  62. package/internal/user-bindings-owner.js +126 -6
  63. package/package.json +59 -37
  64. package/src/client-authoring-view.js +7 -8
  65. package/src/client-capabilities-view.js +874 -909
  66. package/src/client-capability-sort.js +22 -9
  67. package/src/client-copy.js +118 -272
  68. package/src/client-indicator-view.js +2 -1
  69. package/src/client-repl-view.js +35 -16
  70. package/src/client-settings-view.js +90 -33
  71. package/src/client-styles.js +67 -19
  72. package/src/client.js +49 -22
package/README.en.md CHANGED
@@ -114,6 +114,8 @@ An `accepted: true, scheduled: true` receipt means the edit is scheduled: the en
114
114
 
115
115
  When an accepted edit cannot obtain a compute baseline before it runs, the receipt stays a receipt: the revision does not execute, publishes no new binding, and the outer cell keeps its own result, so a restart does not lose what that cell already saved as a durable checkpoint.
116
116
 
117
+ The `editRewritesHistory` setting (off by default) decides how a rebuilt environment reads that edit. Off keeps append semantics: the edited cell and its revision both stay in the environment, and the revision only overwrites the names it declares again. On leaves the edited cell in the session log but stops it from building the environment, replaced by the revision; names the revision no longer declares are reported as superseded (`PTC-R007`) rather than lost. The names the log can prove are named; where it cannot, only the relation is stated.
118
+
117
119
  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.
118
120
 
119
121
  ## Project files and tool capabilities
@@ -162,7 +164,7 @@ The settings window and the sidebar plugin configuration page are the same confi
162
164
 
163
165
  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).
164
166
 
165
- 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.
167
+ 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: one row per capability, stating its object, type, source, the saved availability and disclosure, the decision this session recorded, and that row's receipt, with each column header sorting by its own column. The session entrance writes only this session's record, the same table in settings edits the saved rules, and each entrance writes its own address; picking several rows records one decision for all of them while each row still writes its own record. The workbench's binding group does not wait for a batch — clicking a row's "Used in this session" or "Not used in this session" submits the same `/binding use|skip <id>` command a human types and changes whether this session uses that global entry. See the [configuration reference](docs/runtime-reference.md#configuration) for fields, defaults, and full limits.
166
168
 
167
169
  The **Prompt text** tab lists the fixed text the plugin writes for the model: each row names its channel, presence condition, byte count, and read-only reason, and the totals line reports measured bytes, unmeasured slots, and dynamic slots separately. Editable rows are counted per slot and saving writes the configuration; a channel that is not connected yet says so instead of reporting zero bytes as if measured; protocol text, sentences generated from configuration or runtime facts, and the binding notes you wrote yourself stay read-only.
168
170
 
@@ -170,7 +172,7 @@ Before a new session starts, capability and global binding changes only update i
170
172
 
171
173
  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.
172
174
 
173
- 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.
175
+ When the official runtime keeps a program environment per state owner, **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 decision follows what the runtime declares: a provider that publishes `retainsState` answers directly (an older one expresses the same fact with `repl` source), and the setting has no effect on a runtime that keeps no state. 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.
174
176
 
175
177
  ![PTC Plus settings window](assets/ptc-plus-settings-en.png)
176
178
 
package/README.md CHANGED
@@ -114,6 +114,8 @@ return receipt
114
114
 
115
115
  被接受的编辑若在真正执行前因为没有取得计算基线而未能运行,收据仍然是收据:修订不执行、不产生新变量,外层 cell 自己的结果照常保存,重启恢复时也不会再因为这次编辑而连带丢掉它已保存为 durable 检查点的状态。
116
116
 
117
+ 设置里的“编辑时替换原单元格”(`editRewritesHistory`,默认关闭)决定日志重建环境时怎么看待这次编辑。关闭时保持追加语义:被编辑的单元格和修订都留在环境里,修订只是覆盖了它重新声明的名字。打开后被编辑的单元格仍然留在会话日志里,但不再参与环境重建,改由修订代替它;修订不再声明的名字按“被取代”报告(`PTC-R007`),而不是按“丢失”报告。日志能证明的具体名字会被点名,证明不了时只陈述取代关系。
118
+
117
119
  前两项默认开启,可以在设置里关掉。语法建议不会自动执行,也不代表代码符合任务意图。volatile 状态存不成 durable 检查点,但保存被拒绝后当前变量还能接着用;恢复不撤销外部效果,也不改全局绑定配置。
118
120
 
119
121
  ## 项目文件与工具能力
@@ -164,13 +166,13 @@ return capabilities.search({ query: 'read file content', budgetBytes: 8192 })
164
166
 
165
167
  面向日常计算的功能默认开启,**Cordis 开发工具默认关闭**,要检查或开发 DSH 插件时再打开,详见[集成说明](docs/adr/0020-optional-cordis-tools-in-ptc-mode.md)。
166
168
 
167
- “能力与上下文”是实验性设置,默认关闭。打开后可以按类别、来源和单项选择 Skills、Tools 和 MCP 能力的启停与说明方式,初始提示、提示恢复、输出节选和使用统计也在这里;标题旁的总开关一次暂停整组并保留原有选择,改动对新会话或明确刷新后的会话生效。星光菜单里还有一个会话能力工作台,用来按类别、来源和状态查看、调整当前会话的能力,改动先放进草稿,可以只写进本会话,也可以保存成全局默认。字段、默认值和完整限制见[配置参考](docs/runtime-reference.md#configuration)。
169
+ “能力与上下文”是实验性设置,默认关闭。打开后可以按类别、来源和单项选择 Skills、Tools 和 MCP 能力的启停与说明方式,初始提示、提示恢复、输出节选和使用统计也在这里;标题旁的总开关一次暂停整组并保留原有选择,改动对新会话或明确刷新后的会话生效。星光菜单里还有一个会话能力工作台,每个能力一行,分列陈述对象、类型、来源、已保存的启用与披露、本会话记录的决定以及这一行的回执,点击列头可按该列排序:会话入口只写本会话的记录,设置页里的同一张表改的是保存的规则,两个入口各写自己的地址;勾选多行可以一次写下同一个决定,每行仍然各写一条记录。工作台的绑定组不经过批量选择,点击某一行的“本会话使用/本会话不使用”立即提交人类输入的同一条 `/binding use|skip <id>` 命令,改的是本会话对该全局条目的取用。字段、默认值和完整限制见[配置参考](docs/runtime-reference.md#configuration)。
168
170
 
169
171
  **提示文本**页签把插件写给模型的固定文本列成清单:每行标注所属通道、存在条件、字节数与只读原因,合计行分别给出已测字节、未测槽和动态槽。可编辑项按槽位计字节,改完保存即写入配置;通道尚未接通时如实显示“通道未接通”,不以 0 字节冒充已测量;协议文本、由配置或运行事实生成的句子,以及你自己写给模型的绑定说明只读展示。
170
172
 
171
173
  宿主执行 provider 必须使用 TypeScript;热重载换成别的语言时插件会撤出并报出诊断,换回来就重新启用。
172
174
 
173
- 开启 DSH 官方的 `executionMode: persistent-in-memory` 后,可以在“状态与恢复”里用**官方 REPL 模式优先**选择谁接管 PTC 会话:默认关闭,`run_code` 由 PTC Plus 接管;开启后由官方运行时接管,PTC Plus 让出执行、REPL 状态语义与观察,官方模式没开启时该设置不生效。切换立即生效,离开插件执行时会释放插件的内存环境;官方内存状态由 DSH 的 Agent/provider 生命周期管理,切换优先设置不保证清空它。官方执行期间的调用不进入插件记录,切回插件后不会当作可恢复状态。
175
+ 当官方运行时按状态所有者保留程序环境时,可以在“状态与恢复”里用**官方 REPL 模式优先**选择谁接管 PTC 会话:默认关闭,`run_code` 由 PTC Plus 接管;开启后由官方运行时接管,PTC Plus 让出执行、REPL 状态语义与观察。判断依据是运行时自己的声明(`retainsState`;更早的运行时通过 `repl` 源码形式表达同一件事),不是某个执行模式名或版本号,无状态运行时上该设置不生效。切换立即生效,离开插件执行时会释放插件的内存环境;官方内存状态由 DSH 的 Agent/provider 生命周期管理,切换优先设置不保证清空它。官方执行期间的调用不进入插件记录,切回插件后不会当作可恢复状态。
174
176
 
175
177
  ![PTC Plus 设置窗口](assets/ptc-plus-settings-zh.png)
176
178