@townco/ui 0.1.50 → 0.1.52
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/ChatEmptyState.d.ts +2 -0
- package/dist/gui/components/ChatEmptyState.js +2 -2
- package/dist/gui/components/ChatLayout.d.ts +2 -0
- package/dist/gui/components/ChatLayout.js +70 -1
- package/dist/gui/components/ChatPanelTabContent.js +2 -2
- package/dist/gui/components/ChatSecondaryPanel.js +1 -1
- package/dist/gui/components/ChatView.js +85 -12
- package/dist/gui/components/PanelTabsHeader.js +1 -1
- package/dist/gui/components/SubAgentDetails.d.ts +27 -0
- package/dist/gui/components/SubAgentDetails.js +121 -0
- package/dist/gui/components/TodoList.js +12 -2
- package/dist/gui/components/ToolCall.js +41 -8
- 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 +9 -1
- package/dist/sdk/client/acp-client.js +10 -0
- package/dist/sdk/schemas/message.d.ts +2 -2
- package/dist/sdk/schemas/session.d.ts +96 -0
- package/dist/sdk/transports/http.d.ts +12 -1
- package/dist/sdk/transports/http.js +77 -1
- package/dist/sdk/transports/stdio.d.ts +3 -0
- package/dist/sdk/transports/types.d.ts +34 -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
|
}
|
|
@@ -2,6 +2,8 @@ import * as React from "react";
|
|
|
2
2
|
export interface ChatEmptyStateProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
/** Agent name/title */
|
|
4
4
|
title: string;
|
|
5
|
+
/** Optional custom title element (e.g., with dropdown) - overrides title if provided */
|
|
6
|
+
titleElement?: React.ReactNode;
|
|
5
7
|
/** Agent description */
|
|
6
8
|
description: string;
|
|
7
9
|
/** Optional guide link URL */
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { ChevronRight } from "lucide-react";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import { cn } from "../lib/utils.js";
|
|
5
|
-
export const ChatEmptyState = React.forwardRef(({ title, description, guideUrl, guideText = "Guide", suggestedPrompts = [], onPromptClick, onGuideClick, onOpenFiles, onOpenSettings, toolsAndMcpsCount, onPromptHover, onPromptLeave, className, ...props }, ref) => {
|
|
5
|
+
export const ChatEmptyState = React.forwardRef(({ title, titleElement, description, guideUrl, guideText = "Guide", suggestedPrompts = [], onPromptClick, onGuideClick, onOpenFiles, onOpenSettings, toolsAndMcpsCount, onPromptHover, onPromptLeave, className, ...props }, ref) => {
|
|
6
6
|
const handlePromptClick = (prompt) => {
|
|
7
7
|
onPromptClick?.(prompt);
|
|
8
8
|
};
|
|
@@ -17,6 +17,6 @@ export const ChatEmptyState = React.forwardRef(({ title, description, guideUrl,
|
|
|
17
17
|
for (let i = 0; i < suggestedPrompts.length; i += 2) {
|
|
18
18
|
promptRows.push(suggestedPrompts.slice(i, i + 2));
|
|
19
19
|
}
|
|
20
|
-
return (_jsxs("div", { ref: ref, className: cn("flex flex-col items-start", className), ...props, children: [_jsx("h3", { className: "text-heading-4 text-text-primary mb-6", children: title }), _jsx("p", { className: "text-subheading text-text-secondary max-w-prose mb-6", children: description }), (onOpenFiles || onOpenSettings) && (_jsxs("div", { className: "flex items-center gap-1 -ml-3 mb-6", children: [onOpenFiles && (_jsxs("button", { type: "button", onClick: onOpenFiles, className: "inline-flex items-center gap-1 py-1.5 pr-3 pl-3 rounded-lg hover:bg-accent transition-colors", children: [_jsx("span", { className: "text-paragraph-sm-medium text-foreground tracking-wide leading-none", children: "View Files" }), _jsx(ChevronRight, { className: "size-4 text-foreground shrink-0" })] })), onOpenSettings && (_jsxs("button", { type: "button", onClick: onOpenSettings, className: "inline-flex items-center gap-1 py-1.5 pr-3 pl-3 rounded-lg hover:bg-accent transition-colors", children: [_jsxs("span", { className: "text-paragraph-sm-medium text-foreground tracking-wide leading-none", children: ["View Tools & MCPs", toolsAndMcpsCount !== undefined && toolsAndMcpsCount > 0 && (_jsxs("span", { className: "ml-1", children: ["(", toolsAndMcpsCount, ")"] }))] }), _jsx(ChevronRight, { className: "size-4 text-foreground shrink-0" })] }))] })), (guideUrl || onGuideClick) && (_jsxs("button", { type: "button", onClick: handleGuideClick, className: "inline-flex items-center gap-1 py-1.5 pr-3 -ml-3 pl-3 rounded-lg hover:bg-accent transition-colors", children: [_jsx("span", { className: "text-paragraph-sm-medium text-foreground tracking-wide leading-none", children: guideText }), _jsx(ChevronRight, { className: "size-4 text-foreground shrink-0" })] })), suggestedPrompts.length > 0 && (_jsxs("div", { className: "flex flex-col gap-3 w-full max-w-prompt-container", children: [_jsx("p", { className: "text-label text-text-tertiary", children: "Suggested Prompts" }), _jsx("div", { className: "flex flex-col gap-2.5", children: promptRows.map((row) => (_jsx("div", { className: "flex gap-2.5 items-center", children: row.map((prompt) => (_jsx("button", { type: "button", onClick: () => handlePromptClick(prompt), onMouseEnter: () => onPromptHover?.(prompt), onMouseLeave: () => onPromptLeave?.(), className: "flex-1 flex items-start gap-2 p-3 bg-secondary hover:bg-secondary/80 rounded-2xl transition-colors min-w-0", children: _jsx("span", { className: "text-paragraph font-normal leading-normal text-text-tertiary truncate", children: prompt }) }, prompt))) }, row.join("-")))) })] }))] }));
|
|
20
|
+
return (_jsxs("div", { ref: ref, className: cn("flex flex-col items-start", className), ...props, children: [titleElement ? (_jsx("div", { className: "text-heading-4 text-text-primary mb-6", children: titleElement })) : (_jsx("h3", { className: "text-heading-4 text-text-primary mb-6", children: title })), _jsx("p", { className: "text-subheading text-text-secondary max-w-prose mb-6", children: description }), (onOpenFiles || onOpenSettings) && (_jsxs("div", { className: "flex items-center gap-1 -ml-3 mb-6", children: [onOpenFiles && (_jsxs("button", { type: "button", onClick: onOpenFiles, className: "inline-flex items-center gap-1 py-1.5 pr-3 pl-3 rounded-lg hover:bg-accent transition-colors", children: [_jsx("span", { className: "text-paragraph-sm-medium text-foreground tracking-wide leading-none", children: "View Files" }), _jsx(ChevronRight, { className: "size-4 text-foreground shrink-0" })] })), onOpenSettings && (_jsxs("button", { type: "button", onClick: onOpenSettings, className: "inline-flex items-center gap-1 py-1.5 pr-3 pl-3 rounded-lg hover:bg-accent transition-colors", children: [_jsxs("span", { className: "text-paragraph-sm-medium text-foreground tracking-wide leading-none", children: ["View Tools & MCPs", toolsAndMcpsCount !== undefined && toolsAndMcpsCount > 0 && (_jsxs("span", { className: "ml-1", children: ["(", toolsAndMcpsCount, ")"] }))] }), _jsx(ChevronRight, { className: "size-4 text-foreground shrink-0" })] }))] })), (guideUrl || onGuideClick) && (_jsxs("button", { type: "button", onClick: handleGuideClick, className: "inline-flex items-center gap-1 py-1.5 pr-3 -ml-3 pl-3 rounded-lg hover:bg-accent transition-colors", children: [_jsx("span", { className: "text-paragraph-sm-medium text-foreground tracking-wide leading-none", children: guideText }), _jsx(ChevronRight, { className: "size-4 text-foreground shrink-0" })] })), suggestedPrompts.length > 0 && (_jsxs("div", { className: "flex flex-col gap-3 w-full max-w-prompt-container", children: [_jsx("p", { className: "text-label text-text-tertiary", children: "Suggested Prompts" }), _jsx("div", { className: "flex flex-col gap-2.5", children: promptRows.map((row) => (_jsx("div", { className: "flex gap-2.5 items-center", children: row.map((prompt) => (_jsx("button", { type: "button", onClick: () => handlePromptClick(prompt), onMouseEnter: () => onPromptHover?.(prompt), onMouseLeave: () => onPromptLeave?.(), className: "flex-1 flex items-start gap-2 p-3 bg-secondary hover:bg-secondary/80 rounded-2xl transition-colors min-w-0", children: _jsx("span", { className: "text-paragraph font-normal leading-normal text-text-tertiary truncate", children: prompt }) }, prompt))) }, row.join("-")))) })] }))] }));
|
|
21
21
|
});
|
|
22
22
|
ChatEmptyState.displayName = "ChatEmptyState";
|
|
@@ -36,6 +36,8 @@ export interface ChatLayoutMessagesProps extends React.HTMLAttributes<HTMLDivEle
|
|
|
36
36
|
onScrollChange?: (isAtBottom: boolean) => void;
|
|
37
37
|
/** Whether to show scroll to bottom button */
|
|
38
38
|
showScrollToBottom?: boolean;
|
|
39
|
+
/** Whether to scroll to bottom on initial mount (default: true) */
|
|
40
|
+
initialScrollToBottom?: boolean;
|
|
39
41
|
}
|
|
40
42
|
declare const ChatLayoutMessages: React.ForwardRefExoticComponent<ChatLayoutMessagesProps & React.RefAttributes<HTMLDivElement>>;
|
|
41
43
|
export interface ChatLayoutFooterProps extends React.HTMLAttributes<HTMLDivElement> {
|