@townco/ui 0.1.51 → 0.1.53
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/index.d.ts +1 -0
- package/dist/core/hooks/index.js +1 -0
- package/dist/core/hooks/use-chat-messages.d.ts +84 -0
- package/dist/core/hooks/use-chat-session.js +20 -3
- package/dist/core/hooks/use-subagent-stream.d.ts +28 -0
- package/dist/core/hooks/use-subagent-stream.js +254 -0
- package/dist/core/hooks/use-tool-calls.d.ts +84 -0
- package/dist/core/schemas/chat.d.ts +188 -0
- package/dist/core/schemas/tool-call.d.ts +286 -0
- package/dist/core/schemas/tool-call.js +53 -0
- package/dist/gui/components/ChatView.js +8 -2
- package/dist/gui/components/SubAgentDetails.d.ts +27 -0
- package/dist/gui/components/SubAgentDetails.js +121 -0
- package/dist/gui/components/ToolCall.js +39 -7
- package/dist/gui/components/index.d.ts +1 -0
- package/dist/gui/components/index.js +1 -0
- package/dist/sdk/client/acp-client.d.ts +4 -0
- package/dist/sdk/client/acp-client.js +1 -0
- package/dist/sdk/schemas/session.d.ts +96 -0
- package/dist/sdk/transports/http.d.ts +3 -0
- package/dist/sdk/transports/http.js +39 -0
- package/dist/sdk/transports/stdio.d.ts +3 -0
- package/dist/sdk/transports/types.d.ts +9 -0
- package/package.json +3 -3
|
@@ -102,6 +102,100 @@ export declare const DisplayMessage: z.ZodObject<{
|
|
|
102
102
|
originalTokens: z.ZodOptional<z.ZodNumber>;
|
|
103
103
|
finalTokens: z.ZodOptional<z.ZodNumber>;
|
|
104
104
|
}, z.core.$strip>>;
|
|
105
|
+
subagentPort: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
subagentSessionId: z.ZodOptional<z.ZodString>;
|
|
107
|
+
subagentMessages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
content: z.ZodString;
|
|
110
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
111
|
+
id: z.ZodString;
|
|
112
|
+
title: z.ZodString;
|
|
113
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
114
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
115
|
+
status: z.ZodEnum<{
|
|
116
|
+
pending: "pending";
|
|
117
|
+
in_progress: "in_progress";
|
|
118
|
+
completed: "completed";
|
|
119
|
+
failed: "failed";
|
|
120
|
+
}>;
|
|
121
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
122
|
+
type: z.ZodLiteral<"content">;
|
|
123
|
+
content: z.ZodObject<{
|
|
124
|
+
type: z.ZodLiteral<"text">;
|
|
125
|
+
text: z.ZodString;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
128
|
+
type: z.ZodLiteral<"text">;
|
|
129
|
+
text: z.ZodString;
|
|
130
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
131
|
+
type: z.ZodLiteral<"image">;
|
|
132
|
+
data: z.ZodString;
|
|
133
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
134
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
135
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
136
|
+
type: z.ZodLiteral<"image">;
|
|
137
|
+
url: z.ZodString;
|
|
138
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
139
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"diff">;
|
|
141
|
+
path: z.ZodString;
|
|
142
|
+
oldText: z.ZodString;
|
|
143
|
+
newText: z.ZodString;
|
|
144
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
145
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
146
|
+
type: z.ZodLiteral<"terminal">;
|
|
147
|
+
terminalId: z.ZodString;
|
|
148
|
+
}, z.core.$strip>], "type">>>;
|
|
149
|
+
}, z.core.$strip>>>;
|
|
150
|
+
contentBlocks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
151
|
+
type: z.ZodLiteral<"text">;
|
|
152
|
+
text: z.ZodString;
|
|
153
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
154
|
+
type: z.ZodLiteral<"tool_call">;
|
|
155
|
+
toolCall: z.ZodObject<{
|
|
156
|
+
id: z.ZodString;
|
|
157
|
+
title: z.ZodString;
|
|
158
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
159
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
160
|
+
status: z.ZodEnum<{
|
|
161
|
+
pending: "pending";
|
|
162
|
+
in_progress: "in_progress";
|
|
163
|
+
completed: "completed";
|
|
164
|
+
failed: "failed";
|
|
165
|
+
}>;
|
|
166
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
167
|
+
type: z.ZodLiteral<"content">;
|
|
168
|
+
content: z.ZodObject<{
|
|
169
|
+
type: z.ZodLiteral<"text">;
|
|
170
|
+
text: z.ZodString;
|
|
171
|
+
}, z.core.$strip>;
|
|
172
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
173
|
+
type: z.ZodLiteral<"text">;
|
|
174
|
+
text: z.ZodString;
|
|
175
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
176
|
+
type: z.ZodLiteral<"image">;
|
|
177
|
+
data: z.ZodString;
|
|
178
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
179
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
180
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
181
|
+
type: z.ZodLiteral<"image">;
|
|
182
|
+
url: z.ZodString;
|
|
183
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
184
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
185
|
+
type: z.ZodLiteral<"diff">;
|
|
186
|
+
path: z.ZodString;
|
|
187
|
+
oldText: z.ZodString;
|
|
188
|
+
newText: z.ZodString;
|
|
189
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
190
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
191
|
+
type: z.ZodLiteral<"terminal">;
|
|
192
|
+
terminalId: z.ZodString;
|
|
193
|
+
}, z.core.$strip>], "type">>>;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
}, z.core.$strip>], "type">>>;
|
|
196
|
+
isStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
197
|
+
}, z.core.$strip>>>;
|
|
198
|
+
subagentStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
105
199
|
}, z.core.$strip>>>;
|
|
106
200
|
tokenUsage: z.ZodOptional<z.ZodObject<{
|
|
107
201
|
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -225,6 +319,100 @@ export declare const ChatSessionState: z.ZodObject<{
|
|
|
225
319
|
originalTokens: z.ZodOptional<z.ZodNumber>;
|
|
226
320
|
finalTokens: z.ZodOptional<z.ZodNumber>;
|
|
227
321
|
}, z.core.$strip>>;
|
|
322
|
+
subagentPort: z.ZodOptional<z.ZodNumber>;
|
|
323
|
+
subagentSessionId: z.ZodOptional<z.ZodString>;
|
|
324
|
+
subagentMessages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
325
|
+
id: z.ZodString;
|
|
326
|
+
content: z.ZodString;
|
|
327
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
328
|
+
id: z.ZodString;
|
|
329
|
+
title: z.ZodString;
|
|
330
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
331
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
332
|
+
status: z.ZodEnum<{
|
|
333
|
+
pending: "pending";
|
|
334
|
+
in_progress: "in_progress";
|
|
335
|
+
completed: "completed";
|
|
336
|
+
failed: "failed";
|
|
337
|
+
}>;
|
|
338
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
339
|
+
type: z.ZodLiteral<"content">;
|
|
340
|
+
content: z.ZodObject<{
|
|
341
|
+
type: z.ZodLiteral<"text">;
|
|
342
|
+
text: z.ZodString;
|
|
343
|
+
}, z.core.$strip>;
|
|
344
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
345
|
+
type: z.ZodLiteral<"text">;
|
|
346
|
+
text: z.ZodString;
|
|
347
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
348
|
+
type: z.ZodLiteral<"image">;
|
|
349
|
+
data: z.ZodString;
|
|
350
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
351
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
352
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
353
|
+
type: z.ZodLiteral<"image">;
|
|
354
|
+
url: z.ZodString;
|
|
355
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
356
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
357
|
+
type: z.ZodLiteral<"diff">;
|
|
358
|
+
path: z.ZodString;
|
|
359
|
+
oldText: z.ZodString;
|
|
360
|
+
newText: z.ZodString;
|
|
361
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
362
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
363
|
+
type: z.ZodLiteral<"terminal">;
|
|
364
|
+
terminalId: z.ZodString;
|
|
365
|
+
}, z.core.$strip>], "type">>>;
|
|
366
|
+
}, z.core.$strip>>>;
|
|
367
|
+
contentBlocks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
368
|
+
type: z.ZodLiteral<"text">;
|
|
369
|
+
text: z.ZodString;
|
|
370
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
371
|
+
type: z.ZodLiteral<"tool_call">;
|
|
372
|
+
toolCall: z.ZodObject<{
|
|
373
|
+
id: z.ZodString;
|
|
374
|
+
title: z.ZodString;
|
|
375
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
376
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
377
|
+
status: z.ZodEnum<{
|
|
378
|
+
pending: "pending";
|
|
379
|
+
in_progress: "in_progress";
|
|
380
|
+
completed: "completed";
|
|
381
|
+
failed: "failed";
|
|
382
|
+
}>;
|
|
383
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
384
|
+
type: z.ZodLiteral<"content">;
|
|
385
|
+
content: z.ZodObject<{
|
|
386
|
+
type: z.ZodLiteral<"text">;
|
|
387
|
+
text: z.ZodString;
|
|
388
|
+
}, z.core.$strip>;
|
|
389
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
390
|
+
type: z.ZodLiteral<"text">;
|
|
391
|
+
text: z.ZodString;
|
|
392
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
393
|
+
type: z.ZodLiteral<"image">;
|
|
394
|
+
data: z.ZodString;
|
|
395
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
396
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
397
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
398
|
+
type: z.ZodLiteral<"image">;
|
|
399
|
+
url: z.ZodString;
|
|
400
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
401
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
402
|
+
type: z.ZodLiteral<"diff">;
|
|
403
|
+
path: z.ZodString;
|
|
404
|
+
oldText: z.ZodString;
|
|
405
|
+
newText: z.ZodString;
|
|
406
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
407
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
408
|
+
type: z.ZodLiteral<"terminal">;
|
|
409
|
+
terminalId: z.ZodString;
|
|
410
|
+
}, z.core.$strip>], "type">>>;
|
|
411
|
+
}, z.core.$strip>;
|
|
412
|
+
}, z.core.$strip>], "type">>>;
|
|
413
|
+
isStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
414
|
+
}, z.core.$strip>>>;
|
|
415
|
+
subagentStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
228
416
|
}, z.core.$strip>>>;
|
|
229
417
|
tokenUsage: z.ZodOptional<z.ZodObject<{
|
|
230
418
|
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -74,6 +74,196 @@ export declare const ToolCallContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodO
|
|
|
74
74
|
terminalId: z.ZodString;
|
|
75
75
|
}, z.core.$strip>], "type">;
|
|
76
76
|
export type ToolCallContentBlock = z.infer<typeof ToolCallContentBlockSchema>;
|
|
77
|
+
/**
|
|
78
|
+
* Simplified tool call schema for sub-agent streamed tool calls.
|
|
79
|
+
* Sub-agents cannot spawn their own sub-agents, so no recursive toolCalls.
|
|
80
|
+
*/
|
|
81
|
+
export declare const SubagentToolCallSchema: z.ZodObject<{
|
|
82
|
+
id: z.ZodString;
|
|
83
|
+
title: z.ZodString;
|
|
84
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
85
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
86
|
+
status: z.ZodEnum<{
|
|
87
|
+
pending: "pending";
|
|
88
|
+
in_progress: "in_progress";
|
|
89
|
+
completed: "completed";
|
|
90
|
+
failed: "failed";
|
|
91
|
+
}>;
|
|
92
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
93
|
+
type: z.ZodLiteral<"content">;
|
|
94
|
+
content: z.ZodObject<{
|
|
95
|
+
type: z.ZodLiteral<"text">;
|
|
96
|
+
text: z.ZodString;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
99
|
+
type: z.ZodLiteral<"text">;
|
|
100
|
+
text: z.ZodString;
|
|
101
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
102
|
+
type: z.ZodLiteral<"image">;
|
|
103
|
+
data: z.ZodString;
|
|
104
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
105
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
106
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
107
|
+
type: z.ZodLiteral<"image">;
|
|
108
|
+
url: z.ZodString;
|
|
109
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
110
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
111
|
+
type: z.ZodLiteral<"diff">;
|
|
112
|
+
path: z.ZodString;
|
|
113
|
+
oldText: z.ZodString;
|
|
114
|
+
newText: z.ZodString;
|
|
115
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
116
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
117
|
+
type: z.ZodLiteral<"terminal">;
|
|
118
|
+
terminalId: z.ZodString;
|
|
119
|
+
}, z.core.$strip>], "type">>>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
export type SubagentToolCall = z.infer<typeof SubagentToolCallSchema>;
|
|
122
|
+
/**
|
|
123
|
+
* Content block for sub-agent streaming - either text or a tool call (interleaved)
|
|
124
|
+
*/
|
|
125
|
+
export declare const SubagentContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
126
|
+
type: z.ZodLiteral<"text">;
|
|
127
|
+
text: z.ZodString;
|
|
128
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
129
|
+
type: z.ZodLiteral<"tool_call">;
|
|
130
|
+
toolCall: z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
title: z.ZodString;
|
|
133
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
134
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
135
|
+
status: z.ZodEnum<{
|
|
136
|
+
pending: "pending";
|
|
137
|
+
in_progress: "in_progress";
|
|
138
|
+
completed: "completed";
|
|
139
|
+
failed: "failed";
|
|
140
|
+
}>;
|
|
141
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<"content">;
|
|
143
|
+
content: z.ZodObject<{
|
|
144
|
+
type: z.ZodLiteral<"text">;
|
|
145
|
+
text: z.ZodString;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
148
|
+
type: z.ZodLiteral<"text">;
|
|
149
|
+
text: z.ZodString;
|
|
150
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
151
|
+
type: z.ZodLiteral<"image">;
|
|
152
|
+
data: z.ZodString;
|
|
153
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
154
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
155
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
156
|
+
type: z.ZodLiteral<"image">;
|
|
157
|
+
url: z.ZodString;
|
|
158
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
159
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
160
|
+
type: z.ZodLiteral<"diff">;
|
|
161
|
+
path: z.ZodString;
|
|
162
|
+
oldText: z.ZodString;
|
|
163
|
+
newText: z.ZodString;
|
|
164
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
165
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
166
|
+
type: z.ZodLiteral<"terminal">;
|
|
167
|
+
terminalId: z.ZodString;
|
|
168
|
+
}, z.core.$strip>], "type">>>;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
}, z.core.$strip>], "type">;
|
|
171
|
+
export type SubagentContentBlock = z.infer<typeof SubagentContentBlockSchema>;
|
|
172
|
+
/**
|
|
173
|
+
* Schema for sub-agent streamed messages displayed within a tool call.
|
|
174
|
+
*/
|
|
175
|
+
export declare const SubagentMessageSchema: z.ZodObject<{
|
|
176
|
+
id: z.ZodString;
|
|
177
|
+
content: z.ZodString;
|
|
178
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
179
|
+
id: z.ZodString;
|
|
180
|
+
title: z.ZodString;
|
|
181
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
182
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
183
|
+
status: z.ZodEnum<{
|
|
184
|
+
pending: "pending";
|
|
185
|
+
in_progress: "in_progress";
|
|
186
|
+
completed: "completed";
|
|
187
|
+
failed: "failed";
|
|
188
|
+
}>;
|
|
189
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
190
|
+
type: z.ZodLiteral<"content">;
|
|
191
|
+
content: z.ZodObject<{
|
|
192
|
+
type: z.ZodLiteral<"text">;
|
|
193
|
+
text: z.ZodString;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
196
|
+
type: z.ZodLiteral<"text">;
|
|
197
|
+
text: z.ZodString;
|
|
198
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
199
|
+
type: z.ZodLiteral<"image">;
|
|
200
|
+
data: z.ZodString;
|
|
201
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
202
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
204
|
+
type: z.ZodLiteral<"image">;
|
|
205
|
+
url: z.ZodString;
|
|
206
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
207
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
208
|
+
type: z.ZodLiteral<"diff">;
|
|
209
|
+
path: z.ZodString;
|
|
210
|
+
oldText: z.ZodString;
|
|
211
|
+
newText: z.ZodString;
|
|
212
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
213
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
214
|
+
type: z.ZodLiteral<"terminal">;
|
|
215
|
+
terminalId: z.ZodString;
|
|
216
|
+
}, z.core.$strip>], "type">>>;
|
|
217
|
+
}, z.core.$strip>>>;
|
|
218
|
+
contentBlocks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
219
|
+
type: z.ZodLiteral<"text">;
|
|
220
|
+
text: z.ZodString;
|
|
221
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
222
|
+
type: z.ZodLiteral<"tool_call">;
|
|
223
|
+
toolCall: z.ZodObject<{
|
|
224
|
+
id: z.ZodString;
|
|
225
|
+
title: z.ZodString;
|
|
226
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
227
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
228
|
+
status: z.ZodEnum<{
|
|
229
|
+
pending: "pending";
|
|
230
|
+
in_progress: "in_progress";
|
|
231
|
+
completed: "completed";
|
|
232
|
+
failed: "failed";
|
|
233
|
+
}>;
|
|
234
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
235
|
+
type: z.ZodLiteral<"content">;
|
|
236
|
+
content: z.ZodObject<{
|
|
237
|
+
type: z.ZodLiteral<"text">;
|
|
238
|
+
text: z.ZodString;
|
|
239
|
+
}, z.core.$strip>;
|
|
240
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
241
|
+
type: z.ZodLiteral<"text">;
|
|
242
|
+
text: z.ZodString;
|
|
243
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
244
|
+
type: z.ZodLiteral<"image">;
|
|
245
|
+
data: z.ZodString;
|
|
246
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
247
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
248
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
249
|
+
type: z.ZodLiteral<"image">;
|
|
250
|
+
url: z.ZodString;
|
|
251
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
252
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
253
|
+
type: z.ZodLiteral<"diff">;
|
|
254
|
+
path: z.ZodString;
|
|
255
|
+
oldText: z.ZodString;
|
|
256
|
+
newText: z.ZodString;
|
|
257
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
258
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
259
|
+
type: z.ZodLiteral<"terminal">;
|
|
260
|
+
terminalId: z.ZodString;
|
|
261
|
+
}, z.core.$strip>], "type">>>;
|
|
262
|
+
}, z.core.$strip>;
|
|
263
|
+
}, z.core.$strip>], "type">>>;
|
|
264
|
+
isStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
265
|
+
}, z.core.$strip>;
|
|
266
|
+
export type SubagentMessage = z.infer<typeof SubagentMessageSchema>;
|
|
77
267
|
/**
|
|
78
268
|
* Complete tool call state as displayed in the UI
|
|
79
269
|
*/
|
|
@@ -154,6 +344,100 @@ export declare const ToolCallSchema: z.ZodObject<{
|
|
|
154
344
|
originalTokens: z.ZodOptional<z.ZodNumber>;
|
|
155
345
|
finalTokens: z.ZodOptional<z.ZodNumber>;
|
|
156
346
|
}, z.core.$strip>>;
|
|
347
|
+
subagentPort: z.ZodOptional<z.ZodNumber>;
|
|
348
|
+
subagentSessionId: z.ZodOptional<z.ZodString>;
|
|
349
|
+
subagentMessages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
350
|
+
id: z.ZodString;
|
|
351
|
+
content: z.ZodString;
|
|
352
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
353
|
+
id: z.ZodString;
|
|
354
|
+
title: z.ZodString;
|
|
355
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
356
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
357
|
+
status: z.ZodEnum<{
|
|
358
|
+
pending: "pending";
|
|
359
|
+
in_progress: "in_progress";
|
|
360
|
+
completed: "completed";
|
|
361
|
+
failed: "failed";
|
|
362
|
+
}>;
|
|
363
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
364
|
+
type: z.ZodLiteral<"content">;
|
|
365
|
+
content: z.ZodObject<{
|
|
366
|
+
type: z.ZodLiteral<"text">;
|
|
367
|
+
text: z.ZodString;
|
|
368
|
+
}, z.core.$strip>;
|
|
369
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
370
|
+
type: z.ZodLiteral<"text">;
|
|
371
|
+
text: z.ZodString;
|
|
372
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
373
|
+
type: z.ZodLiteral<"image">;
|
|
374
|
+
data: z.ZodString;
|
|
375
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
376
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
377
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
378
|
+
type: z.ZodLiteral<"image">;
|
|
379
|
+
url: z.ZodString;
|
|
380
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
381
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
382
|
+
type: z.ZodLiteral<"diff">;
|
|
383
|
+
path: z.ZodString;
|
|
384
|
+
oldText: z.ZodString;
|
|
385
|
+
newText: z.ZodString;
|
|
386
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
387
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
388
|
+
type: z.ZodLiteral<"terminal">;
|
|
389
|
+
terminalId: z.ZodString;
|
|
390
|
+
}, z.core.$strip>], "type">>>;
|
|
391
|
+
}, z.core.$strip>>>;
|
|
392
|
+
contentBlocks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
393
|
+
type: z.ZodLiteral<"text">;
|
|
394
|
+
text: z.ZodString;
|
|
395
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
396
|
+
type: z.ZodLiteral<"tool_call">;
|
|
397
|
+
toolCall: z.ZodObject<{
|
|
398
|
+
id: z.ZodString;
|
|
399
|
+
title: z.ZodString;
|
|
400
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
401
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
402
|
+
status: z.ZodEnum<{
|
|
403
|
+
pending: "pending";
|
|
404
|
+
in_progress: "in_progress";
|
|
405
|
+
completed: "completed";
|
|
406
|
+
failed: "failed";
|
|
407
|
+
}>;
|
|
408
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
409
|
+
type: z.ZodLiteral<"content">;
|
|
410
|
+
content: z.ZodObject<{
|
|
411
|
+
type: z.ZodLiteral<"text">;
|
|
412
|
+
text: z.ZodString;
|
|
413
|
+
}, z.core.$strip>;
|
|
414
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
415
|
+
type: z.ZodLiteral<"text">;
|
|
416
|
+
text: z.ZodString;
|
|
417
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
418
|
+
type: z.ZodLiteral<"image">;
|
|
419
|
+
data: z.ZodString;
|
|
420
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
421
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
422
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
423
|
+
type: z.ZodLiteral<"image">;
|
|
424
|
+
url: z.ZodString;
|
|
425
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
426
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
427
|
+
type: z.ZodLiteral<"diff">;
|
|
428
|
+
path: z.ZodString;
|
|
429
|
+
oldText: z.ZodString;
|
|
430
|
+
newText: z.ZodString;
|
|
431
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
432
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
433
|
+
type: z.ZodLiteral<"terminal">;
|
|
434
|
+
terminalId: z.ZodString;
|
|
435
|
+
}, z.core.$strip>], "type">>>;
|
|
436
|
+
}, z.core.$strip>;
|
|
437
|
+
}, z.core.$strip>], "type">>>;
|
|
438
|
+
isStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
439
|
+
}, z.core.$strip>>>;
|
|
440
|
+
subagentStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
157
441
|
}, z.core.$strip>;
|
|
158
442
|
export type ToolCall = z.infer<typeof ToolCallSchema>;
|
|
159
443
|
/**
|
|
@@ -212,6 +496,8 @@ export declare const ToolCallUpdateSchema: z.ZodObject<{
|
|
|
212
496
|
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
213
497
|
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
214
498
|
}, z.core.$strip>>;
|
|
499
|
+
subagentPort: z.ZodOptional<z.ZodNumber>;
|
|
500
|
+
subagentSessionId: z.ZodOptional<z.ZodString>;
|
|
215
501
|
}, z.core.$strip>;
|
|
216
502
|
export type ToolCallUpdate = z.infer<typeof ToolCallUpdateSchema>;
|
|
217
503
|
/**
|
|
@@ -80,6 +80,44 @@ export const ToolCallContentBlockSchema = z.discriminatedUnion("type", [
|
|
|
80
80
|
terminalId: z.string(),
|
|
81
81
|
}),
|
|
82
82
|
]);
|
|
83
|
+
/**
|
|
84
|
+
* Simplified tool call schema for sub-agent streamed tool calls.
|
|
85
|
+
* Sub-agents cannot spawn their own sub-agents, so no recursive toolCalls.
|
|
86
|
+
*/
|
|
87
|
+
export const SubagentToolCallSchema = z.object({
|
|
88
|
+
id: z.string(),
|
|
89
|
+
title: z.string(),
|
|
90
|
+
prettyName: z.string().optional(),
|
|
91
|
+
icon: z.string().optional(),
|
|
92
|
+
status: ToolCallStatusSchema,
|
|
93
|
+
content: z.array(ToolCallContentBlockSchema).optional(),
|
|
94
|
+
});
|
|
95
|
+
/**
|
|
96
|
+
* Content block for sub-agent streaming - either text or a tool call (interleaved)
|
|
97
|
+
*/
|
|
98
|
+
export const SubagentContentBlockSchema = z.discriminatedUnion("type", [
|
|
99
|
+
z.object({
|
|
100
|
+
type: z.literal("text"),
|
|
101
|
+
text: z.string(),
|
|
102
|
+
}),
|
|
103
|
+
z.object({
|
|
104
|
+
type: z.literal("tool_call"),
|
|
105
|
+
toolCall: SubagentToolCallSchema,
|
|
106
|
+
}),
|
|
107
|
+
]);
|
|
108
|
+
/**
|
|
109
|
+
* Schema for sub-agent streamed messages displayed within a tool call.
|
|
110
|
+
*/
|
|
111
|
+
export const SubagentMessageSchema = z.object({
|
|
112
|
+
id: z.string(),
|
|
113
|
+
/** Legacy: accumulated text content */
|
|
114
|
+
content: z.string(),
|
|
115
|
+
/** Legacy: tool calls list */
|
|
116
|
+
toolCalls: z.array(SubagentToolCallSchema).optional(),
|
|
117
|
+
/** Interleaved content blocks in arrival order */
|
|
118
|
+
contentBlocks: z.array(SubagentContentBlockSchema).optional(),
|
|
119
|
+
isStreaming: z.boolean().optional(),
|
|
120
|
+
});
|
|
83
121
|
/**
|
|
84
122
|
* Complete tool call state as displayed in the UI
|
|
85
123
|
*/
|
|
@@ -127,6 +165,14 @@ export const ToolCallSchema = z.object({
|
|
|
127
165
|
finalTokens: z.number().optional(),
|
|
128
166
|
})
|
|
129
167
|
.optional(),
|
|
168
|
+
/** Sub-agent HTTP port for direct SSE connection (Task tool only) */
|
|
169
|
+
subagentPort: z.number().optional(),
|
|
170
|
+
/** Sub-agent session ID for SSE connection (Task tool only) */
|
|
171
|
+
subagentSessionId: z.string().optional(),
|
|
172
|
+
/** Nested sub-agent messages streamed via direct SSE connection */
|
|
173
|
+
subagentMessages: z.array(SubagentMessageSchema).optional(),
|
|
174
|
+
/** Whether the sub-agent is currently streaming */
|
|
175
|
+
subagentStreaming: z.boolean().optional(),
|
|
130
176
|
});
|
|
131
177
|
/**
|
|
132
178
|
* Partial update for an existing tool call
|
|
@@ -145,6 +191,10 @@ export const ToolCallUpdateSchema = z.object({
|
|
|
145
191
|
error: z.string().optional(),
|
|
146
192
|
completedAt: z.number().optional(),
|
|
147
193
|
tokenUsage: TokenUsageSchema.optional(),
|
|
194
|
+
/** Sub-agent HTTP port for direct SSE connection */
|
|
195
|
+
subagentPort: z.number().optional(),
|
|
196
|
+
/** Sub-agent session ID for SSE connection */
|
|
197
|
+
subagentSessionId: z.string().optional(),
|
|
148
198
|
});
|
|
149
199
|
/**
|
|
150
200
|
* Helper to merge a tool call update into an existing tool call
|
|
@@ -167,6 +217,9 @@ export function mergeToolCallUpdate(existing, update) {
|
|
|
167
217
|
error: update.error ?? existing.error,
|
|
168
218
|
completedAt: update.completedAt ?? existing.completedAt,
|
|
169
219
|
tokenUsage: update.tokenUsage ?? existing.tokenUsage,
|
|
220
|
+
// Sub-agent connection info
|
|
221
|
+
subagentPort: update.subagentPort ?? existing.subagentPort,
|
|
222
|
+
subagentSessionId: update.subagentSessionId ?? existing.subagentSessionId,
|
|
170
223
|
};
|
|
171
224
|
return merged;
|
|
172
225
|
}
|
|
@@ -162,6 +162,7 @@ export function ChatView({ client, initialSessionId, error: initError, debuggerU
|
|
|
162
162
|
const [agentSubagents, setAgentSubagents] = useState([]);
|
|
163
163
|
const [isLargeScreen, setIsLargeScreen] = useState(typeof window !== "undefined" ? window.innerWidth >= 1024 : true);
|
|
164
164
|
const [placeholder, setPlaceholder] = useState("Type a message or / for commands...");
|
|
165
|
+
const [hideTopBar, setHideTopBar] = useState(false);
|
|
165
166
|
// Log connection status changes
|
|
166
167
|
useEffect(() => {
|
|
167
168
|
logger.debug("Connection status changed", { status: connectionStatus });
|
|
@@ -208,6 +209,9 @@ export function ChatView({ client, initialSessionId, error: initError, debuggerU
|
|
|
208
209
|
subagents: agentInfo.subagents,
|
|
209
210
|
});
|
|
210
211
|
}
|
|
212
|
+
if (agentInfo.uiConfig?.hideTopBar) {
|
|
213
|
+
setHideTopBar(true);
|
|
214
|
+
}
|
|
211
215
|
}
|
|
212
216
|
}, [client, sessionId, connectionStatus]);
|
|
213
217
|
// Monitor screen size changes and update isLargeScreen state
|
|
@@ -287,7 +291,7 @@ export function ChatView({ client, initialSessionId, error: initError, debuggerU
|
|
|
287
291
|
},
|
|
288
292
|
},
|
|
289
293
|
];
|
|
290
|
-
return (_jsxs(ChatLayout.Root, { defaultPanelSize: "hidden", defaultActiveTab: "todo", children: [_jsx(SidebarHotkey, {}), _jsxs(ChatLayout.Main, { children: [_jsx(AppChatHeader, { agentName: agentName, todos: todos, sources: sources, showHeader: messages.length > 0, sessionId: sessionId, tools: agentTools, mcps: agentMcps, subagents: agentSubagents, client: client, ...(debuggerUrl && { debuggerUrl }) }), connectionStatus === "error" && error && (_jsx("div", { className: "border-b border-destructive/20 bg-destructive/10 px-6 py-4", children: _jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { className: "flex-1", children: [_jsx("h3", { className: "mb-1 text-paragraph-sm font-semibold text-destructive", children: "Connection Error" }), _jsx("p", { className: "whitespace-pre-line text-paragraph-sm text-foreground", children: error })] }), _jsx("button", { type: "button", onClick: connect, className: "rounded-lg bg-destructive px-4 py-2 text-paragraph-sm font-medium text-destructive-foreground transition-colors hover:bg-destructive-hover", children: "Retry" })] }) })), _jsxs(ChatLayout.Body, { children: [_jsx(ChatLayout.Messages, { children: messages.length === 0 ? (_jsx(OpenFilesButton, { children: ({ openFiles, openSettings }) => (_jsx("div", { className: "flex flex-1 items-center px-4", children: _jsx(ChatEmptyState, { title: agentName, titleElement: _jsx(SessionSwitcher, { agentName: agentName, client: client, currentSessionId: sessionId }), description: agentDescription, suggestedPrompts: suggestedPrompts, onPromptClick: (prompt) => {
|
|
294
|
+
return (_jsxs(ChatLayout.Root, { defaultPanelSize: "hidden", defaultActiveTab: "todo", children: [_jsx(SidebarHotkey, {}), _jsxs(ChatLayout.Main, { children: [!hideTopBar && (_jsx(AppChatHeader, { agentName: agentName, todos: todos, sources: sources, showHeader: messages.length > 0, sessionId: sessionId, tools: agentTools, mcps: agentMcps, subagents: agentSubagents, client: client, ...(debuggerUrl && { debuggerUrl }) })), connectionStatus === "error" && error && (_jsx("div", { className: "border-b border-destructive/20 bg-destructive/10 px-6 py-4", children: _jsxs("div", { className: "flex items-start justify-between gap-4", children: [_jsxs("div", { className: "flex-1", children: [_jsx("h3", { className: "mb-1 text-paragraph-sm font-semibold text-destructive", children: "Connection Error" }), _jsx("p", { className: "whitespace-pre-line text-paragraph-sm text-foreground", children: error })] }), _jsx("button", { type: "button", onClick: connect, className: "rounded-lg bg-destructive px-4 py-2 text-paragraph-sm font-medium text-destructive-foreground transition-colors hover:bg-destructive-hover", children: "Retry" })] }) })), _jsxs(ChatLayout.Body, { children: [_jsx(ChatLayout.Messages, { children: messages.length === 0 ? (_jsx(OpenFilesButton, { children: ({ openFiles, openSettings }) => (_jsx("div", { className: "flex flex-1 items-center px-4", children: _jsx(ChatEmptyState, { title: agentName, titleElement: _jsx(SessionSwitcher, { agentName: agentName, client: client, currentSessionId: sessionId }), description: agentDescription, suggestedPrompts: suggestedPrompts, onPromptClick: (prompt) => {
|
|
291
295
|
sendMessage(prompt);
|
|
292
296
|
setPlaceholder("Type a message or / for commands...");
|
|
293
297
|
logger.info("Prompt clicked", { prompt });
|
|
@@ -299,7 +303,9 @@ export function ChatView({ client, initialSessionId, error: initError, debuggerU
|
|
|
299
303
|
const previousMessage = isFirst ? null : messages[index - 1];
|
|
300
304
|
let spacingClass = "mt-2";
|
|
301
305
|
if (isFirst) {
|
|
302
|
-
|
|
306
|
+
// First message needs more top margin if it's an assistant initial message
|
|
307
|
+
spacingClass =
|
|
308
|
+
message.role === "assistant" ? "mt-8" : "mt-2";
|
|
303
309
|
}
|
|
304
310
|
else if (message.role === "user") {
|
|
305
311
|
// User message usually starts a new turn
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface SubAgentDetailsProps {
|
|
2
|
+
/** Sub-agent HTTP port */
|
|
3
|
+
port: number;
|
|
4
|
+
/** Sub-agent session ID */
|
|
5
|
+
sessionId: string;
|
|
6
|
+
/** Optional host (defaults to localhost) */
|
|
7
|
+
host?: string;
|
|
8
|
+
/** Parent tool call status - use this to determine if sub-agent is running */
|
|
9
|
+
parentStatus?: "pending" | "in_progress" | "completed" | "failed";
|
|
10
|
+
/** Sub-agent name (for display) */
|
|
11
|
+
agentName?: string | undefined;
|
|
12
|
+
/** Query sent to the sub-agent */
|
|
13
|
+
query?: string | undefined;
|
|
14
|
+
/** Controlled expanded state (optional - if not provided, uses internal state) */
|
|
15
|
+
isExpanded?: boolean;
|
|
16
|
+
/** Callback when expand state changes */
|
|
17
|
+
onExpandChange?: (expanded: boolean) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* SubAgentDetails component - displays streaming content from a sub-agent.
|
|
21
|
+
*
|
|
22
|
+
* This component:
|
|
23
|
+
* - Connects directly to the sub-agent's SSE endpoint
|
|
24
|
+
* - Displays streaming text and tool calls
|
|
25
|
+
* - Renders in a collapsible section (collapsed by default)
|
|
26
|
+
*/
|
|
27
|
+
export declare function SubAgentDetails({ port, sessionId, host, parentStatus, agentName, query, isExpanded: controlledIsExpanded, onExpandChange, }: SubAgentDetailsProps): import("react/jsx-runtime").JSX.Element;
|