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