@townco/ui 0.1.0 → 0.1.6
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/dist/core/hooks/use-chat-input.d.ts +17 -17
- package/dist/core/hooks/use-chat-input.js +64 -55
- package/dist/core/hooks/use-chat-messages.d.ts +11 -11
- package/dist/core/hooks/use-chat-messages.js +121 -114
- package/dist/core/hooks/use-chat-session.d.ts +5 -5
- package/dist/core/hooks/use-chat-session.js +78 -80
- package/dist/core/hooks/use-media-query.d.ts +5 -5
- package/dist/core/hooks/use-media-query.js +38 -38
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/schemas/chat.d.ts +83 -56
- package/dist/core/schemas/chat.js +27 -25
- package/dist/core/store/chat-store.d.ts +28 -22
- package/dist/core/store/chat-store.js +59 -50
- package/dist/gui/components/Button.d.ts +23 -7
- package/dist/gui/components/Button.js +40 -27
- package/dist/gui/components/Card.d.ts +26 -7
- package/dist/gui/components/Card.js +54 -8
- package/dist/gui/components/ChatHeader.d.ts +58 -31
- package/dist/gui/components/ChatHeader.js +171 -66
- package/dist/gui/components/ChatInput.d.ts +58 -36
- package/dist/gui/components/ChatInput.js +191 -121
- package/dist/gui/components/ChatInterface.d.ts +9 -6
- package/dist/gui/components/ChatInterface.js +162 -90
- package/dist/gui/components/ChatLayout.d.ts +71 -41
- package/dist/gui/components/ChatLayout.js +214 -87
- package/dist/gui/components/ChatPanelTabContent.d.ts +18 -9
- package/dist/gui/components/ChatPanelTabContent.js +88 -10
- package/dist/gui/components/ChatPreview.d.ts +9 -6
- package/dist/gui/components/ChatPreview.js +212 -162
- package/dist/gui/components/ChatSecondaryPanel.d.ts +14 -11
- package/dist/gui/components/ChatSecondaryPanel.js +115 -38
- package/dist/gui/components/ChatSidebar.d.ts +26 -13
- package/dist/gui/components/ChatSidebar.js +48 -14
- package/dist/gui/components/ChatStatus.d.ts +4 -2
- package/dist/gui/components/ChatStatus.js +45 -34
- package/dist/gui/components/ChatView.d.ts +5 -3
- package/dist/gui/components/ChatView.js +38 -9
- package/dist/gui/components/ConfigPanel.d.ts +16 -12
- package/dist/gui/components/ConfigPanel.js +218 -41
- package/dist/gui/components/Conversation.d.ts +17 -14
- package/dist/gui/components/Conversation.js +143 -83
- package/dist/gui/components/Dialog.d.ts +57 -11
- package/dist/gui/components/Dialog.js +84 -8
- package/dist/gui/components/DropdownMenu.d.ts +101 -20
- package/dist/gui/components/DropdownMenu.js +161 -14
- package/dist/gui/components/HeightTransition.d.ts +12 -7
- package/dist/gui/components/HeightTransition.js +88 -77
- package/dist/gui/components/Input.d.ts +13 -6
- package/dist/gui/components/Input.js +27 -16
- package/dist/gui/components/InputBox.d.ts +19 -12
- package/dist/gui/components/InputBox.js +86 -14
- package/dist/gui/components/Label.d.ts +7 -1
- package/dist/gui/components/Label.js +12 -2
- package/dist/gui/components/MarkdownRenderer.d.ts +6 -4
- package/dist/gui/components/MarkdownRenderer.js +178 -81
- package/dist/gui/components/Message.d.ts +25 -18
- package/dist/gui/components/Message.js +44 -23
- package/dist/gui/components/MessageContent.d.ts +29 -22
- package/dist/gui/components/MessageContent.js +157 -85
- package/dist/gui/components/PlaygroundLayout.d.ts +9 -5
- package/dist/gui/components/PlaygroundLayout.js +43 -12
- package/dist/gui/components/Reasoning.d.ts +30 -24
- package/dist/gui/components/Reasoning.js +187 -60
- package/dist/gui/components/Response.d.ts +11 -9
- package/dist/gui/components/Response.js +229 -90
- package/dist/gui/components/Select.d.ts +69 -10
- package/dist/gui/components/Select.js +118 -12
- package/dist/gui/components/Sonner.d.ts +3 -1
- package/dist/gui/components/Sonner.js +29 -18
- package/dist/gui/components/StatusBar.d.ts +9 -5
- package/dist/gui/components/StatusBar.js +56 -9
- package/dist/gui/components/Tabs.d.ts +24 -4
- package/dist/gui/components/Tabs.js +32 -4
- package/dist/gui/components/Task.d.ts +28 -24
- package/dist/gui/components/Task.js +164 -31
- package/dist/gui/components/Textarea.d.ts +15 -7
- package/dist/gui/components/Textarea.js +63 -46
- package/dist/gui/components/ThinkingBlock.d.ts +20 -10
- package/dist/gui/components/ThinkingBlock.js +134 -35
- package/dist/gui/components/TodoList.d.ts +12 -10
- package/dist/gui/components/TodoList.js +22 -7
- package/dist/gui/components/TodoListItem.d.ts +9 -6
- package/dist/gui/components/TodoListItem.js +18 -4
- package/dist/gui/components/index.d.ts +59 -8
- package/dist/gui/components/index.js +42 -8
- package/dist/gui/lib/utils.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.test.js +0 -1
- package/dist/sdk/client/acp-client.d.ts +88 -76
- package/dist/sdk/client/acp-client.js +215 -217
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/sdk/schemas/agent.d.ts +111 -64
- package/dist/sdk/schemas/agent.js +24 -24
- package/dist/sdk/schemas/message.d.ts +245 -147
- package/dist/sdk/schemas/message.js +40 -40
- package/dist/sdk/schemas/session.d.ts +219 -135
- package/dist/sdk/schemas/session.js +27 -27
- package/dist/sdk/transports/http.d.ts +55 -55
- package/dist/sdk/transports/http.js +472 -469
- package/dist/sdk/transports/stdio.d.ts +20 -20
- package/dist/sdk/transports/stdio.js +289 -286
- package/dist/sdk/transports/types.d.ts +42 -42
- package/dist/sdk/transports/websocket.d.ts +12 -12
- package/dist/sdk/transports/websocket.js +52 -46
- package/dist/tui/components/ChatView.d.ts +4 -2
- package/dist/tui/components/ChatView.js +51 -18
- package/dist/tui/components/GameOfLife.js +64 -35
- package/dist/tui/components/InputBox.d.ts +18 -11
- package/dist/tui/components/InputBox.js +70 -10
- package/dist/tui/components/MessageList.d.ts +4 -2
- package/dist/tui/components/MessageList.js +37 -10
- package/dist/tui/components/MultiSelect.d.ts +15 -9
- package/dist/tui/components/MultiSelect.js +116 -69
- package/dist/tui/components/ReadlineInput.d.ts +12 -6
- package/dist/tui/components/ReadlineInput.js +252 -237
- package/dist/tui/components/SingleSelect.d.ts +15 -9
- package/dist/tui/components/SingleSelect.js +84 -43
- package/dist/tui/components/StatusBar.d.ts +11 -6
- package/dist/tui/components/StatusBar.js +102 -67
- package/dist/tui/index.d.ts +1 -1
- package/dist/tui/index.js +1 -1
- package/package.json +2 -3
|
@@ -3,156 +3,240 @@ import { z } from "zod";
|
|
|
3
3
|
* Session status
|
|
4
4
|
*/
|
|
5
5
|
export declare const SessionStatus: z.ZodEnum<{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
error: "error";
|
|
7
|
+
disconnected: "disconnected";
|
|
8
|
+
connecting: "connecting";
|
|
9
|
+
connected: "connected";
|
|
10
|
+
idle: "idle";
|
|
11
|
+
active: "active";
|
|
12
|
+
streaming: "streaming";
|
|
13
13
|
}>;
|
|
14
14
|
export type SessionStatus = z.infer<typeof SessionStatus>;
|
|
15
15
|
/**
|
|
16
16
|
* Session configuration
|
|
17
17
|
*/
|
|
18
|
-
export declare const SessionConfig: z.ZodObject<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
export declare const SessionConfig: z.ZodObject<
|
|
19
|
+
{
|
|
20
|
+
agentPath: z.ZodString;
|
|
21
|
+
agentArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
|
+
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
23
|
+
workingDirectory: z.ZodOptional<z.ZodString>;
|
|
24
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
},
|
|
26
|
+
z.core.$strip
|
|
27
|
+
>;
|
|
25
28
|
export type SessionConfig = z.infer<typeof SessionConfig>;
|
|
26
29
|
/**
|
|
27
30
|
* Session metadata
|
|
28
31
|
*/
|
|
29
|
-
export declare const SessionMetadata: z.ZodObject<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
export declare const SessionMetadata: z.ZodObject<
|
|
33
|
+
{
|
|
34
|
+
agentName: z.ZodOptional<z.ZodString>;
|
|
35
|
+
agentVersion: z.ZodOptional<z.ZodString>;
|
|
36
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
+
startedAt: z.ZodISODateTime;
|
|
38
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
39
|
+
},
|
|
40
|
+
z.core.$strip
|
|
41
|
+
>;
|
|
36
42
|
export type SessionMetadata = z.infer<typeof SessionMetadata>;
|
|
37
43
|
/**
|
|
38
44
|
* Session schema
|
|
39
45
|
*/
|
|
40
|
-
export declare const Session: z.ZodObject<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
46
|
+
export declare const Session: z.ZodObject<
|
|
47
|
+
{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
status: z.ZodEnum<{
|
|
50
|
+
error: "error";
|
|
51
|
+
disconnected: "disconnected";
|
|
52
|
+
connecting: "connecting";
|
|
53
|
+
connected: "connected";
|
|
54
|
+
idle: "idle";
|
|
55
|
+
active: "active";
|
|
56
|
+
streaming: "streaming";
|
|
57
|
+
}>;
|
|
58
|
+
config: z.ZodObject<
|
|
59
|
+
{
|
|
60
|
+
agentPath: z.ZodString;
|
|
61
|
+
agentArgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
62
|
+
environment: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
63
|
+
workingDirectory: z.ZodOptional<z.ZodString>;
|
|
64
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
},
|
|
66
|
+
z.core.$strip
|
|
67
|
+
>;
|
|
68
|
+
metadata: z.ZodOptional<
|
|
69
|
+
z.ZodObject<
|
|
70
|
+
{
|
|
71
|
+
agentName: z.ZodOptional<z.ZodString>;
|
|
72
|
+
agentVersion: z.ZodOptional<z.ZodString>;
|
|
73
|
+
capabilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
74
|
+
startedAt: z.ZodISODateTime;
|
|
75
|
+
lastActivityAt: z.ZodOptional<z.ZodISODateTime>;
|
|
76
|
+
},
|
|
77
|
+
z.core.$strip
|
|
78
|
+
>
|
|
79
|
+
>;
|
|
80
|
+
messages: z.ZodArray<
|
|
81
|
+
z.ZodObject<
|
|
82
|
+
{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
role: z.ZodEnum<{
|
|
85
|
+
user: "user";
|
|
86
|
+
assistant: "assistant";
|
|
87
|
+
system: "system";
|
|
88
|
+
tool: "tool";
|
|
89
|
+
}>;
|
|
90
|
+
content: z.ZodArray<
|
|
91
|
+
z.ZodDiscriminatedUnion<
|
|
92
|
+
[
|
|
93
|
+
z.ZodObject<
|
|
94
|
+
{
|
|
95
|
+
type: z.ZodLiteral<"text">;
|
|
96
|
+
text: z.ZodString;
|
|
97
|
+
},
|
|
98
|
+
z.core.$strip
|
|
99
|
+
>,
|
|
100
|
+
z.ZodObject<
|
|
101
|
+
{
|
|
102
|
+
type: z.ZodLiteral<"image">;
|
|
103
|
+
url: z.ZodOptional<z.ZodString>;
|
|
104
|
+
data: z.ZodOptional<z.ZodString>;
|
|
105
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
106
|
+
},
|
|
107
|
+
z.core.$strip
|
|
108
|
+
>,
|
|
109
|
+
z.ZodObject<
|
|
110
|
+
{
|
|
111
|
+
type: z.ZodLiteral<"file">;
|
|
112
|
+
name: z.ZodString;
|
|
113
|
+
path: z.ZodOptional<z.ZodString>;
|
|
114
|
+
url: z.ZodOptional<z.ZodString>;
|
|
115
|
+
mimeType: z.ZodString;
|
|
116
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
},
|
|
118
|
+
z.core.$strip
|
|
119
|
+
>,
|
|
120
|
+
z.ZodObject<
|
|
121
|
+
{
|
|
122
|
+
type: z.ZodLiteral<"tool_call">;
|
|
123
|
+
id: z.ZodString;
|
|
124
|
+
name: z.ZodString;
|
|
125
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
126
|
+
},
|
|
127
|
+
z.core.$strip
|
|
128
|
+
>,
|
|
129
|
+
z.ZodObject<
|
|
130
|
+
{
|
|
131
|
+
type: z.ZodLiteral<"tool_result">;
|
|
132
|
+
callId: z.ZodString;
|
|
133
|
+
result: z.ZodUnknown;
|
|
134
|
+
error: z.ZodOptional<z.ZodString>;
|
|
135
|
+
},
|
|
136
|
+
z.core.$strip
|
|
137
|
+
>,
|
|
138
|
+
],
|
|
139
|
+
"type"
|
|
140
|
+
>
|
|
141
|
+
>;
|
|
142
|
+
timestamp: z.ZodISODateTime;
|
|
143
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
144
|
+
},
|
|
145
|
+
z.core.$strip
|
|
146
|
+
>
|
|
147
|
+
>;
|
|
148
|
+
error: z.ZodOptional<z.ZodString>;
|
|
149
|
+
},
|
|
150
|
+
z.core.$strip
|
|
151
|
+
>;
|
|
104
152
|
export type Session = z.infer<typeof Session>;
|
|
105
153
|
/**
|
|
106
154
|
* Session update event
|
|
107
155
|
*/
|
|
108
|
-
export declare const SessionUpdate: z.ZodObject<
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
export declare const SessionUpdate: z.ZodObject<
|
|
157
|
+
{
|
|
158
|
+
sessionId: z.ZodString;
|
|
159
|
+
status: z.ZodOptional<
|
|
160
|
+
z.ZodEnum<{
|
|
161
|
+
error: "error";
|
|
162
|
+
disconnected: "disconnected";
|
|
163
|
+
connecting: "connecting";
|
|
164
|
+
connected: "connected";
|
|
165
|
+
idle: "idle";
|
|
166
|
+
active: "active";
|
|
167
|
+
streaming: "streaming";
|
|
168
|
+
}>
|
|
169
|
+
>;
|
|
170
|
+
message: z.ZodOptional<
|
|
171
|
+
z.ZodObject<
|
|
172
|
+
{
|
|
173
|
+
id: z.ZodString;
|
|
174
|
+
role: z.ZodEnum<{
|
|
175
|
+
user: "user";
|
|
176
|
+
assistant: "assistant";
|
|
177
|
+
system: "system";
|
|
178
|
+
tool: "tool";
|
|
179
|
+
}>;
|
|
180
|
+
content: z.ZodArray<
|
|
181
|
+
z.ZodDiscriminatedUnion<
|
|
182
|
+
[
|
|
183
|
+
z.ZodObject<
|
|
184
|
+
{
|
|
185
|
+
type: z.ZodLiteral<"text">;
|
|
186
|
+
text: z.ZodString;
|
|
187
|
+
},
|
|
188
|
+
z.core.$strip
|
|
189
|
+
>,
|
|
190
|
+
z.ZodObject<
|
|
191
|
+
{
|
|
192
|
+
type: z.ZodLiteral<"image">;
|
|
193
|
+
url: z.ZodOptional<z.ZodString>;
|
|
194
|
+
data: z.ZodOptional<z.ZodString>;
|
|
195
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
196
|
+
},
|
|
197
|
+
z.core.$strip
|
|
198
|
+
>,
|
|
199
|
+
z.ZodObject<
|
|
200
|
+
{
|
|
201
|
+
type: z.ZodLiteral<"file">;
|
|
202
|
+
name: z.ZodString;
|
|
203
|
+
path: z.ZodOptional<z.ZodString>;
|
|
204
|
+
url: z.ZodOptional<z.ZodString>;
|
|
205
|
+
mimeType: z.ZodString;
|
|
206
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
207
|
+
},
|
|
208
|
+
z.core.$strip
|
|
209
|
+
>,
|
|
210
|
+
z.ZodObject<
|
|
211
|
+
{
|
|
212
|
+
type: z.ZodLiteral<"tool_call">;
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
name: z.ZodString;
|
|
215
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
216
|
+
},
|
|
217
|
+
z.core.$strip
|
|
218
|
+
>,
|
|
219
|
+
z.ZodObject<
|
|
220
|
+
{
|
|
221
|
+
type: z.ZodLiteral<"tool_result">;
|
|
222
|
+
callId: z.ZodString;
|
|
223
|
+
result: z.ZodUnknown;
|
|
224
|
+
error: z.ZodOptional<z.ZodString>;
|
|
225
|
+
},
|
|
226
|
+
z.core.$strip
|
|
227
|
+
>,
|
|
228
|
+
],
|
|
229
|
+
"type"
|
|
230
|
+
>
|
|
231
|
+
>;
|
|
232
|
+
timestamp: z.ZodISODateTime;
|
|
233
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
234
|
+
},
|
|
235
|
+
z.core.$strip
|
|
236
|
+
>
|
|
237
|
+
>;
|
|
238
|
+
error: z.ZodOptional<z.ZodString>;
|
|
239
|
+
},
|
|
240
|
+
z.core.$strip
|
|
241
|
+
>;
|
|
158
242
|
export type SessionUpdate = z.infer<typeof SessionUpdate>;
|
|
@@ -4,51 +4,51 @@ import { Message } from "./message.js";
|
|
|
4
4
|
* Session status
|
|
5
5
|
*/
|
|
6
6
|
export const SessionStatus = z.enum([
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
"idle",
|
|
8
|
+
"connecting",
|
|
9
|
+
"connected",
|
|
10
|
+
"active",
|
|
11
|
+
"streaming",
|
|
12
|
+
"error",
|
|
13
|
+
"disconnected",
|
|
14
14
|
]);
|
|
15
15
|
/**
|
|
16
16
|
* Session configuration
|
|
17
17
|
*/
|
|
18
18
|
export const SessionConfig = z.object({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
agentPath: z.string(),
|
|
20
|
+
agentArgs: z.array(z.string()).optional(),
|
|
21
|
+
environment: z.record(z.string(), z.string()).optional(),
|
|
22
|
+
workingDirectory: z.string().optional(),
|
|
23
|
+
timeout: z.number().optional(),
|
|
24
24
|
});
|
|
25
25
|
/**
|
|
26
26
|
* Session metadata
|
|
27
27
|
*/
|
|
28
28
|
export const SessionMetadata = z.object({
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
agentName: z.string().optional(),
|
|
30
|
+
agentVersion: z.string().optional(),
|
|
31
|
+
capabilities: z.array(z.string()).optional(),
|
|
32
|
+
startedAt: z.iso.datetime(),
|
|
33
|
+
lastActivityAt: z.iso.datetime().optional(),
|
|
34
34
|
});
|
|
35
35
|
/**
|
|
36
36
|
* Session schema
|
|
37
37
|
*/
|
|
38
38
|
export const Session = z.object({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
id: z.string(),
|
|
40
|
+
status: SessionStatus,
|
|
41
|
+
config: SessionConfig,
|
|
42
|
+
metadata: SessionMetadata.optional(),
|
|
43
|
+
messages: z.array(Message),
|
|
44
|
+
error: z.string().optional(),
|
|
45
45
|
});
|
|
46
46
|
/**
|
|
47
47
|
* Session update event
|
|
48
48
|
*/
|
|
49
49
|
export const SessionUpdate = z.object({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
sessionId: z.string(),
|
|
51
|
+
status: SessionStatus.optional(),
|
|
52
|
+
message: Message.optional(),
|
|
53
|
+
error: z.string().optional(),
|
|
54
54
|
});
|
|
@@ -5,59 +5,59 @@ import type { HttpTransportOptions, Transport } from "./types.js";
|
|
|
5
5
|
* Uses POST /rpc for client->agent messages and GET /events (SSE) for agent->client
|
|
6
6
|
*/
|
|
7
7
|
export declare class HttpTransport implements Transport {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
8
|
+
private connected;
|
|
9
|
+
private sessionUpdateCallbacks;
|
|
10
|
+
private errorCallbacks;
|
|
11
|
+
private messageQueue;
|
|
12
|
+
private currentSessionId;
|
|
13
|
+
private chunkResolvers;
|
|
14
|
+
private streamComplete;
|
|
15
|
+
private sseAbortController;
|
|
16
|
+
private reconnectAttempts;
|
|
17
|
+
private maxReconnectAttempts;
|
|
18
|
+
private reconnectDelay;
|
|
19
|
+
private reconnecting;
|
|
20
|
+
private abortController;
|
|
21
|
+
private options;
|
|
22
|
+
constructor(options: HttpTransportOptions);
|
|
23
|
+
connect(): Promise<void>;
|
|
24
|
+
disconnect(): Promise<void>;
|
|
25
|
+
send(message: Message): Promise<void>;
|
|
26
|
+
receive(): AsyncIterableIterator<MessageChunk>;
|
|
27
|
+
isConnected(): boolean;
|
|
28
|
+
onSessionUpdate(callback: (update: SessionUpdate) => void): () => void;
|
|
29
|
+
onError(callback: (error: Error) => void): () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Send an ACP RPC request to the server
|
|
32
|
+
*/
|
|
33
|
+
private sendRpcRequest;
|
|
34
|
+
/**
|
|
35
|
+
* Connect to the SSE event stream
|
|
36
|
+
* Uses fetch-based SSE to support custom headers (X-Session-ID)
|
|
37
|
+
*/
|
|
38
|
+
private connectSSE;
|
|
39
|
+
/**
|
|
40
|
+
* Handle SSE disconnection with automatic reconnection
|
|
41
|
+
*/
|
|
42
|
+
private handleSSEDisconnect;
|
|
43
|
+
/**
|
|
44
|
+
* Handle an incoming SSE message
|
|
45
|
+
*/
|
|
46
|
+
private handleSSEMessage;
|
|
47
|
+
/**
|
|
48
|
+
* Handle a session notification from the agent
|
|
49
|
+
*/
|
|
50
|
+
private handleSessionNotification;
|
|
51
|
+
/**
|
|
52
|
+
* Generate a unique request ID
|
|
53
|
+
*/
|
|
54
|
+
private generateRequestId;
|
|
55
|
+
/**
|
|
56
|
+
* Notify all session update callbacks
|
|
57
|
+
*/
|
|
58
|
+
private notifySessionUpdate;
|
|
59
|
+
/**
|
|
60
|
+
* Notify all error callbacks
|
|
61
|
+
*/
|
|
62
|
+
private notifyError;
|
|
63
63
|
}
|