@tanstack/ai 0.10.3 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/activities/chat/index.d.ts +4 -0
- package/dist/esm/activities/chat/index.js +50 -16
- package/dist/esm/activities/chat/index.js.map +1 -1
- package/dist/esm/activities/chat/middleware/compose.js +5 -4
- package/dist/esm/activities/chat/middleware/compose.js.map +1 -1
- package/dist/esm/activities/chat/stream/processor.d.ts +16 -1
- package/dist/esm/activities/chat/stream/processor.js +120 -21
- package/dist/esm/activities/chat/stream/processor.js.map +1 -1
- package/dist/esm/activities/chat/stream/types.d.ts +1 -0
- package/dist/esm/activities/chat/tools/tool-calls.js +3 -1
- package/dist/esm/activities/chat/tools/tool-calls.js.map +1 -1
- package/dist/esm/activities/generateVideo/index.js +6 -0
- package/dist/esm/activities/generateVideo/index.js.map +1 -1
- package/dist/esm/activities/stream-generation-result.d.ts +3 -2
- package/dist/esm/activities/stream-generation-result.js +12 -4
- package/dist/esm/activities/stream-generation-result.js.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/stream-to-response.d.ts +2 -2
- package/dist/esm/stream-to-response.js +0 -1
- package/dist/esm/stream-to-response.js.map +1 -1
- package/dist/esm/strip-to-spec-middleware.d.ts +18 -0
- package/dist/esm/strip-to-spec-middleware.js +20 -0
- package/dist/esm/strip-to-spec-middleware.js.map +1 -0
- package/dist/esm/types.d.ts +229 -95
- package/package.json +3 -2
- package/src/activities/chat/index.ts +90 -25
- package/src/activities/chat/middleware/compose.ts +6 -4
- package/src/activities/chat/stream/processor.ts +152 -25
- package/src/activities/chat/stream/types.ts +1 -0
- package/src/activities/chat/tools/tool-calls.ts +4 -2
- package/src/activities/generateVideo/index.ts +13 -6
- package/src/activities/stream-generation-result.ts +19 -11
- package/src/stream-to-response.ts +2 -4
- package/src/strip-to-spec-middleware.ts +37 -0
- package/src/types.ts +276 -109
package/src/types.ts
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
import type { StandardJSONSchemaV1 } from '@standard-schema/spec'
|
|
2
|
+
import type {
|
|
3
|
+
BaseEvent as AGUIBaseEvent,
|
|
4
|
+
CustomEvent as AGUICustomEvent,
|
|
5
|
+
MessagesSnapshotEvent as AGUIMessagesSnapshotEvent,
|
|
6
|
+
ReasoningEncryptedValueEvent as AGUIReasoningEncryptedValueEvent,
|
|
7
|
+
ReasoningEndEvent as AGUIReasoningEndEvent,
|
|
8
|
+
ReasoningMessageContentEvent as AGUIReasoningMessageContentEvent,
|
|
9
|
+
ReasoningMessageEndEvent as AGUIReasoningMessageEndEvent,
|
|
10
|
+
ReasoningMessageStartEvent as AGUIReasoningMessageStartEvent,
|
|
11
|
+
ReasoningStartEvent as AGUIReasoningStartEvent,
|
|
12
|
+
RunErrorEvent as AGUIRunErrorEvent,
|
|
13
|
+
RunFinishedEvent as AGUIRunFinishedEvent,
|
|
14
|
+
RunStartedEvent as AGUIRunStartedEvent,
|
|
15
|
+
StateDeltaEvent as AGUIStateDeltaEvent,
|
|
16
|
+
StateSnapshotEvent as AGUIStateSnapshotEvent,
|
|
17
|
+
StepFinishedEvent as AGUIStepFinishedEvent,
|
|
18
|
+
StepStartedEvent as AGUIStepStartedEvent,
|
|
19
|
+
TextMessageContentEvent as AGUITextMessageContentEvent,
|
|
20
|
+
TextMessageEndEvent as AGUITextMessageEndEvent,
|
|
21
|
+
TextMessageStartEvent as AGUITextMessageStartEvent,
|
|
22
|
+
ToolCallArgsEvent as AGUIToolCallArgsEvent,
|
|
23
|
+
ToolCallEndEvent as AGUIToolCallEndEvent,
|
|
24
|
+
ToolCallResultEvent as AGUIToolCallResultEvent,
|
|
25
|
+
ToolCallStartEvent as AGUIToolCallStartEvent,
|
|
26
|
+
EventType,
|
|
27
|
+
} from '@ag-ui/core'
|
|
2
28
|
|
|
3
29
|
/**
|
|
4
30
|
* Tool call states - track the lifecycle of a tool call
|
|
@@ -712,50 +738,53 @@ export interface TextOptions<
|
|
|
712
738
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/AbortController
|
|
713
739
|
*/
|
|
714
740
|
abortController?: AbortController
|
|
741
|
+
/**
|
|
742
|
+
* Thread ID for AG-UI protocol run correlation.
|
|
743
|
+
* When provided, this will be used in RunStartedEvent and RunFinishedEvent.
|
|
744
|
+
*/
|
|
745
|
+
threadId?: string
|
|
746
|
+
/**
|
|
747
|
+
* Run ID for AG-UI protocol run correlation.
|
|
748
|
+
* When provided, this will be used in RunStartedEvent and RunFinishedEvent.
|
|
749
|
+
* If not provided, a unique ID will be generated.
|
|
750
|
+
*/
|
|
751
|
+
runId?: string
|
|
715
752
|
}
|
|
716
753
|
|
|
717
754
|
// ============================================================================
|
|
718
755
|
// AG-UI Protocol Event Types
|
|
719
756
|
// ============================================================================
|
|
720
757
|
|
|
758
|
+
/**
|
|
759
|
+
* Re-export EventType enum from @ag-ui/core for use in event creation.
|
|
760
|
+
* Use `EventType.RUN_STARTED` etc. when constructing event objects.
|
|
761
|
+
*/
|
|
762
|
+
export { EventType } from '@ag-ui/core'
|
|
763
|
+
|
|
721
764
|
/**
|
|
722
765
|
* AG-UI Protocol event types.
|
|
723
|
-
*
|
|
766
|
+
* @deprecated Use `EventType` enum from `@ag-ui/core` instead. This type alias
|
|
767
|
+
* is kept for backward compatibility but will be removed in a future version.
|
|
724
768
|
* @see https://docs.ag-ui.com/concepts/events
|
|
725
769
|
*/
|
|
726
|
-
export type AGUIEventType =
|
|
727
|
-
| 'RUN_STARTED'
|
|
728
|
-
| 'RUN_FINISHED'
|
|
729
|
-
| 'RUN_ERROR'
|
|
730
|
-
| 'TEXT_MESSAGE_START'
|
|
731
|
-
| 'TEXT_MESSAGE_CONTENT'
|
|
732
|
-
| 'TEXT_MESSAGE_END'
|
|
733
|
-
| 'TOOL_CALL_START'
|
|
734
|
-
| 'TOOL_CALL_ARGS'
|
|
735
|
-
| 'TOOL_CALL_END'
|
|
736
|
-
| 'STEP_STARTED'
|
|
737
|
-
| 'STEP_FINISHED'
|
|
738
|
-
| 'MESSAGES_SNAPSHOT'
|
|
739
|
-
| 'STATE_SNAPSHOT'
|
|
740
|
-
| 'STATE_DELTA'
|
|
741
|
-
| 'CUSTOM'
|
|
770
|
+
export type AGUIEventType = `${EventType}`
|
|
742
771
|
|
|
743
772
|
/**
|
|
744
773
|
* Stream chunk/event types (AG-UI protocol).
|
|
774
|
+
* @deprecated Use `EventType` enum instead.
|
|
745
775
|
*/
|
|
746
776
|
export type StreamChunkType = AGUIEventType
|
|
747
777
|
|
|
748
778
|
/**
|
|
749
779
|
* Base structure for AG-UI events.
|
|
750
|
-
* Extends
|
|
780
|
+
* Extends @ag-ui/core BaseEvent with TanStack AI additions.
|
|
781
|
+
*
|
|
782
|
+
* @ag-ui/core provides: `type`, `timestamp?`, `rawEvent?`
|
|
783
|
+
* TanStack AI adds: `model?`
|
|
751
784
|
*/
|
|
752
|
-
export interface BaseAGUIEvent {
|
|
753
|
-
type: AGUIEventType
|
|
754
|
-
timestamp: number
|
|
785
|
+
export interface BaseAGUIEvent extends AGUIBaseEvent {
|
|
755
786
|
/** Model identifier for multi-model support */
|
|
756
787
|
model?: string
|
|
757
|
-
/** Original provider event for debugging/advanced use cases */
|
|
758
|
-
rawEvent?: unknown
|
|
759
788
|
}
|
|
760
789
|
|
|
761
790
|
// ============================================================================
|
|
@@ -765,24 +794,26 @@ export interface BaseAGUIEvent {
|
|
|
765
794
|
/**
|
|
766
795
|
* Emitted when a run starts.
|
|
767
796
|
* This is the first event in any streaming response.
|
|
797
|
+
*
|
|
798
|
+
* @ag-ui/core provides: `threadId`, `runId`, `parentRunId?`, `input?`
|
|
799
|
+
* TanStack AI adds: `model?`
|
|
768
800
|
*/
|
|
769
|
-
export interface RunStartedEvent extends
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
runId: string
|
|
773
|
-
/** Optional thread/conversation ID */
|
|
774
|
-
threadId?: string
|
|
801
|
+
export interface RunStartedEvent extends AGUIRunStartedEvent {
|
|
802
|
+
/** Model identifier for multi-model support */
|
|
803
|
+
model?: string
|
|
775
804
|
}
|
|
776
805
|
|
|
777
806
|
/**
|
|
778
807
|
* Emitted when a run completes successfully.
|
|
808
|
+
*
|
|
809
|
+
* @ag-ui/core provides: `threadId`, `runId`, `result?`
|
|
810
|
+
* TanStack AI adds: `model?`, `finishReason?`, `usage?`
|
|
779
811
|
*/
|
|
780
|
-
export interface RunFinishedEvent extends
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
runId: string
|
|
812
|
+
export interface RunFinishedEvent extends AGUIRunFinishedEvent {
|
|
813
|
+
/** Model identifier for multi-model support */
|
|
814
|
+
model?: string
|
|
784
815
|
/** Why the generation stopped */
|
|
785
|
-
finishReason
|
|
816
|
+
finishReason?: 'stop' | 'length' | 'content_filter' | 'tool_calls' | null
|
|
786
817
|
/** Token usage statistics */
|
|
787
818
|
usage?: {
|
|
788
819
|
promptTokens: number
|
|
@@ -793,13 +824,18 @@ export interface RunFinishedEvent extends BaseAGUIEvent {
|
|
|
793
824
|
|
|
794
825
|
/**
|
|
795
826
|
* Emitted when an error occurs during a run.
|
|
827
|
+
*
|
|
828
|
+
* @ag-ui/core provides: `message`, `code?`
|
|
829
|
+
* TanStack AI adds: `model?`, `error?` (deprecated nested form)
|
|
796
830
|
*/
|
|
797
|
-
export interface RunErrorEvent extends
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
831
|
+
export interface RunErrorEvent extends AGUIRunErrorEvent {
|
|
832
|
+
/** Model identifier for multi-model support */
|
|
833
|
+
model?: string
|
|
834
|
+
/**
|
|
835
|
+
* @deprecated Use top-level `message` and `code` fields instead.
|
|
836
|
+
* Kept for backward compatibility.
|
|
837
|
+
*/
|
|
838
|
+
error?: {
|
|
803
839
|
message: string
|
|
804
840
|
code?: string
|
|
805
841
|
}
|
|
@@ -807,48 +843,53 @@ export interface RunErrorEvent extends BaseAGUIEvent {
|
|
|
807
843
|
|
|
808
844
|
/**
|
|
809
845
|
* Emitted when a text message starts.
|
|
846
|
+
*
|
|
847
|
+
* @ag-ui/core provides: `messageId`, `role?`, `name?`
|
|
848
|
+
* TanStack AI adds: `model?`
|
|
810
849
|
*/
|
|
811
|
-
export interface TextMessageStartEvent extends
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
messageId: string
|
|
815
|
-
/** Role of the message sender */
|
|
816
|
-
role: 'user' | 'assistant' | 'system' | 'tool'
|
|
850
|
+
export interface TextMessageStartEvent extends AGUITextMessageStartEvent {
|
|
851
|
+
/** Model identifier for multi-model support */
|
|
852
|
+
model?: string
|
|
817
853
|
}
|
|
818
854
|
|
|
819
855
|
/**
|
|
820
856
|
* Emitted when text content is generated (streaming tokens).
|
|
857
|
+
*
|
|
858
|
+
* @ag-ui/core provides: `messageId`, `delta`
|
|
859
|
+
* TanStack AI adds: `model?`, `content?` (accumulated)
|
|
821
860
|
*/
|
|
822
|
-
export interface TextMessageContentEvent extends
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
/** The incremental content token */
|
|
827
|
-
delta: string
|
|
828
|
-
/** Full accumulated content so far (optional, for debugging) */
|
|
861
|
+
export interface TextMessageContentEvent extends AGUITextMessageContentEvent {
|
|
862
|
+
/** Model identifier for multi-model support */
|
|
863
|
+
model?: string
|
|
864
|
+
/** Full accumulated content so far (TanStack AI internal, for debugging) */
|
|
829
865
|
content?: string
|
|
830
866
|
}
|
|
831
867
|
|
|
832
868
|
/**
|
|
833
869
|
* Emitted when a text message completes.
|
|
870
|
+
*
|
|
871
|
+
* @ag-ui/core provides: `messageId`
|
|
872
|
+
* TanStack AI adds: `model?`
|
|
834
873
|
*/
|
|
835
|
-
export interface TextMessageEndEvent extends
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
messageId: string
|
|
874
|
+
export interface TextMessageEndEvent extends AGUITextMessageEndEvent {
|
|
875
|
+
/** Model identifier for multi-model support */
|
|
876
|
+
model?: string
|
|
839
877
|
}
|
|
840
878
|
|
|
841
879
|
/**
|
|
842
880
|
* Emitted when a tool call starts.
|
|
881
|
+
*
|
|
882
|
+
* @ag-ui/core provides: `toolCallId`, `toolCallName`, `parentMessageId?`
|
|
883
|
+
* TanStack AI adds: `model?`, `toolName` (deprecated alias), `index?`, `providerMetadata?`
|
|
843
884
|
*/
|
|
844
|
-
export interface ToolCallStartEvent extends
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
885
|
+
export interface ToolCallStartEvent extends AGUIToolCallStartEvent {
|
|
886
|
+
/** Model identifier for multi-model support */
|
|
887
|
+
model?: string
|
|
888
|
+
/**
|
|
889
|
+
* @deprecated Use `toolCallName` instead (from @ag-ui/core spec).
|
|
890
|
+
* Kept for backward compatibility.
|
|
891
|
+
*/
|
|
849
892
|
toolName: string
|
|
850
|
-
/** ID of the parent message that initiated this tool call */
|
|
851
|
-
parentMessageId?: string
|
|
852
893
|
/** Index for parallel tool calls */
|
|
853
894
|
index?: number
|
|
854
895
|
/** Provider-specific metadata to carry into the ToolCall */
|
|
@@ -857,53 +898,85 @@ export interface ToolCallStartEvent extends BaseAGUIEvent {
|
|
|
857
898
|
|
|
858
899
|
/**
|
|
859
900
|
* Emitted when tool call arguments are streaming.
|
|
901
|
+
*
|
|
902
|
+
* @ag-ui/core provides: `toolCallId`, `delta`
|
|
903
|
+
* TanStack AI adds: `model?`, `args?` (accumulated)
|
|
860
904
|
*/
|
|
861
|
-
export interface ToolCallArgsEvent extends
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
/** Incremental JSON arguments delta */
|
|
866
|
-
delta: string
|
|
867
|
-
/** Full accumulated arguments so far */
|
|
905
|
+
export interface ToolCallArgsEvent extends AGUIToolCallArgsEvent {
|
|
906
|
+
/** Model identifier for multi-model support */
|
|
907
|
+
model?: string
|
|
908
|
+
/** Full accumulated arguments so far (TanStack AI internal) */
|
|
868
909
|
args?: string
|
|
869
910
|
}
|
|
870
911
|
|
|
871
912
|
/**
|
|
872
913
|
* Emitted when a tool call completes.
|
|
914
|
+
*
|
|
915
|
+
* @ag-ui/core provides: `toolCallId`
|
|
916
|
+
* TanStack AI adds: `model?`, `toolCallName?`, `toolName?` (deprecated), `input?`, `result?`
|
|
873
917
|
*/
|
|
874
|
-
export interface ToolCallEndEvent extends
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
918
|
+
export interface ToolCallEndEvent extends AGUIToolCallEndEvent {
|
|
919
|
+
/** Model identifier for multi-model support */
|
|
920
|
+
model?: string
|
|
921
|
+
/** Name of the tool that completed */
|
|
922
|
+
toolCallName?: string
|
|
923
|
+
/**
|
|
924
|
+
* @deprecated Use `toolCallName` instead.
|
|
925
|
+
* Kept for backward compatibility.
|
|
926
|
+
*/
|
|
927
|
+
toolName?: string
|
|
928
|
+
/** Final parsed input arguments (TanStack AI internal) */
|
|
881
929
|
input?: unknown
|
|
882
|
-
/** Tool execution result (
|
|
930
|
+
/** Tool execution result (TanStack AI internal) */
|
|
883
931
|
result?: string
|
|
884
932
|
}
|
|
885
933
|
|
|
934
|
+
/**
|
|
935
|
+
* Emitted when a tool call result is available.
|
|
936
|
+
*
|
|
937
|
+
* @ag-ui/core provides: `messageId`, `toolCallId`, `content`, `role?`
|
|
938
|
+
* TanStack AI adds: `model?`
|
|
939
|
+
*/
|
|
940
|
+
export interface ToolCallResultEvent extends AGUIToolCallResultEvent {
|
|
941
|
+
/** Model identifier for multi-model support */
|
|
942
|
+
model?: string
|
|
943
|
+
}
|
|
944
|
+
|
|
886
945
|
/**
|
|
887
946
|
* Emitted when a thinking/reasoning step starts.
|
|
947
|
+
*
|
|
948
|
+
* @ag-ui/core provides: `stepName`
|
|
949
|
+
* TanStack AI adds: `model?`, `stepId?` (deprecated alias), `stepType?`
|
|
888
950
|
*/
|
|
889
|
-
export interface StepStartedEvent extends
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
951
|
+
export interface StepStartedEvent extends AGUIStepStartedEvent {
|
|
952
|
+
/** Model identifier for multi-model support */
|
|
953
|
+
model?: string
|
|
954
|
+
/**
|
|
955
|
+
* @deprecated Use `stepName` instead (from @ag-ui/core spec).
|
|
956
|
+
* Kept for backward compatibility.
|
|
957
|
+
*/
|
|
958
|
+
stepId?: string
|
|
893
959
|
/** Type of step (e.g., 'thinking', 'planning') */
|
|
894
960
|
stepType?: string
|
|
895
961
|
}
|
|
896
962
|
|
|
897
963
|
/**
|
|
898
964
|
* Emitted when a thinking/reasoning step finishes.
|
|
965
|
+
*
|
|
966
|
+
* @ag-ui/core provides: `stepName`
|
|
967
|
+
* TanStack AI adds: `model?`, `stepId?` (deprecated alias), `delta?`, `content?`
|
|
899
968
|
*/
|
|
900
|
-
export interface StepFinishedEvent extends
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
969
|
+
export interface StepFinishedEvent extends AGUIStepFinishedEvent {
|
|
970
|
+
/** Model identifier for multi-model support */
|
|
971
|
+
model?: string
|
|
972
|
+
/**
|
|
973
|
+
* @deprecated Use `stepName` instead (from @ag-ui/core spec).
|
|
974
|
+
* Kept for backward compatibility.
|
|
975
|
+
*/
|
|
976
|
+
stepId?: string
|
|
977
|
+
/** Incremental thinking content (TanStack AI internal) */
|
|
978
|
+
delta?: string
|
|
979
|
+
/** Full accumulated thinking content (TanStack AI internal) */
|
|
907
980
|
content?: string
|
|
908
981
|
}
|
|
909
982
|
|
|
@@ -912,43 +985,130 @@ export interface StepFinishedEvent extends BaseAGUIEvent {
|
|
|
912
985
|
*
|
|
913
986
|
* Unlike StateSnapshot (which carries arbitrary application state),
|
|
914
987
|
* MessagesSnapshot specifically delivers the conversation transcript.
|
|
915
|
-
*
|
|
988
|
+
*
|
|
989
|
+
* @ag-ui/core provides: `messages` (as @ag-ui/core Message[])
|
|
990
|
+
* TanStack AI adds: `model?`
|
|
991
|
+
*
|
|
992
|
+
* Note: The `messages` field uses the @ag-ui/core Message type.
|
|
993
|
+
* Use converters to transform to/from TanStack UIMessage format.
|
|
916
994
|
*/
|
|
917
|
-
export interface MessagesSnapshotEvent extends
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
messages: Array<UIMessage>
|
|
995
|
+
export interface MessagesSnapshotEvent extends AGUIMessagesSnapshotEvent {
|
|
996
|
+
/** Model identifier for multi-model support */
|
|
997
|
+
model?: string
|
|
921
998
|
}
|
|
922
999
|
|
|
923
1000
|
/**
|
|
924
1001
|
* Emitted to provide a full state snapshot.
|
|
1002
|
+
*
|
|
1003
|
+
* @ag-ui/core provides: `snapshot` (any)
|
|
1004
|
+
* TanStack AI adds: `model?`, `state?` (deprecated alias for snapshot)
|
|
925
1005
|
*/
|
|
926
|
-
export interface StateSnapshotEvent extends
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
1006
|
+
export interface StateSnapshotEvent extends AGUIStateSnapshotEvent {
|
|
1007
|
+
/** Model identifier for multi-model support */
|
|
1008
|
+
model?: string
|
|
1009
|
+
/**
|
|
1010
|
+
* @deprecated Use `snapshot` instead (from @ag-ui/core spec).
|
|
1011
|
+
* Kept for backward compatibility.
|
|
1012
|
+
*/
|
|
1013
|
+
state?: Record<string, unknown>
|
|
930
1014
|
}
|
|
931
1015
|
|
|
932
1016
|
/**
|
|
933
1017
|
* Emitted to provide an incremental state update.
|
|
1018
|
+
*
|
|
1019
|
+
* @ag-ui/core provides: `delta` (any[] - JSON Patch RFC 6902)
|
|
1020
|
+
* TanStack AI adds: `model?`
|
|
934
1021
|
*/
|
|
935
|
-
export interface StateDeltaEvent extends
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
delta: Record<string, unknown>
|
|
1022
|
+
export interface StateDeltaEvent extends AGUIStateDeltaEvent {
|
|
1023
|
+
/** Model identifier for multi-model support */
|
|
1024
|
+
model?: string
|
|
939
1025
|
}
|
|
940
1026
|
|
|
941
1027
|
/**
|
|
942
1028
|
* Custom event for extensibility.
|
|
1029
|
+
*
|
|
1030
|
+
* @ag-ui/core provides: `name`, `value`
|
|
1031
|
+
* TanStack AI adds: `model?`
|
|
943
1032
|
*/
|
|
944
|
-
export interface CustomEvent extends
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
name: string
|
|
948
|
-
/** Custom event value */
|
|
949
|
-
value?: unknown
|
|
1033
|
+
export interface CustomEvent extends AGUICustomEvent {
|
|
1034
|
+
/** Model identifier for multi-model support */
|
|
1035
|
+
model?: string
|
|
950
1036
|
}
|
|
951
1037
|
|
|
1038
|
+
// ============================================================================
|
|
1039
|
+
// AG-UI Reasoning Event Interfaces
|
|
1040
|
+
// ============================================================================
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Emitted when reasoning starts for a message.
|
|
1044
|
+
*
|
|
1045
|
+
* @ag-ui/core provides: `messageId`
|
|
1046
|
+
* TanStack AI adds: `model?`
|
|
1047
|
+
*/
|
|
1048
|
+
export interface ReasoningStartEvent extends AGUIReasoningStartEvent {
|
|
1049
|
+
/** Model identifier for multi-model support */
|
|
1050
|
+
model?: string
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/**
|
|
1054
|
+
* Emitted when a reasoning message starts.
|
|
1055
|
+
*
|
|
1056
|
+
* @ag-ui/core provides: `messageId`, `role` ("reasoning")
|
|
1057
|
+
* TanStack AI adds: `model?`
|
|
1058
|
+
*/
|
|
1059
|
+
export interface ReasoningMessageStartEvent extends AGUIReasoningMessageStartEvent {
|
|
1060
|
+
/** Model identifier for multi-model support */
|
|
1061
|
+
model?: string
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Emitted when reasoning message content is generated.
|
|
1066
|
+
*
|
|
1067
|
+
* @ag-ui/core provides: `messageId`, `delta`
|
|
1068
|
+
* TanStack AI adds: `model?`
|
|
1069
|
+
*/
|
|
1070
|
+
export interface ReasoningMessageContentEvent extends AGUIReasoningMessageContentEvent {
|
|
1071
|
+
/** Model identifier for multi-model support */
|
|
1072
|
+
model?: string
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
/**
|
|
1076
|
+
* Emitted when a reasoning message ends.
|
|
1077
|
+
*
|
|
1078
|
+
* @ag-ui/core provides: `messageId`
|
|
1079
|
+
* TanStack AI adds: `model?`
|
|
1080
|
+
*/
|
|
1081
|
+
export interface ReasoningMessageEndEvent extends AGUIReasoningMessageEndEvent {
|
|
1082
|
+
/** Model identifier for multi-model support */
|
|
1083
|
+
model?: string
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* Emitted when reasoning ends for a message.
|
|
1088
|
+
*
|
|
1089
|
+
* @ag-ui/core provides: `messageId`
|
|
1090
|
+
* TanStack AI adds: `model?`
|
|
1091
|
+
*/
|
|
1092
|
+
export interface ReasoningEndEvent extends AGUIReasoningEndEvent {
|
|
1093
|
+
/** Model identifier for multi-model support */
|
|
1094
|
+
model?: string
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* Emitted for encrypted reasoning values.
|
|
1099
|
+
*
|
|
1100
|
+
* @ag-ui/core provides: `subtype`, `entityId`, `encryptedValue`
|
|
1101
|
+
* TanStack AI adds: `model?`
|
|
1102
|
+
*/
|
|
1103
|
+
export interface ReasoningEncryptedValueEvent extends AGUIReasoningEncryptedValueEvent {
|
|
1104
|
+
/** Model identifier for multi-model support */
|
|
1105
|
+
model?: string
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
// ============================================================================
|
|
1109
|
+
// AG-UI Event Union
|
|
1110
|
+
// ============================================================================
|
|
1111
|
+
|
|
952
1112
|
/**
|
|
953
1113
|
* Union of all AG-UI events.
|
|
954
1114
|
*/
|
|
@@ -962,12 +1122,19 @@ export type AGUIEvent =
|
|
|
962
1122
|
| ToolCallStartEvent
|
|
963
1123
|
| ToolCallArgsEvent
|
|
964
1124
|
| ToolCallEndEvent
|
|
1125
|
+
| ToolCallResultEvent
|
|
965
1126
|
| StepStartedEvent
|
|
966
1127
|
| StepFinishedEvent
|
|
967
1128
|
| MessagesSnapshotEvent
|
|
968
1129
|
| StateSnapshotEvent
|
|
969
1130
|
| StateDeltaEvent
|
|
970
1131
|
| CustomEvent
|
|
1132
|
+
| ReasoningStartEvent
|
|
1133
|
+
| ReasoningMessageStartEvent
|
|
1134
|
+
| ReasoningMessageContentEvent
|
|
1135
|
+
| ReasoningMessageEndEvent
|
|
1136
|
+
| ReasoningEndEvent
|
|
1137
|
+
| ReasoningEncryptedValueEvent
|
|
971
1138
|
|
|
972
1139
|
/**
|
|
973
1140
|
* Chunk returned by the SDK during streaming chat completions.
|