@townco/ui 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/hooks/use-chat-input.d.ts +17 -17
- package/dist/core/hooks/use-chat-input.js +55 -64
- package/dist/core/hooks/use-chat-messages.js +114 -121
- package/dist/core/hooks/use-chat-session.d.ts +1 -1
- package/dist/core/hooks/use-chat-session.js +80 -78
- 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/ChatEmptyState.d.ts +18 -0
- package/dist/gui/components/ChatEmptyState.js +22 -0
- package/dist/gui/components/ChatInput.js +29 -1
- package/dist/gui/components/ChatLayout.js +2 -2
- package/dist/gui/components/ChatSecondaryPanel.d.ts +25 -14
- package/dist/gui/components/ChatSecondaryPanel.js +60 -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/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/MarkdownRenderer.d.ts +4 -6
- package/dist/gui/components/MarkdownRenderer.js +81 -178
- package/dist/gui/components/Message.d.ts +1 -1
- package/dist/gui/components/MessageContent.d.ts +22 -29
- package/dist/gui/components/PanelTabsHeader.d.ts +17 -0
- package/dist/gui/components/PanelTabsHeader.js +31 -0
- 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/Tabs.d.ts +4 -24
- 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 +2 -0
- package/dist/gui/components/index.js +2 -0
- package/dist/gui/lib/utils.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/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 +6 -6
- package/dist/sdk/transports/http.d.ts +55 -55
- package/dist/sdk/transports/http.js +3 -3
- package/dist/sdk/transports/stdio.d.ts +20 -20
- 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/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/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/package.json +2 -2
- package/src/styles/global.css +64 -0
- 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/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/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/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/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/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/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,48 +3,48 @@ import { z } from "zod";
|
|
|
3
3
|
* Agent capability schema
|
|
4
4
|
*/
|
|
5
5
|
export const AgentCapability = z.object({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
name: z.string(),
|
|
7
|
+
description: z.string().optional(),
|
|
8
|
+
parameters: z.record(z.string(), z.unknown()).optional(),
|
|
9
9
|
});
|
|
10
10
|
/**
|
|
11
11
|
* Agent tool schema
|
|
12
12
|
*/
|
|
13
13
|
export const AgentTool = z.object({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
name: z.string(),
|
|
15
|
+
description: z.string(),
|
|
16
|
+
parameters: z.record(z.string(), z.unknown()),
|
|
17
|
+
required: z.array(z.string()).optional(),
|
|
18
18
|
});
|
|
19
19
|
/**
|
|
20
20
|
* Agent information schema
|
|
21
21
|
*/
|
|
22
22
|
export const AgentInfo = z.object({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
name: z.string(),
|
|
24
|
+
version: z.string().optional(),
|
|
25
|
+
description: z.string().optional(),
|
|
26
|
+
author: z.string().optional(),
|
|
27
|
+
capabilities: z.array(AgentCapability).optional(),
|
|
28
|
+
tools: z.array(AgentTool).optional(),
|
|
29
|
+
supportedFormats: z.array(z.string()).optional(),
|
|
30
30
|
});
|
|
31
31
|
/**
|
|
32
32
|
* Agent status schema
|
|
33
33
|
*/
|
|
34
34
|
export const AgentStatus = z.enum([
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
"initializing",
|
|
36
|
+
"ready",
|
|
37
|
+
"busy",
|
|
38
|
+
"error",
|
|
39
|
+
"terminated",
|
|
40
40
|
]);
|
|
41
41
|
/**
|
|
42
42
|
* Agent state schema
|
|
43
43
|
*/
|
|
44
44
|
export const AgentState = z.object({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
status: AgentStatus,
|
|
46
|
+
info: AgentInfo.optional(),
|
|
47
|
+
pid: z.number().optional(),
|
|
48
|
+
error: z.string().optional(),
|
|
49
|
+
uptime: z.number().optional(),
|
|
50
50
|
});
|
|
@@ -3,291 +3,193 @@ import { z } from "zod";
|
|
|
3
3
|
* Message role types
|
|
4
4
|
*/
|
|
5
5
|
export declare const MessageRole: z.ZodEnum<{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
user: "user";
|
|
7
|
+
assistant: "assistant";
|
|
8
|
+
system: "system";
|
|
9
|
+
tool: "tool";
|
|
10
10
|
}>;
|
|
11
11
|
export type MessageRole = z.infer<typeof MessageRole>;
|
|
12
12
|
/**
|
|
13
13
|
* Content type for messages
|
|
14
14
|
*/
|
|
15
15
|
export declare const ContentType: z.ZodEnum<{
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
file: "file";
|
|
17
|
+
text: "text";
|
|
18
|
+
image: "image";
|
|
19
|
+
tool_call: "tool_call";
|
|
20
|
+
tool_result: "tool_result";
|
|
21
21
|
}>;
|
|
22
22
|
export type ContentType = z.infer<typeof ContentType>;
|
|
23
23
|
/**
|
|
24
24
|
* Base content schema
|
|
25
25
|
*/
|
|
26
|
-
export declare const BaseContent: z.ZodObject<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
z.core.$strip
|
|
37
|
-
>;
|
|
26
|
+
export declare const BaseContent: z.ZodObject<{
|
|
27
|
+
type: z.ZodEnum<{
|
|
28
|
+
file: "file";
|
|
29
|
+
text: "text";
|
|
30
|
+
image: "image";
|
|
31
|
+
tool_call: "tool_call";
|
|
32
|
+
tool_result: "tool_result";
|
|
33
|
+
}>;
|
|
34
|
+
}, z.core.$strip>;
|
|
38
35
|
/**
|
|
39
36
|
* Text content
|
|
40
37
|
*/
|
|
41
|
-
export declare const TextContent: z.ZodObject<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
z.core.$strip
|
|
47
|
-
>;
|
|
38
|
+
export declare const TextContent: z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"text">;
|
|
40
|
+
text: z.ZodString;
|
|
41
|
+
}, z.core.$strip>;
|
|
48
42
|
export type TextContent = z.infer<typeof TextContent>;
|
|
49
43
|
/**
|
|
50
44
|
* Image content
|
|
51
45
|
*/
|
|
52
|
-
export declare const ImageContent: z.ZodObject<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
z.core.$strip
|
|
60
|
-
>;
|
|
46
|
+
export declare const ImageContent: z.ZodObject<{
|
|
47
|
+
type: z.ZodLiteral<"image">;
|
|
48
|
+
url: z.ZodOptional<z.ZodString>;
|
|
49
|
+
data: z.ZodOptional<z.ZodString>;
|
|
50
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.core.$strip>;
|
|
61
52
|
export type ImageContent = z.infer<typeof ImageContent>;
|
|
62
53
|
/**
|
|
63
54
|
* File attachment content
|
|
64
55
|
*/
|
|
65
|
-
export declare const FileContent: z.ZodObject<
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
z.core.$strip
|
|
75
|
-
>;
|
|
56
|
+
export declare const FileContent: z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<"file">;
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
path: z.ZodOptional<z.ZodString>;
|
|
60
|
+
url: z.ZodOptional<z.ZodString>;
|
|
61
|
+
mimeType: z.ZodString;
|
|
62
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
}, z.core.$strip>;
|
|
76
64
|
export type FileContent = z.infer<typeof FileContent>;
|
|
77
65
|
/**
|
|
78
66
|
* Tool call content
|
|
79
67
|
*/
|
|
80
|
-
export declare const ToolCallContent: z.ZodObject<
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
z.core.$strip
|
|
88
|
-
>;
|
|
68
|
+
export declare const ToolCallContent: z.ZodObject<{
|
|
69
|
+
type: z.ZodLiteral<"tool_call">;
|
|
70
|
+
id: z.ZodString;
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
73
|
+
}, z.core.$strip>;
|
|
89
74
|
export type ToolCallContent = z.infer<typeof ToolCallContent>;
|
|
90
75
|
/**
|
|
91
76
|
* Tool result content
|
|
92
77
|
*/
|
|
93
|
-
export declare const ToolResultContent: z.ZodObject<
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
},
|
|
100
|
-
z.core.$strip
|
|
101
|
-
>;
|
|
78
|
+
export declare const ToolResultContent: z.ZodObject<{
|
|
79
|
+
type: z.ZodLiteral<"tool_result">;
|
|
80
|
+
callId: z.ZodString;
|
|
81
|
+
result: z.ZodUnknown;
|
|
82
|
+
error: z.ZodOptional<z.ZodString>;
|
|
83
|
+
}, z.core.$strip>;
|
|
102
84
|
export type ToolResultContent = z.infer<typeof ToolResultContent>;
|
|
103
85
|
/**
|
|
104
86
|
* Union of all content types
|
|
105
87
|
*/
|
|
106
|
-
export declare const Content: z.ZodDiscriminatedUnion<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
},
|
|
133
|
-
z.core.$strip
|
|
134
|
-
>,
|
|
135
|
-
z.ZodObject<
|
|
136
|
-
{
|
|
137
|
-
type: z.ZodLiteral<"tool_call">;
|
|
138
|
-
id: z.ZodString;
|
|
139
|
-
name: z.ZodString;
|
|
140
|
-
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
141
|
-
},
|
|
142
|
-
z.core.$strip
|
|
143
|
-
>,
|
|
144
|
-
z.ZodObject<
|
|
145
|
-
{
|
|
146
|
-
type: z.ZodLiteral<"tool_result">;
|
|
147
|
-
callId: z.ZodString;
|
|
148
|
-
result: z.ZodUnknown;
|
|
149
|
-
error: z.ZodOptional<z.ZodString>;
|
|
150
|
-
},
|
|
151
|
-
z.core.$strip
|
|
152
|
-
>,
|
|
153
|
-
],
|
|
154
|
-
"type"
|
|
155
|
-
>;
|
|
88
|
+
export declare const Content: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"text">;
|
|
90
|
+
text: z.ZodString;
|
|
91
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
92
|
+
type: z.ZodLiteral<"image">;
|
|
93
|
+
url: z.ZodOptional<z.ZodString>;
|
|
94
|
+
data: z.ZodOptional<z.ZodString>;
|
|
95
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
type: z.ZodLiteral<"file">;
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
path: z.ZodOptional<z.ZodString>;
|
|
100
|
+
url: z.ZodOptional<z.ZodString>;
|
|
101
|
+
mimeType: z.ZodString;
|
|
102
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
104
|
+
type: z.ZodLiteral<"tool_call">;
|
|
105
|
+
id: z.ZodString;
|
|
106
|
+
name: z.ZodString;
|
|
107
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
108
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
109
|
+
type: z.ZodLiteral<"tool_result">;
|
|
110
|
+
callId: z.ZodString;
|
|
111
|
+
result: z.ZodUnknown;
|
|
112
|
+
error: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, z.core.$strip>], "type">;
|
|
156
114
|
export type Content = z.infer<typeof Content>;
|
|
157
115
|
/**
|
|
158
116
|
* Message schema
|
|
159
117
|
*/
|
|
160
|
-
export declare const Message: z.ZodObject<
|
|
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
|
-
z.core.$strip
|
|
198
|
-
>,
|
|
199
|
-
z.ZodObject<
|
|
200
|
-
{
|
|
201
|
-
type: z.ZodLiteral<"tool_call">;
|
|
202
|
-
id: z.ZodString;
|
|
203
|
-
name: z.ZodString;
|
|
204
|
-
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
205
|
-
},
|
|
206
|
-
z.core.$strip
|
|
207
|
-
>,
|
|
208
|
-
z.ZodObject<
|
|
209
|
-
{
|
|
210
|
-
type: z.ZodLiteral<"tool_result">;
|
|
211
|
-
callId: z.ZodString;
|
|
212
|
-
result: z.ZodUnknown;
|
|
213
|
-
error: z.ZodOptional<z.ZodString>;
|
|
214
|
-
},
|
|
215
|
-
z.core.$strip
|
|
216
|
-
>,
|
|
217
|
-
],
|
|
218
|
-
"type"
|
|
219
|
-
>
|
|
220
|
-
>;
|
|
221
|
-
timestamp: z.ZodISODateTime;
|
|
222
|
-
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
223
|
-
},
|
|
224
|
-
z.core.$strip
|
|
225
|
-
>;
|
|
118
|
+
export declare const Message: z.ZodObject<{
|
|
119
|
+
id: z.ZodString;
|
|
120
|
+
role: z.ZodEnum<{
|
|
121
|
+
user: "user";
|
|
122
|
+
assistant: "assistant";
|
|
123
|
+
system: "system";
|
|
124
|
+
tool: "tool";
|
|
125
|
+
}>;
|
|
126
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
127
|
+
type: z.ZodLiteral<"text">;
|
|
128
|
+
text: z.ZodString;
|
|
129
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
130
|
+
type: z.ZodLiteral<"image">;
|
|
131
|
+
url: z.ZodOptional<z.ZodString>;
|
|
132
|
+
data: z.ZodOptional<z.ZodString>;
|
|
133
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
134
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
135
|
+
type: z.ZodLiteral<"file">;
|
|
136
|
+
name: z.ZodString;
|
|
137
|
+
path: z.ZodOptional<z.ZodString>;
|
|
138
|
+
url: z.ZodOptional<z.ZodString>;
|
|
139
|
+
mimeType: z.ZodString;
|
|
140
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
142
|
+
type: z.ZodLiteral<"tool_call">;
|
|
143
|
+
id: z.ZodString;
|
|
144
|
+
name: z.ZodString;
|
|
145
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
146
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
147
|
+
type: z.ZodLiteral<"tool_result">;
|
|
148
|
+
callId: z.ZodString;
|
|
149
|
+
result: z.ZodUnknown;
|
|
150
|
+
error: z.ZodOptional<z.ZodString>;
|
|
151
|
+
}, z.core.$strip>], "type">>;
|
|
152
|
+
timestamp: z.ZodISODateTime;
|
|
153
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
154
|
+
}, z.core.$strip>;
|
|
226
155
|
export type Message = z.infer<typeof Message>;
|
|
227
156
|
/**
|
|
228
157
|
* Streaming message chunk
|
|
229
158
|
*/
|
|
230
|
-
export declare const MessageChunk: z.ZodObject<
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
z.core.$strip
|
|
267
|
-
>,
|
|
268
|
-
z.ZodObject<
|
|
269
|
-
{
|
|
270
|
-
type: z.ZodLiteral<"tool_call">;
|
|
271
|
-
id: z.ZodString;
|
|
272
|
-
name: z.ZodString;
|
|
273
|
-
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
274
|
-
},
|
|
275
|
-
z.core.$strip
|
|
276
|
-
>,
|
|
277
|
-
z.ZodObject<
|
|
278
|
-
{
|
|
279
|
-
type: z.ZodLiteral<"tool_result">;
|
|
280
|
-
callId: z.ZodString;
|
|
281
|
-
result: z.ZodUnknown;
|
|
282
|
-
error: z.ZodOptional<z.ZodString>;
|
|
283
|
-
},
|
|
284
|
-
z.core.$strip
|
|
285
|
-
>,
|
|
286
|
-
],
|
|
287
|
-
"type"
|
|
288
|
-
>;
|
|
289
|
-
isComplete: z.ZodBoolean;
|
|
290
|
-
},
|
|
291
|
-
z.core.$strip
|
|
292
|
-
>;
|
|
159
|
+
export declare const MessageChunk: z.ZodObject<{
|
|
160
|
+
id: z.ZodString;
|
|
161
|
+
role: z.ZodEnum<{
|
|
162
|
+
user: "user";
|
|
163
|
+
assistant: "assistant";
|
|
164
|
+
system: "system";
|
|
165
|
+
tool: "tool";
|
|
166
|
+
}>;
|
|
167
|
+
contentDelta: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
168
|
+
type: z.ZodLiteral<"text">;
|
|
169
|
+
text: z.ZodString;
|
|
170
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
171
|
+
type: z.ZodLiteral<"image">;
|
|
172
|
+
url: z.ZodOptional<z.ZodString>;
|
|
173
|
+
data: z.ZodOptional<z.ZodString>;
|
|
174
|
+
mimeType: z.ZodOptional<z.ZodString>;
|
|
175
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
176
|
+
type: z.ZodLiteral<"file">;
|
|
177
|
+
name: z.ZodString;
|
|
178
|
+
path: z.ZodOptional<z.ZodString>;
|
|
179
|
+
url: z.ZodOptional<z.ZodString>;
|
|
180
|
+
mimeType: z.ZodString;
|
|
181
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
182
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
183
|
+
type: z.ZodLiteral<"tool_call">;
|
|
184
|
+
id: z.ZodString;
|
|
185
|
+
name: z.ZodString;
|
|
186
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
187
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
188
|
+
type: z.ZodLiteral<"tool_result">;
|
|
189
|
+
callId: z.ZodString;
|
|
190
|
+
result: z.ZodUnknown;
|
|
191
|
+
error: z.ZodOptional<z.ZodString>;
|
|
192
|
+
}, z.core.$strip>], "type">;
|
|
193
|
+
isComplete: z.ZodBoolean;
|
|
194
|
+
}, z.core.$strip>;
|
|
293
195
|
export type MessageChunk = z.infer<typeof MessageChunk>;
|
|
@@ -7,89 +7,89 @@ export const MessageRole = z.enum(["user", "assistant", "system", "tool"]);
|
|
|
7
7
|
* Content type for messages
|
|
8
8
|
*/
|
|
9
9
|
export const ContentType = z.enum([
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
"text",
|
|
11
|
+
"image",
|
|
12
|
+
"file",
|
|
13
|
+
"tool_call",
|
|
14
|
+
"tool_result",
|
|
15
15
|
]);
|
|
16
16
|
/**
|
|
17
17
|
* Base content schema
|
|
18
18
|
*/
|
|
19
19
|
export const BaseContent = z.object({
|
|
20
|
-
|
|
20
|
+
type: ContentType,
|
|
21
21
|
});
|
|
22
22
|
/**
|
|
23
23
|
* Text content
|
|
24
24
|
*/
|
|
25
25
|
export const TextContent = BaseContent.extend({
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
type: z.literal("text"),
|
|
27
|
+
text: z.string(),
|
|
28
28
|
});
|
|
29
29
|
/**
|
|
30
30
|
* Image content
|
|
31
31
|
*/
|
|
32
32
|
export const ImageContent = BaseContent.extend({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
type: z.literal("image"),
|
|
34
|
+
url: z.string().url().optional(),
|
|
35
|
+
data: z.string().optional(), // Base64 encoded
|
|
36
|
+
mimeType: z.string().optional(),
|
|
37
37
|
});
|
|
38
38
|
/**
|
|
39
39
|
* File attachment content
|
|
40
40
|
*/
|
|
41
41
|
export const FileContent = BaseContent.extend({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
type: z.literal("file"),
|
|
43
|
+
name: z.string(),
|
|
44
|
+
path: z.string().optional(),
|
|
45
|
+
url: z.string().url().optional(),
|
|
46
|
+
mimeType: z.string(),
|
|
47
|
+
size: z.number().optional(),
|
|
48
48
|
});
|
|
49
49
|
/**
|
|
50
50
|
* Tool call content
|
|
51
51
|
*/
|
|
52
52
|
export const ToolCallContent = BaseContent.extend({
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
type: z.literal("tool_call"),
|
|
54
|
+
id: z.string(),
|
|
55
|
+
name: z.string(),
|
|
56
|
+
arguments: z.record(z.string(), z.unknown()),
|
|
57
57
|
});
|
|
58
58
|
/**
|
|
59
59
|
* Tool result content
|
|
60
60
|
*/
|
|
61
61
|
export const ToolResultContent = BaseContent.extend({
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
type: z.literal("tool_result"),
|
|
63
|
+
callId: z.string(),
|
|
64
|
+
result: z.unknown(),
|
|
65
|
+
error: z.string().optional(),
|
|
66
66
|
});
|
|
67
67
|
/**
|
|
68
68
|
* Union of all content types
|
|
69
69
|
*/
|
|
70
70
|
export const Content = z.discriminatedUnion("type", [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
TextContent,
|
|
72
|
+
ImageContent,
|
|
73
|
+
FileContent,
|
|
74
|
+
ToolCallContent,
|
|
75
|
+
ToolResultContent,
|
|
76
76
|
]);
|
|
77
77
|
/**
|
|
78
78
|
* Message schema
|
|
79
79
|
*/
|
|
80
80
|
export const Message = z.object({
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
id: z.string(),
|
|
82
|
+
role: MessageRole,
|
|
83
|
+
content: z.array(Content),
|
|
84
|
+
timestamp: z.iso.datetime(),
|
|
85
|
+
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
86
86
|
});
|
|
87
87
|
/**
|
|
88
88
|
* Streaming message chunk
|
|
89
89
|
*/
|
|
90
90
|
export const MessageChunk = z.object({
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
id: z.string(),
|
|
92
|
+
role: MessageRole,
|
|
93
|
+
contentDelta: Content,
|
|
94
|
+
isComplete: z.boolean(),
|
|
95
95
|
});
|