@townco/ui 0.1.67 → 0.1.69
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-messages.d.ts +5 -0
- package/dist/core/hooks/use-tool-calls.d.ts +5 -0
- package/dist/core/hooks/use-tool-calls.js +2 -1
- package/dist/core/schemas/chat.d.ts +10 -0
- package/dist/core/schemas/tool-call.d.ts +96 -0
- package/dist/core/schemas/tool-call.js +12 -0
- package/dist/core/utils/tool-call-state.d.ts +30 -0
- package/dist/core/utils/tool-call-state.js +73 -0
- package/dist/core/utils/tool-summary.d.ts +13 -0
- package/dist/core/utils/tool-summary.js +172 -0
- package/dist/core/utils/tool-verbiage.d.ts +28 -0
- package/dist/core/utils/tool-verbiage.js +185 -0
- package/dist/gui/components/AppSidebar.d.ts +22 -0
- package/dist/gui/components/AppSidebar.js +22 -0
- package/dist/gui/components/ChatLayout.d.ts +5 -0
- package/dist/gui/components/ChatLayout.js +239 -132
- package/dist/gui/components/ChatView.js +42 -118
- package/dist/gui/components/MessageContent.js +199 -49
- package/dist/gui/components/SessionHistory.d.ts +10 -0
- package/dist/gui/components/SessionHistory.js +101 -0
- package/dist/gui/components/SessionHistoryItem.d.ts +11 -0
- package/dist/gui/components/SessionHistoryItem.js +24 -0
- package/dist/gui/components/Sheet.d.ts +25 -0
- package/dist/gui/components/Sheet.js +36 -0
- package/dist/gui/components/Sidebar.d.ts +65 -0
- package/dist/gui/components/Sidebar.js +231 -0
- package/dist/gui/components/SidebarToggle.d.ts +3 -0
- package/dist/gui/components/SidebarToggle.js +9 -0
- package/dist/gui/components/SubAgentDetails.d.ts +13 -6
- package/dist/gui/components/SubAgentDetails.js +29 -14
- package/dist/gui/components/ToolCallList.js +3 -3
- package/dist/gui/components/ToolOperation.d.ts +11 -0
- package/dist/gui/components/ToolOperation.js +289 -0
- package/dist/gui/components/WorkProgress.d.ts +20 -0
- package/dist/gui/components/WorkProgress.js +79 -0
- package/dist/gui/components/index.d.ts +8 -1
- package/dist/gui/components/index.js +9 -1
- package/dist/gui/hooks/index.d.ts +1 -0
- package/dist/gui/hooks/index.js +1 -0
- package/dist/gui/hooks/use-mobile.d.ts +1 -0
- package/dist/gui/hooks/use-mobile.js +15 -0
- package/dist/gui/index.d.ts +1 -0
- package/dist/gui/index.js +2 -0
- package/dist/gui/lib/motion.d.ts +55 -0
- package/dist/gui/lib/motion.js +217 -0
- package/dist/sdk/schemas/session.d.ts +102 -6
- package/dist/sdk/transports/http.js +105 -37
- package/dist/sdk/transports/types.d.ts +5 -0
- package/package.json +8 -7
- package/src/styles/global.css +128 -1
- package/dist/gui/components/InvokingGroup.d.ts +0 -9
- package/dist/gui/components/InvokingGroup.js +0 -16
- package/dist/gui/components/ToolCall.d.ts +0 -8
- package/dist/gui/components/ToolCall.js +0 -226
- package/dist/gui/components/ToolCallGroup.d.ts +0 -8
- package/dist/gui/components/ToolCallGroup.js +0 -29
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Transition, Variants } from "framer-motion";
|
|
2
|
+
/**
|
|
3
|
+
* Motion utilities and reusable animation variants for the UI package
|
|
4
|
+
* Provides consistent animation behavior across components
|
|
5
|
+
*/
|
|
6
|
+
export declare const motionDuration: {
|
|
7
|
+
readonly fast: 0.15;
|
|
8
|
+
readonly normal: 0.25;
|
|
9
|
+
readonly slow: 0.4;
|
|
10
|
+
};
|
|
11
|
+
export declare const motionEasing: {
|
|
12
|
+
readonly smooth: readonly [0.25, 0.1, 0.25, 1];
|
|
13
|
+
readonly bounce: readonly [0.68, -0.55, 0.265, 1.55];
|
|
14
|
+
readonly sharp: readonly [0.4, 0, 0.2, 1];
|
|
15
|
+
readonly gentle: readonly [0.25, 0.46, 0.45, 0.94];
|
|
16
|
+
};
|
|
17
|
+
export declare const fadeInVariants: Variants;
|
|
18
|
+
export declare const fadeInUpVariants: Variants;
|
|
19
|
+
export declare const expandCollapseVariants: Variants;
|
|
20
|
+
export declare const slideDownVariants: Variants;
|
|
21
|
+
export declare const shimmerTransition: Transition;
|
|
22
|
+
export declare const shimmerVariants: Variants;
|
|
23
|
+
export declare const scaleInVariants: Variants;
|
|
24
|
+
export declare const pulseVariants: Variants;
|
|
25
|
+
export declare const rotateVariants: Variants;
|
|
26
|
+
export declare const standardTransition: Transition;
|
|
27
|
+
export declare const fastTransition: Transition;
|
|
28
|
+
export declare const slowTransition: Transition;
|
|
29
|
+
export declare const springTransition: Transition;
|
|
30
|
+
export declare const gentleSpringTransition: Transition;
|
|
31
|
+
export declare const layoutTransition: Transition;
|
|
32
|
+
export declare const staggerChildren: {
|
|
33
|
+
visible: {
|
|
34
|
+
transition: {
|
|
35
|
+
staggerChildren: number;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const staggerChildrenFast: {
|
|
40
|
+
visible: {
|
|
41
|
+
transition: {
|
|
42
|
+
staggerChildren: number;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export declare const slideInFromRightVariants: Variants;
|
|
47
|
+
export declare const slideOutToRightVariants: Variants;
|
|
48
|
+
/**
|
|
49
|
+
* Get transition with reduced motion consideration
|
|
50
|
+
*/
|
|
51
|
+
export declare function getTransition(shouldReduceMotion: boolean, transition?: Transition): Transition;
|
|
52
|
+
/**
|
|
53
|
+
* Get duration with reduced motion consideration
|
|
54
|
+
*/
|
|
55
|
+
export declare function getDuration(shouldReduceMotion: boolean, duration?: number): number;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Motion utilities and reusable animation variants for the UI package
|
|
3
|
+
* Provides consistent animation behavior across components
|
|
4
|
+
*/
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Standard Durations
|
|
7
|
+
// ============================================================================
|
|
8
|
+
export const motionDuration = {
|
|
9
|
+
fast: 0.15,
|
|
10
|
+
normal: 0.25,
|
|
11
|
+
slow: 0.4,
|
|
12
|
+
};
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Standard Easings
|
|
15
|
+
// ============================================================================
|
|
16
|
+
export const motionEasing = {
|
|
17
|
+
// Smooth, natural easing
|
|
18
|
+
smooth: [0.25, 0.1, 0.25, 1],
|
|
19
|
+
// Bouncy, playful easing
|
|
20
|
+
bounce: [0.68, -0.55, 0.265, 1.55],
|
|
21
|
+
// Sharp, snappy easing
|
|
22
|
+
sharp: [0.4, 0, 0.2, 1],
|
|
23
|
+
// Gentle, subtle easing
|
|
24
|
+
gentle: [0.25, 0.46, 0.45, 0.94],
|
|
25
|
+
};
|
|
26
|
+
// ============================================================================
|
|
27
|
+
// Fade Variants
|
|
28
|
+
// ============================================================================
|
|
29
|
+
export const fadeInVariants = {
|
|
30
|
+
hidden: {
|
|
31
|
+
opacity: 0,
|
|
32
|
+
},
|
|
33
|
+
visible: {
|
|
34
|
+
opacity: 1,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
export const fadeInUpVariants = {
|
|
38
|
+
hidden: {
|
|
39
|
+
opacity: 0,
|
|
40
|
+
y: 8,
|
|
41
|
+
},
|
|
42
|
+
visible: {
|
|
43
|
+
opacity: 1,
|
|
44
|
+
y: 0,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
// ============================================================================
|
|
48
|
+
// Expand/Collapse Variants
|
|
49
|
+
// ============================================================================
|
|
50
|
+
export const expandCollapseVariants = {
|
|
51
|
+
collapsed: {
|
|
52
|
+
height: 0,
|
|
53
|
+
opacity: 0,
|
|
54
|
+
overflow: "hidden",
|
|
55
|
+
},
|
|
56
|
+
expanded: {
|
|
57
|
+
height: "auto",
|
|
58
|
+
opacity: 1,
|
|
59
|
+
overflow: "visible",
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export const slideDownVariants = {
|
|
63
|
+
hidden: {
|
|
64
|
+
opacity: 0,
|
|
65
|
+
height: 0,
|
|
66
|
+
y: -4,
|
|
67
|
+
},
|
|
68
|
+
visible: {
|
|
69
|
+
opacity: 1,
|
|
70
|
+
height: "auto",
|
|
71
|
+
y: 0,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
// ============================================================================
|
|
75
|
+
// Shimmer Effect
|
|
76
|
+
// ============================================================================
|
|
77
|
+
export const shimmerTransition = {
|
|
78
|
+
duration: 2,
|
|
79
|
+
ease: "linear",
|
|
80
|
+
repeat: Infinity,
|
|
81
|
+
repeatType: "loop",
|
|
82
|
+
};
|
|
83
|
+
// For shimmer, we'll use a background gradient that shifts
|
|
84
|
+
export const shimmerVariants = {
|
|
85
|
+
idle: {
|
|
86
|
+
backgroundPosition: "200% 0",
|
|
87
|
+
},
|
|
88
|
+
active: {
|
|
89
|
+
backgroundPosition: "-200% 0",
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
// ============================================================================
|
|
93
|
+
// Scale Variants
|
|
94
|
+
// ============================================================================
|
|
95
|
+
export const scaleInVariants = {
|
|
96
|
+
hidden: {
|
|
97
|
+
scale: 0.95,
|
|
98
|
+
opacity: 0,
|
|
99
|
+
},
|
|
100
|
+
visible: {
|
|
101
|
+
scale: 1,
|
|
102
|
+
opacity: 1,
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
export const pulseVariants = {
|
|
106
|
+
idle: {
|
|
107
|
+
scale: 1,
|
|
108
|
+
},
|
|
109
|
+
pulse: {
|
|
110
|
+
scale: [1, 1.05, 1],
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
// ============================================================================
|
|
114
|
+
// Rotation Variants
|
|
115
|
+
// ============================================================================
|
|
116
|
+
export const rotateVariants = {
|
|
117
|
+
collapsed: {
|
|
118
|
+
rotate: 0,
|
|
119
|
+
},
|
|
120
|
+
expanded: {
|
|
121
|
+
rotate: 180,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
// ============================================================================
|
|
125
|
+
// Standard Transitions
|
|
126
|
+
// ============================================================================
|
|
127
|
+
export const standardTransition = {
|
|
128
|
+
duration: motionDuration.normal,
|
|
129
|
+
ease: motionEasing.smooth,
|
|
130
|
+
};
|
|
131
|
+
export const fastTransition = {
|
|
132
|
+
duration: motionDuration.fast,
|
|
133
|
+
ease: motionEasing.sharp,
|
|
134
|
+
};
|
|
135
|
+
export const slowTransition = {
|
|
136
|
+
duration: motionDuration.slow,
|
|
137
|
+
ease: motionEasing.gentle,
|
|
138
|
+
};
|
|
139
|
+
export const springTransition = {
|
|
140
|
+
type: "spring",
|
|
141
|
+
stiffness: 300,
|
|
142
|
+
damping: 30,
|
|
143
|
+
};
|
|
144
|
+
export const gentleSpringTransition = {
|
|
145
|
+
type: "spring",
|
|
146
|
+
stiffness: 200,
|
|
147
|
+
damping: 25,
|
|
148
|
+
};
|
|
149
|
+
// ============================================================================
|
|
150
|
+
// Layout Transition (for shared layout animations)
|
|
151
|
+
// ============================================================================
|
|
152
|
+
export const layoutTransition = {
|
|
153
|
+
layout: {
|
|
154
|
+
duration: motionDuration.normal,
|
|
155
|
+
ease: motionEasing.smooth,
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
// ============================================================================
|
|
159
|
+
// Stagger Configurations
|
|
160
|
+
// ============================================================================
|
|
161
|
+
export const staggerChildren = {
|
|
162
|
+
visible: {
|
|
163
|
+
transition: {
|
|
164
|
+
staggerChildren: 0.05,
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
export const staggerChildrenFast = {
|
|
169
|
+
visible: {
|
|
170
|
+
transition: {
|
|
171
|
+
staggerChildren: 0.03,
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
// ============================================================================
|
|
176
|
+
// Slide Variants (for panels and drawers)
|
|
177
|
+
// ============================================================================
|
|
178
|
+
export const slideInFromRightVariants = {
|
|
179
|
+
hidden: {
|
|
180
|
+
x: "100%",
|
|
181
|
+
opacity: 0,
|
|
182
|
+
},
|
|
183
|
+
visible: {
|
|
184
|
+
x: 0,
|
|
185
|
+
opacity: 1,
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
export const slideOutToRightVariants = {
|
|
189
|
+
visible: {
|
|
190
|
+
x: 0,
|
|
191
|
+
opacity: 1,
|
|
192
|
+
},
|
|
193
|
+
hidden: {
|
|
194
|
+
x: "100%",
|
|
195
|
+
opacity: 0,
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
// ============================================================================
|
|
199
|
+
// Helper Functions
|
|
200
|
+
// ============================================================================
|
|
201
|
+
/**
|
|
202
|
+
* Get transition with reduced motion consideration
|
|
203
|
+
*/
|
|
204
|
+
export function getTransition(shouldReduceMotion, transition = standardTransition) {
|
|
205
|
+
if (shouldReduceMotion) {
|
|
206
|
+
return {
|
|
207
|
+
duration: 0.01,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
return transition;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Get duration with reduced motion consideration
|
|
214
|
+
*/
|
|
215
|
+
export function getDuration(shouldReduceMotion, duration = motionDuration.normal) {
|
|
216
|
+
return shouldReduceMotion ? 0.01 : duration;
|
|
217
|
+
}
|
|
@@ -4,10 +4,10 @@ import { z } from "zod";
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const SessionStatus: z.ZodEnum<{
|
|
6
6
|
error: "error";
|
|
7
|
+
active: "active";
|
|
7
8
|
idle: "idle";
|
|
8
9
|
connecting: "connecting";
|
|
9
10
|
connected: "connected";
|
|
10
|
-
active: "active";
|
|
11
11
|
streaming: "streaming";
|
|
12
12
|
disconnected: "disconnected";
|
|
13
13
|
}>;
|
|
@@ -41,10 +41,10 @@ export declare const Session: z.ZodObject<{
|
|
|
41
41
|
id: z.ZodString;
|
|
42
42
|
status: z.ZodEnum<{
|
|
43
43
|
error: "error";
|
|
44
|
+
active: "active";
|
|
44
45
|
idle: "idle";
|
|
45
46
|
connecting: "connecting";
|
|
46
47
|
connected: "connected";
|
|
47
|
-
active: "active";
|
|
48
48
|
streaming: "streaming";
|
|
49
49
|
disconnected: "disconnected";
|
|
50
50
|
}>;
|
|
@@ -117,10 +117,10 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
117
117
|
sessionId: z.ZodString;
|
|
118
118
|
status: z.ZodOptional<z.ZodEnum<{
|
|
119
119
|
error: "error";
|
|
120
|
+
active: "active";
|
|
120
121
|
idle: "idle";
|
|
121
122
|
connecting: "connecting";
|
|
122
123
|
connected: "connected";
|
|
123
|
-
active: "active";
|
|
124
124
|
streaming: "streaming";
|
|
125
125
|
disconnected: "disconnected";
|
|
126
126
|
}>>;
|
|
@@ -178,6 +178,11 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
178
178
|
title: z.ZodString;
|
|
179
179
|
prettyName: z.ZodOptional<z.ZodString>;
|
|
180
180
|
icon: z.ZodOptional<z.ZodString>;
|
|
181
|
+
verbiage: z.ZodOptional<z.ZodObject<{
|
|
182
|
+
active: z.ZodString;
|
|
183
|
+
past: z.ZodString;
|
|
184
|
+
paramKey: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, z.core.$strip>>;
|
|
181
186
|
subline: z.ZodOptional<z.ZodString>;
|
|
182
187
|
kind: z.ZodEnum<{
|
|
183
188
|
read: "read";
|
|
@@ -349,10 +354,10 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
349
354
|
sessionId: z.ZodString;
|
|
350
355
|
status: z.ZodOptional<z.ZodEnum<{
|
|
351
356
|
error: "error";
|
|
357
|
+
active: "active";
|
|
352
358
|
idle: "idle";
|
|
353
359
|
connecting: "connecting";
|
|
354
360
|
connected: "connected";
|
|
355
|
-
active: "active";
|
|
356
361
|
streaming: "streaming";
|
|
357
362
|
disconnected: "disconnected";
|
|
358
363
|
}>>;
|
|
@@ -459,16 +464,107 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
459
464
|
}, z.core.$strip>>;
|
|
460
465
|
subagentPort: z.ZodOptional<z.ZodNumber>;
|
|
461
466
|
subagentSessionId: z.ZodOptional<z.ZodString>;
|
|
467
|
+
subagentMessages: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
468
|
+
id: z.ZodString;
|
|
469
|
+
content: z.ZodString;
|
|
470
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
471
|
+
id: z.ZodString;
|
|
472
|
+
title: z.ZodString;
|
|
473
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
474
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
475
|
+
status: z.ZodEnum<{
|
|
476
|
+
pending: "pending";
|
|
477
|
+
in_progress: "in_progress";
|
|
478
|
+
completed: "completed";
|
|
479
|
+
failed: "failed";
|
|
480
|
+
}>;
|
|
481
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
482
|
+
type: z.ZodLiteral<"content">;
|
|
483
|
+
content: z.ZodObject<{
|
|
484
|
+
type: z.ZodLiteral<"text">;
|
|
485
|
+
text: z.ZodString;
|
|
486
|
+
}, z.core.$strip>;
|
|
487
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
488
|
+
type: z.ZodLiteral<"text">;
|
|
489
|
+
text: z.ZodString;
|
|
490
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
491
|
+
type: z.ZodLiteral<"image">;
|
|
492
|
+
data: z.ZodString;
|
|
493
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
494
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
495
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
496
|
+
type: z.ZodLiteral<"image">;
|
|
497
|
+
url: z.ZodString;
|
|
498
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
499
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
500
|
+
type: z.ZodLiteral<"diff">;
|
|
501
|
+
path: z.ZodString;
|
|
502
|
+
oldText: z.ZodString;
|
|
503
|
+
newText: z.ZodString;
|
|
504
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
505
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
506
|
+
type: z.ZodLiteral<"terminal">;
|
|
507
|
+
terminalId: z.ZodString;
|
|
508
|
+
}, z.core.$strip>], "type">>>;
|
|
509
|
+
}, z.core.$strip>>>;
|
|
510
|
+
contentBlocks: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
511
|
+
type: z.ZodLiteral<"text">;
|
|
512
|
+
text: z.ZodString;
|
|
513
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
514
|
+
type: z.ZodLiteral<"tool_call">;
|
|
515
|
+
toolCall: z.ZodObject<{
|
|
516
|
+
id: z.ZodString;
|
|
517
|
+
title: z.ZodString;
|
|
518
|
+
prettyName: z.ZodOptional<z.ZodString>;
|
|
519
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
520
|
+
status: z.ZodEnum<{
|
|
521
|
+
pending: "pending";
|
|
522
|
+
in_progress: "in_progress";
|
|
523
|
+
completed: "completed";
|
|
524
|
+
failed: "failed";
|
|
525
|
+
}>;
|
|
526
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
527
|
+
type: z.ZodLiteral<"content">;
|
|
528
|
+
content: z.ZodObject<{
|
|
529
|
+
type: z.ZodLiteral<"text">;
|
|
530
|
+
text: z.ZodString;
|
|
531
|
+
}, z.core.$strip>;
|
|
532
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
533
|
+
type: z.ZodLiteral<"text">;
|
|
534
|
+
text: z.ZodString;
|
|
535
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
536
|
+
type: z.ZodLiteral<"image">;
|
|
537
|
+
data: z.ZodString;
|
|
538
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
539
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
540
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
541
|
+
type: z.ZodLiteral<"image">;
|
|
542
|
+
url: z.ZodString;
|
|
543
|
+
alt: z.ZodOptional<z.ZodString>;
|
|
544
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
545
|
+
type: z.ZodLiteral<"diff">;
|
|
546
|
+
path: z.ZodString;
|
|
547
|
+
oldText: z.ZodString;
|
|
548
|
+
newText: z.ZodString;
|
|
549
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
550
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
551
|
+
type: z.ZodLiteral<"terminal">;
|
|
552
|
+
terminalId: z.ZodString;
|
|
553
|
+
}, z.core.$strip>], "type">>>;
|
|
554
|
+
}, z.core.$strip>;
|
|
555
|
+
}, z.core.$strip>], "type">>>;
|
|
556
|
+
isStreaming: z.ZodOptional<z.ZodBoolean>;
|
|
557
|
+
}, z.core.$strip>>>;
|
|
462
558
|
}, z.core.$strip>;
|
|
463
559
|
messageId: z.ZodOptional<z.ZodString>;
|
|
464
560
|
}, z.core.$strip>, z.ZodObject<{
|
|
465
561
|
sessionId: z.ZodString;
|
|
466
562
|
status: z.ZodOptional<z.ZodEnum<{
|
|
467
563
|
error: "error";
|
|
564
|
+
active: "active";
|
|
468
565
|
idle: "idle";
|
|
469
566
|
connecting: "connecting";
|
|
470
567
|
connected: "connected";
|
|
471
|
-
active: "active";
|
|
472
568
|
streaming: "streaming";
|
|
473
569
|
disconnected: "disconnected";
|
|
474
570
|
}>>;
|
|
@@ -530,10 +626,10 @@ export declare const SessionUpdate: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
530
626
|
sessionId: z.ZodString;
|
|
531
627
|
status: z.ZodOptional<z.ZodEnum<{
|
|
532
628
|
error: "error";
|
|
629
|
+
active: "active";
|
|
533
630
|
idle: "idle";
|
|
534
631
|
connecting: "connecting";
|
|
535
632
|
connected: "connected";
|
|
536
|
-
active: "active";
|
|
537
633
|
streaming: "streaming";
|
|
538
634
|
disconnected: "disconnected";
|
|
539
635
|
}>>;
|
|
@@ -695,6 +695,25 @@ export class HttpTransport {
|
|
|
695
695
|
typeof update._meta.batchId === "string"
|
|
696
696
|
? update._meta.batchId
|
|
697
697
|
: undefined;
|
|
698
|
+
// Extract subagent connection info for replay
|
|
699
|
+
const subagentPort = update._meta &&
|
|
700
|
+
typeof update._meta === "object" &&
|
|
701
|
+
"subagentPort" in update._meta &&
|
|
702
|
+
typeof update._meta.subagentPort === "number"
|
|
703
|
+
? update._meta.subagentPort
|
|
704
|
+
: undefined;
|
|
705
|
+
const subagentSessionId = update._meta &&
|
|
706
|
+
typeof update._meta === "object" &&
|
|
707
|
+
"subagentSessionId" in update._meta &&
|
|
708
|
+
typeof update._meta.subagentSessionId === "string"
|
|
709
|
+
? update._meta.subagentSessionId
|
|
710
|
+
: undefined;
|
|
711
|
+
const subagentMessages = update._meta &&
|
|
712
|
+
typeof update._meta === "object" &&
|
|
713
|
+
"subagentMessages" in update._meta &&
|
|
714
|
+
Array.isArray(update._meta.subagentMessages)
|
|
715
|
+
? update._meta.subagentMessages
|
|
716
|
+
: undefined;
|
|
698
717
|
// Initial tool call notification
|
|
699
718
|
const toolCall = {
|
|
700
719
|
id: update.toolCallId ?? "",
|
|
@@ -755,6 +774,10 @@ export class HttpTransport {
|
|
|
755
774
|
return { type: "text", text: "" };
|
|
756
775
|
}),
|
|
757
776
|
startedAt: Date.now(),
|
|
777
|
+
// Sub-agent connection info and messages for replay
|
|
778
|
+
subagentPort,
|
|
779
|
+
subagentSessionId,
|
|
780
|
+
subagentMessages,
|
|
758
781
|
};
|
|
759
782
|
const sessionUpdate = {
|
|
760
783
|
type: "tool_call",
|
|
@@ -763,19 +786,41 @@ export class HttpTransport {
|
|
|
763
786
|
toolCall: toolCall,
|
|
764
787
|
messageId,
|
|
765
788
|
};
|
|
766
|
-
//
|
|
767
|
-
const
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
789
|
+
// Check if this is replay
|
|
790
|
+
const isReplay = update._meta &&
|
|
791
|
+
typeof update._meta === "object" &&
|
|
792
|
+
"isReplay" in update._meta &&
|
|
793
|
+
update._meta.isReplay === true;
|
|
794
|
+
// Debug: log tool call creation
|
|
795
|
+
logger.info("Creating tool_call session update", {
|
|
796
|
+
toolCallId: toolCall.id,
|
|
797
|
+
title: toolCall.title,
|
|
798
|
+
hasSubagentPort: !!subagentPort,
|
|
799
|
+
hasSubagentSessionId: !!subagentSessionId,
|
|
800
|
+
hasSubagentMessages: !!subagentMessages,
|
|
801
|
+
subagentMessagesCount: subagentMessages?.length,
|
|
802
|
+
isReplay,
|
|
803
|
+
isInReplayMode: this.isInReplayMode,
|
|
804
|
+
});
|
|
805
|
+
// During replay, notify directly since there's no active receive() consumer
|
|
806
|
+
if (isReplay || this.isInReplayMode) {
|
|
807
|
+
this.notifySessionUpdate(sessionUpdate);
|
|
776
808
|
}
|
|
777
809
|
else {
|
|
778
|
-
|
|
810
|
+
// Queue tool call as a chunk for ordered processing during live streaming
|
|
811
|
+
const toolCallChunk = {
|
|
812
|
+
type: "tool_call",
|
|
813
|
+
id: sessionId,
|
|
814
|
+
toolCall: toolCall,
|
|
815
|
+
messageId,
|
|
816
|
+
};
|
|
817
|
+
const resolver = this.chunkResolvers.shift();
|
|
818
|
+
if (resolver) {
|
|
819
|
+
resolver(toolCallChunk);
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
this.messageQueue.push(toolCallChunk);
|
|
823
|
+
}
|
|
779
824
|
}
|
|
780
825
|
}
|
|
781
826
|
else if (update?.sessionUpdate === "tool_call_update") {
|
|
@@ -816,13 +861,19 @@ export class HttpTransport {
|
|
|
816
861
|
typeof update._meta.subagentSessionId === "string"
|
|
817
862
|
? update._meta.subagentSessionId
|
|
818
863
|
: undefined;
|
|
864
|
+
const subagentMessages = update._meta &&
|
|
865
|
+
typeof update._meta === "object" &&
|
|
866
|
+
"subagentMessages" in update._meta &&
|
|
867
|
+
Array.isArray(update._meta.subagentMessages)
|
|
868
|
+
? update._meta.subagentMessages
|
|
869
|
+
: undefined;
|
|
819
870
|
// Debug logging for subagent connection info
|
|
820
|
-
if (subagentPort || subagentSessionId) {
|
|
821
|
-
logger.info("Extracted subagent
|
|
871
|
+
if (subagentPort || subagentSessionId || subagentMessages) {
|
|
872
|
+
logger.info("Extracted subagent info from tool_call_update", {
|
|
822
873
|
toolCallId: update.toolCallId,
|
|
823
874
|
subagentPort,
|
|
824
875
|
subagentSessionId,
|
|
825
|
-
|
|
876
|
+
subagentMessagesCount: subagentMessages?.length,
|
|
826
877
|
});
|
|
827
878
|
}
|
|
828
879
|
// Tool call update notification
|
|
@@ -890,6 +941,8 @@ export class HttpTransport {
|
|
|
890
941
|
// Sub-agent connection info for direct SSE streaming
|
|
891
942
|
subagentPort,
|
|
892
943
|
subagentSessionId,
|
|
944
|
+
// Sub-agent messages for replay
|
|
945
|
+
subagentMessages,
|
|
893
946
|
};
|
|
894
947
|
const sessionUpdate = {
|
|
895
948
|
type: "tool_call_update",
|
|
@@ -898,22 +951,31 @@ export class HttpTransport {
|
|
|
898
951
|
toolCallUpdate: toolCallUpdate,
|
|
899
952
|
messageId,
|
|
900
953
|
};
|
|
901
|
-
//
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
messageId,
|
|
907
|
-
};
|
|
908
|
-
const resolver = this.chunkResolvers.shift();
|
|
909
|
-
if (resolver) {
|
|
910
|
-
resolver(toolCallUpdateChunk);
|
|
954
|
+
// Check if this is replay (tool_call_update doesn't have isReplay in _meta,
|
|
955
|
+
// but we can check if we're in replay mode)
|
|
956
|
+
if (this.isInReplayMode) {
|
|
957
|
+
// During replay, notify directly since there's no active receive() consumer
|
|
958
|
+
this.notifySessionUpdate(sessionUpdate);
|
|
911
959
|
}
|
|
912
960
|
else {
|
|
913
|
-
|
|
961
|
+
// Queue tool call update as a chunk for ordered processing
|
|
962
|
+
const toolCallUpdateChunk = {
|
|
963
|
+
type: "tool_call_update",
|
|
964
|
+
id: sessionId,
|
|
965
|
+
toolCallUpdate: toolCallUpdate,
|
|
966
|
+
messageId,
|
|
967
|
+
};
|
|
968
|
+
const resolver = this.chunkResolvers.shift();
|
|
969
|
+
if (resolver) {
|
|
970
|
+
resolver(toolCallUpdateChunk);
|
|
971
|
+
}
|
|
972
|
+
else {
|
|
973
|
+
this.messageQueue.push(toolCallUpdateChunk);
|
|
974
|
+
}
|
|
914
975
|
}
|
|
915
|
-
logger.debug("
|
|
976
|
+
logger.debug("Processed tool_call_update", {
|
|
916
977
|
sessionUpdate,
|
|
978
|
+
isReplay: this.isInReplayMode,
|
|
917
979
|
});
|
|
918
980
|
}
|
|
919
981
|
else if (update &&
|
|
@@ -995,19 +1057,25 @@ export class HttpTransport {
|
|
|
995
1057
|
toolCallUpdate: toolOutput,
|
|
996
1058
|
messageId,
|
|
997
1059
|
};
|
|
998
|
-
//
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
id: sessionId,
|
|
1002
|
-
toolCallUpdate: toolOutput,
|
|
1003
|
-
messageId,
|
|
1004
|
-
};
|
|
1005
|
-
const resolver = this.chunkResolvers.shift();
|
|
1006
|
-
if (resolver) {
|
|
1007
|
-
resolver(toolCallUpdateChunk);
|
|
1060
|
+
// During replay, notify directly; otherwise queue for ordered processing
|
|
1061
|
+
if (this.isInReplayMode) {
|
|
1062
|
+
this.notifySessionUpdate(sessionUpdate);
|
|
1008
1063
|
}
|
|
1009
1064
|
else {
|
|
1010
|
-
|
|
1065
|
+
// Queue tool output as a chunk for ordered processing
|
|
1066
|
+
const toolCallUpdateChunk = {
|
|
1067
|
+
type: "tool_call_update",
|
|
1068
|
+
id: sessionId,
|
|
1069
|
+
toolCallUpdate: toolOutput,
|
|
1070
|
+
messageId,
|
|
1071
|
+
};
|
|
1072
|
+
const resolver = this.chunkResolvers.shift();
|
|
1073
|
+
if (resolver) {
|
|
1074
|
+
resolver(toolCallUpdateChunk);
|
|
1075
|
+
}
|
|
1076
|
+
else {
|
|
1077
|
+
this.messageQueue.push(toolCallUpdateChunk);
|
|
1078
|
+
}
|
|
1011
1079
|
}
|
|
1012
1080
|
logger.debug("Queued tool_output as tool_call_update chunk", {
|
|
1013
1081
|
sessionUpdate,
|