@sorbetai/acp 0.1.0-alpha.3 → 0.1.0-alpha.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/COMPATIBILITY.md +70 -70
  2. package/MCP_HOST.md +2 -1
  3. package/README.md +9 -2
  4. package/agent.json +1 -1
  5. package/dist/{agent-BWzy47BP.js → agent-BCOPO0L6.js} +86 -56
  6. package/dist/agent-BCOPO0L6.js.map +1 -0
  7. package/dist/{agent-B7GnQJCA.d.ts → agent-BhmoMZBU.d.ts} +3 -3
  8. package/dist/{authentication-D-5hJDU6.js → authentication-ceH0FNpg.js} +2 -2
  9. package/dist/{authentication-D-5hJDU6.js.map → authentication-ceH0FNpg.js.map} +1 -1
  10. package/dist/{compatibility-BD_TbVPM.d.ts → compatibility-Dj5DvCj9.d.ts} +6 -6
  11. package/dist/{compatibility-1QpPxK_p.js → compatibility-afjlc8C_.js} +6 -6
  12. package/dist/compatibility-afjlc8C_.js.map +1 -0
  13. package/dist/compatibility.d.ts +1 -1
  14. package/dist/compatibility.js +1 -1
  15. package/dist/{environment-B-BArXxO.js → environment-7S0-Wqln.js} +59 -29
  16. package/dist/environment-7S0-Wqln.js.map +1 -0
  17. package/dist/{esm-BtdR1t_L.js → esm-ADdBCfsU.js} +2 -2
  18. package/dist/{esm-BtdR1t_L.js.map → esm-ADdBCfsU.js.map} +1 -1
  19. package/dist/{execAsync-B4-X9Hoy.js → execAsync-BvmYsUWQ.js} +2 -2
  20. package/dist/{execAsync-B4-X9Hoy.js.map → execAsync-BvmYsUWQ.js.map} +1 -1
  21. package/dist/{experimental-v2-DgFGCuo2.js → experimental-v2-B0g-apN0.js} +122 -18
  22. package/dist/experimental-v2-B0g-apN0.js.map +1 -0
  23. package/dist/{experimental-v2-a58ITC2d.d.ts → experimental-v2-uBjYsXWJ.d.ts} +3 -3
  24. package/dist/experimental-v2.d.ts +3 -3
  25. package/dist/experimental-v2.js +4 -4
  26. package/dist/filesystem-worker.js +52 -19
  27. package/dist/filesystem-worker.js.map +1 -1
  28. package/dist/{getMachineId-bsd-IHzOcFWI.js → getMachineId-bsd-DMi4LSrq.js} +3 -3
  29. package/dist/{getMachineId-bsd-IHzOcFWI.js.map → getMachineId-bsd-DMi4LSrq.js.map} +1 -1
  30. package/dist/{getMachineId-darwin-BecBWon1.js → getMachineId-darwin-D4kzFBWw.js} +3 -3
  31. package/dist/{getMachineId-darwin-BecBWon1.js.map → getMachineId-darwin-D4kzFBWw.js.map} +1 -1
  32. package/dist/{getMachineId-linux-Ce7oJ7Ie.js → getMachineId-linux-BaClIYJg.js} +2 -2
  33. package/dist/{getMachineId-linux-Ce7oJ7Ie.js.map → getMachineId-linux-BaClIYJg.js.map} +1 -1
  34. package/dist/{getMachineId-unsupported-BkvLks-h.js → getMachineId-unsupported-BTb7CCyX.js} +2 -2
  35. package/dist/{getMachineId-unsupported-BkvLks-h.js.map → getMachineId-unsupported-BTb7CCyX.js.map} +1 -1
  36. package/dist/{getMachineId-win-DjQUtLb-.js → getMachineId-win-S5PVECTO.js} +3 -3
  37. package/dist/{getMachineId-win-DjQUtLb-.js.map → getMachineId-win-S5PVECTO.js.map} +1 -1
  38. package/dist/{index-fSbkxdkc.d.ts → index-B1Rr3ylL.d.ts} +5 -5
  39. package/dist/{index-Bv7GQRxc.d.ts → index-Dgnt2Dbe.d.ts} +11608 -4882
  40. package/dist/index.d.ts +4 -4
  41. package/dist/index.js +6 -6
  42. package/dist/isolate-worker.mjs +30239 -3330
  43. package/dist/managed-worker.js +1 -1
  44. package/dist/{mcp-host-profile-Da6fnCyK.js → mcp-host-profile-ws1FVgCu.js} +70 -19
  45. package/dist/mcp-host-profile-ws1FVgCu.js.map +1 -0
  46. package/dist/mcp-host.d.ts +1 -1
  47. package/dist/mcp-host.js +3 -3
  48. package/dist/mcp-host.js.map +1 -1
  49. package/dist/{otlp-BHSWLZNu.js → otlp-7Yu-NQ4V.js} +374 -4259
  50. package/dist/otlp-7Yu-NQ4V.js.map +1 -0
  51. package/dist/{prompt-work-e71pLSwi.js → prompt-work-DR0Y4XcD.js} +29821 -23557
  52. package/dist/prompt-work-DR0Y4XcD.js.map +1 -0
  53. package/dist/src-t1dCyRPw.js +4753 -0
  54. package/dist/src-t1dCyRPw.js.map +1 -0
  55. package/dist/{stdio-cli-main-CNqlHhr7.js → stdio-cli-main-p8c8vhUL.js} +1670 -531
  56. package/dist/stdio-cli-main-p8c8vhUL.js.map +1 -0
  57. package/dist/stdio-cli.js +1 -1
  58. package/dist/{stdio-osGr1k2G.js → stdio-zoYDCG-W.js} +3 -3
  59. package/dist/{stdio-osGr1k2G.js.map → stdio-zoYDCG-W.js.map} +1 -1
  60. package/dist/stdio.d.ts +4 -4
  61. package/dist/stdio.js +6 -6
  62. package/package.json +11 -10
  63. package/dist/agent-BWzy47BP.js.map +0 -1
  64. package/dist/compatibility-1QpPxK_p.js.map +0 -1
  65. package/dist/environment-B-BArXxO.js.map +0 -1
  66. package/dist/experimental-v2-DgFGCuo2.js.map +0 -1
  67. package/dist/mcp-host-profile-Da6fnCyK.js.map +0 -1
  68. package/dist/metrics-BUyfNRF_-BmvM6Q32.js +0 -694
  69. package/dist/metrics-BUyfNRF_-BmvM6Q32.js.map +0 -1
  70. package/dist/otlp-BHSWLZNu.js.map +0 -1
  71. package/dist/prompt-work-e71pLSwi.js.map +0 -1
  72. package/dist/stdio-cli-main-CNqlHhr7.js.map +0 -1
package/COMPATIBILITY.md CHANGED
@@ -28,10 +28,10 @@ supported behavior is connected and operational.
28
28
  | ------------------------------- | --------: | ------: | ----------: | ----: |
29
29
  | Stable v1 Agent methods | 17 | 0 | 11 | 28 |
30
30
  | Stable v1 Client methods | 11 | 0 | 3 | 14 |
31
- | Stable v1 Session updates | 12 | 0 | 3 | 15 |
31
+ | Stable v1 Session updates | 13 | 0 | 2 | 15 |
32
32
  | Experimental v2 Agent methods | 15 | 1 | 10 | 26 |
33
33
  | Experimental v2 Client methods | 7 | 0 | 0 | 7 |
34
- | Experimental v2 Session updates | 14 | 0 | 5 | 19 |
34
+ | Experimental v2 Session updates | 15 | 0 | 4 | 19 |
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 |
@@ -47,36 +47,36 @@ supported behavior is connected and operational.
47
47
 
48
48
  ## Stable v1 Agent methods
49
49
 
50
- | Protocol item | Status | Notes |
51
- | --------------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
- | `initialize` | ✅ Supported | Negotiates ACP v1, Client capabilities, Sorbet extensions, and advertised features. |
53
- | `authenticate` | ✅ Supported | Dispatches only authentication methods supplied by the injected authentication port. |
54
- | `logout` | ✅ Supported | Uses the injected authentication port or logs out NodeAgent provider credentials. |
55
- | `providers/list` | ✅ Supported | Lists stable Pi Provider slots with non-secret process-local endpoint state. |
56
- | `providers/set` | ✅ Supported | Fully replaces a known Provider endpoint without persisting headers or routing state. |
57
- | `providers/disable` | ✅ Supported | Disables a Provider endpoint while preserving its stable discoverable definition. |
58
- | `session/new` | ✅ Supported | Creates a durable Sorbet Session with workspace, MCP, and model bindings. |
59
- | `session/load` | ✅ Supported | Reopens an unattached Session, abandons interrupted execution without retrying effects, pauses its Goal, and replays durable conversation and Plan projections. |
60
- | `session/list` | ✅ Supported | Provides cwd filtering and opaque cursor pagination. |
61
- | `session/delete` | ✅ Supported | Closes connection state and idempotently deletes the Session catalog entry. |
62
- | `session/fork` | ✅ Supported | Creates an independent durable Session from a committed conversation boundary. |
63
- | `session/resume` | ✅ Supported | Reopens an unattached durable Session with new connection-scoped bindings. |
64
- | `session/close` | ✅ Supported | Aborts active work and releases Session, MCP, and connection resources. |
65
- | `session/set_mode` | ✅ Supported | Keeps ACP v1 Session mode at its sole advertised default; permissions use permission_mode. |
66
- | `session/set_config_option` | ✅ Supported | Applies advertised model, thinking-level, and permission selectors and publishes updated option state. |
67
- | `session/prompt` | ✅ Supported | Runs prompts and, in Plan permission mode, reviews the proposal before an idempotent implementation Run. |
68
- | `session/cancel` | ✅ Supported | Pauses the active Goal and cancels and drains current work, including automatic Runs without an ACP prompt owner. |
69
- | `mcp/message` | ❌ Unsupported | Stable v1 supports stdio, HTTP, and SSE MCP, but not MCP-over-ACP. |
70
- | `nes/start` | ❌ Unsupported | No Next Edit Suggestions engine is connected or advertised. |
71
- | `nes/suggest` | ❌ Unsupported | No Next Edit Suggestions engine is connected or advertised. |
72
- | `nes/accept` | ❌ Unsupported | No Next Edit Suggestions engine is connected or advertised. |
73
- | `nes/reject` | ❌ Unsupported | No Next Edit Suggestions engine is connected or advertised. |
74
- | `nes/close` | ❌ Unsupported | No Next Edit Suggestions engine is connected or advertised. |
75
- | `document/didOpen` | ❌ Unsupported | No editor document-state port is connected or advertised. |
76
- | `document/didChange` | ❌ Unsupported | No editor document-state port is connected or advertised. |
77
- | `document/didClose` | ❌ Unsupported | No editor document-state port is connected or advertised. |
78
- | `document/didSave` | ❌ Unsupported | No editor document-state port is connected or advertised. |
79
- | `document/didFocus` | ❌ Unsupported | No editor document-state port is connected or advertised. |
50
+ | Protocol item | Status | Notes |
51
+ | --------------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
+ | `initialize` | ✅ Supported | Negotiates ACP v1, Client capabilities, Sorbet extensions, and advertised features. |
53
+ | `authenticate` | ✅ Supported | Dispatches only authentication methods supplied by the injected authentication port. |
54
+ | `logout` | ✅ Supported | Uses the injected authentication port or logs out NodeAgent provider credentials. |
55
+ | `providers/list` | ✅ Supported | Lists stable Pi Provider slots with non-secret process-local endpoint state. |
56
+ | `providers/set` | ✅ Supported | Fully replaces a known Provider endpoint without persisting headers or routing state. |
57
+ | `providers/disable` | ✅ Supported | Disables a Provider endpoint while preserving its stable discoverable definition. |
58
+ | `session/new` | ✅ Supported | Creates a durable Sorbet Session with workspace, MCP, and model bindings. |
59
+ | `session/load` | ✅ Supported | Reopens an unattached Session, resumes unparked interrupted Runs through NodeAgent, and replays durable conversation and Plan projections. Recovery never re-executes an Effect attempt. |
60
+ | `session/list` | ✅ Supported | Provides cwd filtering and opaque cursor pagination. |
61
+ | `session/delete` | ✅ Supported | Closes connection state and idempotently deletes the Session catalog entry. |
62
+ | `session/fork` | ✅ Supported | Creates an independent durable Session from a committed conversation boundary. |
63
+ | `session/resume` | ✅ Supported | Reopens an unattached durable Session with new connection-scoped bindings. |
64
+ | `session/close` | ✅ Supported | Aborts active work and releases Session, MCP, and connection resources. |
65
+ | `session/set_mode` | ✅ Supported | Keeps ACP v1 Session mode at its sole advertised default; permissions use permission_mode. |
66
+ | `session/set_config_option` | ✅ Supported | Applies advertised model, thinking-level, and permission selectors and publishes updated option state. |
67
+ | `session/prompt` | ✅ Supported | Runs prompts and, in Plan permission mode, reviews the proposal before an idempotent implementation Run. |
68
+ | `session/cancel` | ✅ Supported | Pauses the active Goal and cancels and drains current work, including automatic Runs without an ACP prompt owner. |
69
+ | `mcp/message` | ❌ Unsupported | Stable v1 supports stdio, HTTP, and SSE MCP, but not MCP-over-ACP. |
70
+ | `nes/start` | ❌ Unsupported | No Next Edit Suggestions engine is connected or advertised. |
71
+ | `nes/suggest` | ❌ Unsupported | No Next Edit Suggestions engine is connected or advertised. |
72
+ | `nes/accept` | ❌ Unsupported | No Next Edit Suggestions engine is connected or advertised. |
73
+ | `nes/reject` | ❌ Unsupported | No Next Edit Suggestions engine is connected or advertised. |
74
+ | `nes/close` | ❌ Unsupported | No Next Edit Suggestions engine is connected or advertised. |
75
+ | `document/didOpen` | ❌ Unsupported | No editor document-state port is connected or advertised. |
76
+ | `document/didChange` | ❌ Unsupported | No editor document-state port is connected or advertised. |
77
+ | `document/didClose` | ❌ Unsupported | No editor document-state port is connected or advertised. |
78
+ | `document/didSave` | ❌ Unsupported | No editor document-state port is connected or advertised. |
79
+ | `document/didFocus` | ❌ Unsupported | No editor document-state port is connected or advertised. |
80
80
 
81
81
  ## Stable v1 Client methods
82
82
 
@@ -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` | ❌ Unsupported | Sorbet has no ACP command catalog projection. |
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 current context occupancy, model context size, and cumulative Session cost. |
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` | ❌ Unsupported | Sorbet has no ACP command catalog projection. |
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 current context occupancy, model context size, and cumulative Session cost. |
186
186
 
187
187
  ## Shared protocol methods
188
188
 
package/MCP_HOST.md CHANGED
@@ -69,7 +69,8 @@ v1 `clientCapabilities._meta` or v2 `capabilities._meta`. Verify the Agent's
69
69
  acknowledgment before using the helper. The acknowledgment includes `version: 1`,
70
70
  `read: true`, `call: true` and `control: 'installed-services'`. No acknowledgment
71
71
  means access is unavailable, even if the Client sends a custom method anyway.
72
- The stock CLI does not opt into remote Host control; an embedding must authorize it.
72
+ The stock CLI enables remote Host control; SDK embeddings must explicitly authorize it.
73
+ The Client must still negotiate the profile and install handlers for each offered service.
73
74
  Import `MCP_EVENTS_PROFILE` from `@sorbetai/mcp`; its pinned experimental version is
74
75
  independent of stable MCP support.
75
76
 
package/README.md CHANGED
@@ -164,8 +164,15 @@ Session for the next model request. Native execution starts no additional model
164
164
  turn. Sorbet checks tool permission and appends `effect.requested` before dispatch,
165
165
  then records the terminal Effect and tool result. Pi input edits from `tool_call`
166
166
  hooks reach Sorbet's validation and authorization before the tool body executes.
167
- Pi protection hooks also run for Sorbet Host tools. Original Pi commands appear as
168
- `pi_command_*` model tools, with ordinary permissions and Effect recording. The CLI
167
+ Pi protection hooks also run for Sorbet Host tools. Original Pi commands appear in
168
+ the Session slash command directory under their original names and as `pi_command_*`
169
+ model tools, with ordinary permissions and Effect recording. ACP v1 and v2 publish
170
+ complete command snapshots through `available_commands_update`; a recognized slash
171
+ command in a prompt is dispatched through the Session. Each attached Session currently
172
+ accepts only one active ACP prompt, so another prompt containing a slash command is
173
+ rejected until the active prompt finishes. See the
174
+ [Session slash command contract](../node-agent/README.md#session-slash-commands).
175
+ The CLI
169
176
  authorizes installed Tools to replace Host `read`, `edit`, `write` and `bash` at a
170
177
  request boundary; other name collisions remain errors. Uninstall restores those
171
178
  Host tools in the next request.
package/agent.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "sorbet",
3
3
  "name": "Sorbet",
4
- "version": "0.1.0-alpha.3",
4
+ "version": "0.1.0-alpha.4",
5
5
  "description": "A durable Pi-based Agent Harness with ACP v1 and experimental ACP v2 support.",
6
6
  "repository": "https://github.com/lodyspeak/sorbet",
7
7
  "license": "MIT",
@@ -1,9 +1,9 @@
1
- import { A as NodeAgentError, B as pluginApplyParser, C as SORBET_ACP_VERSION, D as createV1RequestElicitation, E as observeSessionUsage, F as isAuthoritativeSessionTitleSource, H as pluginWatchParser, I as JournalCursorSchema, M as coordinateNodeAgentBehavior, O as createV1SessionElicitation, T as detailedUsageUpdate, V as pluginQueryParser, a as recoverInterruptedSession, b as AcpMcpAttachment, c as sessionRequestError, d as projectedToolTitle, f as toolTitle, g as createV1McpElicitationOptions, h as modelsIncludingCurrent, i as readGoalPromptControl, j as NodeAgentErrorCode, l as projectBackgroundRun, m as modelConfigOptions, n as applyGoalControl, o as AcpSessionAttachments, p as listRefreshedModels, r as cancelSessionWork, s as lodyTitleSource, t as AcpPromptWork, u as presentationTools, v as mcpElicitationProfile, w as contextUsageUpdate, x as connectMcpServers, y as AcpMcpHost, z as AcpPluginComposition } from "./prompt-work-e71pLSwi.js";
1
+ import { A as coordinateNodeAgentBehavior, At as parseSlashCommand, B as pluginApplyParser, C as contextUsageUpdate, D as createV1SessionElicitation, E as createV1RequestElicitation, F as NodeAgentErrorCode, H as pluginWatchParser, I as JournalCursorSchema, N as isAuthoritativeSessionTitleSource, Ot as commandGoal, P as NodeAgentError, S as SORBET_ACP_VERSION, T as observeSessionUsage, V as pluginQueryParser, _ as mcpElicitationProfile, a as AcpSessionAttachments, b as connectMcpServers, c as projectBackgroundRun, d as toolTitle, f as listRefreshedModels, h as createV1McpElicitationOptions, i as readGoalPromptControl, jt as watchSlashCommands, kt as getGoal, l as presentationTools, m as modelsIncludingCurrent, n as applyGoalControl, o as lodyTitleSource, p as modelConfigOptions, r as cancelSessionWork, s as sessionRequestError, t as AcpPromptWork, u as projectedToolTitle, v as AcpMcpHost, w as detailedUsageUpdate, y as AcpMcpAttachment, z as AcpPluginComposition } from "./prompt-work-DR0Y4XcD.js";
2
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-Da6fnCyK.js";
4
- import * as acp from "@agentclientprotocol/sdk";
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-ws1FVgCu.js";
5
4
  import { Type } from "typebox";
6
5
  import { Check, Parse } from "typebox/schema";
6
+ import * as acp from "@agentclientprotocol/sdk";
7
7
  import { isEqual, isNil, isString } from "es-toolkit";
8
8
  import { LODY_EXTENSION_METHODS } from "acp-extension-core";
9
9
  import { z } from "zod";
@@ -277,6 +277,8 @@ function mediaTypeAttribute(mediaType) {
277
277
  const ToolLocationParametersSchema = Type.Object({ path: Type.String({ minLength: 1 }) }, { additionalProperties: true });
278
278
  const ChildSnapshotSchema = Type.Object({
279
279
  agentId: Type.String({ minLength: 1 }),
280
+ name: Type.Optional(Type.String({ minLength: 1 })),
281
+ description: Type.Optional(Type.String({ minLength: 1 })),
280
282
  state: Type.Union([
281
283
  Type.Literal("starting"),
282
284
  Type.Literal("running"),
@@ -391,20 +393,22 @@ async function projectRun(sessionId$1, run, client, tools, supportsPlanUpdates)
391
393
  function retryToolCallId(logicalModelCallId, attempt) {
392
394
  return `sorbet-retry:${logicalModelCallId}:${attempt}`;
393
395
  }
394
- async function projectChildTasks(sessionId$1, parentToolCallId, result, client) {
396
+ async function projectChildTasks(sessionId$1, parentToolCallId, result, client, currentChildren) {
395
397
  if (!Check(ChildToolResultSchema, result) || result.details.action === "list_models") return;
396
398
  const snapshots = [
397
399
  ...result.details.agent === void 0 ? [] : [result.details.agent],
398
400
  ...result.details.agents ?? [],
399
401
  ...(result.details.tasks ?? []).flatMap(({ agent }) => agent === void 0 ? [] : [agent])
400
402
  ];
401
- const unique = new Map(snapshots.map((snapshot) => [snapshot.agentId, snapshot]));
403
+ if (snapshots.length === 0) return;
404
+ const children = await currentChildren?.();
405
+ const unique = new Map(snapshots.map((snapshot) => [snapshot.agentId, children?.get(snapshot.agentId) ?? snapshot]));
402
406
  await Promise.all([...unique.values()].map((snapshot) => {
403
407
  const status = childTaskStatus(snapshot.state);
404
408
  return update(client, sessionId$1, {
405
409
  sessionUpdate: "tool_call",
406
410
  toolCallId: `sorbet-child:${snapshot.agentId}`,
407
- title: `Child agent ${snapshot.agentId}`,
411
+ title: snapshot.name ?? `Child agent ${snapshot.agentId}`,
408
412
  name: "agent",
409
413
  kind: "other",
410
414
  status,
@@ -413,7 +417,8 @@ async function projectChildTasks(sessionId$1, parentToolCallId, result, client)
413
417
  taskId: snapshot.agentId,
414
418
  kind: "subagent",
415
419
  status,
416
- actor: snapshot.agentId,
420
+ actor: snapshot.name ?? `Child agent ${snapshot.agentId}`,
421
+ ...snapshot.description === void 0 ? {} : { description: snapshot.description },
417
422
  parentToolCallId,
418
423
  usage: { totalTokens: snapshot.modelUsage.totalTokens },
419
424
  ...snapshot.response === void 0 ? {} : { summary: snapshot.response.text },
@@ -781,19 +786,23 @@ function buildConnectionApp(options, state) {
781
786
  return {};
782
787
  }).onRequest(acp.methods.agent.session.new, async ({ params, client, requestId, signal }) => state.sessions.run(void 0, async () => {
783
788
  const attached = await createSession(options, state, params, client, signal, requestId);
789
+ await attachOpeningSlashCommands(state, attached, client);
784
790
  await attached.projection.refresh();
785
791
  return sessionResponse(options.agent, attached.session);
786
792
  })).onRequest(acp.methods.agent.session.load, async ({ params, client, requestId, signal }) => state.sessions.run(params.sessionId, async () => {
787
793
  const attached = await loadSession(options, state, params, client, signal, requestId);
788
- await replayConversation(params.sessionId, attached.session, client, presentationTools(attached.bindings, attached.session), state.capabilities.plan != null);
794
+ await replayConversation(options.agent, params.sessionId, attached.session, client, presentationTools(attached.bindings, attached.session), state.capabilities.plan != null);
795
+ await attachOpeningSlashCommands(state, attached, client);
789
796
  await attached.projection.refresh();
790
797
  return sessionStateResponse(options.agent, attached.session, await options.agent.listAvailableModels());
791
798
  })).onRequest(acp.methods.agent.session.fork, async ({ params, client, requestId, signal }) => state.sessions.run(void 0, async () => {
792
799
  const attached = await forkSession(options, state, params, client, signal, requestId);
800
+ await attachOpeningSlashCommands(state, attached, client);
793
801
  await attached.projection.refresh();
794
802
  return sessionResponse(options.agent, attached.session);
795
803
  })).onRequest(acp.methods.agent.session.resume, async ({ params, client, requestId, signal }) => state.sessions.run(params.sessionId, async () => {
796
804
  const attached = await loadSession(options, state, params, client, signal, requestId);
805
+ await attachOpeningSlashCommands(state, attached, client);
797
806
  await attached.projection.refresh();
798
807
  return sessionStateResponse(options.agent, attached.session, await options.agent.listAvailableModels());
799
808
  })).onRequest(acp.methods.agent.session.list, async ({ params }) => listSessions(options, params)).onRequest(acp.methods.agent.session.delete, async ({ params }) => state.sessions.run(params.sessionId, async () => {
@@ -821,6 +830,8 @@ function buildConnectionApp(options, state) {
821
830
  attached.session = replacement;
822
831
  await attached.projection.close();
823
832
  attached.projection = startSessionProjection(options.agent, replacement, client);
833
+ attached.slashWatch?.close();
834
+ await attachSlashCommands(attached, client);
824
835
  } else if (params.configId === THINKING_LEVEL_CONFIG_ID) {
825
836
  if (attached.prompt !== void 0 && params.value !== attached.session.modelConfiguration.thinkingLevel) throw acp.RequestError.invalidRequest(params.sessionId, "Cannot change thinking level while the Session is running");
826
837
  const thinkingLevel = attached.session.modelConfiguration.availableThinkingLevels.find((level) => level === params.value);
@@ -880,7 +891,7 @@ function buildConnectionApp(options, state) {
880
891
  projection.catch(() => void 0);
881
892
  try {
882
893
  workSignal.throwIfAborted();
883
- await applyGoalControl(attached.session, goalControl);
894
+ await applyGoalControl(attached.session, goalControl, workSignal);
884
895
  work.ownGoal(attached.session);
885
896
  await attached.session.runtime.waitForIdle({ signal: workSignal });
886
897
  } finally {
@@ -894,6 +905,29 @@ function buildConnectionApp(options, state) {
894
905
  await attached.projection.refresh();
895
906
  return { stopReason: "end_turn" };
896
907
  }
908
+ const command = parseSlashCommand(attached.session, params.prompt);
909
+ if (command !== void 0) {
910
+ const result = await work.executeCommand(() => attached.session.slashCommands.execute({
911
+ ...command,
912
+ source: {
913
+ kind: "acp.client",
914
+ data: { method: "session/prompt" }
915
+ }
916
+ }, { signal: workSignal }));
917
+ if (result.text.length > 0) await update(client, params.sessionId, {
918
+ sessionUpdate: "agent_message_chunk",
919
+ content: {
920
+ type: "text",
921
+ text: result.text
922
+ }
923
+ });
924
+ if (result.run === void 0) return { stopReason: "end_turn" };
925
+ await publishTurnBoundary(params.sessionId, result.run.receipt.runId, client);
926
+ const [, outcome$1] = await Promise.all([projectRun(params.sessionId, result.run, client, presentationTools(attached.bindings, attached.session), state.capabilities.plan != null), result.run.result()]);
927
+ await attached.projection.refresh();
928
+ assertRunSucceeded(outcome$1);
929
+ return { stopReason: await stopReason(attached.session, outcome$1.kind) };
930
+ }
897
931
  const prompt = await decodePrompt(params.prompt, options.audio, workSignal);
898
932
  await work.submit(attached.session, {
899
933
  kind: "user-message",
@@ -957,7 +991,7 @@ function buildConnectionApp(options, state) {
957
991
  const prompt = attached.prompt;
958
992
  if (prompt === void 0) await cancelSessionWork(attached.session, "ACP Client cancelled the prompt");
959
993
  else {
960
- if ((await attached.session.runtime.getGoal())?.status === "active") await attached.session.runtime.pauseGoal();
994
+ if ((await getGoal(attached.session.runtime))?.status === "active") await commandGoal(attached.session.runtime, "pause");
961
995
  await prompt.cancel("ACP Client cancelled the prompt");
962
996
  }
963
997
  }).onRequest(SESSION_STEERING_METHOD, steeringParser, async ({ params, client, signal }) => {
@@ -1027,7 +1061,7 @@ function buildConnectionApp(options, state) {
1027
1061
  return { goal: snapshot };
1028
1062
  }).onRequest(LODY_EXTENSION_METHODS.sessionHistoryRead, lodySessionHistoryParser, async ({ params, client }) => {
1029
1063
  const attached = requireAttached(state, params.sessionId);
1030
- await replayConversation(params.sessionId, attached.session, client, presentationTools(attached.bindings, attached.session), state.capabilities.plan != null);
1064
+ await replayConversation(options.agent, params.sessionId, attached.session, client, presentationTools(attached.bindings, attached.session), state.capabilities.plan != null);
1031
1065
  return {};
1032
1066
  }).onRequest(LODY_EXTENSION_METHODS.subagentsList, lodySubagentsListParser, async ({ params }) => {
1033
1067
  requireAttached(state, params.sessionId);
@@ -1061,37 +1095,7 @@ function buildConnectionApp(options, state) {
1061
1095
  limit: 100,
1062
1096
  after
1063
1097
  })).facts.map((fact) => {
1064
- let owner;
1065
- switch (fact.kind) {
1066
- case "tool.operation.accepted":
1067
- case "tool.operation.approval.requested":
1068
- case "tool.operation.approval.resolved":
1069
- case "tool.operation.permission.decided":
1070
- case "tool.operation.permission.failed":
1071
- case "tool.operation.effect.requested":
1072
- case "tool.operation.effect.succeeded":
1073
- case "tool.operation.effect.failed":
1074
- case "tool.operation.effect.unknown":
1075
- case "tool.operation.terminal":
1076
- case "session.forked":
1077
- case "model.request.base.committed":
1078
- case "goal.created":
1079
- case "goal.continuation.requested":
1080
- case "goal.status.changed":
1081
- case "goal.removed":
1082
- case "session.behavior.changed":
1083
- case "permission.grant.revoked":
1084
- case "compaction.requested":
1085
- case "compaction.model.requested":
1086
- case "compaction.model.response.committed":
1087
- case "compaction.model.failed":
1088
- case "compaction.committed":
1089
- case "compaction.failed":
1090
- case "compaction.skipped":
1091
- owner = { operationId: fact.operationId };
1092
- break;
1093
- default: owner = { runId: fact.runId };
1094
- }
1098
+ const owner = fact.runId === void 0 ? { operationId: fact.operationId } : { runId: fact.runId };
1095
1099
  return {
1096
1100
  id: fact.id,
1097
1101
  ...owner,
@@ -1183,6 +1187,8 @@ async function loadSession(options, state, params, client, signal, requestId) {
1183
1187
  signal,
1184
1188
  allowNetwork: false
1185
1189
  });
1190
+ const metadata = (await options.agent.listSessions()).find((entry) => entry.sessionId === params.sessionId);
1191
+ if (metadata !== void 0 && metadata.workspace?.root !== params.cwd) throw acp.RequestError.invalidParams(params.cwd, "Session belongs to a different cwd");
1186
1192
  const identity = {
1187
1193
  sessionId: params.sessionId,
1188
1194
  elicitationSessionPublished: true
@@ -1196,8 +1202,8 @@ async function loadSession(options, state, params, client, signal, requestId) {
1196
1202
  };
1197
1203
  let session;
1198
1204
  try {
1205
+ await mcp.activate((activationSignal) => connectMcpServers(params.mcpServers ?? [], AbortSignal.any([signal, activationSignal]), createV1McpElicitationOptions(state.mcpHost.options(options.mcp, identity, client, requestId ?? void 0, () => mcp.sessions), state.capabilities, identity, requestId, client)));
1199
1206
  session = await options.agent.loadSession(params.sessionId, bindings);
1200
- await recoverInterruptedSession(session);
1201
1207
  const attached = {
1202
1208
  session,
1203
1209
  bindings,
@@ -1206,9 +1212,8 @@ async function loadSession(options, state, params, client, signal, requestId) {
1206
1212
  };
1207
1213
  state.sessions.attach(attached);
1208
1214
  const workspace = session.metadata.workspace;
1209
- if (workspace === void 0 || workspace.root !== params.cwd) throw acp.RequestError.invalidParams(params.cwd, "Session belongs to a different cwd");
1210
1215
  const requestedAdditional = params.additionalDirectories ?? [];
1211
- if (!isEqual(workspace.additionalDirectories ?? [], requestedAdditional)) {
1216
+ if (!isEqual(workspace?.additionalDirectories ?? [], requestedAdditional)) {
1212
1217
  session = await options.agent.setSessionWorkspace(params.sessionId, {
1213
1218
  root: params.cwd,
1214
1219
  additionalDirectories: requestedAdditional
@@ -1217,7 +1222,6 @@ async function loadSession(options, state, params, client, signal, requestId) {
1217
1222
  await attached.projection.close();
1218
1223
  attached.projection = startSessionProjection(options.agent, session, client);
1219
1224
  }
1220
- await mcp.activate((activationSignal) => connectMcpServers(params.mcpServers ?? [], AbortSignal.any([signal, activationSignal]), createV1McpElicitationOptions(state.mcpHost.options(options.mcp, identity, client, requestId ?? void 0, () => mcp.sessions), state.capabilities, identity, requestId, client)));
1221
1225
  identity.elicitationSessionPublished = true;
1222
1226
  for (const warning of mcp.warnings) await update(client, session.metadata.sessionId, warning);
1223
1227
  return attached;
@@ -1337,7 +1341,7 @@ async function sessionConfigOptions(agent, session, current, availableModels) {
1337
1341
  const selectableModels = modelsIncludingCurrent(availableModels, current);
1338
1342
  const thinkingLevels = current.availableThinkingLevels;
1339
1343
  return [
1340
- ...(await session.runtime.listBehaviors()).filter((entry) => entry.available).map((entry) => ({
1344
+ ...(await session.runtime.listBehaviors()).filter((entry) => entry.available && entry.name !== "objective").map((entry) => ({
1341
1345
  id: `behavior:${entry.name}`,
1342
1346
  name: entry.title,
1343
1347
  type: "select",
@@ -1426,12 +1430,17 @@ function decodeCursor(cursor) {
1426
1430
  throw acp.RequestError.invalidParams(cursor, "invalid Session list cursor");
1427
1431
  }
1428
1432
  }
1429
- async function replayConversation(sessionId$1, session, client, tools, supportsPlanUpdates) {
1433
+ async function replayConversation(agent, sessionId$1, session, client, tools, supportsPlanUpdates) {
1430
1434
  const entries = await session.runtime.conversationEntries();
1431
- for (const entry of entries) await replayEntry(sessionId$1, entry, client, tools);
1435
+ let cachedChildren;
1436
+ const children = session.metadata.depth === 0 ? () => {
1437
+ cachedChildren ??= agent.listChildAgents(sessionId$1, { includeClosed: true }).then(({ agents }) => new Map(agents.map((child) => [child.agentId, child])));
1438
+ return cachedChildren;
1439
+ } : void 0;
1440
+ for (const entry of entries) await replayEntry(sessionId$1, entry, client, tools, children);
1432
1441
  for (const behavior of await session.runtime.listBehaviors()) await projectBehaviorSnapshot(sessionId$1, behavior, client, supportsPlanUpdates);
1433
1442
  }
1434
- async function replayEntry(sessionId$1, entry, client, tools) {
1443
+ async function replayEntry(sessionId$1, entry, client, tools, children) {
1435
1444
  const message = entry.message;
1436
1445
  if (message.role === "user") {
1437
1446
  const blocks = isString(message.content) ? [{
@@ -1491,6 +1500,7 @@ async function replayEntry(sessionId$1, entry, client, tools) {
1491
1500
  })),
1492
1501
  rawOutput: message.details
1493
1502
  });
1503
+ if (message.toolName === "agent" && !message.isError) await projectChildTasks(sessionId$1, message.toolCallId, { details: message.details }, client, children);
1494
1504
  }
1495
1505
  function startSessionProjection(agent, session, client) {
1496
1506
  let closed = false;
@@ -1543,9 +1553,10 @@ function lodySubagentTask(child, metadata) {
1543
1553
  const childStopReason = lodySubagentStopReason(child);
1544
1554
  const startedAt = Date.parse(metadata?.createdAt ?? "");
1545
1555
  const endedAt = Date.parse(child.outcome?.recordedAt ?? metadata?.updatedAt ?? "");
1556
+ const description = [child.name ?? metadata?.title, child.description].filter(Boolean).join(" · ");
1546
1557
  return {
1547
1558
  taskId: child.agentId,
1548
- description: metadata?.title ?? `Child agent ${child.agentId}`,
1559
+ description: description || `Child agent ${child.agentId}`,
1549
1560
  status,
1550
1561
  agentId: child.agentId,
1551
1562
  ...metadata?.modelId === void 0 ? {} : { modelId: metadata.modelId },
@@ -1571,15 +1582,13 @@ function lodySubagentStopReason(child) {
1571
1582
  }
1572
1583
  function factAffectsGoal(fact) {
1573
1584
  switch (fact.kind) {
1574
- case "goal.created":
1575
- case "goal.status.changed":
1576
- case "goal.removed":
1585
+ case "session.behavior.changed":
1577
1586
  case "model.response.committed": return true;
1578
1587
  default: return false;
1579
1588
  }
1580
1589
  }
1581
1590
  async function publishGoal(session, client) {
1582
- const goal = await session.runtime.getGoal();
1591
+ const goal = await getGoal(session.runtime);
1583
1592
  await update(client, session.metadata.sessionId, {
1584
1593
  sessionUpdate: "session_info_update",
1585
1594
  _meta: { lody: { goal: lodyGoalSnapshot(goal) } }
@@ -1712,7 +1721,28 @@ function toolKind(name) {
1712
1721
  default: return "other";
1713
1722
  }
1714
1723
  }
1724
+ async function attachSlashCommands(attached, client) {
1725
+ const sessionId$1 = attached.session.metadata.sessionId;
1726
+ const watch = watchSlashCommands(attached.session, (commands) => update(client, sessionId$1, {
1727
+ sessionUpdate: "available_commands_update",
1728
+ availableCommands: commands.map(({ name, description, argumentHint }) => ({
1729
+ name,
1730
+ description,
1731
+ ...argumentHint === void 0 ? {} : { input: { hint: argumentHint } }
1732
+ }))
1733
+ }));
1734
+ attached.slashWatch = watch;
1735
+ await watch.ready;
1736
+ }
1737
+ async function attachOpeningSlashCommands(state, attached, client) {
1738
+ try {
1739
+ await attachSlashCommands(attached, client);
1740
+ } catch (cause) {
1741
+ const sessionId$1 = attached.session.metadata.sessionId;
1742
+ return state.sessions.rejectOpen(sessionId$1, attached.mcp, sessionRequestError(cause, sessionId$1));
1743
+ }
1744
+ }
1715
1745
 
1716
1746
  //#endregion
1717
1747
  export { createSorbetAcpAgent as t };
1718
- //# sourceMappingURL=agent-BWzy47BP.js.map
1748
+ //# sourceMappingURL=agent-BCOPO0L6.js.map