@agno-hq/chat-react 0.1.1 → 0.3.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.
@@ -0,0 +1,5 @@
1
+ 'use client';
2
+ export { AgnoChat, AgnoMark, ArrowUp, BehindTheScenes, BookOpen, Box, Brain, ChatBubble, ChatInput, ChatLauncher, ChatProvider, ChatWindow, Check, ChevronDown, Citations, Close, Copy, EntityBadge, EntitySelector, EventLog, Favicon, FileAudio, FileIcon, FilePreview, FileVideo, Followups, Globe, GridLoader, HoverPreview, HumanInput, LinkPreviewCard, Markdown, MemberResponses, Memory, Message, MessageList, Multimedia, Paperclip, Plus, Pulse, QuickPrompts, Reasoning, Rerun, SessionList, SourceCard, SourcesProvider, Spinner, StatusIndicator, Stop, TeamGlyph, ToolCalls, Trash, WorkflowSteps, Wrench, behindTheScenesItems, behindTheScenesLabel, collectSources, displayUrl, faviconUrl, getProviderIcon, hasBehindTheScenes, linkCitations, normalizeFollowups, quickPromptLabel, quickPromptText, sourceHost, sourcesFromMarkdown, useAgnoChat, useChatContext, useLinkPreview, useOptionalChatContext, useResolvedChat, useResolvedClassNames, useSources, withoutSourcesLine, writeClipboard } from '../chunk-MUOMZG4V.js';
3
+ import '../chunk-62IEW2HM.js';
4
+ //# sourceMappingURL=index.js.map
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,106 @@
1
+ 'use strict';
2
+
3
+ // src/core/types.ts
4
+ var RunEvent = /* @__PURE__ */ ((RunEvent2) => {
5
+ RunEvent2["RunStarted"] = "RunStarted";
6
+ RunEvent2["RunContent"] = "RunContent";
7
+ RunEvent2["RunContentCompleted"] = "RunContentCompleted";
8
+ RunEvent2["RunIntermediateContent"] = "RunIntermediateContent";
9
+ RunEvent2["RunCompleted"] = "RunCompleted";
10
+ RunEvent2["RunError"] = "RunError";
11
+ RunEvent2["RunCancelled"] = "RunCancelled";
12
+ RunEvent2["RunPaused"] = "RunPaused";
13
+ RunEvent2["RunContinued"] = "RunContinued";
14
+ RunEvent2["PreHookStarted"] = "PreHookStarted";
15
+ RunEvent2["PreHookCompleted"] = "PreHookCompleted";
16
+ RunEvent2["PostHookStarted"] = "PostHookStarted";
17
+ RunEvent2["PostHookCompleted"] = "PostHookCompleted";
18
+ RunEvent2["ToolCallStarted"] = "ToolCallStarted";
19
+ RunEvent2["ToolCallCompleted"] = "ToolCallCompleted";
20
+ RunEvent2["ToolCallError"] = "ToolCallError";
21
+ RunEvent2["ReasoningStarted"] = "ReasoningStarted";
22
+ RunEvent2["ReasoningStep"] = "ReasoningStep";
23
+ RunEvent2["ReasoningContentDelta"] = "ReasoningContentDelta";
24
+ RunEvent2["ReasoningCompleted"] = "ReasoningCompleted";
25
+ RunEvent2["MemoryUpdateStarted"] = "MemoryUpdateStarted";
26
+ RunEvent2["MemoryUpdateCompleted"] = "MemoryUpdateCompleted";
27
+ RunEvent2["SessionSummaryStarted"] = "SessionSummaryStarted";
28
+ RunEvent2["SessionSummaryCompleted"] = "SessionSummaryCompleted";
29
+ RunEvent2["ParserModelResponseStarted"] = "ParserModelResponseStarted";
30
+ RunEvent2["ParserModelResponseCompleted"] = "ParserModelResponseCompleted";
31
+ RunEvent2["OutputModelResponseStarted"] = "OutputModelResponseStarted";
32
+ RunEvent2["OutputModelResponseCompleted"] = "OutputModelResponseCompleted";
33
+ RunEvent2["ModelRequestStarted"] = "ModelRequestStarted";
34
+ RunEvent2["ModelRequestCompleted"] = "ModelRequestCompleted";
35
+ RunEvent2["CompressionStarted"] = "CompressionStarted";
36
+ RunEvent2["CompressionCompleted"] = "CompressionCompleted";
37
+ RunEvent2["FollowupsStarted"] = "FollowupsStarted";
38
+ RunEvent2["FollowupsCompleted"] = "FollowupsCompleted";
39
+ RunEvent2["CustomEvent"] = "CustomEvent";
40
+ return RunEvent2;
41
+ })(RunEvent || {});
42
+ var TeamRunEvent = /* @__PURE__ */ ((TeamRunEvent2) => {
43
+ TeamRunEvent2["TeamRunStarted"] = "TeamRunStarted";
44
+ TeamRunEvent2["TeamRunContent"] = "TeamRunContent";
45
+ TeamRunEvent2["TeamRunIntermediateContent"] = "TeamRunIntermediateContent";
46
+ TeamRunEvent2["TeamRunContentCompleted"] = "TeamRunContentCompleted";
47
+ TeamRunEvent2["TeamRunCompleted"] = "TeamRunCompleted";
48
+ TeamRunEvent2["TeamRunError"] = "TeamRunError";
49
+ TeamRunEvent2["TeamRunCancelled"] = "TeamRunCancelled";
50
+ TeamRunEvent2["TeamRunPaused"] = "TeamRunPaused";
51
+ TeamRunEvent2["TeamRunContinued"] = "TeamRunContinued";
52
+ TeamRunEvent2["TeamToolCallStarted"] = "TeamToolCallStarted";
53
+ TeamRunEvent2["TeamToolCallCompleted"] = "TeamToolCallCompleted";
54
+ TeamRunEvent2["TeamToolCallError"] = "TeamToolCallError";
55
+ TeamRunEvent2["TeamReasoningStarted"] = "TeamReasoningStarted";
56
+ TeamRunEvent2["TeamReasoningStep"] = "TeamReasoningStep";
57
+ TeamRunEvent2["TeamReasoningContentDelta"] = "TeamReasoningContentDelta";
58
+ TeamRunEvent2["TeamReasoningCompleted"] = "TeamReasoningCompleted";
59
+ TeamRunEvent2["TeamMemoryUpdateStarted"] = "TeamMemoryUpdateStarted";
60
+ TeamRunEvent2["TeamMemoryUpdateCompleted"] = "TeamMemoryUpdateCompleted";
61
+ TeamRunEvent2["TeamFollowupsStarted"] = "TeamFollowupsStarted";
62
+ TeamRunEvent2["TeamFollowupsCompleted"] = "TeamFollowupsCompleted";
63
+ TeamRunEvent2["TeamTaskIterationStarted"] = "TeamTaskIterationStarted";
64
+ TeamRunEvent2["TeamTaskIterationCompleted"] = "TeamTaskIterationCompleted";
65
+ TeamRunEvent2["TeamTaskStateUpdated"] = "TeamTaskStateUpdated";
66
+ TeamRunEvent2["TeamTaskCreated"] = "TeamTaskCreated";
67
+ TeamRunEvent2["TeamTaskUpdated"] = "TeamTaskUpdated";
68
+ return TeamRunEvent2;
69
+ })(TeamRunEvent || {});
70
+ var WorkflowRunEvent = /* @__PURE__ */ ((WorkflowRunEvent2) => {
71
+ WorkflowRunEvent2["WorkflowStarted"] = "WorkflowStarted";
72
+ WorkflowRunEvent2["WorkflowCompleted"] = "WorkflowCompleted";
73
+ WorkflowRunEvent2["WorkflowPaused"] = "WorkflowPaused";
74
+ WorkflowRunEvent2["WorkflowCancelled"] = "WorkflowCancelled";
75
+ WorkflowRunEvent2["WorkflowError"] = "WorkflowError";
76
+ WorkflowRunEvent2["WorkflowAgentStarted"] = "WorkflowAgentStarted";
77
+ WorkflowRunEvent2["WorkflowAgentCompleted"] = "WorkflowAgentCompleted";
78
+ WorkflowRunEvent2["StepStarted"] = "StepStarted";
79
+ WorkflowRunEvent2["StepCompleted"] = "StepCompleted";
80
+ WorkflowRunEvent2["StepPaused"] = "StepPaused";
81
+ WorkflowRunEvent2["StepContinued"] = "StepContinued";
82
+ WorkflowRunEvent2["StepError"] = "StepError";
83
+ WorkflowRunEvent2["StepOutput"] = "StepOutput";
84
+ WorkflowRunEvent2["StepOutputReview"] = "StepOutputReview";
85
+ WorkflowRunEvent2["LoopExecutionStarted"] = "LoopExecutionStarted";
86
+ WorkflowRunEvent2["LoopIterationStarted"] = "LoopIterationStarted";
87
+ WorkflowRunEvent2["LoopIterationCompleted"] = "LoopIterationCompleted";
88
+ WorkflowRunEvent2["LoopExecutionCompleted"] = "LoopExecutionCompleted";
89
+ WorkflowRunEvent2["ParallelExecutionStarted"] = "ParallelExecutionStarted";
90
+ WorkflowRunEvent2["ParallelExecutionCompleted"] = "ParallelExecutionCompleted";
91
+ WorkflowRunEvent2["ConditionExecutionStarted"] = "ConditionExecutionStarted";
92
+ WorkflowRunEvent2["ConditionExecutionCompleted"] = "ConditionExecutionCompleted";
93
+ WorkflowRunEvent2["ConditionPaused"] = "ConditionPaused";
94
+ WorkflowRunEvent2["RouterExecutionStarted"] = "RouterExecutionStarted";
95
+ WorkflowRunEvent2["RouterExecutionCompleted"] = "RouterExecutionCompleted";
96
+ WorkflowRunEvent2["RouterPaused"] = "RouterPaused";
97
+ WorkflowRunEvent2["StepsExecutionStarted"] = "StepsExecutionStarted";
98
+ WorkflowRunEvent2["StepsExecutionCompleted"] = "StepsExecutionCompleted";
99
+ return WorkflowRunEvent2;
100
+ })(WorkflowRunEvent || {});
101
+
102
+ exports.RunEvent = RunEvent;
103
+ exports.TeamRunEvent = TeamRunEvent;
104
+ exports.WorkflowRunEvent = WorkflowRunEvent;
105
+ //# sourceMappingURL=chunk-2WM3CCFE.cjs.map
106
+ //# sourceMappingURL=chunk-2WM3CCFE.cjs.map
@@ -0,0 +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,CAAA,GAAyB,wBAAA;AACzB,EAAAA,UAAA,cAAA,CAAA,GAAe,cAAA;AACf,EAAAA,UAAA,UAAA,CAAA,GAAW,UAAA;AACX,EAAAA,UAAA,cAAA,CAAA,GAAe,cAAA;AACf,EAAAA,UAAA,WAAA,CAAA,GAAY,WAAA;AACZ,EAAAA,UAAA,cAAA,CAAA,GAAe,cAAA;AAEf,EAAAA,UAAA,gBAAA,CAAA,GAAiB,gBAAA;AACjB,EAAAA,UAAA,kBAAA,CAAA,GAAmB,kBAAA;AACnB,EAAAA,UAAA,iBAAA,CAAA,GAAkB,iBAAA;AAClB,EAAAA,UAAA,mBAAA,CAAA,GAAoB,mBAAA;AAEpB,EAAAA,UAAA,iBAAA,CAAA,GAAkB,iBAAA;AAClB,EAAAA,UAAA,mBAAA,CAAA,GAAoB,mBAAA;AACpB,EA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gBAAA,IAAA,EAAA","file":"chunk-2WM3CCFE.cjs","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"]}
@@ -0,0 +1,506 @@
1
+ // src/core/stream.ts
2
+ function isEnvelope(data) {
3
+ return typeof data === "object" && data !== null && "event" in data && "data" in data && typeof data.event === "string";
4
+ }
5
+ function isFlatEvent(data) {
6
+ return typeof data === "object" && data !== null && "event" in data && !("data" in data) && typeof data.event === "string";
7
+ }
8
+ function normaliseEnvelope(env) {
9
+ let parsed = {};
10
+ if (typeof env.data === "string") {
11
+ try {
12
+ parsed = JSON.parse(env.data);
13
+ } catch {
14
+ parsed = {};
15
+ }
16
+ } else if (env.data && typeof env.data === "object") {
17
+ parsed = env.data;
18
+ }
19
+ return { event: env.event, ...parsed };
20
+ }
21
+ function drainBuffer(buffer, onEvent) {
22
+ let start = buffer.indexOf("{");
23
+ while (start !== -1 && start < buffer.length) {
24
+ let depth = 0;
25
+ let inString = false;
26
+ let escape = false;
27
+ let end = -1;
28
+ for (let i = start; i < buffer.length; i++) {
29
+ const ch = buffer[i];
30
+ if (inString) {
31
+ if (escape) escape = false;
32
+ else if (ch === "\\") escape = true;
33
+ else if (ch === '"') inString = false;
34
+ } else if (ch === '"') {
35
+ inString = true;
36
+ } else if (ch === "{") {
37
+ depth++;
38
+ } else if (ch === "}") {
39
+ depth--;
40
+ if (depth === 0) {
41
+ end = i;
42
+ break;
43
+ }
44
+ }
45
+ }
46
+ if (end === -1) break;
47
+ const slice = buffer.slice(start, end + 1);
48
+ try {
49
+ const parsed = JSON.parse(slice);
50
+ if (isEnvelope(parsed)) onEvent(normaliseEnvelope(parsed));
51
+ else if (isFlatEvent(parsed)) onEvent(parsed);
52
+ } catch {
53
+ start = buffer.indexOf("{", start + 1);
54
+ continue;
55
+ }
56
+ buffer = buffer.slice(end + 1).trim();
57
+ start = buffer.indexOf("{");
58
+ }
59
+ return buffer;
60
+ }
61
+ async function streamRun(options) {
62
+ const { url, body, headers = {}, signal, onEvent, onError, onComplete } = options;
63
+ let buffer = "";
64
+ try {
65
+ const response = await fetch(url, {
66
+ method: "POST",
67
+ headers: {
68
+ ...!(body instanceof FormData) && { "Content-Type": "application/json" },
69
+ ...headers
70
+ },
71
+ body: body instanceof FormData ? body : JSON.stringify(body),
72
+ signal
73
+ });
74
+ if (!response.ok) {
75
+ let detail;
76
+ try {
77
+ const err = await response.json();
78
+ detail = err?.detail ? String(err.detail) : `${response.status} ${response.statusText}`;
79
+ } catch {
80
+ detail = `${response.status} ${response.statusText}`;
81
+ }
82
+ throw new Error(detail);
83
+ }
84
+ if (!response.body) throw new Error("No response body");
85
+ const reader = response.body.getReader();
86
+ const decoder = new TextDecoder();
87
+ for (; ; ) {
88
+ const { done, value } = await reader.read();
89
+ if (done) {
90
+ buffer = drainBuffer(buffer, onEvent);
91
+ onComplete();
92
+ return;
93
+ }
94
+ buffer += decoder.decode(value, { stream: true });
95
+ buffer = drainBuffer(buffer, onEvent);
96
+ }
97
+ } catch (error) {
98
+ if (error instanceof DOMException && error.name === "AbortError") {
99
+ onComplete();
100
+ return;
101
+ }
102
+ onError(error instanceof Error ? error : new Error(String(error)));
103
+ }
104
+ }
105
+
106
+ // src/core/client.ts
107
+ function normaliseBaseUrl(value) {
108
+ if (!value) return "";
109
+ let url = value.trim();
110
+ if (!/^https?:\/\//.test(url)) {
111
+ const isLocal = url.startsWith("localhost") || /^\d{1,3}(\.\d{1,3}){3}/.test(url);
112
+ url = `${isLocal ? "http" : "https"}://${url}`;
113
+ }
114
+ return url.replace(/\/+$/, "");
115
+ }
116
+ var RUN_PATH = {
117
+ agent: "agents",
118
+ team: "teams",
119
+ workflow: "workflows"
120
+ };
121
+ var AgnoClient = class {
122
+ constructor(options) {
123
+ this.baseUrl = normaliseBaseUrl(options.baseUrl);
124
+ this.headers = options.headers ?? {};
125
+ this.dbId = options.dbId;
126
+ }
127
+ async getJson(path) {
128
+ const res = await fetch(`${this.baseUrl}${path}`, { headers: this.headers });
129
+ if (!res.ok) throw new Error(`GET ${path} failed: ${res.status} ${res.statusText}`);
130
+ return res.json();
131
+ }
132
+ /** Liveness check against /health. Returns the HTTP status code. */
133
+ async health() {
134
+ try {
135
+ const res = await fetch(`${this.baseUrl}/health`, { headers: this.headers });
136
+ return res.status;
137
+ } catch {
138
+ return 0;
139
+ }
140
+ }
141
+ /* ----------------------------- discovery ----------------------------- */
142
+ async getAgents() {
143
+ const data = await this.getJson("/agents").catch(() => []);
144
+ return data.map((a) => ({
145
+ type: "agent",
146
+ id: a.agent_id ?? a.id,
147
+ name: a.name ?? a.agent_id ?? a.id,
148
+ description: a.description,
149
+ model: a.model,
150
+ db_id: a.db_id
151
+ }));
152
+ }
153
+ async getTeams() {
154
+ const data = await this.getJson("/teams").catch(() => []);
155
+ return data.map((t) => ({
156
+ type: "team",
157
+ id: t.team_id ?? t.id,
158
+ name: t.name ?? t.team_id ?? t.id,
159
+ description: t.description,
160
+ model: t.model,
161
+ db_id: t.db_id
162
+ }));
163
+ }
164
+ async getWorkflows() {
165
+ const data = await this.getJson("/workflows").catch(() => []);
166
+ return data.map((w) => ({
167
+ type: "workflow",
168
+ id: w.workflow_id ?? w.id,
169
+ name: w.name ?? w.workflow_id ?? w.id,
170
+ description: w.description,
171
+ model: w.model,
172
+ db_id: w.db_id
173
+ }));
174
+ }
175
+ /** All runnable entities (agents, teams, workflows) in one list. */
176
+ async getEntities() {
177
+ const [agents, teams, workflows] = await Promise.all([
178
+ this.getAgents(),
179
+ this.getTeams(),
180
+ this.getWorkflows()
181
+ ]);
182
+ return [...agents, ...teams, ...workflows];
183
+ }
184
+ /* ------------------------------ sessions ----------------------------- */
185
+ async getSessions(type, componentId, dbId) {
186
+ const url = new URL(`${this.baseUrl}/sessions`);
187
+ url.searchParams.set("type", type);
188
+ url.searchParams.set("component_id", componentId);
189
+ const db = dbId ?? this.dbId;
190
+ if (db) url.searchParams.set("db_id", db);
191
+ try {
192
+ const res = await fetch(url.toString(), { headers: this.headers });
193
+ if (!res.ok) return { data: [] };
194
+ return await res.json();
195
+ } catch {
196
+ return { data: [] };
197
+ }
198
+ }
199
+ /** Runs (with messages/tools/events) for a session — used to rehydrate chat history. */
200
+ async getSessionRuns(type, sessionId, dbId) {
201
+ const url = new URL(`${this.baseUrl}/sessions/${sessionId}/runs`);
202
+ url.searchParams.set("type", type);
203
+ const db = dbId ?? this.dbId;
204
+ if (db) url.searchParams.set("db_id", db);
205
+ const res = await fetch(url.toString(), { headers: this.headers });
206
+ if (!res.ok) throw new Error(`Failed to load session: ${res.statusText}`);
207
+ return res.json();
208
+ }
209
+ async deleteSession(sessionId, dbId) {
210
+ const url = new URL(`${this.baseUrl}/sessions/${sessionId}`);
211
+ const db = dbId ?? this.dbId;
212
+ if (db) url.searchParams.set("db_id", db);
213
+ const res = await fetch(url.toString(), { method: "DELETE", headers: this.headers });
214
+ return res.ok;
215
+ }
216
+ /* -------------------------------- runs ------------------------------- */
217
+ /** Start a streaming run for an agent, team or workflow. */
218
+ async run(args) {
219
+ const form = new FormData();
220
+ if (args.message != null) form.append("message", args.message);
221
+ form.append("stream", "true");
222
+ if (args.sessionId) form.append("session_id", args.sessionId);
223
+ if (args.userId) form.append("user_id", args.userId);
224
+ for (const file of args.files ?? []) form.append("files", file);
225
+ for (const [k, v] of Object.entries(args.extra ?? {})) form.append(k, v);
226
+ const url = `${this.baseUrl}/${RUN_PATH[args.type]}/${args.id}/runs`;
227
+ return streamRun({
228
+ url,
229
+ body: form,
230
+ headers: this.headers,
231
+ signal: args.signal,
232
+ onEvent: (e) => args.onEvent(e),
233
+ onError: args.onError,
234
+ onComplete: args.onComplete
235
+ });
236
+ }
237
+ /** Continue a paused run (resolving a human-in-the-loop requirement). */
238
+ async continueRun(args) {
239
+ const form = new FormData();
240
+ form.append("stream", "true");
241
+ if (args.sessionId) form.append("session_id", args.sessionId);
242
+ if (args.userId) form.append("user_id", args.userId);
243
+ if (args.type === "workflow") {
244
+ if (args.stepRequirements) form.append("step_requirements", JSON.stringify(args.stepRequirements));
245
+ } else if (args.tools) {
246
+ form.append("tools", JSON.stringify(args.tools));
247
+ }
248
+ const url = `${this.baseUrl}/${RUN_PATH[args.type]}/${args.id}/runs/${args.runId}/continue`;
249
+ return streamRun({
250
+ url,
251
+ body: form,
252
+ headers: this.headers,
253
+ signal: args.signal,
254
+ onEvent: (e) => args.onEvent(e),
255
+ onError: args.onError,
256
+ onComplete: args.onComplete
257
+ });
258
+ }
259
+ /** Cancel an in-flight run. */
260
+ async cancelRun(type, id2, runId, sessionId) {
261
+ const url = new URL(`${this.baseUrl}/${RUN_PATH[type]}/${id2}/runs/${runId}/cancel`);
262
+ if (sessionId) url.searchParams.set("session_id", sessionId);
263
+ try {
264
+ const res = await fetch(url.toString(), { method: "POST", headers: this.headers });
265
+ return res.ok;
266
+ } catch {
267
+ return false;
268
+ }
269
+ }
270
+ };
271
+
272
+ // src/core/session.ts
273
+ function toText(value) {
274
+ if (value == null) return "";
275
+ if (typeof value === "string") return value;
276
+ if (Array.isArray(value)) {
277
+ return value.map(
278
+ (part) => part && typeof part === "object" && "text" in part ? String(part.text) : ""
279
+ ).filter(Boolean).join(" ");
280
+ }
281
+ if (typeof value === "object") {
282
+ const obj = value;
283
+ if (typeof obj.input_content === "string") return obj.input_content;
284
+ if (typeof obj.message === "string") return obj.message;
285
+ if (typeof obj.content === "string") return obj.content;
286
+ return "```json\n" + JSON.stringify(value, null, 2) + "\n```";
287
+ }
288
+ return String(value);
289
+ }
290
+ var seq = 0;
291
+ var id = (prefix) => `${prefix}-${seq++}`;
292
+ function sessionRunsToMessages(runs) {
293
+ if (!Array.isArray(runs)) return [];
294
+ const messages = [];
295
+ for (const run of runs) {
296
+ const created = run.created_at ?? Math.floor(Date.now() / 1e3);
297
+ const userContent = toText(run.run_input);
298
+ if (userContent) {
299
+ messages.push({
300
+ id: id("hist-u"),
301
+ role: "user",
302
+ content: userContent,
303
+ created_at: created
304
+ });
305
+ }
306
+ messages.push({
307
+ id: id("hist-a"),
308
+ role: "agent",
309
+ content: toText(run.content),
310
+ created_at: created,
311
+ status: "completed",
312
+ run_id: run.run_id,
313
+ session_id: run.session_id,
314
+ tool_calls: run.tools && run.tools.length ? run.tools : void 0,
315
+ // Stored events let the behind-the-scenes panel look the same in history
316
+ // as it does live.
317
+ events: run.events && run.events.length ? run.events : void 0,
318
+ reasoning_steps: run.reasoning_steps ?? run.extra_data?.reasoning_steps,
319
+ references: run.references ?? run.extra_data?.references,
320
+ followups: run.followups && run.followups.length ? run.followups : void 0,
321
+ images: run.images,
322
+ videos: run.videos,
323
+ audio: run.audio,
324
+ response_audio: run.response_audio
325
+ });
326
+ }
327
+ return messages;
328
+ }
329
+
330
+ // src/core/events.ts
331
+ var name = (e) => String(e.event ?? "");
332
+ var isStartedEvent = (e) => name(e) === "RunStarted" || name(e) === "TeamRunStarted" || name(e) === "WorkflowStarted" || name(e) === "ReasoningStarted" || name(e) === "TeamReasoningStarted";
333
+ var isContentEvent = (e) => name(e) === "RunContent" || name(e) === "TeamRunContent" || name(e) === "WorkflowAgentCompleted";
334
+ var isCompletedEvent = (e) => name(e) === "RunCompleted" || name(e) === "TeamRunCompleted" || name(e) === "WorkflowCompleted";
335
+ var isErrorEvent = (e) => name(e) === "RunError" || name(e) === "TeamRunError" || name(e) === "WorkflowError" || name(e) === "StepError" || name(e) === "ToolCallError" || name(e) === "TeamToolCallError";
336
+ var isCancelledEvent = (e) => name(e) === "RunCancelled" || name(e) === "TeamRunCancelled" || name(e) === "WorkflowCancelled";
337
+ var isPausedEvent = (e) => name(e) === "RunPaused" || name(e) === "TeamRunPaused" || name(e) === "WorkflowPaused" || name(e) === "StepPaused" || name(e) === "RouterPaused" || name(e) === "ConditionPaused";
338
+ var isToolStartedEvent = (e) => name(e) === "ToolCallStarted" || name(e) === "TeamToolCallStarted";
339
+ var isToolCompletedEvent = (e) => name(e) === "ToolCallCompleted" || name(e) === "TeamToolCallCompleted";
340
+ var isToolEvent = (e) => isToolStartedEvent(e) || isToolCompletedEvent(e) || name(e) === "ToolCallError" || name(e) === "TeamToolCallError";
341
+ var isReasoningStepEvent = (e) => name(e) === "ReasoningStep" || name(e) === "TeamReasoningStep";
342
+ var isReasoningCompletedEvent = (e) => name(e) === "ReasoningCompleted" || name(e) === "TeamReasoningCompleted";
343
+ var isFollowupsCompletedEvent = (e) => name(e) === "FollowupsCompleted" || name(e) === "TeamFollowupsCompleted";
344
+ function isSubRunEvent(e) {
345
+ if (!e.parent_run_id) return false;
346
+ const ev = name(e);
347
+ return isContentEvent(e) || isToolEvent(e) || isCompletedEvent(e) || isErrorEvent(e) || ev === "RunStarted" || ev === "TeamRunStarted";
348
+ }
349
+ function isStepEvent(e) {
350
+ const ev = name(e);
351
+ return ev === "StepStarted" || ev === "StepCompleted" || ev === "StepOutput" || ev === "StepError";
352
+ }
353
+ function toolsFromEvent(e) {
354
+ const out = [];
355
+ if (e.tool) out.push(e.tool);
356
+ if (Array.isArray(e.tools)) out.push(...e.tools);
357
+ return out;
358
+ }
359
+ function applyContentEvent(message, e) {
360
+ const next = { ...message };
361
+ if (typeof e.content === "string" && e.content) {
362
+ next.content = message.content + e.content;
363
+ } else if (e.content && typeof e.content === "object") {
364
+ next.content = message.content + "\n```json\n" + JSON.stringify(e.content, null, 2) + "\n```\n";
365
+ }
366
+ if (e.reasoning_steps?.length) next.reasoning_steps = e.reasoning_steps;
367
+ if (e.extra_data?.reasoning_steps?.length) next.reasoning_steps = e.extra_data.reasoning_steps;
368
+ if (e.references?.length) next.references = e.references;
369
+ if (e.extra_data?.references?.length) next.references = e.extra_data.references;
370
+ if (e.citations) next.citations = e.citations;
371
+ const tools = toolsFromEvent(e);
372
+ if (tools.length) {
373
+ let toolCalls = message.tool_calls ?? [];
374
+ for (const tool of tools) toolCalls = mergeTool(toolCalls, tool);
375
+ next.tool_calls = toolCalls;
376
+ }
377
+ if (e.images?.length) next.images = e.images;
378
+ if (e.videos?.length) next.videos = e.videos;
379
+ if (e.audio?.length) next.audio = e.audio;
380
+ if (e.response_audio?.transcript) {
381
+ next.response_audio = {
382
+ ...message.response_audio,
383
+ transcript: (message.response_audio?.transcript ?? "") + e.response_audio.transcript
384
+ };
385
+ }
386
+ return next;
387
+ }
388
+ function activityLabel(e) {
389
+ const ev = name(e);
390
+ switch (ev) {
391
+ case "RunStarted":
392
+ case "TeamRunStarted":
393
+ case "WorkflowStarted":
394
+ return "Thinking";
395
+ case "ModelRequestStarted":
396
+ case "TeamModelRequestStarted":
397
+ return "Generating";
398
+ case "ReasoningStarted":
399
+ case "TeamReasoningStarted":
400
+ case "ReasoningStep":
401
+ case "TeamReasoningStep":
402
+ case "ReasoningContentDelta":
403
+ case "TeamReasoningContentDelta":
404
+ return "Reasoning";
405
+ case "MemoryUpdateStarted":
406
+ case "TeamMemoryUpdateStarted":
407
+ return "Updating memory";
408
+ case "SessionSummaryStarted":
409
+ case "TeamSessionSummaryStarted":
410
+ return "Summarising session";
411
+ case "CompressionStarted":
412
+ return "Compressing context";
413
+ case "FollowupsStarted":
414
+ case "TeamFollowupsStarted":
415
+ return "Suggesting follow-ups";
416
+ case "ToolCallStarted":
417
+ case "TeamToolCallStarted": {
418
+ const tool = e.tool?.tool_name;
419
+ return tool ? `Calling ${tool}` : "Calling tool";
420
+ }
421
+ case "ToolCallCompleted":
422
+ case "TeamToolCallCompleted":
423
+ return "Generating";
424
+ case "StepStarted":
425
+ return e.step_name ? `Running step: ${e.step_name}` : "Running step";
426
+ case "LoopIterationStarted":
427
+ return `Loop iteration ${e.iteration ?? ""}`.trim();
428
+ case "ParallelExecutionStarted":
429
+ return "Running parallel steps";
430
+ case "RouterExecutionStarted":
431
+ return "Routing";
432
+ case "ConditionExecutionStarted":
433
+ return "Evaluating condition";
434
+ default:
435
+ return null;
436
+ }
437
+ }
438
+ function textOf(value) {
439
+ if (typeof value === "string") return value;
440
+ if (value && typeof value === "object") return "```json\n" + JSON.stringify(value, null, 2) + "\n```";
441
+ return void 0;
442
+ }
443
+ function applySubRunEvent(message, e, kind) {
444
+ const rid = e.run_id || e.parent_run_id || "sub";
445
+ const members = message.members ? [...message.members] : [];
446
+ const idx = members.findIndex((s) => s.run_id === rid);
447
+ const base = idx >= 0 ? { ...members[idx] } : { run_id: rid, kind, content: "", status: "running" };
448
+ base.name = base.name || e.agent_name || e.team_name || e.agent_id;
449
+ const tools = toolsFromEvent(e);
450
+ if (tools.length) {
451
+ let tc = base.tool_calls ?? [];
452
+ for (const t of tools) tc = mergeTool(tc, t);
453
+ base.tool_calls = tc;
454
+ }
455
+ if (isErrorEvent(e)) {
456
+ base.status = "error";
457
+ } else if (isCompletedEvent(e)) {
458
+ base.status = "completed";
459
+ const final = textOf(e.content);
460
+ if (final) base.content = final;
461
+ } else if (isContentEvent(e)) {
462
+ const delta = typeof e.content === "string" ? e.content : "";
463
+ if (delta) base.content += delta;
464
+ }
465
+ if (idx >= 0) members[idx] = base;
466
+ else members.push(base);
467
+ return { ...message, members };
468
+ }
469
+ function applyStepEvent(message, e) {
470
+ const ev = name(e);
471
+ const key = e.step_name || `step-${JSON.stringify(e.step_index ?? "")}`;
472
+ const steps = message.steps ? [...message.steps] : [];
473
+ const idx = steps.findIndex((s) => s.key === key);
474
+ const step = idx >= 0 ? { ...steps[idx] } : { key, name: e.step_name, index: e.step_index, status: "running" };
475
+ if (ev === "StepStarted") {
476
+ step.status = "running";
477
+ } else if (ev === "StepError") {
478
+ step.status = "error";
479
+ step.error = e.error || (typeof e.content === "string" ? e.content : void 0);
480
+ } else {
481
+ step.status = "completed";
482
+ const stepResponse = e.step_response ?? e.step_output;
483
+ const content = textOf(e.content) ?? textOf(stepResponse?.content);
484
+ if (content) step.content = content;
485
+ }
486
+ if (idx >= 0) steps[idx] = step;
487
+ else steps.push(step);
488
+ return { ...message, steps };
489
+ }
490
+ function mergeTool(list, tool) {
491
+ const key = tool.tool_call_id || `${tool.tool_name}-${tool.created_at}`;
492
+ const idx = list.findIndex((t) => {
493
+ if (t.tool_call_id && tool.tool_call_id) return t.tool_call_id === tool.tool_call_id;
494
+ return `${t.tool_name}-${t.created_at}` === key;
495
+ });
496
+ if (idx >= 0) {
497
+ const next = [...list];
498
+ next[idx] = { ...next[idx], ...tool };
499
+ return next;
500
+ }
501
+ return [...list, tool];
502
+ }
503
+
504
+ export { AgnoClient, activityLabel, applyContentEvent, applyStepEvent, applySubRunEvent, isCancelledEvent, isCompletedEvent, isContentEvent, isErrorEvent, isFollowupsCompletedEvent, isPausedEvent, isReasoningCompletedEvent, isReasoningStepEvent, isStartedEvent, isStepEvent, isSubRunEvent, isToolCompletedEvent, isToolEvent, mergeTool, normaliseBaseUrl, sessionRunsToMessages, streamRun, toolsFromEvent };
505
+ //# sourceMappingURL=chunk-62IEW2HM.js.map
506
+ //# sourceMappingURL=chunk-62IEW2HM.js.map