@sorbetai/acp 0.1.0-alpha.5 → 0.1.0-alpha.7

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 (52) hide show
  1. package/COMPATIBILITY.md +63 -61
  2. package/README.md +64 -37
  3. package/agent.json +2 -2
  4. package/dist/{agent-DlIM47TF.d.ts → agent-C4eZ3fM5.d.ts} +4 -2
  5. package/dist/{agent-HcP_jR30.js → agent-Hg6W1x79.js} +73 -12
  6. package/dist/agent-Hg6W1x79.js.map +1 -0
  7. package/dist/{authentication-BJdNRvpJ.js → authentication-DqnfuE1j.js} +3 -2
  8. package/dist/authentication-DqnfuE1j.js.map +1 -0
  9. package/dist/{compatibility-afjlc8C_.js → compatibility-B8zJ4Hvy.js} +12 -4
  10. package/dist/compatibility-B8zJ4Hvy.js.map +1 -0
  11. package/dist/{compatibility-Dj5DvCj9.d.ts → compatibility-Ct84-yRf.d.ts} +12 -4
  12. package/dist/compatibility.d.ts +1 -1
  13. package/dist/compatibility.js +1 -1
  14. package/dist/{index-D4LUK51N.d.ts → credentials-Bx8QHoD8.d.ts} +2138 -751
  15. package/dist/{experimental-v2-BAgTBt3U.js → experimental-v2-BNgyrD04.js} +26 -5
  16. package/dist/experimental-v2-BNgyrD04.js.map +1 -0
  17. package/dist/{experimental-v2-B4KqNC2o.d.ts → experimental-v2-CRebIPzb.d.ts} +4 -2
  18. package/dist/experimental-v2.d.ts +3 -2
  19. package/dist/experimental-v2.js +4 -4
  20. package/dist/extensions-8WYNyhPy.d.ts +47 -0
  21. package/dist/extensions-Eaix9kSN.js +17 -0
  22. package/dist/extensions-Eaix9kSN.js.map +1 -0
  23. package/dist/extensions.d.ts +2 -33
  24. package/dist/extensions.js +2 -2
  25. package/dist/index.d.ts +5 -4
  26. package/dist/index.js +6 -6
  27. package/dist/isolate-worker.mjs +321 -181
  28. package/dist/{mcp-host-profile-DV1yD1yI.js → mcp-host-profile-DwqBWLFr.js} +3 -3
  29. package/dist/{mcp-host-profile-DV1yD1yI.js.map → mcp-host-profile-DwqBWLFr.js.map} +1 -1
  30. package/dist/mcp-host.js +1 -1
  31. package/dist/{otlp-CzJldeRd.js → otlp-DkgxJDmt.js} +2 -2
  32. package/dist/{otlp-CzJldeRd.js.map → otlp-DkgxJDmt.js.map} +1 -1
  33. package/dist/{prompt-work-DYvHwgdu.js → prompt-work-CuU_ae0j.js} +5336 -3587
  34. package/dist/prompt-work-CuU_ae0j.js.map +1 -0
  35. package/dist/{src-FpN4uy9f.js → src-BS-YX8_H.js} +3 -3
  36. package/dist/{src-FpN4uy9f.js.map → src-BS-YX8_H.js.map} +1 -1
  37. package/dist/{stdio-cli-main-DkODH8lO.js → stdio-cli-main-LPIpwqu4.js} +649 -1868
  38. package/dist/stdio-cli-main-LPIpwqu4.js.map +1 -0
  39. package/dist/stdio-cli.js +1 -1
  40. package/dist/{stdio-22L0P-70.js → stdio-kKREJ6jP.js} +3 -3
  41. package/dist/{stdio-22L0P-70.js.map → stdio-kKREJ6jP.js.map} +1 -1
  42. package/dist/stdio.d.ts +4 -3
  43. package/dist/stdio.js +6 -6
  44. package/package.json +10 -22
  45. package/dist/agent-HcP_jR30.js.map +0 -1
  46. package/dist/authentication-BJdNRvpJ.js.map +0 -1
  47. package/dist/compatibility-afjlc8C_.js.map +0 -1
  48. package/dist/experimental-v2-BAgTBt3U.js.map +0 -1
  49. package/dist/extensions-Da4-kIik.js +0 -14
  50. package/dist/extensions-Da4-kIik.js.map +0 -1
  51. package/dist/prompt-work-DYvHwgdu.js.map +0 -1
  52. package/dist/stdio-cli-main-DkODH8lO.js.map +0 -1
package/COMPATIBILITY.md CHANGED
@@ -35,7 +35,7 @@ supported behavior is connected and operational.
35
35
  | Shared protocol methods | 1 | 0 | 0 | 1 |
36
36
  | Lody extension capabilities | 8 | 0 | 3 | 11 |
37
37
  | Lody custom methods | 8 | 0 | 2 | 10 |
38
- | Sorbet extensions | 7 | 0 | 1 | 8 |
38
+ | Sorbet extensions | 9 | 0 | 1 | 10 |
39
39
 
40
40
  ## Status definitions
41
41
 
@@ -99,23 +99,23 @@ supported behavior is connected and operational.
99
99
 
100
100
  ## Stable v1 Session updates
101
101
 
102
- | Protocol item | Status | Notes |
103
- | --------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------- |
104
- | `user_message_chunk` | ✅ Supported | Emitted while replaying durable user conversation entries. |
105
- | `agent_message_chunk` | ✅ Supported | Streams Pi assistant text and replays durable assistant messages. |
106
- | `agent_thought_chunk` | ✅ Supported | Streams Pi thinking deltas when the model produces them. |
107
- | `tool_call` | ✅ Supported | Publishes complete Pi Tool calls after argument streaming finishes. |
108
- | `tool_call_update` | ✅ Supported | Publishes Tool execution status, partial results, and terminal outcomes. |
109
- | `plan` | ✅ Supported | Projects durable checklist entries for Clients using the stable legacy Plan update. |
110
- | `plan_update` | ✅ Supported | Projects durable item and Markdown Plans when the Client advertises Plan capability. |
111
- | `plan_removed` | ✅ Supported | Removes a projected Plan when the Client advertises Plan capability. |
112
- | `available_commands_update` | ✅ Supported | Publishes Session slash command snapshots and routes client prompt invocations through the Session command owner. |
113
- | `compaction_summary_chunk` | ❌ Unsupported | Sorbet does not yet stream standard ACP compaction summary chunks. |
114
- | `compaction_update` | ❌ Unsupported | Sorbet compaction is currently projected through the Lody extension only. |
115
- | `current_mode_update` | ✅ Supported | Emitted when the Client selects the sole advertised default mode. |
116
- | `config_option_update` | ✅ Supported | Emitted after an advertised Session config option changes. |
117
- | `session_info_update` | ✅ Supported | Publishes durable titles with Lody titleSource provenance, activity timestamps, and MCP startup warnings. |
118
- | `usage_update` | ✅ Supported | Publishes current context occupancy, model context size, and cumulative Session cost. |
102
+ | Protocol item | Status | Notes |
103
+ | --------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
104
+ | `user_message_chunk` | ✅ Supported | Emitted while replaying durable user conversation entries. |
105
+ | `agent_message_chunk` | ✅ Supported | Streams Pi assistant text and replays durable assistant messages. |
106
+ | `agent_thought_chunk` | ✅ Supported | Streams Pi thinking deltas when the model produces them. |
107
+ | `tool_call` | ✅ Supported | Publishes complete Pi Tool calls after argument streaming finishes. |
108
+ | `tool_call_update` | ✅ Supported | Publishes Tool execution status, partial results, and terminal outcomes. |
109
+ | `plan` | ✅ Supported | Projects durable checklist entries for Clients using the stable legacy Plan update. |
110
+ | `plan_update` | ✅ Supported | Projects durable item and Markdown Plans when the Client advertises Plan capability. |
111
+ | `plan_removed` | ✅ Supported | Removes a projected Plan when the Client advertises Plan capability. |
112
+ | `available_commands_update` | ✅ Supported | Publishes Session slash command snapshots and routes client prompt invocations through the Session command owner. |
113
+ | `compaction_summary_chunk` | ❌ Unsupported | Sorbet does not yet stream standard ACP compaction summary chunks. |
114
+ | `compaction_update` | ❌ Unsupported | Sorbet compaction is currently projected through the Lody extension only. |
115
+ | `current_mode_update` | ✅ Supported | Emitted when the Client selects the sole advertised default mode. |
116
+ | `config_option_update` | ✅ Supported | Emitted after an advertised Session config option changes. |
117
+ | `session_info_update` | ✅ Supported | Publishes durable titles with Lody titleSource provenance, activity timestamps, and MCP startup warnings. |
118
+ | `usage_update` | ✅ Supported | Publishes Session cost and context occupancy; the newest Run subtotal, unsettled request counters, and occupancy provenance travel under _meta.sorbet. |
119
119
 
120
120
  ## Experimental v2 Agent methods
121
121
 
@@ -162,27 +162,27 @@ supported behavior is connected and operational.
162
162
 
163
163
  ## Experimental v2 Session updates
164
164
 
165
- | Protocol item | Status | Notes |
166
- | --------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------- |
167
- | `user_message_chunk` | ✅ Supported | Emitted for accepted prompts and replay before the authoritative user_message upsert. |
168
- | `user_message` | ✅ Supported | Emitted for accepted prompts and durable conversation replay. |
169
- | `agent_message_chunk` | ✅ Supported | Streams Pi assistant text with stable message IDs. |
170
- | `agent_message` | ✅ Supported | Publishes authoritative final assistant message upserts. |
171
- | `agent_thought_chunk` | ✅ Supported | Streams Pi thinking deltas with stable thought message IDs. |
172
- | `agent_thought` | ✅ Supported | Publishes authoritative final Pi thinking content for live runs and replay. |
173
- | `state_update` | ✅ Supported | Publishes running and exactly one terminal idle transition per prompt. |
174
- | `tool_call_content_chunk` | ✅ Supported | Appends proven Tool content deltas and falls back to replacement updates on rewrites. |
175
- | `tool_call_update` | ✅ Supported | Publishes Tool input, execution status, progress, and terminal output. |
176
- | `terminal_update` | ❌ Unsupported | The v2 adapter has no terminal projection. |
177
- | `terminal_output_chunk` | ❌ Unsupported | The v2 adapter has no terminal projection. |
178
- | `plan_update` | ✅ Supported | Projects durable item and Markdown Plans for live work and replay. |
179
- | `plan_removed` | ✅ Supported | Removes the current durable Plan projection. |
180
- | `available_commands_update` | ✅ Supported | Publishes Session slash command snapshots and routes client prompt invocations through the Session command owner. |
181
- | `compaction_summary_chunk` | ❌ Unsupported | Sorbet does not yet stream standard ACP v2 compaction summary chunks. |
182
- | `compaction_update` | ❌ Unsupported | Sorbet has no standard ACP v2 compaction projection yet. |
183
- | `config_option_update` | ✅ Supported | Emitted after an advertised Session config option changes. |
184
- | `session_info_update` | ✅ Supported | Publishes durable titles with Lody titleSource provenance, activity timestamps, and MCP startup warnings. |
185
- | `usage_update` | ✅ Supported | Publishes current context occupancy, model context size, and cumulative Session cost. |
165
+ | Protocol item | Status | Notes |
166
+ | --------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
167
+ | `user_message_chunk` | ✅ Supported | Emitted for accepted prompts and replay before the authoritative user_message upsert. |
168
+ | `user_message` | ✅ Supported | Emitted for accepted prompts and durable conversation replay. |
169
+ | `agent_message_chunk` | ✅ Supported | Streams Pi assistant text with stable message IDs. |
170
+ | `agent_message` | ✅ Supported | Publishes authoritative final assistant message upserts. |
171
+ | `agent_thought_chunk` | ✅ Supported | Streams Pi thinking deltas with stable thought message IDs. |
172
+ | `agent_thought` | ✅ Supported | Publishes authoritative final Pi thinking content for live runs and replay. |
173
+ | `state_update` | ✅ Supported | Publishes running and exactly one terminal idle transition per prompt. |
174
+ | `tool_call_content_chunk` | ✅ Supported | Appends proven Tool content deltas and falls back to replacement updates on rewrites. |
175
+ | `tool_call_update` | ✅ Supported | Publishes Tool input, execution status, progress, and terminal output. |
176
+ | `terminal_update` | ❌ Unsupported | The v2 adapter has no terminal projection. |
177
+ | `terminal_output_chunk` | ❌ Unsupported | The v2 adapter has no terminal projection. |
178
+ | `plan_update` | ✅ Supported | Projects durable item and Markdown Plans for live work and replay. |
179
+ | `plan_removed` | ✅ Supported | Removes the current durable Plan projection. |
180
+ | `available_commands_update` | ✅ Supported | Publishes Session slash command snapshots and routes client prompt invocations through the Session command owner. |
181
+ | `compaction_summary_chunk` | ❌ Unsupported | Sorbet does not yet stream standard ACP v2 compaction summary chunks. |
182
+ | `compaction_update` | ❌ Unsupported | Sorbet has no standard ACP v2 compaction projection yet. |
183
+ | `config_option_update` | ✅ Supported | Emitted after an advertised Session config option changes. |
184
+ | `session_info_update` | ✅ Supported | Publishes durable titles with Lody titleSource provenance, activity timestamps, and MCP startup warnings. |
185
+ | `usage_update` | ✅ Supported | Publishes Session cost and context occupancy; the newest Run subtotal, unsettled request counters, and occupancy provenance travel under _meta.sorbet. |
186
186
 
187
187
  ## Shared protocol methods
188
188
 
@@ -208,28 +208,30 @@ supported behavior is connected and operational.
208
208
 
209
209
  ## Lody custom methods
210
210
 
211
- | Protocol item | Status | Notes |
212
- | ----------------------------- | -------------- | --------------------------------------------------------------------------------- |
213
- | `_lody/session/usage_update` | ✅ Supported | Emits cumulative Session and per-model usage after each assistant message. |
214
- | `_lody/rate_limits/get` | ❌ Unsupported | No Provider rate-limit query source is connected. |
215
- | `_lody/rate_limits/update` | ❌ Unsupported | No Provider rate-limit update source is connected. |
216
- | `_lody/session/steer` | ✅ Supported | Injects content into the active Run and returns failed while the Session is idle. |
217
- | `_lody/session/steer_applied` | ✅ Supported | Acknowledges the exact steer identity after Runtime injection succeeds. |
218
- | `_lody/session/goal` | ✅ Supported | Controls the durable Goal through set, pause, resume, and clear actions. |
219
- | `_lody/session/history/read` | ✅ Supported | Replays durable user and assistant conversation through standard Session updates. |
220
- | `_lody/subagents/list` | ✅ Supported | Lists durable Sorbet child-agent snapshots owned by the attached parent Session. |
221
- | `_lody/subagents/cancel` | ✅ Supported | Cancels and closes the requested Sorbet child agent. |
222
- | `_lody/subagents/output` | ✅ Supported | Returns the durable completed child response with optional line tailing. |
211
+ | Protocol item | Status | Notes |
212
+ | ----------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
213
+ | `_lody/session/usage_update` | ✅ Supported | Emits the newest Run subtotal in `usage`, cumulative per-model totals keyed by model id, an optional per-step delta, and subagent spend folded into the owning Session after each assistant message. |
214
+ | `_lody/rate_limits/get` | ❌ Unsupported | No Provider rate-limit query source is connected. |
215
+ | `_lody/rate_limits/update` | ❌ Unsupported | No Provider rate-limit update source is connected. |
216
+ | `_lody/session/steer` | ✅ Supported | Injects content into the active Run and returns failed while the Session is idle. |
217
+ | `_lody/session/steer_applied` | ✅ Supported | Acknowledges the exact steer identity after Runtime injection succeeds. |
218
+ | `_lody/session/goal` | ✅ Supported | Controls the durable Goal through set, pause, resume, and clear actions. |
219
+ | `_lody/session/history/read` | ✅ Supported | Replays durable user and assistant conversation through standard Session updates. |
220
+ | `_lody/subagents/list` | ✅ Supported | Lists durable Sorbet child-agent snapshots owned by the attached parent Session. |
221
+ | `_lody/subagents/cancel` | ✅ Supported | Cancels and closes the requested Sorbet child agent. |
222
+ | `_lody/subagents/output` | ✅ Supported | Returns the durable completed child response with optional line tailing. |
223
223
 
224
224
  ## Sorbet extensions
225
225
 
226
- | Protocol item | Status | Notes |
227
- | -------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
228
- | `_session/steering` | ✅ Supported | Stable v1 injects steering into an active Run or starts a new turn. |
229
- | `_sorbet/session/run/get` | ✅ Supported | Stable v1 returns the durable Sorbet Run snapshot. |
230
- | `_sorbet/session/replay` | ✅ Supported | Stable v1 returns cursor-based Journal fact summaries. |
231
- | `_sorbet/plugins/query` | ✅ Supported | Negotiated v1/v2 transport reads the attached Session’s Host-bound, filtered composition facade. |
232
- | `_sorbet/plugins/apply` | ✅ Supported | Submits patches to the Host-bound facade; the transport cannot supply authorization. Desired concurrency and durable command identity apply. |
233
- | `_sorbet/plugins/watch` | ✅ Supported | Starts or stops one coalesced snapshot subscription per attached Session; cleanup follows the connection. |
234
- | `_sorbet/plugins/changed` | ✅ Supported | Publishes initial and changed composition snapshots, including Service-driven Mount changes without a Desired edit. |
235
- | `_sorbet/session/activity` | ❌ Unsupported | The name is reserved, but no activity notification is emitted yet. |
226
+ | Protocol item | Status | Notes |
227
+ | --------------------------------- | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
228
+ | `_sorbet/auth/credentials/list` | ✅ Supported | Lists non-secret stored credential metadata when the authentication port provides credential management. |
229
+ | `_sorbet/auth/credentials/logout` | ✅ Supported | Logs out one Provider through the authentication port credential management capability. |
230
+ | `_session/steering` | ✅ Supported | Stable v1 injects steering into an active Run or starts a new turn. |
231
+ | `_sorbet/session/run/get` | ✅ Supported | Stable v1 returns the durable Sorbet Run snapshot. |
232
+ | `_sorbet/session/replay` | ✅ Supported | Stable v1 returns cursor-based Journal fact summaries. |
233
+ | `_sorbet/plugins/query` | ✅ Supported | Negotiated v1/v2 transport reads the attached Session’s Host-bound, filtered composition facade. |
234
+ | `_sorbet/plugins/apply` | ✅ Supported | Submits patches to the Host-bound facade; the transport cannot supply authorization. Desired concurrency and durable command identity apply. |
235
+ | `_sorbet/plugins/watch` | ✅ Supported | Starts or stops one coalesced snapshot subscription per attached Session; cleanup follows the connection. |
236
+ | `_sorbet/plugins/changed` | ✅ Supported | Publishes initial and changed composition snapshots, including Service-driven Mount changes without a Desired edit. |
237
+ | `_sorbet/session/activity` | ❌ Unsupported | The name is reserved, but no activity notification is emitted yet. |
package/README.md CHANGED
@@ -64,7 +64,7 @@ per Session; the Host source directory is shared. Authority data is kept under
64
64
  rollback. Reattachment constructs fresh plugin instances. Filesystem input stops before
65
65
  execution shutdown; loaders and storage close after the Session's request borrowers
66
66
  and Platform have released their resources. Sorbet Package Activations execute in
67
- sandboxed processes; the explicit Pi and DSH Tool profiles own trusted native
67
+ sandboxed processes; the explicit Pi Tool profiles own trusted native
68
68
  environments in the CLI process. Closing an attachment releases its Authority
69
69
  lock while the CLI continues running, allowing another process to take ownership.
70
70
 
@@ -122,12 +122,10 @@ permissions and Journal write-ahead still precede dispatch. See the
122
122
 
123
123
  The CLI accepts these explicit installation ABIs alongside Sorbet Packages:
124
124
 
125
- | ABI | Execution and contribution contract |
126
- | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
127
- | `pi.extension/1.1.0-native-tool-v1` | Pinned single-file Pi Tool profile with null configuration. |
128
- | `pi.extension/1.1.0-native-package-v1` | Recorded Pi source tree and text resources; optional extension flags and Host-installed dependencies. See [Pi bridge](../plugin-pi/README.md). |
129
- | `dsh.tool-plugin/0.1.6-alpha.2-single-file-v1` | Pinned single-file Cordis Tool profile with null configuration. |
130
- | `dsh.tool-plugin/0.1.6-alpha.2-package-v1` | Recorded Cordis ESM source tree, text resources and manifest-validated configuration. See [DSH bridge](../plugin-deepseek/README.md). |
125
+ | ABI | Execution and contribution contract |
126
+ | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
127
+ | `pi.extension/1.1.0-native-tool-v1` | Pinned single-file Pi Tool profile with null configuration. |
128
+ | `pi.extension/1.1.0-native-package-v1` | Recorded Pi source tree and text resources; optional extension flags and Host-installed dependencies. See [Pi bridge](../plugin-pi/README.md). |
131
129
 
132
130
  Put the original, unchanged single-file plugin next to a `plugin.json` manifest in
133
131
  the Host plugin directory. For example, `plugins/hello/plugin.json` can contain:
@@ -153,10 +151,7 @@ pinned framework versions with `--native-plugin-node-modules /absolute/node_modu
153
151
  keep that tree unchanged while Sessions using its generations remain open.
154
152
 
155
153
  Pi package configuration accepts `extensionFlagValues` containing declared boolean
156
- or string flags. DSH package configuration follows `plugin.json.configSchema` and
157
- the original Cordis plugin's Config contract. The CLI supplies native DSH prompt,
158
- projection, LLM metadata and local subprocess/bash services; native model calls are
159
- refused. SDK Hosts can choose their own services instead.
154
+ or string flags. The CLI does not install dependencies or execute install scripts.
160
155
 
161
156
  Sorbet alone runs the model loop. A native tool receives the model's Tool Call ID,
162
157
  validated arguments and cancellation, and its result returns to that same Sorbet
@@ -180,16 +175,13 @@ Host tools in the next request.
180
175
  Directory-backed ACP Sessions use Pi's sequential Tool batch mode, including when
181
176
  a watcher installs a native plugin later. Native Session writers must observe the
182
177
  previous Tool's committed result before preparing another write; an adapter mutex
183
- alone cannot enforce that Journal boundary. SDK Hosts supplying writable DSH
184
- Session projections must also select `SorbetSessionOptions.toolExecution: 'sequential'`.
178
+ alone cannot enforce that Journal boundary.
185
179
 
186
- DSH receives the current Sorbet Session's workspace and committed history through
187
- a read-only Journal projection. Supported native Session writes and next-step inbox
188
- injections travel in durable Tool result details and are replayed from those facts.
189
- Prompt assembly narrows the next model request's tool visibility, and execution
190
- rejects hidden tools before protected dispatch. Individual package installations
191
- own separate native worlds; a routing plugin cannot automatically manage another
192
- world's registrations or wrap Sorbet Host tool implementations.
180
+ The CLI registers only Pi native Tool profiles. DSH native worlds were removed by
181
+ [ADR-0114](../../docs/adr/0114-sorbet-owns-the-run.md); the retained DSH
182
+ supplemental pre-step adapter is a library profile, not an ACP installation ABI.
183
+ Pi packages own separate native worlds; a routing plugin cannot automatically
184
+ manage another world's registrations or wrap Sorbet Host tool implementations.
193
185
 
194
186
  Each model request leases its current declarations and implementations. Directory
195
187
  replacement or uninstall changes subsequent requests while borrowed worlds drain.
@@ -197,19 +189,17 @@ An internal native registry change may invalidate an older binding; it must fail
197
189
  or cancel rather than invoke a same-name replacement. `--watch-plugins` applies to
198
190
  these profiles as well as isolated Packages.
199
191
 
200
- These profiles cover the documented Tool, command and preparation contracts.
192
+ These profiles cover the documented Pi Tool, command and preparation contracts.
201
193
  Original Pi `subagent`, `sandbox` and `ssh` still require unprovided process or
202
194
  lifecycle contracts and are refused explicitly. Shared-process `process.argv`,
203
195
  `process.cwd()` and `process.chdir()` assumptions require an isolated native worker.
204
- DSH Agent scheduling, native surface rewrites, inherited fork history, unsupported
205
- message content and deferred tool contexts also fail explicitly. These boundaries
206
- are not implied by basic Tool compatibility.
196
+ These boundaries are not implied by basic Tool compatibility.
207
197
  Native plugins execute with ambient process access; tool permission and Effect
208
198
  recording mediate Sorbet dispatch, not arbitrary module, hook or background effects.
209
199
  They cooperate with cancellation and do not gain worker termination or ESM cache
210
200
  reclamation from the isolated profile. The [stdio regression](./tests/stdio.test.ts)
211
201
  exercises the actual CLI with a scripted Provider transport; it does not establish
212
- live Provider compatibility or compatibility with every Pi or DSH plugin.
202
+ live Provider compatibility or compatibility with every Pi plugin.
213
203
 
214
204
  The executable routes Provider requests, including OAuth exchange and token
215
205
  refresh, through `HTTP_PROXY`, `HTTPS_PROXY`, or `ALL_PROXY` when configured and
@@ -281,11 +271,13 @@ may instead launch `node packages/acp/dist/stdio-cli.js`; production configs
281
271
  should use the PATH-resolved executable so they do not depend on a checkout's
282
272
  absolute path.
283
273
 
284
- Stable v1 advertises one ACP authentication method for each Provider OAuth or
285
- API-key login supported by Pi. Lody selects a method and relays request-scoped
286
- URL, device-code, secret, text, or select elicitations. Sorbet persists the
287
- result in its credential store; credentials are never returned in ACP
288
- capability data or Lody workspace configuration.
274
+ Stable v1 advertises Provider OAuth methods when the Client supports both form and URL
275
+ elicitation. Generic ACP does not expose API-key login; a Provider that only supports an
276
+ API key must be configured by the embedding Host outside ACP. Lody selects a method and
277
+ relays request-scoped URL, device-code, text, or select elicitations; secret and manual-code
278
+ forms additionally require Lody's credential-safe form capability. Sorbet persists the result
279
+ in its credential store; credentials are never returned in ACP capability data or Lody
280
+ workspace configuration.
289
281
 
290
282
  Session create, load, resume, and fork responses publish each advertised
291
283
  model's model-dependent ACP config options under
@@ -357,16 +349,26 @@ for measured costs and rejected simplifications.
357
349
  Both protocol versions publish `usage_update.used` as current context occupancy,
358
350
  including cached tokens, and `size` as the active Session model's context window.
359
351
  They never sum successive requests to calculate occupancy. `cost` is cumulative
360
- Session cost, including committed compaction responses and metered failed attempts.
361
- Usage is reconstructed from the Journal and refreshed after compaction, restore,
362
- and model changes. Before a Provider measurement is available, occupancy is an
352
+ Session cost, including committed compaction responses and metered failed attempts; it
353
+ is `null` when the Provider reported no price, because unknown cost must not read as
354
+ free. `_meta.sorbet` states what the numbers cannot: the occupancy measurement
355
+ (`measured` or `estimated`), the newest Run carrying the top-level `usage` scope, and
356
+ the open, unknown, and partial-usage request counters that make a cumulative total
357
+ provisional. Usage is reconstructed from the Journal and refreshed after compaction,
358
+ restore, and model changes. Before a Provider measurement is available, occupancy is an
363
359
  estimate of the reconstructed request; no context update is sent for an empty
364
360
  Session without request evidence. Estimates are not clamped to the window size.
365
361
 
366
- The v1 detailed Lody notification contains cumulative Session and per-model
367
- billing totals across Runs. A fork inherits context but starts its own billing
368
- history. Model window metadata comes from the runtime model configuration;
369
- custom endpoints with different limits must set `contextWindow` explicitly.
362
+ The v1 detailed Lody notification keeps the two scopes apart: `usage` is the newest
363
+ Run's subtotal, `modelUsage` is cumulative per-model billing across Runs keyed by model
364
+ id, and `delta` reports what the preceding notification newly accounted for. A
365
+ Provider that reports no price leaves `costUSD` absent instead of claiming zero. Child
366
+ Session spend is folded into the owning Session's cumulative rows and reported as
367
+ `_meta.sorbet.subagents`, because a child is not an ACP Session and has no other
368
+ accounting channel; a Client polling `_lody/subagents/list` also refreshes that fold.
369
+ A fork inherits context but starts its own billing history. Model window metadata comes
370
+ from the runtime model configuration; custom endpoints with different limits must set
371
+ `contextWindow` explicitly.
370
372
 
371
373
  ## Lody Extensions
372
374
 
@@ -452,6 +454,31 @@ job. `pnpm compatibility:acp` exists for a faster local review.
452
454
  Sorbet custom methods begin with `_sorbet/`. Custom fields are placed under
453
455
  `_meta["sorbet.dev"]` and include an explicit extension version.
454
456
 
457
+ ## Credential management extension
458
+
459
+ ACP v1 and experimental v2 advertise `_meta["sorbet.dev"].credentials: { "version": 1 }`
460
+ when the authentication implementation supports credential management. Clients should check this
461
+ Agent capability before issuing the following connection-level JSON-RPC requests:
462
+
463
+ - `_sorbet/auth/credentials/list` takes `{}` and returns
464
+ `{ "credentials": [{ "providerId": "...", "type": "oauth" | "api_key" }] }`.
465
+ - `_sorbet/auth/credentials/logout` takes `{ "providerId": "..." }` and returns `{}` after
466
+ the selected Provider's credential is removed. An empty Provider ID is invalid.
467
+
468
+ The list describes credentials stored by the authentication implementation. It does not expose
469
+ secrets, account identity, remote validity, or credentials supplied only through the environment.
470
+ A missing entry means no stored credential was listed; it does not prove that a Provider cannot
471
+ be used. Refresh the list after authentication or logout. Logout affects the selected stored
472
+ credential; it does not promise remote token revocation or removal of environment credentials.
473
+ The ordinary ACP `logout` remains a separate operation which logs out all stored credentials in
474
+ the default implementation.
475
+
476
+ The default Node Agent authentication implements this extension using the Node Agent credential
477
+ store. When a Host injects an `AcpAuthentication` or `AcpV2Authentication`, it must explicitly
478
+ supply `credentials` for the same authentication store to advertise the extension. Otherwise the
479
+ methods return method-not-found. The ACP connection is trusted to manage these credentials;
480
+ Hosts accepting untrusted Clients must enforce access at their transport boundary.
481
+
455
482
  ## MCP Protocol Compatibility
456
483
 
457
484
  SDK embeddings and ACP Clients own MCP UI and credentials. Standard MCP form/URL
package/agent.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "id": "sorbet",
3
3
  "name": "Sorbet",
4
- "version": "0.1.0-alpha.5",
5
- "description": "A durable Pi-based Agent Harness with ACP v1 and experimental ACP v2 support.",
4
+ "version": "0.1.0-alpha.7",
5
+ "description": "A durable Agent Harness with Pi-backed model access and ACP v1 plus experimental ACP v2 support.",
6
6
  "repository": "https://github.com/lodyspeak/sorbet",
7
7
  "license": "MIT",
8
8
  "distribution": {
@@ -1,5 +1,5 @@
1
1
  import { n as McpCompositionOptions } from "./index-B1Rr3ylL.js";
2
- import { i as AcpMcpComposition, n as ElicitationComposition, r as UserPrompt, t as NodeAgent } from "./index-D4LUK51N.js";
2
+ import { a as AcpMcpComposition, i as UserPrompt, n as NodeAgent, r as ElicitationComposition, t as AcpCredentialManagement } from "./credentials-Bx8QHoD8.js";
3
3
  import * as acp from "@agentclientprotocol/sdk";
4
4
 
5
5
  //#region src/prompt.d.ts
@@ -16,6 +16,8 @@ interface AcpAuthenticationMethod {
16
16
  }): Promise<void>;
17
17
  }
18
18
  interface AcpAuthentication {
19
+ /** Omit when this authentication implementation cannot manage individual credentials. */
20
+ readonly credentials?: AcpCredentialManagement;
19
21
  methods(capabilities: acp.ClientCapabilities): readonly AcpAuthenticationMethod[] | Promise<readonly AcpAuthenticationMethod[]>;
20
22
  logout(signal: AbortSignal): Promise<void>;
21
23
  }
@@ -47,4 +49,4 @@ interface SorbetAcpAgent {
47
49
  declare function createSorbetAcpAgent(options: SorbetAcpAgentOptions): SorbetAcpAgent;
48
50
  //#endregion
49
51
  export { createSorbetAcpAgent as a, SorbetAcpAgentOptions as i, AcpAuthenticationMethod as n, AcpAudioDecoder as o, SorbetAcpAgent as r, AcpAuthentication as t };
50
- //# sourceMappingURL=agent-DlIM47TF.d.ts.map
52
+ //# sourceMappingURL=agent-C4eZ3fM5.d.ts.map
@@ -1,6 +1,6 @@
1
- import { At as getGoal, B as AcpPluginComposition, C as SORBET_ACP_VERSION, D as createV1RequestElicitation, E as observeSessionUsage, F as NodeAgentError, H as pluginQueryParser, I as NodeAgentErrorCode, L as JournalCursorSchema, Mt as watchSlashCommands, O as createV1SessionElicitation, P as isAuthoritativeSessionTitleSource, T as detailedUsageUpdate, U as pluginWatchParser, V as pluginApplyParser, a as AcpSessionAttachments, b as AcpMcpAttachment, c as projectBackgroundRun, d as projectedToolTitle, f as toolTitle, g as createV1McpElicitationOptions, h as modelsIncludingCurrent, i as readGoalPromptControl, j as coordinateNodeAgentBehavior, jt as parseSlashCommand, kt as commandGoal, l as presentationTools, m as modelConfigOptions, n as applyGoalControl, o as lodyTitleSource, p as listRefreshedModels, r as cancelSessionWork, s as sessionRequestError, t as AcpPromptWork, u as projectedToolLabels, v as mcpElicitationProfile, w as contextUsageUpdate, x as connectMcpServers, y as AcpMcpHost } from "./prompt-work-DYvHwgdu.js";
2
- import { a as SORBET_PLUGINS_CHANGED, c as SORBET_REPLAY_METHOD, i as SORBET_PLUGINS_APPLY, l as SORBET_RUN_INSPECT_METHOD, o as SORBET_PLUGINS_QUERY, r as SORBET_EXTENSION_VERSION, s as SORBET_PLUGINS_WATCH, t as SESSION_STEERING_METHOD } from "./extensions-Da4-kIik.js";
3
- import { a as SORBET_MCP_QUERY, d as mcpControlParser, f as mcpQueryParser, m as mcpRootsChangedParser, n as SORBET_MCP_CONTROL, o as SORBET_MCP_READ, p as mcpReadParser, s as SORBET_MCP_ROOTS_CHANGED, t as SORBET_MCP_CALL, u as mcpCallParser } from "./mcp-host-profile-DV1yD1yI.js";
1
+ import { C as SORBET_ACP_VERSION, D as withSubagentUsage, E as observeSessionUsage, Ft as watchSlashCommands, G as pluginWatchParser, H as AcpPluginComposition, I as isAuthoritativeSessionTitleSource, L as NodeAgentError, Mt as commandGoal, N as coordinateNodeAgentBehavior, Nt as getGoal, O as createV1RequestElicitation, Pt as parseSlashCommand, R as NodeAgentErrorCode, T as detailedUsageUpdate, U as pluginApplyParser, W as pluginQueryParser, a as AcpSessionAttachments, b as AcpMcpAttachment, c as projectBackgroundRun, d as projectedToolTitle, f as toolTitle, g as createV1McpElicitationOptions, h as modelsIncludingCurrent, i as readGoalPromptControl, j as nodeAgentCredentialManagement, k as createV1SessionElicitation, l as presentationTools, m as modelConfigOptions, n as applyGoalControl, o as lodyTitleSource, p as listRefreshedModels, r as cancelSessionWork, s as sessionRequestError, t as AcpPromptWork, u as projectedToolLabels, v as mcpElicitationProfile, w as contextUsageUpdate, x as connectMcpServers, y as AcpMcpHost, z as JournalCursorSchema } from "./prompt-work-CuU_ae0j.js";
2
+ import { a as SORBET_CREDENTIALS_VERSION, c as SORBET_PLUGINS_CHANGED, d as SORBET_REPLAY_METHOD, f as SORBET_RUN_INSPECT_METHOD, i as SORBET_CREDENTIALS_LOGOUT_METHOD, l as SORBET_PLUGINS_QUERY, o as SORBET_EXTENSION_VERSION, r as SORBET_CREDENTIALS_LIST_METHOD, s as SORBET_PLUGINS_APPLY, t as SESSION_STEERING_METHOD, u as SORBET_PLUGINS_WATCH } from "./extensions-Eaix9kSN.js";
3
+ import { a as SORBET_MCP_QUERY, d as mcpControlParser, f as mcpQueryParser, m as mcpRootsChangedParser, n as SORBET_MCP_CONTROL, o as SORBET_MCP_READ, p as mcpReadParser, s as SORBET_MCP_ROOTS_CHANGED, t as SORBET_MCP_CALL, u as mcpCallParser } from "./mcp-host-profile-DwqBWLFr.js";
4
4
  import { Type } from "typebox";
5
5
  import { Check, Parse } from "typebox/schema";
6
6
  import * as acp from "@agentclientprotocol/sdk";
@@ -697,6 +697,7 @@ function createSorbetAcpAgent(options) {
697
697
  } };
698
698
  }
699
699
  function buildConnectionApp(options, state) {
700
+ const credentialManagement = options.authentication === void 0 ? nodeAgentCredentialManagement(options.agent) : options.authentication.credentials;
700
701
  return acp.agent({ name: "sorbet-acp" }).onRequest(acp.methods.agent.initialize, async ({ params, signal }) => {
701
702
  state.capabilities = params.clientCapabilities ?? {};
702
703
  const { _meta: metadata } = state.capabilities;
@@ -729,6 +730,7 @@ function buildConnectionApp(options, state) {
729
730
  _meta: {
730
731
  "sorbet.dev": {
731
732
  version: SORBET_EXTENSION_VERSION,
733
+ ...credentialManagement === void 0 ? {} : { credentials: { version: SORBET_CREDENTIALS_VERSION } },
732
734
  runInspection: true,
733
735
  replay: true,
734
736
  plugins: state.plugins.capabilities(),
@@ -746,6 +748,16 @@ function buildConnectionApp(options, state) {
746
748
  authMethods: (await options.authentication?.methods(state.capabilities))?.map(({ method }) => method) ?? [],
747
749
  _meta: { steering: { supported: true } }
748
750
  };
751
+ }).onRequest(SORBET_CREDENTIALS_LIST_METHOD, z.object({}), async ({ signal }) => {
752
+ if (credentialManagement === void 0) throw acp.RequestError.methodNotFound(SORBET_CREDENTIALS_LIST_METHOD);
753
+ return { credentials: (await credentialManagement.list(signal)).map(({ providerId, type }) => ({
754
+ providerId,
755
+ type
756
+ })) };
757
+ }).onRequest(SORBET_CREDENTIALS_LOGOUT_METHOD, z.object({ providerId: z.string().min(1) }), async ({ params, signal }) => {
758
+ if (credentialManagement === void 0) throw acp.RequestError.methodNotFound(SORBET_CREDENTIALS_LOGOUT_METHOD);
759
+ await credentialManagement.logout(params.providerId, signal);
760
+ return {};
749
761
  }).onRequest(SORBET_MCP_QUERY, mcpQueryParser, ({ params, signal }) => state.mcpHost.query(requireAttached(state, params.sessionId), params, signal)).onRequest(SORBET_MCP_READ, mcpReadParser, ({ params, signal }) => state.mcpHost.read(requireAttached(state, params.sessionId), params, signal)).onRequest(SORBET_MCP_CALL, mcpCallParser, ({ params, signal, client }) => state.mcpHost.call(requireAttached(state, params.sessionId), params, signal, client)).onRequest(SORBET_MCP_CONTROL, mcpControlParser, ({ params, signal }) => state.mcpHost.control(requireAttached(state, params.sessionId), params, signal)).onRequest(SORBET_MCP_ROOTS_CHANGED, mcpRootsChangedParser, ({ params, signal }) => state.mcpHost.rootsChanged(requireAttached(state, params.sessionId), params, signal)).onRequest(SORBET_PLUGINS_QUERY, pluginQueryParser, ({ params, signal }) => state.plugins.query(requireAttached(state, params.sessionId), signal)).onRequest(SORBET_PLUGINS_APPLY, pluginApplyParser, ({ params, signal }) => state.sessions.run(params.sessionId, () => state.plugins.apply(requireAttached(state, params.sessionId), params.patch, signal))).onRequest(SORBET_PLUGINS_WATCH, pluginWatchParser, ({ params, client, signal }) => state.sessions.run(params.sessionId, () => state.plugins.watch(requireAttached(state, params.sessionId), params.enabled, (snapshot) => client.notify(SORBET_PLUGINS_CHANGED, {
750
762
  sessionId: params.sessionId,
751
763
  snapshot
@@ -1064,10 +1076,12 @@ function buildConnectionApp(options, state) {
1064
1076
  await replayConversation(options.agent, params.sessionId, attached.session, client, presentationTools(attached.bindings, attached.session), state.capabilities.plan != null);
1065
1077
  return {};
1066
1078
  }).onRequest(LODY_EXTENSION_METHODS.subagentsList, lodySubagentsListParser, async ({ params }) => {
1067
- requireAttached(state, params.sessionId);
1079
+ const attached = requireAttached(state, params.sessionId);
1068
1080
  const [children, sessions] = await Promise.all([options.agent.listChildAgents(params.sessionId, { includeClosed: params.activeOnly !== true }), options.agent.listSessions()]);
1069
1081
  const metadata = new Map(sessions.map((session) => [session.sessionId, session]));
1070
- return { tasks: (params.activeOnly === true ? children.agents.filter(({ state: childState }) => ACTIVE_CHILD_STATES.has(childState)) : children.agents).map((child) => lodySubagentTask(child, metadata.get(child.childSessionId))) };
1082
+ const agents = params.activeOnly === true ? children.agents.filter(({ state: childState }) => ACTIVE_CHILD_STATES.has(childState)) : children.agents;
1083
+ await attached.projection.refresh();
1084
+ return { tasks: agents.map((child) => lodySubagentTask(child, metadata.get(child.childSessionId))) };
1071
1085
  }).onRequest(LODY_EXTENSION_METHODS.subagentsCancel, lodySubagentCancelParser, async ({ params, signal }) => {
1072
1086
  requireAttached(state, params.sessionId);
1073
1087
  await options.agent.closeChildAgent(params.sessionId, params.taskId, {
@@ -1509,17 +1523,41 @@ async function replayEntry(sessionId$1, entry, client, tools, children, labels)
1509
1523
  function startSessionProjection(agent, session, client) {
1510
1524
  let closed = false;
1511
1525
  let subscription;
1526
+ const sessionId$1 = session.metadata.sessionId;
1527
+ let childUsage = [];
1528
+ let published;
1529
+ const reloadChildren = async () => {
1530
+ try {
1531
+ const { agents } = await agent.listChildAgents(sessionId$1, { includeClosed: true });
1532
+ childUsage = agents.map(({ modelUsage }) => ({ modelUsage }));
1533
+ } catch {}
1534
+ };
1512
1535
  const usage = observeSessionUsage(session.runtime, async (snapshot) => {
1513
- const context = contextUsageUpdate(snapshot);
1514
- if (context !== void 0) await update(client, session.metadata.sessionId, context);
1515
- if (snapshot.models.length === 0) return;
1516
- await client.notify(LODY_EXTENSION_METHODS.sessionUsageUpdate, detailedUsageUpdate(session.metadata.sessionId, snapshot, agent));
1536
+ const merged = withSubagentUsage(snapshot, childUsage);
1537
+ if (published !== void 0 && isEqual({
1538
+ ...published,
1539
+ cursor: void 0
1540
+ }, {
1541
+ ...merged.snapshot,
1542
+ cursor: void 0
1543
+ })) return;
1544
+ const value = {
1545
+ snapshot: merged.snapshot,
1546
+ ...merged.subagents === void 0 ? {} : { subagents: merged.subagents },
1547
+ ...published === void 0 ? {} : { previous: published }
1548
+ };
1549
+ published = merged.snapshot;
1550
+ const context = contextUsageUpdate(value);
1551
+ if (context !== void 0) await update(client, sessionId$1, context);
1552
+ if (merged.snapshot.models.length === 0) return;
1553
+ await client.notify(LODY_EXTENSION_METHODS.sessionUsageUpdate, detailedUsageUpdate(sessionId$1, value, agent));
1517
1554
  });
1518
1555
  const compactionStartedAt = /* @__PURE__ */ new Map();
1519
1556
  const task = (async () => {
1520
1557
  const { cursor } = await session.runtime.getUsage();
1521
1558
  if (closed) return;
1522
1559
  await publishGoal(session, client);
1560
+ await reloadChildren();
1523
1561
  subscription = session.runtime.facts(cursor === void 0 ? {} : { after: cursor });
1524
1562
  if (closed) {
1525
1563
  subscription.close();
@@ -1528,11 +1566,19 @@ function startSessionProjection(agent, session, client) {
1528
1566
  for await (const fact of subscription) {
1529
1567
  if (closed) return;
1530
1568
  if (factAffectsGoal(fact)) await publishGoal(session, client);
1531
- await projectCompaction(session.metadata.sessionId, fact, compactionStartedAt, client);
1569
+ await projectCompaction(sessionId$1, fact, compactionStartedAt, client);
1570
+ if (factAffectsChildren(fact)) {
1571
+ await reloadChildren();
1572
+ await usage.refresh();
1573
+ }
1532
1574
  }
1533
1575
  })().catch(() => void 0);
1534
1576
  return {
1535
- refresh: usage.refresh,
1577
+ refresh: async () => {
1578
+ if (closed) return;
1579
+ await reloadChildren();
1580
+ await usage.refresh();
1581
+ },
1536
1582
  close: async () => {
1537
1583
  closed = true;
1538
1584
  subscription?.close();
@@ -1591,6 +1637,21 @@ function factAffectsGoal(fact) {
1591
1637
  default: return false;
1592
1638
  }
1593
1639
  }
1640
+ /**
1641
+ * Child Sessions journal their own model requests, so the owning Session sees their spend only when
1642
+ * an `agent` Tool result returns, or when a background completion reaches the Session as input.
1643
+ */
1644
+ function factAffectsChildren(fact) {
1645
+ switch (fact.kind) {
1646
+ case "tool.result.message.committed": {
1647
+ const { source } = fact.payload;
1648
+ return (source.kind === "effect" ? source.toolName : source.message.toolName) === "agent";
1649
+ }
1650
+ case "submission.accepted":
1651
+ case "submission.placed": return true;
1652
+ default: return false;
1653
+ }
1654
+ }
1594
1655
  async function publishGoal(session, client) {
1595
1656
  const goal = await getGoal(session.runtime);
1596
1657
  await update(client, session.metadata.sessionId, {
@@ -1749,4 +1810,4 @@ async function attachOpeningSlashCommands(state, attached, client) {
1749
1810
 
1750
1811
  //#endregion
1751
1812
  export { createSorbetAcpAgent as t };
1752
- //# sourceMappingURL=agent-HcP_jR30.js.map
1813
+ //# sourceMappingURL=agent-Hg6W1x79.js.map