@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/LICENSE +21 -0
- package/package.json +40 -0
- package/src/acp-client.cancel.test.ts +44 -0
- package/src/acp-client.context.test.ts +93 -0
- package/src/acp-client.preset.test.ts +120 -0
- package/src/acp-client.runtime.test.ts +51 -0
- package/src/acp-client.session-load.test.ts +184 -0
- package/src/acp-client.tap.test.ts +36 -0
- package/src/acp-client.ts +361 -0
- package/src/agent-process.test.ts +103 -0
- package/src/agent-process.ts +49 -0
- package/src/event-mapping.test.ts +105 -0
- package/src/event-mapping.ts +69 -0
- package/src/index.ts +25 -0
- package/src/presets.test.ts +102 -0
- package/src/presets.ts +64 -0
- package/src/session-map.test.ts +54 -0
- package/src/session-map.ts +47 -0
- package/src/session-store.test.ts +115 -0
- package/src/session-store.ts +110 -0
- package/src/turn-tracker.test.ts +70 -0
- package/src/turn-tracker.ts +96 -0
- package/src/types.ts +103 -0
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' }
|