@athenaintel/react 0.10.40 → 0.10.41-rc.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 +52 -1
- package/dist/chat/StatewireApprovalCard.d.ts +2 -0
- package/dist/chat/StatewireClientToolBridge.d.ts +14 -0
- package/dist/chat/StatewireQueuedMessages.d.ts +8 -0
- package/dist/chat/statewire-approval.d.ts +35 -0
- package/dist/chat/statewire-banners.d.ts +17 -0
- package/dist/chat/statewire-client-tools.d.ts +24 -0
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +1 -1
- package/dist/index.cjs +6589 -1387
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +21 -2
- package/dist/index.js +6591 -1389
- package/dist/index.js.map +1 -1
- package/dist/lib/athena-urls.d.ts +30 -0
- package/dist/provider/AthenaContext.d.ts +4 -0
- package/dist/provider/AthenaProvider.d.ts +22 -1
- package/dist/provider/config.d.ts +7 -0
- package/dist/provider/statewire-lifecycle-context.d.ts +10 -0
- package/dist/runtime/statewire-lifecycle.d.ts +22 -0
- package/dist/runtime/statewire-run-config.d.ts +38 -0
- package/dist/runtime/transport.d.ts +26 -0
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +67 -0
- package/dist/threads/api.d.ts +14 -0
- package/dist/threads/statewire-thread-list.d.ts +42 -0
- package/dist/threads/useActiveThreadStateHydration.d.ts +4 -6
- package/dist/threads/useAthenaThreadManager.d.ts +7 -2
- package/dist/tools/tool-uis.d.ts +8 -0
- package/package.json +10 -4
|
@@ -8,6 +8,36 @@ export declare const DEFAULT_ATHENA_ENVIRONMENT: AthenaEnvironment;
|
|
|
8
8
|
export declare const DEFAULT_API_URL: string;
|
|
9
9
|
export declare const DEFAULT_BACKEND_URL: string;
|
|
10
10
|
export declare const DEFAULT_APP_URL: string;
|
|
11
|
+
/** Production statewire sync endpoint — the same host the mobile app and
|
|
12
|
+
* Chrome extension ship as their production statewire base. Exported as a
|
|
13
|
+
* constant for explicit configuration; it is deliberately NOT used as an
|
|
14
|
+
* implicit fallback (see {@link resolveStatewireSyncUrl}). */
|
|
15
|
+
export declare const DEFAULT_STATEWIRE_SYNC_URL = "https://iris.prd.athenaintel.com/v2/threads";
|
|
16
|
+
/**
|
|
17
|
+
* Derive the statewire sync endpoint (the `…/v2/threads` mount) that lives on
|
|
18
|
+
* the same host as the Iris chat streaming endpoint: staging
|
|
19
|
+
* `https://iris.stg.athenaintel.com/api/chat` maps to
|
|
20
|
+
* `https://iris.stg.athenaintel.com/v2/threads`, and likewise for production
|
|
21
|
+
* and workspace Iris hosts. Unparseable inputs return `null` so callers can
|
|
22
|
+
* fall back explicitly.
|
|
23
|
+
*/
|
|
24
|
+
export declare function deriveStatewireSyncUrl({ apiUrl, }: {
|
|
25
|
+
apiUrl?: string | null;
|
|
26
|
+
}): string | null;
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the statewire sync endpoint for a provider configuration: an
|
|
29
|
+
* explicit `statewireSyncUrl` wins, otherwise it is derived from the
|
|
30
|
+
* effective `apiUrl` host.
|
|
31
|
+
*
|
|
32
|
+
* When neither yields a URL this throws instead of falling back to an Athena
|
|
33
|
+
* default — mirroring `deriveAthenaApiUrl`'s null-for-unknown-hosts rule, so
|
|
34
|
+
* a misconfigured custom deployment can never silently send its bearer token
|
|
35
|
+
* or API key to Athena production.
|
|
36
|
+
*/
|
|
37
|
+
export declare function resolveStatewireSyncUrl({ statewireSyncUrl, apiUrl, }: {
|
|
38
|
+
statewireSyncUrl?: string;
|
|
39
|
+
apiUrl?: string | null;
|
|
40
|
+
}): string;
|
|
11
41
|
export declare function getAthenaEnvironmentUrls({ environment, }?: {
|
|
12
42
|
environment?: AthenaEnvironment;
|
|
13
43
|
}): AthenaEnvironmentUrls;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import type { AthenaTransport } from '../runtime/transport';
|
|
1
2
|
import type { AthenaProviderConfig } from './config';
|
|
2
3
|
import type { AthenaCitationLinkOptions, AthenaLinkClickOptions } from './citation-links';
|
|
3
4
|
export interface AthenaConfig extends Pick<AthenaProviderConfig, 'apiKey' | 'token'> {
|
|
4
5
|
backendUrl: string;
|
|
5
6
|
appUrl: string;
|
|
6
7
|
enabledToolkits: string[];
|
|
8
|
+
/** Effective chat transport. Statewire supports mid-run sends (the server
|
|
9
|
+
* queues them), so composer gating differs per transport. */
|
|
10
|
+
transport: AthenaTransport;
|
|
7
11
|
linkClicks?: AthenaLinkClickOptions;
|
|
8
12
|
citationLinks?: AthenaCitationLinkOptions;
|
|
9
13
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
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 AthenaTransport } from '../runtime/transport';
|
|
4
5
|
import type { AthenaProviderConfig } from './config';
|
|
5
6
|
import type { AthenaCitationLinkOptions, AthenaLinkClickOptions } from './citation-links';
|
|
6
7
|
import { type AthenaTheme } from '../theme';
|
|
@@ -34,6 +35,26 @@ export interface AthenaProviderProps {
|
|
|
34
35
|
appUrl?: string;
|
|
35
36
|
/** @deprecated Prefer `config.environment`. Athena environment preset used when URLs are not explicitly provided. */
|
|
36
37
|
environment?: AthenaEnvironment;
|
|
38
|
+
/** Chat transport mode. Defaults to 'legacy' (the Iris `/api/chat`
|
|
39
|
+
* assistant-transport stream). Pass 'statewire' to attach to the
|
|
40
|
+
* deep-agent statewire sync host (`…/v2/threads`) instead — the thread is
|
|
41
|
+
* hosted server-side and replicated live, so history, reconnect, and run
|
|
42
|
+
* scheduling come from the server snapshot. Works with and without
|
|
43
|
+
* `enableThreadList`.
|
|
44
|
+
*
|
|
45
|
+
* The `agent` prop is legacy-only (the statewire host always runs the
|
|
46
|
+
* Athena deep agent), and `model` defaults to the deep-agent default
|
|
47
|
+
* model in this mode. */
|
|
48
|
+
transport?: AthenaTransport;
|
|
49
|
+
/** Resolve the latest auth token immediately before a request (for
|
|
50
|
+
* expiring clients). Takes priority over `token` when it resolves. */
|
|
51
|
+
getToken?: () => string | null | Promise<string | null>;
|
|
52
|
+
/** Additional fields merged into runConfig.custom (statewire transport). */
|
|
53
|
+
extraRunConfig?: Record<string, unknown>;
|
|
54
|
+
/** Statewire sync base URL override (the `…/v2/threads` mount). Defaults to
|
|
55
|
+
* the effective `apiUrl` host + `/v2/threads`. Only used when `transport`
|
|
56
|
+
* is 'statewire'. */
|
|
57
|
+
statewireSyncUrl?: string;
|
|
37
58
|
/** Asset IDs to include in the workbench. */
|
|
38
59
|
workbench?: string[];
|
|
39
60
|
/** Knowledge base IDs for RAG context. */
|
|
@@ -83,4 +104,4 @@ export interface AthenaProviderProps {
|
|
|
83
104
|
* Prefer `config.posthog` for structured configuration. */
|
|
84
105
|
posthog?: PostHogConfig;
|
|
85
106
|
}
|
|
86
|
-
export declare function AthenaProvider({ children, config, apiKey, token: tokenProp, agent, model, tools, frontendTools, disableAutoOpen, apiUrl, backendUrl, appUrl, environment, workbench, knowledgeBase, systemPrompt, customToolConfigs, appId, threadId: threadIdProp, enableThreadList, theme, linkClicks, citationLinks, posthog: posthogProp, }: AthenaProviderProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | null;
|
|
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;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AthenaEnvironment } from '../lib/athena-urls';
|
|
2
|
+
import type { AthenaTransport } from '../runtime/transport';
|
|
2
3
|
import type { PostHogConfig } from './PostHogProvider';
|
|
3
4
|
export interface AthenaProviderConfig {
|
|
4
5
|
/** API key for standalone authentication when no token is provided. */
|
|
@@ -7,6 +8,12 @@ export interface AthenaProviderConfig {
|
|
|
7
8
|
token?: string | null;
|
|
8
9
|
/** URL for the chat streaming endpoint. Defaults to the matching Athena environment. */
|
|
9
10
|
apiUrl?: string;
|
|
11
|
+
/** Chat transport mode. Defaults to 'legacy'; pass 'statewire' to attach to
|
|
12
|
+
* the deep-agent statewire sync host instead of the legacy chat stream. */
|
|
13
|
+
transport?: AthenaTransport;
|
|
14
|
+
/** Statewire sync base URL override (the `…/v2/threads` mount). Defaults to
|
|
15
|
+
* the `apiUrl` host + `/v2/threads`. Only used when transport is 'statewire'. */
|
|
16
|
+
statewireSyncUrl?: string;
|
|
10
17
|
/** URL for the Athena backend API. Defaults to the matching Athena environment. */
|
|
11
18
|
backendUrl?: string;
|
|
12
19
|
/** URL for the Athena frontend app origin. Defaults to the matching Athena environment. */
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AthenaStatewireLifecycleState } from '../runtime/statewire-lifecycle';
|
|
2
|
+
/**
|
|
3
|
+
* Statewire transport lifecycle (connection status, transport errors,
|
|
4
|
+
* read-only flag, reconnect handle). Provided by `AthenaProvider` in
|
|
5
|
+
* statewire mode; `null` on the legacy transport, so lifecycle-driven UI
|
|
6
|
+
* renders nothing there.
|
|
7
|
+
*/
|
|
8
|
+
export declare const AthenaStatewireLifecycleContext: import("react").Context<AthenaStatewireLifecycleState | null>;
|
|
9
|
+
/** Read the statewire lifecycle, or null outside statewire mode. */
|
|
10
|
+
export declare function useAthenaStatewireLifecycle(): AthenaStatewireLifecycleState | null;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { DeepAgentConnectionState } from '@athenaintel/agent-runtime';
|
|
2
|
+
/** A user-visible notice mapped from a statewire transport error. */
|
|
3
|
+
export interface AthenaStatewireErrorNotice {
|
|
4
|
+
kind: 'paywall' | 'read-only' | 'command';
|
|
5
|
+
title: string;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Map the statewire failure envelope to a concise, actionable notice.
|
|
10
|
+
* Returns null for expected channel teardowns (thread switch, unmount),
|
|
11
|
+
* which must not surface as errors.
|
|
12
|
+
*/
|
|
13
|
+
export declare function athenaStatewireErrorNotice(error: unknown): AthenaStatewireErrorNotice | null;
|
|
14
|
+
/** Shared lifecycle state for the statewire transport, provided by
|
|
15
|
+
* `AthenaProvider` in statewire mode and read by the chat banners. */
|
|
16
|
+
export interface AthenaStatewireLifecycleState {
|
|
17
|
+
connection: DeepAgentConnectionState | null;
|
|
18
|
+
error: AthenaStatewireErrorNotice | null;
|
|
19
|
+
legacyReadOnly: boolean;
|
|
20
|
+
reconnect: (() => void) | null;
|
|
21
|
+
dismissError: () => void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** Deep-agent default model — matches the Olympus and mobile statewire hosts.
|
|
2
|
+
* The legacy transport keeps its own default model. */
|
|
3
|
+
export declare const DEFAULT_STATEWIRE_MODEL = "claude-sonnet-5";
|
|
4
|
+
export interface StatewireRunConfigOptions {
|
|
5
|
+
/** LLM model identifier. Defaults to the deep-agent default model. */
|
|
6
|
+
model?: string;
|
|
7
|
+
/** Backend toolkit IDs to enable. */
|
|
8
|
+
tools?: string[];
|
|
9
|
+
/** Frontend tool IDs to include in enabled_tools. */
|
|
10
|
+
frontendToolIds?: string[];
|
|
11
|
+
/** Asset IDs to include in the workbench. */
|
|
12
|
+
workbench?: string[];
|
|
13
|
+
/** Knowledge base IDs for RAG context. */
|
|
14
|
+
knowledgeBase?: string[];
|
|
15
|
+
/** System prompt override. */
|
|
16
|
+
systemPrompt?: string;
|
|
17
|
+
/** Custom tool configurations, passed through as custom_tool_configs. */
|
|
18
|
+
customToolConfigs?: Record<string, unknown>;
|
|
19
|
+
/** Client app identifier, passed through as app_id. */
|
|
20
|
+
appId?: string;
|
|
21
|
+
/** Client-executed tool declarations, passed through as client_tools. The
|
|
22
|
+
* deep-agent runtime binds each as an interrupt-backed tool the client
|
|
23
|
+
* answers via the statewire client-tool bridge. */
|
|
24
|
+
clientTools?: Record<string, unknown>[];
|
|
25
|
+
/** Additional fields merged into runConfig.custom. */
|
|
26
|
+
extraRunConfig?: Record<string, unknown>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Build the `runConfig` a deep-agent statewire run is driven by. Commands
|
|
30
|
+
* travel bare on the statewire channel, so this payload rides the ambient
|
|
31
|
+
* model context (`config.runConfig`) instead of the request body.
|
|
32
|
+
*
|
|
33
|
+
* The flattened `custom` fields drive the run, while `panel_config` carries a
|
|
34
|
+
* minimal panel state the backend persists per thread and replays on the
|
|
35
|
+
* statewire snapshot — so a session started from the SDK stays configured
|
|
36
|
+
* when reopened elsewhere.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildStatewireRunConfig(options?: StatewireRunConfigOptions): Record<string, unknown>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const ATHENA_TRANSPORTS: {
|
|
2
|
+
readonly legacy: 'legacy';
|
|
3
|
+
readonly statewire: 'statewire';
|
|
4
|
+
};
|
|
5
|
+
/** Chat transport mode: `legacy` (Iris `/api/chat` assistant-transport) or
|
|
6
|
+
* `statewire` (Iris `/v2/threads` deep-agent statewire sync). */
|
|
7
|
+
export type AthenaTransport = (typeof ATHENA_TRANSPORTS)[keyof typeof ATHENA_TRANSPORTS];
|
|
8
|
+
/** Consumers opt in to statewire explicitly; the default stays legacy until
|
|
9
|
+
* statewire has been validated live across SDK hosts. */
|
|
10
|
+
export declare const DEFAULT_ATHENA_TRANSPORT: AthenaTransport;
|
|
11
|
+
export interface ResolvedAthenaTransport {
|
|
12
|
+
transport: AthenaTransport;
|
|
13
|
+
/** Human-readable reason when the requested transport could not be honored. */
|
|
14
|
+
fallbackReason: string | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolve the effective chat transport for a provider configuration.
|
|
18
|
+
*
|
|
19
|
+
* Both provider modes (standalone and thread-list) support both transports;
|
|
20
|
+
* the resolver exists so a future incompatible combination can fall back
|
|
21
|
+
* with a reported reason instead of silently running the wrong transport.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveAthenaTransport({ transport, }: {
|
|
24
|
+
transport?: AthenaTransport;
|
|
25
|
+
enableThreadList?: boolean;
|
|
26
|
+
}): ResolvedAthenaTransport;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { AssistantClient, Toolkit } from '@assistant-ui/react';
|
|
2
|
+
import { type UseDeepAgentThreadOptions } from '@athenaintel/agent-runtime';
|
|
3
|
+
import { type StatewireClientTool } from '../chat/statewire-client-tools';
|
|
4
|
+
import { DEFAULT_STATEWIRE_MODEL } from './statewire-run-config';
|
|
5
|
+
export { DEFAULT_STATEWIRE_MODEL };
|
|
6
|
+
export interface AthenaStatewireRuntimeConfig {
|
|
7
|
+
/** Base URL of the statewire sync host (the `…/v2/threads` mount). */
|
|
8
|
+
syncUrl: string;
|
|
9
|
+
/** Thread ID the statewire session attaches to. */
|
|
10
|
+
threadId: string;
|
|
11
|
+
/** True only for a never-started local chat. Existing (or pre-assigned)
|
|
12
|
+
* threads load until their server snapshot arrives. */
|
|
13
|
+
isNewChat?: boolean;
|
|
14
|
+
/** API key for authentication. Used when no auth token is provided. */
|
|
15
|
+
apiKey?: string;
|
|
16
|
+
/** Auth token. Takes priority over apiKey. */
|
|
17
|
+
token?: string | null;
|
|
18
|
+
/** Resolve the latest token immediately before a request (for expiring clients). */
|
|
19
|
+
getToken?: () => string | null | Promise<string | null>;
|
|
20
|
+
/** LLM model identifier. Defaults to the deep-agent default model. */
|
|
21
|
+
model?: string;
|
|
22
|
+
/** Backend toolkit IDs to enable. */
|
|
23
|
+
tools?: string[];
|
|
24
|
+
/** Frontend tool IDs to include in enabled_tools. */
|
|
25
|
+
frontendToolIds?: string[];
|
|
26
|
+
/** Frontend tools registered on the assistant client. Tools with a local
|
|
27
|
+
* `execute` are also declared as `client_tools` and executed through the
|
|
28
|
+
* statewire client-tool bridge. */
|
|
29
|
+
frontendToolkit?: Toolkit;
|
|
30
|
+
/** Asset IDs to include in the workbench. */
|
|
31
|
+
workbench?: string[];
|
|
32
|
+
/** Knowledge base IDs for RAG context. */
|
|
33
|
+
knowledgeBase?: string[];
|
|
34
|
+
/** System prompt override. */
|
|
35
|
+
systemPrompt?: string;
|
|
36
|
+
/** Custom tool configurations. Passed as custom_tool_configs in runConfig. */
|
|
37
|
+
customToolConfigs?: Record<string, unknown>;
|
|
38
|
+
/** Client app identifier for session filtering. Sent as app_id in runConfig.custom. */
|
|
39
|
+
appId?: string;
|
|
40
|
+
/** Additional fields merged into runConfig.custom. */
|
|
41
|
+
extraRunConfig?: Record<string, unknown>;
|
|
42
|
+
/** Called on statewire transport errors (send rejections, stream failures). */
|
|
43
|
+
onError?: (error: Error) => void;
|
|
44
|
+
/** Projected connection status changes (deduped; null on unmount). */
|
|
45
|
+
onConnectionChange?: UseDeepAgentThreadOptions['onConnectionChange'];
|
|
46
|
+
/** Raw connection observer — carries the transport's reconnect handle. */
|
|
47
|
+
onRawConnectionChange?: UseDeepAgentThreadOptions['onRawConnectionChange'];
|
|
48
|
+
/** Notified when the snapshot flags a read-only pre-cutover thread. */
|
|
49
|
+
onLegacyReadOnly?: UseDeepAgentThreadOptions['onLegacyReadOnly'];
|
|
50
|
+
/** Notified when a run starts/stops. */
|
|
51
|
+
onRunningChange?: UseDeepAgentThreadOptions['onRunningChange'];
|
|
52
|
+
}
|
|
53
|
+
/** The client tools derived from the runtime's frontend toolkit — exposed so
|
|
54
|
+
* the provider can mount the client-tool bridge with the same set. */
|
|
55
|
+
export declare function useStatewireClientTools(frontendToolkit: Toolkit | undefined): StatewireClientTool[];
|
|
56
|
+
/**
|
|
57
|
+
* Statewire runtime for the Athena SDK: attaches to the agora-hosted
|
|
58
|
+
* deep-agent thread at `${syncUrl}/${threadId}` through the shared
|
|
59
|
+
* `@athenaintel/agent-runtime` core, and returns the `AssistantClient` to
|
|
60
|
+
* mount via `AuiProvider` — the same integration shape as the Chrome
|
|
61
|
+
* extension and mobile statewire hosts.
|
|
62
|
+
*
|
|
63
|
+
* Auth mirrors the legacy transport's credential plumbing: a token (resolved
|
|
64
|
+
* live through `getToken` when provided) rides `Authorization: Bearer`, and
|
|
65
|
+
* an API key falls back to `X-API-KEY` — both accepted by the statewire host.
|
|
66
|
+
*/
|
|
67
|
+
export declare function useAthenaStatewireRuntime(config: AthenaStatewireRuntimeConfig): AssistantClient;
|
package/dist/threads/api.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ export interface ThreadSummary {
|
|
|
10
10
|
last_message: string | null;
|
|
11
11
|
message_count: number;
|
|
12
12
|
state: string | null;
|
|
13
|
+
start_channel?: string | null;
|
|
14
|
+
last_channel?: string | null;
|
|
15
|
+
/** Whether the calling user has seen this thread since it last changed. */
|
|
16
|
+
is_unread?: boolean;
|
|
13
17
|
}
|
|
14
18
|
export interface ThreadListResponse {
|
|
15
19
|
threads: ThreadSummary[];
|
|
@@ -26,7 +30,17 @@ export declare function listThreads(backendUrl: string, auth: AuthConfig, opts?:
|
|
|
26
30
|
offset?: number;
|
|
27
31
|
exclude_triggered?: boolean;
|
|
28
32
|
app_id?: string;
|
|
33
|
+
start_channel?: string;
|
|
29
34
|
}): Promise<ThreadListResponse>;
|
|
35
|
+
export interface ThreadReadStateResponse {
|
|
36
|
+
thread_id: string;
|
|
37
|
+
is_unread: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** Store the calling user's read receipt for a thread. */
|
|
40
|
+
export declare function setThreadReadState(backendUrl: string, auth: AuthConfig, opts: {
|
|
41
|
+
threadId: string;
|
|
42
|
+
isUnread: boolean;
|
|
43
|
+
}): Promise<ThreadReadStateResponse>;
|
|
30
44
|
export declare function createThread(backendUrl: string, auth: AuthConfig, opts?: {
|
|
31
45
|
systemPrompt?: string;
|
|
32
46
|
enabledTools?: string[];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface AthenaStatewireThreadSummary {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string | null;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Thread-list state for the statewire transport. The list itself is the same
|
|
8
|
+
* persisted Agora session list the legacy adapter reads; the ACTIVE thread is
|
|
9
|
+
* a plain id the statewire runtime attaches to — switching threads remounts
|
|
10
|
+
* the statewire session against the new `…/v2/threads/{id}` URL (the same
|
|
11
|
+
* model the mobile app uses).
|
|
12
|
+
*/
|
|
13
|
+
export interface AthenaStatewireThreadListState {
|
|
14
|
+
threads: AthenaStatewireThreadSummary[];
|
|
15
|
+
isLoading: boolean;
|
|
16
|
+
activeThreadId: string;
|
|
17
|
+
/** True while the active thread is a locally-minted chat with no server history. */
|
|
18
|
+
isNewChat: boolean;
|
|
19
|
+
selectThread: (threadId: string) => void;
|
|
20
|
+
newThread: () => void;
|
|
21
|
+
refresh: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const AthenaStatewireThreadListContext: import("react").Context<AthenaStatewireThreadListState | null>;
|
|
24
|
+
/** Read the statewire thread-list state, or null outside that mode. */
|
|
25
|
+
export declare function useAthenaStatewireThreadList(): AthenaStatewireThreadListState | null;
|
|
26
|
+
/**
|
|
27
|
+
* Provides the statewire thread-list state, with an SDK-scoped QueryClient so
|
|
28
|
+
* consumers do not need their own QueryClientProvider.
|
|
29
|
+
*/
|
|
30
|
+
export declare function AthenaStatewireThreadListProvider({ backendUrl, apiKey, token, appId, initialThreadId, children, }: {
|
|
31
|
+
backendUrl: string;
|
|
32
|
+
apiKey?: string;
|
|
33
|
+
token?: string | null;
|
|
34
|
+
appId?: string;
|
|
35
|
+
initialThreadId?: string;
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* Refreshes the thread list until a freshly-started thread's server-generated
|
|
40
|
+
* title appears. Mount inside the statewire runtime scope (needs aui state).
|
|
41
|
+
*/
|
|
42
|
+
export declare function StatewireThreadTitlePoller(): null;
|
|
@@ -3,12 +3,10 @@ interface ActiveThreadStateHydrationConfig {
|
|
|
3
3
|
apiKey?: string;
|
|
4
4
|
token?: string | null;
|
|
5
5
|
}
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
threadId: string;
|
|
6
|
+
type HydratableThreadListItemState = {
|
|
7
|
+
remoteId?: string | undefined;
|
|
8
|
+
id: string;
|
|
11
9
|
};
|
|
12
|
-
export declare const selectHydratableThreadId: (state:
|
|
10
|
+
export declare const selectHydratableThreadId: (state: HydratableThreadListItemState) => string | null;
|
|
13
11
|
export declare function useActiveThreadStateHydration({ backendUrl, apiKey, token, }: ActiveThreadStateHydrationConfig): void;
|
|
14
12
|
export {};
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Must be used inside `<AthenaProvider enableThreadList>`.
|
|
8
8
|
*/
|
|
9
|
-
import { type ThreadListState } from '@assistant-ui/react';
|
|
10
9
|
export interface AthenaThreadManagerState {
|
|
11
10
|
/** The backend thread ID of the currently active thread, or null if not yet synced. */
|
|
12
11
|
activeThreadId: string | null;
|
|
@@ -19,7 +18,13 @@ export interface AthenaThreadManagerState {
|
|
|
19
18
|
/** Create and switch to a new empty thread. */
|
|
20
19
|
switchToNewThread: () => Promise<void>;
|
|
21
20
|
}
|
|
22
|
-
type ActiveThreadState =
|
|
21
|
+
type ActiveThreadState = {
|
|
22
|
+
mainThreadId: string;
|
|
23
|
+
threadItems: readonly {
|
|
24
|
+
id: string;
|
|
25
|
+
remoteId?: string | undefined;
|
|
26
|
+
}[];
|
|
27
|
+
};
|
|
23
28
|
export declare const selectActiveThreadRemoteId: (state: ActiveThreadState) => string | null;
|
|
24
29
|
export declare function useAthenaThreadManager(): AthenaThreadManagerState | null;
|
|
25
30
|
export {};
|
package/dist/tools/tool-uis.d.ts
CHANGED
|
@@ -47,6 +47,14 @@ export declare const DescribeDatabaseToolUI: ToolCallMessagePartComponent;
|
|
|
47
47
|
export declare const ListDatabaseTablesToolUI: ToolCallMessagePartComponent;
|
|
48
48
|
export declare const GetDatabaseTableSchemaToolUI: ToolCallMessagePartComponent;
|
|
49
49
|
export declare const RunSqlToolUI: ToolCallMessagePartComponent;
|
|
50
|
+
/**
|
|
51
|
+
* A rejected `update_sheet_range` write (data-validation violation, no-op, or
|
|
52
|
+
* other failure) comes back as `success: false` rather than raising, so build a
|
|
53
|
+
* concise, user-facing reason for the tool card instead of a false "Updated"
|
|
54
|
+
* success. Prefers naming the offending cells and their allowed values, then
|
|
55
|
+
* falls back to the backend error string, then a generic message.
|
|
56
|
+
*/
|
|
57
|
+
export declare function buildSheetUpdateFailureMessage(data: Record<string, unknown> | null, range: string): string;
|
|
50
58
|
export declare const UpdateSheetRangeToolUI: ToolCallMessagePartComponent;
|
|
51
59
|
export declare const BulkFormatSheetRangeToolUI: ToolCallMessagePartComponent;
|
|
52
60
|
export declare const SetRowColumnDimensionsToolUI: ToolCallMessagePartComponent;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@athenaintel/react",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.41-rc.1",
|
|
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",
|
|
@@ -46,9 +46,13 @@
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@assistant-ui/
|
|
50
|
-
"@assistant-ui/react
|
|
49
|
+
"@assistant-ui/core": "0.3.15",
|
|
50
|
+
"@assistant-ui/react": "0.15.16",
|
|
51
|
+
"@assistant-ui/react-langgraph": "0.14.24",
|
|
52
|
+
"@assistant-ui/react-statewire": "^0.17.0",
|
|
53
|
+
"@assistant-ui/tap": "0.9.14",
|
|
51
54
|
"@floating-ui/react": "^0.27.7",
|
|
55
|
+
"@tanstack/react-query": "5.99.2",
|
|
52
56
|
"@tanstack/react-store": "^0.9.1",
|
|
53
57
|
"@tiptap/core": "^2.11",
|
|
54
58
|
"@tiptap/extension-link": "^2.11",
|
|
@@ -61,16 +65,18 @@
|
|
|
61
65
|
"@tiptap/react": "^2.11",
|
|
62
66
|
"@tiptap/starter-kit": "^2.11",
|
|
63
67
|
"@tiptap/suggestion": "^2.11",
|
|
64
|
-
"assistant-stream": "0.3.
|
|
68
|
+
"assistant-stream": "0.3.39",
|
|
65
69
|
"class-variance-authority": "^0.7.1",
|
|
66
70
|
"cnfast": "0.0.8",
|
|
67
71
|
"lucide-react": "^0.575.0",
|
|
68
72
|
"radix-ui": "^1.4.3",
|
|
73
|
+
"statewire": "^0.9.1",
|
|
69
74
|
"tiptap-markdown": "^0.9.0",
|
|
70
75
|
"zod": "^3.24.0",
|
|
71
76
|
"zustand": "^5.0.11"
|
|
72
77
|
},
|
|
73
78
|
"devDependencies": {
|
|
79
|
+
"@athenaintel/agent-runtime": "workspace:*",
|
|
74
80
|
"@propelauth/react": "^2.1.1",
|
|
75
81
|
"@types/react": "^19.0.0",
|
|
76
82
|
"@types/react-dom": "^19.0.0",
|