@zooid/acp-client 0.7.2 → 0.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zooid/acp-client",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Zooid's ACP client: spawn agent subprocesses, drive them via Agent Client Protocol, route events and permission requests through callbacks.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -18,6 +18,26 @@ describe('acpUpdateToAgentEvent', () => {
18
18
  type: 'agent_message_chunk',
19
19
  sessionId: 's-1',
20
20
  content: { type: 'text', text: 'hello' },
21
+ messageId: undefined,
22
+ })
23
+ })
24
+
25
+ it('forwards messageId on agent_message_chunk when the agent supplies one (opencode)', () => {
26
+ const event = acpUpdateToAgentEvent({
27
+ sessionId: 's-1',
28
+ update: {
29
+ sessionUpdate: 'agent_message_chunk',
30
+ content: { type: 'text', text: 'hello' },
31
+ // opencode stamps each assistant message with its own id; not in the
32
+ // ACP schema, so it rides through as an extra field.
33
+ messageId: 'msg_abc',
34
+ } as never,
35
+ })
36
+ expect(event).toEqual<AgentEvent>({
37
+ type: 'agent_message_chunk',
38
+ sessionId: 's-1',
39
+ content: { type: 'text', text: 'hello' },
40
+ messageId: 'msg_abc',
21
41
  })
22
42
  })
23
43
 
@@ -17,6 +17,10 @@ export function acpUpdateToAgentEvent(
17
17
  type: 'agent_message_chunk',
18
18
  sessionId,
19
19
  content: update.content,
20
+ // `messageId` is not part of the ACP `agent_message_chunk` schema, but
21
+ // opencode includes it. Forward it so transports can split on message
22
+ // boundaries; harmlessly undefined for agents that omit it.
23
+ messageId: (update as { messageId?: string }).messageId,
20
24
  }
21
25
  case 'tool_call':
22
26
  return {
package/src/types.ts CHANGED
@@ -63,6 +63,13 @@ export interface AgentMessageChunkEvent {
63
63
  type: 'agent_message_chunk'
64
64
  sessionId: string
65
65
  content: ContentBlock
66
+ /**
67
+ * Identifier of the assistant message this chunk belongs to, when the agent
68
+ * supplies one (opencode does; Claude Code does not). Lets transports detect
69
+ * message boundaries — a new id means a new message, which agents emit
70
+ * without any delimiter chunk between them. Undefined when not provided.
71
+ */
72
+ messageId?: string
66
73
  }
67
74
 
68
75
  export interface ToolCallLocation {