@athenaintel/react 0.16.3 → 0.18.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.
Files changed (56) hide show
  1. package/README.md +89 -51
  2. package/dist/AthenaContext-B1QMhIP-.cjs.map +1 -1
  3. package/dist/AthenaContext-MOslgOmE.js.map +1 -1
  4. package/dist/chat/statewire-banners.d.ts +5 -9
  5. package/dist/chat-ui/index.d.ts +3 -0
  6. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +24 -0
  7. package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +5 -0
  8. package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +1 -1
  9. package/dist/chat-ui/messages/continue-pill.d.ts +13 -0
  10. package/dist/chat-ui/messages/message-components.d.ts +7 -2
  11. package/dist/chat-ui/messages/runtime-message.d.ts +22 -0
  12. package/dist/chat-ui/messages/statewire-continue-run.d.ts +41 -0
  13. package/dist/chat-ui/thread/chat-composer-dock.d.ts +1 -1
  14. package/dist/chat-ui.cjs +279 -56
  15. package/dist/chat-ui.cjs.map +1 -1
  16. package/dist/chat-ui.js +312 -89
  17. package/dist/chat-ui.js.map +1 -1
  18. package/dist/diagnostics/athena-diagnostics.d.ts +1 -1
  19. package/dist/diagnostics/errors.d.ts +0 -4
  20. package/dist/index.cjs +18866 -21879
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.ts +4 -8
  23. package/dist/index.js +18884 -21897
  24. package/dist/index.js.map +1 -1
  25. package/dist/lib/athena-urls.d.ts +0 -2
  26. package/dist/lib/posthog/wrap-posthog-client.d.ts +3 -1
  27. package/dist/provider/AthenaContext.d.ts +0 -7
  28. package/dist/provider/AthenaProvider.d.ts +25 -51
  29. package/dist/provider/config.d.ts +13 -12
  30. package/dist/provider/statewire-lifecycle-context.d.ts +3 -4
  31. package/dist/provider/types.d.ts +0 -1
  32. package/dist/runtime/auth.d.ts +37 -4
  33. package/dist/runtime/statewire-lifecycle.d.ts +0 -1
  34. package/dist/runtime/statewire-run-config.d.ts +18 -5
  35. package/dist/runtime/useAthenaStatewireRuntime.d.ts +6 -11
  36. package/dist/styles.css +1 -1
  37. package/dist/threads/ThreadList.d.ts +6 -1
  38. package/dist/threads/statewire-thread-list.d.ts +6 -5
  39. package/dist/threads/thread-id-context.d.ts +9 -0
  40. package/dist/threads/use-statewire-conversation-history.d.ts +2 -0
  41. package/dist/threads/useAthenaThreadManager.d.ts +24 -12
  42. package/dist/{use-rest-conversation-history-BgG4VyZQ.js → use-rest-conversation-history-Bs5qn5G3.js} +7500 -6959
  43. package/dist/use-rest-conversation-history-Bs5qn5G3.js.map +1 -0
  44. package/dist/{use-rest-conversation-history-CMuTZmsp.cjs → use-rest-conversation-history-Dm0rdQgT.cjs} +7311 -6770
  45. package/dist/use-rest-conversation-history-Dm0rdQgT.cjs.map +1 -0
  46. package/package.json +3 -3
  47. package/dist/runtime/converter.d.ts +0 -5
  48. package/dist/runtime/external-message-converter.d.ts +0 -21
  49. package/dist/runtime/schemas.d.ts +0 -24
  50. package/dist/runtime/transport.d.ts +0 -37
  51. package/dist/runtime/useAthenaRuntime.d.ts +0 -47
  52. package/dist/threads/adapter.d.ts +0 -42
  53. package/dist/threads/useActiveThreadStateHydration.d.ts +0 -12
  54. package/dist/threads/useThreadTitlePolling.d.ts +0 -14
  55. package/dist/use-rest-conversation-history-BgG4VyZQ.js.map +0 -1
  56. package/dist/use-rest-conversation-history-CMuTZmsp.cjs.map +0 -1
@@ -5,8 +5,6 @@ export interface AthenaEnvironmentUrls {
5
5
  appUrl: string;
6
6
  }
7
7
  export declare const DEFAULT_ATHENA_ENVIRONMENT: AthenaEnvironment;
8
- export declare const DEFAULT_API_URL: string;
9
- export declare const DEFAULT_BACKEND_URL: string;
10
8
  export declare const DEFAULT_APP_URL: string;
11
9
  /** Production statewire sync endpoint — the same host the mobile app and
12
10
  * Chrome extension ship as their production statewire base. Exported as a
@@ -1,11 +1,13 @@
1
1
  import type { CaptureResult, PostHog, Properties } from 'posthog-js';
2
2
  import type { CaptureOptions } from 'posthog-js';
3
3
  import { PosthogCaptureGate } from './capture-gate';
4
+ type PosthogCaptureExceptionFn = (error: unknown, additionalProperties?: Properties) => CaptureResult | undefined;
4
5
  export type PosthogCaptureClient = Pick<PostHog, 'capture'> & {
5
- captureException?: (error: unknown, additionalProperties?: Properties) => CaptureResult | undefined;
6
+ captureException?: PosthogCaptureExceptionFn;
6
7
  };
7
8
  export declare function getPosthogCaptureGate(): PosthogCaptureGate;
8
9
  export declare function resetPosthogCaptureGateForTests(): void;
9
10
  export declare function wrapPosthogClient<TClient extends PosthogCaptureClient>(client: TClient): TClient;
10
11
  export declare function capturePosthogEvent(client: PosthogCaptureClient | null | undefined, event: string, properties?: Properties, options?: CaptureOptions): void;
11
12
  export declare function capturePosthogException(client: PosthogCaptureClient | null | undefined, error: Error, properties?: Properties, options?: CaptureOptions): void;
13
+ export {};
@@ -1,16 +1,9 @@
1
- import type { AthenaTransport } from '../runtime/transport';
2
1
  import type { AthenaProviderConfig } from './config';
3
2
  import type { AthenaCitationLinkOptions, AthenaLinkClickOptions } from './citation-links';
4
3
  export interface AthenaConfig extends Pick<AthenaProviderConfig, 'apiKey' | 'token'> {
5
4
  backendUrl: string;
6
5
  appUrl: string;
7
6
  enabledToolkits: string[];
8
- /** Effective chat transport — the lane the provider actually mounted (the
9
- * SDK defaults to 'statewire'; see `DEFAULT_ATHENA_TRANSPORT`). Optional
10
- * only so hand-built `AthenaConfig` literals keep compiling; capability
11
- * gates treat an absent value as the conservative legacy lane (e.g.
12
- * `allowsMidRunSend(undefined)` is false). */
13
- transport?: AthenaTransport;
14
7
  linkClicks?: AthenaLinkClickOptions;
15
8
  citationLinks?: AthenaCitationLinkOptions;
16
9
  }
@@ -3,7 +3,6 @@ import type { Toolkit } from '@assistant-ui/react';
3
3
  import { type AthenaEnvironment } from '../lib/athena-urls';
4
4
  import { type AthenaDiagnosticEvent, type AthenaDiagnosticLevel, type AthenaDiagnosticsConfig } from '../diagnostics/athena-diagnostics';
5
5
  import type { AthenaSdkError } from '../diagnostics/errors';
6
- import { type AthenaTransport } from '../runtime/transport';
7
6
  import type { AthenaProviderConfig } from './config';
8
7
  import type { AthenaCitationLinkOptions, AthenaLinkClickOptions } from './citation-links';
9
8
  import { type AthenaTheme } from '../theme';
@@ -17,35 +16,39 @@ export interface AthenaProviderProps {
17
16
  /** @deprecated Prefer `config.token`. PropelAuth token. If provided, takes priority over apiKey. If omitted, the SDK
18
17
  * will automatically listen for a token from the parent window via PostMessage. */
19
18
  token?: string | null;
20
- /** Agent selector.
19
+ /** Run the thread AS a published collab agent. The only accepted shape is
20
+ * `collab_agent:<asset_id>`: the thread then uses that agent's prompt,
21
+ * tools, and model default, and the caller must have view access to the
22
+ * agent asset. Omit it (or pass a blank string) to run the Athena deep agent.
21
23
  *
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. */
24
+ * Any other non-blank value throws at render the statewire host cannot
25
+ * honour named agents, and a selector that is silently dropped would let a
26
+ * misconfigured deployment answer as the wrong agent. */
30
27
  agent?: string;
31
28
  /** Collab-agent channel id — a built-in channel (`email`, `sms`, …) or a
32
29
  * user-defined custom channel id from the agent's Channels tab. Selects
33
30
  * 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. */
31
+ * Only meaningful together with a `collab_agent:<asset_id>` `agent`; sent
32
+ * as `collab_channel_id`. An unknown or disabled channel rejects the run
33
+ * with a structured, teaching error. */
37
34
  channel?: string;
38
- /** LLM model identifier. Defaults to 'claude-opus-4-8-thinking-max-fast'. */
35
+ /** LLM model identifier. Defaults to the deep-agent default model
36
+ * (`DEFAULT_STATEWIRE_MODEL`) — or, when a collab agent is selected, to
37
+ * the model its author configured. */
39
38
  model?: string;
40
39
  /** Backend toolkit IDs to enable (e.g. 'document_toolkit', 'web_search_browse_toolkit'). */
41
40
  tools?: string[];
42
41
  /** Frontend tools that execute in the browser. The agent can invoke these.
43
42
  * Merged on top of the SDK's default auto-open tools; entries here take
44
- * precedence over defaults with the same name. */
43
+ * precedence over defaults with the same name. Tools with a local
44
+ * `execute` are declared to the backend as `client_tools` and run through
45
+ * the statewire client-tool bridge. */
45
46
  frontendTools?: Toolkit;
46
47
  /** Disable the SDK's default auto-open behavior for created/touched assets. */
47
48
  disableAutoOpen?: boolean;
48
- /** @deprecated Prefer `config.apiUrl`. URL for the chat streaming endpoint. */
49
+ /** @deprecated Prefer `config.apiUrl`. URL on the Iris host fronting the
50
+ * deployment; its origin derives the statewire sync mount when
51
+ * `statewireSyncUrl` is not set. */
49
52
  apiUrl?: string;
50
53
  /** @deprecated Prefer `config.backendUrl`. URL for the Athena backend API. */
51
54
  backendUrl?: string;
@@ -53,29 +56,16 @@ export interface AthenaProviderProps {
53
56
  appUrl?: string;
54
57
  /** @deprecated Prefer `config.environment`. Athena environment preset used when URLs are not explicitly provided. */
55
58
  environment?: AthenaEnvironment;
56
- /** Chat transport mode. Defaults to 'statewire' (the deep-agent statewire
57
- * sync host, `…/v2/threads`): the thread is hosted server-side and
58
- * replicated live, so history, reconnect, and run scheduling come from the
59
- * server snapshot. Works with and without `enableThreadList`.
60
- *
61
- * Pass 'legacy' to opt a deployment back onto the legacy Iris `/api/chat`
62
- * assistant-transport stream. Threads are transport-scoped: conversations
63
- * created on one transport are read-only from the other.
64
- *
65
- * On statewire the `agent` prop only accepts `collab_agent:<asset_id>`
66
- * refs (the host always runs the Athena deep agent), and `model` defaults
67
- * to the deep-agent default model. */
68
- transport?: AthenaTransport;
69
59
  /** Resolve the latest auth token immediately before a request (for
70
60
  * expiring clients). Takes priority over `token` when it resolves.
71
- * Only used when `transport` is 'statewire'. Prefer `config.getToken`. */
61
+ * Prefer `config.getToken`. */
72
62
  getToken?: () => string | null | Promise<string | null>;
73
- /** Additional fields merged into runConfig.custom. Only used when
74
- * `transport` is 'statewire'. Prefer `config.extraRunConfig`. */
63
+ /** Additional fields merged into runConfig.custom. Prefer
64
+ * `config.extraRunConfig`. */
75
65
  extraRunConfig?: Record<string, unknown>;
76
66
  /** Statewire sync base URL override (the `…/v2/threads` mount). Defaults to
77
- * the effective `apiUrl` host + `/v2/threads`. Only used when `transport`
78
- * is 'statewire'. */
67
+ * the mount a Marathon host mints, then the effective `apiUrl` host +
68
+ * `/v2/threads`. Prefer `config.statewireSyncUrl`. */
79
69
  statewireSyncUrl?: string;
80
70
  /** Asset IDs to include in the workbench. */
81
71
  workbench?: string[];
@@ -83,22 +73,6 @@ export interface AthenaProviderProps {
83
73
  knowledgeBase?: string[];
84
74
  /** System prompt override. */
85
75
  systemPrompt?: string;
86
- /** Custom tool configurations (e.g. MCP servers).
87
- * Legacy transport only: passed through as `custom_tool_configs` in
88
- * runConfig.custom. The deep-agent statewire lane never sends it — that
89
- * runtime has no `custom_tool_configs` reader (MCP configuration is the
90
- * parsed `mcp_server_configs` key).
91
- *
92
- * @example
93
- * <AthenaProvider customToolConfigs={{
94
- * mcp: {
95
- * "my-server": {
96
- * config: { transport: "streamable_http", url: "https://..." },
97
- * }
98
- * }
99
- * }}>
100
- */
101
- customToolConfigs?: Record<string, unknown>;
102
76
  /** Client app identifier for session filtering.
103
77
  * Sessions created with this ID can be filtered in the thread list.
104
78
  * E.g. "olympus", "athena-app", or a computer asset ID like "asset_<uuid>". */
@@ -147,4 +121,4 @@ export interface AthenaProviderProps {
147
121
  * error handling, so integrations never fail silently. */
148
122
  onError?: (error: AthenaSdkError, event: AthenaDiagnosticEvent) => void;
149
123
  }
150
- 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/jsx-runtime").JSX.Element | null;
124
+ export declare function AthenaProvider({ children, config, apiKey, token: tokenProp, agent, channel, model, tools, frontendTools, disableAutoOpen, apiUrl, backendUrl, appUrl, environment, statewireSyncUrl, getToken, extraRunConfig, workbench, knowledgeBase, systemPrompt, appId, threadId: threadIdProp, enableThreadList, theme, linkClicks, citationLinks, posthog: posthogProp, debug, onDiagnostic, onError, }: AthenaProviderProps): import("react/jsx-runtime").JSX.Element | null;
@@ -1,27 +1,28 @@
1
1
  import type { AthenaEnvironment } from '../lib/athena-urls';
2
- import type { AthenaTransport } from '../runtime/transport';
3
2
  import type { PostHogConfig } from './PostHogProvider';
4
3
  export interface AthenaProviderConfig {
5
4
  /** Resolve the latest auth token immediately before a request (for expiring
6
- * clients). Only used when `transport` is 'statewire'. */
5
+ * clients). Takes priority over `token` when it resolves. */
7
6
  getToken?: () => string | null | Promise<string | null>;
8
- /** Additional fields merged into runConfig.custom. Only used when
9
- * `transport` is 'statewire'. */
7
+ /** Additional fields merged into runConfig.custom. */
10
8
  extraRunConfig?: Record<string, unknown>;
11
9
  /** API key for standalone authentication when no token is provided. */
12
10
  apiKey?: string;
13
11
  /** PropelAuth token. Takes priority over apiKey when provided. */
14
12
  token?: string | null;
15
- /** URL for the chat streaming endpoint. Defaults to the matching Athena environment. */
13
+ /** URL on the Iris host that fronts the deployment (historically the
14
+ * `…/api/chat` endpoint). Its origin derives the statewire sync mount when
15
+ * `statewireSyncUrl` is not set, and known Athena hosts map to the matching
16
+ * app origin. Defaults to the matching Athena environment. */
16
17
  apiUrl?: string;
17
- /** Chat transport mode. Defaults to 'statewire' (the deep-agent statewire
18
- * sync host); pass 'legacy' to opt back onto the legacy Iris chat stream.
19
- * Threads created on one transport are read-only from the other. */
20
- transport?: AthenaTransport;
21
- /** Statewire sync base URL override (the `…/v2/threads` mount). Defaults to
22
- * the `apiUrl` host + `/v2/threads`. Only used when transport is 'statewire'. */
18
+ /** Statewire sync base URL override (the `…/v2/threads` mount). Resolution
19
+ * order: this value, then the `statewireSyncUrl` a Marathon host mints via
20
+ * `/_athena/auth` (or a trusted parent posts), then the effective `apiUrl`
21
+ * host + `/v2/threads`. */
23
22
  statewireSyncUrl?: string;
24
- /** URL for the Athena backend API. Defaults to the matching Athena environment. */
23
+ /** URL for the Athena backend API the bare Agora base or the historical
24
+ * `…/api/assistant-ui` endpoint (REST helpers accept both). Defaults to
25
+ * the host-provided value, then the matching Athena environment. */
25
26
  backendUrl?: string;
26
27
  /** URL for the Athena frontend app origin. Defaults to the matching Athena environment. */
27
28
  appUrl?: string;
@@ -1,10 +1,9 @@
1
1
  import type { AthenaStatewireLifecycleState } from '../runtime/statewire-lifecycle';
2
2
  /**
3
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.
4
+ * reconnect handle). Provided by `AthenaProvider`; `null` outside the
5
+ * provider, so lifecycle-driven UI renders nothing there.
7
6
  */
8
7
  export declare const AthenaStatewireLifecycleContext: import("react").Context<AthenaStatewireLifecycleState | null>;
9
- /** Read the statewire lifecycle, or null outside statewire mode. */
8
+ /** Read the statewire lifecycle, or null outside `AthenaProvider`. */
10
9
  export declare function useAthenaStatewireLifecycle(): AthenaStatewireLifecycleState | null;
@@ -1,4 +1,3 @@
1
1
  export type { AthenaProviderProps } from './AthenaProvider';
2
2
  export type { AthenaProviderConfig } from './config';
3
- export type { AthenaRuntimeConfig } from '../runtime/useAthenaRuntime';
4
3
  export type { AthenaEnvironment } from '../lib/athena-urls';
@@ -1,15 +1,44 @@
1
1
  export interface ParentBridgeState {
2
2
  /** PropelAuth access token from the parent window. */
3
3
  token: string | null;
4
- /** Sync server chat URL provided by the Marathon wrapper. */
4
+ /** Legacy Iris chat stream URL (`…/api/chat`) provided by the host. */
5
5
  apiUrl: string | null;
6
- /** Athena backend URL provided by the Marathon wrapper. */
6
+ /** Legacy Athena backend URL (`…/api/assistant-ui`) provided by the host. */
7
7
  backendUrl: string | null;
8
+ /**
9
+ * Statewire sync mount (`…/v2/threads`) minted by the host. `null` when the
10
+ * host predates the statewire-native mint fields; the provider then derives
11
+ * it from `apiUrl`'s origin.
12
+ */
13
+ statewireSyncUrl: string | null;
14
+ /**
15
+ * Bare Agora API base (no path) minted by the host. `null` when the host
16
+ * only serves the legacy `backendUrl`; REST helpers strip that URL's
17
+ * `/api/assistant-ui` suffix themselves.
18
+ */
19
+ backendBaseUrl: string | null;
8
20
  /** Athena frontend origin provided by the parent wrapper. */
9
21
  appUrl: string | null;
10
22
  /** True once config has been received from the parent (or timeout fired). */
11
23
  ready: boolean;
12
24
  }
25
+ declare const BRIDGE_URL_FIELDS: readonly ['apiUrl', 'backendUrl', 'statewireSyncUrl', 'backendBaseUrl', 'appUrl'];
26
+ type BridgeUrlField = (typeof BRIDGE_URL_FIELDS)[number];
27
+ /** The URL half of {@link ParentBridgeState} — what a host can hand the SDK. */
28
+ export type ParentBridgeUrls = Pick<ParentBridgeState, BridgeUrlField>;
29
+ /**
30
+ * Fold an `athena-config` postMessage payload over the current URL set. A
31
+ * field is taken only when it is a string; anything else keeps the previous
32
+ * value. A parent that predates the statewire-native fields therefore leaves
33
+ * `statewireSyncUrl`/`backendBaseUrl` at `null`, and the provider falls back
34
+ * to deriving them from the legacy URLs.
35
+ */
36
+ export declare function mergeBridgeConfigMessage(previous: ParentBridgeUrls, payload: Partial<Record<BridgeUrlField, unknown>>): ParentBridgeUrls;
37
+ /**
38
+ * Read the URL set out of a `/_athena/auth` mint body. Non-string fields are
39
+ * `null` — an older Marathon serves only the legacy `apiUrl`/`backendUrl`.
40
+ */
41
+ export declare function readAuthMintUrls(data: Partial<Record<BridgeUrlField, unknown>>): ParentBridgeUrls;
13
42
  export interface ParentBridgeOptions {
14
43
  /**
15
44
  * Exact parent origins that are allowed to send auth/config via postMessage.
@@ -31,8 +60,11 @@ export declare const getAuthRetryDelay: (retryAttempt: number) => number;
31
60
  * 2. **Standalone (Marathon-served deploy URL)**: top-level navigation, no
32
61
  * parent. The hook fetches `/_athena/auth` on its own origin. Marathon
33
62
  * validates its session cookie (sent by the browser automatically) and
34
- * returns `{ token, apiUrl, backendUrl, appUrl }`. A 404 means we're not
35
- * on a Marathon origin — the hook falls through with empty state.
63
+ * returns `{ token, statewireSyncUrl, backendBaseUrl, apiUrl, backendUrl,
64
+ * appUrl }` — the statewire-native mount and bare Agora base alongside
65
+ * the legacy chat-wire URLs, so old and new hosts both resolve. A 404
66
+ * means we're not on a Marathon origin — the hook falls through with
67
+ * empty state.
36
68
  *
37
69
  * In both modes a timeout safety net flips `ready: true` so the app never
38
70
  * blocks indefinitely.
@@ -43,3 +75,4 @@ export declare function useParentBridge({ trustedOrigins, }?: ParentBridgeOption
43
75
  * Prefer useParentBridge() for new code.
44
76
  */
45
77
  export declare function useParentAuth(): string | null;
78
+ export {};
@@ -16,7 +16,6 @@ export declare function athenaStatewireErrorNotice(error: unknown): AthenaStatew
16
16
  export interface AthenaStatewireLifecycleState {
17
17
  connection: DeepAgentConnectionState | null;
18
18
  error: AthenaStatewireErrorNotice | null;
19
- legacyReadOnly: boolean;
20
19
  reconnect: (() => void) | null;
21
20
  dismissError: () => void;
22
21
  }
@@ -1,19 +1,32 @@
1
- /** Deep-agent default model — matches the Olympus and mobile statewire hosts.
2
- * The legacy transport keeps its own default model. */
1
+ /** Deep-agent default model — matches the Olympus and mobile statewire hosts. */
3
2
  export declare const DEFAULT_STATEWIRE_MODEL = "claude-sonnet-5";
4
3
  /** Agent-id namespace for collab agents (`collab_agent:<asset_id>`). */
5
4
  export declare const COLLAB_AGENT_REF_PREFIX = "collab_agent:";
5
+ /** The only shape the `agent` prop accepts, for error messages and docs. */
6
+ export declare const COLLAB_AGENT_REF_SHAPE = "collab_agent:<asset_id>";
6
7
  /** The asset id when `agent` is a `collab_agent:<asset_id>` ref, else null. */
7
8
  export declare function parseCollabAgentRef(agent: string | undefined | null): string | null;
9
+ /**
10
+ * Resolve the provider's `agent` prop to a collab-agent asset id.
11
+ *
12
+ * An omitted or blank `agent` means "no agent selected" — the thread runs the
13
+ * Athena deep agent — and resolves to `null`. A `collab_agent:<asset_id>` ref
14
+ * resolves to the asset id. Any other non-blank value throws: the statewire
15
+ * host cannot honour it, and a selector that is silently dropped would let a
16
+ * misconfigured deployment ship answers from the wrong agent.
17
+ */
18
+ export declare function resolveAgentProp({ agent }: {
19
+ agent: string | undefined | null;
20
+ }): string | null;
8
21
  export interface StatewireRunConfigOptions {
9
22
  /** LLM model identifier. Defaults to the deep-agent default model — unless a
10
23
  * collab agent is selected and its author set one (the backend overlay
11
24
  * applies the agent's model when the run sends none), in which case no
12
25
  * model is sent so the agent's choice wins. */
13
26
  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. */
27
+ /** Agent selector. Only the `collab_agent:<asset_id>` shape is accepted: the
28
+ * run executes AS that published collab agent (prompt, tools, model
29
+ * default). Any other non-empty value throws (see {@link resolveAgentProp}). */
17
30
  agent?: string;
18
31
  /** Collab-agent channel id (built-in like `email`/`sms`, or a user-defined
19
32
  * custom channel id) selecting that channel's configuration overrides.
@@ -19,8 +19,9 @@ 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. */
22
+ /** Agent selector: only `collab_agent:<asset_id>` refs are accepted (the run
23
+ * executes AS that published collab agent). Any other non-empty value
24
+ * throws — see `resolveAgentProp`. */
24
25
  agent?: string;
25
26
  /** Collab-agent channel id selecting that channel's overrides. */
26
27
  channel?: string;
@@ -38,10 +39,6 @@ export interface AthenaStatewireRuntimeConfig {
38
39
  knowledgeBase?: string[];
39
40
  /** System prompt override. */
40
41
  systemPrompt?: string;
41
- /** Legacy-transport option accepted for shared-config compatibility, never
42
- * sent: the deep-agent runtime has no `custom_tool_configs` reader (MCP
43
- * configuration is the parsed `mcp_server_configs` key). */
44
- customToolConfigs?: Record<string, unknown>;
45
42
  /** Client app identifier for session filtering. Sent as app_id in runConfig.custom. */
46
43
  appId?: string;
47
44
  /** Additional fields merged into runConfig.custom. */
@@ -52,8 +49,6 @@ export interface AthenaStatewireRuntimeConfig {
52
49
  onConnectionChange?: UseDeepAgentThreadOptions['onConnectionChange'];
53
50
  /** Raw connection observer — carries the transport's reconnect handle. */
54
51
  onRawConnectionChange?: UseDeepAgentThreadOptions['onRawConnectionChange'];
55
- /** Notified when the snapshot flags a read-only pre-cutover thread. */
56
- onLegacyReadOnly?: UseDeepAgentThreadOptions['onLegacyReadOnly'];
57
52
  /** Notified when a run starts/stops. */
58
53
  onRunningChange?: UseDeepAgentThreadOptions['onRunningChange'];
59
54
  }
@@ -67,8 +62,8 @@ export declare function useStatewireClientTools(frontendToolkit: Toolkit | undef
67
62
  * `AssistantClient` to mount via `AuiProvider` — the same integration shape as
68
63
  * the Olympus, Chrome extension, Office, and mobile statewire hosts.
69
64
  *
70
- * Auth mirrors the legacy transport's credential plumbing: a token (resolved
71
- * live through `getToken` when provided) rides `Authorization: Bearer`, and
72
- * an API key falls back to `X-API-KEY` — both accepted by the statewire host.
65
+ * Auth: a token (resolved live through `getToken` when provided) rides
66
+ * `Authorization: Bearer`, and an API key falls back to `X-API-KEY` both
67
+ * accepted by the statewire host.
73
68
  */
74
69
  export declare function useAthenaStatewireRuntime(config: AthenaStatewireRuntimeConfig): AssistantClient;