@astralbeam/sdk 0.20.3 → 0.22.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 +9 -1
- package/dist/abort-_ZeHSwUG.js +1 -0
- package/dist/{api-B3UxSTtl.js → api-SpkUzEv3.js} +24 -30
- package/dist/api.d.ts +2 -2
- package/dist/api.js +1 -1
- package/dist/{badge-sVUP8vL9.js → badge-DhXUFnRC.js} +1 -1
- package/dist/client.d.ts +7 -3
- package/dist/client.js +1 -1
- package/dist/{core-D53b-MKt.js → core-CWFT6Db_.js} +1594 -762
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/{highlighter-DvZ03STw.js → highlighter-DldDI8mb.js} +1 -1
- package/dist/{index-DFxtXIXy.d.ts → index-D8X2hDGe.d.ts} +39 -25
- package/dist/{index-BEH3ZhY5.d.ts → index-DatxwZpZ.d.ts} +397 -115
- package/dist/{item-CIByj-ZQ.js → item-Cv2zb7Kn.js} +1 -1
- package/dist/listings-CyliP2E5.js +1 -0
- package/dist/{mcp-servers-BvW_M9Uu.js → mcp-servers-DvCu1KuJ.js} +1 -1
- package/dist/react.d.ts +11 -56
- package/dist/react.js +17 -16
- package/dist/{styles.generated-C1BUZU5O.js → styles.generated-CwyGUg6r.js} +1 -1
- package/dist/threads-rrcqQzl8.js +25 -0
- package/dist/widget-BOdanf0E.js +27 -0
- package/package.json +4 -4
- package/dist/listings-CvKjdN1L.js +0 -1
- package/dist/threads-CAvJZkUj.js +0 -25
- package/dist/widget-Dh-sQrQw.js +0 -26
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $n as personalMcpGetCatalog,
|
|
1
|
+
import { $n as personalMcpGetCatalog, V as CurrentUser, Wt as UploadedChatFile, X as GetThreadAttachmentParams, at as McpConnectionEncoded, hr as JwtOptions, vt as PersonalMcpTestConnection200 } from "./index-D8X2hDGe.js";
|
|
2
2
|
//#region ../node_modules/.bun/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
3
3
|
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
4
4
|
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
@@ -116,7 +116,60 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
116
116
|
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
117
117
|
}
|
|
118
118
|
//#endregion
|
|
119
|
-
//#region ../node_modules/.bun/@tanstack+ai@0.
|
|
119
|
+
//#region ../node_modules/.bun/@tanstack+ai@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai/dist/esm/activities/chat/middleware/capabilities.d.ts
|
|
120
|
+
/**
|
|
121
|
+
* The minimal context shape a capability accessor needs. The full
|
|
122
|
+
* `ChatMiddlewareContext` satisfies this (it has `capabilities`), so accessors
|
|
123
|
+
* accept any middleware context without referencing `any`.
|
|
124
|
+
*/
|
|
125
|
+
interface CapabilityContext {
|
|
126
|
+
capabilities: CapabilityRegistry;
|
|
127
|
+
}
|
|
128
|
+
/** Reads a capability value off a context. Overloaded so the flag narrows the return. */
|
|
129
|
+
interface CapabilityGetter<TValue> {
|
|
130
|
+
(ctx: CapabilityContext): TValue;
|
|
131
|
+
(ctx: CapabilityContext, opts: {
|
|
132
|
+
optional: true;
|
|
133
|
+
}): TValue | undefined;
|
|
134
|
+
}
|
|
135
|
+
/** Writes a capability value onto a context. */
|
|
136
|
+
type CapabilityProvider<TValue> = (ctx: CapabilityContext, value: TValue) => void;
|
|
137
|
+
/**
|
|
138
|
+
* A capability handle. It is BOTH a `[get, provide]` tuple (array-destructurable)
|
|
139
|
+
* AND the identity used in middleware `requires`/`provides` declarations.
|
|
140
|
+
*
|
|
141
|
+
* Runtime identity is this object's reference. The `capabilityName` literal is
|
|
142
|
+
* used for diagnostics and COMPILE-TIME tracking only — capability names MUST be
|
|
143
|
+
* unique across an app or the type-level coverage check conflates them.
|
|
144
|
+
*/
|
|
145
|
+
type Capability<TValue = unknown, TName extends string = string> = readonly [get: CapabilityGetter<TValue>, provide: CapabilityProvider<TValue>] & {
|
|
146
|
+
readonly capabilityName: TName;
|
|
147
|
+
/** @internal Presence check for the post-setup assertion. */
|
|
148
|
+
has: (ctx: CapabilityContext) => boolean;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* A capability handle with permissive value/name — for use as a constraint in
|
|
152
|
+
* `requires`/`provides` arrays. Concentrates `any` in one named alias (same
|
|
153
|
+
* convention as `AnyTextAdapter`/`AnyTool`); needed so `Capability<SpecificT>`
|
|
154
|
+
* is assignable to the handle-array element type.
|
|
155
|
+
*/
|
|
156
|
+
type CapabilityHandle = Capability<any, string>;
|
|
157
|
+
/**
|
|
158
|
+
* Per-request bookkeeping: which capabilities were provided, plus the
|
|
159
|
+
* duplicate-provide notification. Capability VALUES live in per-capability
|
|
160
|
+
* WeakMaps (see `createCapability`), not here — this only tracks presence.
|
|
161
|
+
*/
|
|
162
|
+
declare class CapabilityRegistry {
|
|
163
|
+
private readonly provided;
|
|
164
|
+
private onDuplicate?;
|
|
165
|
+
/** Register a callback fired when a handle is provided more than once. */
|
|
166
|
+
setOnDuplicate(cb: (name: string) => void): void;
|
|
167
|
+
/** Record that `handle` was provided; fire the duplicate callback on repeats. */
|
|
168
|
+
markProvided(handle: CapabilityHandle): void;
|
|
169
|
+
has(handle: CapabilityHandle): boolean;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region ../node_modules/.bun/@tanstack+ai@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai/dist/esm/interrupts.d.ts
|
|
120
173
|
interface InterruptCorrelation {
|
|
121
174
|
threadId: string;
|
|
122
175
|
interruptedRunId: string;
|
|
@@ -124,8 +177,8 @@ interface InterruptCorrelation {
|
|
|
124
177
|
submissionId?: string;
|
|
125
178
|
continuationRunId?: string;
|
|
126
179
|
}
|
|
127
|
-
type ItemInterruptErrorCode = 'invalid-payload' | 'invalid-edited-args' | 'invalid-tool-output' | 'invalid-response-schema' | 'unknown-interrupt' | 'expired' | 'stale' | 'conflict'
|
|
128
|
-
type BatchInterruptErrorCode = 'incomplete-batch' | 'item-validation-failed' | 'unsupported-bulk-operation' | 'async-resolver' | 'inactive-transaction' | 'mixed-provenance' | 'transport' | 'server' | 'protocol' | 'invalid-response-schema' | 'expired' | 'stale' | 'conflict'
|
|
180
|
+
type ItemInterruptErrorCode = 'invalid-payload' | 'invalid-edited-args' | 'invalid-tool-output' | 'invalid-response-schema' | 'unknown-interrupt' | 'expired' | 'stale' | 'conflict';
|
|
181
|
+
type BatchInterruptErrorCode = 'incomplete-batch' | 'item-validation-failed' | 'unsupported-bulk-operation' | 'async-resolver' | 'inactive-transaction' | 'mixed-provenance' | 'transport' | 'server' | 'protocol' | 'invalid-response-schema' | 'expired' | 'stale' | 'conflict';
|
|
129
182
|
interface ItemInterruptError extends InterruptCorrelation {
|
|
130
183
|
scope: 'item';
|
|
131
184
|
interruptId: string;
|
|
@@ -199,7 +252,7 @@ declare global {
|
|
|
199
252
|
var __TANSTACK_EVENT_TARGET__: EventTarget | null;
|
|
200
253
|
}
|
|
201
254
|
//#endregion
|
|
202
|
-
//#region ../node_modules/.bun/@tanstack+ai-event-client@0.
|
|
255
|
+
//#region ../node_modules/.bun/@tanstack+ai-event-client@1.0.0/node_modules/@tanstack/ai-event-client/dist/esm/envelope.d.ts
|
|
203
256
|
type AIDevtoolsEventSource = 'client' | 'server' | 'devtools';
|
|
204
257
|
type AIDevtoolsEventVisibility = 'user-visible' | 'client-state' | 'server-internal' | 'devtools-action';
|
|
205
258
|
interface AIDevtoolsEventEnvelope {
|
|
@@ -225,7 +278,7 @@ declare global {
|
|
|
225
278
|
var __TANSTACK_AI_DEVTOOLS_RUNTIME_ID__: string | undefined;
|
|
226
279
|
}
|
|
227
280
|
//#endregion
|
|
228
|
-
//#region ../node_modules/.bun/@tanstack+ai-event-client@0.
|
|
281
|
+
//#region ../node_modules/.bun/@tanstack+ai-event-client@1.0.0/node_modules/@tanstack/ai-event-client/dist/esm/index.d.ts
|
|
229
282
|
/**
|
|
230
283
|
* Detailed breakdown of prompt/input token usage.
|
|
231
284
|
* Fields are populated based on provider support.
|
|
@@ -235,6 +288,11 @@ interface PromptTokensDetails {
|
|
|
235
288
|
cachedTokens?: number;
|
|
236
289
|
/** Tokens written to cache */
|
|
237
290
|
cacheWriteTokens?: number;
|
|
291
|
+
/**
|
|
292
|
+
* The part of `cacheWriteTokens` written with a 1-hour retention.
|
|
293
|
+
* Providers price it higher than a 5-minute write.
|
|
294
|
+
*/
|
|
295
|
+
cacheWrite1hTokens?: number;
|
|
238
296
|
/** Audio input tokens */
|
|
239
297
|
audioTokens?: number;
|
|
240
298
|
/** Video input tokens */
|
|
@@ -343,19 +401,6 @@ interface TokenUsage$1<TProviderDetails = ProviderUsageDetails> {
|
|
|
343
401
|
* unit. A quantity, distinct from the monetary `cost` / `costDetails`.
|
|
344
402
|
*/
|
|
345
403
|
billed?: BilledUsage;
|
|
346
|
-
/**
|
|
347
|
-
* @deprecated Read {@link TokenUsage.billed} instead, which pairs the same
|
|
348
|
-
* duration with an explicit `unit: 'seconds'`. Still populated alongside
|
|
349
|
-
* `billed` for backward compatibility; will be removed in a future release.
|
|
350
|
-
*/
|
|
351
|
-
durationSeconds?: number;
|
|
352
|
-
/**
|
|
353
|
-
* @deprecated Read {@link TokenUsage.billed} instead, which pairs the same
|
|
354
|
-
* count with the unit it is denominated in (`seconds`, `units`, …) — this
|
|
355
|
-
* bare count is ambiguous across providers. Still populated alongside
|
|
356
|
-
* `billed` for backward compatibility; will be removed in a future release.
|
|
357
|
-
*/
|
|
358
|
-
unitsBilled?: number;
|
|
359
404
|
/** Provider-specific usage details not covered by standard fields */
|
|
360
405
|
providerUsageDetails?: TProviderDetails;
|
|
361
406
|
/** Provider-reported cost for the request, when available. */
|
|
@@ -2828,11 +2873,21 @@ type SubagentInfo = {
|
|
|
2828
2873
|
description?: string;
|
|
2829
2874
|
};
|
|
2830
2875
|
//#endregion
|
|
2831
|
-
//#region ../node_modules/.bun/@tanstack+ai@0.
|
|
2876
|
+
//#region ../node_modules/.bun/@tanstack+ai@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai/dist/esm/utilities/ag-ui-usage.d.ts
|
|
2832
2877
|
/** TokenUsage fields that have no AG-UI `usage[]` equivalent. */
|
|
2833
2878
|
type TokenUsageLeftover = Omit<TokenUsage$1, 'promptTokens' | 'completionTokens' | 'totalTokens'>;
|
|
2834
2879
|
//#endregion
|
|
2835
|
-
//#region ../node_modules/.bun/@tanstack+ai@0.
|
|
2880
|
+
//#region ../node_modules/.bun/@tanstack+ai@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai/dist/esm/utilities/subagent-wire.d.ts
|
|
2881
|
+
/**
|
|
2882
|
+
* Card data that travels on each child wire message, in
|
|
2883
|
+
* `metadata.tanstack.subagent`. The messages carry the AG-UI `subagentRunId`.
|
|
2884
|
+
*/
|
|
2885
|
+
interface SubagentWireInfo extends SubagentInfo, Pick<SubagentHandleData, 'status' | 'error' | 'interruptIds' | 'parentSubagentRunId' | 'parentToolCallId' | 'metadata'> {
|
|
2886
|
+
/** The child has no messages yet. This wire message only holds the card. */
|
|
2887
|
+
placeholder?: true;
|
|
2888
|
+
}
|
|
2889
|
+
//#endregion
|
|
2890
|
+
//#region ../node_modules/.bun/@tanstack+ai@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai/dist/esm/types.d.ts
|
|
2836
2891
|
/**
|
|
2837
2892
|
* Tool call states - track the lifecycle of a tool call
|
|
2838
2893
|
*/
|
|
@@ -2962,6 +3017,33 @@ interface DocumentPart<TMetadata = unknown> extends DocumentPart$1 {
|
|
|
2962
3017
|
* @template TDocumentMeta - Provider-specific document metadata type
|
|
2963
3018
|
*/
|
|
2964
3019
|
type ContentPart<TTextMeta = unknown, TImageMeta = unknown, TAudioMeta = unknown, TVideoMeta = unknown, TDocumentMeta = unknown> = TextPart$1<TTextMeta> | ImagePart<TImageMeta> | AudioPart<TAudioMeta> | VideoPart<TVideoMeta> | DocumentPart<TDocumentMeta>;
|
|
3020
|
+
/**
|
|
3021
|
+
* The mid-conversation record that `chat()` saves on the first assistant
|
|
3022
|
+
* message of a model call. It holds tool names and prompt hashes only, so it
|
|
3023
|
+
* does not depend on a provider.
|
|
3024
|
+
*/
|
|
3025
|
+
interface MidConversationChange {
|
|
3026
|
+
/** A start point: the names of every tool. */
|
|
3027
|
+
tools?: Array<string>;
|
|
3028
|
+
/** Tool names added since the last record. */
|
|
3029
|
+
toolsAdded?: Array<string>;
|
|
3030
|
+
/** Short prompt hashes: every prompt on a start point, the added prompts otherwise. */
|
|
3031
|
+
systemPrompts?: Array<string>;
|
|
3032
|
+
}
|
|
3033
|
+
/**
|
|
3034
|
+
* One block of an assistant `ModelMessage`, in the order the model sent it.
|
|
3035
|
+
* Each entry points into a field of the message. See `ModelMessage.blockOrder`.
|
|
3036
|
+
*/
|
|
3037
|
+
type ModelMessageBlock = {
|
|
3038
|
+
type: 'thinking';
|
|
3039
|
+
index: number;
|
|
3040
|
+
} | {
|
|
3041
|
+
type: 'text';
|
|
3042
|
+
length: number;
|
|
3043
|
+
} | {
|
|
3044
|
+
type: 'tool-call';
|
|
3045
|
+
id: string;
|
|
3046
|
+
};
|
|
2965
3047
|
interface ModelMessage<TContent extends string | null | Array<ContentPart> = string | null | Array<ContentPart>> {
|
|
2966
3048
|
role: 'user' | 'assistant' | 'tool';
|
|
2967
3049
|
content: TContent;
|
|
@@ -2978,8 +3060,22 @@ interface ModelMessage<TContent extends string | null | Array<ContentPart> = str
|
|
|
2978
3060
|
signature?: string;
|
|
2979
3061
|
redacted?: boolean;
|
|
2980
3062
|
}>;
|
|
3063
|
+
/**
|
|
3064
|
+
* The order of the blocks of an assistant message, when it is not the
|
|
3065
|
+
* default order (all thinking, then the text, then the tool calls). Each
|
|
3066
|
+
* entry points into `thinking`, into `content` (a string, by UTF-16 length),
|
|
3067
|
+
* or into `toolCalls`. The library writes and reads this field. A reader
|
|
3068
|
+
* that finds a map that does not match the message uses the default order.
|
|
3069
|
+
*/
|
|
3070
|
+
blockOrder?: Array<ModelMessageBlock>;
|
|
2981
3071
|
/** Error reported by an AG-UI tool message. */
|
|
2982
3072
|
error?: string;
|
|
3073
|
+
/**
|
|
3074
|
+
* The tools and system prompts that changed before this assistant message.
|
|
3075
|
+
* `chat()` writes it when the adapter has a mid-conversation channel.
|
|
3076
|
+
* Providers ignore it: adapters read `TextOptions.midConversationChanges`.
|
|
3077
|
+
*/
|
|
3078
|
+
midConversationChange?: MidConversationChange;
|
|
2983
3079
|
/** Optional AG-UI message metadata. TanStack-owned fields live under `tanstack`. */
|
|
2984
3080
|
metadata?: Record<string, any>;
|
|
2985
3081
|
/**
|
|
@@ -3162,11 +3258,95 @@ interface UIResourcePart {
|
|
|
3162
3258
|
meta?: Record<string, unknown>;
|
|
3163
3259
|
}
|
|
3164
3260
|
type MessagePart$1<TData = unknown> = TextPart$1 | ImagePart | AudioPart | VideoPart | DocumentPart | ToolCallPart$2 | ToolResultPart$1 | ThinkingPart$1 | ActivityPart | StructuredOutputPart<TData> | UIResourcePart | SubagentPart$1;
|
|
3261
|
+
/** Provider, wire API, and requested model of an assistant message. */
|
|
3262
|
+
interface MessageSource {
|
|
3263
|
+
provider: string;
|
|
3264
|
+
api: string;
|
|
3265
|
+
model: string;
|
|
3266
|
+
}
|
|
3267
|
+
/**
|
|
3268
|
+
* Shape of `metadata.tanstack` on a message.
|
|
3269
|
+
* `createdAt` is an ISO-8601 string.
|
|
3270
|
+
*/
|
|
3271
|
+
interface TanStackMessageMetadata {
|
|
3272
|
+
createdAt?: string;
|
|
3273
|
+
model?: string;
|
|
3274
|
+
source?: MessageSource;
|
|
3275
|
+
stopReason?: 'error' | 'aborted';
|
|
3276
|
+
responseId?: string;
|
|
3277
|
+
/**
|
|
3278
|
+
* Why the model call of this assistant message ended. A `'length'` message
|
|
3279
|
+
* stopped at the output limit, so its tool calls are not complete.
|
|
3280
|
+
*/
|
|
3281
|
+
finishReason?: TanStackRunMetadata['finishReason'];
|
|
3282
|
+
/**
|
|
3283
|
+
* The provider's answer items of this assistant message, in order, for a
|
|
3284
|
+
* same-model replay. The OpenAI Responses adapter keeps each output
|
|
3285
|
+
* message item's `id` and `phase` (`commentary` or `final_answer`).
|
|
3286
|
+
*/
|
|
3287
|
+
responseItems?: Array<{
|
|
3288
|
+
id: string;
|
|
3289
|
+
phase?: string;
|
|
3290
|
+
}>;
|
|
3291
|
+
/**
|
|
3292
|
+
* The model call of this assistant message sent a reasoning item. The
|
|
3293
|
+
* OpenAI Responses adapter sets it. A replay that lost that reasoning item
|
|
3294
|
+
* sends the message without its item ids, because the API refuses a
|
|
3295
|
+
* `msg_`/`fc_` item without the reasoning item that made it.
|
|
3296
|
+
*/
|
|
3297
|
+
reasoningItem?: boolean;
|
|
3298
|
+
/** Parent chat run that produced this assistant message. */
|
|
3299
|
+
runId?: string;
|
|
3300
|
+
/**
|
|
3301
|
+
* The chat run that produced this assistant message. `withPersistence` sets
|
|
3302
|
+
* `id`. `reconstructChat` with `includeRuns: true` adds the finished run's
|
|
3303
|
+
* timings, in epoch ms.
|
|
3304
|
+
*/
|
|
3305
|
+
run?: {
|
|
3306
|
+
id: string;
|
|
3307
|
+
startedAt?: number;
|
|
3308
|
+
finishedAt?: number;
|
|
3309
|
+
};
|
|
3310
|
+
/** Card data on a child wire message. See `uiMessagesToWire`. */
|
|
3311
|
+
subagent?: SubagentWireInfo;
|
|
3312
|
+
/** Thinking signature for a `role: 'reasoning'` fan-out message. */
|
|
3313
|
+
signature?: string;
|
|
3314
|
+
/** Per-tool-call provider metadata keyed by tool call id (e.g. Gemini thoughtSignature). */
|
|
3315
|
+
toolCallMetadata?: Record<string, unknown>;
|
|
3316
|
+
toolResult?: {
|
|
3317
|
+
id?: string;
|
|
3318
|
+
createdAt?: string;
|
|
3319
|
+
content?: Array<ContentPart>;
|
|
3320
|
+
};
|
|
3321
|
+
/** Outcome of a cancelled or denied tool result; when present, the UI state is `error`. */
|
|
3322
|
+
toolResultOutcome?: ToolResultOutcome;
|
|
3323
|
+
structuredOutput?: {
|
|
3324
|
+
status?: 'streaming' | 'complete' | 'error';
|
|
3325
|
+
partial?: unknown;
|
|
3326
|
+
data?: unknown;
|
|
3327
|
+
raw?: string;
|
|
3328
|
+
reasoning?: string;
|
|
3329
|
+
errorMessage?: string;
|
|
3330
|
+
};
|
|
3331
|
+
uiResources?: Array<UIResourcePart>;
|
|
3332
|
+
/**
|
|
3333
|
+
* On an assistant wire row that exists only to keep the block order: the
|
|
3334
|
+
* id of the assistant row before it. Our server joins the two rows into
|
|
3335
|
+
* one message with a `blockOrder` map. See `uiMessagesToWire`.
|
|
3336
|
+
*/
|
|
3337
|
+
continues?: string;
|
|
3338
|
+
}
|
|
3165
3339
|
/**
|
|
3166
3340
|
* Shape of `metadata.tanstack` on run events.
|
|
3167
3341
|
*/
|
|
3168
3342
|
interface TanStackRunMetadata {
|
|
3343
|
+
source?: MessageSource;
|
|
3169
3344
|
model?: string;
|
|
3345
|
+
responseId?: string;
|
|
3346
|
+
/** The answer items of this model call. See `TanStackMessageMetadata.responseItems`. */
|
|
3347
|
+
responseItems?: TanStackMessageMetadata['responseItems'];
|
|
3348
|
+
/** See `TanStackMessageMetadata.reasoningItem`. */
|
|
3349
|
+
reasoningItem?: boolean;
|
|
3170
3350
|
finishReason?: 'stop' | 'length' | 'content_filter' | 'tool_calls' | null;
|
|
3171
3351
|
/** TokenUsage fields that have no AG-UI `usage[]` equivalent. */
|
|
3172
3352
|
usage?: TokenUsageLeftover;
|
|
@@ -3177,9 +3357,17 @@ interface TanStackRunMetadata {
|
|
|
3177
3357
|
index?: number;
|
|
3178
3358
|
/** On a `RUN_ERROR`. See `RunErrorEvent.retryAfterMs`. */
|
|
3179
3359
|
retryAfterMs?: number;
|
|
3360
|
+
/** On a `RUN_ERROR`. See `RunErrorEvent.rawText`. */
|
|
3361
|
+
rawText?: string;
|
|
3362
|
+
/** On a `RUN_ERROR`. See `RunErrorEvent.errorType`. */
|
|
3363
|
+
errorType?: string;
|
|
3364
|
+
/** On a `RUN_ERROR`. See `RunErrorEvent.requestId`. */
|
|
3365
|
+
requestId?: string;
|
|
3180
3366
|
state?: ToolOutputState;
|
|
3181
3367
|
/** Parsed `TOOL_CALL_END` input. Spec `TOOL_CALL_END` has no top-level `input`. */
|
|
3182
3368
|
input?: unknown;
|
|
3369
|
+
/** The raw tool argument string on `TOOL_CALL_END`, as the provider sent it. */
|
|
3370
|
+
args?: string;
|
|
3183
3371
|
}
|
|
3184
3372
|
/**
|
|
3185
3373
|
* UIMessage - Domain-specific message format optimized for building chat UIs
|
|
@@ -3252,6 +3440,13 @@ type ToolInputResponse = {
|
|
|
3252
3440
|
type ToolExecutionContext<TContext = unknown> = RuntimeContextField<TContext> & {
|
|
3253
3441
|
/** The ID of the tool call being executed */
|
|
3254
3442
|
toolCallId?: string;
|
|
3443
|
+
/**
|
|
3444
|
+
* The thread id of the chat run. `chat()` sets it to the same value as
|
|
3445
|
+
* `ctx.threadId` in middleware. A tool can use it to keep its own state
|
|
3446
|
+
* for each conversation. It is missing when a tool runs outside a chat,
|
|
3447
|
+
* for example from an MCP server, WebMCP, or a direct `execute()` call.
|
|
3448
|
+
*/
|
|
3449
|
+
threadId?: string;
|
|
3255
3450
|
/**
|
|
3256
3451
|
* Abort signal for the current chat run. Aborts when the run's
|
|
3257
3452
|
* `abortController` fires (or middleware aborts). Long-running tools —
|
|
@@ -3264,6 +3459,44 @@ type ToolExecutionContext<TContext = unknown> = RuntimeContextField<TContext> &
|
|
|
3264
3459
|
* interrupt for this tool call.
|
|
3265
3460
|
*/
|
|
3266
3461
|
inputResponse?: ToolInputResponse;
|
|
3462
|
+
/**
|
|
3463
|
+
* Set when the host can move this call to the background. Pass it the
|
|
3464
|
+
* work of the call, and race the two promises. It resolves to a short
|
|
3465
|
+
* note for the model when the user moves the call. The work keeps
|
|
3466
|
+
* running, and the host tells the model its result when it ends.
|
|
3467
|
+
* `chat()` does not set it: a host wraps the tool's `execute` to add it.
|
|
3468
|
+
* The note is a string. An object `outputSchema` rejects it. A string
|
|
3469
|
+
* schema, or no schema, accepts it.
|
|
3470
|
+
*
|
|
3471
|
+
* @example
|
|
3472
|
+
* ```ts
|
|
3473
|
+
* const work = runJob(args)
|
|
3474
|
+
* return context?.detach ? Promise.race([work, context.detach(work)]) : work
|
|
3475
|
+
* ```
|
|
3476
|
+
*/
|
|
3477
|
+
detach?: (work: Promise<unknown>) => Promise<string>;
|
|
3478
|
+
/**
|
|
3479
|
+
* The run of the call, when a host knows it. `chat()` does not set it:
|
|
3480
|
+
* a host such as the harness wraps the tool's `execute` to add it.
|
|
3481
|
+
*/
|
|
3482
|
+
runId?: string;
|
|
3483
|
+
/**
|
|
3484
|
+
* Read a capability that a middleware of the run provided, by its
|
|
3485
|
+
* handle. It works like `ctx.get` in middleware and throws if the
|
|
3486
|
+
* capability was never provided. `chat()` sets it. It is missing when a
|
|
3487
|
+
* tool runs outside a chat.
|
|
3488
|
+
*
|
|
3489
|
+
* @example
|
|
3490
|
+
* ```ts
|
|
3491
|
+
* const sandbox = context?.get?.(SandboxCapability)
|
|
3492
|
+
* ```
|
|
3493
|
+
*/
|
|
3494
|
+
get?: <TValue>(capability: Capability<TValue>) => TValue;
|
|
3495
|
+
/**
|
|
3496
|
+
* Read a capability by its handle. Returns `undefined` if no middleware
|
|
3497
|
+
* provided it. It works like `ctx.getOptional` in middleware.
|
|
3498
|
+
*/
|
|
3499
|
+
getOptional?: <TValue>(capability: Capability<TValue>) => TValue | undefined;
|
|
3267
3500
|
/**
|
|
3268
3501
|
* Emit a custom event during tool execution.
|
|
3269
3502
|
* Events are streamed to the client in real-time as AG-UI CUSTOM events.
|
|
@@ -3400,6 +3633,13 @@ interface Tool$1<TInput extends SchemaInput | undefined = SchemaInput, TOutput e
|
|
|
3400
3633
|
needsApproval?: boolean;
|
|
3401
3634
|
/** If true, this tool is lazy and will only be sent to the LLM after being discovered via the lazy tool discovery mechanism. Works with both chat() (the synthetic discovery tool) and Code Mode (kept out of the system prompt and revealed via discover_tools). */
|
|
3402
3635
|
lazy?: boolean;
|
|
3636
|
+
/**
|
|
3637
|
+
* Whether a host may run this tool again after a crash cut the run
|
|
3638
|
+
* between the call and its result. `'safe'` runs it again. Omit the
|
|
3639
|
+
* field, or set `'never'`, when a second run is not safe. The host
|
|
3640
|
+
* writes the model note. `chat()` does not read this field.
|
|
3641
|
+
*/
|
|
3642
|
+
replay?: 'safe' | 'never';
|
|
3403
3643
|
/** Additional metadata for adapters or custom extensions */
|
|
3404
3644
|
metadata?: Record<string, any> | undefined;
|
|
3405
3645
|
}
|
|
@@ -3427,6 +3667,8 @@ interface RunFinishedEvent extends Pick<RunFinishedEvent$1, 'threadId' | 'runId'
|
|
|
3427
3667
|
usage?: Array<TokenUsage> | TokenUsage$1;
|
|
3428
3668
|
/** Restored on the client from `metadata.tanstack`. */
|
|
3429
3669
|
model?: string;
|
|
3670
|
+
/** Provider generation ID. Restored from `metadata.tanstack`. */
|
|
3671
|
+
responseId?: string;
|
|
3430
3672
|
/** Restored on the client from `metadata.tanstack`. */
|
|
3431
3673
|
finishReason?: 'stop' | 'length' | 'content_filter' | 'tool_calls' | null;
|
|
3432
3674
|
metadata?: {
|
|
@@ -3454,12 +3696,30 @@ interface RunErrorEvent extends Pick<RunErrorEvent$1, 'message' | 'code' | 'time
|
|
|
3454
3696
|
message: string;
|
|
3455
3697
|
code?: string;
|
|
3456
3698
|
};
|
|
3699
|
+
/**
|
|
3700
|
+
* The model text of a failed structured output: JSON that did not parse,
|
|
3701
|
+
* or a value that failed the `outputSchema` check. `chat()` moves it to
|
|
3702
|
+
* `metadata.tanstack.rawText`.
|
|
3703
|
+
*/
|
|
3704
|
+
rawText?: string;
|
|
3457
3705
|
/**
|
|
3458
3706
|
* How long the provider asks you to wait before a retry, in milliseconds.
|
|
3459
3707
|
* Adapters read it from the `retry-after-ms` or `retry-after` header.
|
|
3460
3708
|
* `chat()` moves it to `metadata.tanstack.retryAfterMs`.
|
|
3461
3709
|
*/
|
|
3462
3710
|
retryAfterMs?: number;
|
|
3711
|
+
/**
|
|
3712
|
+
* The provider's error type, for example `overloaded_error` or
|
|
3713
|
+
* `rate_limit_exceeded`. `code` stays the HTTP status. A string of at most
|
|
3714
|
+
* 128 characters. `chat()` moves it to `metadata.tanstack.errorType`.
|
|
3715
|
+
*/
|
|
3716
|
+
errorType?: string;
|
|
3717
|
+
/**
|
|
3718
|
+
* The provider's request id, from the SDK error or the `request-id` /
|
|
3719
|
+
* `x-request-id` header. Give it to the provider's support.
|
|
3720
|
+
* `chat()` moves it to `metadata.tanstack.requestId`.
|
|
3721
|
+
*/
|
|
3722
|
+
requestId?: string;
|
|
3463
3723
|
metadata?: {
|
|
3464
3724
|
tanstack?: TanStackRunMetadata;
|
|
3465
3725
|
} & Record<string, any>;
|
|
@@ -3490,8 +3750,6 @@ interface TextMessageEndEvent extends TextMessageEndEvent$1 {}
|
|
|
3490
3750
|
*/
|
|
3491
3751
|
interface ToolCallStartEvent extends Omit<ToolCallStartEvent$1, 'type'> {
|
|
3492
3752
|
type: 'TOOL_CALL_START';
|
|
3493
|
-
/** Alias of `toolCallName`. Kept so existing stream readers still compile. */
|
|
3494
|
-
toolName?: string;
|
|
3495
3753
|
/** Provider-specific metadata to carry into the ToolCall. */
|
|
3496
3754
|
metadata?: Record<string, any>;
|
|
3497
3755
|
}
|
|
@@ -3655,7 +3913,7 @@ interface SubagentErrorEvent extends SubagentErrorEvent$1 {}
|
|
|
3655
3913
|
*/
|
|
3656
3914
|
type StreamChunk = AGUIEvent;
|
|
3657
3915
|
//#endregion
|
|
3658
|
-
//#region ../node_modules/.bun/@tanstack+ai@0.
|
|
3916
|
+
//#region ../node_modules/.bun/@tanstack+ai@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai/dist/esm/interrupt-definition.d.ts
|
|
3659
3917
|
type PortableSchema = StandardJSONSchemaV1<any, any> | StandardSchemaV1$1<any, any>;
|
|
3660
3918
|
type InterruptInput<TPayloadSchema extends PortableSchema | undefined, TPayload = unknown> = {
|
|
3661
3919
|
key: string;
|
|
@@ -3697,7 +3955,7 @@ interface InterruptDefinition<TId extends string, TPayloadSchema extends Portabl
|
|
|
3697
3955
|
interrupt: InterruptRequestMethod<TId, TPayloadSchema, TResponseSchema, TPayload, TPayloadInput>;
|
|
3698
3956
|
}
|
|
3699
3957
|
//#endregion
|
|
3700
|
-
//#region ../node_modules/.bun/@tanstack+ai@0.
|
|
3958
|
+
//#region ../node_modules/.bun/@tanstack+ai@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai/dist/esm/activities/chat/tools/tool-definition.d.ts
|
|
3701
3959
|
/**
|
|
3702
3960
|
* Type-level brand key for {@link ToolApprovalCapabilityMarker}. Only ever used
|
|
3703
3961
|
* in type positions, but it must stay exported: a `unique symbol` referenced by
|
|
@@ -3739,6 +3997,7 @@ interface ClientTool<TInput extends SchemaInput | undefined = undefined, TOutput
|
|
|
3739
3997
|
approvalSchema?: TApprovalSchema;
|
|
3740
3998
|
execution?: 'task';
|
|
3741
3999
|
lazy?: boolean;
|
|
4000
|
+
replay?: 'safe' | 'never';
|
|
3742
4001
|
metadata?: Record<string, unknown>;
|
|
3743
4002
|
execute?: ToolExecuteFunction<TInput, TOutput, TContext>;
|
|
3744
4003
|
}
|
|
@@ -3778,7 +4037,7 @@ type InferToolOutput<T> = T extends {
|
|
|
3778
4037
|
outputSchema?: infer TOutput;
|
|
3779
4038
|
} ? TOutput extends StandardJSONSchemaV1<any, any> ? InferSchemaType<TOutput> : TOutput extends StandardSchemaV1$1<any, any> ? InferSchemaType<TOutput> : TOutput extends JSONSchema ? unknown : InferSchemaType<TOutput> : unknown;
|
|
3780
4039
|
//#endregion
|
|
3781
|
-
//#region ../node_modules/.bun/@tanstack+ai@0.
|
|
4040
|
+
//#region ../node_modules/.bun/@tanstack+ai@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai/dist/esm/byok/define-provider.d.ts
|
|
3782
4041
|
/**
|
|
3783
4042
|
* A BYOK provider declared by an adapter. `id` is the `x-byok-<id>` slug and
|
|
3784
4043
|
* is required — `{ id?: string }` is not a {@link ByokProvider}.
|
|
@@ -3798,14 +4057,14 @@ interface ByokProvider<TId extends string = string> {
|
|
|
3798
4057
|
readonly with?: ReadonlyArray<ByokProvider>;
|
|
3799
4058
|
}
|
|
3800
4059
|
//#endregion
|
|
3801
|
-
//#region ../node_modules/.bun/@tanstack+ai@0.
|
|
4060
|
+
//#region ../node_modules/.bun/@tanstack+ai@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai/dist/esm/byok/providers.d.ts
|
|
3802
4061
|
/**
|
|
3803
4062
|
* Provider ids are open slugs, not a closed catalog. `@tanstack/ai` does not
|
|
3804
4063
|
* list adapters. Any matching string is a valid id and becomes `x-byok-<id>`.
|
|
3805
4064
|
*/
|
|
3806
4065
|
type ProviderId = string;
|
|
3807
4066
|
//#endregion
|
|
3808
|
-
//#region ../node_modules/.bun/@tanstack+ai@0.
|
|
4067
|
+
//#region ../node_modules/.bun/@tanstack+ai@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/types.d.ts
|
|
3809
4068
|
/**
|
|
3810
4069
|
* Strategy for determining when to emit text updates
|
|
3811
4070
|
*/
|
|
@@ -3823,7 +4082,7 @@ interface ChunkStrategy {
|
|
|
3823
4082
|
reset?: () => void;
|
|
3824
4083
|
}
|
|
3825
4084
|
//#endregion
|
|
3826
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@0.
|
|
4085
|
+
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai-client/dist/esm/byok/storage.d.ts
|
|
3827
4086
|
type Keyring = Partial<Record<ProviderId, string>>;
|
|
3828
4087
|
type KeyPreview = Partial<Record<ProviderId, string>>;
|
|
3829
4088
|
interface KeyringStorage {
|
|
@@ -3838,7 +4097,7 @@ interface KeyringStorage {
|
|
|
3838
4097
|
clear: () => void | Promise<void>;
|
|
3839
4098
|
}
|
|
3840
4099
|
//#endregion
|
|
3841
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@0.
|
|
4100
|
+
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai-client/dist/esm/byok/client.d.ts
|
|
3842
4101
|
type KeyStatus = {
|
|
3843
4102
|
state: 'empty';
|
|
3844
4103
|
} | {
|
|
@@ -3893,7 +4152,7 @@ declare class ByokClient {
|
|
|
3893
4152
|
unlock(): Promise<void>;
|
|
3894
4153
|
}
|
|
3895
4154
|
//#endregion
|
|
3896
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@0.
|
|
4155
|
+
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai-client/dist/esm/events.d.ts
|
|
3897
4156
|
interface ChatClientRunEventContext {
|
|
3898
4157
|
threadId: string;
|
|
3899
4158
|
runId: string;
|
|
@@ -4003,17 +4262,13 @@ declare abstract class ChatClientEventEmitter {
|
|
|
4003
4262
|
* Emit tool result added event
|
|
4004
4263
|
*/
|
|
4005
4264
|
toolResultAdded(toolCallId: string, toolName: string, output: unknown, state: string, context?: ChatClientEventContext): void;
|
|
4006
|
-
/**
|
|
4007
|
-
* Emit tool approval responded event
|
|
4008
|
-
*/
|
|
4009
|
-
toolApprovalResponded(approvalId: string, toolCallId: string, approved: boolean, context?: ChatClientRunEventContext): void;
|
|
4010
4265
|
/**
|
|
4011
4266
|
* Emit tool fixture applied event.
|
|
4012
4267
|
*/
|
|
4013
4268
|
toolFixtureApplied(fixture: ChatClientToolFixtureAppliedEvent): void;
|
|
4014
4269
|
}
|
|
4015
4270
|
//#endregion
|
|
4016
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@0.
|
|
4271
|
+
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai-client/dist/esm/devtools.d.ts
|
|
4017
4272
|
interface AIDevtoolsDisplayOptions {
|
|
4018
4273
|
name?: string;
|
|
4019
4274
|
}
|
|
@@ -4057,7 +4312,7 @@ type AIDevtoolsRunEventType = 'run:created' | 'run:started' | 'run:updated' | 'r
|
|
|
4057
4312
|
type AIDevtoolsRunStatus = 'created' | 'started' | 'updated' | 'completed' | 'errored' | 'cancelled';
|
|
4058
4313
|
interface AIDevtoolsBridgeOptions<TSnapshot extends object> {
|
|
4059
4314
|
hookId: string;
|
|
4060
|
-
threadId
|
|
4315
|
+
threadId: string;
|
|
4061
4316
|
clientId: string;
|
|
4062
4317
|
metadata: AIDevtoolsClientMetadata;
|
|
4063
4318
|
getSnapshot: () => TSnapshot;
|
|
@@ -4181,10 +4436,10 @@ declare class ChatDevtoolsBridge extends ClientDevtoolsBridge<AIDevtoolsChatSnap
|
|
|
4181
4436
|
private findClientTool;
|
|
4182
4437
|
}
|
|
4183
4438
|
//#endregion
|
|
4184
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@0.
|
|
4439
|
+
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai-client/dist/esm/devtools-noop.d.ts
|
|
4185
4440
|
type ChatDevtoolsBridgeFactory = (options: ChatDevtoolsBridgeOptions) => ChatDevtoolsBridge;
|
|
4186
4441
|
//#endregion
|
|
4187
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@0.
|
|
4442
|
+
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai-client/dist/esm/types.d.ts
|
|
4188
4443
|
interface ChatResumeState {
|
|
4189
4444
|
threadId: string;
|
|
4190
4445
|
runId: string;
|
|
@@ -4214,8 +4469,6 @@ interface BoundInterruptBase {
|
|
|
4214
4469
|
readonly generation: number;
|
|
4215
4470
|
readonly status: InterruptItemStatus;
|
|
4216
4471
|
readonly errors: ReadonlyArray<ItemInterruptError>;
|
|
4217
|
-
/** @deprecated Use `errors[0]`. */
|
|
4218
|
-
readonly error?: ItemInterruptError;
|
|
4219
4472
|
/**
|
|
4220
4473
|
* Whether the binding/schema allows resolution at hydrate time.
|
|
4221
4474
|
* Does not flip on submit/expiry — gate UI on `status`, `resuming`, and
|
|
@@ -4303,14 +4556,12 @@ type ResolvableChatInterrupt<TTools extends ReadonlyArray<AnyClientTool> = Reado
|
|
|
4303
4556
|
type BoundInterrupts<TTools extends ReadonlyArray<AnyClientTool> = ReadonlyArray<AnyClientTool>, TInterrupts extends ReadonlyArray<InterruptDefinition<any, any, any, any>> = readonly []> = ReadonlyArray<ChatInterrupt<TTools, TInterrupts>>;
|
|
4304
4557
|
interface ChatInterruptState<TTools extends ReadonlyArray<AnyClientTool> = ReadonlyArray<AnyClientTool>, TInterrupts extends ReadonlyArray<InterruptDefinition<any, any, any, any>> = readonly []> {
|
|
4305
4558
|
readonly interrupts: BoundInterrupts<TTools, TInterrupts>;
|
|
4306
|
-
/** @deprecated Use `interrupts`. Same snapshot today. */
|
|
4307
|
-
readonly pendingInterrupts: BoundInterrupts<TTools, TInterrupts>;
|
|
4308
4559
|
readonly interruptErrors: ReadonlyArray<BatchInterruptError>;
|
|
4309
4560
|
readonly resuming: boolean;
|
|
4310
4561
|
}
|
|
4311
4562
|
/**
|
|
4312
4563
|
* `messages` is the full UIMessage history (not a delta). `data` is the
|
|
4313
|
-
* merged body — `ChatClientOptions.
|
|
4564
|
+
* merged body — `ChatClientOptions.forwardedProps` plus any per-call data passed to
|
|
4314
4565
|
* `sendMessage(...)`. `threadId` / `runId` are the AG-UI correlation ids
|
|
4315
4566
|
* the chat client uses to track this turn — forward them to your server
|
|
4316
4567
|
* if it needs to correlate requests.
|
|
@@ -4339,6 +4590,7 @@ interface ChatFetcherOptions {
|
|
|
4339
4590
|
* @example
|
|
4340
4591
|
* ```ts
|
|
4341
4592
|
* useChat({
|
|
4593
|
+
* threadId,
|
|
4342
4594
|
* fetcher: ({ messages }, { signal }) =>
|
|
4343
4595
|
* chatFn({ data: { messages }, signal }),
|
|
4344
4596
|
* })
|
|
@@ -4376,6 +4628,26 @@ type ToolResultState = 'streaming' | 'complete' | 'error';
|
|
|
4376
4628
|
* ChatClient state - track the lifecycle of a chat
|
|
4377
4629
|
*/
|
|
4378
4630
|
type ChatClientState = 'ready' | 'submitted' | 'streaming' | 'error';
|
|
4631
|
+
/**
|
|
4632
|
+
* UI snapshot published by {@link ChatClient.subscribeSnapshot} /
|
|
4633
|
+
* {@link ChatClient.getSnapshot}.
|
|
4634
|
+
*/
|
|
4635
|
+
interface ChatClientSnapshot<TTools extends ReadonlyArray<AnyClientTool> = any, TInterrupts extends ReadonlyArray<InterruptDefinition<any, any, any, any>> = readonly []> {
|
|
4636
|
+
readonly messages: ReadonlyArray<UIMessage<TTools>>;
|
|
4637
|
+
readonly status: ChatClientState;
|
|
4638
|
+
readonly isLoading: boolean;
|
|
4639
|
+
readonly error: Error | undefined;
|
|
4640
|
+
readonly isSubscribed: boolean;
|
|
4641
|
+
readonly connectionStatus: ConnectionStatus;
|
|
4642
|
+
readonly sessionGenerating: boolean;
|
|
4643
|
+
readonly queue: ReadonlyArray<QueuedMessage>;
|
|
4644
|
+
readonly runId: string | null;
|
|
4645
|
+
/** True when the last hydrate or older-page response said more messages exist. */
|
|
4646
|
+
readonly hasOlderMessages: boolean;
|
|
4647
|
+
/** True while a store or server load may still repaint the transcript. */
|
|
4648
|
+
readonly isHydrating: boolean;
|
|
4649
|
+
readonly interruptState: ChatInterruptState<TTools, TInterrupts>;
|
|
4650
|
+
}
|
|
4379
4651
|
/**
|
|
4380
4652
|
* Connection lifecycle state for the subscription loop.
|
|
4381
4653
|
*/
|
|
@@ -4621,6 +4893,11 @@ interface SubagentHandle extends SubagentHandleData {
|
|
|
4621
4893
|
* keeps going.
|
|
4622
4894
|
*/
|
|
4623
4895
|
stop?: () => void;
|
|
4896
|
+
/**
|
|
4897
|
+
* The checked input of an agent with `inputSchema`: what the parent model
|
|
4898
|
+
* wrote when it started this child. Set by ChatClient from the card.
|
|
4899
|
+
*/
|
|
4900
|
+
input?: unknown;
|
|
4624
4901
|
}
|
|
4625
4902
|
interface SubagentPart {
|
|
4626
4903
|
type: 'subagent';
|
|
@@ -4638,6 +4915,8 @@ type SubagentClientAgent = {
|
|
|
4638
4915
|
name: string;
|
|
4639
4916
|
}>;
|
|
4640
4917
|
interrupts?: ReadonlyArray<InterruptDefinition<any, any, any, any>>;
|
|
4918
|
+
/** Types `part.subagent.input`. */
|
|
4919
|
+
inputSchema?: unknown;
|
|
4641
4920
|
outputSchema?: SchemaInput;
|
|
4642
4921
|
};
|
|
4643
4922
|
type AgentToolList<TAgent> = TAgent extends {
|
|
@@ -4646,10 +4925,21 @@ type AgentToolList<TAgent> = TAgent extends {
|
|
|
4646
4925
|
type AgentOutputData<TAgent> = TAgent extends {
|
|
4647
4926
|
outputSchema?: infer TSchema;
|
|
4648
4927
|
} ? Exclude<TSchema, undefined> extends SchemaInput ? [Exclude<TSchema, undefined>] extends [never] ? unknown : InferSchemaType<Exclude<TSchema, undefined>> : unknown : unknown;
|
|
4928
|
+
type AgentInputData<TAgent> = TAgent extends {
|
|
4929
|
+
inputSchema?: infer TSchema;
|
|
4930
|
+
} ? [Exclude<TSchema, undefined>] extends [never] ? undefined : Exclude<TSchema, undefined> extends {
|
|
4931
|
+
'~standard': {
|
|
4932
|
+
types?: {
|
|
4933
|
+
output: infer TOutput;
|
|
4934
|
+
};
|
|
4935
|
+
};
|
|
4936
|
+
} ? TOutput : Exclude<TSchema, undefined> extends SchemaInput ? InferSchemaType<Exclude<TSchema, undefined>> : unknown : undefined;
|
|
4649
4937
|
/** One child handle. `name` is the discriminant. */
|
|
4650
|
-
type SubagentHandleOf<TAgent extends SubagentClientAgent> = Omit<SubagentHandle, 'name' | 'messages'> & {
|
|
4938
|
+
type SubagentHandleOf<TAgent extends SubagentClientAgent> = Omit<SubagentHandle, 'name' | 'messages' | 'input'> & {
|
|
4651
4939
|
name: TAgent['name'];
|
|
4652
4940
|
messages: Array<UIMessage<AgentToolList<TAgent>, AgentOutputData<TAgent>>>;
|
|
4941
|
+
/** Unset on a card saved before the input was kept. */
|
|
4942
|
+
input?: AgentInputData<TAgent>;
|
|
4653
4943
|
};
|
|
4654
4944
|
type SubagentHandles<TAgents extends ReadonlyArray<SubagentClientAgent> | undefined> = [TAgents] extends [undefined] ? SubagentHandle : unknown extends TAgents ? SubagentHandle : TAgents extends ReadonlyArray<infer TAgent> ? TAgent extends SubagentClientAgent ? SubagentHandleOf<TAgent> : SubagentHandle : SubagentHandle;
|
|
4655
4945
|
type SubagentPartOf<TAgents extends ReadonlyArray<SubagentClientAgent> | undefined> = [TAgents] extends [undefined] ? SubagentPart : unknown extends TAgents ? SubagentPart : {
|
|
@@ -4702,28 +4992,23 @@ interface ChatPersistedState<TTools extends ReadonlyArray<AnyClientTool> = any>
|
|
|
4702
4992
|
* message transcript and the resume snapshot as one {@link ChatPersistedState}
|
|
4703
4993
|
* record, so a full page reload restores the conversation AND can rejoin an
|
|
4704
4994
|
* in-flight run / rehydrate pending interrupts.
|
|
4705
|
-
*
|
|
4706
|
-
* For backward compatibility `getItem` may also return a bare `UIMessage[]`
|
|
4707
|
-
* (the legacy messages-only format); the client normalizes it to
|
|
4708
|
-
* `{ messages }`. `setItem` always writes the combined record.
|
|
4709
4995
|
*/
|
|
4710
4996
|
interface ChatClientPersistence<TTools extends ReadonlyArray<AnyClientTool> = any> {
|
|
4711
|
-
getItem: (id: string) => ChatPersistedState<TTools> |
|
|
4997
|
+
getItem: (id: string) => ChatPersistedState<TTools> | null | undefined | Promise<ChatPersistedState<TTools> | null | undefined>;
|
|
4712
4998
|
setItem: (id: string, state: ChatPersistedState<TTools>) => void | Promise<void>;
|
|
4713
4999
|
removeItem: (id: string) => void | Promise<void>;
|
|
4714
5000
|
}
|
|
4715
5001
|
/**
|
|
4716
5002
|
* The `persistence` / `threadId` pairing for `ChatClient` and the chat hooks.
|
|
4717
5003
|
*
|
|
4718
|
-
*
|
|
4719
|
-
*
|
|
4720
|
-
*
|
|
5004
|
+
* `threadId` is always required. It is the conversation id for the wire,
|
|
5005
|
+
* DevTools, and persistence. Use a stable id for each conversation, for
|
|
5006
|
+
* example the id from your route or database.
|
|
4721
5007
|
*
|
|
4722
|
-
*
|
|
4723
|
-
* The client then mints one after mount for the wire and DevTools.
|
|
5008
|
+
* `history` is allowed only with `persistence: true`.
|
|
4724
5009
|
*
|
|
4725
5010
|
* Intersect this onto `ChatClientOptions`. Do not apply a later plain `Omit`
|
|
4726
|
-
* to that type: it collapses the union and the
|
|
5011
|
+
* to that type: it collapses the union and the `history` rule disappears. Use
|
|
4727
5012
|
* {@link DistributedOmit}.
|
|
4728
5013
|
*/
|
|
4729
5014
|
type ChatPersistenceOptions<TTools extends ReadonlyArray<AnyClientTool> = any> = {
|
|
@@ -4737,13 +5022,9 @@ type ChatPersistenceOptions<TTools extends ReadonlyArray<AnyClientTool> = any> =
|
|
|
4737
5022
|
pageSize: number;
|
|
4738
5023
|
};
|
|
4739
5024
|
} | {
|
|
4740
|
-
persistence
|
|
5025
|
+
persistence?: ChatClientPersistence<TTools> | false | undefined;
|
|
4741
5026
|
threadId: string;
|
|
4742
5027
|
history?: never;
|
|
4743
|
-
} | {
|
|
4744
|
-
persistence?: false | undefined;
|
|
4745
|
-
threadId?: string;
|
|
4746
|
-
history?: never;
|
|
4747
5028
|
};
|
|
4748
5029
|
type IsUnknown<T> = unknown extends T ? [T] extends [unknown] ? true : false : false;
|
|
4749
5030
|
type KnownContext<T> = IsUnknown<T> extends true ? never : T;
|
|
@@ -4788,19 +5069,8 @@ interface ChatClientBaseOptions<TTools extends ReadonlyArray<AnyClientTool> = an
|
|
|
4788
5069
|
* AG-UI `RunAgentInput.forwardedProps` field. Use this for per-session
|
|
4789
5070
|
* options like provider/model selection or feature flags that the
|
|
4790
5071
|
* server endpoint should read.
|
|
4791
|
-
*
|
|
4792
|
-
* Replaces the legacy `body` option. If both are provided,
|
|
4793
|
-
* `forwardedProps` wins on key collision.
|
|
4794
5072
|
*/
|
|
4795
5073
|
forwardedProps?: Record<string, any>;
|
|
4796
|
-
/**
|
|
4797
|
-
* @deprecated Use `forwardedProps` instead. `body` continues to work
|
|
4798
|
-
* unchanged — its values are merged into the AG-UI
|
|
4799
|
-
* `RunAgentInput.forwardedProps` field on the wire and are also
|
|
4800
|
-
* mirrored under the legacy `data` field for servers that have not
|
|
4801
|
-
* migrated yet. Will be removed in a future major release.
|
|
4802
|
-
*/
|
|
4803
|
-
body?: Record<string, any>;
|
|
4804
5074
|
/**
|
|
4805
5075
|
* Optional BYOK keyring. On each send the client prepares the resolved
|
|
4806
5076
|
* provider and stamps `x-byok-*` request headers. Keys never go in the body.
|
|
@@ -4845,7 +5115,8 @@ interface ChatClientBaseOptions<TTools extends ReadonlyArray<AnyClientTool> = an
|
|
|
4845
5115
|
*/
|
|
4846
5116
|
onError?: (error: Error) => void;
|
|
4847
5117
|
/**
|
|
4848
|
-
* Callback when messages change
|
|
5118
|
+
* Callback when messages change. Receives the client's live array, not the
|
|
5119
|
+
* frozen snapshot copy. Do not change it in place; use `setMessagesManually`.
|
|
4849
5120
|
*/
|
|
4850
5121
|
onMessagesChange?: (messages: Array<UIMessage<TTools>>) => void;
|
|
4851
5122
|
/**
|
|
@@ -4894,7 +5165,7 @@ interface ChatClientBaseOptions<TTools extends ReadonlyArray<AnyClientTool> = an
|
|
|
4894
5165
|
queue?: QueueOption;
|
|
4895
5166
|
/**
|
|
4896
5167
|
* Callback when the pending send queue changes (enqueue, cancel, drain,
|
|
4897
|
-
* or flush).
|
|
5168
|
+
* or flush). Receives a live array, not the frozen snapshot copy.
|
|
4898
5169
|
*/
|
|
4899
5170
|
onQueueChange?: (queue: Array<QueuedMessage>) => void;
|
|
4900
5171
|
/**
|
|
@@ -4958,12 +5229,12 @@ interface ChatClientBaseOptions<TTools extends ReadonlyArray<AnyClientTool> = an
|
|
|
4958
5229
|
}
|
|
4959
5230
|
/**
|
|
4960
5231
|
* Options for `ChatClient`. Exactly one of `connection` or `fetcher` must be
|
|
4961
|
-
* provided — the type-level XOR is enforced via `ChatTransport`.
|
|
4962
|
-
*
|
|
5232
|
+
* provided — the type-level XOR is enforced via `ChatTransport`. `threadId`
|
|
5233
|
+
* is required. See {@link ChatPersistenceOptions}.
|
|
4963
5234
|
*/
|
|
4964
5235
|
type ChatClientOptions<TTools extends ReadonlyArray<AnyClientTool> = any, TContext = InferredClientContext<TTools>, TInterrupts extends ReadonlyArray<InterruptDefinition<any, any, any, any>> = readonly []> = DistributedOmit<ChatClientBaseOptions<TTools, TContext, TInterrupts>, 'context'> & ClientContextOptionFromTools<TTools, TContext> & ChatTransport & ChatPersistenceOptions<TTools>;
|
|
4965
5236
|
//#endregion
|
|
4966
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@0.
|
|
5237
|
+
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai-client/dist/esm/connection-adapters.d.ts
|
|
4967
5238
|
/**
|
|
4968
5239
|
* Per-send context provided by the chat client to the connection adapter.
|
|
4969
5240
|
* The adapter combines this with serialized messages to build a full
|
|
@@ -4990,7 +5261,7 @@ interface ConnectConnectionAdapter {
|
|
|
4990
5261
|
/**
|
|
4991
5262
|
* Connect and return an async iterable of StreamChunks.
|
|
4992
5263
|
*/
|
|
4993
|
-
connect: (messages: Array<UIMessage$1> | Array<ModelMessage>, data
|
|
5264
|
+
connect: (messages: Array<UIMessage$1> | Array<ModelMessage>, data: Record<string, any> | undefined, abortSignal: AbortSignal | undefined, runContext: RunAgentInputContext) => AsyncIterable<StreamChunk>;
|
|
4994
5265
|
/**
|
|
4995
5266
|
* Fetch server-driven hydration for a generation `threadId`: the last
|
|
4996
5267
|
* generation's resume snapshot, plus a cursor to a run still generating if
|
|
@@ -5086,6 +5357,12 @@ interface ChatHydrationResult {
|
|
|
5086
5357
|
runId: string;
|
|
5087
5358
|
pending: Array<ChatPendingInterrupt>;
|
|
5088
5359
|
} | null;
|
|
5360
|
+
/**
|
|
5361
|
+
* Every wait of the thread, also one with no interrupt, for example a
|
|
5362
|
+
* question that a tool asks. A harness server sends the `pendingWaits` of
|
|
5363
|
+
* its snapshot. Old servers omit it.
|
|
5364
|
+
*/
|
|
5365
|
+
pendingWaits?: Array<unknown>;
|
|
5089
5366
|
/**
|
|
5090
5367
|
* Whether this window is a slice of a longer thread.
|
|
5091
5368
|
* `cursor` is set when `truncated` is true and is sent back as `before`.
|
|
@@ -5105,7 +5382,7 @@ interface SubscribeConnectionAdapter {
|
|
|
5105
5382
|
/**
|
|
5106
5383
|
* Send a request; chunks arrive through subscribe().
|
|
5107
5384
|
*/
|
|
5108
|
-
send: (messages: Array<UIMessage$1> | Array<ModelMessage>, data
|
|
5385
|
+
send: (messages: Array<UIMessage$1> | Array<ModelMessage>, data: Record<string, any> | undefined, abortSignal: AbortSignal | undefined, runContext: RunAgentInputContext) => Promise<void>;
|
|
5109
5386
|
/**
|
|
5110
5387
|
* Re-attach to an existing run by id, replaying its stream from the start off
|
|
5111
5388
|
* the server's delivery-durability sink. Present only when the underlying
|
|
@@ -5126,12 +5403,10 @@ interface SubscribeConnectionAdapter {
|
|
|
5126
5403
|
*/
|
|
5127
5404
|
type ConnectionAdapter = ConnectConnectionAdapter | SubscribeConnectionAdapter;
|
|
5128
5405
|
//#endregion
|
|
5129
|
-
//#region ../node_modules/.bun/@tanstack+ai-client@0.
|
|
5406
|
+
//#region ../node_modules/.bun/@tanstack+ai-client@1.0.0+367daa2260c029d6/node_modules/@tanstack/ai-client/dist/esm/chat-client.d.ts
|
|
5130
5407
|
type ChatClientUpdateOptionsWithoutContext<TTools extends ReadonlyArray<AnyClientTool>, TInterrupts extends ReadonlyArray<InterruptDefinition<any, any, any, any>> = readonly []> = {
|
|
5131
5408
|
connection?: ConnectionAdapter;
|
|
5132
5409
|
fetcher?: ChatFetcher;
|
|
5133
|
-
/** @deprecated Use `forwardedProps` instead. */
|
|
5134
|
-
body?: Record<string, any>;
|
|
5135
5410
|
forwardedProps?: Record<string, any>;
|
|
5136
5411
|
byok?: ByokClient;
|
|
5137
5412
|
byokProvider?: () => string | undefined;
|
|
@@ -5172,11 +5447,19 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5172
5447
|
private readonly subagentHandles;
|
|
5173
5448
|
private readonly stoppedSubagentIds;
|
|
5174
5449
|
private connection;
|
|
5175
|
-
private
|
|
5176
|
-
private threadId;
|
|
5450
|
+
private readonly threadId;
|
|
5177
5451
|
private readonly persistor?;
|
|
5178
5452
|
private readonly clearedStreamTracker;
|
|
5179
|
-
private
|
|
5453
|
+
private readonly snapshotAtom;
|
|
5454
|
+
private get status();
|
|
5455
|
+
private get isLoading();
|
|
5456
|
+
private get error();
|
|
5457
|
+
private get isSubscribed();
|
|
5458
|
+
private get connectionStatus();
|
|
5459
|
+
private get sessionGenerating();
|
|
5460
|
+
private get hasOlderMessages();
|
|
5461
|
+
private get isHydrating();
|
|
5462
|
+
private get currentRunId();
|
|
5180
5463
|
private lastResume;
|
|
5181
5464
|
private readonly runParents;
|
|
5182
5465
|
private readonly supersededInterruptRunIds;
|
|
@@ -5190,7 +5473,6 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5190
5473
|
private pendingResumeItems;
|
|
5191
5474
|
private activeResumeThreadId;
|
|
5192
5475
|
private activeResumeRunId;
|
|
5193
|
-
private bodyOption;
|
|
5194
5476
|
private forwardedPropsOption;
|
|
5195
5477
|
private byok;
|
|
5196
5478
|
private byokProvider;
|
|
@@ -5221,11 +5503,6 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5221
5503
|
* deliverers cannot both append a user message before only one stream runs.
|
|
5222
5504
|
*/
|
|
5223
5505
|
private deliverClaim;
|
|
5224
|
-
private isLoading;
|
|
5225
|
-
private isSubscribed;
|
|
5226
|
-
private error;
|
|
5227
|
-
private status;
|
|
5228
|
-
private connectionStatus;
|
|
5229
5506
|
private abortController;
|
|
5230
5507
|
private readonly clientToolsRef;
|
|
5231
5508
|
private readonly devtoolsBridge;
|
|
@@ -5258,7 +5535,6 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5258
5535
|
private streamContinuationGeneration;
|
|
5259
5536
|
private continuationSkipped;
|
|
5260
5537
|
private draining;
|
|
5261
|
-
private sessionGenerating;
|
|
5262
5538
|
private readonly activeRunIds;
|
|
5263
5539
|
/** Latched by `dispose()`; stops any late async callback starting new work. */
|
|
5264
5540
|
private disposed;
|
|
@@ -5270,8 +5546,6 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5270
5546
|
private hydrationInFlight;
|
|
5271
5547
|
/** An async storage adapter is still reading the persisted transcript. */
|
|
5272
5548
|
private storeHydrating;
|
|
5273
|
-
/** See {@link getIsHydrating}. */
|
|
5274
|
-
private isHydrating;
|
|
5275
5549
|
/** Constructor inputs `attach()` needs on every re-attach, not just the first. */
|
|
5276
5550
|
private readonly rejoinRunId;
|
|
5277
5551
|
private readonly cachesMessages;
|
|
@@ -5280,7 +5554,6 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5280
5554
|
* `persistence === true`.
|
|
5281
5555
|
*/
|
|
5282
5556
|
private readonly historyPageSize;
|
|
5283
|
-
private hasOlderMessages;
|
|
5284
5557
|
private olderMessagesCursor;
|
|
5285
5558
|
private readonly knownServerMessageIds;
|
|
5286
5559
|
private loadOlderMessagesInFlight;
|
|
@@ -5360,7 +5633,6 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5360
5633
|
*/
|
|
5361
5634
|
private failHydration;
|
|
5362
5635
|
mountDevtools(): void;
|
|
5363
|
-
private ensureThreadId;
|
|
5364
5636
|
/**
|
|
5365
5637
|
* Drain a runId-less RUN_ERROR that belongs to a cleared run the client is
|
|
5366
5638
|
* still tracking. The persistor owns the cleared-run bookkeeping; the client
|
|
@@ -5395,8 +5667,6 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5395
5667
|
private setCurrentRunId;
|
|
5396
5668
|
getInterruptState(): ChatInterruptState<TTools, TInterrupts>;
|
|
5397
5669
|
getInterrupts(): BoundInterrupts<TTools, TInterrupts>;
|
|
5398
|
-
/** @deprecated Use getInterrupts(). */
|
|
5399
|
-
getPendingInterrupts(): BoundInterrupts<TTools, TInterrupts>;
|
|
5400
5670
|
resolveInterrupts(approved: boolean): void;
|
|
5401
5671
|
resolveInterrupts(resolver: (interrupt: ResolvableChatInterrupt<TTools, TInterrupts>) => undefined): void;
|
|
5402
5672
|
cancelInterrupts(): void;
|
|
@@ -5404,12 +5674,27 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5404
5674
|
/** Unsafe low-level resume escape hatch. Prefer bound interrupt methods. */
|
|
5405
5675
|
resumeInterruptsUnsafe(resume: Array<RunAgentResumeItem>, state?: ChatResumeState): Promise<boolean>;
|
|
5406
5676
|
private resumeInterruptsUnsafeForGeneration;
|
|
5407
|
-
/** @deprecated Use bound interrupt methods or resumeInterruptsUnsafe(). */
|
|
5408
|
-
resumeInterrupts(resume: Array<RunAgentResumeItem>, state?: ChatResumeState): Promise<boolean>;
|
|
5409
5677
|
private submitInterruptBatch;
|
|
5410
5678
|
private takeInterruptSubmissionFailure;
|
|
5411
5679
|
private interruptGeneration;
|
|
5412
5680
|
private generateUniqueId;
|
|
5681
|
+
/** Frozen copies of unchanged messages and parts, keyed by the live object. */
|
|
5682
|
+
private readonly frozenMessages;
|
|
5683
|
+
private freezeSnapshotQueue;
|
|
5684
|
+
/** The atom with messages, queue, and interrupt state read fresh. */
|
|
5685
|
+
private readSnapshot;
|
|
5686
|
+
/**
|
|
5687
|
+
* Subscribe to UI snapshot changes. Does not fire with the current value;
|
|
5688
|
+
* read {@link getSnapshot} first.
|
|
5689
|
+
*
|
|
5690
|
+
* Named separately from {@link subscribe} (the live connection loop).
|
|
5691
|
+
*/
|
|
5692
|
+
subscribeSnapshot: (listener: () => void) => (() => void);
|
|
5693
|
+
/**
|
|
5694
|
+
* Current UI snapshot. The snapshot, `messages`, `queue`, and their entries
|
|
5695
|
+
* are frozen copies. `interruptState` is the interrupt manager's own state.
|
|
5696
|
+
*/
|
|
5697
|
+
getSnapshot: () => ChatClientSnapshot<TTools, TInterrupts>;
|
|
5413
5698
|
private setIsLoading;
|
|
5414
5699
|
/**
|
|
5415
5700
|
* A send or a clear now owns the transcript. A load that is still pending can
|
|
@@ -5496,12 +5781,13 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5496
5781
|
* @param content - The message content. Can be:
|
|
5497
5782
|
* - A simple string for text-only messages
|
|
5498
5783
|
* - A MultimodalContent object with content array and optional custom ID
|
|
5499
|
-
* @param body - Optional body parameters to merge
|
|
5500
|
-
*
|
|
5784
|
+
* @param body - Optional body parameters to merge into this request's
|
|
5785
|
+
* forwardedProps, over the forwardedProps option. Uses
|
|
5786
|
+
* shallow merge with per-message body taking priority.
|
|
5501
5787
|
* @param sendOptions - Per-call overrides. `{ whenBusy }` overrides the
|
|
5502
5788
|
* queue policy for this one send. `{ body }`
|
|
5503
5789
|
* shallow-merges with `body` and with the chat-level
|
|
5504
|
-
* `
|
|
5790
|
+
* `forwardedProps`. `sendOptions.body` wins
|
|
5505
5791
|
* on key collisions. Framework hooks forward this
|
|
5506
5792
|
* object as their second argument.
|
|
5507
5793
|
*
|
|
@@ -5605,13 +5891,6 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5605
5891
|
addToolResult(result: ClientToolResult): Promise<void>;
|
|
5606
5892
|
private addToolResultForClientTool;
|
|
5607
5893
|
private validateClientToolOutput;
|
|
5608
|
-
/**
|
|
5609
|
-
* Respond to a tool approval request
|
|
5610
|
-
*/
|
|
5611
|
-
addToolApprovalResponse(response: {
|
|
5612
|
-
id: string;
|
|
5613
|
-
approved: boolean;
|
|
5614
|
-
}): Promise<void>;
|
|
5615
5894
|
/**
|
|
5616
5895
|
* Queue an action to be executed after the current stream ends
|
|
5617
5896
|
*/
|
|
@@ -5652,6 +5931,7 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5652
5931
|
* are; {@link getHasOlderMessages} stays true.
|
|
5653
5932
|
*/
|
|
5654
5933
|
loadOlderMessages(): Promise<void>;
|
|
5934
|
+
private setHasOlderMessages;
|
|
5655
5935
|
private resetHistoryPaging;
|
|
5656
5936
|
private applyHydrationPage;
|
|
5657
5937
|
private rememberServerMessageIds;
|
|
@@ -5731,7 +6011,7 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
5731
6011
|
/**
|
|
5732
6012
|
* Manually set messages
|
|
5733
6013
|
*/
|
|
5734
|
-
setMessagesManually(messages:
|
|
6014
|
+
setMessagesManually(messages: ReadonlyArray<UIMessage<TTools>>): void;
|
|
5735
6015
|
/**
|
|
5736
6016
|
* Update options refs (for use in React hooks to avoid recreating client)
|
|
5737
6017
|
*/
|
|
@@ -6039,8 +6319,9 @@ type RenderWidget = (input: RenderWidgetInput, toolCallId: string) => Promise<{
|
|
|
6039
6319
|
}>;
|
|
6040
6320
|
/** What declaring a widget to the agent needs; `render` stays with whoever draws it. */
|
|
6041
6321
|
type WidgetDeclaration = Pick<WidgetDefinition, "description" | "parameters">;
|
|
6322
|
+
type HostExecutionGuard = (name: string, declaration: ToolDefinition, toolCallId?: string) => () => ToolDefinition;
|
|
6042
6323
|
/** The full tool set declared to the agent; `render_widget` only when widgets are registered. */
|
|
6043
|
-
declare function buildAgentTools(widgets: Record<string, WidgetDeclaration>, hostTools: Record<string, ToolDefinition>, renderWidget: RenderWidget, debug?: DebugLogger): ((ClientTool<{
|
|
6324
|
+
declare function buildAgentTools(widgets: Record<string, WidgetDeclaration>, hostTools: Record<string, ToolDefinition>, renderWidget: RenderWidget, debug?: DebugLogger, guardHostExecution?: HostExecutionGuard): ((ClientTool<{
|
|
6044
6325
|
type: "object";
|
|
6045
6326
|
properties: {
|
|
6046
6327
|
widget: {
|
|
@@ -6406,11 +6687,12 @@ interface AstralBeamChatCore {
|
|
|
6406
6687
|
filename: string;
|
|
6407
6688
|
mimeType: string;
|
|
6408
6689
|
}) => Promise<UploadedChatFile>;
|
|
6409
|
-
|
|
6690
|
+
getThreadAttachment: (params: GetThreadAttachmentParams, options?: {
|
|
6691
|
+
preview?: boolean;
|
|
6692
|
+
}) => Promise<Blob>;
|
|
6410
6693
|
getMcpCatalog: () => Promise<McpCatalog>;
|
|
6411
6694
|
manageMcpConnection: (operation: McpConnectionOperation) => ReturnType<typeof manageMcpConnection>;
|
|
6412
6695
|
authorizeMcpConnection: (input: Parameters<typeof authorizeMcpConnection>[0]) => Promise<void>;
|
|
6413
|
-
getAttachment: (messageId: string, partId: string) => Promise<Blob>;
|
|
6414
6696
|
/** Tears the session down: the connection, authentication, and widget renders. */
|
|
6415
6697
|
dispose: () => void;
|
|
6416
6698
|
}
|
|
@@ -6499,4 +6781,4 @@ interface WebPartMetadata {
|
|
|
6499
6781
|
web?: WebEvidence;
|
|
6500
6782
|
}
|
|
6501
6783
|
//#endregion
|
|
6502
|
-
export {
|
|
6784
|
+
export { ChatSubmissionCallbacks as A, RenderWidgetInput as B, lastPartInProgress as C, AstralBeamChatState as D, AstralBeamChatCoreOptions as E, McpCatalog as F, SandboxStatus as G, SandboxArtifact as H, McpConnectionOperation as I, ParametersSchema as J, InferParameters as K, ChatAuthenticationState as L, createAstralBeamChat as M, ChatPendingInteraction as N, ChatStreamCallbacks as O, ChatThread as P, WidgetDeclaration as R, isSettledToolCall as S, AstralBeamChatCore as T, SandboxCommandRun as U, SandboxActivity as V, SandboxFileWrite as W, ToolDefinition as X, StandardSchemaV1 as Y, readSandboxArtifact as _, defineTool as a, sandboxRefusal as b, SANDBOX_LIST_FILES_TOOL as c, SANDBOX_RUN_COMMAND_TOOL as d, SANDBOX_STATUS_EVENT as f, isSandboxTool as g, describeSandboxCommandRun as h, WebSource as i, WidgetRenderRequest as j, ChatSubmission as k, SANDBOX_PUBLISH_ARTIFACT_TOOL as l, collectSandboxActivity as m, WebEvidence as n, ASK_QUESTIONNAIRE_TOOL as o, SANDBOX_WRITE_FILE_TOOL as p, JsonSchemaObject as q, WebPartMetadata as r, RENDER_WIDGET_TOOL as s, WebCitation as t, SANDBOX_READ_FILE_TOOL as u, readSandboxCommandRun as v, AgentToolInfo as w, hasPendingToolRun as x, readSandboxFileWrite as y, buildAgentTools as z };
|