@athenaintel/react 0.10.41-rc.2 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/statewire-client-tools.d.ts +14 -7
- package/dist/diagnostics/athena-diagnostics.d.ts +138 -0
- package/dist/diagnostics/errors.d.ts +67 -0
- package/dist/diagnostics/useAthenaDiagnostics.d.ts +13 -0
- package/dist/index.cjs +1343 -637
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +1369 -663
- package/dist/index.js.map +1 -1
- package/dist/provider/AthenaContext.d.ts +3 -3
- package/dist/provider/AthenaProvider.d.ts +42 -4
- package/dist/provider/config.d.ts +6 -0
- package/dist/runtime/statewire-run-config.d.ts +16 -1
- package/dist/runtime/transport.d.ts +8 -0
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +5 -0
- package/dist/version.d.ts +6 -0
- package/package.json +3 -3
|
@@ -5,9 +5,9 @@ export interface AthenaConfig extends Pick<AthenaProviderConfig, 'apiKey' | 'tok
|
|
|
5
5
|
backendUrl: string;
|
|
6
6
|
appUrl: string;
|
|
7
7
|
enabledToolkits: string[];
|
|
8
|
-
/** Effective chat transport
|
|
9
|
-
*
|
|
10
|
-
transport
|
|
8
|
+
/** Effective chat transport; absent means `legacy`. Optional so existing
|
|
9
|
+
* `AthenaConfig` object literals keep compiling. */
|
|
10
|
+
transport?: AthenaTransport;
|
|
11
11
|
linkClicks?: AthenaLinkClickOptions;
|
|
12
12
|
citationLinks?: AthenaCitationLinkOptions;
|
|
13
13
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { Toolkit } from '@assistant-ui/react';
|
|
3
3
|
import { type AthenaEnvironment } from '../lib/athena-urls';
|
|
4
|
+
import { type AthenaDiagnosticEvent, type AthenaDiagnosticLevel, type AthenaDiagnosticsConfig } from '../diagnostics/athena-diagnostics';
|
|
5
|
+
import type { AthenaSdkError } from '../diagnostics/errors';
|
|
4
6
|
import { type AthenaTransport } from '../runtime/transport';
|
|
5
7
|
import type { AthenaProviderConfig } from './config';
|
|
6
8
|
import type { AthenaCitationLinkOptions, AthenaLinkClickOptions } from './citation-links';
|
|
@@ -15,8 +17,24 @@ export interface AthenaProviderProps {
|
|
|
15
17
|
/** @deprecated Prefer `config.token`. PropelAuth token. If provided, takes priority over apiKey. If omitted, the SDK
|
|
16
18
|
* will automatically listen for a token from the parent window via PostMessage. */
|
|
17
19
|
token?: string | null;
|
|
18
|
-
/** Agent
|
|
20
|
+
/** Agent selector.
|
|
21
|
+
*
|
|
22
|
+
* - `legacy` transport: any agent name (defaults to 'athena_assist_agent'),
|
|
23
|
+
* including `collab_agent:<asset_id>` refs.
|
|
24
|
+
* - `statewire` transport: only `collab_agent:<asset_id>` refs apply — the
|
|
25
|
+
* thread then runs AS that published collab agent (its prompt, tools, and
|
|
26
|
+
* model default), and the caller must have view access to the agent
|
|
27
|
+
* asset. Any other value is ignored with a `sdk.config.warning`
|
|
28
|
+
* diagnostic, because the statewire host always runs the Athena deep
|
|
29
|
+
* agent. */
|
|
19
30
|
agent?: string;
|
|
31
|
+
/** Collab-agent channel id — a built-in channel (`email`, `sms`, …) or a
|
|
32
|
+
* user-defined custom channel id from the agent's Channels tab. Selects
|
|
33
|
+
* that channel's configuration overrides and stamps the session's origin.
|
|
34
|
+
* Only meaningful with a `collab_agent:<asset_id>` `agent` on the
|
|
35
|
+
* `statewire` transport; sent as `collab_channel_id`. An unknown or
|
|
36
|
+
* disabled channel rejects the run with a structured, teaching error. */
|
|
37
|
+
channel?: string;
|
|
20
38
|
/** LLM model identifier. Defaults to 'claude-opus-4-6-thinking-max-fast'. */
|
|
21
39
|
model?: string;
|
|
22
40
|
/** Backend toolkit IDs to enable (e.g. 'document_toolkit', 'web_search_browse_toolkit'). */
|
|
@@ -47,9 +65,11 @@ export interface AthenaProviderProps {
|
|
|
47
65
|
* model in this mode. */
|
|
48
66
|
transport?: AthenaTransport;
|
|
49
67
|
/** Resolve the latest auth token immediately before a request (for
|
|
50
|
-
* expiring clients). Takes priority over `token` when it resolves.
|
|
68
|
+
* expiring clients). Takes priority over `token` when it resolves.
|
|
69
|
+
* Only used when `transport` is 'statewire'. Prefer `config.getToken`. */
|
|
51
70
|
getToken?: () => string | null | Promise<string | null>;
|
|
52
|
-
/** Additional fields merged into runConfig.custom
|
|
71
|
+
/** Additional fields merged into runConfig.custom. Only used when
|
|
72
|
+
* `transport` is 'statewire'. Prefer `config.extraRunConfig`. */
|
|
53
73
|
extraRunConfig?: Record<string, unknown>;
|
|
54
74
|
/** Statewire sync base URL override (the `…/v2/threads` mount). Defaults to
|
|
55
75
|
* the effective `apiUrl` host + `/v2/threads`. Only used when `transport`
|
|
@@ -103,5 +123,23 @@ export interface AthenaProviderProps {
|
|
|
103
123
|
/** PostHog analytics configuration. When omitted or keys are missing, PostHog is silently disabled.
|
|
104
124
|
* Prefer `config.posthog` for structured configuration. */
|
|
105
125
|
posthog?: PostHogConfig;
|
|
126
|
+
/** SDK diagnostics.
|
|
127
|
+
*
|
|
128
|
+
* - `true` / a level: echo structured `[AthenaSDK]` events to the console
|
|
129
|
+
* at that level (`true` = 'debug').
|
|
130
|
+
* - An object: full diagnostics config (console level, PostHog timing
|
|
131
|
+
* forwarding, buffer size).
|
|
132
|
+
*
|
|
133
|
+
* Independent of the prop, `localStorage.setItem('athena:debug','debug')`
|
|
134
|
+
* (or `window.__ATHENA_SDK__.diagnostics.enableConsole()`) turns console
|
|
135
|
+
* echo on at runtime without a rebuild. Errors log once even when off. */
|
|
136
|
+
debug?: boolean | AthenaDiagnosticLevel | Partial<AthenaDiagnosticsConfig>;
|
|
137
|
+
/** Receives every diagnostics event (timings, warnings, errors) — the hook
|
|
138
|
+
* for shipping SDK telemetry to the host app's own pipeline. */
|
|
139
|
+
onDiagnostic?: (event: AthenaDiagnosticEvent) => void;
|
|
140
|
+
/** Receives every SDK error as a typed `AthenaSdkError` (stable `code`,
|
|
141
|
+
* `hint`, structured server `detail`). Fires in addition to the UI's own
|
|
142
|
+
* error handling, so integrations never fail silently. */
|
|
143
|
+
onError?: (error: AthenaSdkError, event: AthenaDiagnosticEvent) => void;
|
|
106
144
|
}
|
|
107
|
-
export declare function AthenaProvider({ children, config, apiKey, token: tokenProp, agent, model, tools, frontendTools, disableAutoOpen, apiUrl, backendUrl, appUrl, environment, transport, statewireSyncUrl, getToken, extraRunConfig, workbench, knowledgeBase, systemPrompt, customToolConfigs, appId, threadId: threadIdProp, enableThreadList, theme, linkClicks, citationLinks, posthog: posthogProp, }: AthenaProviderProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
|
|
145
|
+
export declare function AthenaProvider({ children, config, apiKey, token: tokenProp, agent, channel, model, tools, frontendTools, disableAutoOpen, apiUrl, backendUrl, appUrl, environment, transport, statewireSyncUrl, getToken, extraRunConfig, workbench, knowledgeBase, systemPrompt, customToolConfigs, appId, threadId: threadIdProp, enableThreadList, theme, linkClicks, citationLinks, posthog: posthogProp, debug, onDiagnostic, onError, }: AthenaProviderProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
|
|
@@ -2,6 +2,12 @@ import type { AthenaEnvironment } from '../lib/athena-urls';
|
|
|
2
2
|
import type { AthenaTransport } from '../runtime/transport';
|
|
3
3
|
import type { PostHogConfig } from './PostHogProvider';
|
|
4
4
|
export interface AthenaProviderConfig {
|
|
5
|
+
/** Resolve the latest auth token immediately before a request (for expiring
|
|
6
|
+
* clients). Only used when `transport` is 'statewire'. */
|
|
7
|
+
getToken?: () => string | null | Promise<string | null>;
|
|
8
|
+
/** Additional fields merged into runConfig.custom. Only used when
|
|
9
|
+
* `transport` is 'statewire'. */
|
|
10
|
+
extraRunConfig?: Record<string, unknown>;
|
|
5
11
|
/** API key for standalone authentication when no token is provided. */
|
|
6
12
|
apiKey?: string;
|
|
7
13
|
/** PropelAuth token. Takes priority over apiKey when provided. */
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
/** Deep-agent default model — matches the Olympus and mobile statewire hosts.
|
|
2
2
|
* The legacy transport keeps its own default model. */
|
|
3
3
|
export declare const DEFAULT_STATEWIRE_MODEL = "claude-sonnet-5";
|
|
4
|
+
/** Agent-id namespace for collab agents (`collab_agent:<asset_id>`). */
|
|
5
|
+
export declare const COLLAB_AGENT_REF_PREFIX = "collab_agent:";
|
|
6
|
+
/** The asset id when `agent` is a `collab_agent:<asset_id>` ref, else null. */
|
|
7
|
+
export declare function parseCollabAgentRef(agent: string | undefined | null): string | null;
|
|
4
8
|
export interface StatewireRunConfigOptions {
|
|
5
|
-
/** LLM model identifier. Defaults to the deep-agent default model
|
|
9
|
+
/** LLM model identifier. Defaults to the deep-agent default model — unless a
|
|
10
|
+
* collab agent is selected and its author set one (the backend overlay
|
|
11
|
+
* applies the agent's model when the run sends none), in which case no
|
|
12
|
+
* model is sent so the agent's choice wins. */
|
|
6
13
|
model?: string;
|
|
14
|
+
/** Agent selector. On statewire only the `collab_agent:<asset_id>` namespace
|
|
15
|
+
* is meaningful: the run executes AS that published collab agent (prompt,
|
|
16
|
+
* tools, model default). Any other value is ignored by the host. */
|
|
17
|
+
agent?: string;
|
|
18
|
+
/** Collab-agent channel id (built-in like `email`/`sms`, or a user-defined
|
|
19
|
+
* custom channel id) selecting that channel's configuration overrides.
|
|
20
|
+
* Sent as `collab_channel_id`; only meaningful with a collab `agent`. */
|
|
21
|
+
channel?: string;
|
|
7
22
|
/** Backend toolkit IDs to enable. */
|
|
8
23
|
tools?: string[];
|
|
9
24
|
/** Frontend tool IDs to include in enabled_tools. */
|
|
@@ -24,3 +24,11 @@ export declare function resolveAthenaTransport({ transport, }: {
|
|
|
24
24
|
transport?: AthenaTransport;
|
|
25
25
|
enableThreadList?: boolean;
|
|
26
26
|
}): ResolvedAthenaTransport;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a send may be dispatched while a run is already active.
|
|
29
|
+
*
|
|
30
|
+
* Statewire hosts the queue server-side, so a mid-run send is queued behind
|
|
31
|
+
* the live run. The legacy transport has no queue: a second dispatch would
|
|
32
|
+
* orphan the in-flight run and duplicate its pending placeholder.
|
|
33
|
+
*/
|
|
34
|
+
export declare function allowsMidRunSend(transport: AthenaTransport | undefined): boolean;
|
|
@@ -19,6 +19,11 @@ export interface AthenaStatewireRuntimeConfig {
|
|
|
19
19
|
getToken?: () => string | null | Promise<string | null>;
|
|
20
20
|
/** LLM model identifier. Defaults to the deep-agent default model. */
|
|
21
21
|
model?: string;
|
|
22
|
+
/** Agent selector: only `collab_agent:<asset_id>` refs are meaningful here
|
|
23
|
+
* (the run executes AS that published collab agent). Other values warn. */
|
|
24
|
+
agent?: string;
|
|
25
|
+
/** Collab-agent channel id selecting that channel's overrides. */
|
|
26
|
+
channel?: string;
|
|
22
27
|
/** Backend toolkit IDs to enable. */
|
|
23
28
|
tools?: string[];
|
|
24
29
|
/** Frontend tool IDs to include in enabled_tools. */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SDK's own version, inlined at build time. Surfaced in diagnostics, on
|
|
3
|
+
* `window.__ATHENA_SDK__.version`, and available to consumers so a host app
|
|
4
|
+
* can show "what SDK am I running" without reading node_modules.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ATHENA_REACT_SDK_VERSION: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@athenaintel/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Athena React SDK — Build AI-powered chat applications with the Athena platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@assistant-ui/core": "0.3.15",
|
|
50
50
|
"@assistant-ui/react": "0.15.16",
|
|
51
51
|
"@assistant-ui/react-langgraph": "0.14.24",
|
|
52
|
-
"@assistant-ui/react-statewire": "^0.
|
|
52
|
+
"@assistant-ui/react-statewire": "^0.21.0",
|
|
53
53
|
"@assistant-ui/tap": "0.9.14",
|
|
54
54
|
"@floating-ui/react": "^0.27.7",
|
|
55
55
|
"@tanstack/react-query": "5.99.2",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"cnfast": "0.0.8",
|
|
71
71
|
"lucide-react": "^0.575.0",
|
|
72
72
|
"radix-ui": "^1.4.3",
|
|
73
|
-
"statewire": "^0.
|
|
73
|
+
"statewire": "^0.12.0",
|
|
74
74
|
"tiptap-markdown": "^0.9.0",
|
|
75
75
|
"zod": "^3.24.0",
|
|
76
76
|
"zustand": "^5.0.11"
|