@townco/ui 0.1.14 → 0.1.16
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 +50 -11
- package/dist/core/hooks/use-chat-session.d.ts +5 -5
- package/dist/core/hooks/use-tool-calls.d.ts +52 -0
- package/dist/core/hooks/use-tool-calls.js +61 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/lib/logger.d.ts +24 -0
- package/dist/core/lib/logger.js +108 -0
- package/dist/core/schemas/chat.d.ts +166 -83
- package/dist/core/schemas/chat.js +27 -27
- package/dist/core/schemas/index.d.ts +1 -0
- package/dist/core/schemas/index.js +1 -0
- package/dist/core/schemas/tool-call.d.ts +174 -0
- package/dist/core/schemas/tool-call.js +130 -0
- package/dist/core/store/chat-store.d.ts +28 -28
- package/dist/core/store/chat-store.js +123 -59
- package/dist/gui/components/ChatLayout.js +11 -10
- package/dist/gui/components/MessageContent.js +4 -1
- package/dist/gui/components/ToolCall.d.ts +8 -0
- package/dist/gui/components/ToolCall.js +100 -0
- package/dist/gui/components/ToolCallList.d.ts +9 -0
- package/dist/gui/components/ToolCallList.js +22 -0
- package/dist/gui/components/index.d.ts +2 -0
- package/dist/gui/components/index.js +2 -0
- package/dist/gui/components/resizable.d.ts +7 -0
- package/dist/gui/components/resizable.js +7 -0
- package/dist/sdk/schemas/session.d.ts +390 -220
- package/dist/sdk/schemas/session.js +74 -29
- package/dist/sdk/transports/http.js +705 -472
- package/dist/sdk/transports/stdio.js +187 -32
- package/dist/tui/components/ChatView.js +19 -51
- package/dist/tui/components/MessageList.d.ts +2 -4
- package/dist/tui/components/MessageList.js +13 -37
- package/dist/tui/components/ToolCall.d.ts +9 -0
- package/dist/tui/components/ToolCall.js +41 -0
- package/dist/tui/components/ToolCallList.d.ts +8 -0
- package/dist/tui/components/ToolCallList.js +17 -0
- package/dist/tui/components/index.d.ts +2 -0
- package/dist/tui/components/index.js +2 -0
- package/package.json +4 -2
package/dist/core/hooks/index.js
CHANGED
|
@@ -3,15 +3,54 @@ import type { AcpClient } from "../../sdk/client/index.js";
|
|
|
3
3
|
* Hook for managing chat messages
|
|
4
4
|
*/
|
|
5
5
|
export declare function useChatMessages(client: AcpClient | null): {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
messages: {
|
|
7
|
+
id: string;
|
|
8
|
+
role: "user" | "assistant" | "system";
|
|
9
|
+
content: string;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
isStreaming: boolean;
|
|
12
|
+
streamingStartTime?: number | undefined;
|
|
13
|
+
metadata?: Record<string, unknown> | undefined;
|
|
14
|
+
toolCalls?: {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
kind: "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "other";
|
|
18
|
+
status: "pending" | "in_progress" | "completed" | "failed";
|
|
19
|
+
locations?: {
|
|
20
|
+
path: string;
|
|
21
|
+
line?: number | null | undefined;
|
|
22
|
+
}[] | undefined;
|
|
23
|
+
rawInput?: Record<string, unknown> | undefined;
|
|
24
|
+
rawOutput?: Record<string, unknown> | undefined;
|
|
25
|
+
content?: ({
|
|
26
|
+
type: "content";
|
|
27
|
+
content: {
|
|
28
|
+
type: "text";
|
|
29
|
+
text: string;
|
|
30
|
+
};
|
|
31
|
+
} | {
|
|
32
|
+
type: "text";
|
|
33
|
+
text: string;
|
|
34
|
+
} | {
|
|
35
|
+
type: "diff";
|
|
36
|
+
path: string;
|
|
37
|
+
oldText: string;
|
|
38
|
+
newText: string;
|
|
39
|
+
line?: number | null | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
type: "terminal";
|
|
42
|
+
terminalId: string;
|
|
43
|
+
})[] | undefined;
|
|
44
|
+
error?: string | undefined;
|
|
45
|
+
startedAt?: number | undefined;
|
|
46
|
+
completedAt?: number | undefined;
|
|
47
|
+
tokenUsage?: {
|
|
48
|
+
inputTokens?: number | undefined;
|
|
49
|
+
outputTokens?: number | undefined;
|
|
50
|
+
totalTokens?: number | undefined;
|
|
51
|
+
} | undefined;
|
|
52
|
+
}[] | undefined;
|
|
53
|
+
}[];
|
|
54
|
+
isStreaming: boolean;
|
|
55
|
+
sendMessage: (content: string) => Promise<void>;
|
|
17
56
|
};
|
|
@@ -3,9 +3,9 @@ import type { AcpClient } from "../../sdk/client/index.js";
|
|
|
3
3
|
* Hook for managing chat session lifecycle
|
|
4
4
|
*/
|
|
5
5
|
export declare function useChatSession(client: AcpClient | null): {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
connectionStatus: "connecting" | "connected" | "error" | "disconnected";
|
|
7
|
+
sessionId: string | null;
|
|
8
|
+
connect: () => Promise<void>;
|
|
9
|
+
startSession: () => Promise<void>;
|
|
10
|
+
disconnect: () => Promise<void>;
|
|
11
11
|
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { AcpClient } from "../../sdk/client/acp-client.js";
|
|
2
|
+
import type { ToolCall } from "../schemas/tool-call.js";
|
|
3
|
+
/**
|
|
4
|
+
* Hook to track and manage tool calls from ACP sessions
|
|
5
|
+
*
|
|
6
|
+
* Subscribes to session updates and tracks tool call lifecycle:
|
|
7
|
+
* - Receives initial tool_call notifications
|
|
8
|
+
* - Merges incremental tool_call_update notifications
|
|
9
|
+
* - Associates tool calls with sessions
|
|
10
|
+
*/
|
|
11
|
+
export declare function useToolCalls(client: AcpClient | null): {
|
|
12
|
+
toolCalls: Record<string, {
|
|
13
|
+
id: string;
|
|
14
|
+
title: string;
|
|
15
|
+
kind: "read" | "edit" | "delete" | "move" | "search" | "execute" | "think" | "fetch" | "switch_mode" | "other";
|
|
16
|
+
status: "pending" | "in_progress" | "completed" | "failed";
|
|
17
|
+
locations?: {
|
|
18
|
+
path: string;
|
|
19
|
+
line?: number | null | undefined;
|
|
20
|
+
}[] | undefined;
|
|
21
|
+
rawInput?: Record<string, unknown> | undefined;
|
|
22
|
+
rawOutput?: Record<string, unknown> | undefined;
|
|
23
|
+
content?: ({
|
|
24
|
+
type: "content";
|
|
25
|
+
content: {
|
|
26
|
+
type: "text";
|
|
27
|
+
text: string;
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
type: "text";
|
|
31
|
+
text: string;
|
|
32
|
+
} | {
|
|
33
|
+
type: "diff";
|
|
34
|
+
path: string;
|
|
35
|
+
oldText: string;
|
|
36
|
+
newText: string;
|
|
37
|
+
line?: number | null | undefined;
|
|
38
|
+
} | {
|
|
39
|
+
type: "terminal";
|
|
40
|
+
terminalId: string;
|
|
41
|
+
})[] | undefined;
|
|
42
|
+
error?: string | undefined;
|
|
43
|
+
startedAt?: number | undefined;
|
|
44
|
+
completedAt?: number | undefined;
|
|
45
|
+
tokenUsage?: {
|
|
46
|
+
inputTokens?: number | undefined;
|
|
47
|
+
outputTokens?: number | undefined;
|
|
48
|
+
totalTokens?: number | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
}[]>;
|
|
51
|
+
getToolCallsForSession: (sessionId: string) => ToolCall[];
|
|
52
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useChatStore } from "../store/chat-store.js";
|
|
3
|
+
/**
|
|
4
|
+
* Hook to track and manage tool calls from ACP sessions
|
|
5
|
+
*
|
|
6
|
+
* Subscribes to session updates and tracks tool call lifecycle:
|
|
7
|
+
* - Receives initial tool_call notifications
|
|
8
|
+
* - Merges incremental tool_call_update notifications
|
|
9
|
+
* - Associates tool calls with sessions
|
|
10
|
+
*/
|
|
11
|
+
export function useToolCalls(client) {
|
|
12
|
+
const toolCalls = useChatStore((state) => state.toolCalls);
|
|
13
|
+
const addToolCall = useChatStore((state) => state.addToolCall);
|
|
14
|
+
const updateToolCall = useChatStore((state) => state.updateToolCall);
|
|
15
|
+
const addToolCallToCurrentMessage = useChatStore((state) => state.addToolCallToCurrentMessage);
|
|
16
|
+
const updateToolCallInCurrentMessage = useChatStore((state) => state.updateToolCallInCurrentMessage);
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
if (!client)
|
|
19
|
+
return;
|
|
20
|
+
// Subscribe to session updates for tool calls
|
|
21
|
+
const unsubscribe = client.onSessionUpdate((update) => {
|
|
22
|
+
if (update.type === "tool_call") {
|
|
23
|
+
// Initial tool call notification
|
|
24
|
+
// Add to session-level tool calls (for sidebar)
|
|
25
|
+
addToolCall(update.sessionId, update.toolCall);
|
|
26
|
+
// Also add to current assistant message (for inline display)
|
|
27
|
+
addToolCallToCurrentMessage(update.toolCall);
|
|
28
|
+
}
|
|
29
|
+
else if (update.type === "tool_call_update") {
|
|
30
|
+
// Tool call update notification
|
|
31
|
+
// Update session-level tool calls (for sidebar)
|
|
32
|
+
updateToolCall(update.sessionId, update.toolCallUpdate);
|
|
33
|
+
// Also update in current assistant message (for inline display)
|
|
34
|
+
updateToolCallInCurrentMessage(update.toolCallUpdate);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return () => {
|
|
38
|
+
unsubscribe();
|
|
39
|
+
};
|
|
40
|
+
}, [
|
|
41
|
+
client,
|
|
42
|
+
addToolCall,
|
|
43
|
+
updateToolCall,
|
|
44
|
+
addToolCallToCurrentMessage,
|
|
45
|
+
updateToolCallInCurrentMessage,
|
|
46
|
+
]);
|
|
47
|
+
return {
|
|
48
|
+
toolCalls,
|
|
49
|
+
getToolCallsForSession: (sessionId) => {
|
|
50
|
+
// First try the exact session ID
|
|
51
|
+
const exactMatch = toolCalls[sessionId];
|
|
52
|
+
if (exactMatch && exactMatch.length > 0) {
|
|
53
|
+
return exactMatch;
|
|
54
|
+
}
|
|
55
|
+
// If no exact match, return all tool calls from all sessions
|
|
56
|
+
// This handles the case where the UI session ID doesn't match the ACP session ID
|
|
57
|
+
const allToolCalls = Object.values(toolCalls).flat();
|
|
58
|
+
return allToolCalls;
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
package/dist/core/index.d.ts
CHANGED
package/dist/core/index.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-compatible logger
|
|
3
|
+
* Outputs structured JSON logs to console with color-coding
|
|
4
|
+
*/
|
|
5
|
+
export type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal";
|
|
6
|
+
export declare class Logger {
|
|
7
|
+
private service;
|
|
8
|
+
private minLevel;
|
|
9
|
+
constructor(service: string, minLevel?: LogLevel);
|
|
10
|
+
private shouldLog;
|
|
11
|
+
private log;
|
|
12
|
+
trace(message: string, metadata?: Record<string, unknown>): void;
|
|
13
|
+
debug(message: string, metadata?: Record<string, unknown>): void;
|
|
14
|
+
info(message: string, metadata?: Record<string, unknown>): void;
|
|
15
|
+
warn(message: string, metadata?: Record<string, unknown>): void;
|
|
16
|
+
error(message: string, metadata?: Record<string, unknown>): void;
|
|
17
|
+
fatal(message: string, metadata?: Record<string, unknown>): void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Create a logger instance for a service
|
|
21
|
+
* @param service - Service name (e.g., "gui", "http-agent", "tui")
|
|
22
|
+
* @param minLevel - Minimum log level to display (default: "debug")
|
|
23
|
+
*/
|
|
24
|
+
export declare function createLogger(service: string, minLevel?: LogLevel): Logger;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-compatible logger
|
|
3
|
+
* Outputs structured JSON logs to console with color-coding
|
|
4
|
+
*/
|
|
5
|
+
const LOG_LEVELS = {
|
|
6
|
+
trace: 0,
|
|
7
|
+
debug: 1,
|
|
8
|
+
info: 2,
|
|
9
|
+
warn: 3,
|
|
10
|
+
error: 4,
|
|
11
|
+
fatal: 5,
|
|
12
|
+
};
|
|
13
|
+
const _LOG_COLORS = {
|
|
14
|
+
trace: "#6B7280", // gray
|
|
15
|
+
debug: "#3B82F6", // blue
|
|
16
|
+
info: "#10B981", // green
|
|
17
|
+
warn: "#F59E0B", // orange
|
|
18
|
+
error: "#EF4444", // red
|
|
19
|
+
fatal: "#DC2626", // dark red
|
|
20
|
+
};
|
|
21
|
+
const LOG_STYLES = {
|
|
22
|
+
trace: "color: #6B7280",
|
|
23
|
+
debug: "color: #3B82F6; font-weight: bold",
|
|
24
|
+
info: "color: #10B981; font-weight: bold",
|
|
25
|
+
warn: "color: #F59E0B; font-weight: bold",
|
|
26
|
+
error: "color: #EF4444; font-weight: bold",
|
|
27
|
+
fatal: "color: #DC2626; font-weight: bold; background: #FEE2E2",
|
|
28
|
+
};
|
|
29
|
+
export class Logger {
|
|
30
|
+
service;
|
|
31
|
+
minLevel;
|
|
32
|
+
constructor(service, minLevel = "debug") {
|
|
33
|
+
this.service = service;
|
|
34
|
+
this.minLevel = minLevel;
|
|
35
|
+
// In production, suppress trace and debug logs
|
|
36
|
+
if (typeof process !== "undefined" &&
|
|
37
|
+
process.env?.NODE_ENV === "production") {
|
|
38
|
+
this.minLevel = "info";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
shouldLog(level) {
|
|
42
|
+
return LOG_LEVELS[level] >= LOG_LEVELS[this.minLevel];
|
|
43
|
+
}
|
|
44
|
+
log(level, message, metadata) {
|
|
45
|
+
if (!this.shouldLog(level)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const entry = {
|
|
49
|
+
timestamp: new Date().toISOString(),
|
|
50
|
+
level,
|
|
51
|
+
service: this.service,
|
|
52
|
+
message,
|
|
53
|
+
...(metadata && { metadata }),
|
|
54
|
+
};
|
|
55
|
+
// Console output with color-coding
|
|
56
|
+
const style = LOG_STYLES[level];
|
|
57
|
+
const levelUpper = level.toUpperCase().padEnd(5);
|
|
58
|
+
if (typeof console !== "undefined") {
|
|
59
|
+
// Format: [timestamp] [SERVICE] [LEVEL] message
|
|
60
|
+
const prefix = `%c[${entry.timestamp}] [${this.service}] [${levelUpper}]`;
|
|
61
|
+
const msg = metadata ? `${message} %o` : message;
|
|
62
|
+
switch (level) {
|
|
63
|
+
case "trace":
|
|
64
|
+
case "debug":
|
|
65
|
+
case "info":
|
|
66
|
+
console.log(prefix, style, msg, ...(metadata ? [metadata] : []));
|
|
67
|
+
break;
|
|
68
|
+
case "warn":
|
|
69
|
+
console.warn(prefix, style, msg, ...(metadata ? [metadata] : []));
|
|
70
|
+
break;
|
|
71
|
+
case "error":
|
|
72
|
+
case "fatal":
|
|
73
|
+
console.error(prefix, style, msg, ...(metadata ? [metadata] : []));
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Also log the structured JSON for debugging
|
|
78
|
+
if (level === "fatal" || level === "error") {
|
|
79
|
+
console.debug("Structured log:", JSON.stringify(entry));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
trace(message, metadata) {
|
|
83
|
+
this.log("trace", message, metadata);
|
|
84
|
+
}
|
|
85
|
+
debug(message, metadata) {
|
|
86
|
+
this.log("debug", message, metadata);
|
|
87
|
+
}
|
|
88
|
+
info(message, metadata) {
|
|
89
|
+
this.log("info", message, metadata);
|
|
90
|
+
}
|
|
91
|
+
warn(message, metadata) {
|
|
92
|
+
this.log("warn", message, metadata);
|
|
93
|
+
}
|
|
94
|
+
error(message, metadata) {
|
|
95
|
+
this.log("error", message, metadata);
|
|
96
|
+
}
|
|
97
|
+
fatal(message, metadata) {
|
|
98
|
+
this.log("fatal", message, metadata);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Create a logger instance for a service
|
|
103
|
+
* @param service - Service name (e.g., "gui", "http-agent", "tui")
|
|
104
|
+
* @param minLevel - Minimum log level to display (default: "debug")
|
|
105
|
+
*/
|
|
106
|
+
export function createLogger(service, minLevel = "debug") {
|
|
107
|
+
return new Logger(service, minLevel);
|
|
108
|
+
}
|
|
@@ -5,101 +5,184 @@ import { z } from "zod";
|
|
|
5
5
|
/**
|
|
6
6
|
* Display message schema (UI representation of messages)
|
|
7
7
|
*/
|
|
8
|
-
export declare const DisplayMessage: z.ZodObject<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
export declare const DisplayMessage: z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
role: z.ZodEnum<{
|
|
11
|
+
user: "user";
|
|
12
|
+
assistant: "assistant";
|
|
13
|
+
system: "system";
|
|
14
|
+
}>;
|
|
15
|
+
content: z.ZodString;
|
|
16
|
+
timestamp: z.ZodISODateTime;
|
|
17
|
+
isStreaming: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
+
streamingStartTime: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
20
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
id: z.ZodString;
|
|
22
|
+
title: z.ZodString;
|
|
23
|
+
kind: z.ZodEnum<{
|
|
24
|
+
read: "read";
|
|
25
|
+
edit: "edit";
|
|
26
|
+
delete: "delete";
|
|
27
|
+
move: "move";
|
|
28
|
+
search: "search";
|
|
29
|
+
execute: "execute";
|
|
30
|
+
think: "think";
|
|
31
|
+
fetch: "fetch";
|
|
32
|
+
switch_mode: "switch_mode";
|
|
33
|
+
other: "other";
|
|
34
|
+
}>;
|
|
35
|
+
status: z.ZodEnum<{
|
|
36
|
+
pending: "pending";
|
|
37
|
+
in_progress: "in_progress";
|
|
38
|
+
completed: "completed";
|
|
39
|
+
failed: "failed";
|
|
40
|
+
}>;
|
|
41
|
+
locations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
42
|
+
path: z.ZodString;
|
|
43
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
44
|
+
}, z.core.$strip>>>;
|
|
45
|
+
rawInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
46
|
+
rawOutput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
47
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
48
|
+
type: z.ZodLiteral<"content">;
|
|
49
|
+
content: z.ZodObject<{
|
|
50
|
+
type: z.ZodLiteral<"text">;
|
|
51
|
+
text: z.ZodString;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
54
|
+
type: z.ZodLiteral<"text">;
|
|
55
|
+
text: z.ZodString;
|
|
56
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<"diff">;
|
|
58
|
+
path: z.ZodString;
|
|
59
|
+
oldText: z.ZodString;
|
|
60
|
+
newText: z.ZodString;
|
|
61
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
62
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
63
|
+
type: z.ZodLiteral<"terminal">;
|
|
64
|
+
terminalId: z.ZodString;
|
|
65
|
+
}, z.core.$strip>], "type">>>;
|
|
66
|
+
error: z.ZodOptional<z.ZodString>;
|
|
67
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
completedAt: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
tokenUsage: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
71
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
}, z.core.$strip>>;
|
|
74
|
+
}, z.core.$strip>>>;
|
|
75
|
+
}, z.core.$strip>;
|
|
24
76
|
export type DisplayMessage = z.infer<typeof DisplayMessage>;
|
|
25
77
|
/**
|
|
26
78
|
* Input state schema
|
|
27
79
|
*/
|
|
28
|
-
export declare const InputState: z.ZodObject<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
mimeType: z.ZodString;
|
|
39
|
-
},
|
|
40
|
-
z.core.$strip
|
|
41
|
-
>
|
|
42
|
-
>;
|
|
43
|
-
},
|
|
44
|
-
z.core.$strip
|
|
45
|
-
>;
|
|
80
|
+
export declare const InputState: z.ZodObject<{
|
|
81
|
+
value: z.ZodString;
|
|
82
|
+
isSubmitting: z.ZodBoolean;
|
|
83
|
+
attachedFiles: z.ZodArray<z.ZodObject<{
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
path: z.ZodString;
|
|
86
|
+
size: z.ZodNumber;
|
|
87
|
+
mimeType: z.ZodString;
|
|
88
|
+
}, z.core.$strip>>;
|
|
89
|
+
}, z.core.$strip>;
|
|
46
90
|
export type InputState = z.infer<typeof InputState>;
|
|
47
91
|
/**
|
|
48
92
|
* Chat session UI state
|
|
49
93
|
*/
|
|
50
|
-
export declare const ChatSessionState: z.ZodObject<
|
|
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
|
-
>;
|
|
94
|
+
export declare const ChatSessionState: z.ZodObject<{
|
|
95
|
+
sessionId: z.ZodNullable<z.ZodString>;
|
|
96
|
+
isConnected: z.ZodBoolean;
|
|
97
|
+
isStreaming: z.ZodBoolean;
|
|
98
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
99
|
+
id: z.ZodString;
|
|
100
|
+
role: z.ZodEnum<{
|
|
101
|
+
user: "user";
|
|
102
|
+
assistant: "assistant";
|
|
103
|
+
system: "system";
|
|
104
|
+
}>;
|
|
105
|
+
content: z.ZodString;
|
|
106
|
+
timestamp: z.ZodISODateTime;
|
|
107
|
+
isStreaming: z.ZodDefault<z.ZodBoolean>;
|
|
108
|
+
streamingStartTime: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
110
|
+
toolCalls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
111
|
+
id: z.ZodString;
|
|
112
|
+
title: z.ZodString;
|
|
113
|
+
kind: z.ZodEnum<{
|
|
114
|
+
read: "read";
|
|
115
|
+
edit: "edit";
|
|
116
|
+
delete: "delete";
|
|
117
|
+
move: "move";
|
|
118
|
+
search: "search";
|
|
119
|
+
execute: "execute";
|
|
120
|
+
think: "think";
|
|
121
|
+
fetch: "fetch";
|
|
122
|
+
switch_mode: "switch_mode";
|
|
123
|
+
other: "other";
|
|
124
|
+
}>;
|
|
125
|
+
status: z.ZodEnum<{
|
|
126
|
+
pending: "pending";
|
|
127
|
+
in_progress: "in_progress";
|
|
128
|
+
completed: "completed";
|
|
129
|
+
failed: "failed";
|
|
130
|
+
}>;
|
|
131
|
+
locations: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
132
|
+
path: z.ZodString;
|
|
133
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
134
|
+
}, z.core.$strip>>>;
|
|
135
|
+
rawInput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
136
|
+
rawOutput: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
137
|
+
content: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
138
|
+
type: z.ZodLiteral<"content">;
|
|
139
|
+
content: z.ZodObject<{
|
|
140
|
+
type: z.ZodLiteral<"text">;
|
|
141
|
+
text: z.ZodString;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
144
|
+
type: z.ZodLiteral<"text">;
|
|
145
|
+
text: z.ZodString;
|
|
146
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
147
|
+
type: z.ZodLiteral<"diff">;
|
|
148
|
+
path: z.ZodString;
|
|
149
|
+
oldText: z.ZodString;
|
|
150
|
+
newText: z.ZodString;
|
|
151
|
+
line: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
152
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
153
|
+
type: z.ZodLiteral<"terminal">;
|
|
154
|
+
terminalId: z.ZodString;
|
|
155
|
+
}, z.core.$strip>], "type">>>;
|
|
156
|
+
error: z.ZodOptional<z.ZodString>;
|
|
157
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
completedAt: z.ZodOptional<z.ZodNumber>;
|
|
159
|
+
tokenUsage: z.ZodOptional<z.ZodObject<{
|
|
160
|
+
inputTokens: z.ZodOptional<z.ZodNumber>;
|
|
161
|
+
outputTokens: z.ZodOptional<z.ZodNumber>;
|
|
162
|
+
totalTokens: z.ZodOptional<z.ZodNumber>;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
}, z.core.$strip>>>;
|
|
165
|
+
}, z.core.$strip>>;
|
|
166
|
+
input: z.ZodObject<{
|
|
167
|
+
value: z.ZodString;
|
|
168
|
+
isSubmitting: z.ZodBoolean;
|
|
169
|
+
attachedFiles: z.ZodArray<z.ZodObject<{
|
|
170
|
+
name: z.ZodString;
|
|
171
|
+
path: z.ZodString;
|
|
172
|
+
size: z.ZodNumber;
|
|
173
|
+
mimeType: z.ZodString;
|
|
174
|
+
}, z.core.$strip>>;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
error: z.ZodNullable<z.ZodString>;
|
|
177
|
+
}, z.core.$strip>;
|
|
95
178
|
export type ChatSessionState = z.infer<typeof ChatSessionState>;
|
|
96
179
|
/**
|
|
97
180
|
* Connection status
|
|
98
181
|
*/
|
|
99
182
|
export declare const ConnectionStatus: z.ZodEnum<{
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
183
|
+
error: "error";
|
|
184
|
+
connecting: "connecting";
|
|
185
|
+
connected: "connected";
|
|
186
|
+
disconnected: "disconnected";
|
|
104
187
|
}>;
|
|
105
188
|
export type ConnectionStatus = z.infer<typeof ConnectionStatus>;
|