@astralbeam/sdk 0.13.6 → 0.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{api-ImuMGEar.d.ts → api-B_IIYO7t.d.ts} +3 -1
- package/dist/{api-DiwSihrG.js → api-CsRaydMf.js} +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +1 -1
- package/dist/client.js +1 -1
- package/dist/{core-c6eS1h0R.js → core-BhxhgxMN.js} +1863 -524
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/{index-B3y8nySY.d.ts → index-CpLgwh4y.d.ts} +2798 -387
- package/dist/react.d.ts +2 -2
- package/dist/react.js +2 -2
- package/dist/{widget-C31rEqSh.js → widget-DtcXZ3qb.js} +12 -6
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as CurrentUser } from "./api-
|
|
1
|
+
import { f as CurrentUser } from "./api-B_IIYO7t.js";
|
|
2
2
|
|
|
3
3
|
//#region node_modules/.deno/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
4
4
|
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
@@ -117,7 +117,7 @@ declare namespace StandardJSONSchemaV1 {
|
|
|
117
117
|
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
118
118
|
}
|
|
119
119
|
//#endregion
|
|
120
|
-
//#region node_modules/.deno/@tanstack+ai@0.
|
|
120
|
+
//#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/interrupts.d.ts
|
|
121
121
|
interface InterruptCorrelation {
|
|
122
122
|
threadId: string;
|
|
123
123
|
interruptedRunId: string;
|
|
@@ -198,7 +198,7 @@ declare global {
|
|
|
198
198
|
var __TANSTACK_EVENT_TARGET__: EventTarget | null;
|
|
199
199
|
}
|
|
200
200
|
//#endregion
|
|
201
|
-
//#region node_modules/.deno/@tanstack+ai-event-client@0.
|
|
201
|
+
//#region node_modules/.deno/@tanstack+ai-event-client@0.13.0/node_modules/@tanstack/ai-event-client/dist/esm/envelope.d.ts
|
|
202
202
|
type AIDevtoolsEventSource = 'client' | 'server' | 'devtools';
|
|
203
203
|
type AIDevtoolsEventVisibility = 'user-visible' | 'client-state' | 'server-internal' | 'devtools-action';
|
|
204
204
|
interface AIDevtoolsEventEnvelope {
|
|
@@ -224,7 +224,7 @@ declare global {
|
|
|
224
224
|
var __TANSTACK_AI_DEVTOOLS_RUNTIME_ID__: string | undefined;
|
|
225
225
|
}
|
|
226
226
|
//#endregion
|
|
227
|
-
//#region node_modules/.deno/@tanstack+ai-event-client@0.
|
|
227
|
+
//#region node_modules/.deno/@tanstack+ai-event-client@0.13.0/node_modules/@tanstack/ai-event-client/dist/esm/index.d.ts
|
|
228
228
|
/**
|
|
229
229
|
* Detailed breakdown of prompt/input token usage.
|
|
230
230
|
* Fields are populated based on provider support.
|
|
@@ -320,7 +320,7 @@ type ProviderUsageDetails = Record<string, NonNullable<unknown>>;
|
|
|
320
320
|
* it defaults to {@link ProviderUsageDetails} (an open, serializable record) for
|
|
321
321
|
* generic consumers.
|
|
322
322
|
*/
|
|
323
|
-
interface TokenUsage<TProviderDetails = ProviderUsageDetails> {
|
|
323
|
+
interface TokenUsage$1<TProviderDetails = ProviderUsageDetails> {
|
|
324
324
|
/** Total input/prompt tokens */
|
|
325
325
|
promptTokens: number;
|
|
326
326
|
/** Total output/completion tokens */
|
|
@@ -363,143 +363,11 @@ interface TokenUsage<TProviderDetails = ProviderUsageDetails> {
|
|
|
363
363
|
costDetails?: UsageCostBreakdown;
|
|
364
364
|
}
|
|
365
365
|
//#endregion
|
|
366
|
-
//#region node_modules/.deno/@ag-ui+core@
|
|
367
|
-
//#region src/types.d.ts
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
}
|
|
372
|
-
interface ToolCall$1 {
|
|
373
|
-
id: string;
|
|
374
|
-
type: "function";
|
|
375
|
-
function: FunctionCall;
|
|
376
|
-
encryptedValue?: string;
|
|
377
|
-
}
|
|
378
|
-
interface TextInputContent {
|
|
379
|
-
type: "text";
|
|
380
|
-
text: string;
|
|
381
|
-
}
|
|
382
|
-
interface InputContentDataSource {
|
|
383
|
-
type: "data";
|
|
384
|
-
value: string;
|
|
385
|
-
mimeType: string;
|
|
386
|
-
}
|
|
387
|
-
interface InputContentUrlSource {
|
|
388
|
-
type: "url";
|
|
389
|
-
value: string;
|
|
390
|
-
mimeType?: string;
|
|
391
|
-
}
|
|
392
|
-
type InputContentSource = InputContentDataSource | InputContentUrlSource;
|
|
393
|
-
interface ImageInputContent {
|
|
394
|
-
type: "image";
|
|
395
|
-
source: InputContentSource;
|
|
396
|
-
metadata?: unknown;
|
|
397
|
-
}
|
|
398
|
-
interface AudioInputContent {
|
|
399
|
-
type: "audio";
|
|
400
|
-
source: InputContentSource;
|
|
401
|
-
metadata?: unknown;
|
|
402
|
-
}
|
|
403
|
-
interface VideoInputContent {
|
|
404
|
-
type: "video";
|
|
405
|
-
source: InputContentSource;
|
|
406
|
-
metadata?: unknown;
|
|
407
|
-
}
|
|
408
|
-
interface DocumentInputContent {
|
|
409
|
-
type: "document";
|
|
410
|
-
source: InputContentSource;
|
|
411
|
-
metadata?: unknown;
|
|
412
|
-
}
|
|
413
|
-
interface BinaryInputContent {
|
|
414
|
-
type: "binary";
|
|
415
|
-
mimeType: string;
|
|
416
|
-
id?: string;
|
|
417
|
-
url?: string;
|
|
418
|
-
data?: string;
|
|
419
|
-
filename?: string;
|
|
420
|
-
}
|
|
421
|
-
type InputContent = TextInputContent | ImageInputContent | AudioInputContent | VideoInputContent | DocumentInputContent | BinaryInputContent;
|
|
422
|
-
interface BaseMessageFields {
|
|
423
|
-
id: string;
|
|
424
|
-
name?: string;
|
|
425
|
-
encryptedValue?: string;
|
|
426
|
-
}
|
|
427
|
-
interface DeveloperMessage extends BaseMessageFields {
|
|
428
|
-
role: "developer";
|
|
429
|
-
content: string;
|
|
430
|
-
}
|
|
431
|
-
interface SystemMessage extends BaseMessageFields {
|
|
432
|
-
role: "system";
|
|
433
|
-
content: string;
|
|
434
|
-
}
|
|
435
|
-
interface AssistantMessage extends BaseMessageFields {
|
|
436
|
-
role: "assistant";
|
|
437
|
-
content?: string;
|
|
438
|
-
toolCalls?: ToolCall$1[];
|
|
439
|
-
}
|
|
440
|
-
interface UserMessage extends BaseMessageFields {
|
|
441
|
-
role: "user";
|
|
442
|
-
content: string | InputContent[];
|
|
443
|
-
}
|
|
444
|
-
interface ToolMessage {
|
|
445
|
-
id: string;
|
|
446
|
-
content: string;
|
|
447
|
-
role: "tool";
|
|
448
|
-
toolCallId: string;
|
|
449
|
-
error?: string;
|
|
450
|
-
encryptedValue?: string;
|
|
451
|
-
}
|
|
452
|
-
interface ActivityMessage {
|
|
453
|
-
id: string;
|
|
454
|
-
role: "activity";
|
|
455
|
-
activityType: string;
|
|
456
|
-
content: Record<string, any>;
|
|
457
|
-
}
|
|
458
|
-
interface ReasoningMessage {
|
|
459
|
-
id: string;
|
|
460
|
-
role: "reasoning";
|
|
461
|
-
content: string;
|
|
462
|
-
encryptedValue?: string;
|
|
463
|
-
}
|
|
464
|
-
type Message = DeveloperMessage | SystemMessage | AssistantMessage | UserMessage | ToolMessage | ActivityMessage | ReasoningMessage;
|
|
465
|
-
interface Context {
|
|
466
|
-
description: string;
|
|
467
|
-
value: string;
|
|
468
|
-
}
|
|
469
|
-
interface Tool$2 {
|
|
470
|
-
name: string;
|
|
471
|
-
description: string;
|
|
472
|
-
parameters?: any;
|
|
473
|
-
metadata?: Record<string, any>;
|
|
474
|
-
}
|
|
475
|
-
interface Interrupt$1 {
|
|
476
|
-
id: string;
|
|
477
|
-
reason: string;
|
|
478
|
-
message?: string;
|
|
479
|
-
toolCallId?: string;
|
|
480
|
-
responseSchema?: Record<string, any>;
|
|
481
|
-
expiresAt?: string;
|
|
482
|
-
metadata?: Record<string, any>;
|
|
483
|
-
}
|
|
484
|
-
type ResumeStatus = "resolved" | "cancelled";
|
|
485
|
-
interface ResumeEntry {
|
|
486
|
-
interruptId: string;
|
|
487
|
-
status: ResumeStatus;
|
|
488
|
-
payload?: any;
|
|
489
|
-
}
|
|
490
|
-
interface RunAgentInput {
|
|
491
|
-
threadId: string;
|
|
492
|
-
runId: string;
|
|
493
|
-
parentRunId?: string;
|
|
494
|
-
state?: any;
|
|
495
|
-
messages: Message[];
|
|
496
|
-
tools: Tool$2[];
|
|
497
|
-
context: Context[];
|
|
498
|
-
forwardedProps?: any;
|
|
499
|
-
resume?: ResumeEntry[];
|
|
500
|
-
}
|
|
501
|
-
//#endregion
|
|
502
|
-
//#region src/events.d.ts
|
|
366
|
+
//#region node_modules/.deno/@ag-ui+core@1.0.0/node_modules/@ag-ui/core/dist/version-DEKfpZNa.d.ts
|
|
367
|
+
//#region src/generated/types.d.ts
|
|
368
|
+
/**
|
|
369
|
+
* The discriminator carried by every event.
|
|
370
|
+
*/
|
|
503
371
|
declare enum EventType {
|
|
504
372
|
TEXT_MESSAGE_START = "TEXT_MESSAGE_START",
|
|
505
373
|
TEXT_MESSAGE_CONTENT = "TEXT_MESSAGE_CONTENT",
|
|
@@ -510,16 +378,6 @@ declare enum EventType {
|
|
|
510
378
|
TOOL_CALL_END = "TOOL_CALL_END",
|
|
511
379
|
TOOL_CALL_CHUNK = "TOOL_CALL_CHUNK",
|
|
512
380
|
TOOL_CALL_RESULT = "TOOL_CALL_RESULT",
|
|
513
|
-
/** @deprecated Use REASONING_START instead. Will be removed in 1.0.0. */
|
|
514
|
-
THINKING_START = "THINKING_START",
|
|
515
|
-
/** @deprecated Use REASONING_END instead. Will be removed in 1.0.0. */
|
|
516
|
-
THINKING_END = "THINKING_END",
|
|
517
|
-
/** @deprecated Use REASONING_MESSAGE_START instead. Will be removed in 1.0.0. */
|
|
518
|
-
THINKING_TEXT_MESSAGE_START = "THINKING_TEXT_MESSAGE_START",
|
|
519
|
-
/** @deprecated Use REASONING_MESSAGE_CONTENT instead. Will be removed in 1.0.0. */
|
|
520
|
-
THINKING_TEXT_MESSAGE_CONTENT = "THINKING_TEXT_MESSAGE_CONTENT",
|
|
521
|
-
/** @deprecated Use REASONING_MESSAGE_END instead. Will be removed in 1.0.0. */
|
|
522
|
-
THINKING_TEXT_MESSAGE_END = "THINKING_TEXT_MESSAGE_END",
|
|
523
381
|
STATE_SNAPSHOT = "STATE_SNAPSHOT",
|
|
524
382
|
STATE_DELTA = "STATE_DELTA",
|
|
525
383
|
MESSAGES_SNAPSHOT = "MESSAGES_SNAPSHOT",
|
|
@@ -538,149 +396,2453 @@ declare enum EventType {
|
|
|
538
396
|
REASONING_MESSAGE_END = "REASONING_MESSAGE_END",
|
|
539
397
|
REASONING_MESSAGE_CHUNK = "REASONING_MESSAGE_CHUNK",
|
|
540
398
|
REASONING_END = "REASONING_END",
|
|
541
|
-
REASONING_ENCRYPTED_VALUE = "REASONING_ENCRYPTED_VALUE"
|
|
399
|
+
REASONING_ENCRYPTED_VALUE = "REASONING_ENCRYPTED_VALUE",
|
|
400
|
+
SUBAGENT_STARTED = "SUBAGENT_STARTED",
|
|
401
|
+
SUBAGENT_FINISHED = "SUBAGENT_FINISHED",
|
|
402
|
+
SUBAGENT_ERROR = "SUBAGENT_ERROR"
|
|
542
403
|
}
|
|
404
|
+
/**
|
|
405
|
+
* Extra information attached to an event, a message, a tool call, a tool, an
|
|
406
|
+
* interrupt or a resume entry. Open by key: any JSON value is allowed under a
|
|
407
|
+
* key, including null, because a null there is meaningful data. The object
|
|
408
|
+
* itself may be absent but is never null when present. The key ag-ui is
|
|
409
|
+
* reserved for the protocol's own use; reservation is by convention, since
|
|
410
|
+
* validating the shape of a key's value would contradict being open by key.
|
|
411
|
+
*/
|
|
412
|
+
type Metadata = Record<string, any>;
|
|
413
|
+
/**
|
|
414
|
+
* An opaque handle for one subagent invocation, not a reusable name for a
|
|
415
|
+
* subagent definition: two invocations of the same subagent carry two
|
|
416
|
+
* different values. Named to mirror runId one level down, the way the
|
|
417
|
+
* subagent's name mirrors agentId.
|
|
418
|
+
*/
|
|
419
|
+
type SubagentRunId = string;
|
|
420
|
+
/**
|
|
421
|
+
* The roles a streamed text message may take. Excludes tool, which is carried
|
|
422
|
+
* by TOOL_CALL_RESULT rather than streamed as text.
|
|
423
|
+
*/
|
|
543
424
|
type TextMessageRole = "developer" | "system" | "assistant" | "user";
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
425
|
+
/**
|
|
426
|
+
* Opens a streamed text message. The content arrives as TEXT_MESSAGE_CONTENT
|
|
427
|
+
* events and the message closes with TEXT_MESSAGE_END.
|
|
428
|
+
*/
|
|
429
|
+
type TextMessageStartEvent$1 = {
|
|
430
|
+
/**
|
|
431
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
432
|
+
*/
|
|
433
|
+
type: EventType.TEXT_MESSAGE_START;
|
|
434
|
+
/**
|
|
435
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
436
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
437
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
438
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
439
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
440
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
441
|
+
* protocol computes with this value.
|
|
442
|
+
*/
|
|
547
443
|
timestamp?: number;
|
|
444
|
+
/**
|
|
445
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
446
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
447
|
+
* model. Any JSON value.
|
|
448
|
+
*/
|
|
548
449
|
rawEvent?: any;
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
450
|
+
/**
|
|
451
|
+
* Extra information attached to this event.
|
|
452
|
+
*/
|
|
453
|
+
metadata?: Metadata;
|
|
454
|
+
/**
|
|
455
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
456
|
+
* produced it directly.
|
|
457
|
+
*/
|
|
458
|
+
subagentRunId?: SubagentRunId;
|
|
459
|
+
/**
|
|
460
|
+
* Identifies the message this stream builds, and ties the later content and
|
|
461
|
+
* end events to it.
|
|
462
|
+
*/
|
|
553
463
|
messageId: string;
|
|
554
|
-
|
|
464
|
+
/**
|
|
465
|
+
* Who the message is from. An absent role means assistant; that meaning is
|
|
466
|
+
* normative and stated in the prose, because a validator treats a default as
|
|
467
|
+
* documentation rather than as behaviour.
|
|
468
|
+
* @default "assistant"
|
|
469
|
+
*/
|
|
470
|
+
role?: TextMessageRole;
|
|
471
|
+
/**
|
|
472
|
+
* An optional display name for the author, for providers that distinguish
|
|
473
|
+
* several participants in one role.
|
|
474
|
+
*/
|
|
555
475
|
name?: string;
|
|
556
|
-
}
|
|
557
|
-
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* Appends a fragment to a streamed text message.
|
|
479
|
+
*/
|
|
480
|
+
type TextMessageContentEvent$1 = {
|
|
481
|
+
/**
|
|
482
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
483
|
+
*/
|
|
558
484
|
type: EventType.TEXT_MESSAGE_CONTENT;
|
|
485
|
+
/**
|
|
486
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
487
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
488
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
489
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
490
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
491
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
492
|
+
* protocol computes with this value.
|
|
493
|
+
*/
|
|
494
|
+
timestamp?: number;
|
|
495
|
+
/**
|
|
496
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
497
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
498
|
+
* model. Any JSON value.
|
|
499
|
+
*/
|
|
500
|
+
rawEvent?: any;
|
|
501
|
+
/**
|
|
502
|
+
* Extra information attached to this event.
|
|
503
|
+
*/
|
|
504
|
+
metadata?: Metadata;
|
|
505
|
+
/**
|
|
506
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
507
|
+
* produced it directly.
|
|
508
|
+
*/
|
|
509
|
+
subagentRunId?: SubagentRunId;
|
|
510
|
+
/**
|
|
511
|
+
* The message this fragment belongs to.
|
|
512
|
+
*/
|
|
559
513
|
messageId: string;
|
|
514
|
+
/**
|
|
515
|
+
* The fragment to append. May be the empty string: providers emit empty
|
|
516
|
+
* deltas as keep-alives and while a tool call is being decided, and
|
|
517
|
+
* rejecting them would kill runs that are working correctly.
|
|
518
|
+
*/
|
|
560
519
|
delta: string;
|
|
561
|
-
}
|
|
562
|
-
|
|
520
|
+
};
|
|
521
|
+
/**
|
|
522
|
+
* Closes a streamed text message.
|
|
523
|
+
*/
|
|
524
|
+
type TextMessageEndEvent$1 = {
|
|
525
|
+
/**
|
|
526
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
527
|
+
*/
|
|
563
528
|
type: EventType.TEXT_MESSAGE_END;
|
|
529
|
+
/**
|
|
530
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
531
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
532
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
533
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
534
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
535
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
536
|
+
* protocol computes with this value.
|
|
537
|
+
*/
|
|
538
|
+
timestamp?: number;
|
|
539
|
+
/**
|
|
540
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
541
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
542
|
+
* model. Any JSON value.
|
|
543
|
+
*/
|
|
544
|
+
rawEvent?: any;
|
|
545
|
+
/**
|
|
546
|
+
* Extra information attached to this event.
|
|
547
|
+
*/
|
|
548
|
+
metadata?: Metadata;
|
|
549
|
+
/**
|
|
550
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
551
|
+
* produced it directly.
|
|
552
|
+
*/
|
|
553
|
+
subagentRunId?: SubagentRunId;
|
|
554
|
+
/**
|
|
555
|
+
* The message being closed.
|
|
556
|
+
*/
|
|
564
557
|
messageId: string;
|
|
565
|
-
}
|
|
566
|
-
|
|
558
|
+
};
|
|
559
|
+
/**
|
|
560
|
+
* A shorthand that stands in for a start, content and end sequence, for
|
|
561
|
+
* producers that cannot know in advance where a message begins. Every field is
|
|
562
|
+
* optional because a continuation chunk omits what has not changed; which
|
|
563
|
+
* message a field-less chunk continues is a sequence question the prose
|
|
564
|
+
* specification answers.
|
|
565
|
+
*/
|
|
566
|
+
type TextMessageChunkEvent$1 = {
|
|
567
|
+
/**
|
|
568
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
569
|
+
*/
|
|
570
|
+
type: EventType.TEXT_MESSAGE_CHUNK;
|
|
571
|
+
/**
|
|
572
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
573
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
574
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
575
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
576
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
577
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
578
|
+
* protocol computes with this value.
|
|
579
|
+
*/
|
|
580
|
+
timestamp?: number;
|
|
581
|
+
/**
|
|
582
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
583
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
584
|
+
* model. Any JSON value.
|
|
585
|
+
*/
|
|
586
|
+
rawEvent?: any;
|
|
587
|
+
/**
|
|
588
|
+
* Extra information attached to this event.
|
|
589
|
+
*/
|
|
590
|
+
metadata?: Metadata;
|
|
591
|
+
/**
|
|
592
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
593
|
+
* produced it directly.
|
|
594
|
+
*/
|
|
595
|
+
subagentRunId?: SubagentRunId;
|
|
596
|
+
/**
|
|
597
|
+
* The message this chunk belongs to. Absent continues the message already
|
|
598
|
+
* open.
|
|
599
|
+
*/
|
|
600
|
+
messageId?: string;
|
|
601
|
+
/**
|
|
602
|
+
* Who the message is from, on the chunk that opens it.
|
|
603
|
+
*/
|
|
604
|
+
role?: TextMessageRole;
|
|
605
|
+
/**
|
|
606
|
+
* The fragment to append. May be the empty string.
|
|
607
|
+
*/
|
|
608
|
+
delta?: string;
|
|
609
|
+
/**
|
|
610
|
+
* An optional display name for the author.
|
|
611
|
+
*/
|
|
612
|
+
name?: string;
|
|
613
|
+
};
|
|
614
|
+
/**
|
|
615
|
+
* Opens a tool call. The arguments arrive as TOOL_CALL_ARGS events and the
|
|
616
|
+
* call closes with TOOL_CALL_END.
|
|
617
|
+
*/
|
|
618
|
+
type ToolCallStartEvent$1 = {
|
|
619
|
+
/**
|
|
620
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
621
|
+
*/
|
|
567
622
|
type: EventType.TOOL_CALL_START;
|
|
623
|
+
/**
|
|
624
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
625
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
626
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
627
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
628
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
629
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
630
|
+
* protocol computes with this value.
|
|
631
|
+
*/
|
|
632
|
+
timestamp?: number;
|
|
633
|
+
/**
|
|
634
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
635
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
636
|
+
* model. Any JSON value.
|
|
637
|
+
*/
|
|
638
|
+
rawEvent?: any;
|
|
639
|
+
/**
|
|
640
|
+
* Extra information attached to this event.
|
|
641
|
+
*/
|
|
642
|
+
metadata?: Metadata;
|
|
643
|
+
/**
|
|
644
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
645
|
+
* produced it directly.
|
|
646
|
+
*/
|
|
647
|
+
subagentRunId?: SubagentRunId;
|
|
648
|
+
/**
|
|
649
|
+
* Identifies the call, and ties the later args, end and result events to it.
|
|
650
|
+
*/
|
|
568
651
|
toolCallId: string;
|
|
652
|
+
/**
|
|
653
|
+
* Which tool is being called.
|
|
654
|
+
*/
|
|
569
655
|
toolCallName: string;
|
|
656
|
+
/**
|
|
657
|
+
* The assistant message that holds this call. Absent means the producer did
|
|
658
|
+
* not attribute it to one.
|
|
659
|
+
*/
|
|
570
660
|
parentMessageId?: string;
|
|
571
|
-
}
|
|
572
|
-
|
|
661
|
+
};
|
|
662
|
+
/**
|
|
663
|
+
* Appends a fragment of a tool call's arguments.
|
|
664
|
+
*/
|
|
665
|
+
type ToolCallArgsEvent$1 = {
|
|
666
|
+
/**
|
|
667
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
668
|
+
*/
|
|
573
669
|
type: EventType.TOOL_CALL_ARGS;
|
|
670
|
+
/**
|
|
671
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
672
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
673
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
674
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
675
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
676
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
677
|
+
* protocol computes with this value.
|
|
678
|
+
*/
|
|
679
|
+
timestamp?: number;
|
|
680
|
+
/**
|
|
681
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
682
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
683
|
+
* model. Any JSON value.
|
|
684
|
+
*/
|
|
685
|
+
rawEvent?: any;
|
|
686
|
+
/**
|
|
687
|
+
* Extra information attached to this event.
|
|
688
|
+
*/
|
|
689
|
+
metadata?: Metadata;
|
|
690
|
+
/**
|
|
691
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
692
|
+
* produced it directly.
|
|
693
|
+
*/
|
|
694
|
+
subagentRunId?: SubagentRunId;
|
|
695
|
+
/**
|
|
696
|
+
* The call these arguments belong to.
|
|
697
|
+
*/
|
|
574
698
|
toolCallId: string;
|
|
699
|
+
/**
|
|
700
|
+
* A fragment of the arguments, which concatenate into the call's argument
|
|
701
|
+
* text — conventionally a JSON document, though the protocol does not
|
|
702
|
+
* validate it (see FunctionCall.arguments). Deliberately a string rather
|
|
703
|
+
* than parsed JSON: a fragment is not itself a document. May be the empty
|
|
704
|
+
* string.
|
|
705
|
+
*/
|
|
575
706
|
delta: string;
|
|
576
|
-
}
|
|
577
|
-
|
|
707
|
+
};
|
|
708
|
+
/**
|
|
709
|
+
* Closes a tool call, meaning its arguments are complete.
|
|
710
|
+
*/
|
|
711
|
+
type ToolCallEndEvent$1 = {
|
|
712
|
+
/**
|
|
713
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
714
|
+
*/
|
|
578
715
|
type: EventType.TOOL_CALL_END;
|
|
716
|
+
/**
|
|
717
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
718
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
719
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
720
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
721
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
722
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
723
|
+
* protocol computes with this value.
|
|
724
|
+
*/
|
|
725
|
+
timestamp?: number;
|
|
726
|
+
/**
|
|
727
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
728
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
729
|
+
* model. Any JSON value.
|
|
730
|
+
*/
|
|
731
|
+
rawEvent?: any;
|
|
732
|
+
/**
|
|
733
|
+
* Extra information attached to this event.
|
|
734
|
+
*/
|
|
735
|
+
metadata?: Metadata;
|
|
736
|
+
/**
|
|
737
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
738
|
+
* produced it directly.
|
|
739
|
+
*/
|
|
740
|
+
subagentRunId?: SubagentRunId;
|
|
741
|
+
/**
|
|
742
|
+
* The call being closed.
|
|
743
|
+
*/
|
|
579
744
|
toolCallId: string;
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
type: EventType.
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
745
|
+
};
|
|
746
|
+
/**
|
|
747
|
+
* A shorthand that stands in for a tool call's start, args and end sequence.
|
|
748
|
+
* Every field is optional for the same reason as TEXT_MESSAGE_CHUNK.
|
|
749
|
+
*/
|
|
750
|
+
type ToolCallChunkEvent$1 = {
|
|
751
|
+
/**
|
|
752
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
753
|
+
*/
|
|
754
|
+
type: EventType.TOOL_CALL_CHUNK;
|
|
755
|
+
/**
|
|
756
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
757
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
758
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
759
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
760
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
761
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
762
|
+
* protocol computes with this value.
|
|
763
|
+
*/
|
|
764
|
+
timestamp?: number;
|
|
765
|
+
/**
|
|
766
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
767
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
768
|
+
* model. Any JSON value.
|
|
769
|
+
*/
|
|
770
|
+
rawEvent?: any;
|
|
771
|
+
/**
|
|
772
|
+
* Extra information attached to this event.
|
|
773
|
+
*/
|
|
774
|
+
metadata?: Metadata;
|
|
775
|
+
/**
|
|
776
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
777
|
+
* produced it directly.
|
|
778
|
+
*/
|
|
779
|
+
subagentRunId?: SubagentRunId;
|
|
780
|
+
/**
|
|
781
|
+
* The call this chunk belongs to. Absent continues the call already open.
|
|
782
|
+
*/
|
|
783
|
+
toolCallId?: string;
|
|
784
|
+
/**
|
|
785
|
+
* Which tool is being called, on the chunk that opens it.
|
|
786
|
+
*/
|
|
787
|
+
toolCallName?: string;
|
|
788
|
+
/**
|
|
789
|
+
* The assistant message that holds this call.
|
|
790
|
+
*/
|
|
791
|
+
parentMessageId?: string;
|
|
792
|
+
/**
|
|
793
|
+
* A fragment of the arguments. May be the empty string.
|
|
794
|
+
*/
|
|
795
|
+
delta?: string;
|
|
796
|
+
};
|
|
797
|
+
/**
|
|
798
|
+
* A text part.
|
|
799
|
+
*/
|
|
800
|
+
type TextPart$2 = {
|
|
801
|
+
/**
|
|
802
|
+
* Discriminator.
|
|
803
|
+
*/
|
|
804
|
+
type: "text";
|
|
805
|
+
/**
|
|
806
|
+
* Identifies this part within its message. Optional, and nothing reads it
|
|
807
|
+
* yet: reserved so that a streamed part can be matched to its entry in
|
|
808
|
+
* history once assistant messages carry parts too.
|
|
809
|
+
*/
|
|
810
|
+
id?: string;
|
|
811
|
+
/**
|
|
812
|
+
* The text.
|
|
813
|
+
*/
|
|
814
|
+
text: string;
|
|
815
|
+
/**
|
|
816
|
+
* Extra information about this part. Unconstrained, as on the media parts.
|
|
817
|
+
* This is where a text search hit carries its source and title, rather than
|
|
818
|
+
* the protocol modelling a search-result part of its own.
|
|
819
|
+
*/
|
|
820
|
+
metadata?: any;
|
|
821
|
+
};
|
|
822
|
+
/**
|
|
823
|
+
* Bytes carried inline.
|
|
824
|
+
*/
|
|
825
|
+
type DataSource = {
|
|
826
|
+
/**
|
|
827
|
+
* Discriminator.
|
|
828
|
+
*/
|
|
829
|
+
type: "data";
|
|
830
|
+
/**
|
|
831
|
+
* The bytes, base64-encoded. contentEncoding is an annotation rather than a
|
|
832
|
+
* constraint in 2020-12, so a malformed string still validates here;
|
|
833
|
+
* rejecting one is the decoder's job.
|
|
834
|
+
* @contentEncoding base64
|
|
835
|
+
*/
|
|
836
|
+
value: string;
|
|
837
|
+
/**
|
|
838
|
+
* What the bytes are. Required here, unlike on a URL source, because nothing
|
|
839
|
+
* else can tell a consumer how to read them.
|
|
840
|
+
*/
|
|
841
|
+
mimeType: string;
|
|
842
|
+
};
|
|
843
|
+
/**
|
|
844
|
+
* Bytes referenced by URL, fetched by whoever needs them.
|
|
845
|
+
*/
|
|
846
|
+
type UrlSource = {
|
|
847
|
+
/**
|
|
848
|
+
* Discriminator.
|
|
849
|
+
*/
|
|
850
|
+
type: "url";
|
|
851
|
+
/**
|
|
852
|
+
* The URL. Deliberately not constrained to a URI format, so a scheme a
|
|
853
|
+
* producer already uses is not rejected here.
|
|
854
|
+
*/
|
|
855
|
+
value: string;
|
|
856
|
+
/**
|
|
857
|
+
* What the resource is, when the producer knows. Optional, because the
|
|
858
|
+
* response can say.
|
|
859
|
+
*/
|
|
860
|
+
mimeType?: string;
|
|
861
|
+
};
|
|
862
|
+
/**
|
|
863
|
+
* Bytes already at the provider, named by a handle the provider issued: an
|
|
864
|
+
* OpenAI or Anthropic file id, a Gemini file URI, a storage URL only that
|
|
865
|
+
* provider can read. No bytes travel and nothing is fetched. Only the provider
|
|
866
|
+
* that minted the handle can resolve it; a peer that cannot drops the part as
|
|
867
|
+
* it drops any part it cannot use.
|
|
868
|
+
*/
|
|
869
|
+
type FileSource = {
|
|
870
|
+
/**
|
|
871
|
+
* Discriminator.
|
|
872
|
+
*/
|
|
873
|
+
type: "file";
|
|
874
|
+
/**
|
|
875
|
+
* The handle, exactly as the provider issued it. Opaque: a consumer MUST NOT
|
|
876
|
+
* fetch it, parse it or read a scheme out of it.
|
|
877
|
+
*/
|
|
878
|
+
value: string;
|
|
879
|
+
/**
|
|
880
|
+
* Who issued the handle, when the producer knows. Optional: an agent already
|
|
881
|
+
* knows which provider it talks to. When present, SHOULD be the lowercase
|
|
882
|
+
* vendor id (openai, anthropic, google) that TokenUsage.provider uses, so a
|
|
883
|
+
* peer can tell before sending whether a handle is one it can use.
|
|
884
|
+
*/
|
|
885
|
+
provider?: string;
|
|
886
|
+
/**
|
|
887
|
+
* What the file is, when the producer knows. Optional, because the provider
|
|
888
|
+
* that holds the bytes knows.
|
|
889
|
+
*/
|
|
890
|
+
mimeType?: string;
|
|
891
|
+
};
|
|
892
|
+
/**
|
|
893
|
+
* Where a media part's bytes come from: carried inline, referenced by URL, or
|
|
894
|
+
* already at the provider under a handle it issued.
|
|
895
|
+
*/
|
|
896
|
+
type PartSource = DataSource | UrlSource | FileSource;
|
|
897
|
+
/**
|
|
898
|
+
* An image part.
|
|
899
|
+
*/
|
|
900
|
+
type ImagePart$1 = {
|
|
901
|
+
/**
|
|
902
|
+
* Discriminator.
|
|
903
|
+
*/
|
|
904
|
+
type: "image";
|
|
905
|
+
/**
|
|
906
|
+
* Identifies this part within its message. Optional, and nothing reads it
|
|
907
|
+
* yet: reserved as on the text part.
|
|
908
|
+
*/
|
|
909
|
+
id?: string;
|
|
910
|
+
/**
|
|
911
|
+
* Where the image comes from.
|
|
912
|
+
*/
|
|
913
|
+
source: PartSource;
|
|
914
|
+
/**
|
|
915
|
+
* Extra information about this part. Unconstrained rather than an object:
|
|
916
|
+
* inherited from the SDKs, which declare it unknown rather than a record;
|
|
917
|
+
* listed under known divergences in the README rather than resolved here.
|
|
918
|
+
*/
|
|
919
|
+
metadata?: any;
|
|
920
|
+
};
|
|
921
|
+
/**
|
|
922
|
+
* An audio part.
|
|
923
|
+
*/
|
|
924
|
+
type AudioPart$1 = {
|
|
925
|
+
/**
|
|
926
|
+
* Discriminator.
|
|
927
|
+
*/
|
|
928
|
+
type: "audio";
|
|
929
|
+
/**
|
|
930
|
+
* Identifies this part within its message. Optional, and nothing reads it
|
|
931
|
+
* yet: reserved as on the text part.
|
|
932
|
+
*/
|
|
933
|
+
id?: string;
|
|
934
|
+
/**
|
|
935
|
+
* Where the audio comes from.
|
|
936
|
+
*/
|
|
937
|
+
source: PartSource;
|
|
938
|
+
/**
|
|
939
|
+
* Extra information about this part. Unconstrained, as on the other media
|
|
940
|
+
* parts.
|
|
941
|
+
*/
|
|
942
|
+
metadata?: any;
|
|
943
|
+
};
|
|
944
|
+
/**
|
|
945
|
+
* A video part.
|
|
946
|
+
*/
|
|
947
|
+
type VideoPart$1 = {
|
|
948
|
+
/**
|
|
949
|
+
* Discriminator.
|
|
950
|
+
*/
|
|
951
|
+
type: "video";
|
|
952
|
+
/**
|
|
953
|
+
* Identifies this part within its message. Optional, and nothing reads it
|
|
954
|
+
* yet: reserved as on the text part.
|
|
955
|
+
*/
|
|
956
|
+
id?: string;
|
|
957
|
+
/**
|
|
958
|
+
* Where the video comes from.
|
|
959
|
+
*/
|
|
960
|
+
source: PartSource;
|
|
961
|
+
/**
|
|
962
|
+
* Extra information about this part. Unconstrained, as on the other media
|
|
963
|
+
* parts.
|
|
964
|
+
*/
|
|
965
|
+
metadata?: any;
|
|
966
|
+
};
|
|
967
|
+
/**
|
|
968
|
+
* A document part.
|
|
969
|
+
*/
|
|
970
|
+
type DocumentPart$1 = {
|
|
971
|
+
/**
|
|
972
|
+
* Discriminator.
|
|
973
|
+
*/
|
|
974
|
+
type: "document";
|
|
975
|
+
/**
|
|
976
|
+
* Identifies this part within its message. Optional, and nothing reads it
|
|
977
|
+
* yet: reserved as on the text part.
|
|
978
|
+
*/
|
|
979
|
+
id?: string;
|
|
980
|
+
/**
|
|
981
|
+
* Where the document comes from.
|
|
982
|
+
*/
|
|
983
|
+
source: PartSource;
|
|
984
|
+
/**
|
|
985
|
+
* Extra information about this part. Unconstrained, as on the other media
|
|
986
|
+
* parts.
|
|
987
|
+
*/
|
|
988
|
+
metadata?: any;
|
|
989
|
+
};
|
|
990
|
+
/**
|
|
991
|
+
* One part of a message body: what a person sends in a user message, or what a
|
|
992
|
+
* tool returns in a tool message. Discriminated by type. Named by what the
|
|
993
|
+
* part is rather than by direction, because the same part travels into the
|
|
994
|
+
* model inside a user message and back out of the stream inside a tool result.
|
|
995
|
+
*/
|
|
996
|
+
type ContentPart$1 = TextPart$2 | ImagePart$1 | AudioPart$1 | VideoPart$1 | DocumentPart$1;
|
|
997
|
+
/**
|
|
998
|
+
* Carries what a tool returned. Mints a tool message rather than appending to
|
|
999
|
+
* an existing one, which is why it has its own messageId.
|
|
1000
|
+
*/
|
|
1001
|
+
type ToolCallResultEvent$1 = {
|
|
1002
|
+
/**
|
|
1003
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
1004
|
+
*/
|
|
1005
|
+
type: EventType.TOOL_CALL_RESULT;
|
|
1006
|
+
/**
|
|
1007
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
1008
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
1009
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
1010
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
1011
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
1012
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
1013
|
+
* protocol computes with this value.
|
|
1014
|
+
*/
|
|
1015
|
+
timestamp?: number;
|
|
1016
|
+
/**
|
|
1017
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
1018
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
1019
|
+
* model. Any JSON value.
|
|
1020
|
+
*/
|
|
1021
|
+
rawEvent?: any;
|
|
1022
|
+
/**
|
|
1023
|
+
* Extra information attached to this event.
|
|
1024
|
+
*/
|
|
1025
|
+
metadata?: Metadata;
|
|
1026
|
+
/**
|
|
1027
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1028
|
+
* produced it directly.
|
|
1029
|
+
*/
|
|
1030
|
+
subagentRunId?: SubagentRunId;
|
|
1031
|
+
/**
|
|
1032
|
+
* The tool message this result becomes.
|
|
1033
|
+
*/
|
|
1034
|
+
messageId: string;
|
|
1035
|
+
/**
|
|
1036
|
+
* The call being answered.
|
|
1037
|
+
*/
|
|
1038
|
+
toolCallId: string;
|
|
1039
|
+
/**
|
|
1040
|
+
* What the tool returned: either plain text, or an ordered list of parts,
|
|
1041
|
+
* exactly as on the tool message this event mints. A tool returning
|
|
1042
|
+
* structured data serialises it into text; media travel as parts of their
|
|
1043
|
+
* own.
|
|
1044
|
+
*/
|
|
1045
|
+
content: string | ContentPart$1[];
|
|
1046
|
+
/**
|
|
1047
|
+
* Present only for symmetry with the message it mints; the value is fixed,
|
|
1048
|
+
* so a producer may leave it out.
|
|
1049
|
+
*/
|
|
1050
|
+
role?: "tool";
|
|
1051
|
+
};
|
|
1052
|
+
/**
|
|
1053
|
+
* Agent state. Any JSON value: the protocol carries state without interpreting
|
|
1054
|
+
* it, so an object, an array, a string and a number are all valid.
|
|
1055
|
+
*/
|
|
1056
|
+
type State = any;
|
|
1057
|
+
/**
|
|
1058
|
+
* Replaces the agent state wholesale. Sent when a delta cannot express the
|
|
1059
|
+
* change, or to resynchronise a consumer.
|
|
1060
|
+
*/
|
|
1061
|
+
type StateSnapshotEvent$1 = {
|
|
1062
|
+
/**
|
|
1063
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
1064
|
+
*/
|
|
1065
|
+
type: EventType.STATE_SNAPSHOT;
|
|
1066
|
+
/**
|
|
1067
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
1068
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
1069
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
1070
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
1071
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
1072
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
1073
|
+
* protocol computes with this value.
|
|
1074
|
+
*/
|
|
1075
|
+
timestamp?: number;
|
|
1076
|
+
/**
|
|
1077
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
1078
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
1079
|
+
* model. Any JSON value.
|
|
1080
|
+
*/
|
|
1081
|
+
rawEvent?: any;
|
|
1082
|
+
/**
|
|
1083
|
+
* Extra information attached to this event.
|
|
1084
|
+
*/
|
|
1085
|
+
metadata?: Metadata;
|
|
1086
|
+
/**
|
|
1087
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1088
|
+
* produced it directly.
|
|
1089
|
+
*/
|
|
1090
|
+
subagentRunId?: SubagentRunId;
|
|
1091
|
+
/**
|
|
1092
|
+
* The complete new state.
|
|
1093
|
+
*/
|
|
1094
|
+
snapshot: State;
|
|
1095
|
+
};
|
|
1096
|
+
/**
|
|
1097
|
+
* A JSON Pointer as defined by RFC 6901. Either the empty string, meaning the
|
|
1098
|
+
* whole document, or a sequence of slash-prefixed reference tokens in which a
|
|
1099
|
+
* tilde is escaped as ~0 and a slash as ~1. A value with no leading slash, or
|
|
1100
|
+
* a tilde followed by anything other than 0 or 1, is not a JSON Pointer.
|
|
1101
|
+
*/
|
|
1102
|
+
type JsonPointer = string;
|
|
1103
|
+
/**
|
|
1104
|
+
* Inserts value at path. RFC 6902 section 4.1.
|
|
1105
|
+
*/
|
|
1106
|
+
type AddOperation = {
|
|
1107
|
+
/**
|
|
1108
|
+
* Discriminator for the add operation.
|
|
1109
|
+
*/
|
|
1110
|
+
op: "add";
|
|
1111
|
+
/**
|
|
1112
|
+
* Where to insert the value.
|
|
1113
|
+
*/
|
|
1114
|
+
path: JsonPointer;
|
|
1115
|
+
/**
|
|
1116
|
+
* The value to insert. Any JSON value, including null, which is a legitimate
|
|
1117
|
+
* thing to add.
|
|
1118
|
+
*/
|
|
1119
|
+
value: any;
|
|
1120
|
+
};
|
|
1121
|
+
/**
|
|
1122
|
+
* Removes the value at path. RFC 6902 section 4.2.
|
|
1123
|
+
*/
|
|
1124
|
+
type RemoveOperation = {
|
|
1125
|
+
/**
|
|
1126
|
+
* Discriminator for the remove operation.
|
|
1127
|
+
*/
|
|
1128
|
+
op: "remove";
|
|
1129
|
+
/**
|
|
1130
|
+
* What to remove.
|
|
1131
|
+
*/
|
|
1132
|
+
path: JsonPointer;
|
|
1133
|
+
};
|
|
1134
|
+
/**
|
|
1135
|
+
* Replaces the value at path. RFC 6902 section 4.3.
|
|
1136
|
+
*/
|
|
1137
|
+
type ReplaceOperation = {
|
|
1138
|
+
/**
|
|
1139
|
+
* Discriminator for the replace operation.
|
|
1140
|
+
*/
|
|
1141
|
+
op: "replace";
|
|
1142
|
+
/**
|
|
1143
|
+
* What to replace.
|
|
1144
|
+
*/
|
|
1145
|
+
path: JsonPointer;
|
|
1146
|
+
/**
|
|
1147
|
+
* The replacement. Any JSON value, including null.
|
|
1148
|
+
*/
|
|
1149
|
+
value: any;
|
|
1150
|
+
};
|
|
1151
|
+
/**
|
|
1152
|
+
* Moves the value at from to path. RFC 6902 section 4.4.
|
|
1153
|
+
*/
|
|
1154
|
+
type MoveOperation = {
|
|
1155
|
+
/**
|
|
1156
|
+
* Discriminator for the move operation.
|
|
1157
|
+
*/
|
|
1158
|
+
op: "move";
|
|
1159
|
+
/**
|
|
1160
|
+
* Where the value is moved from.
|
|
1161
|
+
*/
|
|
1162
|
+
from: JsonPointer;
|
|
1163
|
+
/**
|
|
1164
|
+
* Where the value is moved to.
|
|
1165
|
+
*/
|
|
1166
|
+
path: JsonPointer;
|
|
1167
|
+
};
|
|
1168
|
+
/**
|
|
1169
|
+
* Copies the value at from to path. RFC 6902 section 4.5.
|
|
1170
|
+
*/
|
|
1171
|
+
type CopyOperation = {
|
|
1172
|
+
/**
|
|
1173
|
+
* Discriminator for the copy operation.
|
|
1174
|
+
*/
|
|
1175
|
+
op: "copy";
|
|
1176
|
+
/**
|
|
1177
|
+
* Where the value is copied from.
|
|
1178
|
+
*/
|
|
1179
|
+
from: JsonPointer;
|
|
1180
|
+
/**
|
|
1181
|
+
* Where the value is copied to.
|
|
1182
|
+
*/
|
|
1183
|
+
path: JsonPointer;
|
|
1184
|
+
};
|
|
1185
|
+
/**
|
|
1186
|
+
* Asserts that the value at path equals value. RFC 6902 section 4.6.
|
|
1187
|
+
*/
|
|
1188
|
+
type TestOperation = {
|
|
1189
|
+
/**
|
|
1190
|
+
* Discriminator for the test operation.
|
|
1191
|
+
*/
|
|
1192
|
+
op: "test";
|
|
1193
|
+
/**
|
|
1194
|
+
* What to compare.
|
|
1195
|
+
*/
|
|
1196
|
+
path: JsonPointer;
|
|
1197
|
+
/**
|
|
1198
|
+
* The value the target must equal. Any JSON value, including null.
|
|
1199
|
+
*/
|
|
1200
|
+
value: any;
|
|
1201
|
+
};
|
|
1202
|
+
/**
|
|
1203
|
+
* A single RFC 6902 operation. Exactly one of the operation shapes must match,
|
|
1204
|
+
* discriminated by op. Unlike the protocol's own objects, the operations are
|
|
1205
|
+
* open: RFC 6902 section 4 requires members an operation does not define to be
|
|
1206
|
+
* ignored rather than rejected, so a remove carrying a leftover value is a
|
|
1207
|
+
* valid patch. Two of the RFC's rules are relations between values rather than
|
|
1208
|
+
* shapes, so no static schema can express them and neither is checked here: a
|
|
1209
|
+
* move whose from is a proper prefix of its path (section 4.4), and any
|
|
1210
|
+
* operation whose pointer does not resolve in the target document. Both are
|
|
1211
|
+
* the applier's to reject.
|
|
1212
|
+
*/
|
|
1213
|
+
type JsonPatchOperation = AddOperation | RemoveOperation | ReplaceOperation | MoveOperation | CopyOperation | TestOperation;
|
|
1214
|
+
/**
|
|
1215
|
+
* A JSON Patch document as defined by RFC 6902, referenced by
|
|
1216
|
+
* STATE_DELTA.delta and ACTIVITY_DELTA.patch: an ordered sequence of
|
|
1217
|
+
* operations applied to a target document. An empty array is a valid no-op
|
|
1218
|
+
* patch. Whether the operations actually apply to the document they target is
|
|
1219
|
+
* a runtime question RFC 6902 leaves to the applier; structural validity here
|
|
1220
|
+
* says nothing about it.
|
|
1221
|
+
*/
|
|
1222
|
+
type JsonPatch = JsonPatchOperation[];
|
|
1223
|
+
/**
|
|
1224
|
+
* Changes the agent state incrementally.
|
|
1225
|
+
*/
|
|
1226
|
+
type StateDeltaEvent$1 = {
|
|
1227
|
+
/**
|
|
1228
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
1229
|
+
*/
|
|
593
1230
|
type: EventType.STATE_DELTA;
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
1231
|
+
/**
|
|
1232
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
1233
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
1234
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
1235
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
1236
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
1237
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
1238
|
+
* protocol computes with this value.
|
|
1239
|
+
*/
|
|
1240
|
+
timestamp?: number;
|
|
1241
|
+
/**
|
|
1242
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
1243
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
1244
|
+
* model. Any JSON value.
|
|
1245
|
+
*/
|
|
1246
|
+
rawEvent?: any;
|
|
1247
|
+
/**
|
|
1248
|
+
* Extra information attached to this event.
|
|
1249
|
+
*/
|
|
1250
|
+
metadata?: Metadata;
|
|
1251
|
+
/**
|
|
1252
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1253
|
+
* produced it directly.
|
|
1254
|
+
*/
|
|
1255
|
+
subagentRunId?: SubagentRunId;
|
|
1256
|
+
/**
|
|
1257
|
+
* The change, as an RFC 6902 patch against the current state. Structural
|
|
1258
|
+
* validity here does not mean the patch applies: a well-formed operation may
|
|
1259
|
+
* point at a path that does not exist, which RFC 6902 leaves to the applier.
|
|
1260
|
+
*/
|
|
1261
|
+
delta: JsonPatch;
|
|
1262
|
+
};
|
|
1263
|
+
/**
|
|
1264
|
+
* Instructions from the application developer.
|
|
1265
|
+
*/
|
|
1266
|
+
type DeveloperMessage = {
|
|
1267
|
+
/**
|
|
1268
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1269
|
+
* produced it directly.
|
|
1270
|
+
*/
|
|
1271
|
+
subagentRunId?: SubagentRunId;
|
|
1272
|
+
/**
|
|
1273
|
+
* Identifies the message within the conversation.
|
|
1274
|
+
*/
|
|
1275
|
+
id: string;
|
|
1276
|
+
/**
|
|
1277
|
+
* Who the message is from. Each message definition narrows this to a single
|
|
1278
|
+
* value.
|
|
1279
|
+
*/
|
|
1280
|
+
role: "developer";
|
|
1281
|
+
/**
|
|
1282
|
+
* An optional display name for the author.
|
|
1283
|
+
*/
|
|
1284
|
+
name?: string;
|
|
1285
|
+
/**
|
|
1286
|
+
* A provider's opaque artefact belonging to this message, stored by a
|
|
1287
|
+
* consumer and returned on a later turn.
|
|
1288
|
+
*/
|
|
1289
|
+
encryptedValue?: string;
|
|
1290
|
+
/**
|
|
1291
|
+
* Extra information attached to this message.
|
|
1292
|
+
*/
|
|
1293
|
+
metadata?: Metadata;
|
|
1294
|
+
/**
|
|
1295
|
+
* The instructions. Required: a developer message with nothing in it says
|
|
1296
|
+
* nothing.
|
|
1297
|
+
*/
|
|
1298
|
+
content: string;
|
|
1299
|
+
};
|
|
1300
|
+
/**
|
|
1301
|
+
* Instructions from the system.
|
|
1302
|
+
*/
|
|
1303
|
+
type SystemMessage = {
|
|
1304
|
+
/**
|
|
1305
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1306
|
+
* produced it directly.
|
|
1307
|
+
*/
|
|
1308
|
+
subagentRunId?: SubagentRunId;
|
|
1309
|
+
/**
|
|
1310
|
+
* Identifies the message within the conversation.
|
|
1311
|
+
*/
|
|
1312
|
+
id: string;
|
|
1313
|
+
/**
|
|
1314
|
+
* Who the message is from. Each message definition narrows this to a single
|
|
1315
|
+
* value.
|
|
1316
|
+
*/
|
|
1317
|
+
role: "system";
|
|
1318
|
+
/**
|
|
1319
|
+
* An optional display name for the author.
|
|
1320
|
+
*/
|
|
1321
|
+
name?: string;
|
|
1322
|
+
/**
|
|
1323
|
+
* A provider's opaque artefact belonging to this message, stored by a
|
|
1324
|
+
* consumer and returned on a later turn.
|
|
1325
|
+
*/
|
|
1326
|
+
encryptedValue?: string;
|
|
1327
|
+
/**
|
|
1328
|
+
* Extra information attached to this message.
|
|
1329
|
+
*/
|
|
1330
|
+
metadata?: Metadata;
|
|
1331
|
+
/**
|
|
1332
|
+
* The instructions. Required.
|
|
1333
|
+
*/
|
|
1334
|
+
content: string;
|
|
1335
|
+
};
|
|
1336
|
+
/**
|
|
1337
|
+
* The name and arguments of a tool call.
|
|
1338
|
+
*/
|
|
1339
|
+
type FunctionCall = {
|
|
1340
|
+
/**
|
|
1341
|
+
* Which tool is being called.
|
|
1342
|
+
*/
|
|
1343
|
+
name: string;
|
|
1344
|
+
/**
|
|
1345
|
+
* The arguments as a JSON string, not as parsed JSON. Kept as written
|
|
1346
|
+
* because a model can emit arguments that are not valid JSON, and losing
|
|
1347
|
+
* them at the protocol boundary would hide the fault from the consumer that
|
|
1348
|
+
* has to handle it.
|
|
1349
|
+
*/
|
|
1350
|
+
arguments: string;
|
|
1351
|
+
};
|
|
1352
|
+
/**
|
|
1353
|
+
* A call an assistant message made. Carries no subagent attribution of its own
|
|
1354
|
+
* and inherits its containing message's, since several calls can share one
|
|
1355
|
+
* parent.
|
|
1356
|
+
*/
|
|
1357
|
+
type ToolCall$1 = {
|
|
1358
|
+
/**
|
|
1359
|
+
* Identifies the call. The answering tool message carries this as its
|
|
1360
|
+
* toolCallId.
|
|
1361
|
+
*/
|
|
1362
|
+
id: string;
|
|
1363
|
+
/**
|
|
1364
|
+
* The only kind of call the protocol models.
|
|
1365
|
+
*/
|
|
1366
|
+
type: "function";
|
|
1367
|
+
/**
|
|
1368
|
+
* What is being called, and with what.
|
|
1369
|
+
*/
|
|
1370
|
+
function: FunctionCall;
|
|
1371
|
+
/**
|
|
1372
|
+
* A provider's opaque artefact belonging to this call.
|
|
1373
|
+
*/
|
|
1374
|
+
encryptedValue?: string;
|
|
1375
|
+
/**
|
|
1376
|
+
* Extra information attached to this call. Carried here rather than folded
|
|
1377
|
+
* into the containing message, because several calls can share one parent
|
|
1378
|
+
* and merging them would make the result depend on their order.
|
|
1379
|
+
*/
|
|
1380
|
+
metadata?: Metadata;
|
|
1381
|
+
};
|
|
1382
|
+
/**
|
|
1383
|
+
* A message from the agent. Content is optional because a turn may consist
|
|
1384
|
+
* only of tool calls.
|
|
1385
|
+
*/
|
|
1386
|
+
type AssistantMessage = {
|
|
1387
|
+
/**
|
|
1388
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1389
|
+
* produced it directly.
|
|
1390
|
+
*/
|
|
1391
|
+
subagentRunId?: SubagentRunId;
|
|
1392
|
+
/**
|
|
1393
|
+
* Identifies the message within the conversation.
|
|
1394
|
+
*/
|
|
1395
|
+
id: string;
|
|
1396
|
+
/**
|
|
1397
|
+
* Who the message is from. Each message definition narrows this to a single
|
|
1398
|
+
* value.
|
|
1399
|
+
*/
|
|
1400
|
+
role: "assistant";
|
|
1401
|
+
/**
|
|
1402
|
+
* An optional display name for the author.
|
|
1403
|
+
*/
|
|
1404
|
+
name?: string;
|
|
1405
|
+
/**
|
|
1406
|
+
* A provider's opaque artefact belonging to this message, stored by a
|
|
1407
|
+
* consumer and returned on a later turn.
|
|
1408
|
+
*/
|
|
1409
|
+
encryptedValue?: string;
|
|
1410
|
+
/**
|
|
1411
|
+
* Extra information attached to this message.
|
|
1412
|
+
*/
|
|
1413
|
+
metadata?: Metadata;
|
|
1414
|
+
/**
|
|
1415
|
+
* What the agent said, if it said anything.
|
|
1416
|
+
*/
|
|
1417
|
+
content?: string;
|
|
1418
|
+
/**
|
|
1419
|
+
* The tool calls this turn made.
|
|
1420
|
+
*/
|
|
1421
|
+
toolCalls?: ToolCall$1[];
|
|
1422
|
+
};
|
|
1423
|
+
/**
|
|
1424
|
+
* A message from the person using the application.
|
|
1425
|
+
*/
|
|
1426
|
+
type UserMessage = {
|
|
1427
|
+
/**
|
|
1428
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1429
|
+
* produced it directly.
|
|
1430
|
+
*/
|
|
1431
|
+
subagentRunId?: SubagentRunId;
|
|
1432
|
+
/**
|
|
1433
|
+
* Identifies the message within the conversation.
|
|
1434
|
+
*/
|
|
1435
|
+
id: string;
|
|
1436
|
+
/**
|
|
1437
|
+
* Who the message is from. Each message definition narrows this to a single
|
|
1438
|
+
* value.
|
|
1439
|
+
*/
|
|
1440
|
+
role: "user";
|
|
1441
|
+
/**
|
|
1442
|
+
* An optional display name for the author.
|
|
1443
|
+
*/
|
|
1444
|
+
name?: string;
|
|
1445
|
+
/**
|
|
1446
|
+
* A provider's opaque artefact belonging to this message, stored by a
|
|
1447
|
+
* consumer and returned on a later turn.
|
|
1448
|
+
*/
|
|
1449
|
+
encryptedValue?: string;
|
|
1450
|
+
/**
|
|
1451
|
+
* Extra information attached to this message.
|
|
1452
|
+
*/
|
|
1453
|
+
metadata?: Metadata;
|
|
1454
|
+
/**
|
|
1455
|
+
* What the person sent: either plain text, or an ordered list of parts for a
|
|
1456
|
+
* multimodal message.
|
|
1457
|
+
*/
|
|
1458
|
+
content: string | ContentPart$1[];
|
|
1459
|
+
};
|
|
1460
|
+
/**
|
|
1461
|
+
* What a tool returned, as a message in the conversation. Stands alone rather
|
|
1462
|
+
* than composing BaseMessage, because it carries no name.
|
|
1463
|
+
*/
|
|
1464
|
+
type ToolMessage = {
|
|
1465
|
+
/**
|
|
1466
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1467
|
+
* produced it directly.
|
|
1468
|
+
*/
|
|
1469
|
+
subagentRunId?: SubagentRunId;
|
|
1470
|
+
/**
|
|
1471
|
+
* Identifies the message.
|
|
1472
|
+
*/
|
|
1473
|
+
id: string;
|
|
1474
|
+
/**
|
|
1475
|
+
* Fixed. Declared here rather than inherited, because this message does not
|
|
1476
|
+
* compose BaseMessage.
|
|
1477
|
+
*/
|
|
1478
|
+
role: "tool";
|
|
1479
|
+
/**
|
|
1480
|
+
* What the tool returned: either plain text, or an ordered list of parts. A
|
|
1481
|
+
* tool returning structured data serialises it into text; media travel as
|
|
1482
|
+
* parts of their own.
|
|
1483
|
+
*/
|
|
1484
|
+
content: string | ContentPart$1[];
|
|
1485
|
+
/**
|
|
1486
|
+
* The call this answers.
|
|
1487
|
+
*/
|
|
1488
|
+
toolCallId: string;
|
|
1489
|
+
/**
|
|
1490
|
+
* Why the tool failed, when it did. Present alongside content rather than
|
|
1491
|
+
* instead of it, so a partial result survives a failure.
|
|
1492
|
+
*/
|
|
1493
|
+
error?: string;
|
|
1494
|
+
/**
|
|
1495
|
+
* A provider's opaque artefact belonging to this message.
|
|
1496
|
+
*/
|
|
1497
|
+
encryptedValue?: string;
|
|
1498
|
+
/**
|
|
1499
|
+
* Extra information attached to this message.
|
|
1500
|
+
*/
|
|
1501
|
+
metadata?: Metadata;
|
|
1502
|
+
};
|
|
1503
|
+
/**
|
|
1504
|
+
* Structured progress that is not conversation content, materialised as a
|
|
1505
|
+
* message so it keeps its place in the sequence. Stands alone rather than
|
|
1506
|
+
* composing BaseMessage, because its content is an object rather than a
|
|
1507
|
+
* string.
|
|
1508
|
+
*/
|
|
1509
|
+
type ActivityMessage = {
|
|
1510
|
+
/**
|
|
1511
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1512
|
+
* produced it directly.
|
|
1513
|
+
*/
|
|
1514
|
+
subagentRunId?: SubagentRunId;
|
|
1515
|
+
/**
|
|
1516
|
+
* Identifies the message.
|
|
1517
|
+
*/
|
|
1518
|
+
id: string;
|
|
1519
|
+
/**
|
|
1520
|
+
* Fixed. Declared here rather than inherited, because this message does not
|
|
1521
|
+
* compose BaseMessage.
|
|
1522
|
+
*/
|
|
1523
|
+
role: "activity";
|
|
1524
|
+
/**
|
|
1525
|
+
* What kind of activity this is. An open string: the set is the producer's.
|
|
1526
|
+
*/
|
|
1527
|
+
activityType: string;
|
|
1528
|
+
/**
|
|
1529
|
+
* The activity's payload, open by key.
|
|
1530
|
+
*/
|
|
1531
|
+
content: Record<string, any>;
|
|
1532
|
+
/**
|
|
1533
|
+
* Extra information attached to this message.
|
|
1534
|
+
*/
|
|
1535
|
+
metadata?: Metadata;
|
|
1536
|
+
};
|
|
1537
|
+
/**
|
|
1538
|
+
* A span of the agent's reasoning, materialised as a message. Stands alone
|
|
1539
|
+
* rather than composing BaseMessage, because it carries no name.
|
|
1540
|
+
*/
|
|
1541
|
+
type ReasoningMessage = {
|
|
1542
|
+
/**
|
|
1543
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1544
|
+
* produced it directly.
|
|
1545
|
+
*/
|
|
1546
|
+
subagentRunId?: SubagentRunId;
|
|
1547
|
+
/**
|
|
1548
|
+
* Identifies the message.
|
|
1549
|
+
*/
|
|
1550
|
+
id: string;
|
|
1551
|
+
/**
|
|
1552
|
+
* Fixed. Declared here rather than inherited, because this message does not
|
|
1553
|
+
* compose BaseMessage.
|
|
1554
|
+
*/
|
|
1555
|
+
role: "reasoning";
|
|
1556
|
+
/**
|
|
1557
|
+
* The reasoning text.
|
|
1558
|
+
*/
|
|
1559
|
+
content: string;
|
|
1560
|
+
/**
|
|
1561
|
+
* A provider's opaque reasoning artefact belonging to this message.
|
|
1562
|
+
*/
|
|
1563
|
+
encryptedValue?: string;
|
|
1564
|
+
/**
|
|
1565
|
+
* Extra information attached to this message.
|
|
1566
|
+
*/
|
|
1567
|
+
metadata?: Metadata;
|
|
1568
|
+
};
|
|
1569
|
+
/**
|
|
1570
|
+
* Any message in a conversation. Discriminated by role.
|
|
1571
|
+
*/
|
|
1572
|
+
type Message = DeveloperMessage | SystemMessage | AssistantMessage | UserMessage | ToolMessage | ActivityMessage | ReasoningMessage;
|
|
1573
|
+
/**
|
|
1574
|
+
* The complete set of messages the producer owns, in order. Conversation-wide
|
|
1575
|
+
* rather than a plain overwrite: a consumer may keep messages of its own that
|
|
1576
|
+
* no producer tracks, so exactly how a snapshot reconciles with those is
|
|
1577
|
+
* behavioural and belongs in the prose. Being conversation-wide it cannot
|
|
1578
|
+
* belong to a single subagent, so it carries no attribution; it does establish
|
|
1579
|
+
* which subagent owns each message it contains, through the messages
|
|
1580
|
+
* themselves.
|
|
1581
|
+
*/
|
|
1582
|
+
type MessagesSnapshotEvent$1 = {
|
|
1583
|
+
/**
|
|
1584
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
1585
|
+
*/
|
|
597
1586
|
type: EventType.MESSAGES_SNAPSHOT;
|
|
1587
|
+
/**
|
|
1588
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
1589
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
1590
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
1591
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
1592
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
1593
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
1594
|
+
* protocol computes with this value.
|
|
1595
|
+
*/
|
|
1596
|
+
timestamp?: number;
|
|
1597
|
+
/**
|
|
1598
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
1599
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
1600
|
+
* model. Any JSON value.
|
|
1601
|
+
*/
|
|
1602
|
+
rawEvent?: any;
|
|
1603
|
+
/**
|
|
1604
|
+
* Extra information attached to this event.
|
|
1605
|
+
*/
|
|
1606
|
+
metadata?: Metadata;
|
|
1607
|
+
/**
|
|
1608
|
+
* The messages the producer is declaring, in order.
|
|
1609
|
+
*/
|
|
598
1610
|
messages: Message[];
|
|
599
|
-
}
|
|
600
|
-
|
|
1611
|
+
};
|
|
1612
|
+
/**
|
|
1613
|
+
* Reports structured progress that is not conversation content, such as a step
|
|
1614
|
+
* a UI renders as its own widget.
|
|
1615
|
+
*/
|
|
1616
|
+
type ActivitySnapshotEvent$1 = {
|
|
1617
|
+
/**
|
|
1618
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
1619
|
+
*/
|
|
1620
|
+
type: EventType.ACTIVITY_SNAPSHOT;
|
|
1621
|
+
/**
|
|
1622
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
1623
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
1624
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
1625
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
1626
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
1627
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
1628
|
+
* protocol computes with this value.
|
|
1629
|
+
*/
|
|
1630
|
+
timestamp?: number;
|
|
1631
|
+
/**
|
|
1632
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
1633
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
1634
|
+
* model. Any JSON value.
|
|
1635
|
+
*/
|
|
1636
|
+
rawEvent?: any;
|
|
1637
|
+
/**
|
|
1638
|
+
* Extra information attached to this event.
|
|
1639
|
+
*/
|
|
1640
|
+
metadata?: Metadata;
|
|
1641
|
+
/**
|
|
1642
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1643
|
+
* produced it directly.
|
|
1644
|
+
*/
|
|
1645
|
+
subagentRunId?: SubagentRunId;
|
|
1646
|
+
/**
|
|
1647
|
+
* The activity message this describes.
|
|
1648
|
+
*/
|
|
1649
|
+
messageId: string;
|
|
1650
|
+
/**
|
|
1651
|
+
* What kind of activity this is. An open string: the set is the producer's,
|
|
1652
|
+
* not the protocol's.
|
|
1653
|
+
*/
|
|
1654
|
+
activityType: string;
|
|
1655
|
+
/**
|
|
1656
|
+
* The activity's payload, open by key.
|
|
1657
|
+
*/
|
|
1658
|
+
content: Record<string, any>;
|
|
1659
|
+
/**
|
|
1660
|
+
* Whether this snapshot overwrites the activity's existing content. Absent
|
|
1661
|
+
* means it does, and that meaning is normative; only an explicit false asks
|
|
1662
|
+
* a consumer to leave what is already there. It does not ask for a merge —
|
|
1663
|
+
* ACTIVITY_DELTA is how content is changed incrementally. What a consumer
|
|
1664
|
+
* does with a non-overwriting snapshot is behavioural and belongs in the
|
|
1665
|
+
* prose.
|
|
1666
|
+
* @default true
|
|
1667
|
+
*/
|
|
1668
|
+
replace?: boolean;
|
|
1669
|
+
};
|
|
1670
|
+
/**
|
|
1671
|
+
* Changes an activity message's content incrementally.
|
|
1672
|
+
*/
|
|
1673
|
+
type ActivityDeltaEvent$1 = {
|
|
1674
|
+
/**
|
|
1675
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
1676
|
+
*/
|
|
1677
|
+
type: EventType.ACTIVITY_DELTA;
|
|
1678
|
+
/**
|
|
1679
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
1680
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
1681
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
1682
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
1683
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
1684
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
1685
|
+
* protocol computes with this value.
|
|
1686
|
+
*/
|
|
1687
|
+
timestamp?: number;
|
|
1688
|
+
/**
|
|
1689
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
1690
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
1691
|
+
* model. Any JSON value.
|
|
1692
|
+
*/
|
|
1693
|
+
rawEvent?: any;
|
|
1694
|
+
/**
|
|
1695
|
+
* Extra information attached to this event.
|
|
1696
|
+
*/
|
|
1697
|
+
metadata?: Metadata;
|
|
1698
|
+
/**
|
|
1699
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1700
|
+
* produced it directly.
|
|
1701
|
+
*/
|
|
1702
|
+
subagentRunId?: SubagentRunId;
|
|
1703
|
+
/**
|
|
1704
|
+
* The activity message being changed.
|
|
1705
|
+
*/
|
|
1706
|
+
messageId: string;
|
|
1707
|
+
/**
|
|
1708
|
+
* What kind of activity this is.
|
|
1709
|
+
*/
|
|
1710
|
+
activityType: string;
|
|
1711
|
+
/**
|
|
1712
|
+
* The change, as an RFC 6902 patch against the activity's content.
|
|
1713
|
+
*/
|
|
1714
|
+
patch: JsonPatch;
|
|
1715
|
+
};
|
|
1716
|
+
/**
|
|
1717
|
+
* Passes a provider-native event through untranslated, for consumers that need
|
|
1718
|
+
* detail the protocol does not model.
|
|
1719
|
+
*/
|
|
1720
|
+
type RawEvent$1 = {
|
|
1721
|
+
/**
|
|
1722
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
1723
|
+
*/
|
|
1724
|
+
type: EventType.RAW;
|
|
1725
|
+
/**
|
|
1726
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
1727
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
1728
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
1729
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
1730
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
1731
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
1732
|
+
* protocol computes with this value.
|
|
1733
|
+
*/
|
|
1734
|
+
timestamp?: number;
|
|
1735
|
+
/**
|
|
1736
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
1737
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
1738
|
+
* model. Any JSON value.
|
|
1739
|
+
*/
|
|
1740
|
+
rawEvent?: any;
|
|
1741
|
+
/**
|
|
1742
|
+
* Extra information attached to this event.
|
|
1743
|
+
*/
|
|
1744
|
+
metadata?: Metadata;
|
|
1745
|
+
/**
|
|
1746
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1747
|
+
* produced it directly.
|
|
1748
|
+
*/
|
|
1749
|
+
subagentRunId?: SubagentRunId;
|
|
1750
|
+
/**
|
|
1751
|
+
* The provider's own event. Any JSON value, and required: an event whose
|
|
1752
|
+
* only purpose is to carry this would say nothing without it.
|
|
1753
|
+
*/
|
|
1754
|
+
event: any;
|
|
1755
|
+
/**
|
|
1756
|
+
* Which provider or framework the event came from.
|
|
1757
|
+
*/
|
|
1758
|
+
source?: string;
|
|
1759
|
+
};
|
|
1760
|
+
/**
|
|
1761
|
+
* The protocol's extension point for an application's own events. Anything a
|
|
1762
|
+
* consumer does with one is outside the protocol.
|
|
1763
|
+
*/
|
|
1764
|
+
type CustomEvent$1 = {
|
|
1765
|
+
/**
|
|
1766
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
1767
|
+
*/
|
|
601
1768
|
type: EventType.CUSTOM;
|
|
1769
|
+
/**
|
|
1770
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
1771
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
1772
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
1773
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
1774
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
1775
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
1776
|
+
* protocol computes with this value.
|
|
1777
|
+
*/
|
|
1778
|
+
timestamp?: number;
|
|
1779
|
+
/**
|
|
1780
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
1781
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
1782
|
+
* model. Any JSON value.
|
|
1783
|
+
*/
|
|
1784
|
+
rawEvent?: any;
|
|
1785
|
+
/**
|
|
1786
|
+
* Extra information attached to this event.
|
|
1787
|
+
*/
|
|
1788
|
+
metadata?: Metadata;
|
|
1789
|
+
/**
|
|
1790
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
1791
|
+
* produced it directly.
|
|
1792
|
+
*/
|
|
1793
|
+
subagentRunId?: SubagentRunId;
|
|
1794
|
+
/**
|
|
1795
|
+
* What this custom event is. Required: without it a consumer cannot route
|
|
1796
|
+
* the value.
|
|
1797
|
+
*/
|
|
602
1798
|
name: string;
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
1799
|
+
/**
|
|
1800
|
+
* The payload. Any JSON value, and required.
|
|
1801
|
+
*/
|
|
1802
|
+
value: any;
|
|
1803
|
+
};
|
|
1804
|
+
/**
|
|
1805
|
+
* A tool the agent may call.
|
|
1806
|
+
*/
|
|
1807
|
+
type Tool$2 = {
|
|
1808
|
+
/**
|
|
1809
|
+
* The tool's name, as the agent will call it.
|
|
1810
|
+
*/
|
|
1811
|
+
name: string;
|
|
1812
|
+
/**
|
|
1813
|
+
* What the tool does, for the agent to decide when to use it.
|
|
1814
|
+
*/
|
|
1815
|
+
description: string;
|
|
1816
|
+
/**
|
|
1817
|
+
* A JSON Schema describing the tool's arguments. Carried opaquely: the
|
|
1818
|
+
* protocol does not constrain or validate it. Optional, because all three
|
|
1819
|
+
* SDKs already treat it that way and a tool that takes no arguments has
|
|
1820
|
+
* nothing to declare; an absent schema and an empty one mean the same thing
|
|
1821
|
+
* to an agent.
|
|
1822
|
+
*/
|
|
1823
|
+
parameters?: any;
|
|
1824
|
+
/**
|
|
1825
|
+
* Extra information about the tool, for consumers that attach their own
|
|
1826
|
+
* rendering or routing information to it.
|
|
1827
|
+
*/
|
|
1828
|
+
metadata?: Metadata;
|
|
1829
|
+
};
|
|
1830
|
+
/**
|
|
1831
|
+
* A named piece of ambient information given to the agent for the run,
|
|
1832
|
+
* distinct from the conversation.
|
|
1833
|
+
*/
|
|
1834
|
+
type Context = {
|
|
1835
|
+
/**
|
|
1836
|
+
* What this context is, for the agent to interpret.
|
|
1837
|
+
*/
|
|
1838
|
+
description: string;
|
|
1839
|
+
/**
|
|
1840
|
+
* The context itself.
|
|
1841
|
+
*/
|
|
1842
|
+
value: string;
|
|
1843
|
+
};
|
|
1844
|
+
/**
|
|
1845
|
+
* An answer to one interrupt, sent on the run that continues from it.
|
|
1846
|
+
*/
|
|
1847
|
+
type ResumeEntry = {
|
|
1848
|
+
/**
|
|
1849
|
+
* The interrupt being answered.
|
|
1850
|
+
*/
|
|
1851
|
+
interruptId: string;
|
|
1852
|
+
/**
|
|
1853
|
+
* Whether the interrupt was answered or abandoned.
|
|
1854
|
+
*/
|
|
1855
|
+
status: "resolved" | "cancelled";
|
|
1856
|
+
/**
|
|
1857
|
+
* The answer the agent asked for and will act on. Any JSON value.
|
|
1858
|
+
*/
|
|
1859
|
+
payload?: any;
|
|
1860
|
+
/**
|
|
1861
|
+
* Envelope information about the response, such as signatures or routing
|
|
1862
|
+
* keys, as opposed to payload, which is the answer itself.
|
|
1863
|
+
*/
|
|
1864
|
+
metadata?: Metadata;
|
|
1865
|
+
};
|
|
1866
|
+
/**
|
|
1867
|
+
* A request to run an agent. Also echoed back as RUN_STARTED.input. Only
|
|
1868
|
+
* threadId, runId and messages are required: those are the three the SDKs
|
|
1869
|
+
* already agree on, and for tools and context an absent key and an empty array
|
|
1870
|
+
* mean the same thing, so requiring them would catch nothing a producer could
|
|
1871
|
+
* get wrong. Requiredness above describes the wire; this TypeScript type
|
|
1872
|
+
* additionally requires every field the SDK materialises.
|
|
1873
|
+
*/
|
|
1874
|
+
type RunAgentInput = {
|
|
1875
|
+
/**
|
|
1876
|
+
* The conversation this run belongs to.
|
|
1877
|
+
*/
|
|
1878
|
+
threadId: string;
|
|
1879
|
+
/**
|
|
1880
|
+
* Identifies this run.
|
|
1881
|
+
*/
|
|
1882
|
+
runId: string;
|
|
1883
|
+
/**
|
|
1884
|
+
* The protocol version this consumer speaks, such as "1.0". Absent means the
|
|
1885
|
+
* input was produced before the protocol carried a version — the versioning
|
|
1886
|
+
* rules in the prose govern what each side does with that. Sent in-band
|
|
1887
|
+
* rather than by the transport, so a recorded exchange stays
|
|
1888
|
+
* self-describing.
|
|
1889
|
+
*/
|
|
1890
|
+
protocolVersion?: string;
|
|
1891
|
+
/**
|
|
1892
|
+
* The run that spawned this one.
|
|
1893
|
+
*/
|
|
1894
|
+
parentRunId?: string;
|
|
1895
|
+
/**
|
|
1896
|
+
* The state the run starts from.
|
|
1897
|
+
*/
|
|
1898
|
+
state?: State;
|
|
1899
|
+
/**
|
|
1900
|
+
* The conversation so far, in order.
|
|
1901
|
+
*/
|
|
1902
|
+
messages: Message[];
|
|
1903
|
+
/**
|
|
1904
|
+
* The tools the agent may call. Absent means none. Optional on the wire; the
|
|
1905
|
+
* TypeScript SDK materialises an absent one as an empty list, so this type
|
|
1906
|
+
* requires it.
|
|
1907
|
+
*/
|
|
1908
|
+
tools: Tool$2[];
|
|
1909
|
+
/**
|
|
1910
|
+
* Ambient information for the run. Absent means none. Optional on the wire;
|
|
1911
|
+
* the TypeScript SDK materialises an absent one as an empty list, so this
|
|
1912
|
+
* type requires it.
|
|
1913
|
+
*/
|
|
1914
|
+
context: Context[];
|
|
1915
|
+
/**
|
|
1916
|
+
* Application-specific values passed through to the agent untouched. Any
|
|
1917
|
+
* JSON value.
|
|
1918
|
+
*/
|
|
1919
|
+
forwardedProps?: any;
|
|
1920
|
+
/**
|
|
1921
|
+
* Answers to the interrupts that ended a previous run, when this run
|
|
1922
|
+
* continues from one.
|
|
1923
|
+
*/
|
|
1924
|
+
resume?: ResumeEntry[];
|
|
1925
|
+
};
|
|
1926
|
+
/**
|
|
1927
|
+
* Opens a run. Run-scoped, so it carries no subagent attribution.
|
|
1928
|
+
*/
|
|
1929
|
+
type RunStartedEvent$1 = {
|
|
1930
|
+
/**
|
|
1931
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
1932
|
+
*/
|
|
606
1933
|
type: EventType.RUN_STARTED;
|
|
1934
|
+
/**
|
|
1935
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
1936
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
1937
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
1938
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
1939
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
1940
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
1941
|
+
* protocol computes with this value.
|
|
1942
|
+
*/
|
|
1943
|
+
timestamp?: number;
|
|
1944
|
+
/**
|
|
1945
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
1946
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
1947
|
+
* model. Any JSON value.
|
|
1948
|
+
*/
|
|
1949
|
+
rawEvent?: any;
|
|
1950
|
+
/**
|
|
1951
|
+
* Extra information attached to this event.
|
|
1952
|
+
*/
|
|
1953
|
+
metadata?: Metadata;
|
|
1954
|
+
/**
|
|
1955
|
+
* The conversation this run belongs to.
|
|
1956
|
+
*/
|
|
607
1957
|
threadId: string;
|
|
1958
|
+
/**
|
|
1959
|
+
* Identifies this run.
|
|
1960
|
+
*/
|
|
608
1961
|
runId: string;
|
|
1962
|
+
/**
|
|
1963
|
+
* The protocol version this producer speaks, such as "1.0" — the producer's
|
|
1964
|
+
* own version, not an echo of the input's, which is what makes the pair a
|
|
1965
|
+
* negotiation: each side declares itself and the consumer sees a downgrade
|
|
1966
|
+
* the moment it happens. Absent means a producer from before the protocol
|
|
1967
|
+
* carried a version.
|
|
1968
|
+
*/
|
|
1969
|
+
protocolVersion?: string;
|
|
1970
|
+
/**
|
|
1971
|
+
* The run that spawned this one, when an agent invokes another agent as a
|
|
1972
|
+
* separate run rather than as a subagent within one.
|
|
1973
|
+
*/
|
|
609
1974
|
parentRunId?: string;
|
|
1975
|
+
/**
|
|
1976
|
+
* The request this run was started from, echoed back so a consumer that did
|
|
1977
|
+
* not make the request can still see what the agent was asked.
|
|
1978
|
+
*/
|
|
610
1979
|
input?: RunAgentInput;
|
|
611
|
-
}
|
|
612
|
-
|
|
1980
|
+
};
|
|
1981
|
+
/**
|
|
1982
|
+
* The run completed. Equivalent to an absent outcome. Closed like every other
|
|
1983
|
+
* object, which is also what keeps it from carrying the suspended sibling's
|
|
1984
|
+
* interrupts — a success with an interrupt still pending would be a
|
|
1985
|
+
* contradiction, not an extension. A completed run may still have left
|
|
1986
|
+
* frontend tool calls for the application to answer; pendingToolCallIds names
|
|
1987
|
+
* them.
|
|
1988
|
+
*/
|
|
1989
|
+
type RunFinishedSuccessOutcome = {
|
|
1990
|
+
/**
|
|
1991
|
+
* Discriminator.
|
|
1992
|
+
*/
|
|
613
1993
|
type: "success";
|
|
614
|
-
|
|
615
|
-
|
|
1994
|
+
/**
|
|
1995
|
+
* The tool calls this run started and left unanswered — no TOOL_CALL_RESULT
|
|
1996
|
+
* in the run — for the application to answer in the next input's messages,
|
|
1997
|
+
* in the order they were made. Absent or empty means the producer named
|
|
1998
|
+
* none, and a consumer derives the list from the stream; otherwise it is the
|
|
1999
|
+
* list, and it agrees with the stream. On the success outcome rather than
|
|
2000
|
+
* the event because a run that stopped on a frontend tool call is a
|
|
2001
|
+
* completed run: whether the application continues the thread is its own
|
|
2002
|
+
* decision, so the producer reports what it knows and no more. Each item: A
|
|
2003
|
+
* tool call id, as carried by TOOL_CALL_START.
|
|
2004
|
+
*/
|
|
2005
|
+
pendingToolCallIds?: string[];
|
|
2006
|
+
};
|
|
2007
|
+
/**
|
|
2008
|
+
* Something a run needs from outside before it can continue, such as an
|
|
2009
|
+
* approval or a missing value.
|
|
2010
|
+
*/
|
|
2011
|
+
type Interrupt$1 = {
|
|
2012
|
+
/**
|
|
2013
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
2014
|
+
* produced it directly.
|
|
2015
|
+
*/
|
|
2016
|
+
subagentRunId?: SubagentRunId;
|
|
2017
|
+
/**
|
|
2018
|
+
* Identifies the interrupt. A resume entry answers it by this id.
|
|
2019
|
+
*/
|
|
2020
|
+
id: string;
|
|
2021
|
+
/**
|
|
2022
|
+
* Why the run stopped. An open string rather than an enumeration: the
|
|
2023
|
+
* protocol does not attempt to classify every reason an agent might need
|
|
2024
|
+
* input.
|
|
2025
|
+
*/
|
|
2026
|
+
reason: string;
|
|
2027
|
+
/**
|
|
2028
|
+
* A human-readable prompt for whoever answers.
|
|
2029
|
+
*/
|
|
2030
|
+
message?: string;
|
|
2031
|
+
/**
|
|
2032
|
+
* The tool call this interrupt concerns, when it is a tool approval.
|
|
2033
|
+
*/
|
|
2034
|
+
toolCallId?: string;
|
|
2035
|
+
/**
|
|
2036
|
+
* A JSON Schema describing the answer this interrupt expects, so a consumer
|
|
2037
|
+
* can build a form for it. Carried opaquely: the protocol does not constrain
|
|
2038
|
+
* or validate it. Restricted to an object because TypeScript and Python both
|
|
2039
|
+
* declare it that way; .NET holds it as any JSON, and the ticket that
|
|
2040
|
+
* commissioned this schema lists it among the arbitrary-JSON fields.
|
|
2041
|
+
* Following the two that constrain it keeps the schema from accepting
|
|
2042
|
+
* documents the reference client rejects, at the cost of rejecting the
|
|
2043
|
+
* boolean schemas JSON Schema also permits — a bare true for "any answer".
|
|
2044
|
+
* Recorded as a known divergence rather than settled.
|
|
2045
|
+
*/
|
|
2046
|
+
responseSchema?: Record<string, any>;
|
|
2047
|
+
/**
|
|
2048
|
+
* When the interrupt stops being answerable. Deliberately unconstrained
|
|
2049
|
+
* rather than a date-time format, because producers already disagree about
|
|
2050
|
+
* the representation and tightening it here would reject streams that work
|
|
2051
|
+
* today. The documented convention is ISO 8601, and a consumer comparing
|
|
2052
|
+
* this value will parse it as a date, so a value that is not one leaves the
|
|
2053
|
+
* interrupt looking permanently unexpired.
|
|
2054
|
+
*/
|
|
2055
|
+
expiresAt?: string;
|
|
2056
|
+
/**
|
|
2057
|
+
* Extra information attached to this interrupt.
|
|
2058
|
+
*/
|
|
2059
|
+
metadata?: Metadata;
|
|
2060
|
+
};
|
|
2061
|
+
/**
|
|
2062
|
+
* The run is paused, waiting for something outside it. Resuming means starting
|
|
2063
|
+
* a new run whose resume entries answer these interrupts.
|
|
2064
|
+
*/
|
|
2065
|
+
type RunFinishedInterruptOutcome = {
|
|
2066
|
+
/**
|
|
2067
|
+
* Discriminator.
|
|
2068
|
+
*/
|
|
616
2069
|
type: "interrupt";
|
|
2070
|
+
/**
|
|
2071
|
+
* What the run is waiting for. At least one: an interrupt outcome with
|
|
2072
|
+
* nothing to answer would leave a consumer with nothing to do.
|
|
2073
|
+
*/
|
|
617
2074
|
interrupts: Interrupt$1[];
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
|
|
2075
|
+
};
|
|
2076
|
+
/**
|
|
2077
|
+
* The run was stopped before it completed, by whoever was running it, and did
|
|
2078
|
+
* not fail. Neither success nor interrupt: nothing was produced as a result,
|
|
2079
|
+
* and nothing is waited for, so the next run on the thread is an ordinary new
|
|
2080
|
+
* run rather than a resume. Closed like its siblings: a cancelled run has no
|
|
2081
|
+
* interrupts to carry. Named in the schema before 1.0 because an outcome a
|
|
2082
|
+
* consumer does not recognise is stripped and read as success — a cancellation
|
|
2083
|
+
* added later would reach every 1.0 consumer as a completed run.
|
|
2084
|
+
*/
|
|
2085
|
+
type RunFinishedCancelledOutcome = {
|
|
2086
|
+
/**
|
|
2087
|
+
* Discriminator.
|
|
2088
|
+
*/
|
|
2089
|
+
type: "cancelled";
|
|
2090
|
+
};
|
|
2091
|
+
/**
|
|
2092
|
+
* Why a run ended.
|
|
2093
|
+
*/
|
|
2094
|
+
type RunFinishedOutcome = RunFinishedSuccessOutcome | RunFinishedInterruptOutcome | RunFinishedCancelledOutcome;
|
|
2095
|
+
/**
|
|
2096
|
+
* Token counts for one provider and model, in the protocol's own accounting:
|
|
2097
|
+
* every count is either a total or a named part of one, so entries from
|
|
2098
|
+
* different providers add up without double-counting. inputTokens and
|
|
2099
|
+
* outputTokens are the totals; reasoningTokens, cachedInputTokens and
|
|
2100
|
+
* cacheWriteInputTokens are parts of them, never additions to them;
|
|
2101
|
+
* totalTokens is the two totals summed. Every field is a label or a number —
|
|
2102
|
+
* nothing content-bearing or identifying, no prompts, completions, messages,
|
|
2103
|
+
* or thread, run and user identifiers.
|
|
2104
|
+
*/
|
|
2105
|
+
type TokenUsage = {
|
|
2106
|
+
/**
|
|
2107
|
+
* Which provider served the request.
|
|
2108
|
+
*/
|
|
2109
|
+
provider?: string;
|
|
2110
|
+
/**
|
|
2111
|
+
* Which model served the request.
|
|
2112
|
+
*/
|
|
2113
|
+
model?: string;
|
|
2114
|
+
/**
|
|
2115
|
+
* Every prompt token the call was charged for: tokens read from a provider
|
|
2116
|
+
* cache, tokens written to one, and audio or other non-text input all count
|
|
2117
|
+
* here. cachedInputTokens and cacheWriteInputTokens break this number down
|
|
2118
|
+
* and are never added to it — a provider that reports its cache counts
|
|
2119
|
+
* beside a smaller input count has them added in by the producer before the
|
|
2120
|
+
* entry leaves. Bounded like timestamp and for the same reason: a count
|
|
2121
|
+
* above the JSON safe-integer range does not survive a round trip, so a
|
|
2122
|
+
* consumer would silently read a different number than the producer wrote.
|
|
2123
|
+
*/
|
|
2124
|
+
inputTokens?: number;
|
|
2125
|
+
/**
|
|
2126
|
+
* Every generated token, reasoning included where the provider distinguishes
|
|
2127
|
+
* it. reasoningTokens breaks this number down and is never added to it — a
|
|
2128
|
+
* provider that reports reasoning tokens beside a smaller completion count
|
|
2129
|
+
* has them added in by the producer.
|
|
2130
|
+
*/
|
|
2131
|
+
outputTokens?: number;
|
|
2132
|
+
/**
|
|
2133
|
+
* inputTokens plus outputTokens, under the accounting above. A producer MAY
|
|
2134
|
+
* compute it rather than copy a provider's total, and copies a provider's
|
|
2135
|
+
* total only when that total counts the same way, so a consumer can read
|
|
2136
|
+
* this field as the sum of the other two.
|
|
2137
|
+
*/
|
|
2138
|
+
totalTokens?: number;
|
|
2139
|
+
/**
|
|
2140
|
+
* Output tokens spent on reasoning, where the provider distinguishes them.
|
|
2141
|
+
* Part of outputTokens, not in addition to it.
|
|
2142
|
+
*/
|
|
2143
|
+
reasoningTokens?: number;
|
|
2144
|
+
/**
|
|
2145
|
+
* Input tokens read from a provider cache. Part of inputTokens, not in
|
|
2146
|
+
* addition to it, and disjoint from cacheWriteInputTokens.
|
|
2147
|
+
*/
|
|
2148
|
+
cachedInputTokens?: number;
|
|
2149
|
+
/**
|
|
2150
|
+
* Input tokens written to a provider cache on this call, where the provider
|
|
2151
|
+
* distinguishes them. Part of inputTokens, not in addition to it, and
|
|
2152
|
+
* disjoint from cachedInputTokens. Its own field because providers price a
|
|
2153
|
+
* cache write differently from a cache read, so a consumer computing cost
|
|
2154
|
+
* cannot do without it.
|
|
2155
|
+
*/
|
|
2156
|
+
cacheWriteInputTokens?: number;
|
|
2157
|
+
};
|
|
2158
|
+
/**
|
|
2159
|
+
* Closes a run that did not fail. Run-scoped, so it carries no subagent
|
|
2160
|
+
* attribution.
|
|
2161
|
+
*/
|
|
2162
|
+
type RunFinishedEvent$1 = {
|
|
2163
|
+
/**
|
|
2164
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2165
|
+
*/
|
|
621
2166
|
type: EventType.RUN_FINISHED;
|
|
2167
|
+
/**
|
|
2168
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2169
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2170
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2171
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2172
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2173
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2174
|
+
* protocol computes with this value.
|
|
2175
|
+
*/
|
|
2176
|
+
timestamp?: number;
|
|
2177
|
+
/**
|
|
2178
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2179
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2180
|
+
* model. Any JSON value.
|
|
2181
|
+
*/
|
|
2182
|
+
rawEvent?: any;
|
|
2183
|
+
/**
|
|
2184
|
+
* Extra information attached to this event.
|
|
2185
|
+
*/
|
|
2186
|
+
metadata?: Metadata;
|
|
2187
|
+
/**
|
|
2188
|
+
* The conversation this run belongs to.
|
|
2189
|
+
*/
|
|
622
2190
|
threadId: string;
|
|
2191
|
+
/**
|
|
2192
|
+
* The run being closed.
|
|
2193
|
+
*/
|
|
623
2194
|
runId: string;
|
|
2195
|
+
/**
|
|
2196
|
+
* The run's return value, if it has one. Any JSON value.
|
|
2197
|
+
*/
|
|
624
2198
|
result?: any;
|
|
2199
|
+
/**
|
|
2200
|
+
* Why the run ended. Absent means success, so every producer written before
|
|
2201
|
+
* outcomes existed is already conformant.
|
|
2202
|
+
*/
|
|
625
2203
|
outcome?: RunFinishedOutcome;
|
|
626
|
-
|
|
627
|
-
|
|
2204
|
+
/**
|
|
2205
|
+
* Token usage for the run, one entry per provider and model, so a run that
|
|
2206
|
+
* invoked several models keeps them separate. A consumer that only wants
|
|
2207
|
+
* totals sums across the entries. The run is the accounting boundary: usage
|
|
2208
|
+
* covers every model call made within the run, calls made by its subagents
|
|
2209
|
+
* included; an agent invoked as a separate run under parentRunId reports its
|
|
2210
|
+
* own usage on its own terminal event; and a run that resumes an interrupted
|
|
2211
|
+
* one reports only the calls it made itself, not the interrupted run's.
|
|
2212
|
+
*/
|
|
2213
|
+
usage?: TokenUsage[];
|
|
2214
|
+
};
|
|
2215
|
+
/**
|
|
2216
|
+
* Ends a run that failed. Run-scoped, so it carries no subagent attribution; a
|
|
2217
|
+
* subagent that fails without ending the run reports SUBAGENT_ERROR instead.
|
|
2218
|
+
*/
|
|
2219
|
+
type RunErrorEvent$1 = {
|
|
2220
|
+
/**
|
|
2221
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2222
|
+
*/
|
|
628
2223
|
type: EventType.RUN_ERROR;
|
|
2224
|
+
/**
|
|
2225
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2226
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2227
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2228
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2229
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2230
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2231
|
+
* protocol computes with this value.
|
|
2232
|
+
*/
|
|
2233
|
+
timestamp?: number;
|
|
2234
|
+
/**
|
|
2235
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2236
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2237
|
+
* model. Any JSON value.
|
|
2238
|
+
*/
|
|
2239
|
+
rawEvent?: any;
|
|
2240
|
+
/**
|
|
2241
|
+
* Extra information attached to this event.
|
|
2242
|
+
*/
|
|
2243
|
+
metadata?: Metadata;
|
|
2244
|
+
/**
|
|
2245
|
+
* What went wrong, for a person to read.
|
|
2246
|
+
*/
|
|
629
2247
|
message: string;
|
|
2248
|
+
/**
|
|
2249
|
+
* A machine-readable error code. An open string: the protocol defines no
|
|
2250
|
+
* vocabulary.
|
|
2251
|
+
*/
|
|
630
2252
|
code?: string;
|
|
631
|
-
|
|
632
|
-
|
|
2253
|
+
/**
|
|
2254
|
+
* Token usage accrued before the failure, for a run that completed one or
|
|
2255
|
+
* more model calls before dying. Scoped as on RUN_FINISHED: the run's own
|
|
2256
|
+
* calls, subagents included.
|
|
2257
|
+
*/
|
|
2258
|
+
usage?: TokenUsage[];
|
|
2259
|
+
};
|
|
2260
|
+
/**
|
|
2261
|
+
* Opens a named step within a run, for producers whose frameworks have a step
|
|
2262
|
+
* concept worth surfacing.
|
|
2263
|
+
*/
|
|
2264
|
+
type StepStartedEvent$1 = {
|
|
2265
|
+
/**
|
|
2266
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2267
|
+
*/
|
|
633
2268
|
type: EventType.STEP_STARTED;
|
|
2269
|
+
/**
|
|
2270
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2271
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2272
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2273
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2274
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2275
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2276
|
+
* protocol computes with this value.
|
|
2277
|
+
*/
|
|
2278
|
+
timestamp?: number;
|
|
2279
|
+
/**
|
|
2280
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2281
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2282
|
+
* model. Any JSON value.
|
|
2283
|
+
*/
|
|
2284
|
+
rawEvent?: any;
|
|
2285
|
+
/**
|
|
2286
|
+
* Extra information attached to this event.
|
|
2287
|
+
*/
|
|
2288
|
+
metadata?: Metadata;
|
|
2289
|
+
/**
|
|
2290
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
2291
|
+
* produced it directly.
|
|
2292
|
+
*/
|
|
2293
|
+
subagentRunId?: SubagentRunId;
|
|
2294
|
+
/**
|
|
2295
|
+
* The step's name. Identifies it: the matching STEP_FINISHED carries the
|
|
2296
|
+
* same name.
|
|
2297
|
+
*/
|
|
634
2298
|
stepName: string;
|
|
635
|
-
}
|
|
636
|
-
|
|
2299
|
+
};
|
|
2300
|
+
/**
|
|
2301
|
+
* Closes a named step.
|
|
2302
|
+
*/
|
|
2303
|
+
type StepFinishedEvent$1 = {
|
|
2304
|
+
/**
|
|
2305
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2306
|
+
*/
|
|
637
2307
|
type: EventType.STEP_FINISHED;
|
|
2308
|
+
/**
|
|
2309
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2310
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2311
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2312
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2313
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2314
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2315
|
+
* protocol computes with this value.
|
|
2316
|
+
*/
|
|
2317
|
+
timestamp?: number;
|
|
2318
|
+
/**
|
|
2319
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2320
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2321
|
+
* model. Any JSON value.
|
|
2322
|
+
*/
|
|
2323
|
+
rawEvent?: any;
|
|
2324
|
+
/**
|
|
2325
|
+
* Extra information attached to this event.
|
|
2326
|
+
*/
|
|
2327
|
+
metadata?: Metadata;
|
|
2328
|
+
/**
|
|
2329
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
2330
|
+
* produced it directly.
|
|
2331
|
+
*/
|
|
2332
|
+
subagentRunId?: SubagentRunId;
|
|
2333
|
+
/**
|
|
2334
|
+
* The step being closed.
|
|
2335
|
+
*/
|
|
638
2336
|
stepName: string;
|
|
639
|
-
}
|
|
640
|
-
|
|
2337
|
+
};
|
|
2338
|
+
/**
|
|
2339
|
+
* Opens a span of reasoning. A span may contain several reasoning messages.
|
|
2340
|
+
*/
|
|
2341
|
+
type ReasoningStartEvent$1 = {
|
|
2342
|
+
/**
|
|
2343
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2344
|
+
*/
|
|
641
2345
|
type: EventType.REASONING_START;
|
|
2346
|
+
/**
|
|
2347
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2348
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2349
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2350
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2351
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2352
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2353
|
+
* protocol computes with this value.
|
|
2354
|
+
*/
|
|
2355
|
+
timestamp?: number;
|
|
2356
|
+
/**
|
|
2357
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2358
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2359
|
+
* model. Any JSON value.
|
|
2360
|
+
*/
|
|
2361
|
+
rawEvent?: any;
|
|
2362
|
+
/**
|
|
2363
|
+
* Extra information attached to this event.
|
|
2364
|
+
*/
|
|
2365
|
+
metadata?: Metadata;
|
|
2366
|
+
/**
|
|
2367
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
2368
|
+
* produced it directly.
|
|
2369
|
+
*/
|
|
2370
|
+
subagentRunId?: SubagentRunId;
|
|
2371
|
+
/**
|
|
2372
|
+
* The span being opened.
|
|
2373
|
+
*/
|
|
642
2374
|
messageId: string;
|
|
643
|
-
}
|
|
644
|
-
|
|
2375
|
+
};
|
|
2376
|
+
/**
|
|
2377
|
+
* Opens a streamed reasoning message.
|
|
2378
|
+
*/
|
|
2379
|
+
type ReasoningMessageStartEvent$1 = {
|
|
2380
|
+
/**
|
|
2381
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2382
|
+
*/
|
|
645
2383
|
type: EventType.REASONING_MESSAGE_START;
|
|
2384
|
+
/**
|
|
2385
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2386
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2387
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2388
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2389
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2390
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2391
|
+
* protocol computes with this value.
|
|
2392
|
+
*/
|
|
2393
|
+
timestamp?: number;
|
|
2394
|
+
/**
|
|
2395
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2396
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2397
|
+
* model. Any JSON value.
|
|
2398
|
+
*/
|
|
2399
|
+
rawEvent?: any;
|
|
2400
|
+
/**
|
|
2401
|
+
* Extra information attached to this event.
|
|
2402
|
+
*/
|
|
2403
|
+
metadata?: Metadata;
|
|
2404
|
+
/**
|
|
2405
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
2406
|
+
* produced it directly.
|
|
2407
|
+
*/
|
|
2408
|
+
subagentRunId?: SubagentRunId;
|
|
2409
|
+
/**
|
|
2410
|
+
* The reasoning message this stream builds.
|
|
2411
|
+
*/
|
|
646
2412
|
messageId: string;
|
|
2413
|
+
/**
|
|
2414
|
+
* Fixed, and required rather than defaulted. The requirement is inherited
|
|
2415
|
+
* from the SDKs rather than chosen.
|
|
2416
|
+
*/
|
|
647
2417
|
role: "reasoning";
|
|
648
|
-
}
|
|
649
|
-
|
|
2418
|
+
};
|
|
2419
|
+
/**
|
|
2420
|
+
* Appends a fragment to a streamed reasoning message.
|
|
2421
|
+
*/
|
|
2422
|
+
type ReasoningMessageContentEvent$1 = {
|
|
2423
|
+
/**
|
|
2424
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2425
|
+
*/
|
|
650
2426
|
type: EventType.REASONING_MESSAGE_CONTENT;
|
|
2427
|
+
/**
|
|
2428
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2429
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2430
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2431
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2432
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2433
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2434
|
+
* protocol computes with this value.
|
|
2435
|
+
*/
|
|
2436
|
+
timestamp?: number;
|
|
2437
|
+
/**
|
|
2438
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2439
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2440
|
+
* model. Any JSON value.
|
|
2441
|
+
*/
|
|
2442
|
+
rawEvent?: any;
|
|
2443
|
+
/**
|
|
2444
|
+
* Extra information attached to this event.
|
|
2445
|
+
*/
|
|
2446
|
+
metadata?: Metadata;
|
|
2447
|
+
/**
|
|
2448
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
2449
|
+
* produced it directly.
|
|
2450
|
+
*/
|
|
2451
|
+
subagentRunId?: SubagentRunId;
|
|
2452
|
+
/**
|
|
2453
|
+
* The reasoning message this fragment belongs to.
|
|
2454
|
+
*/
|
|
651
2455
|
messageId: string;
|
|
2456
|
+
/**
|
|
2457
|
+
* The fragment to append. May be the empty string.
|
|
2458
|
+
*/
|
|
652
2459
|
delta: string;
|
|
653
|
-
}
|
|
654
|
-
|
|
2460
|
+
};
|
|
2461
|
+
/**
|
|
2462
|
+
* Closes a streamed reasoning message.
|
|
2463
|
+
*/
|
|
2464
|
+
type ReasoningMessageEndEvent$1 = {
|
|
2465
|
+
/**
|
|
2466
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2467
|
+
*/
|
|
655
2468
|
type: EventType.REASONING_MESSAGE_END;
|
|
2469
|
+
/**
|
|
2470
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2471
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2472
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2473
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2474
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2475
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2476
|
+
* protocol computes with this value.
|
|
2477
|
+
*/
|
|
2478
|
+
timestamp?: number;
|
|
2479
|
+
/**
|
|
2480
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2481
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2482
|
+
* model. Any JSON value.
|
|
2483
|
+
*/
|
|
2484
|
+
rawEvent?: any;
|
|
2485
|
+
/**
|
|
2486
|
+
* Extra information attached to this event.
|
|
2487
|
+
*/
|
|
2488
|
+
metadata?: Metadata;
|
|
2489
|
+
/**
|
|
2490
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
2491
|
+
* produced it directly.
|
|
2492
|
+
*/
|
|
2493
|
+
subagentRunId?: SubagentRunId;
|
|
2494
|
+
/**
|
|
2495
|
+
* The reasoning message being closed.
|
|
2496
|
+
*/
|
|
656
2497
|
messageId: string;
|
|
657
|
-
}
|
|
658
|
-
|
|
2498
|
+
};
|
|
2499
|
+
/**
|
|
2500
|
+
* A shorthand that stands in for a reasoning message's start, content and end
|
|
2501
|
+
* sequence.
|
|
2502
|
+
*/
|
|
2503
|
+
type ReasoningMessageChunkEvent$1 = {
|
|
2504
|
+
/**
|
|
2505
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2506
|
+
*/
|
|
2507
|
+
type: EventType.REASONING_MESSAGE_CHUNK;
|
|
2508
|
+
/**
|
|
2509
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2510
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2511
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2512
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2513
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2514
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2515
|
+
* protocol computes with this value.
|
|
2516
|
+
*/
|
|
2517
|
+
timestamp?: number;
|
|
2518
|
+
/**
|
|
2519
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2520
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2521
|
+
* model. Any JSON value.
|
|
2522
|
+
*/
|
|
2523
|
+
rawEvent?: any;
|
|
2524
|
+
/**
|
|
2525
|
+
* Extra information attached to this event.
|
|
2526
|
+
*/
|
|
2527
|
+
metadata?: Metadata;
|
|
2528
|
+
/**
|
|
2529
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
2530
|
+
* produced it directly.
|
|
2531
|
+
*/
|
|
2532
|
+
subagentRunId?: SubagentRunId;
|
|
2533
|
+
/**
|
|
2534
|
+
* The reasoning message this chunk belongs to. Absent continues the one
|
|
2535
|
+
* already open.
|
|
2536
|
+
*/
|
|
2537
|
+
messageId?: string;
|
|
2538
|
+
/**
|
|
2539
|
+
* The fragment to append. May be the empty string.
|
|
2540
|
+
*/
|
|
2541
|
+
delta?: string;
|
|
2542
|
+
};
|
|
2543
|
+
/**
|
|
2544
|
+
* Closes a span of reasoning.
|
|
2545
|
+
*/
|
|
2546
|
+
type ReasoningEndEvent$1 = {
|
|
2547
|
+
/**
|
|
2548
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2549
|
+
*/
|
|
659
2550
|
type: EventType.REASONING_END;
|
|
2551
|
+
/**
|
|
2552
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2553
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2554
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2555
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2556
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2557
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2558
|
+
* protocol computes with this value.
|
|
2559
|
+
*/
|
|
2560
|
+
timestamp?: number;
|
|
2561
|
+
/**
|
|
2562
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2563
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2564
|
+
* model. Any JSON value.
|
|
2565
|
+
*/
|
|
2566
|
+
rawEvent?: any;
|
|
2567
|
+
/**
|
|
2568
|
+
* Extra information attached to this event.
|
|
2569
|
+
*/
|
|
2570
|
+
metadata?: Metadata;
|
|
2571
|
+
/**
|
|
2572
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
2573
|
+
* produced it directly.
|
|
2574
|
+
*/
|
|
2575
|
+
subagentRunId?: SubagentRunId;
|
|
2576
|
+
/**
|
|
2577
|
+
* The span being closed.
|
|
2578
|
+
*/
|
|
660
2579
|
messageId: string;
|
|
661
|
-
}
|
|
662
|
-
|
|
2580
|
+
};
|
|
2581
|
+
/**
|
|
2582
|
+
* Whether a REASONING_ENCRYPTED_VALUE belongs to a message or to a tool call.
|
|
2583
|
+
*/
|
|
2584
|
+
type ReasoningEncryptedValueSubtype = "tool-call" | "message";
|
|
2585
|
+
/**
|
|
2586
|
+
* Carries a provider's opaque, encrypted reasoning artefact, which a consumer
|
|
2587
|
+
* stores and returns on a later turn without being able to read it.
|
|
2588
|
+
*/
|
|
2589
|
+
type ReasoningEncryptedValueEvent$1 = {
|
|
2590
|
+
/**
|
|
2591
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2592
|
+
*/
|
|
663
2593
|
type: EventType.REASONING_ENCRYPTED_VALUE;
|
|
2594
|
+
/**
|
|
2595
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2596
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2597
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2598
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2599
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2600
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2601
|
+
* protocol computes with this value.
|
|
2602
|
+
*/
|
|
2603
|
+
timestamp?: number;
|
|
2604
|
+
/**
|
|
2605
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2606
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2607
|
+
* model. Any JSON value.
|
|
2608
|
+
*/
|
|
2609
|
+
rawEvent?: any;
|
|
2610
|
+
/**
|
|
2611
|
+
* Extra information attached to this event.
|
|
2612
|
+
*/
|
|
2613
|
+
metadata?: Metadata;
|
|
2614
|
+
/**
|
|
2615
|
+
* The subagent invocation this belongs to. Absent means the parent agent
|
|
2616
|
+
* produced it directly.
|
|
2617
|
+
*/
|
|
2618
|
+
subagentRunId?: SubagentRunId;
|
|
2619
|
+
/**
|
|
2620
|
+
* What kind of thing entityId names, which decides where the value is
|
|
2621
|
+
* stored.
|
|
2622
|
+
*/
|
|
664
2623
|
subtype: ReasoningEncryptedValueSubtype;
|
|
2624
|
+
/**
|
|
2625
|
+
* What the value belongs to: a message id or a tool call id, according to
|
|
2626
|
+
* subtype.
|
|
2627
|
+
*/
|
|
665
2628
|
entityId: string;
|
|
2629
|
+
/**
|
|
2630
|
+
* The provider's opaque artefact.
|
|
2631
|
+
*/
|
|
666
2632
|
encryptedValue: string;
|
|
667
|
-
}
|
|
2633
|
+
};
|
|
2634
|
+
/**
|
|
2635
|
+
* Announces that a subagent invocation has begun. Everything the subagent
|
|
2636
|
+
* produces afterwards is attributed by carrying its subagentRunId, so a
|
|
2637
|
+
* consumer can group the work without replaying the stream. Composed from
|
|
2638
|
+
* BaseEvent alone rather than Attributable, because here subagentRunId
|
|
2639
|
+
* identifies the subagent rather than attributing the event to one;
|
|
2640
|
+
* attribution to an enclosing subagent is parentSubagentRunId.
|
|
2641
|
+
*/
|
|
2642
|
+
type SubagentStartedEvent$1 = {
|
|
2643
|
+
/**
|
|
2644
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2645
|
+
*/
|
|
2646
|
+
type: EventType.SUBAGENT_STARTED;
|
|
2647
|
+
/**
|
|
2648
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2649
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2650
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2651
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2652
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2653
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2654
|
+
* protocol computes with this value.
|
|
2655
|
+
*/
|
|
2656
|
+
timestamp?: number;
|
|
2657
|
+
/**
|
|
2658
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2659
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2660
|
+
* model. Any JSON value.
|
|
2661
|
+
*/
|
|
2662
|
+
rawEvent?: any;
|
|
2663
|
+
/**
|
|
2664
|
+
* Extra information attached to this event.
|
|
2665
|
+
*/
|
|
2666
|
+
metadata?: Metadata;
|
|
2667
|
+
/**
|
|
2668
|
+
* The invocation being announced.
|
|
2669
|
+
*/
|
|
2670
|
+
subagentRunId: SubagentRunId;
|
|
2671
|
+
/**
|
|
2672
|
+
* The subagent's name, which is reusable across invocations, unlike
|
|
2673
|
+
* subagentRunId.
|
|
2674
|
+
*/
|
|
2675
|
+
name: string;
|
|
2676
|
+
/**
|
|
2677
|
+
* What this subagent is for, for a consumer to display.
|
|
2678
|
+
*/
|
|
2679
|
+
description?: string;
|
|
2680
|
+
/**
|
|
2681
|
+
* The subagent invocation that spawned this one, for nested delegation.
|
|
2682
|
+
* Absent means the parent agent spawned it directly.
|
|
2683
|
+
*/
|
|
2684
|
+
parentSubagentRunId?: SubagentRunId;
|
|
2685
|
+
/**
|
|
2686
|
+
* The tool call that spawned this subagent, for the pattern where agents are
|
|
2687
|
+
* exposed to a model as tools. Lets a consumer tie the subagent to the call
|
|
2688
|
+
* without reading rawEvent.
|
|
2689
|
+
*/
|
|
2690
|
+
parentToolCallId?: string;
|
|
2691
|
+
/**
|
|
2692
|
+
* The message that held the spawning tool call.
|
|
2693
|
+
*/
|
|
2694
|
+
parentMessageId?: string;
|
|
2695
|
+
};
|
|
2696
|
+
/**
|
|
2697
|
+
* The subagent completed its work. Equivalent to an absent outcome.
|
|
2698
|
+
*/
|
|
2699
|
+
type SubagentFinishedSuccessOutcome = {
|
|
2700
|
+
/**
|
|
2701
|
+
* Discriminator.
|
|
2702
|
+
*/
|
|
2703
|
+
type: "success";
|
|
2704
|
+
};
|
|
2705
|
+
/**
|
|
2706
|
+
* The subagent is paused awaiting outside input. Terminal for this stream, not
|
|
2707
|
+
* for the subagent: a later run may continue the same invocation once the
|
|
2708
|
+
* interrupts are answered.
|
|
2709
|
+
*/
|
|
2710
|
+
type SubagentFinishedSuspendedOutcome = {
|
|
2711
|
+
/**
|
|
2712
|
+
* Discriminator.
|
|
2713
|
+
*/
|
|
2714
|
+
type: "suspended";
|
|
2715
|
+
/**
|
|
2716
|
+
* The run-level interrupts this subagent raised itself. May be empty or
|
|
2717
|
+
* absent: a subagent suspended because a descendant interrupted owns no
|
|
2718
|
+
* interrupt of its own. Each item: An Interrupt.id.
|
|
2719
|
+
*/
|
|
2720
|
+
interruptIds?: string[];
|
|
2721
|
+
};
|
|
2722
|
+
/**
|
|
2723
|
+
* Why a subagent's segment of a run ended. Mirrors RunFinishedOutcome one
|
|
2724
|
+
* level down.
|
|
2725
|
+
*/
|
|
2726
|
+
type SubagentFinishedOutcome = SubagentFinishedSuccessOutcome | SubagentFinishedSuspendedOutcome;
|
|
2727
|
+
/**
|
|
2728
|
+
* Ends a subagent invocation's segment of this run, either because the work
|
|
2729
|
+
* completed or because it is suspended awaiting outside input.
|
|
2730
|
+
*/
|
|
2731
|
+
type SubagentFinishedEvent$1 = {
|
|
2732
|
+
/**
|
|
2733
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2734
|
+
*/
|
|
2735
|
+
type: EventType.SUBAGENT_FINISHED;
|
|
2736
|
+
/**
|
|
2737
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2738
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2739
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2740
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2741
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2742
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2743
|
+
* protocol computes with this value.
|
|
2744
|
+
*/
|
|
2745
|
+
timestamp?: number;
|
|
2746
|
+
/**
|
|
2747
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2748
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2749
|
+
* model. Any JSON value.
|
|
2750
|
+
*/
|
|
2751
|
+
rawEvent?: any;
|
|
2752
|
+
/**
|
|
2753
|
+
* Extra information attached to this event.
|
|
2754
|
+
*/
|
|
2755
|
+
metadata?: Metadata;
|
|
2756
|
+
/**
|
|
2757
|
+
* The invocation being closed.
|
|
2758
|
+
*/
|
|
2759
|
+
subagentRunId: SubagentRunId;
|
|
2760
|
+
/**
|
|
2761
|
+
* The subagent's return value, if it has one. Any JSON value, mirroring
|
|
2762
|
+
* RUN_FINISHED.result.
|
|
2763
|
+
*/
|
|
2764
|
+
result?: any;
|
|
2765
|
+
/**
|
|
2766
|
+
* Why the segment ended. Absent means success. A suspended subagent is
|
|
2767
|
+
* neither a success nor a failure, which is why saying so needs its own
|
|
2768
|
+
* value rather than being inferred from a later interrupt.
|
|
2769
|
+
*/
|
|
2770
|
+
outcome?: SubagentFinishedOutcome;
|
|
2771
|
+
};
|
|
2772
|
+
/**
|
|
2773
|
+
* Reports that a subagent invocation failed. The run may continue: a parent
|
|
2774
|
+
* agent is free to handle a failed subagent, which is why this is not
|
|
2775
|
+
* RUN_ERROR.
|
|
2776
|
+
*/
|
|
2777
|
+
type SubagentErrorEvent$1 = {
|
|
2778
|
+
/**
|
|
2779
|
+
* Which event this is. Each event definition narrows this to a single value.
|
|
2780
|
+
*/
|
|
2781
|
+
type: EventType.SUBAGENT_ERROR;
|
|
2782
|
+
/**
|
|
2783
|
+
* When the event was created. Bounded to the range JSON numbers survive a
|
|
2784
|
+
* round trip in, so the value a consumer reads is the value the producer
|
|
2785
|
+
* wrote. Deliberately not a float. The unit is not constrained here, because
|
|
2786
|
+
* it never has been stated normatively; every SDK that sets it in practice
|
|
2787
|
+
* uses milliseconds since the Unix epoch, and a producer choosing another
|
|
2788
|
+
* unit will be misread by consumers even though it validates. Nothing in the
|
|
2789
|
+
* protocol computes with this value.
|
|
2790
|
+
*/
|
|
2791
|
+
timestamp?: number;
|
|
2792
|
+
/**
|
|
2793
|
+
* The provider-native event this one was translated from, carried verbatim
|
|
2794
|
+
* for debugging and for consumers that need detail the protocol does not
|
|
2795
|
+
* model. Any JSON value.
|
|
2796
|
+
*/
|
|
2797
|
+
rawEvent?: any;
|
|
2798
|
+
/**
|
|
2799
|
+
* Extra information attached to this event.
|
|
2800
|
+
*/
|
|
2801
|
+
metadata?: Metadata;
|
|
2802
|
+
/**
|
|
2803
|
+
* The invocation that failed.
|
|
2804
|
+
*/
|
|
2805
|
+
subagentRunId: SubagentRunId;
|
|
2806
|
+
/**
|
|
2807
|
+
* What went wrong, for a person to read.
|
|
2808
|
+
*/
|
|
2809
|
+
message: string;
|
|
2810
|
+
/**
|
|
2811
|
+
* A machine-readable error code. An open string.
|
|
2812
|
+
*/
|
|
2813
|
+
code?: string;
|
|
2814
|
+
};
|
|
2815
|
+
/**
|
|
2816
|
+
* Any AG-UI event. Every member is normative: there is no optional tier and no
|
|
2817
|
+
* event a consumer may decline to implement. Discriminated by the type
|
|
2818
|
+
* property.
|
|
2819
|
+
*/
|
|
2820
|
+
/**
|
|
2821
|
+
* Describes a subagent that can be invoked by a parent agent.
|
|
2822
|
+
*/
|
|
2823
|
+
type SubagentInfo = {
|
|
2824
|
+
/**
|
|
2825
|
+
* Unique name or identifier of the subagent.
|
|
2826
|
+
*/
|
|
2827
|
+
name: string;
|
|
2828
|
+
/**
|
|
2829
|
+
* What this subagent specializes in. Helps clients build agent selection
|
|
2830
|
+
* UIs.
|
|
2831
|
+
*/
|
|
2832
|
+
description?: string;
|
|
2833
|
+
};
|
|
2834
|
+
/**
|
|
2835
|
+
* Basic metadata about the agent. Useful for discovery UIs, agent
|
|
2836
|
+
* marketplaces, and debugging. Set these when you want clients to display
|
|
2837
|
+
* agent information or when multiple agents are available and users need to
|
|
2838
|
+
* pick one.
|
|
2839
|
+
*/
|
|
668
2840
|
//#endregion
|
|
669
|
-
//#region node_modules/.deno/@tanstack+ai@0.
|
|
670
|
-
/** AG-UI spec `usage[]` item (provider/model labels + token counts only). */
|
|
671
|
-
interface SpecTokenUsage {
|
|
672
|
-
provider?: string;
|
|
673
|
-
model?: string;
|
|
674
|
-
inputTokens?: number;
|
|
675
|
-
outputTokens?: number;
|
|
676
|
-
totalTokens?: number;
|
|
677
|
-
reasoningTokens?: number;
|
|
678
|
-
cachedInputTokens?: number;
|
|
679
|
-
}
|
|
2841
|
+
//#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/utilities/ag-ui-usage.d.ts
|
|
680
2842
|
/** TokenUsage fields that have no AG-UI `usage[]` equivalent. */
|
|
681
|
-
type TokenUsageLeftover = Omit<TokenUsage, 'promptTokens' | 'completionTokens' | 'totalTokens'>;
|
|
2843
|
+
type TokenUsageLeftover = Omit<TokenUsage$1, 'promptTokens' | 'completionTokens' | 'totalTokens'>;
|
|
682
2844
|
//#endregion
|
|
683
|
-
//#region node_modules/.deno/@tanstack+ai@0.
|
|
2845
|
+
//#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/types.d.ts
|
|
684
2846
|
/**
|
|
685
2847
|
* Tool call states - track the lifecycle of a tool call
|
|
686
2848
|
*/
|
|
@@ -689,6 +2851,8 @@ type ToolCallState$1 = 'awaiting-input' | 'input-streaming' | 'input-complete' |
|
|
|
689
2851
|
* Tool result states - track the lifecycle of a tool result
|
|
690
2852
|
*/
|
|
691
2853
|
type ToolResultState$1 = 'streaming' | 'complete' | 'error';
|
|
2854
|
+
/** Why a tool result ended without executing successfully. */
|
|
2855
|
+
type ToolResultOutcome = 'cancelled' | 'denied';
|
|
692
2856
|
type ToolOutputState = 'output-available' | 'output-error';
|
|
693
2857
|
/**
|
|
694
2858
|
* JSON Schema type for defining tool input/output schemas as raw JSON Schema objects.
|
|
@@ -761,103 +2925,42 @@ type SchemaInput = StandardJSONSchemaV1<any, any> | StandardSchemaV1$1<any, any>
|
|
|
761
2925
|
* JSON Schema at compile time.
|
|
762
2926
|
*/
|
|
763
2927
|
type InferSchemaType<T> = T extends StandardJSONSchemaV1<infer TInput, unknown> ? TInput : T extends StandardSchemaV1$1<infer TInput, unknown> ? TInput : unknown;
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
type: 'function';
|
|
767
|
-
function: {
|
|
768
|
-
name: string;
|
|
769
|
-
arguments: string;
|
|
770
|
-
};
|
|
2928
|
+
/** AG-UI `ToolCall` with typed metadata. `function.arguments` is a JSON string. */
|
|
2929
|
+
interface ToolCall<TMetadata = unknown> extends Omit<ToolCall$1, 'metadata'> {
|
|
771
2930
|
/** Provider-specific metadata to carry through the tool call lifecycle.
|
|
772
2931
|
* Typed per-adapter via `TToolCallMetadata`. For example,
|
|
773
2932
|
* `@tanstack/ai-gemini` sets this to `{ thoughtSignature?: string }`. */
|
|
774
2933
|
metadata?: TMetadata;
|
|
775
2934
|
}
|
|
776
2935
|
/**
|
|
777
|
-
*
|
|
778
|
-
* Requires a mimeType to ensure providers receive proper content type information.
|
|
779
|
-
*/
|
|
780
|
-
interface ContentPartDataSource {
|
|
781
|
-
/**
|
|
782
|
-
* Indicates this is inline data content.
|
|
783
|
-
*/
|
|
784
|
-
type: 'data';
|
|
785
|
-
/**
|
|
786
|
-
* The base64-encoded content value.
|
|
787
|
-
*/
|
|
788
|
-
value: string;
|
|
789
|
-
/**
|
|
790
|
-
* The MIME type of the content (e.g., 'image/png', 'audio/wav').
|
|
791
|
-
* Required for data sources to ensure proper handling by providers.
|
|
792
|
-
*/
|
|
793
|
-
mimeType: string;
|
|
794
|
-
}
|
|
795
|
-
/**
|
|
796
|
-
* Source specification for URL-based content.
|
|
797
|
-
* mimeType is optional as it can often be inferred from the URL or response headers.
|
|
798
|
-
*/
|
|
799
|
-
interface ContentPartUrlSource {
|
|
800
|
-
/**
|
|
801
|
-
* Indicates this is URL-referenced content.
|
|
802
|
-
*/
|
|
803
|
-
type: 'url';
|
|
804
|
-
/**
|
|
805
|
-
* HTTP(S) URL or data URI pointing to the content.
|
|
806
|
-
*/
|
|
807
|
-
value: string;
|
|
808
|
-
/**
|
|
809
|
-
* Optional MIME type hint for cases where providers can't infer it from the URL.
|
|
810
|
-
*/
|
|
811
|
-
mimeType?: string;
|
|
812
|
-
}
|
|
813
|
-
/**
|
|
814
|
-
* Source specification for multimodal content.
|
|
815
|
-
* Discriminated union supporting both inline data (base64) and URL-based content.
|
|
816
|
-
* - For 'data' sources: mimeType is required
|
|
817
|
-
* - For 'url' sources: mimeType is optional
|
|
818
|
-
*/
|
|
819
|
-
type ContentPartSource = ContentPartDataSource | ContentPartUrlSource;
|
|
820
|
-
/**
|
|
821
|
-
* Image content part for multimodal messages.
|
|
2936
|
+
* Image content part for multimodal messages. AG-UI `ImagePart` with typed metadata.
|
|
822
2937
|
* @template TMetadata - Provider-specific metadata type (e.g., OpenAI's detail level)
|
|
823
2938
|
*/
|
|
824
|
-
interface ImagePart<TMetadata = unknown> {
|
|
825
|
-
type: 'image';
|
|
826
|
-
/** Source of the image content */
|
|
827
|
-
source: ContentPartSource;
|
|
2939
|
+
interface ImagePart<TMetadata = unknown> extends ImagePart$1 {
|
|
828
2940
|
/** Provider-specific metadata (e.g., OpenAI's detail: 'auto' | 'low' | 'high') */
|
|
829
2941
|
metadata?: TMetadata;
|
|
830
2942
|
}
|
|
831
2943
|
/**
|
|
832
|
-
* Audio content part for multimodal messages.
|
|
2944
|
+
* Audio content part for multimodal messages. AG-UI `AudioPart` with typed metadata.
|
|
833
2945
|
* @template TMetadata - Provider-specific metadata type
|
|
834
2946
|
*/
|
|
835
|
-
interface AudioPart<TMetadata = unknown> {
|
|
836
|
-
type: 'audio';
|
|
837
|
-
/** Source of the audio content */
|
|
838
|
-
source: ContentPartSource;
|
|
2947
|
+
interface AudioPart<TMetadata = unknown> extends AudioPart$1 {
|
|
839
2948
|
/** Provider-specific metadata (e.g., format, sample rate) */
|
|
840
2949
|
metadata?: TMetadata;
|
|
841
2950
|
}
|
|
842
2951
|
/**
|
|
843
|
-
* Video content part for multimodal messages.
|
|
2952
|
+
* Video content part for multimodal messages. AG-UI `VideoPart` with typed metadata.
|
|
844
2953
|
* @template TMetadata - Provider-specific metadata type
|
|
845
2954
|
*/
|
|
846
|
-
interface VideoPart<TMetadata = unknown> {
|
|
847
|
-
type: 'video';
|
|
848
|
-
/** Source of the video content */
|
|
849
|
-
source: ContentPartSource;
|
|
2955
|
+
interface VideoPart<TMetadata = unknown> extends VideoPart$1 {
|
|
850
2956
|
/** Provider-specific metadata (e.g., duration, resolution) */
|
|
851
2957
|
metadata?: TMetadata;
|
|
852
2958
|
}
|
|
853
2959
|
/**
|
|
854
|
-
* Document content part for multimodal messages (e.g., PDFs).
|
|
2960
|
+
* Document content part for multimodal messages (e.g., PDFs). AG-UI `DocumentPart` with typed metadata.
|
|
855
2961
|
* @template TMetadata - Provider-specific metadata type (e.g., Anthropic's media_type)
|
|
856
2962
|
*/
|
|
857
|
-
interface DocumentPart<TMetadata = unknown> {
|
|
858
|
-
type: 'document';
|
|
859
|
-
/** Source of the document content */
|
|
860
|
-
source: ContentPartSource;
|
|
2963
|
+
interface DocumentPart<TMetadata = unknown> extends DocumentPart$1 {
|
|
861
2964
|
/** Provider-specific metadata (e.g., media_type for PDFs) */
|
|
862
2965
|
metadata?: TMetadata;
|
|
863
2966
|
}
|
|
@@ -879,6 +2982,10 @@ interface ModelMessage<TContent extends string | null | Array<ContentPart> = str
|
|
|
879
2982
|
content: string;
|
|
880
2983
|
signature?: string;
|
|
881
2984
|
}>;
|
|
2985
|
+
/** Error reported by an AG-UI tool message. */
|
|
2986
|
+
error?: string;
|
|
2987
|
+
/** Optional AG-UI message metadata. TanStack-owned fields live under `tanstack`. */
|
|
2988
|
+
metadata?: Record<string, any>;
|
|
882
2989
|
/**
|
|
883
2990
|
* Completed structured output represented by this assistant message.
|
|
884
2991
|
* `content` remains the provider-facing JSON text; this field preserves the
|
|
@@ -939,10 +3046,16 @@ interface ToolCallPart$2<TMetadata = unknown> {
|
|
|
939
3046
|
}
|
|
940
3047
|
interface ToolResultPart$1 {
|
|
941
3048
|
type: 'tool-result';
|
|
3049
|
+
id?: string;
|
|
3050
|
+
name?: string;
|
|
942
3051
|
toolCallId: string;
|
|
943
3052
|
content: string | Array<ContentPart>;
|
|
944
3053
|
state: ToolResultState$1;
|
|
3054
|
+
/** Set when the user or middleware cancelled or denied the tool call; state remains `error`. */
|
|
3055
|
+
outcome?: ToolResultOutcome;
|
|
945
3056
|
error?: string;
|
|
3057
|
+
metadata?: Record<string, unknown>;
|
|
3058
|
+
createdAt?: Date;
|
|
946
3059
|
}
|
|
947
3060
|
interface ThinkingPart$1 {
|
|
948
3061
|
type: 'thinking';
|
|
@@ -979,6 +3092,28 @@ interface StructuredOutputPart<TData = unknown> {
|
|
|
979
3092
|
/** Populated when `status === 'error'`. */
|
|
980
3093
|
errorMessage?: string;
|
|
981
3094
|
}
|
|
3095
|
+
type SubagentStatus = 'running' | 'finished' | 'error' | 'suspended';
|
|
3096
|
+
/**
|
|
3097
|
+
* One child invocation as the client sees it. AG-UI `SubagentInfo` names the
|
|
3098
|
+
* child; the other AG-UI fields come from its `SUBAGENT_STARTED`,
|
|
3099
|
+
* `SUBAGENT_FINISHED` and `SUBAGENT_ERROR` events. `id` is the AG-UI
|
|
3100
|
+
* `subagentRunId`. `status`, `parentRunId` and `messages` are client state the
|
|
3101
|
+
* spec does not model.
|
|
3102
|
+
*/
|
|
3103
|
+
interface SubagentHandleData extends SubagentInfo, Pick<SubagentStartedEvent$1, 'parentSubagentRunId' | 'parentToolCallId' | 'metadata'> {
|
|
3104
|
+
id: SubagentRunId;
|
|
3105
|
+
status: SubagentStatus;
|
|
3106
|
+
/** The parent chat run that started this child. */
|
|
3107
|
+
parentRunId?: string;
|
|
3108
|
+
/** Interrupts this child raised, while `status` is `'suspended'`. */
|
|
3109
|
+
interruptIds?: SubagentFinishedSuspendedOutcome['interruptIds'];
|
|
3110
|
+
messages: Array<UIMessage$1>;
|
|
3111
|
+
error?: Pick<SubagentErrorEvent$1, 'message' | 'code'>;
|
|
3112
|
+
}
|
|
3113
|
+
interface SubagentPart$1 {
|
|
3114
|
+
type: 'subagent';
|
|
3115
|
+
subagent: SubagentHandleData;
|
|
3116
|
+
}
|
|
982
3117
|
interface UIResourcePart {
|
|
983
3118
|
type: 'ui-resource';
|
|
984
3119
|
/** The ui:// resource object in MCP-native shape — fed straight to the renderer. */
|
|
@@ -1000,7 +3135,7 @@ interface UIResourcePart {
|
|
|
1000
3135
|
* Currently always `undefined` — nothing populates this field yet. */
|
|
1001
3136
|
meta?: Record<string, unknown>;
|
|
1002
3137
|
}
|
|
1003
|
-
type MessagePart$1<TData = unknown> = TextPart$1 | ImagePart | AudioPart | VideoPart | DocumentPart | ToolCallPart$2 | ToolResultPart$1 | ThinkingPart$1 | StructuredOutputPart<TData> | UIResourcePart;
|
|
3138
|
+
type MessagePart$1<TData = unknown> = TextPart$1 | ImagePart | AudioPart | VideoPart | DocumentPart | ToolCallPart$2 | ToolResultPart$1 | ThinkingPart$1 | StructuredOutputPart<TData> | UIResourcePart | SubagentPart$1;
|
|
1004
3139
|
/**
|
|
1005
3140
|
* Shape of `metadata.tanstack` on run events.
|
|
1006
3141
|
*/
|
|
@@ -1030,6 +3165,8 @@ interface UIMessage$1<TData = unknown> {
|
|
|
1030
3165
|
role: 'system' | 'user' | 'assistant';
|
|
1031
3166
|
parts: Array<MessagePart$1<TData>>;
|
|
1032
3167
|
createdAt?: Date;
|
|
3168
|
+
/** Optional AG-UI sender name. Converters preserve it across wire and persist. */
|
|
3169
|
+
name?: string;
|
|
1033
3170
|
/**
|
|
1034
3171
|
* Optional AG-UI metadata bag. TanStack writes the `tanstack` key.
|
|
1035
3172
|
* User keys stay at the top.
|
|
@@ -1054,6 +3191,32 @@ type RuntimeContextField<TContext> = IsUnknown$1<TContext> extends true ? {
|
|
|
1054
3191
|
*/
|
|
1055
3192
|
context: TContext;
|
|
1056
3193
|
};
|
|
3194
|
+
/**
|
|
3195
|
+
* Options for a single `emitCustomEvent` call, on both the tool-execution and
|
|
3196
|
+
* middleware contexts.
|
|
3197
|
+
*/
|
|
3198
|
+
interface EmitCustomEventOptions {
|
|
3199
|
+
/**
|
|
3200
|
+
* Keep this event in the durability batch with later chunks.
|
|
3201
|
+
* CUSTOM events flush as soon as they are emitted, so a progress
|
|
3202
|
+
* indicator can render at emit time. Pass `{ batch: true }` for a
|
|
3203
|
+
* high-volume stream that should share appends with later output.
|
|
3204
|
+
* `process.stdout`, `process.stderr`, `sandbox.file`, and
|
|
3205
|
+
* `sandbox.file.diff` already batch.
|
|
3206
|
+
*/
|
|
3207
|
+
batch?: boolean;
|
|
3208
|
+
}
|
|
3209
|
+
/**
|
|
3210
|
+
* The user's answer to an `mcp_input` interrupt.
|
|
3211
|
+
* `resolved` carries the `payload` from `resolveInterrupt`.
|
|
3212
|
+
* `cancelled` means the user called `cancel()`.
|
|
3213
|
+
*/
|
|
3214
|
+
type ToolInputResponse = {
|
|
3215
|
+
status: 'resolved';
|
|
3216
|
+
payload: unknown;
|
|
3217
|
+
} | {
|
|
3218
|
+
status: 'cancelled';
|
|
3219
|
+
};
|
|
1057
3220
|
/**
|
|
1058
3221
|
* Context passed to tool execute functions, providing capabilities like
|
|
1059
3222
|
* emitting custom events during execution.
|
|
@@ -1066,12 +3229,20 @@ type ToolExecutionContext<TContext = unknown> = RuntimeContextField<TContext> &
|
|
|
1066
3229
|
* e.g. MCP `callTool` — should forward this to cancel in-flight work.
|
|
1067
3230
|
*/
|
|
1068
3231
|
abortSignal?: AbortSignal;
|
|
3232
|
+
/**
|
|
3233
|
+
* The answer to the input request that this tool call raised in the
|
|
3234
|
+
* previous run. It is set only when the run resumes an `mcp_input`
|
|
3235
|
+
* interrupt for this tool call.
|
|
3236
|
+
*/
|
|
3237
|
+
inputResponse?: ToolInputResponse;
|
|
1069
3238
|
/**
|
|
1070
3239
|
* Emit a custom event during tool execution.
|
|
1071
3240
|
* Events are streamed to the client in real-time as AG-UI CUSTOM events.
|
|
1072
3241
|
*
|
|
1073
3242
|
* @param eventName - Name of the custom event
|
|
1074
3243
|
* @param value - Event payload value
|
|
3244
|
+
* @param options - Pass `{ batch: true }` to keep this event in the
|
|
3245
|
+
* durability batch instead of flushing it immediately
|
|
1075
3246
|
*
|
|
1076
3247
|
* @example
|
|
1077
3248
|
* ```ts
|
|
@@ -1084,7 +3255,7 @@ type ToolExecutionContext<TContext = unknown> = RuntimeContextField<TContext> &
|
|
|
1084
3255
|
* })
|
|
1085
3256
|
* ```
|
|
1086
3257
|
*/
|
|
1087
|
-
emitCustomEvent: (eventName: string, value: Record<string, any
|
|
3258
|
+
emitCustomEvent: (eventName: string, value: Record<string, any>, options?: EmitCustomEventOptions) => void;
|
|
1088
3259
|
};
|
|
1089
3260
|
type ToolExecuteFunction<TInput extends SchemaInput | undefined = SchemaInput, TOutput extends SchemaInput | undefined = SchemaInput, TContext = unknown> = undefined extends TContext ? (args: InferSchemaType<TInput>, context?: ToolExecutionContext<TContext>) => Promise<InferSchemaType<TOutput>> | InferSchemaType<TOutput> : (args: InferSchemaType<TInput>, context: ToolExecutionContext<TContext>) => Promise<InferSchemaType<TOutput>> | InferSchemaType<TOutput>;
|
|
1090
3261
|
/**
|
|
@@ -1223,7 +3394,7 @@ type RunAgentResumeItem = ResumeEntry & {
|
|
|
1223
3394
|
*/
|
|
1224
3395
|
interface RunFinishedEvent extends Pick<RunFinishedEvent$1, 'threadId' | 'runId' | 'result' | 'outcome' | 'timestamp' | 'rawEvent'> {
|
|
1225
3396
|
type: EventType.RUN_FINISHED;
|
|
1226
|
-
usage?: Array<
|
|
3397
|
+
usage?: Array<TokenUsage> | TokenUsage$1;
|
|
1227
3398
|
/** Restored on the client from `metadata.tanstack`. */
|
|
1228
3399
|
model?: string;
|
|
1229
3400
|
/** Restored on the client from `metadata.tanstack`. */
|
|
@@ -1241,7 +3412,7 @@ interface RunFinishedEvent extends Pick<RunFinishedEvent$1, 'threadId' | 'runId'
|
|
|
1241
3412
|
*/
|
|
1242
3413
|
interface RunErrorEvent extends Pick<RunErrorEvent$1, 'message' | 'code' | 'timestamp' | 'rawEvent'> {
|
|
1243
3414
|
type: EventType.RUN_ERROR;
|
|
1244
|
-
usage?: Array<
|
|
3415
|
+
usage?: Array<TokenUsage> | TokenUsage$1;
|
|
1245
3416
|
/** Restored on the client from `metadata.tanstack`. */
|
|
1246
3417
|
threadId?: string;
|
|
1247
3418
|
/** Restored on the client from `metadata.tanstack`. */
|
|
@@ -1278,13 +3449,10 @@ interface TextMessageEndEvent extends TextMessageEndEvent$1 {}
|
|
|
1278
3449
|
/**
|
|
1279
3450
|
* Emitted when a tool call starts.
|
|
1280
3451
|
*
|
|
1281
|
-
* @ag-ui/core provides: `toolCallId`, `toolCallName`, `parentMessageId
|
|
1282
|
-
*
|
|
1283
|
-
* Field shapes are taken from AG-UI via `Pick` (not `extends`) so Zod
|
|
1284
|
-
* `.passthrough()` index signatures do not pollute the StreamChunk
|
|
1285
|
-
* discriminated union — required for {@link KnownCustomEvent} narrowing.
|
|
3452
|
+
* @ag-ui/core provides: `toolCallId`, `toolCallName`, `parentMessageId?`,
|
|
3453
|
+
* `subagentRunId?`
|
|
1286
3454
|
*/
|
|
1287
|
-
interface ToolCallStartEvent extends
|
|
3455
|
+
interface ToolCallStartEvent extends Omit<ToolCallStartEvent$1, 'type'> {
|
|
1288
3456
|
type: 'TOOL_CALL_START';
|
|
1289
3457
|
/** Alias of `toolCallName`. Kept so existing stream readers still compile. */
|
|
1290
3458
|
toolName?: string;
|
|
@@ -1300,11 +3468,9 @@ interface ToolCallArgsEvent extends ToolCallArgsEvent$1 {}
|
|
|
1300
3468
|
/**
|
|
1301
3469
|
* Emitted when a tool call completes.
|
|
1302
3470
|
*
|
|
1303
|
-
* @ag-ui/core provides: `toolCallId`
|
|
1304
|
-
*
|
|
1305
|
-
* Same `Pick` (not `extends`) rationale as {@link ToolCallStartEvent}.
|
|
3471
|
+
* @ag-ui/core provides: `toolCallId`, `subagentRunId?`
|
|
1306
3472
|
*/
|
|
1307
|
-
interface ToolCallEndEvent extends
|
|
3473
|
+
interface ToolCallEndEvent extends Omit<ToolCallEndEvent$1, 'type'> {
|
|
1308
3474
|
type: 'TOOL_CALL_END';
|
|
1309
3475
|
/** Parsed tool arguments when the adapter already parsed them. */
|
|
1310
3476
|
input?: unknown;
|
|
@@ -1355,12 +3521,9 @@ interface StateDeltaEvent extends StateDeltaEvent$1 {}
|
|
|
1355
3521
|
/**
|
|
1356
3522
|
* Custom event for extensibility.
|
|
1357
3523
|
*
|
|
1358
|
-
* @ag-ui/core provides: `name`, `value`
|
|
1359
|
-
*
|
|
1360
|
-
* Uses `Pick` (not `extends`) so the Zod passthrough index signature does not
|
|
1361
|
-
* erase discriminant property access on {@link KnownCustomEvent} unions.
|
|
3524
|
+
* @ag-ui/core provides: `name`, `value`, `subagentRunId?`
|
|
1362
3525
|
*/
|
|
1363
|
-
interface CustomEvent extends
|
|
3526
|
+
interface CustomEvent extends Omit<CustomEvent$1, 'type'> {
|
|
1364
3527
|
type: 'CUSTOM';
|
|
1365
3528
|
metadata?: Record<string, any>;
|
|
1366
3529
|
}
|
|
@@ -1400,17 +3563,91 @@ interface ReasoningEndEvent extends ReasoningEndEvent$1 {}
|
|
|
1400
3563
|
* @ag-ui/core provides: `subtype`, `entityId`, `encryptedValue`
|
|
1401
3564
|
*/
|
|
1402
3565
|
interface ReasoningEncryptedValueEvent extends ReasoningEncryptedValueEvent$1 {}
|
|
3566
|
+
/** AG-UI 1.0 ActivitySnapshotEvent shape. */
|
|
3567
|
+
interface ActivitySnapshotEvent extends ActivitySnapshotEvent$1 {}
|
|
3568
|
+
/** AG-UI 1.0 ActivityDeltaEvent shape. */
|
|
3569
|
+
interface ActivityDeltaEvent extends ActivityDeltaEvent$1 {}
|
|
3570
|
+
/** AG-UI 1.0 RawEvent shape. */
|
|
3571
|
+
interface RawEvent extends RawEvent$1 {}
|
|
3572
|
+
/** AG-UI 1.0 TextMessageChunkEvent shape. */
|
|
3573
|
+
interface TextMessageChunkEvent extends TextMessageChunkEvent$1 {}
|
|
3574
|
+
/** AG-UI 1.0 ToolCallChunkEvent shape. */
|
|
3575
|
+
interface ToolCallChunkEvent extends ToolCallChunkEvent$1 {}
|
|
3576
|
+
/** AG-UI 1.0 ReasoningMessageChunkEvent shape. */
|
|
3577
|
+
interface ReasoningMessageChunkEvent extends ReasoningMessageChunkEvent$1 {}
|
|
1403
3578
|
/**
|
|
1404
3579
|
* Union of all AG-UI events.
|
|
1405
3580
|
*/
|
|
1406
|
-
type AGUIEvent = RunStartedEvent | RunFinishedEvent | RunErrorEvent | TextMessageStartEvent | TextMessageContentEvent | TextMessageEndEvent | ToolCallStartEvent | ToolCallArgsEvent | ToolCallEndEvent | ToolCallResultEvent | StepStartedEvent | StepFinishedEvent | MessagesSnapshotEvent | StateSnapshotEvent | StateDeltaEvent | CustomEvent | ReasoningStartEvent | ReasoningMessageStartEvent | ReasoningMessageContentEvent | ReasoningMessageEndEvent | ReasoningEndEvent | ReasoningEncryptedValueEvent;
|
|
3581
|
+
type AGUIEvent = ActivitySnapshotEvent | ActivityDeltaEvent | RawEvent | TextMessageChunkEvent | ToolCallChunkEvent | ReasoningMessageChunkEvent | RunStartedEvent | RunFinishedEvent | RunErrorEvent | TextMessageStartEvent | TextMessageContentEvent | TextMessageEndEvent | ToolCallStartEvent | ToolCallArgsEvent | ToolCallEndEvent | ToolCallResultEvent | StepStartedEvent | StepFinishedEvent | MessagesSnapshotEvent | StateSnapshotEvent | StateDeltaEvent | CustomEvent | ReasoningStartEvent | ReasoningMessageStartEvent | ReasoningMessageContentEvent | ReasoningMessageEndEvent | ReasoningEndEvent | ReasoningEncryptedValueEvent | SubagentStartedEvent | SubagentFinishedEvent | SubagentErrorEvent;
|
|
3582
|
+
/**
|
|
3583
|
+
* A child agent started. The later chunks for that child carry the same
|
|
3584
|
+
* `subagentRunId`.
|
|
3585
|
+
*
|
|
3586
|
+
* @ag-ui/core provides: `subagentRunId`, `name`, `description?`,
|
|
3587
|
+
* `parentSubagentRunId?`, `parentToolCallId?`, `parentMessageId?`, `metadata?`
|
|
3588
|
+
*/
|
|
3589
|
+
interface SubagentStartedEvent extends SubagentStartedEvent$1 {}
|
|
3590
|
+
/**
|
|
3591
|
+
* A child agent's segment of this run ended.
|
|
3592
|
+
*
|
|
3593
|
+
* @ag-ui/core provides: `subagentRunId`, `result?`, `outcome?`
|
|
3594
|
+
*/
|
|
3595
|
+
interface SubagentFinishedEvent extends SubagentFinishedEvent$1 {}
|
|
3596
|
+
/**
|
|
3597
|
+
* A child agent failed. The parent run can continue.
|
|
3598
|
+
*
|
|
3599
|
+
* @ag-ui/core provides: `subagentRunId`, `message`, `code?`
|
|
3600
|
+
*/
|
|
3601
|
+
interface SubagentErrorEvent extends SubagentErrorEvent$1 {}
|
|
1407
3602
|
/**
|
|
1408
3603
|
* Chunk returned by the SDK during streaming chat completions.
|
|
1409
3604
|
* Uses the AG-UI protocol event format.
|
|
1410
3605
|
*/
|
|
1411
3606
|
type StreamChunk = AGUIEvent;
|
|
1412
3607
|
//#endregion
|
|
1413
|
-
//#region node_modules/.deno/@tanstack+ai@0.
|
|
3608
|
+
//#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/interrupt-definition.d.ts
|
|
3609
|
+
type PortableSchema = StandardJSONSchemaV1<any, any> | StandardSchemaV1$1<any, any>;
|
|
3610
|
+
type InterruptInput<TPayloadSchema extends PortableSchema | undefined, TPayload = unknown> = {
|
|
3611
|
+
key: string;
|
|
3612
|
+
reason: string;
|
|
3613
|
+
message: string;
|
|
3614
|
+
expiresAt?: string;
|
|
3615
|
+
} & ([TPayloadSchema] extends [undefined] ? {} : {
|
|
3616
|
+
payload?: TPayload;
|
|
3617
|
+
});
|
|
3618
|
+
type GenericInterruptRequestBase<TDefinition extends InterruptDefinition<any, any, any, any>> = {
|
|
3619
|
+
readonly definition: TDefinition;
|
|
3620
|
+
readonly key: string;
|
|
3621
|
+
readonly reason: string;
|
|
3622
|
+
readonly message: string;
|
|
3623
|
+
readonly expiresAt?: string;
|
|
3624
|
+
};
|
|
3625
|
+
type GenericInterruptRequestFor<TDefinition extends InterruptDefinition<any, any, any, any>, TPayloadSchema extends PortableSchema | undefined, TPayload> = GenericInterruptRequestBase<TDefinition> & ([TPayloadSchema] extends [undefined] ? {} : {
|
|
3626
|
+
readonly payload: TPayload | undefined;
|
|
3627
|
+
});
|
|
3628
|
+
type InterruptInputKey = 'key' | 'reason' | 'message' | 'expiresAt' | 'payload';
|
|
3629
|
+
type RejectUnexpectedInputKeys<TInput> = Exclude<keyof TInput, InterruptInputKey> extends never ? unknown : { [K in Exclude<keyof TInput, InterruptInputKey>]: never };
|
|
3630
|
+
type RejectUnexpectedPayload<TInput> = 'payload' extends keyof TInput ? {
|
|
3631
|
+
payload: never;
|
|
3632
|
+
} : unknown;
|
|
3633
|
+
type ValidInterruptInput<TInput, TPayloadSchema extends PortableSchema | undefined, TPayload = unknown> = TInput extends InterruptInput<TPayloadSchema, TPayload> ? RejectUnexpectedInputKeys<TInput> & ([TPayloadSchema] extends [undefined] ? RejectUnexpectedPayload<TInput> : unknown) : never;
|
|
3634
|
+
/**
|
|
3635
|
+
* Extracting a class method preserves the intentional bivariant assignment
|
|
3636
|
+
* behavior of the public `interrupt` callback without exposing a method
|
|
3637
|
+
* signature in an interface.
|
|
3638
|
+
*/
|
|
3639
|
+
declare abstract class InterruptRequestMethodSignature<TId extends string, TPayloadSchema extends PortableSchema | undefined, TResponseSchema extends PortableSchema | undefined, TPayload, TPayloadInput> {
|
|
3640
|
+
abstract call<TInput>(input: TInput & ValidInterruptInput<TInput, TPayloadSchema, TPayloadInput>): GenericInterruptRequestFor<InterruptDefinition<TId, TPayloadSchema, TResponseSchema, TPayload, TPayloadInput>, TPayloadSchema, TPayload>;
|
|
3641
|
+
}
|
|
3642
|
+
type InterruptRequestMethod<TId extends string, TPayloadSchema extends PortableSchema | undefined, TResponseSchema extends PortableSchema | undefined, TPayload, TPayloadInput> = InterruptRequestMethodSignature<TId, TPayloadSchema, TResponseSchema, TPayload, TPayloadInput>['call'];
|
|
3643
|
+
interface InterruptDefinition<TId extends string, TPayloadSchema extends PortableSchema | undefined, TResponseSchema extends PortableSchema | undefined, TPayload = unknown, TPayloadInput = TPayload> {
|
|
3644
|
+
readonly id: TId;
|
|
3645
|
+
readonly payloadSchema: TPayloadSchema;
|
|
3646
|
+
readonly responseSchema: TResponseSchema;
|
|
3647
|
+
interrupt: InterruptRequestMethod<TId, TPayloadSchema, TResponseSchema, TPayload, TPayloadInput>;
|
|
3648
|
+
}
|
|
3649
|
+
//#endregion
|
|
3650
|
+
//#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/activities/chat/tools/tool-definition.d.ts
|
|
1414
3651
|
/**
|
|
1415
3652
|
* Type-level brand key for {@link ToolApprovalCapabilityMarker}. Only ever used
|
|
1416
3653
|
* in type positions, but it must stay exported: a `unique symbol` referenced by
|
|
@@ -1450,6 +3687,7 @@ interface ClientTool<TInput extends SchemaInput | undefined = undefined, TOutput
|
|
|
1450
3687
|
outputSchema?: TOutput;
|
|
1451
3688
|
needsApproval?: TNeedsApproval;
|
|
1452
3689
|
approvalSchema?: TApprovalSchema;
|
|
3690
|
+
execution?: 'task';
|
|
1453
3691
|
lazy?: boolean;
|
|
1454
3692
|
metadata?: Record<string, unknown>;
|
|
1455
3693
|
execute?: ToolExecuteFunction<TInput, TOutput, TContext>;
|
|
@@ -1463,6 +3701,7 @@ interface ToolDefinitionInstance<TInput extends SchemaInput | undefined = undefi
|
|
|
1463
3701
|
outputSchema: TOutput;
|
|
1464
3702
|
needsApproval?: TNeedsApproval;
|
|
1465
3703
|
approvalSchema: TApprovalSchema;
|
|
3704
|
+
execution?: 'task';
|
|
1466
3705
|
readonly [toolApprovalCapability]?: {
|
|
1467
3706
|
needsApproval: TNeedsApproval;
|
|
1468
3707
|
approvalSchema: TApprovalSchema;
|
|
@@ -1489,7 +3728,7 @@ type InferToolOutput<T> = T extends {
|
|
|
1489
3728
|
outputSchema?: infer TOutput;
|
|
1490
3729
|
} ? TOutput extends StandardJSONSchemaV1<any, any> ? InferSchemaType<TOutput> : TOutput extends StandardSchemaV1$1<any, any> ? InferSchemaType<TOutput> : TOutput extends JSONSchema ? unknown : InferSchemaType<TOutput> : unknown;
|
|
1491
3730
|
//#endregion
|
|
1492
|
-
//#region node_modules/.deno/@tanstack+ai@0.
|
|
3731
|
+
//#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/activities/chat/stream/types.d.ts
|
|
1493
3732
|
/**
|
|
1494
3733
|
* Strategy for determining when to emit text updates
|
|
1495
3734
|
*/
|
|
@@ -1507,56 +3746,34 @@ interface ChunkStrategy {
|
|
|
1507
3746
|
reset?: () => void;
|
|
1508
3747
|
}
|
|
1509
3748
|
//#endregion
|
|
1510
|
-
//#region node_modules/.deno/@tanstack+ai@0.
|
|
1511
|
-
type PortableSchema = StandardJSONSchemaV1<any, any> | StandardSchemaV1$1<any, any>;
|
|
1512
|
-
type InterruptInput<TPayloadSchema extends PortableSchema | undefined, TPayload = unknown> = {
|
|
1513
|
-
key: string;
|
|
1514
|
-
reason: string;
|
|
1515
|
-
message: string;
|
|
1516
|
-
expiresAt?: string;
|
|
1517
|
-
} & ([TPayloadSchema] extends [undefined] ? {} : {
|
|
1518
|
-
payload?: TPayload;
|
|
1519
|
-
});
|
|
1520
|
-
type GenericInterruptRequestBase<TDefinition extends InterruptDefinition<any, any, any, any>> = {
|
|
1521
|
-
readonly definition: TDefinition;
|
|
1522
|
-
readonly key: string;
|
|
1523
|
-
readonly reason: string;
|
|
1524
|
-
readonly message: string;
|
|
1525
|
-
readonly expiresAt?: string;
|
|
1526
|
-
};
|
|
1527
|
-
type GenericInterruptRequestFor<TDefinition extends InterruptDefinition<any, any, any, any>, TPayloadSchema extends PortableSchema | undefined, TPayload> = GenericInterruptRequestBase<TDefinition> & ([TPayloadSchema] extends [undefined] ? {} : {
|
|
1528
|
-
readonly payload: TPayload | undefined;
|
|
1529
|
-
});
|
|
1530
|
-
type InterruptInputKey = 'key' | 'reason' | 'message' | 'expiresAt' | 'payload';
|
|
1531
|
-
type RejectUnexpectedInputKeys<TInput> = Exclude<keyof TInput, InterruptInputKey> extends never ? unknown : { [K in Exclude<keyof TInput, InterruptInputKey>]: never };
|
|
1532
|
-
type RejectUnexpectedPayload<TInput> = 'payload' extends keyof TInput ? {
|
|
1533
|
-
payload: never;
|
|
1534
|
-
} : unknown;
|
|
1535
|
-
type ValidInterruptInput<TInput, TPayloadSchema extends PortableSchema | undefined, TPayload = unknown> = TInput extends InterruptInput<TPayloadSchema, TPayload> ? RejectUnexpectedInputKeys<TInput> & ([TPayloadSchema] extends [undefined] ? RejectUnexpectedPayload<TInput> : unknown) : never;
|
|
1536
|
-
/**
|
|
1537
|
-
* Extracting a class method preserves the intentional bivariant assignment
|
|
1538
|
-
* behavior of the public `interrupt` callback without exposing a method
|
|
1539
|
-
* signature in an interface.
|
|
1540
|
-
*/
|
|
1541
|
-
declare abstract class InterruptRequestMethodSignature<TId extends string, TPayloadSchema extends PortableSchema | undefined, TResponseSchema extends PortableSchema | undefined, TPayload, TPayloadInput> {
|
|
1542
|
-
abstract call<TInput>(input: TInput & ValidInterruptInput<TInput, TPayloadSchema, TPayloadInput>): GenericInterruptRequestFor<InterruptDefinition<TId, TPayloadSchema, TResponseSchema, TPayload, TPayloadInput>, TPayloadSchema, TPayload>;
|
|
1543
|
-
}
|
|
1544
|
-
type InterruptRequestMethod<TId extends string, TPayloadSchema extends PortableSchema | undefined, TResponseSchema extends PortableSchema | undefined, TPayload, TPayloadInput> = InterruptRequestMethodSignature<TId, TPayloadSchema, TResponseSchema, TPayload, TPayloadInput>['call'];
|
|
1545
|
-
interface InterruptDefinition<TId extends string, TPayloadSchema extends PortableSchema | undefined, TResponseSchema extends PortableSchema | undefined, TPayload = unknown, TPayloadInput = TPayload> {
|
|
1546
|
-
readonly id: TId;
|
|
1547
|
-
readonly payloadSchema: TPayloadSchema;
|
|
1548
|
-
readonly responseSchema: TResponseSchema;
|
|
1549
|
-
interrupt: InterruptRequestMethod<TId, TPayloadSchema, TResponseSchema, TPayload, TPayloadInput>;
|
|
1550
|
-
}
|
|
1551
|
-
//#endregion
|
|
1552
|
-
//#region node_modules/.deno/@tanstack+ai@0.49.1/node_modules/@tanstack/ai/dist/esm/byok/providers.d.ts
|
|
3749
|
+
//#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/byok/providers.d.ts
|
|
1553
3750
|
/**
|
|
1554
3751
|
* Provider ids are open slugs, not a closed catalog. `@tanstack/ai` does not
|
|
1555
3752
|
* list adapters. Any matching string is a valid id and becomes `x-byok-<id>`.
|
|
1556
3753
|
*/
|
|
1557
3754
|
type ProviderId = string;
|
|
1558
3755
|
//#endregion
|
|
1559
|
-
//#region node_modules/.deno/@tanstack+ai
|
|
3756
|
+
//#region node_modules/.deno/@tanstack+ai@0.63.0/node_modules/@tanstack/ai/dist/esm/byok/define-provider.d.ts
|
|
3757
|
+
/**
|
|
3758
|
+
* A BYOK provider declared by an adapter. `id` is the `x-byok-<id>` slug and
|
|
3759
|
+
* is required — `{ id?: string }` is not a {@link ByokProvider}.
|
|
3760
|
+
*/
|
|
3761
|
+
interface ByokProvider<TId extends string = string> {
|
|
3762
|
+
readonly id: TId;
|
|
3763
|
+
readonly label: string;
|
|
3764
|
+
/**
|
|
3765
|
+
* Env var names the relay may read. Names only — never put `process.env`
|
|
3766
|
+
* values here. This object is imported on the client.
|
|
3767
|
+
*/
|
|
3768
|
+
readonly env?: ReadonlyArray<string>;
|
|
3769
|
+
/**
|
|
3770
|
+
* Other descriptors this credential needs. A send for this provider also
|
|
3771
|
+
* carries their headers and prompts for each one that is missing.
|
|
3772
|
+
*/
|
|
3773
|
+
readonly with?: ReadonlyArray<ByokProvider>;
|
|
3774
|
+
}
|
|
3775
|
+
//#endregion
|
|
3776
|
+
//#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/byok/storage.d.ts
|
|
1560
3777
|
type Keyring = Partial<Record<ProviderId, string>>;
|
|
1561
3778
|
type KeyPreview = Partial<Record<ProviderId, string>>;
|
|
1562
3779
|
interface KeyringStorage {
|
|
@@ -1571,7 +3788,7 @@ interface KeyringStorage {
|
|
|
1571
3788
|
clear: () => void | Promise<void>;
|
|
1572
3789
|
}
|
|
1573
3790
|
//#endregion
|
|
1574
|
-
//#region node_modules/.deno/@tanstack+ai-client@0.
|
|
3791
|
+
//#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/byok/client.d.ts
|
|
1575
3792
|
type KeyStatus = {
|
|
1576
3793
|
state: 'empty';
|
|
1577
3794
|
} | {
|
|
@@ -1597,6 +3814,11 @@ type ByokSnapshot = {
|
|
|
1597
3814
|
};
|
|
1598
3815
|
interface DefineByokOptions {
|
|
1599
3816
|
storage?: KeyringStorage;
|
|
3817
|
+
/**
|
|
3818
|
+
* Descriptors whose `with` companions the store expands: `headers()` and
|
|
3819
|
+
* `prepare()` for such a provider cover its companions too.
|
|
3820
|
+
*/
|
|
3821
|
+
providers?: ReadonlyArray<ByokProvider>;
|
|
1600
3822
|
}
|
|
1601
3823
|
declare class ByokClient {
|
|
1602
3824
|
#private;
|
|
@@ -1621,7 +3843,7 @@ declare class ByokClient {
|
|
|
1621
3843
|
unlock(): Promise<void>;
|
|
1622
3844
|
}
|
|
1623
3845
|
//#endregion
|
|
1624
|
-
//#region node_modules/.deno/@tanstack+ai-client@0.
|
|
3846
|
+
//#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/events.d.ts
|
|
1625
3847
|
interface ChatClientRunEventContext {
|
|
1626
3848
|
threadId: string;
|
|
1627
3849
|
runId: string;
|
|
@@ -1741,7 +3963,7 @@ declare abstract class ChatClientEventEmitter {
|
|
|
1741
3963
|
toolFixtureApplied(fixture: ChatClientToolFixtureAppliedEvent): void;
|
|
1742
3964
|
}
|
|
1743
3965
|
//#endregion
|
|
1744
|
-
//#region node_modules/.deno/@tanstack+ai-client@0.
|
|
3966
|
+
//#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/devtools.d.ts
|
|
1745
3967
|
interface AIDevtoolsDisplayOptions {
|
|
1746
3968
|
name?: string;
|
|
1747
3969
|
}
|
|
@@ -1821,7 +4043,7 @@ declare class ClientDevtoolsBridge<TSnapshot extends object> {
|
|
|
1821
4043
|
protected onReplayState(): void;
|
|
1822
4044
|
private handleToolFixtureApply;
|
|
1823
4045
|
private matchesFixtureTarget;
|
|
1824
|
-
protected createEnvelope(eventType: 'hook:registered' | 'hook:updated' | 'hook:unregistered' | 'hook:state-snapshot' | 'tools:registered' | 'memory:retrieve:started' | 'memory:retrieve:completed' | 'memory:snapshot' | AIDevtoolsRunEventType, visibility?: AIDevtoolsEventVisibility, context?: {
|
|
4046
|
+
protected createEnvelope(eventType: 'hook:registered' | 'hook:updated' | 'hook:unregistered' | 'hook:state-snapshot' | 'tools:registered' | 'memory:retrieve:started' | 'memory:retrieve:completed' | 'memory:snapshot' | 'compaction:started' | 'compaction:state' | 'compaction:ended' | 'skills:snapshot' | AIDevtoolsRunEventType, visibility?: AIDevtoolsEventVisibility, context?: {
|
|
1825
4047
|
runId?: string;
|
|
1826
4048
|
}): AIDevtoolsEventEnvelope;
|
|
1827
4049
|
private createMetadataPayload;
|
|
@@ -1842,6 +4064,10 @@ declare class ChatDevtoolsBridge extends ClientDevtoolsBridge<AIDevtoolsChatSnap
|
|
|
1842
4064
|
private lastRunEventContext;
|
|
1843
4065
|
/** Last transported `memory:state` value, replayed when a panel opens. */
|
|
1844
4066
|
private lastMemoryStateValue;
|
|
4067
|
+
/** Transported compaction CUSTOM events, replayed when a panel opens. */
|
|
4068
|
+
private readonly lastCompactionEvents;
|
|
4069
|
+
/** Last transported `skills:state` value, replayed when a panel opens. */
|
|
4070
|
+
private lastSkillsStateValue;
|
|
1845
4071
|
constructor(options: ChatDevtoolsBridgeOptions);
|
|
1846
4072
|
setCurrentStreamId(streamId: string | null): void;
|
|
1847
4073
|
/**
|
|
@@ -1867,6 +4093,7 @@ declare class ChatDevtoolsBridge extends ClientDevtoolsBridge<AIDevtoolsChatSnap
|
|
|
1867
4093
|
* `recordResultChange` / `recordProgressChange`.
|
|
1868
4094
|
*/
|
|
1869
4095
|
recordMemoryState(rawValue: unknown): void;
|
|
4096
|
+
recordSkillsState(rawValue: unknown): void;
|
|
1870
4097
|
/**
|
|
1871
4098
|
* Re-emit the browser-side `memory:*` events from a transported
|
|
1872
4099
|
* `memory:state` value. The devtools store consumes these to render the
|
|
@@ -1875,6 +4102,15 @@ declare class ChatDevtoolsBridge extends ClientDevtoolsBridge<AIDevtoolsChatSnap
|
|
|
1875
4102
|
* adapter supports introspection.
|
|
1876
4103
|
*/
|
|
1877
4104
|
private emitMemoryState;
|
|
4105
|
+
/**
|
|
4106
|
+
* Record a transported compaction CUSTOM event. Called from the chat
|
|
4107
|
+
* client's `onCustomEvent` handler so server-side compaction reaches the
|
|
4108
|
+
* browser DevTools panel.
|
|
4109
|
+
*/
|
|
4110
|
+
recordCompactionEvent(eventType: string, rawValue: unknown): void;
|
|
4111
|
+
recordCompactionState(rawValue: unknown): void;
|
|
4112
|
+
private emitCompactionEvent;
|
|
4113
|
+
private emitSkillsState;
|
|
1878
4114
|
protected onReplayState(): void;
|
|
1879
4115
|
getCurrentRunEventContext(): ChatClientRunEventContext | undefined;
|
|
1880
4116
|
getCurrentOrLastRunEventContext(): ChatClientRunEventContext | undefined;
|
|
@@ -1895,10 +4131,10 @@ declare class ChatDevtoolsBridge extends ClientDevtoolsBridge<AIDevtoolsChatSnap
|
|
|
1895
4131
|
private findClientTool;
|
|
1896
4132
|
}
|
|
1897
4133
|
//#endregion
|
|
1898
|
-
//#region node_modules/.deno/@tanstack+ai-client@0.
|
|
4134
|
+
//#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/devtools-noop.d.ts
|
|
1899
4135
|
type ChatDevtoolsBridgeFactory = (options: ChatDevtoolsBridgeOptions) => ChatDevtoolsBridge;
|
|
1900
4136
|
//#endregion
|
|
1901
|
-
//#region node_modules/.deno/@tanstack+ai-client@0.
|
|
4137
|
+
//#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/types.d.ts
|
|
1902
4138
|
interface ChatResumeState {
|
|
1903
4139
|
threadId: string;
|
|
1904
4140
|
runId: string;
|
|
@@ -2228,6 +4464,21 @@ interface TextPart {
|
|
|
2228
4464
|
type: 'text';
|
|
2229
4465
|
content: string;
|
|
2230
4466
|
}
|
|
4467
|
+
/**
|
|
4468
|
+
* Tool-call part for a bare `{ name }` tool, such as a server tool
|
|
4469
|
+
* definition a subagent carries. No `approval` field.
|
|
4470
|
+
*/
|
|
4471
|
+
type ToolCallPartForNamedTool<T extends {
|
|
4472
|
+
name: string;
|
|
4473
|
+
}> = {
|
|
4474
|
+
type: 'tool-call';
|
|
4475
|
+
id: string;
|
|
4476
|
+
name: T['name'];
|
|
4477
|
+
arguments: string;
|
|
4478
|
+
input?: InferToolInput<T>;
|
|
4479
|
+
state: ToolCallState;
|
|
4480
|
+
output?: InferToolOutput<T>;
|
|
4481
|
+
};
|
|
2231
4482
|
/**
|
|
2232
4483
|
* Helper type that creates a tool-call part for a specific tool.
|
|
2233
4484
|
* This is a conditional type to enable proper distribution over union types,
|
|
@@ -2255,7 +4506,9 @@ type ToolCallPartForTool<T> = T extends AnyClientTool ? {
|
|
|
2255
4506
|
needsApproval: boolean;
|
|
2256
4507
|
approved?: boolean;
|
|
2257
4508
|
};
|
|
2258
|
-
} : unknown) :
|
|
4509
|
+
} : unknown) : T extends {
|
|
4510
|
+
name: string;
|
|
4511
|
+
} ? ToolCallPartForNamedTool<T> : never;
|
|
2259
4512
|
/**
|
|
2260
4513
|
* Fallback tool-call part type when tools are not typed
|
|
2261
4514
|
*/
|
|
@@ -2285,19 +4538,75 @@ type UntypedToolCallPart = {
|
|
|
2285
4538
|
* }
|
|
2286
4539
|
* ```
|
|
2287
4540
|
*/
|
|
2288
|
-
type ToolCallPart$1<TTools extends ReadonlyArray<
|
|
4541
|
+
type ToolCallPart$1<TTools extends ReadonlyArray<{
|
|
4542
|
+
name: string;
|
|
4543
|
+
}> = any> = [TTools] extends [never] ? UntypedToolCallPart : unknown extends TTools ? UntypedToolCallPart : TTools extends ReadonlyArray<infer Tool> ? Tool extends {
|
|
4544
|
+
name: string;
|
|
4545
|
+
} ? ToolCallPartForTool<Tool> : UntypedToolCallPart : UntypedToolCallPart;
|
|
2289
4546
|
interface ToolResultPart {
|
|
2290
4547
|
type: 'tool-result';
|
|
4548
|
+
id?: string;
|
|
4549
|
+
name?: string;
|
|
2291
4550
|
toolCallId: string;
|
|
2292
4551
|
content: string | Array<ContentPart>;
|
|
2293
4552
|
state: ToolResultState;
|
|
4553
|
+
/** Set when the user or middleware cancelled or denied the tool call; state remains `error`. */
|
|
4554
|
+
outcome?: ToolResultOutcome;
|
|
2294
4555
|
error?: string;
|
|
4556
|
+
metadata?: Record<string, unknown>;
|
|
4557
|
+
createdAt?: Date;
|
|
2295
4558
|
}
|
|
2296
4559
|
interface ThinkingPart {
|
|
2297
4560
|
type: 'thinking';
|
|
2298
4561
|
content: string;
|
|
2299
4562
|
}
|
|
2300
|
-
|
|
4563
|
+
interface SubagentHandle extends SubagentHandleData {
|
|
4564
|
+
/**
|
|
4565
|
+
* Set by ChatClient on every card it holds, streamed, restored, or initial,
|
|
4566
|
+
* nested cards included. Calling it marks the card `error` (`Stopped`),
|
|
4567
|
+
* ignores that child's later chunks until the same child starts again, and
|
|
4568
|
+
* aborts the local request, parent stream included. A durable server run
|
|
4569
|
+
* keeps going.
|
|
4570
|
+
*/
|
|
4571
|
+
stop?: () => void;
|
|
4572
|
+
}
|
|
4573
|
+
interface SubagentPart {
|
|
4574
|
+
type: 'subagent';
|
|
4575
|
+
subagent: SubagentHandle;
|
|
4576
|
+
}
|
|
4577
|
+
/**
|
|
4578
|
+
* The slice of a server `defineAgent` result that the client reads for types.
|
|
4579
|
+
* The client does not call `run`. Put tool definitions (from
|
|
4580
|
+
* `toolDefinition`) in `tools` to type the child's tool calls and approvals.
|
|
4581
|
+
*/
|
|
4582
|
+
type SubagentClientAgent = {
|
|
4583
|
+
name: string;
|
|
4584
|
+
description?: string;
|
|
4585
|
+
tools?: ReadonlyArray<{
|
|
4586
|
+
name: string;
|
|
4587
|
+
}>;
|
|
4588
|
+
interrupts?: ReadonlyArray<InterruptDefinition<any, any, any, any>>;
|
|
4589
|
+
outputSchema?: SchemaInput;
|
|
4590
|
+
};
|
|
4591
|
+
type AgentToolList<TAgent> = TAgent extends {
|
|
4592
|
+
tools?: infer TTools;
|
|
4593
|
+
} ? [undefined] extends [TTools] ? [TTools] extends [undefined] ? any : Exclude<TTools, undefined> extends ReadonlyArray<infer TTool> ? [TTool] extends [never] ? any : Exclude<TTools, undefined> : any : TTools extends ReadonlyArray<infer TTool> ? [TTool] extends [never] ? any : TTools : any : any;
|
|
4594
|
+
type AgentOutputData<TAgent> = TAgent extends {
|
|
4595
|
+
outputSchema?: infer TSchema;
|
|
4596
|
+
} ? Exclude<TSchema, undefined> extends SchemaInput ? [Exclude<TSchema, undefined>] extends [never] ? unknown : InferSchemaType<Exclude<TSchema, undefined>> : unknown : unknown;
|
|
4597
|
+
/** One child handle. `name` is the discriminant. */
|
|
4598
|
+
type SubagentHandleOf<TAgent extends SubagentClientAgent> = Omit<SubagentHandle, 'name' | 'messages'> & {
|
|
4599
|
+
name: TAgent['name'];
|
|
4600
|
+
messages: Array<UIMessage<AgentToolList<TAgent>, AgentOutputData<TAgent>>>;
|
|
4601
|
+
};
|
|
4602
|
+
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;
|
|
4603
|
+
type SubagentPartOf<TAgents extends ReadonlyArray<SubagentClientAgent> | undefined> = [TAgents] extends [undefined] ? SubagentPart : unknown extends TAgents ? SubagentPart : {
|
|
4604
|
+
type: 'subagent';
|
|
4605
|
+
subagent: SubagentHandles<TAgents>;
|
|
4606
|
+
};
|
|
4607
|
+
type MessagePart<TTools extends ReadonlyArray<{
|
|
4608
|
+
name: string;
|
|
4609
|
+
}> = any, TData = unknown, TSubagents extends ReadonlyArray<SubagentClientAgent> | undefined = undefined> = TextPart | ImagePart | AudioPart | VideoPart | DocumentPart | ToolCallPart$1<TTools> | ToolResultPart | ThinkingPart | StructuredOutputPart<TData> | UIResourcePart | SubagentPartOf<TSubagents>;
|
|
2301
4610
|
/**
|
|
2302
4611
|
* UIMessage - Domain-specific message format optimized for building chat UIs
|
|
2303
4612
|
* Contains parts that can be text, tool calls, or tool results.
|
|
@@ -2310,10 +4619,13 @@ type MessagePart<TTools extends ReadonlyArray<AnyClientTool> = any, TData = unkn
|
|
|
2310
4619
|
* the public return so `m.parts.find(p => p.type === 'structured-output').data`
|
|
2311
4620
|
* is typed without manual casts.
|
|
2312
4621
|
*/
|
|
2313
|
-
interface UIMessage<TTools extends ReadonlyArray<
|
|
4622
|
+
interface UIMessage<TTools extends ReadonlyArray<{
|
|
4623
|
+
name: string;
|
|
4624
|
+
}> = any, TData = unknown, TSubagents extends ReadonlyArray<SubagentClientAgent> | undefined = undefined> {
|
|
2314
4625
|
id: string;
|
|
2315
4626
|
role: 'system' | 'user' | 'assistant';
|
|
2316
|
-
|
|
4627
|
+
name?: string;
|
|
4628
|
+
parts: Array<MessagePart<TTools, TData, TSubagents>>;
|
|
2317
4629
|
createdAt?: Date;
|
|
2318
4630
|
/**
|
|
2319
4631
|
* Optional AG-UI metadata bag. TanStack writes the `tanstack` key.
|
|
@@ -2365,12 +4677,21 @@ interface ChatClientPersistence<TTools extends ReadonlyArray<AnyClientTool> = an
|
|
|
2365
4677
|
type ChatPersistenceOptions<TTools extends ReadonlyArray<AnyClientTool> = any> = {
|
|
2366
4678
|
persistence: true;
|
|
2367
4679
|
threadId: string;
|
|
4680
|
+
/**
|
|
4681
|
+
* Newest-window size for server hydrate. Only with `persistence: true`.
|
|
4682
|
+
* Without this, hydrate still loads the full thread.
|
|
4683
|
+
*/
|
|
4684
|
+
history?: {
|
|
4685
|
+
pageSize: number;
|
|
4686
|
+
};
|
|
2368
4687
|
} | {
|
|
2369
4688
|
persistence: ChatClientPersistence<TTools>;
|
|
2370
4689
|
threadId: string;
|
|
4690
|
+
history?: never;
|
|
2371
4691
|
} | {
|
|
2372
4692
|
persistence?: false | undefined;
|
|
2373
4693
|
threadId?: string;
|
|
4694
|
+
history?: never;
|
|
2374
4695
|
};
|
|
2375
4696
|
type IsUnknown<T> = unknown extends T ? [T] extends [unknown] ? true : false : false;
|
|
2376
4697
|
type KnownContext<T> = IsUnknown<T> extends true ? never : T;
|
|
@@ -2433,6 +4754,13 @@ interface ChatClientBaseOptions<TTools extends ReadonlyArray<AnyClientTool> = an
|
|
|
2433
4754
|
* provider and stamps `x-byok-*` request headers. Keys never go in the body.
|
|
2434
4755
|
*/
|
|
2435
4756
|
byok?: ByokClient;
|
|
4757
|
+
/**
|
|
4758
|
+
* The agents you pass to `chat({ subagents: { agents } })`, for types only.
|
|
4759
|
+
* The client does not call `run`. `createChatHook` from
|
|
4760
|
+
* `@tanstack/ai-react/ui` requires a `subagentsComponents` entry for every
|
|
4761
|
+
* agent name.
|
|
4762
|
+
*/
|
|
4763
|
+
subagents?: ReadonlyArray<SubagentClientAgent>;
|
|
2436
4764
|
/**
|
|
2437
4765
|
* Optional provider id for this chat. If it returns a provider slug,
|
|
2438
4766
|
* only that key is prepared and sent. Otherwise the merged `provider`
|
|
@@ -2577,7 +4905,7 @@ interface ChatClientBaseOptions<TTools extends ReadonlyArray<AnyClientTool> = an
|
|
|
2577
4905
|
*/
|
|
2578
4906
|
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>;
|
|
2579
4907
|
//#endregion
|
|
2580
|
-
//#region node_modules/.deno/@tanstack+ai-client@0.
|
|
4908
|
+
//#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/connection-adapters.d.ts
|
|
2581
4909
|
/**
|
|
2582
4910
|
* Per-send context provided by the chat client to the connection adapter.
|
|
2583
4911
|
* The adapter combines this with serialized messages to build a full
|
|
@@ -2633,7 +4961,7 @@ interface ConnectConnectionAdapter {
|
|
|
2633
4961
|
* `fetchServerSentEvents` / `fetchHttpStream`, and on `stream()` /
|
|
2634
4962
|
* `rpcStream()` when supplied via {@link StreamConnectionHandlers}.
|
|
2635
4963
|
*/
|
|
2636
|
-
hydrate?: (threadId: string) => Promise<ChatHydrationResult>;
|
|
4964
|
+
hydrate?: (threadId: string, options?: ChatHydrateOptions) => Promise<ChatHydrationResult>;
|
|
2637
4965
|
}
|
|
2638
4966
|
/**
|
|
2639
4967
|
* Server-resolved hydration for a generation thread. `resumeSnapshot` is the
|
|
@@ -2669,11 +4997,22 @@ interface GenerationHydrationResult {
|
|
|
2669
4997
|
runId: string;
|
|
2670
4998
|
} | null;
|
|
2671
4999
|
}
|
|
5000
|
+
/**
|
|
5001
|
+
* Optional paging for a chat hydrate GET.
|
|
5002
|
+
* Omit both fields to load the full thread.
|
|
5003
|
+
*/
|
|
5004
|
+
interface ChatHydrateOptions {
|
|
5005
|
+
limit?: number;
|
|
5006
|
+
before?: string;
|
|
5007
|
+
}
|
|
2672
5008
|
/**
|
|
2673
5009
|
* Server-resolved hydration for a thread. `messages` is the stored transcript;
|
|
2674
5010
|
* `activeRun` is a cursor to a run still generating for the thread (or `null`).
|
|
2675
5011
|
* Keyed on the STABLE thread id — the client never handles a run id, so a turn
|
|
2676
5012
|
* that spans several runs (interrupt/tool continuations) reconnects correctly.
|
|
5013
|
+
*
|
|
5014
|
+
* `page` is additive. Old servers omit it; treat that as a full list
|
|
5015
|
+
* (`truncated: false`).
|
|
2677
5016
|
*/
|
|
2678
5017
|
interface ChatHydrationResult {
|
|
2679
5018
|
messages: Array<UIMessage$1>;
|
|
@@ -2689,6 +5028,16 @@ interface ChatHydrationResult {
|
|
|
2689
5028
|
runId: string;
|
|
2690
5029
|
pending: Array<ChatPendingInterrupt>;
|
|
2691
5030
|
} | null;
|
|
5031
|
+
/**
|
|
5032
|
+
* Whether this window is a slice of a longer thread.
|
|
5033
|
+
* `cursor` is set when `truncated` is true and is sent back as `before`.
|
|
5034
|
+
*/
|
|
5035
|
+
page?: {
|
|
5036
|
+
truncated: false;
|
|
5037
|
+
} | {
|
|
5038
|
+
truncated: true;
|
|
5039
|
+
cursor: string;
|
|
5040
|
+
};
|
|
2692
5041
|
}
|
|
2693
5042
|
interface SubscribeConnectionAdapter {
|
|
2694
5043
|
/**
|
|
@@ -2711,7 +5060,7 @@ interface SubscribeConnectionAdapter {
|
|
|
2711
5060
|
* cursor). Present only when the underlying connection supports it. The client
|
|
2712
5061
|
* calls it on mount to re-hydrate without any app-side loader or prop.
|
|
2713
5062
|
*/
|
|
2714
|
-
hydrate?: (threadId: string) => Promise<ChatHydrationResult>;
|
|
5063
|
+
hydrate?: (threadId: string, options?: ChatHydrateOptions) => Promise<ChatHydrationResult>;
|
|
2715
5064
|
}
|
|
2716
5065
|
/**
|
|
2717
5066
|
* Connection adapter union.
|
|
@@ -2719,7 +5068,7 @@ interface SubscribeConnectionAdapter {
|
|
|
2719
5068
|
*/
|
|
2720
5069
|
type ConnectionAdapter = ConnectConnectionAdapter | SubscribeConnectionAdapter;
|
|
2721
5070
|
//#endregion
|
|
2722
|
-
//#region node_modules/.deno/@tanstack+ai-client@0.
|
|
5071
|
+
//#region node_modules/.deno/@tanstack+ai-client@0.36.0/node_modules/@tanstack/ai-client/dist/esm/chat-client.d.ts
|
|
2723
5072
|
type ChatClientUpdateOptionsWithoutContext<TTools extends ReadonlyArray<AnyClientTool>, TInterrupts extends ReadonlyArray<InterruptDefinition<any, any, any, any>> = readonly []> = {
|
|
2724
5073
|
connection?: ConnectionAdapter;
|
|
2725
5074
|
fetcher?: ChatFetcher; /** @deprecated Use `forwardedProps` instead. */
|
|
@@ -2760,6 +5109,8 @@ type ClientToolResult = {
|
|
|
2760
5109
|
};
|
|
2761
5110
|
declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TContext = unknown, TInterrupts extends ReadonlyArray<InterruptDefinition<any, any, any, any>> = any> {
|
|
2762
5111
|
private readonly processor;
|
|
5112
|
+
private readonly subagentHandles;
|
|
5113
|
+
private readonly stoppedSubagentIds;
|
|
2763
5114
|
private connection;
|
|
2764
5115
|
private uniqueId;
|
|
2765
5116
|
private threadId;
|
|
@@ -2767,6 +5118,8 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
2767
5118
|
private readonly clearedStreamTracker;
|
|
2768
5119
|
private currentRunId;
|
|
2769
5120
|
private lastResume;
|
|
5121
|
+
private readonly runParents;
|
|
5122
|
+
private readonly supersededInterruptRunIds;
|
|
2770
5123
|
private rejoinedRunId;
|
|
2771
5124
|
private readonly interruptManager;
|
|
2772
5125
|
private activeInterruptSubmission;
|
|
@@ -2832,19 +5185,39 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
2832
5185
|
private continuationPending;
|
|
2833
5186
|
private subscriptionAbortController;
|
|
2834
5187
|
private processingResolve;
|
|
5188
|
+
/**
|
|
5189
|
+
* `connect()` adapters push the full HTTP body into the subscribe queue, then
|
|
5190
|
+
* wait until that queue is idle. After `send()` returns, every chunk from this
|
|
5191
|
+
* request has been processed. Subscribe/send sockets do not drain that way.
|
|
5192
|
+
*/
|
|
5193
|
+
private connectionDrainsOnSend;
|
|
2835
5194
|
private errorReportedGeneration;
|
|
2836
5195
|
private streamGeneration;
|
|
5196
|
+
private continuationGeneration;
|
|
5197
|
+
private streamContinuationGeneration;
|
|
2837
5198
|
private continuationSkipped;
|
|
2838
5199
|
private draining;
|
|
2839
5200
|
private sessionGenerating;
|
|
2840
5201
|
private readonly activeRunIds;
|
|
2841
5202
|
/** Latched by `dispose()`; stops any late async callback starting new work. */
|
|
2842
5203
|
private disposed;
|
|
5204
|
+
/** The error a failed mount hydration set, cleared by the next successful one. */
|
|
5205
|
+
private hydrationError;
|
|
2843
5206
|
/** Whether a view is currently watching. See `attach` / `detach`. */
|
|
2844
5207
|
private tailing;
|
|
2845
5208
|
/** Constructor inputs `attach()` needs on every re-attach, not just the first. */
|
|
2846
5209
|
private readonly rejoinRunId;
|
|
2847
5210
|
private readonly cachesMessages;
|
|
5211
|
+
/**
|
|
5212
|
+
* Newest-window size from `history.pageSize`. Only set when
|
|
5213
|
+
* `persistence === true`.
|
|
5214
|
+
*/
|
|
5215
|
+
private readonly historyPageSize;
|
|
5216
|
+
private hasOlderMessages;
|
|
5217
|
+
private olderMessagesCursor;
|
|
5218
|
+
private readonly knownServerMessageIds;
|
|
5219
|
+
private loadOlderMessagesInFlight;
|
|
5220
|
+
private historyGeneration;
|
|
2848
5221
|
private devtoolsMounted;
|
|
2849
5222
|
private readonly callbacksRef;
|
|
2850
5223
|
constructor(options: ChatClientOptions<TTools, TContext, TInterrupts>);
|
|
@@ -2906,6 +5279,19 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
2906
5279
|
* send that starts first owns the client (hydration then backs off).
|
|
2907
5280
|
*/
|
|
2908
5281
|
private hydrateFromServer;
|
|
5282
|
+
/**
|
|
5283
|
+
* Surface a mount-hydration failure (`persistence: true`) on the observable
|
|
5284
|
+
* fields, mirroring `GenerationClient.failHydration`, so "this thread failed
|
|
5285
|
+
* to load" is distinguishable from "this thread has no messages" and the app
|
|
5286
|
+
* can show an error / offer a retry. A genuine miss — the server having no
|
|
5287
|
+
* record for a fresh thread — resolves normally and never reaches here; only a
|
|
5288
|
+
* thrown transport / authorize-gate error does.
|
|
5289
|
+
*
|
|
5290
|
+
* Skipped when the view unmounted (`!tailing`) or a `sendMessage` took
|
|
5291
|
+
* ownership while the hydrate GET was in flight, so a live run's state always
|
|
5292
|
+
* wins over a stale mount-time failure — same guard as the success path above.
|
|
5293
|
+
*/
|
|
5294
|
+
private failHydration;
|
|
2909
5295
|
mountDevtools(): void;
|
|
2910
5296
|
private ensureThreadId;
|
|
2911
5297
|
/**
|
|
@@ -2923,6 +5309,8 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
2923
5309
|
* state. This is interrupt (state) resume — there is no delivery cursor.
|
|
2924
5310
|
*/
|
|
2925
5311
|
private observeInterruptState;
|
|
5312
|
+
/** Walk parentRunId links and mark this run plus its ancestors as answered. */
|
|
5313
|
+
private markLineageAnswered;
|
|
2926
5314
|
/**
|
|
2927
5315
|
* The interrupt-resume state for the active/interrupted run (its run/thread
|
|
2928
5316
|
* ids), or null when there is nothing to resume. Apps can persist this to
|
|
@@ -2948,6 +5336,7 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
2948
5336
|
retryInterrupts(): void;
|
|
2949
5337
|
/** Unsafe low-level resume escape hatch. Prefer bound interrupt methods. */
|
|
2950
5338
|
resumeInterruptsUnsafe(resume: Array<RunAgentResumeItem>, state?: ChatResumeState): Promise<boolean>;
|
|
5339
|
+
private resumeInterruptsUnsafeForGeneration;
|
|
2951
5340
|
/** @deprecated Use bound interrupt methods or resumeInterruptsUnsafe(). */
|
|
2952
5341
|
resumeInterrupts(resume: Array<RunAgentResumeItem>, state?: ChatResumeState): Promise<boolean>;
|
|
2953
5342
|
private submitInterruptBatch;
|
|
@@ -2979,7 +5368,8 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
2979
5368
|
*/
|
|
2980
5369
|
private startSubscription;
|
|
2981
5370
|
/**
|
|
2982
|
-
* Consume chunks from the connection subscription.
|
|
5371
|
+
* Consume chunks from the connection subscription. Chunks are processed in
|
|
5372
|
+
* order; the loop yields to the host after each processing budget.
|
|
2983
5373
|
*/
|
|
2984
5374
|
private consumeSubscription;
|
|
2985
5375
|
/**
|
|
@@ -3001,7 +5391,7 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
3001
5391
|
* give up after {@link REJOIN_CONNECT_DEADLINE_MS} if no chunk arrives and
|
|
3002
5392
|
* clear the dead pointer so it does not retry on the next load.
|
|
3003
5393
|
*
|
|
3004
|
-
* Replay chunks are processed WITHOUT the
|
|
5394
|
+
* Replay chunks are processed WITHOUT the time-slice yield the live path uses,
|
|
3005
5395
|
* so the buffered prefix snaps in and only the genuinely-live tail streams at
|
|
3006
5396
|
* network speed — a reload looks like the run continued, not like it re-typed.
|
|
3007
5397
|
*/
|
|
@@ -3080,8 +5470,6 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
3080
5470
|
sendMessage(content: string | MultimodalContent, body?: Record<string, any>, sendOptions?: SendMessageOptions): Promise<void>;
|
|
3081
5471
|
/** True while interrupt descriptors still own continuation. */
|
|
3082
5472
|
private hasPendingInterrupts;
|
|
3083
|
-
/** True while an interrupt batch owns the next user turn. */
|
|
3084
|
-
private hasBlockingInterrupts;
|
|
3085
5473
|
/** True while a stream is active, a send is claiming the client, or the queue is draining. */
|
|
3086
5474
|
private isSendBusy;
|
|
3087
5475
|
private resolveBusyReason;
|
|
@@ -3172,6 +5560,29 @@ declare class ChatClient<TTools extends ReadonlyArray<AnyClientTool> = any, TCon
|
|
|
3172
5560
|
* Get current messages
|
|
3173
5561
|
*/
|
|
3174
5562
|
getMessages(): Array<UIMessage<TTools>>;
|
|
5563
|
+
getSubagents(): SubagentHandle[];
|
|
5564
|
+
private devtoolsSnapshotQueued;
|
|
5565
|
+
/** One devtools snapshot per microtask, however many chunks arrive. */
|
|
5566
|
+
private queueDevtoolsSnapshot;
|
|
5567
|
+
private syncSubagentHandles;
|
|
5568
|
+
private stopSubagent;
|
|
5569
|
+
/**
|
|
5570
|
+
* True when the last hydrate or older-page response said more messages exist.
|
|
5571
|
+
*/
|
|
5572
|
+
getHasOlderMessages(): boolean;
|
|
5573
|
+
/**
|
|
5574
|
+
* Fetch the next older window and put it in front of the painted messages.
|
|
5575
|
+
*
|
|
5576
|
+
* No-op when there is no older page, no cursor, or a page load is already
|
|
5577
|
+
* running. A network failure rejects and leaves the painted messages as they
|
|
5578
|
+
* are; {@link getHasOlderMessages} stays true.
|
|
5579
|
+
*/
|
|
5580
|
+
loadOlderMessages(): Promise<void>;
|
|
5581
|
+
private resetHistoryPaging;
|
|
5582
|
+
private applyHydrationPage;
|
|
5583
|
+
private rememberServerMessageIds;
|
|
5584
|
+
private rememberProcessorMessageIds;
|
|
5585
|
+
private messagesForSend;
|
|
3175
5586
|
/**
|
|
3176
5587
|
* True when an interrupt (or another direct send) claimed the client during
|
|
3177
5588
|
* a drain. Read via a method so cross-await mutations are not constant-folded
|