@agno-hq/chat-react 0.3.3 → 0.3.4

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.
Files changed (33) hide show
  1. package/README.md +46 -0
  2. package/dist/chat/index.cjs +90 -86
  3. package/dist/chat/index.d.cts +55 -43
  4. package/dist/chat/index.d.ts +55 -43
  5. package/dist/chat/index.js +2 -2
  6. package/dist/{chunk-RE7ZT73K.js → chunk-5QKU7OPE.js} +2 -2
  7. package/dist/{chunk-RE7ZT73K.js.map → chunk-5QKU7OPE.js.map} +1 -1
  8. package/dist/{chunk-6V2YIPHF.js → chunk-BCVKAMSO.js} +22 -4
  9. package/dist/chunk-BCVKAMSO.js.map +1 -0
  10. package/dist/{chunk-3IEYJIYJ.cjs → chunk-ESV52ERB.cjs} +620 -318
  11. package/dist/chunk-ESV52ERB.cjs.map +1 -0
  12. package/dist/{chunk-2WM3CCFE.cjs → chunk-HBSF434L.cjs} +2 -2
  13. package/dist/{chunk-2WM3CCFE.cjs.map → chunk-HBSF434L.cjs.map} +1 -1
  14. package/dist/{chunk-E4CFQ457.js → chunk-OGDPK4Z3.js} +586 -285
  15. package/dist/chunk-OGDPK4Z3.js.map +1 -0
  16. package/dist/{chunk-55HQJGLP.cjs → chunk-Y34YRC5T.cjs} +22 -3
  17. package/dist/chunk-Y34YRC5T.cjs.map +1 -0
  18. package/dist/{client-DUyVqxU9.d.cts → client-Dwk6ThnW.d.cts} +24 -12
  19. package/dist/{client-DUyVqxU9.d.ts → client-Dwk6ThnW.d.ts} +24 -12
  20. package/dist/core/index.cjs +23 -23
  21. package/dist/core/index.d.cts +2 -2
  22. package/dist/core/index.d.ts +2 -2
  23. package/dist/core/index.js +2 -2
  24. package/dist/index.cjs +113 -109
  25. package/dist/index.d.cts +2 -2
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +3 -3
  28. package/dist/styles.css +22 -15
  29. package/package.json +11 -9
  30. package/dist/chunk-3IEYJIYJ.cjs.map +0 -1
  31. package/dist/chunk-55HQJGLP.cjs.map +0 -1
  32. package/dist/chunk-6V2YIPHF.js.map +0 -1
  33. package/dist/chunk-E4CFQ457.js.map +0 -1
@@ -1,7 +1,19 @@
1
- import { C as ChatMessage, l as RunEventData, e as ChatStatus, g as EntityType, q as ToolExecution, m as RunRequirement, S as SessionEntry, A as AgnoClient, E as Entity, j as ReferenceData, f as Citations$1, R as ReasoningStep, o as SubRun, r as WorkflowStep, I as ImageData, V as VideoData, c as AudioData } from '../client-DUyVqxU9.js';
1
+ import { C as ChatMessage, l as RunEventData, e as ChatStatus, g as EntityType, s as ToolExecution, m as RunRequirement, S as SessionEntry, n as RunResolution, A as AgnoClient, E as Entity, j as ReferenceData, f as Citations$1, R as ReasoningStep, q as SubRun, t as WorkflowStep, I as ImageData, V as VideoData, c as AudioData } from '../client-Dwk6ThnW.js';
2
2
  import React$1 from 'react';
3
3
  import { StreamdownProps } from 'streamdown';
4
4
 
5
+ interface StreamingOptions {
6
+ /** Buffer plain text updates. Set false for immediate per-event updates. */
7
+ enabled?: boolean;
8
+ /** How long text accumulates before a flush, in ms. Zero disables buffering. */
9
+ flushIntervalMs?: number;
10
+ /** Flush when this many original events are pending. */
11
+ maxBufferEvents?: number;
12
+ /** Flush when this many UTF-16 characters are pending. */
13
+ maxBufferChars?: number;
14
+ }
15
+ declare const DEFAULT_STREAMING_OPTIONS: Readonly<Required<StreamingOptions>>;
16
+
5
17
  /**
6
18
  * useAgnoChat — a headless React hook for running any Agno agent, team or
7
19
  * workflow against an AgentOS backend and consuming its streamed output.
@@ -30,7 +42,9 @@ interface UseAgnoChatOptions {
30
42
  sessionId?: string;
31
43
  /** Pre-seed the transcript (e.g. when restoring a session). */
32
44
  initialMessages?: ChatMessage[];
33
- /** Called with every raw run event, for logging/telemetry. */
45
+ /** Plain-text buffering settings, captured when a run or continuation starts. */
46
+ streaming?: StreamingOptions;
47
+ /** Called immediately with every raw run event, for logging/telemetry. */
34
48
  onEvent?: (event: RunEventData) => void;
35
49
  /** Called when the session id changes (e.g. first run of a new session). */
36
50
  onSessionId?: (sessionId: string) => void;
@@ -76,10 +90,7 @@ interface UseAgnoChat {
76
90
  /** Stop the active run. */
77
91
  cancel: () => Promise<void>;
78
92
  /** Continue a paused run with explicitly resolved requirements. */
79
- continueRun: (resolution: {
80
- tools?: ToolExecution[];
81
- stepRequirements?: unknown[];
82
- }) => Promise<void>;
93
+ continueRun: (resolution: RunResolution) => Promise<void>;
83
94
  /** Approve or reject all pending tool confirmations, then continue. */
84
95
  respondToConfirmation: (approve: boolean) => Promise<void>;
85
96
  /** Provide values for pending tool user-input fields, then continue. */
@@ -364,36 +375,6 @@ declare const SourcesProvider: React$1.Provider<Source[]>;
364
375
  /** The sources of the surrounding message; empty outside one. */
365
376
  declare function useSources(): Source[];
366
377
 
367
- /**
368
- * The copy control — one component wherever something can be copied: the
369
- * header of a fenced code block, the action row under an answer, a host's own
370
- * surface. It owns the "copied" flash and the clipboard fallbacks, so every
371
- * copy affordance in a transcript behaves the same way.
372
- */
373
-
374
- /**
375
- * Copy text, by whichever route the browser allows.
376
- *
377
- * The async Clipboard API is the right one, but it rejects on an insecure
378
- * origin and whenever the document isn't focused — so a selection-based copy
379
- * stands behind it. Returns whether anything was actually copied: the button
380
- * should not claim success it didn't have.
381
- *
382
- * Exported because a host building its own copy affordance wants the same
383
- * fallbacks, and because the failure paths are worth testing.
384
- */
385
- declare function writeClipboard(text: string): Promise<boolean>;
386
- interface CopyButtonProps {
387
- /** What to copy — a string, or a function for text that is costly to build. */
388
- text: string | (() => string);
389
- /** Accessible name and tooltip. Defaults to "Copy". */
390
- label?: string;
391
- /** Icon size, in px. */
392
- size?: number;
393
- className?: string;
394
- }
395
- declare function CopyButton({ text, label, size, className }: CopyButtonProps): React$1.ReactElement;
396
-
397
378
  /**
398
379
  * Markdown for a chat transcript, rendered by [Streamdown](https://streamdown.ai).
399
380
  *
@@ -411,6 +392,8 @@ declare function CopyButton({ text, label, size, className }: CopyButtonProps):
411
392
  * this one entirely.
412
393
  */
413
394
 
395
+ /** Everything a host may pass straight through to Streamdown. */
396
+ type StreamdownOptions = Omit<StreamdownProps, 'children' | 'className' | 'components'>;
414
397
  interface MarkdownProps {
415
398
  content: string;
416
399
  className?: string;
@@ -435,11 +418,41 @@ interface MarkdownProps {
435
418
  */
436
419
  linkComponent?: LinkComponent;
437
420
  /** Escape hatch onto Streamdown itself — anything not set here. */
438
- options?: Omit<StreamdownProps, 'children' | 'className' | 'components'>;
421
+ options?: StreamdownOptions;
439
422
  }
440
- declare function Markdown({ content, className, sources, streaming, codeCopy, linkComponent, options, }: MarkdownProps): React$1.ReactElement;
423
+ declare function Markdown({ content, className, sources, streaming, codeCopy, linkComponent, options }: MarkdownProps): React$1.ReactElement;
441
424
  type RenderMarkdown = (content: string) => React$1.ReactNode;
442
425
 
426
+ /**
427
+ * The copy control — one component wherever something can be copied: the
428
+ * header of a fenced code block, the action row under an answer, a host's own
429
+ * surface. It owns the "copied" flash and the clipboard fallbacks, so every
430
+ * copy affordance in a transcript behaves the same way.
431
+ */
432
+
433
+ /**
434
+ * Copy text, by whichever route the browser allows.
435
+ *
436
+ * The async Clipboard API is the right one, but it rejects on an insecure
437
+ * origin and whenever the document isn't focused — so a selection-based copy
438
+ * stands behind it. Returns whether anything was actually copied: the button
439
+ * should not claim success it didn't have.
440
+ *
441
+ * Exported because a host building its own copy affordance wants the same
442
+ * fallbacks, and because the failure paths are worth testing.
443
+ */
444
+ declare function writeClipboard(text: string): Promise<boolean>;
445
+ interface CopyButtonProps {
446
+ /** What to copy — a string, or a function for text that is costly to build. */
447
+ text: string | (() => string);
448
+ /** Accessible name and tooltip. Defaults to "Copy". */
449
+ label?: string;
450
+ /** Icon size, in px. */
451
+ size?: number;
452
+ className?: string;
453
+ }
454
+ declare function CopyButton({ text, label, size, className }: CopyButtonProps): React$1.ReactElement;
455
+
443
456
  /**
444
457
  * `<ChatProvider>` runs a chat and shares it with everything below it, so the
445
458
  * layout is entirely yours:
@@ -623,6 +636,8 @@ interface AgnoChatProps {
623
636
  client?: AgnoClient;
624
637
  headers?: Record<string, string>;
625
638
  userId?: string;
639
+ /** Override the default bounded plain-text buffering. */
640
+ streaming?: StreamingOptions;
626
641
  /**
627
642
  * The selected agent/team/workflow. Pass it to own the selection — the embed
628
643
  * then only displays it, the way AgentOS drives the chat from its breadcrumb.
@@ -1235,10 +1250,7 @@ interface HumanInputProps {
1235
1250
  entityType?: EntityType;
1236
1251
  busy?: boolean;
1237
1252
  /** Continue the run with the resolved tools (agent/team) or step requirements (workflow). */
1238
- onResolve: (resolution: {
1239
- tools?: ToolExecution[];
1240
- stepRequirements?: unknown[];
1241
- }) => void;
1253
+ onResolve: (resolution: RunResolution) => void;
1242
1254
  className?: string;
1243
1255
  }
1244
1256
  declare function HumanInput({ message, entityType, busy, onResolve, className, }: HumanInputProps): React$1.ReactElement | null;
@@ -1387,4 +1399,4 @@ declare function GridLoader({ className }: {
1387
1399
  className?: string;
1388
1400
  }): React$1.ReactElement;
1389
1401
 
1390
- export { AgnoChat, type AgnoChatProps, AgnoMark, ArrowUp, BehindTheScenes, type BehindTheScenesProps, BookOpen, Box, Brain, ChatBubble, type ChatClassNames, type ChatContextValue, ChatInput, type ChatInputProps, ChatLauncher, type ChatLauncherProps, ChatProvider, type ChatProviderProps, type ChatTextareaProps, ChatWindow, type ChatWindowProps, Check, ChevronDown, Citations, type CitationsProps, Close, Copy, CopyButton, type CopyButtonProps, EntityBadge, type EntityBadgeProps, EntitySelector, EventLog, Favicon, FileAudio, FileIcon, type FileLimits, FilePreview, type FilePreviewProps, FileType, FileVideo, Followups, type FollowupsProps, Globe, GridLoader, HoverPreview, type HoverPreviewProps, HumanInput, type HumanInputProps, type LauncherPanel, type LauncherPosition, type LinkComponent, LinkIcon, type LinkPreview, LinkPreviewCard, type LinkPreviewCardProps, Markdown, type MarkdownProps, MemberResponses, Memory, Message, MessageActions, type MessageActionsProps, MessageList, type MessageListProps, type MessageProps, Multimedia, Paperclip, Plus, Pulse, type QuickPrompt, QuickPrompts, type QuickPromptsProps, Reasoning, type RenderMarkdown, Rerun, type ResolveLinkPreview, type SendOptions, SessionList, type SessionListProps, type Source, SourceCard, SourcesProvider, Spinner, StatusIndicator, Stop, TeamGlyph, ToolCalls, Trash, type UseAgnoChat, type UseAgnoChatOptions, WorkflowSteps, Wrench, admitFiles, behindTheScenesItems, behindTheScenesLabel, collectSources, displayUrl, faviconFallbacks, faviconUrl, fileAccepted, getProviderIcon, hasBehindTheScenes, linkCitations, normalizeFollowups, quickPromptLabel, quickPromptText, sourceHost, sourcesFromMarkdown, useAgnoChat, useChatContext, useLinkComponent, useLinkPreview, useOptionalChatContext, useResolvedChat, useResolvedClassNames, useSources, withoutSourcesLine, writeClipboard };
1402
+ export { AgnoChat, type AgnoChatProps, AgnoMark, ArrowUp, BehindTheScenes, type BehindTheScenesProps, BookOpen, Box, Brain, ChatBubble, type ChatClassNames, type ChatContextValue, ChatInput, type ChatInputProps, ChatLauncher, type ChatLauncherProps, ChatProvider, type ChatProviderProps, type ChatTextareaProps, ChatWindow, type ChatWindowProps, Check, ChevronDown, Citations, type CitationsProps, Close, Copy, CopyButton, type CopyButtonProps, DEFAULT_STREAMING_OPTIONS, EntityBadge, type EntityBadgeProps, EntitySelector, EventLog, Favicon, FileAudio, FileIcon, type FileLimits, FilePreview, type FilePreviewProps, FileType, FileVideo, Followups, type FollowupsProps, Globe, GridLoader, HoverPreview, type HoverPreviewProps, HumanInput, type HumanInputProps, type LauncherPanel, type LauncherPosition, type LinkComponent, LinkIcon, type LinkPreview, LinkPreviewCard, type LinkPreviewCardProps, Markdown, type MarkdownProps, MemberResponses, Memory, Message, MessageActions, type MessageActionsProps, MessageList, type MessageListProps, type MessageProps, Multimedia, Paperclip, Plus, Pulse, type QuickPrompt, QuickPrompts, type QuickPromptsProps, Reasoning, type RenderMarkdown, Rerun, type ResolveLinkPreview, type SendOptions, SessionList, type SessionListProps, type Source, SourceCard, SourcesProvider, Spinner, StatusIndicator, Stop, type StreamingOptions, TeamGlyph, ToolCalls, Trash, type UseAgnoChat, type UseAgnoChatOptions, WorkflowSteps, Wrench, admitFiles, behindTheScenesItems, behindTheScenesLabel, collectSources, displayUrl, faviconFallbacks, faviconUrl, fileAccepted, getProviderIcon, hasBehindTheScenes, linkCitations, normalizeFollowups, quickPromptLabel, quickPromptText, sourceHost, sourcesFromMarkdown, useAgnoChat, useChatContext, useLinkComponent, useLinkPreview, useOptionalChatContext, useResolvedChat, useResolvedClassNames, useSources, withoutSourcesLine, writeClipboard };
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- export { AgnoChat, AgnoMark, ArrowUp, BehindTheScenes, BookOpen, Box, Brain, ChatBubble, ChatInput, ChatLauncher, ChatProvider, ChatWindow, Check, ChevronDown, Citations, Close, Copy, CopyButton, EntityBadge, EntitySelector, EventLog, Favicon, FileAudio, FileIcon, FilePreview, FileType, FileVideo, Followups, Globe, GridLoader, HoverPreview, HumanInput, LinkIcon, LinkPreviewCard, Markdown, MemberResponses, Memory, Message, MessageActions, MessageList, Multimedia, Paperclip, Plus, Pulse, QuickPrompts, Reasoning, Rerun, SessionList, SourceCard, SourcesProvider, Spinner, StatusIndicator, Stop, TeamGlyph, ToolCalls, Trash, WorkflowSteps, Wrench, admitFiles, behindTheScenesItems, behindTheScenesLabel, collectSources, displayUrl, faviconFallbacks, faviconUrl, fileAccepted, getProviderIcon, hasBehindTheScenes, linkCitations, normalizeFollowups, quickPromptLabel, quickPromptText, sourceHost, sourcesFromMarkdown, useAgnoChat, useChatContext, useLinkComponent, useLinkPreview, useOptionalChatContext, useResolvedChat, useResolvedClassNames, useSources, withoutSourcesLine, writeClipboard } from '../chunk-E4CFQ457.js';
3
- import '../chunk-6V2YIPHF.js';
2
+ export { AgnoChat, AgnoMark, ArrowUp, BehindTheScenes, BookOpen, Box, Brain, ChatBubble, ChatInput, ChatLauncher, ChatProvider, ChatWindow, Check, ChevronDown, Citations, Close, Copy, CopyButton, DEFAULT_STREAMING_OPTIONS, EntityBadge, EntitySelector, EventLog, Favicon, FileAudio, FileIcon, FilePreview, FileType, FileVideo, Followups, Globe, GridLoader, HoverPreview, HumanInput, LinkIcon, LinkPreviewCard, Markdown, MemberResponses, Memory, Message, MessageActions, MessageList, Multimedia, Paperclip, Plus, Pulse, QuickPrompts, Reasoning, Rerun, SessionList, SourceCard, SourcesProvider, Spinner, StatusIndicator, Stop, TeamGlyph, ToolCalls, Trash, WorkflowSteps, Wrench, admitFiles, behindTheScenesItems, behindTheScenesLabel, collectSources, displayUrl, faviconFallbacks, faviconUrl, fileAccepted, getProviderIcon, hasBehindTheScenes, linkCitations, normalizeFollowups, quickPromptLabel, quickPromptText, sourceHost, sourcesFromMarkdown, useAgnoChat, useChatContext, useLinkComponent, useLinkPreview, useOptionalChatContext, useResolvedChat, useResolvedClassNames, useSources, withoutSourcesLine, writeClipboard } from '../chunk-OGDPK4Z3.js';
3
+ import '../chunk-BCVKAMSO.js';
4
4
  //# sourceMappingURL=index.js.map
5
5
  //# sourceMappingURL=index.js.map
@@ -98,5 +98,5 @@ var WorkflowRunEvent = /* @__PURE__ */ ((WorkflowRunEvent2) => {
98
98
  })(WorkflowRunEvent || {});
99
99
 
100
100
  export { RunEvent, TeamRunEvent, WorkflowRunEvent };
101
- //# sourceMappingURL=chunk-RE7ZT73K.js.map
102
- //# sourceMappingURL=chunk-RE7ZT73K.js.map
101
+ //# sourceMappingURL=chunk-5QKU7OPE.js.map
102
+ //# sourceMappingURL=chunk-5QKU7OPE.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/types.ts"],"names":["RunEvent","TeamRunEvent","WorkflowRunEvent"],"mappings":";AAYO,IAAK,QAAA,qBAAAA,SAAAA,KAAL;AACL,EAAAA,UAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,UAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,UAAA,qBAAA,CAAA,GAAsB,qBAAA;AACtB,EAAAA,UAAA,wBAAA,CA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AAA,kBAAA,0BAAA,CAAA,GAA2B,0BAAA;AAC3B,EAAAA,kBAAA,4BAAA,CAAA,GAA6B,4BAAA;AAE7B,EAAAA,kBAAA,2BAAA,CAAA,GAA4B,2BAAA;AAC5B,EAAAA,kBAAA,6BAAA,CAAA,GAA8B,6BAAA;AAC9B,EAAAA,kBAAA,iBAAA,CAAA,GAAkB,iBAAA;AAElB,EAAAA,kBAAA,wBAAA,CAAA,GAAyB,wBAAA;AACzB,EAAAA,kBAAA,0BAAA,CAAA,GAA2B,0BAAA;AAC3B,EAAAA,kBAAA,cAAA,CAAA,GAAe,cAAA;AAEf,EAAAA,kBAAA,uBAAA,CAAA,GAAwB,uBAAA;AACxB,EAAAA,kBAAA,yBAAA,CAAA,GAA0B,yBAAA;AAnChB,EAAA,OAAAA,iBAAAA;AAAA,CAAA,EAAA,gBAAA,IAAA,EAAA","file":"chunk-RE7ZT73K.js","sourcesContent":["/**\n * Types for AgentOS run events, messages, and entities.\n *\n * These mirror the wire format emitted by Agno's AgentOS when streaming a run\n * for an agent, team, or workflow. Field names match the JSON sent on the wire.\n */\n\n/* ------------------------------------------------------------------ */\n/* Run event names */\n/* ------------------------------------------------------------------ */\n\n/** Agent run event names. */\nexport enum RunEvent {\n RunStarted = 'RunStarted',\n RunContent = 'RunContent',\n RunContentCompleted = 'RunContentCompleted',\n RunIntermediateContent = 'RunIntermediateContent',\n RunCompleted = 'RunCompleted',\n RunError = 'RunError',\n RunCancelled = 'RunCancelled',\n RunPaused = 'RunPaused',\n RunContinued = 'RunContinued',\n\n PreHookStarted = 'PreHookStarted',\n PreHookCompleted = 'PreHookCompleted',\n PostHookStarted = 'PostHookStarted',\n PostHookCompleted = 'PostHookCompleted',\n\n ToolCallStarted = 'ToolCallStarted',\n ToolCallCompleted = 'ToolCallCompleted',\n ToolCallError = 'ToolCallError',\n\n ReasoningStarted = 'ReasoningStarted',\n ReasoningStep = 'ReasoningStep',\n ReasoningContentDelta = 'ReasoningContentDelta',\n ReasoningCompleted = 'ReasoningCompleted',\n\n MemoryUpdateStarted = 'MemoryUpdateStarted',\n MemoryUpdateCompleted = 'MemoryUpdateCompleted',\n\n SessionSummaryStarted = 'SessionSummaryStarted',\n SessionSummaryCompleted = 'SessionSummaryCompleted',\n\n ParserModelResponseStarted = 'ParserModelResponseStarted',\n ParserModelResponseCompleted = 'ParserModelResponseCompleted',\n OutputModelResponseStarted = 'OutputModelResponseStarted',\n OutputModelResponseCompleted = 'OutputModelResponseCompleted',\n\n ModelRequestStarted = 'ModelRequestStarted',\n ModelRequestCompleted = 'ModelRequestCompleted',\n\n CompressionStarted = 'CompressionStarted',\n CompressionCompleted = 'CompressionCompleted',\n\n FollowupsStarted = 'FollowupsStarted',\n FollowupsCompleted = 'FollowupsCompleted',\n\n CustomEvent = 'CustomEvent',\n}\n\n/** Team run event names. */\nexport enum TeamRunEvent {\n TeamRunStarted = 'TeamRunStarted',\n TeamRunContent = 'TeamRunContent',\n TeamRunIntermediateContent = 'TeamRunIntermediateContent',\n TeamRunContentCompleted = 'TeamRunContentCompleted',\n TeamRunCompleted = 'TeamRunCompleted',\n TeamRunError = 'TeamRunError',\n TeamRunCancelled = 'TeamRunCancelled',\n TeamRunPaused = 'TeamRunPaused',\n TeamRunContinued = 'TeamRunContinued',\n\n TeamToolCallStarted = 'TeamToolCallStarted',\n TeamToolCallCompleted = 'TeamToolCallCompleted',\n TeamToolCallError = 'TeamToolCallError',\n\n TeamReasoningStarted = 'TeamReasoningStarted',\n TeamReasoningStep = 'TeamReasoningStep',\n TeamReasoningContentDelta = 'TeamReasoningContentDelta',\n TeamReasoningCompleted = 'TeamReasoningCompleted',\n\n TeamMemoryUpdateStarted = 'TeamMemoryUpdateStarted',\n TeamMemoryUpdateCompleted = 'TeamMemoryUpdateCompleted',\n\n TeamFollowupsStarted = 'TeamFollowupsStarted',\n TeamFollowupsCompleted = 'TeamFollowupsCompleted',\n\n TeamTaskIterationStarted = 'TeamTaskIterationStarted',\n TeamTaskIterationCompleted = 'TeamTaskIterationCompleted',\n TeamTaskStateUpdated = 'TeamTaskStateUpdated',\n TeamTaskCreated = 'TeamTaskCreated',\n TeamTaskUpdated = 'TeamTaskUpdated',\n}\n\n/** Workflow run event names. */\nexport enum WorkflowRunEvent {\n WorkflowStarted = 'WorkflowStarted',\n WorkflowCompleted = 'WorkflowCompleted',\n WorkflowPaused = 'WorkflowPaused',\n WorkflowCancelled = 'WorkflowCancelled',\n WorkflowError = 'WorkflowError',\n\n WorkflowAgentStarted = 'WorkflowAgentStarted',\n WorkflowAgentCompleted = 'WorkflowAgentCompleted',\n\n StepStarted = 'StepStarted',\n StepCompleted = 'StepCompleted',\n StepPaused = 'StepPaused',\n StepContinued = 'StepContinued',\n StepError = 'StepError',\n StepOutput = 'StepOutput',\n StepOutputReview = 'StepOutputReview',\n\n LoopExecutionStarted = 'LoopExecutionStarted',\n LoopIterationStarted = 'LoopIterationStarted',\n LoopIterationCompleted = 'LoopIterationCompleted',\n LoopExecutionCompleted = 'LoopExecutionCompleted',\n\n ParallelExecutionStarted = 'ParallelExecutionStarted',\n ParallelExecutionCompleted = 'ParallelExecutionCompleted',\n\n ConditionExecutionStarted = 'ConditionExecutionStarted',\n ConditionExecutionCompleted = 'ConditionExecutionCompleted',\n ConditionPaused = 'ConditionPaused',\n\n RouterExecutionStarted = 'RouterExecutionStarted',\n RouterExecutionCompleted = 'RouterExecutionCompleted',\n RouterPaused = 'RouterPaused',\n\n StepsExecutionStarted = 'StepsExecutionStarted',\n StepsExecutionCompleted = 'StepsExecutionCompleted',\n}\n\n/** Any run event name, across agents, teams and workflows. */\nexport type AnyRunEventName = RunEvent | TeamRunEvent | WorkflowRunEvent | string\n\n/* ------------------------------------------------------------------ */\n/* Tool calls */\n/* ------------------------------------------------------------------ */\n\nexport interface UserInputField {\n name: string\n field_type?: string\n description?: string\n value?: unknown\n}\n\nexport interface ToolExecution {\n tool_call_id?: string\n tool_name?: string\n tool_args?: Record<string, unknown>\n tool_call_error?: boolean\n result?: string\n metrics?: { time?: number }\n created_at?: number\n stop_after_tool_call?: boolean\n\n // Human-in-the-loop\n requires_confirmation?: boolean\n confirmed?: boolean\n confirmation_note?: string\n requires_user_input?: boolean\n user_input_schema?: UserInputField[]\n answered?: boolean\n external_execution_required?: boolean\n\n // present on a few content payloads under the legacy `role`/`content` shape\n role?: string\n content?: string | null\n}\n\n/* ------------------------------------------------------------------ */\n/* Reasoning, references, media */\n/* ------------------------------------------------------------------ */\n\nexport interface ReasoningStep {\n title?: string\n action?: string\n result?: string\n reasoning?: string\n confidence?: number\n next_action?: string\n}\n\nexport interface Reference {\n content: string\n name?: string\n meta_data?: Record<string, unknown>\n}\n\nexport interface ReferenceData {\n query: string\n references: Reference[]\n time?: number\n}\n\nexport interface ImageData {\n url?: string\n revised_prompt?: string\n content?: string\n}\n\nexport interface VideoData {\n id?: number | string\n url?: string\n eta?: number\n}\n\nexport interface AudioData {\n id?: string\n url?: string\n base64_audio?: string\n mime_type?: string\n content?: string\n transcript?: string\n channels?: number\n sample_rate?: number\n}\n\nexport interface Citations {\n raw?: unknown\n urls?: Array<{ url?: string; title?: string }>\n}\n\n/* ------------------------------------------------------------------ */\n/* The raw streamed event */\n/* ------------------------------------------------------------------ */\n\n/**\n * A single run event off the wire, normalised to a flat object. The `event`\n * field is the discriminator; other fields depend on the event type. This is a\n * permissive superset — most fields are optional and present only for the\n * events that carry them.\n */\nexport interface RunEventData {\n event: AnyRunEventName\n created_at?: number\n run_id?: string\n parent_run_id?: string\n session_id?: string\n agent_id?: string\n agent_name?: string\n team_id?: string\n team_name?: string\n workflow_id?: string\n workflow_name?: string\n\n content?: string | object | null\n content_type?: string\n reasoning_content?: string\n\n tool?: ToolExecution\n tools?: ToolExecution[]\n\n reasoning_steps?: ReasoningStep[]\n references?: ReferenceData[]\n citations?: Citations\n\n /** `FollowupsCompleted`: the suggested next prompts. */\n followups?: string[]\n\n images?: ImageData[]\n videos?: VideoData[]\n audio?: AudioData[]\n response_audio?: AudioData\n\n // workflow / step context\n step_name?: string\n step_index?: number | [number, number]\n iteration?: number\n max_iterations?: number\n\n // pause / human-in-the-loop\n requirements?: RunRequirement[]\n requires_confirmation?: boolean\n confirmation_message?: string\n requires_user_input?: boolean\n user_input_message?: string\n user_input_schema?: UserInputField[]\n available_choices?: string[]\n allow_multiple_selections?: boolean\n\n // error\n error?: string\n error_type?: string\n\n // model metrics\n model?: string\n model_provider?: string\n input_tokens?: number\n output_tokens?: number\n total_tokens?: number\n\n metrics?: Record<string, unknown>\n extra_data?: {\n reasoning_steps?: ReasoningStep[]\n references?: ReferenceData[]\n }\n\n // allow forward-compatible access to any other field\n [key: string]: unknown\n}\n\n/* ------------------------------------------------------------------ */\n/* Human-in-the-loop requirement */\n/* ------------------------------------------------------------------ */\n\nexport type PauseType = 'confirmation' | 'user_input' | 'user_feedback' | 'external_execution'\n\nexport interface RunRequirement {\n id: string\n tool_execution?: ToolExecution\n confirmation?: boolean\n confirmation_note?: string\n user_input_schema?: UserInputField[]\n external_execution_result?: string\n member_agent_id?: string\n member_agent_name?: string\n pause_type?: PauseType\n}\n\n/* ------------------------------------------------------------------ */\n/* Chat message (the accumulated, render-ready view of a run) */\n/* ------------------------------------------------------------------ */\n\nexport type ChatRole = 'user' | 'agent' | 'system'\n\nexport type ChatStatus = 'idle' | 'streaming' | 'paused' | 'completed' | 'error' | 'cancelled'\n\nexport type SubRunStatus = 'running' | 'completed' | 'error'\n\n/**\n * A nested run inside a team or workflow run — a team member's turn, or the\n * agent/team that executes a workflow step. Accumulated from events that carry\n * a `parent_run_id`.\n */\nexport interface SubRun {\n run_id: string\n kind: 'member' | 'executor'\n name?: string\n agent_id?: string\n content: string\n tool_calls?: ToolExecution[]\n status: SubRunStatus\n}\n\n/** A workflow step and its output, accumulated from `Step*` events. */\nexport interface WorkflowStep {\n key: string\n name?: string\n index?: number | [number, number]\n status: SubRunStatus\n content?: string\n error?: string\n}\n\nexport interface ChatMessage {\n id: string\n role: ChatRole\n content: string\n created_at: number\n\n /** Set while this message is being streamed. */\n streaming?: boolean\n /** Run-level status, set for agent messages. */\n status?: ChatStatus\n error?: string\n\n run_id?: string\n session_id?: string\n\n tool_calls?: ToolExecution[]\n reasoning_steps?: ReasoningStep[]\n references?: ReferenceData[]\n citations?: Citations\n\n /**\n * Suggested next prompts, when the agent was built with `followups=True`.\n * Rendered under the latest answer as \"Related questions\".\n */\n followups?: string[]\n\n images?: ImageData[]\n videos?: VideoData[]\n audio?: AudioData[]\n response_audio?: AudioData\n\n /** Live \"what is it doing right now\" label, e.g. \"Calling get_weather\". */\n activity?: string\n\n /** Pause requirements when the run is waiting for a human. */\n requirements?: RunRequirement[]\n\n /** Team member turns / workflow step executors (nested runs). */\n members?: SubRun[]\n\n /** Workflow steps and their outputs. */\n steps?: WorkflowStep[]\n\n /** Every raw event that contributed to this message, in order. */\n events?: RunEventData[]\n}\n\n/* ------------------------------------------------------------------ */\n/* Entities (agents / teams / workflows) and sessions */\n/* ------------------------------------------------------------------ */\n\nexport interface Model {\n name?: string\n model?: string\n provider?: string\n}\n\nexport type EntityType = 'agent' | 'team' | 'workflow'\n\nexport interface Entity {\n type: EntityType\n id: string\n name: string\n description?: string\n model?: Model\n db_id?: string\n}\n\nexport interface SessionEntry {\n session_id: string\n session_name?: string\n /** Unix seconds, Unix milliseconds, or an ISO date string, depending on the backend. */\n created_at: number | string\n updated_at?: number | string\n}\n\nexport interface Pagination {\n page: number\n limit: number\n total_pages: number\n total_count: number\n}\n\nexport interface SessionsResponse {\n data: SessionEntry[]\n meta?: Pagination\n}\n"]}
1
+ {"version":3,"sources":["../src/core/types.ts"],"names":["RunEvent","TeamRunEvent","WorkflowRunEvent"],"mappings":";AAYO,IAAK,QAAA,qBAAAA,SAAAA,KAAL;AACL,EAAAA,UAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,UAAA,YAAA,CAAA,GAAa,YAAA;AACb,EAAAA,UAAA,qBAAA,CAAA,GAAsB,qBAAA;AACtB,EAAAA,UAAA,wBAAA,CA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AAA,kBAAA,0BAAA,CAAA,GAA2B,0BAAA;AAC3B,EAAAA,kBAAA,4BAAA,CAAA,GAA6B,4BAAA;AAE7B,EAAAA,kBAAA,2BAAA,CAAA,GAA4B,2BAAA;AAC5B,EAAAA,kBAAA,6BAAA,CAAA,GAA8B,6BAAA;AAC9B,EAAAA,kBAAA,iBAAA,CAAA,GAAkB,iBAAA;AAElB,EAAAA,kBAAA,wBAAA,CAAA,GAAyB,wBAAA;AACzB,EAAAA,kBAAA,0BAAA,CAAA,GAA2B,0BAAA;AAC3B,EAAAA,kBAAA,cAAA,CAAA,GAAe,cAAA;AAEf,EAAAA,kBAAA,uBAAA,CAAA,GAAwB,uBAAA;AACxB,EAAAA,kBAAA,yBAAA,CAAA,GAA0B,yBAAA;AAnChB,EAAA,OAAAA,iBAAAA;AAAA,CAAA,EAAA,gBAAA,IAAA,EAAA","file":"chunk-5QKU7OPE.js","sourcesContent":["/**\n * Types for AgentOS run events, messages, and entities.\n *\n * These mirror the wire format emitted by Agno's AgentOS when streaming a run\n * for an agent, team, or workflow. Field names match the JSON sent on the wire.\n */\n\n/* ------------------------------------------------------------------ */\n/* Run event names */\n/* ------------------------------------------------------------------ */\n\n/** Agent run event names. */\nexport enum RunEvent {\n RunStarted = 'RunStarted',\n RunContent = 'RunContent',\n RunContentCompleted = 'RunContentCompleted',\n RunIntermediateContent = 'RunIntermediateContent',\n RunCompleted = 'RunCompleted',\n RunError = 'RunError',\n RunCancelled = 'RunCancelled',\n RunPaused = 'RunPaused',\n RunContinued = 'RunContinued',\n\n PreHookStarted = 'PreHookStarted',\n PreHookCompleted = 'PreHookCompleted',\n PostHookStarted = 'PostHookStarted',\n PostHookCompleted = 'PostHookCompleted',\n\n ToolCallStarted = 'ToolCallStarted',\n ToolCallCompleted = 'ToolCallCompleted',\n ToolCallError = 'ToolCallError',\n\n ReasoningStarted = 'ReasoningStarted',\n ReasoningStep = 'ReasoningStep',\n ReasoningContentDelta = 'ReasoningContentDelta',\n ReasoningCompleted = 'ReasoningCompleted',\n\n MemoryUpdateStarted = 'MemoryUpdateStarted',\n MemoryUpdateCompleted = 'MemoryUpdateCompleted',\n\n SessionSummaryStarted = 'SessionSummaryStarted',\n SessionSummaryCompleted = 'SessionSummaryCompleted',\n\n ParserModelResponseStarted = 'ParserModelResponseStarted',\n ParserModelResponseCompleted = 'ParserModelResponseCompleted',\n OutputModelResponseStarted = 'OutputModelResponseStarted',\n OutputModelResponseCompleted = 'OutputModelResponseCompleted',\n\n ModelRequestStarted = 'ModelRequestStarted',\n ModelRequestCompleted = 'ModelRequestCompleted',\n\n CompressionStarted = 'CompressionStarted',\n CompressionCompleted = 'CompressionCompleted',\n\n FollowupsStarted = 'FollowupsStarted',\n FollowupsCompleted = 'FollowupsCompleted',\n\n CustomEvent = 'CustomEvent',\n}\n\n/** Team run event names. */\nexport enum TeamRunEvent {\n TeamRunStarted = 'TeamRunStarted',\n TeamRunContent = 'TeamRunContent',\n TeamRunIntermediateContent = 'TeamRunIntermediateContent',\n TeamRunContentCompleted = 'TeamRunContentCompleted',\n TeamRunCompleted = 'TeamRunCompleted',\n TeamRunError = 'TeamRunError',\n TeamRunCancelled = 'TeamRunCancelled',\n TeamRunPaused = 'TeamRunPaused',\n TeamRunContinued = 'TeamRunContinued',\n\n TeamToolCallStarted = 'TeamToolCallStarted',\n TeamToolCallCompleted = 'TeamToolCallCompleted',\n TeamToolCallError = 'TeamToolCallError',\n\n TeamReasoningStarted = 'TeamReasoningStarted',\n TeamReasoningStep = 'TeamReasoningStep',\n TeamReasoningContentDelta = 'TeamReasoningContentDelta',\n TeamReasoningCompleted = 'TeamReasoningCompleted',\n\n TeamMemoryUpdateStarted = 'TeamMemoryUpdateStarted',\n TeamMemoryUpdateCompleted = 'TeamMemoryUpdateCompleted',\n\n TeamFollowupsStarted = 'TeamFollowupsStarted',\n TeamFollowupsCompleted = 'TeamFollowupsCompleted',\n\n TeamTaskIterationStarted = 'TeamTaskIterationStarted',\n TeamTaskIterationCompleted = 'TeamTaskIterationCompleted',\n TeamTaskStateUpdated = 'TeamTaskStateUpdated',\n TeamTaskCreated = 'TeamTaskCreated',\n TeamTaskUpdated = 'TeamTaskUpdated',\n}\n\n/** Workflow run event names. */\nexport enum WorkflowRunEvent {\n WorkflowStarted = 'WorkflowStarted',\n WorkflowCompleted = 'WorkflowCompleted',\n WorkflowPaused = 'WorkflowPaused',\n WorkflowCancelled = 'WorkflowCancelled',\n WorkflowError = 'WorkflowError',\n\n WorkflowAgentStarted = 'WorkflowAgentStarted',\n WorkflowAgentCompleted = 'WorkflowAgentCompleted',\n\n StepStarted = 'StepStarted',\n StepCompleted = 'StepCompleted',\n StepPaused = 'StepPaused',\n StepContinued = 'StepContinued',\n StepError = 'StepError',\n StepOutput = 'StepOutput',\n StepOutputReview = 'StepOutputReview',\n\n LoopExecutionStarted = 'LoopExecutionStarted',\n LoopIterationStarted = 'LoopIterationStarted',\n LoopIterationCompleted = 'LoopIterationCompleted',\n LoopExecutionCompleted = 'LoopExecutionCompleted',\n\n ParallelExecutionStarted = 'ParallelExecutionStarted',\n ParallelExecutionCompleted = 'ParallelExecutionCompleted',\n\n ConditionExecutionStarted = 'ConditionExecutionStarted',\n ConditionExecutionCompleted = 'ConditionExecutionCompleted',\n ConditionPaused = 'ConditionPaused',\n\n RouterExecutionStarted = 'RouterExecutionStarted',\n RouterExecutionCompleted = 'RouterExecutionCompleted',\n RouterPaused = 'RouterPaused',\n\n StepsExecutionStarted = 'StepsExecutionStarted',\n StepsExecutionCompleted = 'StepsExecutionCompleted',\n}\n\n/** Any run event name, across agents, teams and workflows. */\nexport type AnyRunEventName = RunEvent | TeamRunEvent | WorkflowRunEvent | string\n\n/* ------------------------------------------------------------------ */\n/* Tool calls */\n/* ------------------------------------------------------------------ */\n\nexport interface UserInputField {\n name: string\n field_type?: string\n description?: string\n value?: unknown\n}\n\nexport interface ToolExecution {\n tool_call_id?: string\n tool_name?: string\n tool_args?: Record<string, unknown>\n tool_call_error?: boolean\n result?: string\n metrics?: { time?: number }\n created_at?: number\n stop_after_tool_call?: boolean\n\n // Human-in-the-loop\n requires_confirmation?: boolean\n confirmed?: boolean\n confirmation_note?: string\n requires_user_input?: boolean\n user_input_schema?: UserInputField[]\n answered?: boolean\n external_execution_required?: boolean\n\n // present on a few content payloads under the legacy `role`/`content` shape\n role?: string\n content?: string | null\n}\n\n/* ------------------------------------------------------------------ */\n/* Reasoning, references, media */\n/* ------------------------------------------------------------------ */\n\nexport interface ReasoningStep {\n title?: string | null\n action?: string | null\n result?: string | null\n reasoning?: string | null\n confidence?: number | null\n next_action?: string | null\n}\n\nexport interface Reference {\n content: string\n name?: string\n meta_data?: Record<string, unknown>\n}\n\nexport interface ReferenceData {\n query: string\n references: Reference[]\n time?: number\n}\n\nexport interface ImageData {\n url?: string\n revised_prompt?: string\n content?: string\n}\n\nexport interface VideoData {\n id?: number | string\n url?: string\n eta?: number\n}\n\nexport interface AudioData {\n id?: string\n url?: string\n base64_audio?: string\n mime_type?: string\n content?: string\n transcript?: string\n channels?: number\n sample_rate?: number\n}\n\nexport interface Citations {\n raw?: unknown\n urls?: Array<{ url?: string; title?: string }>\n}\n\n/* ------------------------------------------------------------------ */\n/* The raw streamed event */\n/* ------------------------------------------------------------------ */\n\n/**\n * A single run event off the wire, normalised to a flat object. The `event`\n * field is the discriminator; other fields depend on the event type. This is a\n * permissive superset — most fields are optional and present only for the\n * events that carry them.\n */\nexport interface RunEventData {\n event: AnyRunEventName\n created_at?: number\n run_id?: string\n parent_run_id?: string\n session_id?: string\n agent_id?: string\n agent_name?: string\n team_id?: string\n team_name?: string\n workflow_id?: string\n workflow_name?: string\n\n content?: string | object | null\n content_type?: string\n reasoning_content?: string\n\n tool?: ToolExecution\n tools?: ToolExecution[]\n\n reasoning_steps?: ReasoningStep[]\n references?: ReferenceData[]\n citations?: Citations\n\n /** `FollowupsCompleted`: the suggested next prompts. */\n followups?: string[]\n\n images?: ImageData[]\n videos?: VideoData[]\n audio?: AudioData[]\n response_audio?: AudioData\n\n // workflow / step context\n step_name?: string\n step_index?: number | [number, number]\n iteration?: number\n max_iterations?: number\n\n // pause / human-in-the-loop\n requirements?: RunRequirement[]\n step_requirements?: StepRequirement[]\n requires_confirmation?: boolean\n confirmation_message?: string\n requires_user_input?: boolean\n user_input_message?: string\n user_input_schema?: UserInputField[]\n available_choices?: string[]\n allow_multiple_selections?: boolean\n\n // error\n error?: string\n error_type?: string\n\n // model metrics\n model?: string\n model_provider?: string\n input_tokens?: number\n output_tokens?: number\n total_tokens?: number\n\n metrics?: Record<string, unknown>\n extra_data?: {\n reasoning_steps?: ReasoningStep[]\n references?: ReferenceData[]\n }\n\n // allow forward-compatible access to any other field\n [key: string]: unknown\n}\n\n/* ------------------------------------------------------------------ */\n/* Human-in-the-loop requirement */\n/* ------------------------------------------------------------------ */\n\nexport type PauseType = 'confirmation' | 'user_input' | 'user_feedback' | 'external_execution'\n\nexport interface RunRequirement {\n id: string\n tool_execution?: ToolExecution\n confirmation?: boolean\n confirmation_note?: string\n user_input_schema?: UserInputField[]\n external_execution_result?: string\n member_agent_id?: string\n member_agent_name?: string\n member_run_id?: string\n pause_type?: PauseType\n}\n\nexport interface RunResolution {\n tools?: ToolExecution[]\n requirements?: RunRequirement[]\n stepRequirements?: unknown[]\n}\n\nexport interface StepRequirement {\n step_id: string\n step_name?: string\n requires_confirmation?: boolean\n confirmed?: boolean | null\n confirmation_message?: string\n [key: string]: unknown\n}\n\n/* ------------------------------------------------------------------ */\n/* Chat message (the accumulated, render-ready view of a run) */\n/* ------------------------------------------------------------------ */\n\nexport type ChatRole = 'user' | 'agent' | 'system'\n\nexport type ChatStatus = 'idle' | 'streaming' | 'paused' | 'completed' | 'error' | 'cancelled'\n\nexport type SubRunStatus = 'running' | 'completed' | 'error'\n\n/**\n * A nested run inside a team or workflow run — a team member's turn, or the\n * agent/team that executes a workflow step. Accumulated from events that carry\n * a `parent_run_id`.\n */\nexport interface SubRun {\n run_id: string\n kind: 'member' | 'executor'\n name?: string\n agent_id?: string\n content: string\n tool_calls?: ToolExecution[]\n status: SubRunStatus\n}\n\n/** A workflow step and its output, accumulated from `Step*` events. */\nexport interface WorkflowStep {\n key: string\n name?: string\n index?: number | [number, number]\n status: SubRunStatus\n content?: string\n error?: string\n}\n\nexport interface ChatMessage {\n id: string\n role: ChatRole\n content: string\n created_at: number\n\n /** Set while this message is being streamed. */\n streaming?: boolean\n /** Run-level status, set for agent messages. */\n status?: ChatStatus\n error?: string\n\n run_id?: string\n session_id?: string\n\n tool_calls?: ToolExecution[]\n reasoning_steps?: ReasoningStep[]\n references?: ReferenceData[]\n citations?: Citations\n\n /**\n * Suggested next prompts, when the agent was built with `followups=True`.\n * Rendered under the latest answer as \"Related questions\".\n */\n followups?: string[]\n\n images?: ImageData[]\n videos?: VideoData[]\n audio?: AudioData[]\n response_audio?: AudioData\n\n /** Live \"what is it doing right now\" label, e.g. \"Calling get_weather\". */\n activity?: string\n\n /** Pause requirements when the run is waiting for a human. */\n requirements?: RunRequirement[]\n step_requirements?: StepRequirement[]\n\n /** Team member turns / workflow step executors (nested runs). */\n members?: SubRun[]\n\n /** Workflow steps and their outputs. */\n steps?: WorkflowStep[]\n\n /** Every raw event that contributed to this message, in order. */\n events?: RunEventData[]\n}\n\n/* ------------------------------------------------------------------ */\n/* Entities (agents / teams / workflows) and sessions */\n/* ------------------------------------------------------------------ */\n\nexport interface Model {\n name?: string\n model?: string\n provider?: string\n}\n\nexport type EntityType = 'agent' | 'team' | 'workflow'\n\nexport interface Entity {\n type: EntityType\n id: string\n name: string\n description?: string\n model?: Model\n db_id?: string\n}\n\nexport interface SessionEntry {\n session_id: string\n session_name?: string\n /** Unix seconds, Unix milliseconds, or an ISO date string, depending on the backend. */\n created_at: number | string\n updated_at?: number | string\n}\n\nexport interface Pagination {\n page: number\n limit: number\n total_pages: number\n total_count: number\n}\n\nexport interface SessionsResponse {\n data: SessionEntry[]\n meta?: Pagination\n}\n"]}
@@ -53,7 +53,7 @@ function drainBuffer(buffer, onEvent) {
53
53
  start = buffer.indexOf("{", start + 1);
54
54
  continue;
55
55
  }
56
- buffer = buffer.slice(end + 1).trim();
56
+ buffer = buffer.slice(end + 1);
57
57
  start = buffer.indexOf("{");
58
58
  }
59
59
  return buffer;
@@ -242,6 +242,8 @@ var AgnoClient = class {
242
242
  if (args.userId) form.append("user_id", args.userId);
243
243
  if (args.type === "workflow") {
244
244
  if (args.stepRequirements) form.append("step_requirements", JSON.stringify(args.stepRequirements));
245
+ } else if (args.requirements) {
246
+ form.append("requirements", JSON.stringify(args.requirements));
245
247
  } else if (args.tools) {
246
248
  form.append("tools", JSON.stringify(args.tools));
247
249
  }
@@ -340,6 +342,22 @@ var isToolCompletedEvent = (e) => name(e) === "ToolCallCompleted" || name(e) ===
340
342
  var isToolEvent = (e) => isToolStartedEvent(e) || isToolCompletedEvent(e) || name(e) === "ToolCallError" || name(e) === "TeamToolCallError";
341
343
  var isReasoningStepEvent = (e) => name(e) === "ReasoningStep" || name(e) === "TeamReasoningStep";
342
344
  var isReasoningCompletedEvent = (e) => name(e) === "ReasoningCompleted" || name(e) === "TeamReasoningCompleted";
345
+ function reasoningStepsFromEvent(e) {
346
+ const legacy = e.reasoning_steps ?? e.extra_data?.reasoning_steps;
347
+ if (legacy?.length) return legacy;
348
+ if (!isReasoningStepEvent(e) && !isReasoningCompletedEvent(e)) return [];
349
+ const content = e.content;
350
+ if (!content || typeof content !== "object" || Array.isArray(content)) return [];
351
+ if ("reasoning_steps" in content && Array.isArray(content.reasoning_steps)) {
352
+ return content.reasoning_steps.filter(isReasoningStep);
353
+ }
354
+ return isReasoningStep(content) ? [content] : [];
355
+ }
356
+ function isReasoningStep(value) {
357
+ if (!value || typeof value !== "object" || Array.isArray(value)) return false;
358
+ const fields = ["title", "action", "result", "reasoning", "next_action"];
359
+ return fields.some((key) => typeof Reflect.get(value, key) === "string") && fields.every((key) => Reflect.get(value, key) == null || typeof Reflect.get(value, key) === "string") && (!("confidence" in value) || value.confidence == null || typeof value.confidence === "number");
360
+ }
343
361
  var isFollowupsCompletedEvent = (e) => name(e) === "FollowupsCompleted" || name(e) === "TeamFollowupsCompleted";
344
362
  function isSubRunEvent(e) {
345
363
  if (!e.parent_run_id) return false;
@@ -498,6 +516,6 @@ function mergeTool(list, tool) {
498
516
  return [...list, tool];
499
517
  }
500
518
 
501
- export { AgnoClient, activityLabel, applyContentEvent, applyStepEvent, applySubRunEvent, isCancelledEvent, isCompletedEvent, isContentEvent, isErrorEvent, isFollowupsCompletedEvent, isPausedEvent, isReasoningCompletedEvent, isReasoningStepEvent, isStartedEvent, isStepEvent, isSubRunEvent, isToolCompletedEvent, isToolEvent, mergeTool, normaliseBaseUrl, sessionRunsToMessages, streamRun, toolsFromEvent };
502
- //# sourceMappingURL=chunk-6V2YIPHF.js.map
503
- //# sourceMappingURL=chunk-6V2YIPHF.js.map
519
+ export { AgnoClient, activityLabel, applyContentEvent, applyStepEvent, applySubRunEvent, isCancelledEvent, isCompletedEvent, isContentEvent, isErrorEvent, isFollowupsCompletedEvent, isPausedEvent, isReasoningCompletedEvent, isReasoningStepEvent, isStartedEvent, isStepEvent, isSubRunEvent, isToolCompletedEvent, isToolEvent, mergeTool, normaliseBaseUrl, reasoningStepsFromEvent, sessionRunsToMessages, streamRun, toolsFromEvent };
520
+ //# sourceMappingURL=chunk-BCVKAMSO.js.map
521
+ //# sourceMappingURL=chunk-BCVKAMSO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/stream.ts","../src/core/client.ts","../src/core/session.ts","../src/core/events.ts"],"names":["id"],"mappings":";AA0BA,SAAS,WAAW,IAAA,EAAiC;AACnD,EAAA,OACE,OAAO,IAAA,KAAS,QAAA,IAChB,IAAA,KAAS,IAAA,IACT,OAAA,IAAW,IAAA,IACX,MAAA,IAAU,IAAA,IACV,OAAQ,IAAA,CAAkB,KAAA,KAAU,QAAA;AAExC;AAEA,SAAS,YAAY,IAAA,EAAoC;AACvD,EAAA,OACE,OAAO,IAAA,KAAS,QA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AA,IAAK,MAAA,CAAO,cAAc,OAAO,CAAA;AACjE,IAAA,IAAI,OAAA,OAAc,OAAA,GAAU,OAAA;AAAA,EAC9B;AAEA,EAAA,IAAI,GAAA,IAAO,CAAA,EAAG,KAAA,CAAM,GAAG,CAAA,GAAI,IAAA;AAAA,OACtB,KAAA,CAAM,KAAK,IAAI,CAAA;AACpB,EAAA,OAAO,EAAE,GAAG,OAAA,EAAS,KAAA,EAAM;AAC7B;AAGO,SAAS,SAAA,CAAU,MAAuB,IAAA,EAAsC;AACrF,EAAA,MAAM,GAAA,GAAM,KAAK,YAAA,IAAgB,CAAA,EAAG,KAAK,SAAS,CAAA,CAAA,EAAI,KAAK,UAAU,CAAA,CAAA;AACrE,EAAA,MAAM,GAAA,GAAM,IAAA,CAAK,SAAA,CAAU,CAAC,CAAA,KAAM;AAChC,IAAA,IAAI,EAAE,YAAA,IAAgB,IAAA,CAAK,cAAc,OAAO,CAAA,CAAE,iBAAiB,IAAA,CAAK,YAAA;AACxE,IAAA,OAAO,GAAG,CAAA,CAAE,SAAS,CAAA,CAAA,EAAI,CAAA,CAAE,UAAU,CAAA,CAAA,KAAO,GAAA;AAAA,EAC9C,CAAC,CAAA;AACD,EAAA,IAAI,OAAO,CAAA,EAAG;AACZ,IAAA,MAAM,IAAA,GAAO,CAAC,GAAG,IAAI,CAAA;AACrB,IAAA,IAAA,CAAK,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAA,EAAG,GAAG,IAAA,EAAK;AACpC,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,OAAO,CAAC,GAAG,IAAA,EAAM,IAAI,CAAA;AACvB","file":"chunk-BCVKAMSO.js","sourcesContent":["/**\n * Streaming parser for AgentOS run endpoints.\n *\n * AgentOS streams a run as a sequence of JSON objects concatenated on the wire\n * (not strictly newline-delimited). Each object is one \"run event\". This module\n * reads the response body incrementally, extracts complete JSON objects as they\n * arrive, and hands each one to a callback.\n *\n * It supports both the legacy shape (the event object sent directly) and the\n * newer envelope shape ({ event: string, data: string | object }), normalising\n * both into a flat event object with an `event` discriminator field.\n */\n\nimport type { RunEvent } from './types'\n\n/** A parsed, normalised run event. Shape varies by `event` type — see types.ts. */\nexport interface StreamEvent {\n event: RunEvent | string\n [key: string]: unknown\n}\n\ninterface Envelope {\n event: string\n data: string | Record<string, unknown>\n}\n\nfunction isEnvelope(data: unknown): data is Envelope {\n return (\n typeof data === 'object' &&\n data !== null &&\n 'event' in data &&\n 'data' in data &&\n typeof (data as Envelope).event === 'string'\n )\n}\n\nfunction isFlatEvent(data: unknown): data is StreamEvent {\n return (\n typeof data === 'object' &&\n data !== null &&\n 'event' in data &&\n !('data' in data) &&\n typeof (data as StreamEvent).event === 'string'\n )\n}\n\nfunction normaliseEnvelope(env: Envelope): StreamEvent {\n let parsed: Record<string, unknown> = {}\n if (typeof env.data === 'string') {\n try {\n parsed = JSON.parse(env.data)\n } catch {\n parsed = {}\n }\n } else if (env.data && typeof env.data === 'object') {\n parsed = env.data\n }\n return { event: env.event, ...parsed }\n}\n\n/**\n * Pulls every complete JSON object out of `buffer`, emitting each via `onEvent`.\n * Returns the unconsumed tail (a partial object awaiting more bytes).\n */\nfunction drainBuffer(buffer: string, onEvent: (e: StreamEvent) => void): string {\n let start = buffer.indexOf('{')\n\n while (start !== -1 && start < buffer.length) {\n let depth = 0\n let inString = false\n let escape = false\n let end = -1\n\n for (let i = start; i < buffer.length; i++) {\n const ch = buffer[i]\n if (inString) {\n if (escape) escape = false\n else if (ch === '\\\\') escape = true\n else if (ch === '\"') inString = false\n } else if (ch === '\"') {\n inString = true\n } else if (ch === '{') {\n depth++\n } else if (ch === '}') {\n depth--\n if (depth === 0) {\n end = i\n break\n }\n }\n }\n\n if (end === -1) break // incomplete object; wait for more data\n\n const slice = buffer.slice(start, end + 1)\n try {\n const parsed = JSON.parse(slice)\n if (isEnvelope(parsed)) onEvent(normaliseEnvelope(parsed))\n else if (isFlatEvent(parsed)) onEvent(parsed)\n } catch {\n // Not valid JSON despite balanced braces — skip this opening brace.\n start = buffer.indexOf('{', start + 1)\n continue\n }\n\n // The tail may end inside a JSON string. Trimming it would delete content\n // whitespace when a network read splits the next event in the middle.\n buffer = buffer.slice(end + 1)\n start = buffer.indexOf('{')\n }\n\n return buffer\n}\n\nexport interface StreamRunOptions {\n url: string\n body: FormData | Record<string, unknown>\n headers?: Record<string, string>\n signal?: AbortSignal\n onEvent: (event: StreamEvent) => void\n onError: (error: Error) => void\n onComplete: () => void\n}\n\n/**\n * POSTs a run request and streams the response, calling `onEvent` for every\n * run event as it arrives. Resolves when the stream ends.\n */\nexport async function streamRun(options: StreamRunOptions): Promise<void> {\n const { url, body, headers = {}, signal, onEvent, onError, onComplete } = options\n let buffer = ''\n\n try {\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n ...(!(body instanceof FormData) && { 'Content-Type': 'application/json' }),\n ...headers,\n },\n body: body instanceof FormData ? body : JSON.stringify(body),\n signal,\n })\n\n if (!response.ok) {\n let detail: string\n try {\n const err = await response.json()\n detail = err?.detail ? String(err.detail) : `${response.status} ${response.statusText}`\n } catch {\n detail = `${response.status} ${response.statusText}`\n }\n throw new Error(detail)\n }\n if (!response.body) throw new Error('No response body')\n\n const reader = response.body.getReader()\n const decoder = new TextDecoder()\n\n for (;;) {\n const { done, value } = await reader.read()\n if (done) {\n buffer = drainBuffer(buffer, onEvent)\n onComplete()\n return\n }\n buffer += decoder.decode(value, { stream: true })\n buffer = drainBuffer(buffer, onEvent)\n }\n } catch (error) {\n if (error instanceof DOMException && error.name === 'AbortError') {\n onComplete()\n return\n }\n onError(error instanceof Error ? error : new Error(String(error)))\n }\n}\n","/**\n * Thin client for an AgentOS HTTP backend.\n *\n * Wraps the discovery, run, continue, cancel and session endpoints. Streaming\n * runs are handled by `streamRun` from ./stream; everything else is plain JSON.\n */\n\nimport { streamRun, type StreamEvent } from './stream'\nimport type {\n Entity,\n EntityType,\n RunEventData,\n RunResolution,\n SessionsResponse,\n} from './types'\n\n/** Normalise a base URL: add a scheme for bare hosts, strip trailing slash. */\nexport function normaliseBaseUrl(value: string | null | undefined): string {\n if (!value) return ''\n let url = value.trim()\n if (!/^https?:\\/\\//.test(url)) {\n const isLocal = url.startsWith('localhost') || /^\\d{1,3}(\\.\\d{1,3}){3}/.test(url)\n url = `${isLocal ? 'http' : 'https'}://${url}`\n }\n return url.replace(/\\/+$/, '')\n}\n\nexport interface AgnoClientOptions {\n /** AgentOS base URL, e.g. \"http://localhost:7777\". */\n baseUrl: string\n /** Optional headers (e.g. Authorization) added to every request. */\n headers?: Record<string, string>\n /** Default db_id used for session listing where the backend requires it. */\n dbId?: string\n}\n\ninterface RunArgs {\n type: EntityType\n id: string\n message?: string\n sessionId?: string\n userId?: string\n files?: File[]\n /** Extra form fields appended verbatim. */\n extra?: Record<string, string>\n signal?: AbortSignal\n onEvent: (event: RunEventData) => void\n onError: (error: Error) => void\n onComplete: () => void\n}\n\ninterface ContinueArgs extends RunResolution {\n type: EntityType\n id: string\n runId: string\n sessionId?: string\n userId?: string\n signal?: AbortSignal\n onEvent: (event: RunEventData) => void\n onError: (error: Error) => void\n onComplete: () => void\n}\n\nconst RUN_PATH: Record<EntityType, string> = {\n agent: 'agents',\n team: 'teams',\n workflow: 'workflows',\n}\n\nexport class AgnoClient {\n readonly baseUrl: string\n readonly headers: Record<string, string>\n readonly dbId?: string\n\n constructor(options: AgnoClientOptions) {\n this.baseUrl = normaliseBaseUrl(options.baseUrl)\n this.headers = options.headers ?? {}\n this.dbId = options.dbId\n }\n\n private async getJson<T>(path: string): Promise<T> {\n const res = await fetch(`${this.baseUrl}${path}`, { headers: this.headers })\n if (!res.ok) throw new Error(`GET ${path} failed: ${res.status} ${res.statusText}`)\n return res.json() as Promise<T>\n }\n\n /** Liveness check against /health. Returns the HTTP status code. */\n async health(): Promise<number> {\n try {\n const res = await fetch(`${this.baseUrl}/health`, { headers: this.headers })\n return res.status\n } catch {\n return 0\n }\n }\n\n /* ----------------------------- discovery ----------------------------- */\n\n async getAgents(): Promise<Entity[]> {\n const data = await this.getJson<any[]>('/agents').catch(() => [])\n return data.map((a) => ({\n type: 'agent' as const,\n id: a.agent_id ?? a.id,\n name: a.name ?? a.agent_id ?? a.id,\n description: a.description,\n model: a.model,\n db_id: a.db_id,\n }))\n }\n\n async getTeams(): Promise<Entity[]> {\n const data = await this.getJson<any[]>('/teams').catch(() => [])\n return data.map((t) => ({\n type: 'team' as const,\n id: t.team_id ?? t.id,\n name: t.name ?? t.team_id ?? t.id,\n description: t.description,\n model: t.model,\n db_id: t.db_id,\n }))\n }\n\n async getWorkflows(): Promise<Entity[]> {\n const data = await this.getJson<any[]>('/workflows').catch(() => [])\n return data.map((w) => ({\n type: 'workflow' as const,\n id: w.workflow_id ?? w.id,\n name: w.name ?? w.workflow_id ?? w.id,\n description: w.description,\n model: w.model,\n db_id: w.db_id,\n }))\n }\n\n /** All runnable entities (agents, teams, workflows) in one list. */\n async getEntities(): Promise<Entity[]> {\n const [agents, teams, workflows] = await Promise.all([\n this.getAgents(),\n this.getTeams(),\n this.getWorkflows(),\n ])\n return [...agents, ...teams, ...workflows]\n }\n\n /* ------------------------------ sessions ----------------------------- */\n\n async getSessions(type: EntityType, componentId: string, dbId?: string): Promise<SessionsResponse> {\n const url = new URL(`${this.baseUrl}/sessions`)\n url.searchParams.set('type', type)\n url.searchParams.set('component_id', componentId)\n const db = dbId ?? this.dbId\n if (db) url.searchParams.set('db_id', db)\n try {\n const res = await fetch(url.toString(), { headers: this.headers })\n if (!res.ok) return { data: [] }\n return (await res.json()) as SessionsResponse\n } catch {\n return { data: [] }\n }\n }\n\n /** Runs (with messages/tools/events) for a session — used to rehydrate chat history. */\n async getSessionRuns(type: EntityType, sessionId: string, dbId?: string): Promise<any[]> {\n const url = new URL(`${this.baseUrl}/sessions/${sessionId}/runs`)\n url.searchParams.set('type', type)\n const db = dbId ?? this.dbId\n if (db) url.searchParams.set('db_id', db)\n const res = await fetch(url.toString(), { headers: this.headers })\n if (!res.ok) throw new Error(`Failed to load session: ${res.statusText}`)\n return res.json()\n }\n\n async deleteSession(sessionId: string, dbId?: string): Promise<boolean> {\n const url = new URL(`${this.baseUrl}/sessions/${sessionId}`)\n const db = dbId ?? this.dbId\n if (db) url.searchParams.set('db_id', db)\n const res = await fetch(url.toString(), { method: 'DELETE', headers: this.headers })\n return res.ok\n }\n\n /* -------------------------------- runs ------------------------------- */\n\n /** Start a streaming run for an agent, team or workflow. */\n async run(args: RunArgs): Promise<void> {\n const form = new FormData()\n if (args.message != null) form.append('message', args.message)\n form.append('stream', 'true')\n if (args.sessionId) form.append('session_id', args.sessionId)\n if (args.userId) form.append('user_id', args.userId)\n for (const file of args.files ?? []) form.append('files', file)\n for (const [k, v] of Object.entries(args.extra ?? {})) form.append(k, v)\n\n const url = `${this.baseUrl}/${RUN_PATH[args.type]}/${args.id}/runs`\n return streamRun({\n url,\n body: form,\n headers: this.headers,\n signal: args.signal,\n onEvent: (e) => args.onEvent(e as RunEventData),\n onError: args.onError,\n onComplete: args.onComplete,\n })\n }\n\n /** Continue a paused run (resolving a human-in-the-loop requirement). */\n async continueRun(args: ContinueArgs): Promise<void> {\n const form = new FormData()\n form.append('stream', 'true')\n if (args.sessionId) form.append('session_id', args.sessionId)\n if (args.userId) form.append('user_id', args.userId)\n\n if (args.type === 'workflow') {\n if (args.stepRequirements) form.append('step_requirements', JSON.stringify(args.stepRequirements))\n } else if (args.requirements) {\n form.append('requirements', JSON.stringify(args.requirements))\n } else if (args.tools) {\n form.append('tools', JSON.stringify(args.tools))\n }\n\n const url = `${this.baseUrl}/${RUN_PATH[args.type]}/${args.id}/runs/${args.runId}/continue`\n return streamRun({\n url,\n body: form,\n headers: this.headers,\n signal: args.signal,\n onEvent: (e) => args.onEvent(e as RunEventData),\n onError: args.onError,\n onComplete: args.onComplete,\n })\n }\n\n /** Cancel an in-flight run. */\n async cancelRun(type: EntityType, id: string, runId: string, sessionId?: string): Promise<boolean> {\n const url = new URL(`${this.baseUrl}/${RUN_PATH[type]}/${id}/runs/${runId}/cancel`)\n if (sessionId) url.searchParams.set('session_id', sessionId)\n try {\n const res = await fetch(url.toString(), { method: 'POST', headers: this.headers })\n return res.ok\n } catch {\n return false\n }\n }\n}\n\nexport type { StreamEvent }\n","/**\n * Helpers for turning AgentOS session history into render-ready chat messages.\n *\n * `GET /sessions/{id}/runs` returns an array of run records. Each run carries\n * the user input plus the agent's content, tools, reasoning, references and\n * media — enough to reconstruct the transcript for a past session.\n */\n\nimport type { ChatMessage, ReasoningStep, ReferenceData, RunEventData, ToolExecution } from './types'\n\ninterface SessionRun {\n run_id?: string\n session_id?: string\n run_input?: unknown\n content?: unknown\n created_at?: number\n status?: string\n /** Present when the agent was configured with `store_events`. */\n events?: RunEventData[]\n tools?: ToolExecution[]\n images?: ChatMessage['images']\n videos?: ChatMessage['videos']\n audio?: ChatMessage['audio']\n response_audio?: ChatMessage['response_audio']\n extra_data?: {\n reasoning_steps?: ReasoningStep[]\n references?: ReferenceData[]\n }\n reasoning_steps?: ReasoningStep[]\n references?: ReferenceData[]\n followups?: string[]\n}\n\nfunction toText(value: unknown): string {\n if (value == null) return ''\n if (typeof value === 'string') return value\n // Some inputs/outputs arrive as content-part arrays or objects.\n if (Array.isArray(value)) {\n return value\n .map((part) =>\n part && typeof part === 'object' && 'text' in part ? String((part as { text: unknown }).text) : '',\n )\n .filter(Boolean)\n .join(' ')\n }\n if (typeof value === 'object') {\n const obj = value as Record<string, unknown>\n if (typeof obj.input_content === 'string') return obj.input_content\n if (typeof obj.message === 'string') return obj.message\n if (typeof obj.content === 'string') return obj.content\n return '```json\\n' + JSON.stringify(value, null, 2) + '\\n```'\n }\n return String(value)\n}\n\nlet seq = 0\nconst id = (prefix: string) => `${prefix}-${seq++}`\n\n/** Convert the runs of a session into an ordered list of chat messages. */\nexport function sessionRunsToMessages(runs: SessionRun[]): ChatMessage[] {\n if (!Array.isArray(runs)) return []\n const messages: ChatMessage[] = []\n\n for (const run of runs) {\n const created = run.created_at ?? Math.floor(Date.now() / 1000)\n\n const userContent = toText(run.run_input)\n if (userContent) {\n messages.push({\n id: id('hist-u'),\n role: 'user',\n content: userContent,\n created_at: created,\n })\n }\n\n messages.push({\n id: id('hist-a'),\n role: 'agent',\n content: toText(run.content),\n created_at: created,\n status: 'completed',\n run_id: run.run_id,\n session_id: run.session_id,\n tool_calls: run.tools && run.tools.length ? run.tools : undefined,\n // Stored events let the behind-the-scenes panel look the same in history\n // as it does live.\n events: run.events && run.events.length ? run.events : undefined,\n reasoning_steps: run.reasoning_steps ?? run.extra_data?.reasoning_steps,\n references: run.references ?? run.extra_data?.references,\n followups: run.followups && run.followups.length ? run.followups : undefined,\n images: run.images,\n videos: run.videos,\n audio: run.audio,\n response_audio: run.response_audio,\n })\n }\n\n return messages\n}\n","/**\n * Helpers for classifying run events and turning them into UI labels.\n *\n * Agent, team and workflow events share shapes but use different name prefixes\n * (e.g. `RunContent` vs `TeamRunContent`). These helpers let the rest of the\n * library treat them uniformly.\n */\n\nimport type { ChatMessage, ReasoningStep, RunEventData, SubRun, ToolExecution, WorkflowStep } from './types'\n\nconst name = (e: RunEventData): string => String(e.event ?? '')\n\nexport const isStartedEvent = (e: RunEventData): boolean =>\n name(e) === 'RunStarted' ||\n name(e) === 'TeamRunStarted' ||\n name(e) === 'WorkflowStarted' ||\n name(e) === 'ReasoningStarted' ||\n name(e) === 'TeamReasoningStarted'\n\nexport const isContentEvent = (e: RunEventData): boolean =>\n name(e) === 'RunContent' || name(e) === 'TeamRunContent' || name(e) === 'WorkflowAgentCompleted'\n\nexport const isContentCompletedEvent = (e: RunEventData): boolean =>\n name(e) === 'RunContentCompleted' || name(e) === 'TeamRunContentCompleted'\n\nexport const isCompletedEvent = (e: RunEventData): boolean =>\n name(e) === 'RunCompleted' ||\n name(e) === 'TeamRunCompleted' ||\n name(e) === 'WorkflowCompleted'\n\nexport const isErrorEvent = (e: RunEventData): boolean =>\n name(e) === 'RunError' ||\n name(e) === 'TeamRunError' ||\n name(e) === 'WorkflowError' ||\n name(e) === 'StepError' ||\n name(e) === 'ToolCallError' ||\n name(e) === 'TeamToolCallError'\n\nexport const isCancelledEvent = (e: RunEventData): boolean =>\n name(e) === 'RunCancelled' ||\n name(e) === 'TeamRunCancelled' ||\n name(e) === 'WorkflowCancelled'\n\nexport const isPausedEvent = (e: RunEventData): boolean =>\n name(e) === 'RunPaused' ||\n name(e) === 'TeamRunPaused' ||\n name(e) === 'WorkflowPaused' ||\n name(e) === 'StepPaused' ||\n name(e) === 'RouterPaused' ||\n name(e) === 'ConditionPaused'\n\nexport const isToolStartedEvent = (e: RunEventData): boolean =>\n name(e) === 'ToolCallStarted' || name(e) === 'TeamToolCallStarted'\n\nexport const isToolCompletedEvent = (e: RunEventData): boolean =>\n name(e) === 'ToolCallCompleted' || name(e) === 'TeamToolCallCompleted'\n\nexport const isToolEvent = (e: RunEventData): boolean =>\n isToolStartedEvent(e) || isToolCompletedEvent(e) || name(e) === 'ToolCallError' || name(e) === 'TeamToolCallError'\n\nexport const isReasoningStepEvent = (e: RunEventData): boolean =>\n name(e) === 'ReasoningStep' || name(e) === 'TeamReasoningStep'\n\nexport const isReasoningCompletedEvent = (e: RunEventData): boolean =>\n name(e) === 'ReasoningCompleted' || name(e) === 'TeamReasoningCompleted'\n\n/** Read both legacy fields and the SDK's typed reasoning event content. */\nexport function reasoningStepsFromEvent(e: RunEventData): ReasoningStep[] {\n const legacy = e.reasoning_steps ?? e.extra_data?.reasoning_steps\n if (legacy?.length) return legacy\n if (!isReasoningStepEvent(e) && !isReasoningCompletedEvent(e)) return []\n const content = e.content\n if (!content || typeof content !== 'object' || Array.isArray(content)) return []\n if ('reasoning_steps' in content && Array.isArray(content.reasoning_steps)) {\n return content.reasoning_steps.filter(isReasoningStep)\n }\n return isReasoningStep(content) ? [content] : []\n}\n\nfunction isReasoningStep(value: unknown): value is ReasoningStep {\n if (!value || typeof value !== 'object' || Array.isArray(value)) return false\n const fields = ['title', 'action', 'result', 'reasoning', 'next_action']\n return fields.some((key) => typeof Reflect.get(value, key) === 'string') &&\n fields.every((key) => Reflect.get(value, key) == null || typeof Reflect.get(value, key) === 'string') &&\n (!('confidence' in value) || value.confidence == null || typeof value.confidence === 'number')\n}\n\n/** The follow-up prompts an agent built with `followups=True` suggests. */\nexport const isFollowupsCompletedEvent = (e: RunEventData): boolean =>\n name(e) === 'FollowupsCompleted' || name(e) === 'TeamFollowupsCompleted'\n\n/**\n * A nested-run event — a team member's turn or a workflow step executor.\n * Identified by a `parent_run_id` on an agent/team content/tool/run event.\n */\nexport function isSubRunEvent(e: RunEventData): boolean {\n if (!e.parent_run_id) return false\n const ev = name(e)\n return (\n isContentEvent(e) ||\n isToolEvent(e) ||\n isCompletedEvent(e) ||\n isErrorEvent(e) ||\n ev === 'RunStarted' ||\n ev === 'TeamRunStarted'\n )\n}\n\n/** A workflow step lifecycle event (start / output / complete / error). */\nexport function isStepEvent(e: RunEventData): boolean {\n const ev = name(e)\n return ev === 'StepStarted' || ev === 'StepCompleted' || ev === 'StepOutput' || ev === 'StepError'\n}\n\n/** Tool executions carried by an event, from either the single or array field. */\nexport function toolsFromEvent(e: RunEventData): ToolExecution[] {\n const out: ToolExecution[] = []\n if (e.tool) out.push(e.tool)\n if (Array.isArray(e.tools)) out.push(...e.tools)\n return out\n}\n\n/** Apply a content chunk and its related metadata to a message. */\nexport function applyContentEvent(message: ChatMessage, e: RunEventData): ChatMessage {\n const next: ChatMessage = { ...message }\n\n if (typeof e.content === 'string' && e.content) {\n next.content = message.content + e.content\n } else if (e.content && typeof e.content === 'object') {\n next.content = message.content + '\\n```json\\n' + JSON.stringify(e.content, null, 2) + '\\n```\\n'\n }\n\n if (e.reasoning_steps?.length) next.reasoning_steps = e.reasoning_steps\n if (e.extra_data?.reasoning_steps?.length) next.reasoning_steps = e.extra_data.reasoning_steps\n if (e.references?.length) next.references = e.references\n if (e.extra_data?.references?.length) next.references = e.extra_data.references\n if (e.citations) next.citations = e.citations\n\n const tools = toolsFromEvent(e)\n if (tools.length) {\n let toolCalls = message.tool_calls ?? []\n for (const tool of tools) toolCalls = mergeTool(toolCalls, tool)\n next.tool_calls = toolCalls\n }\n\n if (e.images?.length) next.images = e.images\n if (e.videos?.length) next.videos = e.videos\n if (e.audio?.length) next.audio = e.audio\n if (e.response_audio?.transcript) {\n next.response_audio = {\n ...message.response_audio,\n transcript: (message.response_audio?.transcript ?? '') + e.response_audio.transcript,\n }\n }\n\n return next\n}\n\n/**\n * A short human-readable label describing what a run is doing at the moment of\n * this event — for a live status line (\"Calling get_weather\", \"Reasoning…\").\n * Returns null for events that don't warrant a status change.\n */\nexport function activityLabel(e: RunEventData): string | null {\n const ev = name(e)\n switch (ev) {\n case 'RunStarted':\n case 'TeamRunStarted':\n case 'WorkflowStarted':\n return 'Thinking'\n case 'ModelRequestStarted':\n case 'TeamModelRequestStarted':\n return 'Generating'\n case 'ReasoningStarted':\n case 'TeamReasoningStarted':\n case 'ReasoningStep':\n case 'TeamReasoningStep':\n case 'ReasoningContentDelta':\n case 'TeamReasoningContentDelta':\n return 'Reasoning'\n case 'MemoryUpdateStarted':\n case 'TeamMemoryUpdateStarted':\n return 'Updating memory'\n case 'SessionSummaryStarted':\n case 'TeamSessionSummaryStarted':\n return 'Summarising session'\n case 'CompressionStarted':\n return 'Compressing context'\n case 'ToolCallStarted':\n case 'TeamToolCallStarted': {\n const tool = e.tool?.tool_name\n return tool ? `Calling ${tool}` : 'Calling tool'\n }\n case 'ToolCallCompleted':\n case 'TeamToolCallCompleted':\n return 'Generating'\n case 'StepStarted':\n return e.step_name ? `Running step: ${e.step_name}` : 'Running step'\n case 'LoopIterationStarted':\n return `Loop iteration ${e.iteration ?? ''}`.trim()\n case 'ParallelExecutionStarted':\n return 'Running parallel steps'\n case 'RouterExecutionStarted':\n return 'Routing'\n case 'ConditionExecutionStarted':\n return 'Evaluating condition'\n default:\n return null\n }\n}\n\nfunction textOf(value: unknown): string | undefined {\n if (typeof value === 'string') return value\n if (value && typeof value === 'object') return '```json\\n' + JSON.stringify(value, null, 2) + '\\n```'\n return undefined\n}\n\n/** Apply a nested member/executor run event into a message's `members`. */\nexport function applySubRunEvent(\n message: ChatMessage,\n e: RunEventData,\n kind: SubRun['kind'],\n): ChatMessage {\n const rid = e.run_id || e.parent_run_id || 'sub'\n const members = message.members ? [...message.members] : []\n const idx = members.findIndex((s) => s.run_id === rid)\n const base: SubRun = idx >= 0 ? { ...members[idx] } : { run_id: rid, kind, content: '', status: 'running' }\n\n base.name = base.name || (e.agent_name as string) || (e.team_name as string) || (e.agent_id as string)\n\n const tools = toolsFromEvent(e)\n if (tools.length) {\n let tc = base.tool_calls ?? []\n for (const t of tools) tc = mergeTool(tc, t)\n base.tool_calls = tc\n }\n\n if (isErrorEvent(e)) {\n base.status = 'error'\n } else if (isCompletedEvent(e)) {\n base.status = 'completed'\n const final = textOf(e.content)\n if (final) base.content = final\n } else if (isContentEvent(e)) {\n const delta = typeof e.content === 'string' ? e.content : ''\n if (delta) base.content += delta\n }\n\n if (idx >= 0) members[idx] = base\n else members.push(base)\n return { ...message, members }\n}\n\n/** Apply a workflow `Step*` event into a message's `steps`. */\nexport function applyStepEvent(message: ChatMessage, e: RunEventData): ChatMessage {\n const ev = name(e)\n const key = (e.step_name as string) || `step-${JSON.stringify(e.step_index ?? '')}`\n const steps = message.steps ? [...message.steps] : []\n const idx = steps.findIndex((s) => s.key === key)\n const step: WorkflowStep =\n idx >= 0\n ? { ...steps[idx] }\n : { key, name: e.step_name, index: e.step_index, status: 'running' }\n\n if (ev === 'StepStarted') {\n step.status = 'running'\n } else if (ev === 'StepError') {\n step.status = 'error'\n step.error = e.error || (typeof e.content === 'string' ? e.content : undefined)\n } else {\n // StepCompleted / StepOutput\n step.status = 'completed'\n const stepResponse = (e.step_response ?? e.step_output) as { content?: unknown } | undefined\n const content = textOf(e.content) ?? textOf(stepResponse?.content)\n if (content) step.content = content\n }\n\n if (idx >= 0) steps[idx] = step\n else steps.push(step)\n return { ...message, steps }\n}\n\n/** Merge a tool execution into a list, updating an existing entry by id/name. */\nexport function mergeTool(list: ToolExecution[], tool: ToolExecution): ToolExecution[] {\n const key = tool.tool_call_id || `${tool.tool_name}-${tool.created_at}`\n const idx = list.findIndex((t) => {\n if (t.tool_call_id && tool.tool_call_id) return t.tool_call_id === tool.tool_call_id\n return `${t.tool_name}-${t.created_at}` === key\n })\n if (idx >= 0) {\n const next = [...list]\n next[idx] = { ...next[idx], ...tool }\n return next\n }\n return [...list, tool]\n}\n"]}