@agno-hq/chat-react 0.1.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +407 -21
- package/dist/chat/index.cjs +334 -0
- package/dist/chat/index.cjs.map +1 -0
- package/dist/chat/index.d.cts +1335 -0
- package/dist/chat/index.d.ts +1335 -0
- package/dist/chat/index.js +5 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/chunk-2WM3CCFE.cjs +106 -0
- package/dist/chunk-2WM3CCFE.cjs.map +1 -0
- package/dist/chunk-55HQJGLP.cjs +527 -0
- package/dist/chunk-55HQJGLP.cjs.map +1 -0
- package/dist/chunk-6V2YIPHF.js +503 -0
- package/dist/chunk-6V2YIPHF.js.map +1 -0
- package/dist/chunk-BZC2674Z.js +3501 -0
- package/dist/chunk-BZC2674Z.js.map +1 -0
- package/dist/chunk-JEPFGKHH.cjs +3588 -0
- package/dist/chunk-JEPFGKHH.cjs.map +1 -0
- package/dist/chunk-RE7ZT73K.js +102 -0
- package/dist/chunk-RE7ZT73K.js.map +1 -0
- package/dist/client-DUyVqxU9.d.cts +413 -0
- package/dist/client-DUyVqxU9.d.ts +413 -0
- package/dist/core/index.cjs +94 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +108 -0
- package/dist/core/index.d.ts +108 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/fonts.css +18 -0
- package/dist/index.cjs +415 -1954
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -835
- package/dist/index.d.ts +12 -835
- package/dist/index.js +3 -1920
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2102 -659
- package/dist/tokens.css +111 -0
- package/package.json +50 -7
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { k as RunEvent, l as RunEventData, q as ToolExecution, C as ChatMessage, R as ReasoningStep, j as ReferenceData, o as SubRun } from '../client-DUyVqxU9.js';
|
|
2
|
+
export { A as AgnoClient, a as AgnoClientOptions, b as AnyRunEventName, c as AudioData, d as ChatRole, e as ChatStatus, f as Citations, E as Entity, g as EntityType, I as ImageData, M as Model, P as Pagination, h as PauseType, i as Reference, m as RunRequirement, S as SessionEntry, n as SessionsResponse, p as SubRunStatus, T as TeamRunEvent, U as UserInputField, V as VideoData, W as WorkflowRunEvent, r as WorkflowStep, s as normaliseBaseUrl } from '../client-DUyVqxU9.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Streaming parser for AgentOS run endpoints.
|
|
6
|
+
*
|
|
7
|
+
* AgentOS streams a run as a sequence of JSON objects concatenated on the wire
|
|
8
|
+
* (not strictly newline-delimited). Each object is one "run event". This module
|
|
9
|
+
* reads the response body incrementally, extracts complete JSON objects as they
|
|
10
|
+
* arrive, and hands each one to a callback.
|
|
11
|
+
*
|
|
12
|
+
* It supports both the legacy shape (the event object sent directly) and the
|
|
13
|
+
* newer envelope shape ({ event: string, data: string | object }), normalising
|
|
14
|
+
* both into a flat event object with an `event` discriminator field.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** A parsed, normalised run event. Shape varies by `event` type — see types.ts. */
|
|
18
|
+
interface StreamEvent {
|
|
19
|
+
event: RunEvent | string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
interface StreamRunOptions {
|
|
23
|
+
url: string;
|
|
24
|
+
body: FormData | Record<string, unknown>;
|
|
25
|
+
headers?: Record<string, string>;
|
|
26
|
+
signal?: AbortSignal;
|
|
27
|
+
onEvent: (event: StreamEvent) => void;
|
|
28
|
+
onError: (error: Error) => void;
|
|
29
|
+
onComplete: () => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* POSTs a run request and streams the response, calling `onEvent` for every
|
|
33
|
+
* run event as it arrives. Resolves when the stream ends.
|
|
34
|
+
*/
|
|
35
|
+
declare function streamRun(options: StreamRunOptions): Promise<void>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Helpers for turning AgentOS session history into render-ready chat messages.
|
|
39
|
+
*
|
|
40
|
+
* `GET /sessions/{id}/runs` returns an array of run records. Each run carries
|
|
41
|
+
* the user input plus the agent's content, tools, reasoning, references and
|
|
42
|
+
* media — enough to reconstruct the transcript for a past session.
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
interface SessionRun {
|
|
46
|
+
run_id?: string;
|
|
47
|
+
session_id?: string;
|
|
48
|
+
run_input?: unknown;
|
|
49
|
+
content?: unknown;
|
|
50
|
+
created_at?: number;
|
|
51
|
+
status?: string;
|
|
52
|
+
/** Present when the agent was configured with `store_events`. */
|
|
53
|
+
events?: RunEventData[];
|
|
54
|
+
tools?: ToolExecution[];
|
|
55
|
+
images?: ChatMessage['images'];
|
|
56
|
+
videos?: ChatMessage['videos'];
|
|
57
|
+
audio?: ChatMessage['audio'];
|
|
58
|
+
response_audio?: ChatMessage['response_audio'];
|
|
59
|
+
extra_data?: {
|
|
60
|
+
reasoning_steps?: ReasoningStep[];
|
|
61
|
+
references?: ReferenceData[];
|
|
62
|
+
};
|
|
63
|
+
reasoning_steps?: ReasoningStep[];
|
|
64
|
+
references?: ReferenceData[];
|
|
65
|
+
followups?: string[];
|
|
66
|
+
}
|
|
67
|
+
/** Convert the runs of a session into an ordered list of chat messages. */
|
|
68
|
+
declare function sessionRunsToMessages(runs: SessionRun[]): ChatMessage[];
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Helpers for classifying run events and turning them into UI labels.
|
|
72
|
+
*
|
|
73
|
+
* Agent, team and workflow events share shapes but use different name prefixes
|
|
74
|
+
* (e.g. `RunContent` vs `TeamRunContent`). These helpers let the rest of the
|
|
75
|
+
* library treat them uniformly.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
declare const isContentEvent: (e: RunEventData) => boolean;
|
|
79
|
+
declare const isCompletedEvent: (e: RunEventData) => boolean;
|
|
80
|
+
declare const isErrorEvent: (e: RunEventData) => boolean;
|
|
81
|
+
declare const isPausedEvent: (e: RunEventData) => boolean;
|
|
82
|
+
declare const isToolEvent: (e: RunEventData) => boolean;
|
|
83
|
+
declare const isReasoningStepEvent: (e: RunEventData) => boolean;
|
|
84
|
+
/** The follow-up prompts an agent built with `followups=True` suggests. */
|
|
85
|
+
declare const isFollowupsCompletedEvent: (e: RunEventData) => boolean;
|
|
86
|
+
/**
|
|
87
|
+
* A nested-run event — a team member's turn or a workflow step executor.
|
|
88
|
+
* Identified by a `parent_run_id` on an agent/team content/tool/run event.
|
|
89
|
+
*/
|
|
90
|
+
declare function isSubRunEvent(e: RunEventData): boolean;
|
|
91
|
+
/** A workflow step lifecycle event (start / output / complete / error). */
|
|
92
|
+
declare function isStepEvent(e: RunEventData): boolean;
|
|
93
|
+
/** Tool executions carried by an event, from either the single or array field. */
|
|
94
|
+
declare function toolsFromEvent(e: RunEventData): ToolExecution[];
|
|
95
|
+
/**
|
|
96
|
+
* A short human-readable label describing what a run is doing at the moment of
|
|
97
|
+
* this event — for a live status line ("Calling get_weather", "Reasoning…").
|
|
98
|
+
* Returns null for events that don't warrant a status change.
|
|
99
|
+
*/
|
|
100
|
+
declare function activityLabel(e: RunEventData): string | null;
|
|
101
|
+
/** Apply a nested member/executor run event into a message's `members`. */
|
|
102
|
+
declare function applySubRunEvent(message: ChatMessage, e: RunEventData, kind: SubRun['kind']): ChatMessage;
|
|
103
|
+
/** Apply a workflow `Step*` event into a message's `steps`. */
|
|
104
|
+
declare function applyStepEvent(message: ChatMessage, e: RunEventData): ChatMessage;
|
|
105
|
+
/** Merge a tool execution into a list, updating an existing entry by id/name. */
|
|
106
|
+
declare function mergeTool(list: ToolExecution[], tool: ToolExecution): ToolExecution[];
|
|
107
|
+
|
|
108
|
+
export { ChatMessage, ReasoningStep, ReferenceData, RunEvent, RunEventData, type StreamEvent, type StreamRunOptions, SubRun, ToolExecution, activityLabel, applyStepEvent, applySubRunEvent, isCompletedEvent, isContentEvent, isErrorEvent, isFollowupsCompletedEvent, isPausedEvent, isReasoningStepEvent, isStepEvent, isSubRunEvent, isToolEvent, mergeTool, sessionRunsToMessages, streamRun, toolsFromEvent };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
export { RunEvent, TeamRunEvent, WorkflowRunEvent } from '../chunk-RE7ZT73K.js';
|
|
3
|
+
export { AgnoClient, activityLabel, applyStepEvent, applySubRunEvent, isCompletedEvent, isContentEvent, isErrorEvent, isFollowupsCompletedEvent, isPausedEvent, isReasoningStepEvent, isStepEvent, isSubRunEvent, isToolEvent, mergeTool, normaliseBaseUrl, sessionRunsToMessages, streamRun, toolsFromEvent } from '../chunk-6V2YIPHF.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
package/dist/fonts.css
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @agno-hq/chat-react — the webfonts the default tokens name.
|
|
3
|
+
*
|
|
4
|
+
* Optional and opt-in: `styles.css` deliberately does NOT fetch these, so the
|
|
5
|
+
* package makes no third-party request unless you ask for it.
|
|
6
|
+
*
|
|
7
|
+
* import '@agno-hq/chat-react/fonts.css'
|
|
8
|
+
*
|
|
9
|
+
* Prefer to self-host, or already load Inter and DM Mono? Skip this file and
|
|
10
|
+
* point the tokens at your own faces instead:
|
|
11
|
+
*
|
|
12
|
+
* :root {
|
|
13
|
+
* --agno-font: 'Inter', system-ui, sans-serif;
|
|
14
|
+
* --agno-font-mono: 'DM Mono', ui-monospace, monospace;
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=DM+Mono:wght@400;500&display=swap');
|