@zooid/acp-client 0.7.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/src/types.ts ADDED
@@ -0,0 +1,103 @@
1
+ import type {
2
+ ContentBlock,
3
+ PlanEntry,
4
+ StopReason,
5
+ ToolCallContent,
6
+ ToolCallStatus,
7
+ ToolKind,
8
+ } from '@agentclientprotocol/sdk'
9
+ import type { PresetName } from './presets.js'
10
+
11
+ export interface AgentConfig {
12
+ id: string
13
+ /** Short-hand for a known ACP harness. Resolves to command/args via the preset registry. */
14
+ preset?: PresetName
15
+ /** Optional model id, forwarded to the preset as `--model <id>` where supported. */
16
+ model?: string
17
+ /** Explicit command. Overrides whatever the preset would set. */
18
+ command?: string
19
+ /** Explicit args. Overrides whatever the preset would set. */
20
+ args?: string[]
21
+ env?: Record<string, string>
22
+ cwd?: string
23
+ /** Container image. Forwarded to the spawn runtime; ignored by host-spawn paths. */
24
+ image?: string
25
+ }
26
+
27
+ export interface PromptInput {
28
+ threadId: string
29
+ /**
30
+ * Channel/room id this thread lives in. Optional — when omitted, callers
31
+ * (transports that don't model a separate channel, e.g. HTTP) treat
32
+ * `threadId` as both. Matrix passes `evt.room_id` here so the
33
+ * transport-context provider sees the real room.
34
+ */
35
+ channelId?: string
36
+ content: ContentBlock[]
37
+ }
38
+
39
+ export interface PromptResult {
40
+ stopReason: StopReason
41
+ }
42
+
43
+ export type AgentEvent =
44
+ | AgentMessageChunkEvent
45
+ | ToolCallEvent
46
+ | ToolCallUpdateEvent
47
+ | PlanEvent
48
+
49
+ export interface AgentMessageChunkEvent {
50
+ type: 'agent_message_chunk'
51
+ sessionId: string
52
+ content: ContentBlock
53
+ }
54
+
55
+ export interface ToolCallLocation {
56
+ path: string
57
+ line?: number
58
+ }
59
+
60
+ export interface ToolCallEvent {
61
+ type: 'tool_call'
62
+ sessionId: string
63
+ toolCallId: string
64
+ title: string
65
+ kind?: ToolKind
66
+ status?: ToolCallStatus
67
+ rawInput?: unknown
68
+ locations?: ToolCallLocation[]
69
+ }
70
+
71
+ export interface ToolCallUpdateEvent {
72
+ type: 'tool_call_update'
73
+ sessionId: string
74
+ toolCallId: string
75
+ status?: ToolCallStatus
76
+ kind?: ToolKind
77
+ content?: ToolCallContent[]
78
+ rawInput?: unknown
79
+ rawOutput?: unknown
80
+ locations?: ToolCallLocation[]
81
+ }
82
+
83
+ export interface PlanEvent {
84
+ type: 'plan'
85
+ sessionId: string
86
+ entries: PlanEntry[]
87
+ }
88
+
89
+ export interface ApprovalRequest {
90
+ sessionId: string
91
+ toolCallId: string
92
+ /** ACP tool kind (e.g. "edit", "fetch", "execute"). */
93
+ toolKind?: string
94
+ /** Short human-readable title from the agent (e.g. "webfetch"). */
95
+ toolTitle?: string
96
+ /** Raw structured tool input, shape varies by kind. */
97
+ toolInput?: unknown
98
+ options: Array<{ optionId: string; name: string; kind: string }>
99
+ }
100
+
101
+ export type ApprovalDecision =
102
+ | { decision: 'allow'; optionId: string }
103
+ | { decision: 'cancel' }