@zooid/acp-client 0.7.3 → 0.8.0

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.3",
3
+ "version": "0.8.0",
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",
package/src/errors.ts CHANGED
@@ -10,6 +10,7 @@ export type ErrorCode =
10
10
  | 'container_exit'
11
11
  | 'acp_protocol'
12
12
  | 'permission_denied'
13
+ | 'media_failed'
13
14
  | 'internal'
14
15
 
15
16
  export interface Classified {
@@ -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/index.ts CHANGED
@@ -18,6 +18,7 @@ export type {
18
18
  ApprovalDecision,
19
19
  ApprovalRequest,
20
20
  AgentMessageChunkEvent,
21
+ ContentBlock,
21
22
  PlanEvent,
22
23
  PromptInput,
23
24
  PromptResult,
package/src/types.ts CHANGED
@@ -6,6 +6,8 @@ import type {
6
6
  ToolCallStatus,
7
7
  ToolKind,
8
8
  } from '@agentclientprotocol/sdk'
9
+
10
+ export type { ContentBlock }
9
11
  import type { PresetName } from './presets.js'
10
12
 
11
13
  /**
@@ -63,6 +65,13 @@ export interface AgentMessageChunkEvent {
63
65
  type: 'agent_message_chunk'
64
66
  sessionId: string
65
67
  content: ContentBlock
68
+ /**
69
+ * Identifier of the assistant message this chunk belongs to, when the agent
70
+ * supplies one (opencode does; Claude Code does not). Lets transports detect
71
+ * message boundaries — a new id means a new message, which agents emit
72
+ * without any delimiter chunk between them. Undefined when not provided.
73
+ */
74
+ messageId?: string
66
75
  }
67
76
 
68
77
  export interface ToolCallLocation {