@agent-native/core 0.55.0 → 0.56.0
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 +7 -7
- package/dist/action-ui.d.ts +17 -0
- package/dist/action-ui.d.ts.map +1 -0
- package/dist/action-ui.js +23 -0
- package/dist/action-ui.js.map +1 -0
- package/dist/action.d.ts +8 -1
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +3 -0
- package/dist/action.js.map +1 -1
- package/dist/agent/production-agent.d.ts +2 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +7 -1
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts +4 -0
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +4 -0
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/agent/types.d.ts +2 -0
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +6 -4
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/chat/index.d.ts +5 -3
- package/dist/client/chat/index.d.ts.map +1 -1
- package/dist/client/chat/index.js +4 -3
- package/dist/client/chat/index.js.map +1 -1
- package/dist/client/chat/run-recovery.d.ts.map +1 -1
- package/dist/client/chat/run-recovery.js +9 -5
- package/dist/client/chat/run-recovery.js.map +1 -1
- package/dist/client/chat/runtime.d.ts +354 -0
- package/dist/client/chat/runtime.d.ts.map +1 -0
- package/dist/client/chat/runtime.js +2 -0
- package/dist/client/chat/runtime.js.map +1 -0
- package/dist/client/chat/tool-call-display.d.ts +4 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +6 -5
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/chat/tool-render-registry.d.ts +11 -0
- package/dist/client/chat/tool-render-registry.d.ts.map +1 -1
- package/dist/client/chat/tool-render-registry.js +47 -1
- package/dist/client/chat/tool-render-registry.js.map +1 -1
- package/dist/client/chat/widgets/builtin-tool-renderers.js +73 -18
- package/dist/client/chat/widgets/builtin-tool-renderers.js.map +1 -1
- package/dist/client/chat/widgets/data-widget-types.d.ts +1 -51
- package/dist/client/chat/widgets/data-widget-types.d.ts.map +1 -1
- package/dist/client/chat/widgets/data-widget-types.js +1 -92
- package/dist/client/chat/widgets/data-widget-types.js.map +1 -1
- package/dist/client/chat-view-transition.d.ts +12 -0
- package/dist/client/chat-view-transition.d.ts.map +1 -1
- package/dist/client/chat-view-transition.js +16 -0
- package/dist/client/chat-view-transition.js.map +1 -1
- package/dist/client/index.d.ts +5 -3
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +4 -3
- package/dist/client/index.js.map +1 -1
- package/dist/client/route-state.d.ts.map +1 -1
- package/dist/client/route-state.js +2 -15
- package/dist/client/route-state.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts +3 -0
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +2 -0
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/data-widgets/index.d.ts +326 -0
- package/dist/data-widgets/index.d.ts.map +1 -0
- package/dist/data-widgets/index.js +232 -0
- package/dist/data-widgets/index.js.map +1 -0
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.d.ts.map +1 -1
- package/dist/index.browser.js +2 -0
- package/dist/index.browser.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +160 -0
- package/dist/provider-api/corpus-jobs.d.ts.map +1 -1
- package/dist/provider-api/corpus-jobs.js +44 -0
- package/dist/provider-api/corpus-jobs.js.map +1 -1
- package/dist/provider-api/index.d.ts +39 -0
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/provider-api/index.js +53 -0
- package/dist/provider-api/index.js.map +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +5 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +5 -0
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/styles/agent-native.css +9 -2
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +1 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/actions.md +52 -0
- package/docs/content/components.md +24 -1
- package/docs/content/drop-in-agent.md +9 -2
- package/docs/content/faq.md +5 -4
- package/docs/content/getting-started.md +39 -88
- package/docs/content/key-concepts.md +22 -22
- package/docs/content/mcp-apps.md +1 -1
- package/docs/content/native-chat-ui.md +210 -0
- package/docs/content/what-is-agent-native.md +2 -2
- package/package.json +2 -1
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import type { AgentMcpAppPayload } from "../../mcp-client/app-result.js";
|
|
2
|
+
import type { ActionChatUIConfig } from "../../action-ui.js";
|
|
3
|
+
import type { ReasoningEffort } from "../../shared/reasoning-effort.js";
|
|
4
|
+
export type AgentChatRuntimeId = string;
|
|
5
|
+
export type AgentChatRuntimeSessionId = string;
|
|
6
|
+
export type AgentChatRuntimeTurnId = string;
|
|
7
|
+
export type AgentChatRuntimeMessageId = string;
|
|
8
|
+
export type AgentChatRuntimeToolCallId = string;
|
|
9
|
+
export type AgentChatRuntimeMetadata = Record<string, unknown>;
|
|
10
|
+
export type AgentChatRuntimeAwaitable<T> = T | Promise<T>;
|
|
11
|
+
export type AgentChatRuntimeKind = "agent-native" | "external-agent" | "code-agent" | (string & {});
|
|
12
|
+
export type AgentChatRuntimeRole = "system" | "user" | "assistant" | "tool";
|
|
13
|
+
export interface AgentChatRuntimeContentPartBase<TType extends string = string> {
|
|
14
|
+
readonly type: TType;
|
|
15
|
+
readonly id?: string;
|
|
16
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
17
|
+
}
|
|
18
|
+
export interface AgentChatRuntimeTextPart extends AgentChatRuntimeContentPartBase<"text"> {
|
|
19
|
+
readonly text: string;
|
|
20
|
+
}
|
|
21
|
+
export interface AgentChatRuntimeReasoningPart extends AgentChatRuntimeContentPartBase<"reasoning"> {
|
|
22
|
+
readonly text: string;
|
|
23
|
+
readonly signature?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface AgentChatRuntimeImagePart extends AgentChatRuntimeContentPartBase<"image"> {
|
|
26
|
+
readonly data?: string;
|
|
27
|
+
readonly url?: string;
|
|
28
|
+
readonly mediaType?: string;
|
|
29
|
+
readonly alt?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface AgentChatRuntimeFilePart extends AgentChatRuntimeContentPartBase<"file"> {
|
|
32
|
+
readonly data?: string;
|
|
33
|
+
readonly url?: string;
|
|
34
|
+
readonly mediaType?: string;
|
|
35
|
+
readonly filename?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface AgentChatRuntimeToolCallPart extends AgentChatRuntimeContentPartBase<"tool-call"> {
|
|
38
|
+
readonly toolCallId: AgentChatRuntimeToolCallId;
|
|
39
|
+
readonly toolName: string;
|
|
40
|
+
readonly input?: unknown;
|
|
41
|
+
readonly inputText?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface AgentChatRuntimeToolResultPart extends AgentChatRuntimeContentPartBase<"tool-result"> {
|
|
44
|
+
readonly toolCallId: AgentChatRuntimeToolCallId;
|
|
45
|
+
readonly toolName?: string;
|
|
46
|
+
readonly result?: unknown;
|
|
47
|
+
readonly resultText?: string;
|
|
48
|
+
readonly isError?: boolean;
|
|
49
|
+
readonly mcpApp?: AgentMcpAppPayload;
|
|
50
|
+
readonly chatUI?: ActionChatUIConfig;
|
|
51
|
+
}
|
|
52
|
+
export interface AgentChatRuntimeDataPart extends AgentChatRuntimeContentPartBase<"data"> {
|
|
53
|
+
readonly data: unknown;
|
|
54
|
+
readonly mediaType?: string;
|
|
55
|
+
readonly title?: string;
|
|
56
|
+
}
|
|
57
|
+
export interface AgentChatRuntimeCustomContentPart extends AgentChatRuntimeContentPartBase {
|
|
58
|
+
readonly [key: string]: unknown;
|
|
59
|
+
}
|
|
60
|
+
export type AgentChatRuntimeKnownContentPart = AgentChatRuntimeTextPart | AgentChatRuntimeReasoningPart | AgentChatRuntimeImagePart | AgentChatRuntimeFilePart | AgentChatRuntimeToolCallPart | AgentChatRuntimeToolResultPart | AgentChatRuntimeDataPart;
|
|
61
|
+
export type AgentChatRuntimeContentPart<TCustomPart extends AgentChatRuntimeCustomContentPart = never> = AgentChatRuntimeKnownContentPart | TCustomPart;
|
|
62
|
+
export interface AgentChatRuntimeMessage<TContentPart extends AgentChatRuntimeContentPartBase = AgentChatRuntimeKnownContentPart> {
|
|
63
|
+
readonly id: AgentChatRuntimeMessageId;
|
|
64
|
+
readonly role: AgentChatRuntimeRole;
|
|
65
|
+
readonly content: readonly TContentPart[];
|
|
66
|
+
readonly createdAt?: string;
|
|
67
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
68
|
+
}
|
|
69
|
+
export interface AgentChatRuntimeAttachment {
|
|
70
|
+
readonly id?: string;
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly mediaType?: string;
|
|
73
|
+
readonly data?: string;
|
|
74
|
+
readonly url?: string;
|
|
75
|
+
readonly text?: string;
|
|
76
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
77
|
+
}
|
|
78
|
+
export interface AgentChatRuntimeToolDefinition {
|
|
79
|
+
readonly name: string;
|
|
80
|
+
readonly description?: string;
|
|
81
|
+
readonly inputSchema?: Record<string, unknown>;
|
|
82
|
+
readonly readOnly?: boolean;
|
|
83
|
+
readonly destructive?: boolean;
|
|
84
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
85
|
+
}
|
|
86
|
+
export interface AgentChatRuntimeToolCall {
|
|
87
|
+
readonly id: AgentChatRuntimeToolCallId;
|
|
88
|
+
readonly name: string;
|
|
89
|
+
readonly input?: unknown;
|
|
90
|
+
readonly inputText?: string;
|
|
91
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
92
|
+
}
|
|
93
|
+
export type AgentChatRuntimeToolStatus = "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
94
|
+
export interface AgentChatRuntimeUsage {
|
|
95
|
+
readonly inputTokens?: number;
|
|
96
|
+
readonly outputTokens?: number;
|
|
97
|
+
readonly totalTokens?: number;
|
|
98
|
+
readonly reasoningTokens?: number;
|
|
99
|
+
readonly cacheReadTokens?: number;
|
|
100
|
+
readonly cacheWriteTokens?: number;
|
|
101
|
+
readonly costCents?: number;
|
|
102
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
103
|
+
}
|
|
104
|
+
export interface AgentChatRuntimeMessageCapabilities {
|
|
105
|
+
readonly streaming: boolean;
|
|
106
|
+
readonly history?: boolean;
|
|
107
|
+
readonly structuredContent?: boolean;
|
|
108
|
+
readonly multimodal?: boolean;
|
|
109
|
+
readonly attachments?: boolean;
|
|
110
|
+
}
|
|
111
|
+
export interface AgentChatRuntimeToolCapabilities {
|
|
112
|
+
readonly events: boolean;
|
|
113
|
+
readonly hostTools?: boolean;
|
|
114
|
+
readonly inputStreaming?: boolean;
|
|
115
|
+
readonly resultStreaming?: boolean;
|
|
116
|
+
readonly approvals?: boolean;
|
|
117
|
+
readonly mcpApps?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export interface AgentChatRuntimeSessionCapabilities {
|
|
120
|
+
readonly create: boolean;
|
|
121
|
+
readonly restore?: boolean;
|
|
122
|
+
readonly list?: boolean;
|
|
123
|
+
readonly fork?: boolean;
|
|
124
|
+
readonly detach?: boolean;
|
|
125
|
+
readonly persistent?: boolean;
|
|
126
|
+
}
|
|
127
|
+
export interface AgentChatRuntimeCancellationCapabilities {
|
|
128
|
+
readonly abortSignal?: boolean;
|
|
129
|
+
readonly explicitCancel?: boolean;
|
|
130
|
+
readonly interrupt?: boolean;
|
|
131
|
+
}
|
|
132
|
+
export interface AgentChatRuntimeModelCapabilities {
|
|
133
|
+
readonly selectable?: boolean;
|
|
134
|
+
readonly reasoningEffort?: boolean;
|
|
135
|
+
readonly temperature?: boolean;
|
|
136
|
+
readonly providerOptions?: boolean;
|
|
137
|
+
}
|
|
138
|
+
export interface AgentChatRuntimeArtifactCapabilities {
|
|
139
|
+
readonly files?: boolean;
|
|
140
|
+
readonly links?: boolean;
|
|
141
|
+
readonly patches?: boolean;
|
|
142
|
+
readonly progress?: boolean;
|
|
143
|
+
}
|
|
144
|
+
export interface AgentChatRuntimeCapabilities {
|
|
145
|
+
readonly messages: AgentChatRuntimeMessageCapabilities;
|
|
146
|
+
readonly tools?: AgentChatRuntimeToolCapabilities;
|
|
147
|
+
readonly sessions?: AgentChatRuntimeSessionCapabilities;
|
|
148
|
+
readonly cancellation?: AgentChatRuntimeCancellationCapabilities;
|
|
149
|
+
readonly models?: AgentChatRuntimeModelCapabilities;
|
|
150
|
+
readonly artifacts?: AgentChatRuntimeArtifactCapabilities;
|
|
151
|
+
readonly custom?: AgentChatRuntimeMetadata;
|
|
152
|
+
}
|
|
153
|
+
export interface AgentChatRuntimeCreateSessionInput {
|
|
154
|
+
readonly id?: AgentChatRuntimeSessionId;
|
|
155
|
+
readonly threadId?: string;
|
|
156
|
+
readonly title?: string;
|
|
157
|
+
readonly messages?: readonly AgentChatRuntimeMessage[];
|
|
158
|
+
readonly resumeState?: unknown;
|
|
159
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
160
|
+
readonly abortSignal?: AbortSignal;
|
|
161
|
+
}
|
|
162
|
+
export interface AgentChatRuntimeListSessionsInput {
|
|
163
|
+
readonly threadId?: string;
|
|
164
|
+
readonly limit?: number;
|
|
165
|
+
readonly cursor?: string;
|
|
166
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
167
|
+
readonly abortSignal?: AbortSignal;
|
|
168
|
+
}
|
|
169
|
+
export type AgentChatRuntimeSessionStatus = "idle" | "running" | "waiting" | "cancelled" | "completed" | "error";
|
|
170
|
+
export interface AgentChatRuntimeSessionSummary {
|
|
171
|
+
readonly id: AgentChatRuntimeSessionId;
|
|
172
|
+
readonly runtimeId: AgentChatRuntimeId;
|
|
173
|
+
readonly threadId?: string;
|
|
174
|
+
readonly title?: string;
|
|
175
|
+
readonly status?: AgentChatRuntimeSessionStatus;
|
|
176
|
+
readonly createdAt?: string;
|
|
177
|
+
readonly updatedAt?: string;
|
|
178
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
179
|
+
}
|
|
180
|
+
export interface AgentChatRuntimeSessionSnapshot extends AgentChatRuntimeSessionSummary {
|
|
181
|
+
readonly messages?: readonly AgentChatRuntimeMessage[];
|
|
182
|
+
readonly resumeState?: unknown;
|
|
183
|
+
}
|
|
184
|
+
export interface AgentChatRuntimeTurnInput {
|
|
185
|
+
readonly prompt?: string;
|
|
186
|
+
readonly messages?: readonly AgentChatRuntimeMessage[];
|
|
187
|
+
readonly attachments?: readonly AgentChatRuntimeAttachment[];
|
|
188
|
+
readonly tools?: readonly AgentChatRuntimeToolDefinition[];
|
|
189
|
+
readonly model?: string;
|
|
190
|
+
readonly reasoningEffort?: ReasoningEffort;
|
|
191
|
+
readonly temperature?: number;
|
|
192
|
+
readonly providerOptions?: Record<string, unknown>;
|
|
193
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
194
|
+
readonly abortSignal?: AbortSignal;
|
|
195
|
+
}
|
|
196
|
+
export interface AgentChatRuntimeApprovalResponse {
|
|
197
|
+
readonly id: string;
|
|
198
|
+
readonly approved: boolean;
|
|
199
|
+
readonly message?: string;
|
|
200
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
201
|
+
}
|
|
202
|
+
export interface AgentChatRuntimeContinueInput {
|
|
203
|
+
readonly turnId?: AgentChatRuntimeTurnId;
|
|
204
|
+
readonly prompt?: string;
|
|
205
|
+
readonly approval?: AgentChatRuntimeApprovalResponse;
|
|
206
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
207
|
+
readonly abortSignal?: AbortSignal;
|
|
208
|
+
}
|
|
209
|
+
export interface AgentChatRuntimeCancelInput {
|
|
210
|
+
readonly turnId?: AgentChatRuntimeTurnId;
|
|
211
|
+
readonly reason?: string;
|
|
212
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
213
|
+
readonly abortSignal?: AbortSignal;
|
|
214
|
+
}
|
|
215
|
+
export type AgentChatRuntimeCancelStatus = "cancelled" | "not-found" | "already-finished" | "unsupported";
|
|
216
|
+
export interface AgentChatRuntimeCancelResult {
|
|
217
|
+
readonly status: AgentChatRuntimeCancelStatus;
|
|
218
|
+
readonly message?: string;
|
|
219
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
220
|
+
}
|
|
221
|
+
export interface AgentChatRuntimeEventBase<TType extends string = string> {
|
|
222
|
+
readonly type: TType;
|
|
223
|
+
readonly id?: string;
|
|
224
|
+
readonly sessionId?: AgentChatRuntimeSessionId;
|
|
225
|
+
readonly turnId?: AgentChatRuntimeTurnId;
|
|
226
|
+
readonly timestamp?: string;
|
|
227
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
228
|
+
}
|
|
229
|
+
export interface AgentChatRuntimeMessageStartEvent extends AgentChatRuntimeEventBase<"message-start"> {
|
|
230
|
+
readonly message: AgentChatRuntimeMessage;
|
|
231
|
+
}
|
|
232
|
+
export type AgentChatRuntimeMessageDelta = {
|
|
233
|
+
readonly type: "text";
|
|
234
|
+
readonly text: string;
|
|
235
|
+
readonly partId?: string;
|
|
236
|
+
} | {
|
|
237
|
+
readonly type: "reasoning";
|
|
238
|
+
readonly text: string;
|
|
239
|
+
readonly partId?: string;
|
|
240
|
+
readonly signature?: string;
|
|
241
|
+
} | {
|
|
242
|
+
readonly type: "data";
|
|
243
|
+
readonly data: unknown;
|
|
244
|
+
readonly partId?: string;
|
|
245
|
+
readonly mediaType?: string;
|
|
246
|
+
};
|
|
247
|
+
export interface AgentChatRuntimeMessageDeltaEvent extends AgentChatRuntimeEventBase<"message-delta"> {
|
|
248
|
+
readonly messageId: AgentChatRuntimeMessageId;
|
|
249
|
+
readonly delta: AgentChatRuntimeMessageDelta;
|
|
250
|
+
}
|
|
251
|
+
export interface AgentChatRuntimeMessageDoneEvent extends AgentChatRuntimeEventBase<"message-done"> {
|
|
252
|
+
readonly message: AgentChatRuntimeMessage;
|
|
253
|
+
}
|
|
254
|
+
export interface AgentChatRuntimeToolStartEvent extends AgentChatRuntimeEventBase<"tool-start"> {
|
|
255
|
+
readonly toolCall: AgentChatRuntimeToolCall;
|
|
256
|
+
}
|
|
257
|
+
export interface AgentChatRuntimeToolDeltaEvent extends AgentChatRuntimeEventBase<"tool-delta"> {
|
|
258
|
+
readonly toolCallId: AgentChatRuntimeToolCallId;
|
|
259
|
+
readonly toolName?: string;
|
|
260
|
+
readonly inputTextDelta?: string;
|
|
261
|
+
readonly resultTextDelta?: string;
|
|
262
|
+
}
|
|
263
|
+
export interface AgentChatRuntimeToolDoneEvent extends AgentChatRuntimeEventBase<"tool-done"> {
|
|
264
|
+
readonly toolCallId: AgentChatRuntimeToolCallId;
|
|
265
|
+
readonly toolName: string;
|
|
266
|
+
readonly status: AgentChatRuntimeToolStatus;
|
|
267
|
+
readonly result?: unknown;
|
|
268
|
+
readonly resultText?: string;
|
|
269
|
+
readonly error?: string;
|
|
270
|
+
readonly mcpApp?: AgentMcpAppPayload;
|
|
271
|
+
}
|
|
272
|
+
export interface AgentChatRuntimeApprovalRequestEvent extends AgentChatRuntimeEventBase<"approval-request"> {
|
|
273
|
+
readonly approvalId: string;
|
|
274
|
+
readonly toolCallId?: AgentChatRuntimeToolCallId;
|
|
275
|
+
readonly toolName?: string;
|
|
276
|
+
readonly message: string;
|
|
277
|
+
readonly input?: unknown;
|
|
278
|
+
}
|
|
279
|
+
export interface AgentChatRuntimeApprovalResolvedEvent extends AgentChatRuntimeEventBase<"approval-resolved"> {
|
|
280
|
+
readonly approvalId: string;
|
|
281
|
+
readonly approved: boolean;
|
|
282
|
+
readonly message?: string;
|
|
283
|
+
}
|
|
284
|
+
export interface AgentChatRuntimeStatusEvent extends AgentChatRuntimeEventBase<"status"> {
|
|
285
|
+
readonly level?: "info" | "warning" | "error";
|
|
286
|
+
readonly message: string;
|
|
287
|
+
readonly code?: string;
|
|
288
|
+
}
|
|
289
|
+
export interface AgentChatRuntimeArtifactEvent extends AgentChatRuntimeEventBase<"artifact"> {
|
|
290
|
+
readonly artifact: {
|
|
291
|
+
readonly id?: string;
|
|
292
|
+
readonly kind: string;
|
|
293
|
+
readonly title?: string;
|
|
294
|
+
readonly url?: string;
|
|
295
|
+
readonly path?: string;
|
|
296
|
+
readonly data?: unknown;
|
|
297
|
+
readonly metadata?: AgentChatRuntimeMetadata;
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
export interface AgentChatRuntimeFileEvent extends AgentChatRuntimeEventBase<"file"> {
|
|
301
|
+
readonly path: string;
|
|
302
|
+
readonly operation?: "create" | "update" | "delete" | "rename" | "unknown";
|
|
303
|
+
readonly summary?: string;
|
|
304
|
+
}
|
|
305
|
+
export interface AgentChatRuntimeUsageEvent extends AgentChatRuntimeEventBase<"usage"> {
|
|
306
|
+
readonly usage: AgentChatRuntimeUsage;
|
|
307
|
+
}
|
|
308
|
+
export interface AgentChatRuntimeErrorEvent extends AgentChatRuntimeEventBase<"error"> {
|
|
309
|
+
readonly error: string;
|
|
310
|
+
readonly code?: string;
|
|
311
|
+
readonly recoverable?: boolean;
|
|
312
|
+
readonly cause?: unknown;
|
|
313
|
+
}
|
|
314
|
+
export type AgentChatRuntimeDoneReason = "complete" | "cancelled" | "error" | "interrupted" | "length" | "tool-use" | (string & {});
|
|
315
|
+
export interface AgentChatRuntimeDoneEvent extends AgentChatRuntimeEventBase<"done"> {
|
|
316
|
+
readonly reason?: AgentChatRuntimeDoneReason;
|
|
317
|
+
}
|
|
318
|
+
export interface AgentChatRuntimeCustomEvent extends AgentChatRuntimeEventBase {
|
|
319
|
+
readonly [key: string]: unknown;
|
|
320
|
+
}
|
|
321
|
+
export type AgentChatRuntimeKnownEvent = AgentChatRuntimeMessageStartEvent | AgentChatRuntimeMessageDeltaEvent | AgentChatRuntimeMessageDoneEvent | AgentChatRuntimeToolStartEvent | AgentChatRuntimeToolDeltaEvent | AgentChatRuntimeToolDoneEvent | AgentChatRuntimeApprovalRequestEvent | AgentChatRuntimeApprovalResolvedEvent | AgentChatRuntimeStatusEvent | AgentChatRuntimeArtifactEvent | AgentChatRuntimeFileEvent | AgentChatRuntimeUsageEvent | AgentChatRuntimeErrorEvent | AgentChatRuntimeDoneEvent;
|
|
322
|
+
export type AgentChatRuntimeEvent<TCustomEvent extends AgentChatRuntimeCustomEvent = never> = AgentChatRuntimeKnownEvent | TCustomEvent;
|
|
323
|
+
export interface AgentChatRuntimeTurn<TEvent extends AgentChatRuntimeEventBase = AgentChatRuntimeKnownEvent> {
|
|
324
|
+
readonly id?: AgentChatRuntimeTurnId;
|
|
325
|
+
readonly sessionId: AgentChatRuntimeSessionId;
|
|
326
|
+
readonly events: AsyncIterable<TEvent>;
|
|
327
|
+
cancel?(input?: AgentChatRuntimeCancelInput): Promise<AgentChatRuntimeCancelResult>;
|
|
328
|
+
}
|
|
329
|
+
export interface AgentChatRuntimeSession<TEvent extends AgentChatRuntimeEventBase = AgentChatRuntimeKnownEvent> {
|
|
330
|
+
readonly id: AgentChatRuntimeSessionId;
|
|
331
|
+
readonly runtimeId: AgentChatRuntimeId;
|
|
332
|
+
readonly threadId?: string;
|
|
333
|
+
readonly capabilities?: Partial<AgentChatRuntimeCapabilities>;
|
|
334
|
+
startTurn(input: AgentChatRuntimeTurnInput): AgentChatRuntimeAwaitable<AgentChatRuntimeTurn<TEvent>>;
|
|
335
|
+
continueTurn?(input?: AgentChatRuntimeContinueInput): AgentChatRuntimeAwaitable<AgentChatRuntimeTurn<TEvent>>;
|
|
336
|
+
cancelTurn?(input?: AgentChatRuntimeCancelInput): Promise<AgentChatRuntimeCancelResult>;
|
|
337
|
+
snapshot?(): AgentChatRuntimeAwaitable<AgentChatRuntimeSessionSnapshot>;
|
|
338
|
+
dispose?(): AgentChatRuntimeAwaitable<void>;
|
|
339
|
+
}
|
|
340
|
+
export interface AgentChatRuntime<TEvent extends AgentChatRuntimeEventBase = AgentChatRuntimeKnownEvent> {
|
|
341
|
+
readonly id: AgentChatRuntimeId;
|
|
342
|
+
readonly kind: AgentChatRuntimeKind;
|
|
343
|
+
readonly label: string;
|
|
344
|
+
readonly description?: string;
|
|
345
|
+
readonly capabilities: AgentChatRuntimeCapabilities;
|
|
346
|
+
createSession(input?: AgentChatRuntimeCreateSessionInput): AgentChatRuntimeAwaitable<AgentChatRuntimeSession<TEvent>>;
|
|
347
|
+
restoreSession?(snapshot: AgentChatRuntimeSessionSnapshot): AgentChatRuntimeAwaitable<AgentChatRuntimeSession<TEvent>>;
|
|
348
|
+
getSession?(input: {
|
|
349
|
+
readonly sessionId: AgentChatRuntimeSessionId;
|
|
350
|
+
readonly abortSignal?: AbortSignal;
|
|
351
|
+
}): AgentChatRuntimeAwaitable<AgentChatRuntimeSession<TEvent> | null>;
|
|
352
|
+
listSessions?(input?: AgentChatRuntimeListSessionsInput): AgentChatRuntimeAwaitable<readonly AgentChatRuntimeSessionSummary[]>;
|
|
353
|
+
}
|
|
354
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/client/chat/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAExE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACxC,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAC/C,MAAM,MAAM,sBAAsB,G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AAC,CAAC;CACzE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/client/chat/runtime.ts"],"names":[],"mappings":"","sourcesContent":["import type { AgentMcpAppPayload } from \"../../mcp-client/app-result.js\";\nimport type { ActionChatUIConfig } from \"../../action-ui.js\";\nimport type { ReasoningEffort } from \"../../shared/reasoning-effort.js\";\n\nexport type AgentChatRuntimeId = string;\nexport type AgentChatRuntimeSessionId = string;\nexport type AgentChatRuntimeTurnId = string;\nexport type AgentChatRuntimeMessageId = string;\nexport type AgentChatRuntimeToolCallId = string;\nexport type AgentChatRuntimeMetadata = Record<string, unknown>;\nexport type AgentChatRuntimeAwaitable<T> = T | Promise<T>;\n\nexport type AgentChatRuntimeKind =\n | \"agent-native\"\n | \"external-agent\"\n | \"code-agent\"\n | (string & {});\n\nexport type AgentChatRuntimeRole = \"system\" | \"user\" | \"assistant\" | \"tool\";\n\nexport interface AgentChatRuntimeContentPartBase<\n TType extends string = string,\n> {\n readonly type: TType;\n readonly id?: string;\n readonly metadata?: AgentChatRuntimeMetadata;\n}\n\nexport interface AgentChatRuntimeTextPart extends AgentChatRuntimeContentPartBase<\"text\"> {\n readonly text: string;\n}\n\nexport interface AgentChatRuntimeReasoningPart extends AgentChatRuntimeContentPartBase<\"reasoning\"> {\n readonly text: string;\n readonly signature?: string;\n}\n\nexport interface AgentChatRuntimeImagePart extends AgentChatRuntimeContentPartBase<\"image\"> {\n readonly data?: string;\n readonly url?: string;\n readonly mediaType?: string;\n readonly alt?: string;\n}\n\nexport interface AgentChatRuntimeFilePart extends AgentChatRuntimeContentPartBase<\"file\"> {\n readonly data?: string;\n readonly url?: string;\n readonly mediaType?: string;\n readonly filename?: string;\n}\n\nexport interface AgentChatRuntimeToolCallPart extends AgentChatRuntimeContentPartBase<\"tool-call\"> {\n readonly toolCallId: AgentChatRuntimeToolCallId;\n readonly toolName: string;\n readonly input?: unknown;\n readonly inputText?: string;\n}\n\nexport interface AgentChatRuntimeToolResultPart extends AgentChatRuntimeContentPartBase<\"tool-result\"> {\n readonly toolCallId: AgentChatRuntimeToolCallId;\n readonly toolName?: string;\n readonly result?: unknown;\n readonly resultText?: string;\n readonly isError?: boolean;\n readonly mcpApp?: AgentMcpAppPayload;\n readonly chatUI?: ActionChatUIConfig;\n}\n\nexport interface AgentChatRuntimeDataPart extends AgentChatRuntimeContentPartBase<\"data\"> {\n readonly data: unknown;\n readonly mediaType?: string;\n readonly title?: string;\n}\n\nexport interface AgentChatRuntimeCustomContentPart extends AgentChatRuntimeContentPartBase {\n readonly [key: string]: unknown;\n}\n\nexport type AgentChatRuntimeKnownContentPart =\n | AgentChatRuntimeTextPart\n | AgentChatRuntimeReasoningPart\n | AgentChatRuntimeImagePart\n | AgentChatRuntimeFilePart\n | AgentChatRuntimeToolCallPart\n | AgentChatRuntimeToolResultPart\n | AgentChatRuntimeDataPart;\n\nexport type AgentChatRuntimeContentPart<\n TCustomPart extends AgentChatRuntimeCustomContentPart = never,\n> = AgentChatRuntimeKnownContentPart | TCustomPart;\n\nexport interface AgentChatRuntimeMessage<\n TContentPart extends AgentChatRuntimeContentPartBase =\n AgentChatRuntimeKnownContentPart,\n> {\n readonly id: AgentChatRuntimeMessageId;\n readonly role: AgentChatRuntimeRole;\n readonly content: readonly TContentPart[];\n readonly createdAt?: string;\n readonly metadata?: AgentChatRuntimeMetadata;\n}\n\nexport interface AgentChatRuntimeAttachment {\n readonly id?: string;\n readonly name: string;\n readonly mediaType?: string;\n readonly data?: string;\n readonly url?: string;\n readonly text?: string;\n readonly metadata?: AgentChatRuntimeMetadata;\n}\n\nexport interface AgentChatRuntimeToolDefinition {\n readonly name: string;\n readonly description?: string;\n readonly inputSchema?: Record<string, unknown>;\n readonly readOnly?: boolean;\n readonly destructive?: boolean;\n readonly metadata?: AgentChatRuntimeMetadata;\n}\n\nexport interface AgentChatRuntimeToolCall {\n readonly id: AgentChatRuntimeToolCallId;\n readonly name: string;\n readonly input?: unknown;\n readonly inputText?: string;\n readonly metadata?: AgentChatRuntimeMetadata;\n}\n\nexport type AgentChatRuntimeToolStatus =\n | \"pending\"\n | \"running\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\";\n\nexport interface AgentChatRuntimeUsage {\n readonly inputTokens?: number;\n readonly outputTokens?: number;\n readonly totalTokens?: number;\n readonly reasoningTokens?: number;\n readonly cacheReadTokens?: number;\n readonly cacheWriteTokens?: number;\n readonly costCents?: number;\n readonly metadata?: AgentChatRuntimeMetadata;\n}\n\nexport interface AgentChatRuntimeMessageCapabilities {\n readonly streaming: boolean;\n readonly history?: boolean;\n readonly structuredContent?: boolean;\n readonly multimodal?: boolean;\n readonly attachments?: boolean;\n}\n\nexport interface AgentChatRuntimeToolCapabilities {\n readonly events: boolean;\n readonly hostTools?: boolean;\n readonly inputStreaming?: boolean;\n readonly resultStreaming?: boolean;\n readonly approvals?: boolean;\n readonly mcpApps?: boolean;\n}\n\nexport interface AgentChatRuntimeSessionCapabilities {\n readonly create: boolean;\n readonly restore?: boolean;\n readonly list?: boolean;\n readonly fork?: boolean;\n readonly detach?: boolean;\n readonly persistent?: boolean;\n}\n\nexport interface AgentChatRuntimeCancellationCapabilities {\n readonly abortSignal?: boolean;\n readonly explicitCancel?: boolean;\n readonly interrupt?: boolean;\n}\n\nexport interface AgentChatRuntimeModelCapabilities {\n readonly selectable?: boolean;\n readonly reasoningEffort?: boolean;\n readonly temperature?: boolean;\n readonly providerOptions?: boolean;\n}\n\nexport interface AgentChatRuntimeArtifactCapabilities {\n readonly files?: boolean;\n readonly links?: boolean;\n readonly patches?: boolean;\n readonly progress?: boolean;\n}\n\nexport interface AgentChatRuntimeCapabilities {\n readonly messages: AgentChatRuntimeMessageCapabilities;\n readonly tools?: AgentChatRuntimeToolCapabilities;\n readonly sessions?: AgentChatRuntimeSessionCapabilities;\n readonly cancellation?: AgentChatRuntimeCancellationCapabilities;\n readonly models?: AgentChatRuntimeModelCapabilities;\n readonly artifacts?: AgentChatRuntimeArtifactCapabilities;\n readonly custom?: AgentChatRuntimeMetadata;\n}\n\nexport interface AgentChatRuntimeCreateSessionInput {\n readonly id?: AgentChatRuntimeSessionId;\n readonly threadId?: string;\n readonly title?: string;\n readonly messages?: readonly AgentChatRuntimeMessage[];\n readonly resumeState?: unknown;\n readonly metadata?: AgentChatRuntimeMetadata;\n readonly abortSignal?: AbortSignal;\n}\n\nexport interface AgentChatRuntimeListSessionsInput {\n readonly threadId?: string;\n readonly limit?: number;\n readonly cursor?: string;\n readonly metadata?: AgentChatRuntimeMetadata;\n readonly abortSignal?: AbortSignal;\n}\n\nexport type AgentChatRuntimeSessionStatus =\n | \"idle\"\n | \"running\"\n | \"waiting\"\n | \"cancelled\"\n | \"completed\"\n | \"error\";\n\nexport interface AgentChatRuntimeSessionSummary {\n readonly id: AgentChatRuntimeSessionId;\n readonly runtimeId: AgentChatRuntimeId;\n readonly threadId?: string;\n readonly title?: string;\n readonly status?: AgentChatRuntimeSessionStatus;\n readonly createdAt?: string;\n readonly updatedAt?: string;\n readonly metadata?: AgentChatRuntimeMetadata;\n}\n\nexport interface AgentChatRuntimeSessionSnapshot extends AgentChatRuntimeSessionSummary {\n readonly messages?: readonly AgentChatRuntimeMessage[];\n readonly resumeState?: unknown;\n}\n\nexport interface AgentChatRuntimeTurnInput {\n readonly prompt?: string;\n readonly messages?: readonly AgentChatRuntimeMessage[];\n readonly attachments?: readonly AgentChatRuntimeAttachment[];\n readonly tools?: readonly AgentChatRuntimeToolDefinition[];\n readonly model?: string;\n readonly reasoningEffort?: ReasoningEffort;\n readonly temperature?: number;\n readonly providerOptions?: Record<string, unknown>;\n readonly metadata?: AgentChatRuntimeMetadata;\n readonly abortSignal?: AbortSignal;\n}\n\nexport interface AgentChatRuntimeApprovalResponse {\n readonly id: string;\n readonly approved: boolean;\n readonly message?: string;\n readonly metadata?: AgentChatRuntimeMetadata;\n}\n\nexport interface AgentChatRuntimeContinueInput {\n readonly turnId?: AgentChatRuntimeTurnId;\n readonly prompt?: string;\n readonly approval?: AgentChatRuntimeApprovalResponse;\n readonly metadata?: AgentChatRuntimeMetadata;\n readonly abortSignal?: AbortSignal;\n}\n\nexport interface AgentChatRuntimeCancelInput {\n readonly turnId?: AgentChatRuntimeTurnId;\n readonly reason?: string;\n readonly metadata?: AgentChatRuntimeMetadata;\n readonly abortSignal?: AbortSignal;\n}\n\nexport type AgentChatRuntimeCancelStatus =\n | \"cancelled\"\n | \"not-found\"\n | \"already-finished\"\n | \"unsupported\";\n\nexport interface AgentChatRuntimeCancelResult {\n readonly status: AgentChatRuntimeCancelStatus;\n readonly message?: string;\n readonly metadata?: AgentChatRuntimeMetadata;\n}\n\nexport interface AgentChatRuntimeEventBase<TType extends string = string> {\n readonly type: TType;\n readonly id?: string;\n readonly sessionId?: AgentChatRuntimeSessionId;\n readonly turnId?: AgentChatRuntimeTurnId;\n readonly timestamp?: string;\n readonly metadata?: AgentChatRuntimeMetadata;\n}\n\nexport interface AgentChatRuntimeMessageStartEvent extends AgentChatRuntimeEventBase<\"message-start\"> {\n readonly message: AgentChatRuntimeMessage;\n}\n\nexport type AgentChatRuntimeMessageDelta =\n | {\n readonly type: \"text\";\n readonly text: string;\n readonly partId?: string;\n }\n | {\n readonly type: \"reasoning\";\n readonly text: string;\n readonly partId?: string;\n readonly signature?: string;\n }\n | {\n readonly type: \"data\";\n readonly data: unknown;\n readonly partId?: string;\n readonly mediaType?: string;\n };\n\nexport interface AgentChatRuntimeMessageDeltaEvent extends AgentChatRuntimeEventBase<\"message-delta\"> {\n readonly messageId: AgentChatRuntimeMessageId;\n readonly delta: AgentChatRuntimeMessageDelta;\n}\n\nexport interface AgentChatRuntimeMessageDoneEvent extends AgentChatRuntimeEventBase<\"message-done\"> {\n readonly message: AgentChatRuntimeMessage;\n}\n\nexport interface AgentChatRuntimeToolStartEvent extends AgentChatRuntimeEventBase<\"tool-start\"> {\n readonly toolCall: AgentChatRuntimeToolCall;\n}\n\nexport interface AgentChatRuntimeToolDeltaEvent extends AgentChatRuntimeEventBase<\"tool-delta\"> {\n readonly toolCallId: AgentChatRuntimeToolCallId;\n readonly toolName?: string;\n readonly inputTextDelta?: string;\n readonly resultTextDelta?: string;\n}\n\nexport interface AgentChatRuntimeToolDoneEvent extends AgentChatRuntimeEventBase<\"tool-done\"> {\n readonly toolCallId: AgentChatRuntimeToolCallId;\n readonly toolName: string;\n readonly status: AgentChatRuntimeToolStatus;\n readonly result?: unknown;\n readonly resultText?: string;\n readonly error?: string;\n readonly mcpApp?: AgentMcpAppPayload;\n}\n\nexport interface AgentChatRuntimeApprovalRequestEvent extends AgentChatRuntimeEventBase<\"approval-request\"> {\n readonly approvalId: string;\n readonly toolCallId?: AgentChatRuntimeToolCallId;\n readonly toolName?: string;\n readonly message: string;\n readonly input?: unknown;\n}\n\nexport interface AgentChatRuntimeApprovalResolvedEvent extends AgentChatRuntimeEventBase<\"approval-resolved\"> {\n readonly approvalId: string;\n readonly approved: boolean;\n readonly message?: string;\n}\n\nexport interface AgentChatRuntimeStatusEvent extends AgentChatRuntimeEventBase<\"status\"> {\n readonly level?: \"info\" | \"warning\" | \"error\";\n readonly message: string;\n readonly code?: string;\n}\n\nexport interface AgentChatRuntimeArtifactEvent extends AgentChatRuntimeEventBase<\"artifact\"> {\n readonly artifact: {\n readonly id?: string;\n readonly kind: string;\n readonly title?: string;\n readonly url?: string;\n readonly path?: string;\n readonly data?: unknown;\n readonly metadata?: AgentChatRuntimeMetadata;\n };\n}\n\nexport interface AgentChatRuntimeFileEvent extends AgentChatRuntimeEventBase<\"file\"> {\n readonly path: string;\n readonly operation?: \"create\" | \"update\" | \"delete\" | \"rename\" | \"unknown\";\n readonly summary?: string;\n}\n\nexport interface AgentChatRuntimeUsageEvent extends AgentChatRuntimeEventBase<\"usage\"> {\n readonly usage: AgentChatRuntimeUsage;\n}\n\nexport interface AgentChatRuntimeErrorEvent extends AgentChatRuntimeEventBase<\"error\"> {\n readonly error: string;\n readonly code?: string;\n readonly recoverable?: boolean;\n readonly cause?: unknown;\n}\n\nexport type AgentChatRuntimeDoneReason =\n | \"complete\"\n | \"cancelled\"\n | \"error\"\n | \"interrupted\"\n | \"length\"\n | \"tool-use\"\n | (string & {});\n\nexport interface AgentChatRuntimeDoneEvent extends AgentChatRuntimeEventBase<\"done\"> {\n readonly reason?: AgentChatRuntimeDoneReason;\n}\n\nexport interface AgentChatRuntimeCustomEvent extends AgentChatRuntimeEventBase {\n readonly [key: string]: unknown;\n}\n\nexport type AgentChatRuntimeKnownEvent =\n | AgentChatRuntimeMessageStartEvent\n | AgentChatRuntimeMessageDeltaEvent\n | AgentChatRuntimeMessageDoneEvent\n | AgentChatRuntimeToolStartEvent\n | AgentChatRuntimeToolDeltaEvent\n | AgentChatRuntimeToolDoneEvent\n | AgentChatRuntimeApprovalRequestEvent\n | AgentChatRuntimeApprovalResolvedEvent\n | AgentChatRuntimeStatusEvent\n | AgentChatRuntimeArtifactEvent\n | AgentChatRuntimeFileEvent\n | AgentChatRuntimeUsageEvent\n | AgentChatRuntimeErrorEvent\n | AgentChatRuntimeDoneEvent;\n\nexport type AgentChatRuntimeEvent<\n TCustomEvent extends AgentChatRuntimeCustomEvent = never,\n> = AgentChatRuntimeKnownEvent | TCustomEvent;\n\nexport interface AgentChatRuntimeTurn<\n TEvent extends AgentChatRuntimeEventBase = AgentChatRuntimeKnownEvent,\n> {\n readonly id?: AgentChatRuntimeTurnId;\n readonly sessionId: AgentChatRuntimeSessionId;\n readonly events: AsyncIterable<TEvent>;\n cancel?(\n input?: AgentChatRuntimeCancelInput,\n ): Promise<AgentChatRuntimeCancelResult>;\n}\n\nexport interface AgentChatRuntimeSession<\n TEvent extends AgentChatRuntimeEventBase = AgentChatRuntimeKnownEvent,\n> {\n readonly id: AgentChatRuntimeSessionId;\n readonly runtimeId: AgentChatRuntimeId;\n readonly threadId?: string;\n readonly capabilities?: Partial<AgentChatRuntimeCapabilities>;\n startTurn(\n input: AgentChatRuntimeTurnInput,\n ): AgentChatRuntimeAwaitable<AgentChatRuntimeTurn<TEvent>>;\n continueTurn?(\n input?: AgentChatRuntimeContinueInput,\n ): AgentChatRuntimeAwaitable<AgentChatRuntimeTurn<TEvent>>;\n cancelTurn?(\n input?: AgentChatRuntimeCancelInput,\n ): Promise<AgentChatRuntimeCancelResult>;\n snapshot?(): AgentChatRuntimeAwaitable<AgentChatRuntimeSessionSnapshot>;\n dispose?(): AgentChatRuntimeAwaitable<void>;\n}\n\nexport interface AgentChatRuntime<\n TEvent extends AgentChatRuntimeEventBase = AgentChatRuntimeKnownEvent,\n> {\n readonly id: AgentChatRuntimeId;\n readonly kind: AgentChatRuntimeKind;\n readonly label: string;\n readonly description?: string;\n readonly capabilities: AgentChatRuntimeCapabilities;\n createSession(\n input?: AgentChatRuntimeCreateSessionInput,\n ): AgentChatRuntimeAwaitable<AgentChatRuntimeSession<TEvent>>;\n restoreSession?(\n snapshot: AgentChatRuntimeSessionSnapshot,\n ): AgentChatRuntimeAwaitable<AgentChatRuntimeSession<TEvent>>;\n getSession?(input: {\n readonly sessionId: AgentChatRuntimeSessionId;\n readonly abortSignal?: AbortSignal;\n }): AgentChatRuntimeAwaitable<AgentChatRuntimeSession<TEvent> | null>;\n listSessions?(\n input?: AgentChatRuntimeListSessionsInput,\n ): AgentChatRuntimeAwaitable<readonly AgentChatRuntimeSessionSummary[]>;\n}\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ToolCallMessagePartProps } from "@assistant-ui/react";
|
|
3
|
+
import type { ActionChatUIConfig } from "../../action-ui.js";
|
|
3
4
|
import type { AgentMcpAppPayload } from "../../mcp-client/app-result.js";
|
|
4
5
|
import type { ContentPart } from "../sse-event-processor.js";
|
|
5
6
|
import { FilesChangedSummary } from "../tool-cells/index.js";
|
|
@@ -26,12 +27,13 @@ export type ToolDetailPayload = {
|
|
|
26
27
|
};
|
|
27
28
|
export declare function toolInputPayload(toolName: string, args: Record<string, unknown>): ToolDetailPayload | null;
|
|
28
29
|
export declare function toolResultPayload(result: string | undefined): ToolDetailPayload | null;
|
|
29
|
-
export declare function ToolCallDisplay({ toolName, argsText, args, result, mcpApp, isRunning, structuredMeta, approval, }: {
|
|
30
|
+
export declare function ToolCallDisplay({ toolName, argsText, args, result, mcpApp, chatUI, isRunning, structuredMeta, approval, }: {
|
|
30
31
|
toolName: string;
|
|
31
32
|
argsText?: string;
|
|
32
33
|
args: Record<string, unknown>;
|
|
33
34
|
result?: string;
|
|
34
35
|
mcpApp?: AgentMcpAppPayload;
|
|
36
|
+
chatUI?: ActionChatUIConfig;
|
|
35
37
|
isRunning: boolean;
|
|
36
38
|
structuredMeta?: Record<string, unknown>;
|
|
37
39
|
approval?: {
|
|
@@ -41,6 +43,7 @@ export declare function ToolCallDisplay({ toolName, argsText, args, result, mcpA
|
|
|
41
43
|
}): import("react/jsx-runtime").JSX.Element;
|
|
42
44
|
export declare function ToolCallFallback({ toolName, args, argsText, result, ...rest }: ToolCallMessagePartProps & {
|
|
43
45
|
mcpApp?: AgentMcpAppPayload;
|
|
46
|
+
chatUI?: ActionChatUIConfig;
|
|
44
47
|
structuredMeta?: Record<string, unknown>;
|
|
45
48
|
approval?: {
|
|
46
49
|
approvalKey: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-call-display.d.ts","sourceRoot":"","sources":["../../../src/client/chat/tool-call-display.tsx"],"names":[],"mappings":"AAGA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAIL,mBAAmB,EACpB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,qCAAqC,CAAC;AAyB7C,eAAO,MAAM,kBAAkB,wBAA6B,CAAC;AAE7D;;;;;GAKG;AACH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T,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACzD,2CAgDA;AA0MD,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,GAAG,IAAI,EACR,EAAE,wBAAwB,GAAG;IAC5B,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE;QAAE,WAAW,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACzD,2CAsBA;AAMD,wBAAgB,sBAAsB,CAAC,EACrC,OAAO,GACR,EAAE;IACD,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,2CAuCA;AAKD,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -189,7 +189,7 @@ function ApprovalAffordance({ toolName, approval, }) {
|
|
|
189
189
|
}, className: cn("inline-flex items-center gap-1 rounded-md px-2.5 py-1 text-xs font-medium transition-colors", "bg-foreground text-background hover:bg-foreground/90"), children: [_jsx(IconCheck, { className: "h-3.5 w-3.5" }), "Approve"] })), _jsxs("button", { type: "button", onClick: () => setDenied(true), className: cn("inline-flex items-center gap-1 rounded-md border border-border px-2.5 py-1 text-xs font-medium transition-colors", "text-foreground hover:bg-muted"), children: [_jsx(IconX, { className: "h-3.5 w-3.5" }), "Deny"] })] }));
|
|
190
190
|
}
|
|
191
191
|
// ─── ToolCallDisplay ──────────────────────────────────────────────────────────
|
|
192
|
-
export function ToolCallDisplay({ toolName, argsText, args, result, mcpApp, isRunning, structuredMeta, approval, }) {
|
|
192
|
+
export function ToolCallDisplay({ toolName, argsText, args, result, mcpApp, chatUI, isRunning, structuredMeta, approval, }) {
|
|
193
193
|
// Delegate to bespoke cells when structured metadata is present.
|
|
194
194
|
// These must be separate components so hook order in ToolCallDisplayGeneric
|
|
195
195
|
// is always stable (no conditional hook calls).
|
|
@@ -203,9 +203,9 @@ export function ToolCallDisplay({ toolName, argsText, args, result, mcpApp, isRu
|
|
|
203
203
|
if (toolKind === "write") {
|
|
204
204
|
return (_jsx(WriteCell, { meta: structuredMeta, isRunning: isRunning }));
|
|
205
205
|
}
|
|
206
|
-
return (_jsx(ToolCallDisplayGeneric, { toolName: toolName, argsText: argsText, args: args, result: result, mcpApp: mcpApp, isRunning: isRunning, approval: approval }));
|
|
206
|
+
return (_jsx(ToolCallDisplayGeneric, { toolName: toolName, argsText: argsText, args: args, result: result, mcpApp: mcpApp, chatUI: chatUI, isRunning: isRunning, approval: approval }));
|
|
207
207
|
}
|
|
208
|
-
function ToolCallDisplayGeneric({ toolName, argsText, args, result, mcpApp, isRunning, approval, }) {
|
|
208
|
+
function ToolCallDisplayGeneric({ toolName, argsText, args, result, mcpApp, chatUI, isRunning, approval, }) {
|
|
209
209
|
const streamRef = useRef(null);
|
|
210
210
|
const isAgentCall = toolName.startsWith("agent:");
|
|
211
211
|
const [expanded, setExpanded] = useState(isAgentCall);
|
|
@@ -269,6 +269,7 @@ function ToolCallDisplayGeneric({ toolName, argsText, args, result, mcpApp, isRu
|
|
|
269
269
|
resultText: result,
|
|
270
270
|
resultJson: parsedResult,
|
|
271
271
|
isRunning,
|
|
272
|
+
chatUI,
|
|
272
273
|
};
|
|
273
274
|
const NativeToolRenderer = isAgentCall
|
|
274
275
|
? null
|
|
@@ -301,7 +302,7 @@ export function ToolCallFallback({ toolName, args, argsText, result, ...rest })
|
|
|
301
302
|
? result
|
|
302
303
|
: result !== undefined
|
|
303
304
|
? JSON.stringify(result)
|
|
304
|
-
: undefined, mcpApp: rest.mcpApp, structuredMeta: rest.structuredMeta, isRunning: isRunning, approval: rest.approval }));
|
|
305
|
+
: undefined, mcpApp: rest.mcpApp, chatUI: rest.chatUI, structuredMeta: rest.structuredMeta, isRunning: isRunning, approval: rest.approval }));
|
|
305
306
|
}
|
|
306
307
|
// ─── ReconnectStreamMessage ────────────────────────────────────────────────────
|
|
307
308
|
// Renders the agent's in-progress response during reconnection (outside
|
|
@@ -313,7 +314,7 @@ export function ReconnectStreamMessage({ content, }) {
|
|
|
313
314
|
return (_jsx(SmoothMarkdownText, { text: part.text, streaming: chatRunning, resetKey: `reconnect-text-${i}`, statusType: chatRunning ? "running" : "complete" }, `reconnect-text-${i}`));
|
|
314
315
|
}
|
|
315
316
|
if (part.type === "tool-call") {
|
|
316
|
-
return (_jsx(ToolCallDisplay, { toolName: part.toolName, argsText: part.argsText, args: part.args, result: part.result, mcpApp: part.mcpApp, structuredMeta: part.structuredMeta, isRunning: part.result === undefined && chatRunning, approval: part.approval }, `reconnect-tool-${i}`));
|
|
317
|
+
return (_jsx(ToolCallDisplay, { toolName: part.toolName, argsText: part.argsText, args: part.args, result: part.result, mcpApp: part.mcpApp, chatUI: part.chatUI, structuredMeta: part.structuredMeta, isRunning: part.result === undefined && chatRunning, approval: part.approval }, `reconnect-tool-${i}`));
|
|
317
318
|
}
|
|
318
319
|
return null;
|
|
319
320
|
}) }) }));
|