@athenaintel/react 0.32.0 → 0.36.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/README.md +148 -9
- package/dist/agent-runtime/src/composer-markdown.cjs.map +1 -1
- package/dist/agent-runtime/src/composer-markdown.js.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs +2 -3
- package/dist/agent-runtime/src/deep-agent-transport-recipe.cjs.map +1 -1
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js +3 -4
- package/dist/agent-runtime/src/deep-agent-transport-recipe.js.map +1 -1
- package/dist/agent-runtime/src/edit-command.cjs.map +1 -1
- package/dist/agent-runtime/src/edit-command.js.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +4 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.js +4 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/messages.cjs +57 -2
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.js +57 -2
- package/dist/agent-runtime/src/messages.js.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +24 -3
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js +24 -3
- package/dist/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
- package/dist/agent-runtime/src/statewire-transport.cjs +4 -13
- package/dist/agent-runtime/src/statewire-transport.cjs.map +1 -1
- package/dist/agent-runtime/src/statewire-transport.js +5 -14
- package/dist/agent-runtime/src/statewire-transport.js.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.cjs +12 -1
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.js +12 -1
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/assets/AthenaAssetEmbed.cjs +3 -1
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +7 -0
- package/dist/assets/AthenaAssetEmbed.js +4 -2
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/assets/use-asset-embed.cjs +71 -71
- package/dist/assets/use-asset-embed.cjs.map +1 -1
- package/dist/assets/use-asset-embed.d.ts +20 -7
- package/dist/assets/use-asset-embed.js +72 -72
- package/dist/assets/use-asset-embed.js.map +1 -1
- package/dist/catalog/agent-mode-menu.cjs +115 -0
- package/dist/catalog/agent-mode-menu.cjs.map +1 -0
- package/dist/catalog/agent-mode-menu.d.ts +101 -0
- package/dist/catalog/agent-mode-menu.js +115 -0
- package/dist/catalog/agent-mode-menu.js.map +1 -0
- package/dist/catalog/agent-model-options.cjs +122 -0
- package/dist/catalog/agent-model-options.cjs.map +1 -0
- package/dist/catalog/agent-model-options.d.ts +115 -0
- package/dist/catalog/agent-model-options.js +122 -0
- package/dist/catalog/agent-model-options.js.map +1 -0
- package/dist/catalog/chat-pickers.cjs +235 -4
- package/dist/catalog/chat-pickers.cjs.map +1 -1
- package/dist/catalog/chat-pickers.d.ts +55 -3
- package/dist/catalog/chat-pickers.js +238 -7
- package/dist/catalog/chat-pickers.js.map +1 -1
- package/dist/catalog/runtime-catalog.cjs +121 -3
- package/dist/catalog/runtime-catalog.cjs.map +1 -1
- package/dist/catalog/runtime-catalog.d.ts +120 -0
- package/dist/catalog/runtime-catalog.js +124 -6
- package/dist/catalog/runtime-catalog.js.map +1 -1
- package/dist/catalog/use-athena-chat-mode.cjs +139 -0
- package/dist/catalog/use-athena-chat-mode.cjs.map +1 -0
- package/dist/catalog/use-athena-chat-mode.d.ts +43 -0
- package/dist/catalog/use-athena-chat-mode.js +139 -0
- package/dist/catalog/use-athena-chat-mode.js.map +1 -0
- package/dist/chat/AthenaChat.cjs +2 -0
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +8 -7
- package/dist/chat/AthenaChat.js +2 -0
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +30 -3
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +12 -9
- package/dist/chat/super-grouping/SuperGroupingCard.js +31 -4
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.d.ts +8 -8
- package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +4 -4
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/super-grouping/index.d.ts +6 -5
- package/dist/chat/super-grouping/toolkit-map.cjs +3 -1
- package/dist/chat/super-grouping/toolkit-map.cjs.map +1 -1
- package/dist/chat/super-grouping/toolkit-map.js +3 -1
- package/dist/chat/super-grouping/toolkit-map.js.map +1 -1
- package/dist/chat-ui/index.cjs +1 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +1 -1
- package/dist/chat-ui/index.js +2 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +33 -2
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +14 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.js +33 -2
- package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
- package/dist/chat-ui/statewire.cjs +3 -0
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +4 -2
- package/dist/chat-ui/statewire.js +3 -0
- package/dist/chat-ui/statewire.js.map +1 -1
- package/dist/index.cjs +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/use-athena-rest-query.cjs +4 -0
- package/dist/lib/use-athena-rest-query.cjs.map +1 -1
- package/dist/lib/use-athena-rest-query.d.ts +6 -0
- package/dist/lib/use-athena-rest-query.js +4 -0
- package/dist/lib/use-athena-rest-query.js.map +1 -1
- package/dist/provider/AthenaProvider.cjs +81 -9
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +25 -5
- package/dist/provider/AthenaProvider.js +83 -11
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/agent-selection-context.cjs +6 -0
- package/dist/provider/agent-selection-context.cjs.map +1 -0
- package/dist/provider/agent-selection-context.d.ts +14 -0
- package/dist/provider/agent-selection-context.js +6 -0
- package/dist/provider/agent-selection-context.js.map +1 -0
- package/dist/provider/chat-mode-context.cjs +6 -0
- package/dist/provider/chat-mode-context.cjs.map +1 -0
- package/dist/provider/chat-mode-context.d.ts +35 -0
- package/dist/provider/chat-mode-context.js +6 -0
- package/dist/provider/chat-mode-context.js.map +1 -0
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs +125 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.d.ts +54 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.js +125 -0
- package/dist/runtime/StatewireThreadConfigLaneSync.js.map +1 -0
- package/dist/runtime/statewire-model-lane.cjs +0 -12
- package/dist/runtime/statewire-model-lane.cjs.map +1 -1
- package/dist/runtime/statewire-model-lane.d.ts +3 -1
- package/dist/runtime/statewire-model-lane.js +0 -12
- package/dist/runtime/statewire-model-lane.js.map +1 -1
- package/dist/runtime/statewire-run-config.cjs +10 -6
- package/dist/runtime/statewire-run-config.cjs.map +1 -1
- package/dist/runtime/statewire-run-config.d.ts +7 -0
- package/dist/runtime/statewire-run-config.js +10 -6
- package/dist/runtime/statewire-run-config.js.map +1 -1
- package/dist/runtime/statewire-server-lane-context.cjs.map +1 -1
- package/dist/runtime/statewire-server-lane-context.d.ts +2 -2
- package/dist/runtime/statewire-server-lane-context.js.map +1 -1
- package/dist/runtime/statewire-thread-config-lane.cjs +84 -0
- package/dist/runtime/statewire-thread-config-lane.cjs.map +1 -0
- package/dist/runtime/statewire-thread-config-lane.d.ts +94 -0
- package/dist/runtime/statewire-thread-config-lane.js +84 -0
- package/dist/runtime/statewire-thread-config-lane.js.map +1 -0
- package/dist/runtime/useAthenaStatewireRuntime.cjs +4 -2
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +2 -0
- package/dist/runtime/useAthenaStatewireRuntime.js +4 -2
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/threads/use-athena-thread-model.cjs +11 -3
- package/dist/threads/use-athena-thread-model.cjs.map +1 -1
- package/dist/threads/use-athena-thread-model.d.ts +5 -0
- package/dist/threads/use-athena-thread-model.js +12 -4
- package/dist/threads/use-athena-thread-model.js.map +1 -1
- package/package.json +3 -3
- package/dist/runtime/StatewireModelLaneSync.cjs +0 -96
- package/dist/runtime/StatewireModelLaneSync.cjs.map +0 -1
- package/dist/runtime/StatewireModelLaneSync.d.ts +0 -45
- package/dist/runtime/StatewireModelLaneSync.js +0 -96
- package/dist/runtime/StatewireModelLaneSync.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { AuiProvider, AuiConfig, useAui } from "@assistant-ui/react";
|
|
3
|
-
import { useRef, useEffect,
|
|
3
|
+
import { useMemo, useRef, useEffect, useContext, useState, useCallback, useReducer, useLayoutEffect } from "react";
|
|
4
4
|
import { getAthenaEnvironmentUrls, deriveAthenaAppUrl, assertHostMintedStatewireMount, resolveStatewireSyncUrl } from "../lib/athena-urls.js";
|
|
5
5
|
import { getAthenaApiBaseUrl } from "../collab/mint.js";
|
|
6
6
|
import { useParentBridge } from "../runtime/auth.js";
|
|
@@ -10,13 +10,14 @@ import { createAthenaCredentialSource } from "../auth/credential-source.js";
|
|
|
10
10
|
import { useRestartAfterAuthRefusal } from "../runtime/auth-refusal-restart.js";
|
|
11
11
|
import { useStatewireClientTools, useAthenaStatewireRuntime } from "../runtime/useAthenaStatewireRuntime.js";
|
|
12
12
|
import { isStatewireChannelLive, statewireLifecycleReducer, initialStatewireLifecycle, athenaStatewireErrorNotice } from "../runtime/statewire-lifecycle.js";
|
|
13
|
-
import { resolveAgentProp
|
|
13
|
+
import { resolveAgentProp } from "../runtime/statewire-run-config.js";
|
|
14
|
+
import { providerThreadConfig } from "../runtime/statewire-thread-config-lane.js";
|
|
14
15
|
import { mintThreadId } from "../threads/mint-thread-id.js";
|
|
15
16
|
import { AthenaStatewireLifecycleContext } from "./statewire-lifecycle-context.js";
|
|
16
17
|
import { createComposerHandoffStore, clearComposerHandoff, ComposerHandoffContext, useComposerHandoffStore, useComposerReady, drainComposerHandoff } from "../composer/composer-handoff.js";
|
|
17
18
|
import { StatewireToolOutputsContext } from "./statewire-window-context.js";
|
|
18
19
|
import { StatewireClientToolBridge } from "../chat/StatewireClientToolBridge.js";
|
|
19
|
-
import {
|
|
20
|
+
import { StatewireThreadConfigLaneSync } from "../runtime/StatewireThreadConfigLaneSync.js";
|
|
20
21
|
import { AthenaStatewireServerLaneContext, STATEWIRE_SERVER_LANE_PENDING, nextServerLane } from "../runtime/statewire-server-lane-context.js";
|
|
21
22
|
import { installAthenaDiagnosticsGlobal, athenaDiagnostics, debugPropToDiagnosticsConfig } from "../diagnostics/athena-diagnostics.js";
|
|
22
23
|
import { AthenaSdkError } from "../diagnostics/errors.js";
|
|
@@ -24,6 +25,8 @@ import { backendDeclaredFrontendToolIds, resolveClientToolSurface } from "../cha
|
|
|
24
25
|
import { TooltipProvider } from "../ui/tooltip.js";
|
|
25
26
|
import { DEFAULT_AUTO_OPEN_TOOLS } from "../tools/auto-open-tools.js";
|
|
26
27
|
import { AthenaContext } from "./AthenaContext.js";
|
|
28
|
+
import { AthenaAgentSelectionContext } from "./agent-selection-context.js";
|
|
29
|
+
import { AthenaChatModeSelectionContext } from "./chat-mode-context.js";
|
|
27
30
|
import { AthenaStatewireThreadIdContext, AthenaThreadIdContext, useAthenaStatewireThreadId } from "../threads/thread-id-context.js";
|
|
28
31
|
import { AthenaStatewireThreadListContext, AthenaStatewireThreadListProvider, useAthenaStatewireThreadList, StatewireThreadTitlePoller } from "../threads/statewire-thread-list.js";
|
|
29
32
|
import { useAssetPanelStore } from "../assets/asset-panel-store.js";
|
|
@@ -94,6 +97,20 @@ function ComposerHandoffDrain() {
|
|
|
94
97
|
}, [aui, ready, store, threadId]);
|
|
95
98
|
return null;
|
|
96
99
|
}
|
|
100
|
+
const EMPTY_MODES = [];
|
|
101
|
+
function withEntry(record, key, value) {
|
|
102
|
+
if (value === null) {
|
|
103
|
+
if (!(key in record)) return record;
|
|
104
|
+
const { [key]: _dropped, ...rest } = record;
|
|
105
|
+
return rest;
|
|
106
|
+
}
|
|
107
|
+
return record[key] === value ? record : { ...record, [key]: value };
|
|
108
|
+
}
|
|
109
|
+
function useProviderThreadConfig(inputs) {
|
|
110
|
+
const value = providerThreadConfig(inputs);
|
|
111
|
+
const key = JSON.stringify(value);
|
|
112
|
+
return useMemo(() => value, [key]);
|
|
113
|
+
}
|
|
97
114
|
function AthenaStatewireRuntimeMount({
|
|
98
115
|
threadId,
|
|
99
116
|
isNewChat,
|
|
@@ -105,6 +122,7 @@ function AthenaStatewireRuntimeMount({
|
|
|
105
122
|
model,
|
|
106
123
|
agent,
|
|
107
124
|
channel,
|
|
125
|
+
mode,
|
|
108
126
|
tools,
|
|
109
127
|
frontendToolIds,
|
|
110
128
|
frontendTools,
|
|
@@ -133,6 +151,7 @@ function AthenaStatewireRuntimeMount({
|
|
|
133
151
|
model,
|
|
134
152
|
agent,
|
|
135
153
|
channel,
|
|
154
|
+
mode,
|
|
136
155
|
tools,
|
|
137
156
|
frontendToolIds,
|
|
138
157
|
frontendToolkit: frontendTools,
|
|
@@ -180,7 +199,15 @@ function AthenaStatewireRuntimeMount({
|
|
|
180
199
|
}),
|
|
181
200
|
[lifecycle, dismissError]
|
|
182
201
|
);
|
|
183
|
-
const
|
|
202
|
+
const threadConfig = useProviderThreadConfig({
|
|
203
|
+
model,
|
|
204
|
+
systemPrompt,
|
|
205
|
+
tools,
|
|
206
|
+
frontendToolIds,
|
|
207
|
+
workbench,
|
|
208
|
+
knowledgeBase,
|
|
209
|
+
extraRunConfig
|
|
210
|
+
});
|
|
184
211
|
const snapshot = useMemo(
|
|
185
212
|
() => ({
|
|
186
213
|
threadId,
|
|
@@ -188,9 +215,9 @@ function AthenaStatewireRuntimeMount({
|
|
|
188
215
|
client,
|
|
189
216
|
lifecycle: lifecycleValue,
|
|
190
217
|
serverLane,
|
|
191
|
-
|
|
218
|
+
threadConfig
|
|
192
219
|
}),
|
|
193
|
-
[threadId, isNewChat, client, lifecycleValue, serverLane,
|
|
220
|
+
[threadId, isNewChat, client, lifecycleValue, serverLane, threadConfig]
|
|
194
221
|
);
|
|
195
222
|
useLayoutEffect(() => {
|
|
196
223
|
onPublish(snapshot);
|
|
@@ -206,6 +233,7 @@ function AthenaStatewireStandalone({
|
|
|
206
233
|
threadList,
|
|
207
234
|
linkClicks,
|
|
208
235
|
citationLinks,
|
|
236
|
+
modes,
|
|
209
237
|
...runtimeProps
|
|
210
238
|
}) {
|
|
211
239
|
const generatedIdRef = useRef(null);
|
|
@@ -215,6 +243,27 @@ function AthenaStatewireStandalone({
|
|
|
215
243
|
const threadId = threadIdProp ?? generatedIdRef.current;
|
|
216
244
|
const isNewChat = (threadList == null ? void 0 : threadList.isNewChat) ?? (!threadIdProp || threadIsNew);
|
|
217
245
|
const [published, setPublished] = useState(null);
|
|
246
|
+
const agentSelection = useContext(AthenaAgentSelectionContext);
|
|
247
|
+
const modeScope = `${(agentSelection == null ? void 0 : agentSelection.agentAssetId) ?? ""}\0${(agentSelection == null ? void 0 : agentSelection.channel) ?? ""}`;
|
|
248
|
+
const [modePicks, setModePicks] = useState({});
|
|
249
|
+
const [sessionChannels, setSessionChannels] = useState({});
|
|
250
|
+
const setModePick = useCallback(
|
|
251
|
+
({ threadId: pickedThread, modeId }) => setModePicks((picks) => withEntry(picks, `${modeScope}\0${pickedThread}`, modeId)),
|
|
252
|
+
[modeScope]
|
|
253
|
+
);
|
|
254
|
+
const setSessionChannel = useCallback(
|
|
255
|
+
({ threadId: readThread, channel }) => setSessionChannels(
|
|
256
|
+
(channels) => withEntry(channels, `${modeScope}\0${readThread}`, channel)
|
|
257
|
+
),
|
|
258
|
+
[modeScope]
|
|
259
|
+
);
|
|
260
|
+
const hostModes = modes ?? EMPTY_MODES;
|
|
261
|
+
const modeKey = hostModes.join("\0");
|
|
262
|
+
const listedPick = (thread) => {
|
|
263
|
+
const pick = modePicks[`${modeScope}\0${thread}`];
|
|
264
|
+
return pick !== void 0 && hostModes.includes(pick) ? pick : null;
|
|
265
|
+
};
|
|
266
|
+
const threadMode = hostModes.length > 0 ? listedPick(threadId) ?? sessionChannels[`${modeScope}\0${threadId}`] : void 0;
|
|
218
267
|
const clientTools = useStatewireClientTools(runtimeProps.frontendTools);
|
|
219
268
|
const clientToolNamesKey = clientTools.map((tool) => tool.definition.name).join(",");
|
|
220
269
|
const clientToolAppId = runtimeProps.appId;
|
|
@@ -241,20 +290,34 @@ function AthenaStatewireStandalone({
|
|
|
241
290
|
linkClicks,
|
|
242
291
|
citationLinks
|
|
243
292
|
});
|
|
293
|
+
const chatModeSelection = useMemo(
|
|
294
|
+
() => published ? {
|
|
295
|
+
hostModes,
|
|
296
|
+
threadId: published.threadId,
|
|
297
|
+
isNewChat: published.isNewChat,
|
|
298
|
+
pick: listedPick(published.threadId),
|
|
299
|
+
sessionChannel: sessionChannels[`${modeScope}\0${published.threadId}`] ?? null,
|
|
300
|
+
setPick: setModePick,
|
|
301
|
+
setSessionChannel
|
|
302
|
+
} : null,
|
|
303
|
+
// modeKey is the value-stable form of hostModes, which listedPick reads.
|
|
304
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
305
|
+
[modeKey, modeScope, modePicks, sessionChannels, published, setModePick, setSessionChannel]
|
|
306
|
+
);
|
|
244
307
|
const scope = published && /* @__PURE__ */ jsx(AuiProvider, { value: published.client, children: /* @__PURE__ */ jsx(AthenaContext.Provider, { value: athenaConfig, children: /* @__PURE__ */ jsx(AthenaStatewireThreadIdContext.Provider, { value: published.threadId, children: /* @__PURE__ */ jsx(AthenaStatewireLifecycleContext.Provider, { value: published.lifecycle, children: /* @__PURE__ */ jsx(DeepAgentConnectionContext.Provider, { value: published.lifecycle.connection, children: /* @__PURE__ */ jsx(AthenaStatewireServerLaneContext.Provider, { value: published.serverLane, children: /* @__PURE__ */ jsx(StatewireToolOutputsContext.Provider, { value: runtimeProps.toolOutputs, children: /* @__PURE__ */ jsxs(TooltipProvider, { children: [
|
|
245
308
|
/* @__PURE__ */ jsx(StatewireClientToolBridge, { tools: clientTools, threadId: published.threadId }),
|
|
246
309
|
/* @__PURE__ */ jsx(
|
|
247
|
-
|
|
310
|
+
StatewireThreadConfigLaneSync,
|
|
248
311
|
{
|
|
249
312
|
threadId: published.threadId,
|
|
250
|
-
|
|
313
|
+
config: published.threadConfig,
|
|
251
314
|
lane: published.serverLane,
|
|
252
315
|
channelLive: isStatewireChannelLive(published.lifecycle.connection)
|
|
253
316
|
},
|
|
254
317
|
published.threadId
|
|
255
318
|
),
|
|
256
319
|
/* @__PURE__ */ jsx(ComposerHandoffDrain, {}),
|
|
257
|
-
children
|
|
320
|
+
/* @__PURE__ */ jsx(AthenaChatModeSelectionContext.Provider, { value: chatModeSelection, children })
|
|
258
321
|
] }) }) }) }) }) }) }) });
|
|
259
322
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
260
323
|
/* @__PURE__ */ jsx(
|
|
@@ -263,6 +326,7 @@ function AthenaStatewireStandalone({
|
|
|
263
326
|
threadId,
|
|
264
327
|
isNewChat,
|
|
265
328
|
onPublish: setPublished,
|
|
329
|
+
mode: threadMode,
|
|
266
330
|
...runtimeProps
|
|
267
331
|
},
|
|
268
332
|
threadId
|
|
@@ -353,6 +417,7 @@ function AthenaProvider({
|
|
|
353
417
|
token: tokenProp,
|
|
354
418
|
agent,
|
|
355
419
|
channel,
|
|
420
|
+
modes,
|
|
356
421
|
model,
|
|
357
422
|
tools = [],
|
|
358
423
|
frontendTools = {},
|
|
@@ -383,7 +448,13 @@ function AthenaProvider({
|
|
|
383
448
|
onError
|
|
384
449
|
}) {
|
|
385
450
|
var _a;
|
|
386
|
-
resolveAgentProp({ agent });
|
|
451
|
+
const agentAssetId = resolveAgentProp({ agent });
|
|
452
|
+
const trimmedChannel = (channel == null ? void 0 : channel.trim()) ?? "";
|
|
453
|
+
const agentChannel = agentAssetId && trimmedChannel !== "" ? trimmedChannel : null;
|
|
454
|
+
const agentSelection = useMemo(
|
|
455
|
+
() => ({ agentAssetId, channel: agentChannel }),
|
|
456
|
+
[agentAssetId, agentChannel]
|
|
457
|
+
);
|
|
387
458
|
const onDiagnosticRef = useRef(onDiagnostic);
|
|
388
459
|
onDiagnosticRef.current = onDiagnostic;
|
|
389
460
|
const onErrorRef = useRef(onError);
|
|
@@ -511,6 +582,7 @@ function AthenaProvider({
|
|
|
511
582
|
model,
|
|
512
583
|
agent,
|
|
513
584
|
channel,
|
|
585
|
+
modes,
|
|
514
586
|
tools,
|
|
515
587
|
frontendToolIds: frontendToolNames,
|
|
516
588
|
frontendTools: effectiveFrontendTools,
|
|
@@ -552,7 +624,7 @@ function AthenaProvider({
|
|
|
552
624
|
{
|
|
553
625
|
className: themeStyleVars ? "athena-sdk athena-themed" : "athena-sdk",
|
|
554
626
|
style: themeStyleVars,
|
|
555
|
-
children: /* @__PURE__ */ jsx(PostHogProvider, { config: posthogConfig, children: /* @__PURE__ */ jsx(ComposerHandoffContext.Provider, { value: composerHandoff, children: /* @__PURE__ */ jsx(AthenaThemeStyleContext.Provider, { value: themeStyleVars, children: /* @__PURE__ */ jsx(AthenaCredentialSourceContext.Provider, { value: credentials, children: inner }) }) }) })
|
|
627
|
+
children: /* @__PURE__ */ jsx(PostHogProvider, { config: posthogConfig, children: /* @__PURE__ */ jsx(ComposerHandoffContext.Provider, { value: composerHandoff, children: /* @__PURE__ */ jsx(AthenaThemeStyleContext.Provider, { value: themeStyleVars, children: /* @__PURE__ */ jsx(AthenaCredentialSourceContext.Provider, { value: credentials, children: /* @__PURE__ */ jsx(AthenaAgentSelectionContext.Provider, { value: agentSelection, children: inner }) }) }) }) })
|
|
556
628
|
}
|
|
557
629
|
);
|
|
558
630
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AthenaProvider.js","sources":["../../src/provider/AthenaProvider.tsx"],"sourcesContent":["import { AuiConfig, AuiProvider, useAui } from '@assistant-ui/react';\nimport {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useReducer,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport type { AssistantClient, Toolkit } from '@assistant-ui/react';\nimport {\n createDeepAgentThreadSnapshotCache,\n createDeepAgentToolOutputStore,\n DeepAgentConnectionContext,\n type DeepAgentThreadSnapshotCache,\n type DeepAgentToolOutputStore,\n readServerConfig,\n} from '@athenaintel/agent-runtime';\nimport {\n assertHostMintedStatewireMount,\n deriveAthenaAppUrl,\n getAthenaEnvironmentUrls,\n resolveStatewireSyncUrl,\n type AthenaEnvironment,\n} from '../lib/athena-urls';\nimport { getAthenaApiBaseUrl } from '../collab/mint';\nimport { useParentBridge } from '../runtime/auth';\nimport { AthenaAuthContext } from '../auth/AthenaAuthContext';\nimport { AthenaCredentialSourceContext } from '../auth/AthenaCredentialSourceContext';\nimport {\n createAthenaCredentialSource,\n type AthenaCredentialInputs,\n} from '../auth/credential-source';\nimport { useRestartAfterAuthRefusal } from '../runtime/auth-refusal-restart';\nimport {\n useAthenaStatewireRuntime,\n useStatewireClientTools,\n} from '../runtime/useAthenaStatewireRuntime';\nimport {\n athenaStatewireErrorNotice,\n type AthenaStatewireLifecycleState,\n initialStatewireLifecycle,\n isStatewireChannelLive,\n statewireLifecycleReducer,\n} from '../runtime/statewire-lifecycle';\nimport type { AthenaStatewireTokenGetter } from '../runtime/statewire-auth-headers';\nimport { effectiveStatewireModel, resolveAgentProp } from '../runtime/statewire-run-config';\nimport { mintThreadId } from '../threads/mint-thread-id';\nimport { AthenaStatewireLifecycleContext } from './statewire-lifecycle-context';\nimport {\n ComposerHandoffContext,\n clearComposerHandoff,\n createComposerHandoffStore,\n drainComposerHandoff,\n useComposerHandoffStore,\n useComposerReady,\n} from '../composer/composer-handoff';\nimport { StatewireToolOutputsContext } from './statewire-window-context';\nimport { StatewireClientToolBridge } from '../chat/StatewireClientToolBridge';\nimport { StatewireModelLaneSync } from '../runtime/StatewireModelLaneSync';\nimport {\n type AthenaStatewireServerLane,\n AthenaStatewireServerLaneContext,\n nextServerLane,\n STATEWIRE_SERVER_LANE_PENDING,\n} from '../runtime/statewire-server-lane-context';\nimport {\n athenaDiagnostics,\n debugPropToDiagnosticsConfig,\n installAthenaDiagnosticsGlobal,\n type AthenaDiagnosticEvent,\n type AthenaDiagnosticLevel,\n type AthenaDiagnosticsConfig,\n} from '../diagnostics/athena-diagnostics';\nimport { AthenaSdkError } from '../diagnostics/errors';\nimport {\n backendDeclaredFrontendToolIds,\n resolveClientToolSurface,\n} from '../chat/statewire-client-tools';\nimport { TooltipProvider } from '../ui/tooltip';\nimport { DEFAULT_AUTO_OPEN_TOOLS } from '../tools/auto-open-tools';\nimport { AthenaContext, type AthenaConfig } from './AthenaContext';\nimport type { AthenaProviderConfig } from './config';\nimport type {\n AthenaCitationLinkOptions,\n AthenaLinkClickOptions,\n} from './citation-links';\nimport {\n AthenaStatewireThreadIdContext,\n AthenaThreadIdContext,\n useAthenaStatewireThreadId,\n} from '../threads/thread-id-context';\nimport {\n AthenaStatewireThreadListContext,\n AthenaStatewireThreadListProvider,\n StatewireThreadTitlePoller,\n useAthenaStatewireThreadList,\n} from '../threads/statewire-thread-list';\nimport { type AssetOpener, useAssetPanelStore } from '../assets/asset-panel-store';\nimport { themeToStyleVars, type AthenaTheme } from '../theme';\nimport { AthenaThemeStyleContext } from './theme-style-context';\nimport { PostHogProvider, type PostHogConfig } from './PostHogProvider';\n\nexport interface AthenaProviderProps {\n children: ReactNode;\n\n /** Preferred structured config for auth and Athena endpoint settings. */\n config?: AthenaProviderConfig;\n\n /** @deprecated Prefer `config.apiKey`. API key for authentication in standalone mode. */\n apiKey?: string;\n\n /** @deprecated Prefer `config.token`. PropelAuth token. If provided, takes priority over apiKey. If omitted, the SDK\n * will automatically listen for a token from the parent window via PostMessage. */\n token?: string | null;\n\n /** Run the thread AS a published collab agent. The only accepted shape is\n * `collab_agent:<asset_id>`: the thread then uses that agent's prompt,\n * tools, and model default, and the caller must have view access to the\n * agent asset. Omit it (or pass a blank string) to run the Athena deep agent.\n *\n * Any other non-blank value throws at render — the statewire host cannot\n * honour named agents, and a selector that is silently dropped would let a\n * misconfigured deployment answer as the wrong agent. */\n agent?: string;\n\n /** Collab-agent channel id — a built-in channel (`email`, `sms`, …) or a\n * user-defined custom channel id from the agent's Channels tab. Selects\n * that channel's configuration overrides and stamps the session's origin.\n * Only meaningful together with a `collab_agent:<asset_id>` `agent`; sent\n * as `collab_channel_id`. An unknown or disabled channel rejects the run\n * with a structured, teaching error. */\n channel?: string;\n\n /** LLM model identifier. Defaults to the deep-agent default model\n * (`DEFAULT_STATEWIRE_MODEL`) — or, when a collab agent is selected, to\n * the model its author configured.\n *\n * Changing it while a thread is open applies to that thread's next turn:\n * on a thread whose server config already exists the SDK writes the new\n * model there (`undefined` clears it, so the agent's model applies). The\n * value a thread is opened with is not written; read the thread's own\n * model with `useAthenaThreadModel`. */\n model?: string;\n\n /** Backend toolkit IDs to enable (e.g. 'document_toolkit', 'web_search_browse_toolkit'). */\n tools?: string[];\n\n /** Frontend tools that execute in the browser. The agent can invoke these.\n * Merged on top of the SDK's default auto-open tools; entries here take\n * precedence over defaults with the same name. Tools with a local\n * `execute` are declared to the backend as `client_tools` and run through\n * the statewire client-tool bridge. */\n frontendTools?: Toolkit;\n\n /** Disable the SDK's default auto-open behavior for created/touched assets. */\n disableAutoOpen?: boolean;\n\n /** @deprecated Prefer `config.apiUrl`. URL on the Iris host fronting the\n * deployment; its origin derives the statewire sync mount when\n * `statewireSyncUrl` is not set. */\n apiUrl?: string;\n\n /** @deprecated Prefer `config.backendUrl`. URL for the Athena backend API. */\n backendUrl?: string;\n\n /** @deprecated Prefer `config.appUrl`. URL for the Athena frontend app origin. */\n appUrl?: string;\n\n /** @deprecated Prefer `config.environment`. Athena environment preset used when URLs are not explicitly provided. */\n environment?: AthenaEnvironment;\n\n /** Resolve the latest auth token immediately before a request (for\n * expiring clients). Takes priority over `token` when it resolves.\n * Prefer `config.getToken` (see its `force` contract for refused\n * credentials). */\n getToken?: AthenaStatewireTokenGetter;\n\n /** Additional fields merged into runConfig.custom. Prefer\n * `config.extraRunConfig`. */\n extraRunConfig?: Record<string, unknown>;\n\n /** Statewire sync base URL override (the `…/v2/threads` mount). Defaults to\n * the mount a Marathon host mints, then the effective `apiUrl` host +\n * `/v2/threads`. Prefer `config.statewireSyncUrl`. */\n statewireSyncUrl?: string;\n\n /** Asset IDs to include in the workbench. */\n workbench?: string[];\n\n /** Knowledge base IDs for RAG context. */\n knowledgeBase?: string[];\n\n /** System prompt override. */\n systemPrompt?: string;\n\n /** Client app identifier for session filtering.\n * Sessions created with this ID can be filtered in the thread list.\n * E.g. \"olympus\", \"athena-app\", or a computer asset ID like \"asset_<uuid>\". */\n appId?: string;\n\n /** Thread ID override. Auto-generated if not provided. */\n threadId?: string;\n\n /**\n * With `threadId` and no thread list: the host minted that id\n * (`mintThreadId`) for a chat that has not started, which attaches as a new\n * chat until this turns false. Turn it false once the backend lists the\n * thread (a host showing several chats keeps each one's id across a remount\n * this way). Default `false`: a given `threadId` names an existing thread.\n */\n threadIsNew?: boolean;\n\n /** Enable thread list management (sidebar thread switching). */\n enableThreadList?: boolean;\n\n /** Ask the thread list for live pull-request state on each session\n * (`include_pull_requests`), which `SessionList` renders as chips.\n * Defaults to `true` in thread-list mode; turn it off in a host that never\n * shows them to spare the server the lookup. */\n threadListIncludePullRequests?: boolean;\n\n /** Other client apps whose sessions the thread list shows beside this\n * provider's own (`appId`), e.g. a desktop app listing the sessions of the\n * desktop app it replaced. New sessions are still tagged `appId`. */\n threadListAdditionalAppIds?: readonly string[];\n\n /** Theme configuration. Pass a preset from `themes` or a custom `AthenaTheme` object.\n * Injects CSS variables on a wrapper element — no CSS files needed.\n *\n * @example\n * import { themes } from '@athenaintel/react';\n * <AthenaProvider theme={themes.dark}>\n *\n * @example\n * <AthenaProvider theme={{ primary: '#8b5cf6', radius: '1rem' }}>\n *\n * @example\n * <AthenaProvider theme={{ ...themes.dark, primary: '#22c55e' }}>\n */\n theme?: AthenaTheme;\n\n /** Customize how rendered chat links behave. */\n linkClicks?: AthenaLinkClickOptions;\n\n /** @deprecated Prefer `linkClicks`. Customize how Athena citation links rendered in chat messages behave. */\n citationLinks?: AthenaCitationLinkOptions;\n\n /** Opens assets the host's own way (a desktop app's tabs, a route of its own). While set, every\n * request to open an asset goes here before the SDK's asset panel: a tool card's Open, an\n * Athena citation or asset link in a message (which the SDK then intercepts as it does with an\n * asset panel mounted), and the auto-open after a tool created or touched an asset\n * (`origin: 'auto'`). Return `false` to let the panel open it as before. */\n onOpenAsset?: AssetOpener;\n\n /** PostHog analytics configuration. When omitted or keys are missing, PostHog is silently disabled.\n * Prefer `config.posthog` for structured configuration. */\n posthog?: PostHogConfig;\n\n /** SDK diagnostics.\n *\n * - `true` / a level: echo structured `[AthenaSDK]` events to the console\n * at that level (`true` = 'debug').\n * - An object: full diagnostics config (console level, PostHog timing\n * forwarding, buffer size).\n *\n * Independent of the prop, `localStorage.setItem('athena:debug','debug')`\n * (or `window.__ATHENA_SDK__.diagnostics.enableConsole()`) turns console\n * echo on at runtime without a rebuild. Errors log once even when off. */\n debug?: boolean | AthenaDiagnosticLevel | Partial<AthenaDiagnosticsConfig>;\n\n /** Receives every diagnostics event (timings, warnings, errors) — the hook\n * for shipping SDK telemetry to the host app's own pipeline. */\n onDiagnostic?: (event: AthenaDiagnosticEvent) => void;\n\n /** Receives every SDK error as a typed `AthenaSdkError` (stable `code`,\n * `hint`, structured server `detail`). Fires in addition to the UI's own\n * error handling, so integrations never fail silently. */\n onError?: (error: AthenaSdkError, event: AthenaDiagnosticEvent) => void;\n}\n\nconst resolveTokenOverride = ({\n config,\n token,\n}: {\n config?: AthenaProviderConfig;\n token?: string | null;\n}): string | null | undefined => {\n if (config?.token !== undefined) {\n return config.token;\n }\n return token;\n};\n\nconst useAthenaConfigValue = ({\n backendUrl,\n appUrl,\n apiKey,\n token,\n getToken,\n enabledToolkits,\n linkClicks,\n citationLinks,\n}: {\n backendUrl: string;\n appUrl: string;\n apiKey?: string;\n token?: string | null;\n getToken?: AthenaStatewireTokenGetter;\n enabledToolkits: string[];\n linkClicks?: AthenaLinkClickOptions;\n citationLinks?: AthenaCitationLinkOptions;\n}): AthenaConfig => {\n const linkClicksRef = useRef(linkClicks);\n linkClicksRef.current = linkClicks;\n const citationLinksRef = useRef(citationLinks);\n citationLinksRef.current = citationLinks;\n // Keep token in a ref so its value can update without invalidating the\n // config object identity. PropelAuth rotates tokens on window focus —\n // if token were a memo dep, every rotation would publish a new config\n // object to context and force every consumer (e.g. AssetIframe) to\n // re-render, causing asset panel flicker.\n const tokenRef = useRef(token);\n tokenRef.current = token;\n const getTokenRef = useRef(getToken);\n getTokenRef.current = getToken;\n\n return useMemo(\n () => ({\n backendUrl,\n appUrl,\n apiKey,\n enabledToolkits,\n get token() {\n return tokenRef.current;\n },\n get getToken() {\n return getTokenRef.current;\n },\n get linkClicks() {\n return linkClicksRef.current;\n },\n get citationLinks() {\n return citationLinksRef.current;\n },\n }),\n [backendUrl, appUrl, apiKey, enabledToolkits],\n );\n};\n\n/**\n * Delivers composer writes that were made before this mount was ready\n * (`useAppendToComposer` / `useSendMessage` queue them in the provider-level\n * store, which outlives the keyed per-thread mount). Lives under the\n * `AuiProvider` so it can read the thread's own loading state.\n */\nfunction ComposerHandoffDrain(): null {\n const aui = useAui();\n const store = useComposerHandoffStore();\n const threadId = useContext(AthenaStatewireThreadIdContext);\n const ready = useComposerReady();\n useEffect(() => {\n if (!ready || !store) return;\n // Writes bound to another thread are dropped here, not applied.\n drainComposerHandoff({ store, target: aui, threadId });\n }, [aui, ready, store, threadId]);\n return null;\n}\n\n// ─── Standalone Mode ──────────────────────────────────────────────────\n\n/** Everything the per-thread runtime needs to attach and run a thread. */\ninterface AthenaStatewireRuntimeProps {\n syncUrl: string;\n apiKey?: string;\n token?: string | null;\n getToken?: AthenaStatewireTokenGetter;\n model?: string;\n agent?: string;\n channel?: string;\n tools: string[];\n frontendToolIds: string[];\n frontendTools: Toolkit;\n workbench?: string[];\n knowledgeBase?: string[];\n systemPrompt?: string;\n appId?: string;\n extraRunConfig?: Record<string, unknown>;\n /** The provider-owned snapshot cache (see `AthenaProvider`). */\n snapshotCache: DeepAgentThreadSnapshotCache;\n /** The provider-owned store of fetched-back cut tool outputs (see `AthenaProvider`). */\n toolOutputs: DeepAgentToolOutputStore;\n}\n\ninterface AthenaStatewireStandaloneProps extends AthenaStatewireRuntimeProps {\n children: ReactNode;\n backendUrl: string;\n appUrl: string;\n threadId?: string;\n /** `AthenaProviderProps.threadIsNew`. */\n threadIsNew?: boolean;\n /**\n * Thread-list mode. The list owns the active id and alone knows whether the\n * backend has listed it yet: `isNewChat` overrides the \"new chat\"\n * derivation (the list mints ids for brand-new chats, which must still load\n * as new), and the scope publishes `AthenaThreadIdContext` — the backend id,\n * withheld while the chat is unpersisted. Absent outside thread-list mode,\n * where that context stays untouched.\n */\n threadList?: { isNewChat: boolean };\n linkClicks?: AthenaLinkClickOptions;\n citationLinks?: AthenaCitationLinkOptions;\n}\n\n/**\n * What one per-thread runtime mount hands to the stable scope around the\n * host's children: the assistant client attached to `threadId` and the\n * transport lifecycle observed on that attach. Published as ONE value so the\n * scope can never pair a thread's id with another thread's client.\n */\ninterface AthenaStatewireRuntimeSnapshot {\n threadId: string;\n isNewChat: boolean;\n client: AssistantClient;\n lifecycle: AthenaStatewireLifecycleState;\n /** The thread's server config lane as the host sent it on this attach. */\n serverLane: AthenaStatewireServerLane;\n /**\n * The model this thread's sends carry (`model` under an `extraRunConfig`\n * override), published with the thread it applies to: during a switch the\n * scope still holds the outgoing thread for a render while the host's props\n * already describe the incoming one, and pairing them would write the new\n * pick into the session being left.\n */\n model: string | undefined;\n}\n\n/**\n * The per-thread half of the statewire lane: owns the runtime hook (statewire\n * client, pending-message lane, `useAui` client) and the lifecycle reducer\n * behind the connection/error banners, and renders nothing itself. Mounted\n * under `key={threadId}` so a switch — or a new chat — gets a fresh instance\n * of everything here, exactly as when the whole provider subtree was keyed,\n * without remounting the host's UI.\n *\n * An assistant client's readable state only advances when its tap fibers\n * commit (in effects), so an in-place `threadId` change on one mounted hook\n * would leave a commit in which the new id is published but `useAuiState`\n * still reads the previous thread's committed state; a fresh mount publishes\n * its own state on its first render. That is why the runtime is remounted per\n * thread rather than switched in place.\n *\n * The snapshot is published from a layout effect: React flushes the state\n * update a layout effect schedules synchronously, before the browser paints,\n * so the scope re-renders against this client in the same task as this\n * mount's commit — the previous client is never painted under the new id.\n */\nfunction AthenaStatewireRuntimeMount({\n threadId,\n isNewChat,\n onPublish,\n syncUrl,\n apiKey,\n token,\n getToken,\n model,\n agent,\n channel,\n tools,\n frontendToolIds,\n frontendTools,\n workbench,\n knowledgeBase,\n systemPrompt,\n appId,\n extraRunConfig,\n snapshotCache,\n toolOutputs,\n}: AthenaStatewireRuntimeProps & {\n threadId: string;\n isNewChat: boolean;\n onPublish: (snapshot: AthenaStatewireRuntimeSnapshot) => void;\n}): null {\n const [lifecycle, dispatchLifecycle] = useReducer(\n statewireLifecycleReducer,\n initialStatewireLifecycle,\n );\n const [serverLane, setServerLane] = useState<AthenaStatewireServerLane>(\n STATEWIRE_SERVER_LANE_PENDING,\n );\n\n const client = useAthenaStatewireRuntime({\n syncUrl,\n threadId,\n isNewChat,\n apiKey,\n token,\n getToken,\n model,\n agent,\n channel,\n tools,\n frontendToolIds,\n frontendToolkit: frontendTools,\n workbench,\n knowledgeBase,\n systemPrompt,\n appId,\n extraRunConfig,\n snapshotCache,\n toolOutputs,\n // The runtime already records every transport error on the diagnostics\n // bus (with the channel-teardown split), so this layer only maps it to\n // the banner notice.\n onError: (error) => {\n const notice = athenaStatewireErrorNotice(error);\n if (notice) dispatchLifecycle({ type: 'error', error: notice });\n },\n onConnectionChange: (connection) => {\n dispatchLifecycle({ type: 'connection', connection });\n },\n onRawConnectionChange: (connection) => {\n dispatchLifecycle({ type: 'raw-connection', reconnect: connection.reconnect });\n },\n // The lane as the host holds it: anything that decides from the lane waits\n // for this, never the placeholder or remembered snapshot rendered before.\n onServerState: (state) => {\n const config = readServerConfig(state);\n setServerLane((previous) => nextServerLane({ previous, config }));\n },\n });\n\n // A thread the host stopped for refusing its credential reconnects as soon\n // as a new token exists, instead of waiting for a retry click.\n useRestartAfterAuthRefusal({\n connection: lifecycle.connection,\n reconnect: lifecycle.reconnect,\n });\n\n const dismissError = useCallback(\n () => dispatchLifecycle({ type: 'error', error: null }),\n [],\n );\n const lifecycleValue = useMemo<AthenaStatewireLifecycleState>(\n () => ({\n connection: lifecycle.connection,\n error: lifecycle.error,\n reconnect: lifecycle.reconnect,\n dismissError,\n }),\n [lifecycle, dismissError],\n );\n\n const sendModel = effectiveStatewireModel({ model, extraRunConfig });\n const snapshot = useMemo<AthenaStatewireRuntimeSnapshot>(\n () => ({\n threadId,\n isNewChat,\n client,\n lifecycle: lifecycleValue,\n serverLane,\n model: sendModel,\n }),\n [threadId, isNewChat, client, lifecycleValue, serverLane, sendModel],\n );\n useLayoutEffect(() => {\n onPublish(snapshot);\n }, [onPublish, snapshot]);\n\n return null;\n}\n\n/**\n * The stable half of the statewire lane: the scope around the host's\n * `children`. It mounts one `AthenaStatewireRuntimeMount` per thread beside\n * them and provides whatever that mount last published — client, thread ids,\n * lifecycle — so a thread switch swaps the client under the host's UI instead\n * of remounting it. Until the first mount has published, the children are\n * withheld: they need a client, and the first publication lands in the same\n * task as the mount's commit.\n *\n * A server render runs no effects, so it would withhold the children too.\n * That changes nothing today: `AthenaProvider` renders `null` until the parent\n * bridge reports ready, which only ever happens in an effect (`useParentBridge`\n * starts `ready: false`), so the SDK has never server-rendered the host UI —\n * it hydrates it. A future SSR-ready bridge would need the first publication\n * to happen in render as well.\n */\nfunction AthenaStatewireStandalone({\n children,\n backendUrl,\n appUrl,\n threadId: threadIdProp,\n threadIsNew = false,\n threadList,\n linkClicks,\n citationLinks,\n ...runtimeProps\n}: AthenaStatewireStandaloneProps) {\n // Statewire attaches to `${syncUrl}/${threadId}`, so a thread ID must exist\n // up front. An auto-generated ID is by definition a never-started local chat.\n const generatedIdRef = useRef<string | null>(null);\n if (generatedIdRef.current === null) {\n generatedIdRef.current = mintThreadId();\n }\n const threadId = threadIdProp ?? generatedIdRef.current;\n const isNewChat = threadList?.isNewChat ?? (!threadIdProp || threadIsNew);\n\n const [published, setPublished] = useState<AthenaStatewireRuntimeSnapshot | null>(null);\n\n const clientTools = useStatewireClientTools(runtimeProps.frontendTools);\n\n // The runtime binds `client_tools` only for a recognised `app_id`; with none\n // it drops every declaration without telling the client, and the model then\n // sees \"not a valid tool\". Say so here, once per configuration, as an error\n // so it reaches `onError` and the console even with diagnostics off.\n const clientToolNamesKey = clientTools.map((tool) => tool.definition.name).join(',');\n const clientToolAppId = runtimeProps.appId;\n useEffect(() => {\n if (clientTools.length === 0 || resolveClientToolSurface(clientToolAppId) !== null) return;\n athenaDiagnostics.emit('sdk.config.warning', {\n level: 'error',\n error: new AthenaSdkError({\n code: 'config_invalid',\n message: `frontendTools with an execute() need a recognised appId; ${clientTools.length} tool(s) will not be bound.`,\n hint:\n \"Pass appId={publicAppId} on <AthenaProvider> (a computer-asset app reads it from athena-public-config.json as computer_asset_<uuid>). Without it the deep-agent runtime drops every client tool.\",\n context: { appId: clientToolAppId ?? null, tools: clientToolNamesKey.split(',') },\n }),\n data: { appId: clientToolAppId ?? null, tools: clientToolNamesKey.split(',') },\n });\n // clientToolNamesKey is the value-stable form of the tool list.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [clientToolAppId, clientToolNamesKey]);\n\n const athenaConfig = useAthenaConfigValue({\n backendUrl,\n appUrl,\n apiKey: runtimeProps.apiKey,\n token: runtimeProps.token,\n getToken: runtimeProps.getToken,\n enabledToolkits: runtimeProps.tools,\n linkClicks,\n citationLinks,\n });\n\n const scope = published && (\n <AuiProvider value={published.client}>\n <AthenaContext.Provider value={athenaConfig}>\n <AthenaStatewireThreadIdContext.Provider value={published.threadId}>\n <AthenaStatewireLifecycleContext.Provider value={published.lifecycle}>\n <DeepAgentConnectionContext.Provider value={published.lifecycle.connection}>\n <AthenaStatewireServerLaneContext.Provider value={published.serverLane}>\n <StatewireToolOutputsContext.Provider value={runtimeProps.toolOutputs}>\n <TooltipProvider>\n <StatewireClientToolBridge tools={clientTools} threadId={published.threadId} />\n {/* Keyed per thread: each attach starts with no pending lane write. */}\n <StatewireModelLaneSync\n key={published.threadId}\n threadId={published.threadId}\n model={published.model}\n lane={published.serverLane}\n channelLive={isStatewireChannelLive(published.lifecycle.connection)}\n />\n <ComposerHandoffDrain />\n {children}\n </TooltipProvider>\n </StatewireToolOutputsContext.Provider>\n </AthenaStatewireServerLaneContext.Provider>\n </DeepAgentConnectionContext.Provider>\n </AthenaStatewireLifecycleContext.Provider>\n </AthenaStatewireThreadIdContext.Provider>\n </AthenaContext.Provider>\n </AuiProvider>\n );\n\n return (\n <>\n <AthenaStatewireRuntimeMount\n key={threadId}\n threadId={threadId}\n isNewChat={isNewChat}\n onPublish={setPublished}\n {...runtimeProps}\n />\n {/* The backend id rides the same snapshot as the client, so\n history-gated UI (e.g. the loading overlay) never judges one thread\n by another's state; it is undefined for a never-started chat, which\n must not read as pending history. */}\n {threadList && published ? (\n <AthenaThreadIdContext.Provider\n value={published.isNewChat ? undefined : published.threadId}\n >\n {scope}\n </AthenaThreadIdContext.Provider>\n ) : (\n scope\n )}\n </>\n );\n}\n\n// ─── Thread List Mode ─────────────────────────────────────────────────\n\nfunction AthenaStatewireWithThreadList({\n children,\n backendUrl,\n syncUrl,\n appId,\n apiKey,\n token,\n getToken,\n initialThreadId,\n includePullRequests,\n additionalListAppIds,\n ...standaloneProps\n}: Omit<AthenaStatewireStandaloneProps, 'threadId' | 'threadList'> & {\n initialThreadId?: string;\n includePullRequests?: boolean;\n additionalListAppIds?: readonly string[];\n}) {\n return (\n <AthenaStatewireThreadListProvider\n backendUrl={backendUrl}\n syncUrl={syncUrl}\n apiKey={apiKey}\n token={token}\n getToken={getToken}\n appId={appId}\n additionalListAppIds={additionalListAppIds}\n initialThreadId={initialThreadId}\n includePullRequests={includePullRequests}\n // The list's hover prefetch warms the same cache the active-thread\n // mount seeds from, so a hovered-then-selected session paints at once.\n snapshotCache={standaloneProps.snapshotCache}\n >\n <AthenaStatewireActiveThreadHost\n backendUrl={backendUrl}\n syncUrl={syncUrl}\n appId={appId}\n apiKey={apiKey}\n token={token}\n getToken={getToken}\n {...standaloneProps}\n >\n {children}\n </AthenaStatewireActiveThreadHost>\n </AthenaStatewireThreadListProvider>\n );\n}\n\nfunction AthenaStatewireActiveThreadHost({\n children,\n ...standaloneProps\n}: Omit<AthenaStatewireStandaloneProps, 'threadId' | 'threadList'>) {\n const list = useAthenaStatewireThreadList();\n if (!list) return null;\n\n // Not keyed: the scope keeps the host's children mounted across a switch\n // and remounts only its per-thread runtime against the new\n // `…/v2/threads/{id}` URL (see `AthenaStatewireStandalone`).\n return (\n <AthenaStatewireStandalone\n threadId={list.activeThreadId}\n threadList={{ isNewChat: list.isNewChat }}\n {...standaloneProps}\n >\n <StatewireThreadTitlePoller />\n <AssetPanelThreadSync />\n {children}\n </AthenaStatewireStandalone>\n );\n}\n\n/**\n * Syncs the active thread ID into the asset panel store so that open asset\n * tabs are scoped per-thread automatically.\n *\n * Scoped by the attached thread's minted id from creation onward — NOT by\n * `useAthenaThreadManager().activeThreadId`, which is deliberately `null`\n * while a new chat is unpersisted (so URL sync never names it). The minted id\n * is the id the thread persists under, so tabs opened in a brand-new chat\n * stay put when the backend first lists it instead of being left behind in a\n * `null` scope the store never restores. Read from the statewire scope (the\n * id published with its client) rather than the list's selection, which runs\n * one commit ahead of the client during a switch.\n */\nfunction AssetPanelThreadSync() {\n const threadId = useAthenaStatewireThreadId();\n const setCurrentThread = useAssetPanelStore((s) => s.setCurrentThread);\n\n useEffect(() => {\n setCurrentThread(threadId);\n }, [threadId, setCurrentThread]);\n\n return null;\n}\n\n// ─── Main Provider ────────────────────────────────────────────────────\n\nexport function AthenaProvider({\n children,\n config,\n apiKey,\n token: tokenProp,\n agent,\n channel,\n model,\n tools = [],\n frontendTools = {},\n disableAutoOpen = false,\n apiUrl,\n backendUrl,\n appUrl,\n environment,\n statewireSyncUrl,\n getToken,\n extraRunConfig,\n workbench,\n knowledgeBase,\n systemPrompt,\n appId,\n threadId: threadIdProp,\n threadIsNew,\n enableThreadList = false,\n threadListIncludePullRequests = true,\n threadListAdditionalAppIds,\n theme,\n linkClicks,\n citationLinks,\n onOpenAsset,\n posthog: posthogProp,\n debug,\n onDiagnostic,\n onError,\n}: AthenaProviderProps) {\n // Fail loud before any effect, bridge wait, or network call: an `agent`\n // outside the collab_agent namespace can never apply, so a misconfigured\n // deployment must die at first render rather than answer as the wrong agent.\n resolveAgentProp({ agent });\n\n // Diagnostics wiring first, so everything below is observable. Callbacks\n // ride refs: a per-render closure must not re-register the consumer. Each\n // provider registers its OWN consumer (additive, cleaned up on unmount), so\n // two mounted providers never clobber each other's onDiagnostic/onError —\n // only the console/PostHog/buffer settings are global (last writer wins).\n const onDiagnosticRef = useRef(onDiagnostic);\n onDiagnosticRef.current = onDiagnostic;\n const onErrorRef = useRef(onError);\n onErrorRef.current = onError;\n useEffect(() => {\n installAthenaDiagnosticsGlobal();\n return athenaDiagnostics.addConsumer({\n onEvent: (event) => onDiagnosticRef.current?.(event),\n onError: (error, event) => onErrorRef.current?.(error, event),\n });\n }, []);\n // A host that opens assets its own way takes every request the SDK makes to open one, on the\n // shared asset store. The callback rides a ref, so a new one each render does not re-register.\n const onOpenAssetRef = useRef(onOpenAsset);\n onOpenAssetRef.current = onOpenAsset;\n const opensAssets = onOpenAsset !== undefined;\n useEffect(() => {\n if (!opensAssets) return;\n // The host's answer as given: anything but `false` (a callback returning nothing included)\n // means it opened the asset.\n return useAssetPanelStore.getState().registerAssetOpener((request) => {\n const open = onOpenAssetRef.current;\n return open ? open(request) : false;\n });\n }, [opensAssets]);\n const debugKey = JSON.stringify(debugPropToDiagnosticsConfig(debug));\n useEffect(() => {\n athenaDiagnostics.configure(debugPropToDiagnosticsConfig(debug));\n // debugKey is the value-stable form of `debug` (consumers pass literals).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debugKey]);\n // Only declarations WITHOUT a local `execute` ride `enabled_tools`: they name\n // registry tools the backend binds itself. Executable tools are declared\n // through `client_tools` instead — listing them here too would switch on a\n // backend toolkit owning a tool of the same name, and the backend wins that\n // collision (the client tool is silently dropped).\n const frontendToolNames = useMemo(\n () => backendDeclaredFrontendToolIds(frontendTools),\n [frontendTools],\n );\n // Merge SDK auto-open defaults under the consumer's frontendTools. Consumer\n // entries win on name collision; auto-open tool names are NOT added to\n // frontendToolIds (they are already backend-advertised by their toolkits).\n const effectiveFrontendTools = useMemo<Toolkit>(\n () => (disableAutoOpen ? frontendTools : { ...DEFAULT_AUTO_OPEN_TOOLS, ...frontendTools }),\n [disableAutoOpen, frontendTools],\n );\n const themeStyleVars = useMemo(() => theme ? themeToStyleVars(theme) : undefined, [theme]);\n const configuredEnvironment = config?.environment ?? environment;\n const environmentUrls = useMemo(\n () => getAthenaEnvironmentUrls({ environment: configuredEnvironment }),\n [configuredEnvironment],\n );\n const configuredApiKey = config?.apiKey ?? apiKey;\n const configuredToken = resolveTokenOverride({ config, token: tokenProp });\n const configuredApiUrl = config?.apiUrl ?? apiUrl;\n const configuredBackendUrl = config?.backendUrl ?? backendUrl;\n const configuredAppUrl = config?.appUrl ?? appUrl;\n const configuredStatewireSyncUrl = config?.statewireSyncUrl ?? statewireSyncUrl;\n const configuredGetToken = config?.getToken ?? getToken;\n const configuredExtraRunConfig = config?.extraRunConfig ?? extraRunConfig;\n const configuredTrustedParentOrigins = config?.trustedParentOrigins;\n const posthogConfig: PostHogConfig | undefined = config?.posthog ?? posthogProp;\n\n // Statewire is the SDK's only chat transport; the gauge/event stay on the\n // diagnostics contract so dashboards keyed on them keep reading a value.\n useEffect(() => {\n athenaDiagnostics.gauge('sdk.transport', 'statewire');\n athenaDiagnostics.emit('sdk.transport', {\n level: 'debug',\n data: { transport: 'statewire', thread_list: enableThreadList },\n });\n }, [enableThreadList]);\n\n const bridge = useParentBridge({\n trustedOrigins: configuredTrustedParentOrigins,\n });\n\n // If an AthenaAuthProvider is present above us, use its access token automatically.\n const authContext = useContext(AthenaAuthContext);\n const authProviderToken = authContext?.accessToken ?? null;\n\n // Per-provider snapshot cache: a switch back to a recently-visited thread\n // mounts with its last-known snapshot instead of a loading spinner. Owned\n // here, above the per-thread keyed mount, so it survives switches; cleared\n // when the acting identity changes so a snapshot captured under one account\n // never seeds a mount under another.\n const [snapshotCache] = useState(() => createDeepAgentThreadSnapshotCache());\n // Composer writes that arrive before the per-thread mount is ready wait\n // here, above that mount, so a thread-list remount cannot drop them.\n const [composerHandoff] = useState(createComposerHandoffStore);\n // The windowed wire's fetched-back tool outputs, owned alongside the cache\n // for the same reasons: shared across the provider's thread switches (a\n // tool message id is unique across threads), dropped with the identity.\n const [toolOutputs] = useState(() => createDeepAgentToolOutputStore());\n const principal = authContext?.user?.userId ?? '';\n useEffect(() => {\n snapshotCache.clear();\n toolOutputs.clear();\n // A draft or send queued under the previous identity must never land in\n // this one's composer.\n clearComposerHandoff({ store: composerHandoff, reason: 'the signed-in identity changed' });\n }, [snapshotCache, toolOutputs, composerHandoff, principal, configuredApiKey]);\n // Nothing drains after the provider is gone: settle what still waits so no\n // `useSendMessage` caller hangs.\n useEffect(\n () => () => clearComposerHandoff({ store: composerHandoff, reason: 'the chat provider unmounted' }),\n [composerHandoff],\n );\n\n const effectiveToken = configuredToken !== undefined\n ? configuredToken\n : authProviderToken ?? bridge.token;\n\n // One credential source for every network path below: it presents the\n // token chosen above and renews it the way its origin can. A host's own\n // `getToken` owns renewal; a host's static `token` never renews; a sign-in\n // provider's token renews through its getter (PropelAuth, SSO); a host\n // bridge token through the bridge (a Marathon re-mint, or the parent\n // window's next `athena-auth`).\n const authProviderGetToken = authContext?.getToken;\n const credentialInputsRef = useRef<AthenaCredentialInputs>({ token: null });\n credentialInputsRef.current = {\n hostGetToken: configuredGetToken,\n token: effectiveToken,\n renew:\n configuredToken !== undefined\n ? undefined\n : authProviderToken !== null\n ? authProviderGetToken\n ? async ({ force }) => (await authProviderGetToken({ force })) ?? null\n : undefined\n : bridge.token !== null\n ? bridge.renewToken\n : undefined,\n };\n const [credentials] = useState(() =>\n createAthenaCredentialSource(() => credentialInputsRef.current),\n );\n useEffect(() => {\n credentials.notifyTokenChanged();\n }, [credentials, effectiveToken]);\n // Only a provider that holds a token (or a host getter) hands one out, so\n // \"has credentials\" checks downstream keep meaning what they did.\n const credentialGetToken =\n configuredGetToken !== undefined || effectiveToken ? credentials.getToken : undefined;\n // Explicit config wins. A Marathon host mints the statewire mount, the bare\n // Agora base and the app origin outright (`/_athena/auth`, or a trusted\n // parent's `athena-config`); the environment preset is the last resort, and\n // the sync mount derives from the `apiUrl` host when no host minted one.\n const effectiveApiUrl = configuredApiUrl ?? environmentUrls.apiUrl;\n // Published as the bare Agora base: a historical `…/api/assistant-ui` value\n // is trimmed here once rather than by each REST helper.\n const effectiveBackendUrl = getAthenaApiBaseUrl(\n configuredBackendUrl ?? bridge.backendBaseUrl ?? environmentUrls.backendUrl,\n );\n const hostStatewireSyncUrl = configuredStatewireSyncUrl ?? bridge.statewireSyncUrl ?? undefined;\n const effectiveAppUrl = configuredAppUrl\n ?? bridge.appUrl\n ?? deriveAthenaAppUrl({ apiUrl: effectiveApiUrl, backendUrl: effectiveBackendUrl })\n ?? environmentUrls.appUrl;\n\n // Wait for the parent bridge to deliver config/auth before rendering.\n // This prevents the thread list from fetching with wrong URLs or no token.\n // An iframe bridge falls back after a short timeout (2s) if no parent\n // answers; a Marathon mint is ready once its bounded retry cycle ends.\n if (!bridge.ready) {\n return null;\n }\n\n // Fail closed when the host's mint gave up and nothing else can\n // authenticate: the chat would otherwise attach with no credential (and to\n // the environment preset, since no host minted a mount). The bridge has\n // already reported the typed `auth_bridge_failed` / `auth_bridge_timeout`\n // error to `onError`; remounting the provider starts a new bounded mint.\n if (\n bridge.error &&\n !effectiveToken &&\n configuredGetToken === undefined &&\n !configuredApiKey\n ) {\n return null;\n }\n\n // Both throw on an unresolvable configuration instead of falling back to an\n // Athena default — a custom deployment's credentials must never be sent to\n // a host the consumer didn't configure. A host that answered the bridge\n // without minting the statewire mount is that case: its token would\n // otherwise ride the environment preset.\n assertHostMintedStatewireMount({\n hostAnswered: bridge.hostAnswered,\n hostStatewireSyncUrl: bridge.statewireSyncUrl,\n statewireSyncUrl: configuredStatewireSyncUrl,\n apiUrl: configuredApiUrl,\n });\n const effectiveStatewireSyncUrl = resolveStatewireSyncUrl({\n statewireSyncUrl: hostStatewireSyncUrl,\n apiUrl: effectiveApiUrl,\n });\n\n const statewireProps = {\n syncUrl: effectiveStatewireSyncUrl,\n backendUrl: effectiveBackendUrl,\n appUrl: effectiveAppUrl,\n apiKey: configuredApiKey,\n token: effectiveToken,\n getToken: credentialGetToken,\n model,\n agent,\n channel,\n tools,\n frontendToolIds: frontendToolNames,\n frontendTools: effectiveFrontendTools,\n workbench,\n knowledgeBase,\n systemPrompt,\n appId,\n extraRunConfig: configuredExtraRunConfig,\n snapshotCache,\n toolOutputs,\n linkClicks,\n citationLinks,\n };\n\n // Each provider's assistant client is a root of its own (`extends={null}`): one mounted under\n // another provider's (a host showing several chats side by side) would otherwise extend that\n // client and define every tool a second time. The empty config is built per render (configs are\n // identity-insensitive), never at import, which a host's test stub of assistant-ui could not take.\n const inner: ReactNode = (\n <AuiProvider extends={null} config={AuiConfig({})}>\n {enableThreadList ? (\n <AthenaStatewireWithThreadList\n {...statewireProps}\n initialThreadId={threadIdProp}\n includePullRequests={threadListIncludePullRequests}\n additionalListAppIds={threadListAdditionalAppIds}\n >\n {children}\n </AthenaStatewireWithThreadList>\n ) : (\n // A provider without a thread list is its own chat: one nested under a thread-list\n // provider (a host showing several chats side by side) must not read that list as its\n // own, or its banners and composer would follow the other chat's thread.\n <AthenaStatewireThreadListContext.Provider value={null}>\n <AthenaStatewireStandalone\n {...statewireProps}\n threadId={threadIdProp}\n threadIsNew={threadIsNew}\n >\n {children}\n </AthenaStatewireStandalone>\n </AthenaStatewireThreadListContext.Provider>\n )}\n </AuiProvider>\n );\n\n // The .athena-sdk wrapper (display: contents) anchors the SDK's design\n // tokens and scoped preflight from styles.css, so the stylesheet works\n // in hosts without their own Tailwind build. PostHog gracefully no-ops\n // when its config is missing.\n return (\n <div\n className={themeStyleVars ? \"athena-sdk athena-themed\" : \"athena-sdk\"}\n style={themeStyleVars as React.CSSProperties | undefined}\n >\n <PostHogProvider config={posthogConfig}>\n <ComposerHandoffContext.Provider value={composerHandoff}>\n <AthenaThemeStyleContext.Provider value={themeStyleVars}>\n <AthenaCredentialSourceContext.Provider value={credentials}>\n {inner}\n </AthenaCredentialSourceContext.Provider>\n </AthenaThemeStyleContext.Provider>\n </ComposerHando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AG;AAAA,MACJ,iBAAiB;AAAA,MACjB,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,MAErB;AAAA,IAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,IAMH,oBAAC,iCAAiC,UAAjC,EAA0C,OAAO,MAChD,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,UAAU;AAAA,QACV;AAAA,QAEC;AAAA,MAAA;AAAA,IAAA,EACH,CACF;AAAA,KAEJ;AAOF,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,iBAAiB,6BAA6B;AAAA,MACzD,OAAO;AAAA,MAEP,UAAA,oBAAC,iBAAA,EAAgB,QAAQ,eACvB,UAAA,oBAAC,uBAAuB,UAAvB,EAAgC,OAAO,iBACtC,UAAA,oBAAC,wBAAwB,UAAxB,EAAiC,OAAO,gBACvC,UAAA,oBAAC,8BAA8B,UAA9B,EAAuC,OAAO,aAC5C,UAAA,MAAA,CACH,EAAA,CACF,EAAA,CACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"AthenaProvider.js","sources":["../../src/provider/AthenaProvider.tsx"],"sourcesContent":["import { AuiConfig, AuiProvider, useAui } from '@assistant-ui/react';\nimport {\n useCallback,\n useContext,\n useEffect,\n useLayoutEffect,\n useMemo,\n useReducer,\n useRef,\n useState,\n type ReactNode,\n} from 'react';\nimport type { AssistantClient, Toolkit } from '@assistant-ui/react';\nimport {\n createDeepAgentThreadSnapshotCache,\n createDeepAgentToolOutputStore,\n DeepAgentConnectionContext,\n type DeepAgentThreadSnapshotCache,\n type DeepAgentToolOutputStore,\n readServerConfig,\n} from '@athenaintel/agent-runtime';\nimport {\n assertHostMintedStatewireMount,\n deriveAthenaAppUrl,\n getAthenaEnvironmentUrls,\n resolveStatewireSyncUrl,\n type AthenaEnvironment,\n} from '../lib/athena-urls';\nimport { getAthenaApiBaseUrl } from '../collab/mint';\nimport { useParentBridge } from '../runtime/auth';\nimport { AthenaAuthContext } from '../auth/AthenaAuthContext';\nimport { AthenaCredentialSourceContext } from '../auth/AthenaCredentialSourceContext';\nimport {\n createAthenaCredentialSource,\n type AthenaCredentialInputs,\n} from '../auth/credential-source';\nimport { useRestartAfterAuthRefusal } from '../runtime/auth-refusal-restart';\nimport {\n useAthenaStatewireRuntime,\n useStatewireClientTools,\n} from '../runtime/useAthenaStatewireRuntime';\nimport {\n athenaStatewireErrorNotice,\n type AthenaStatewireLifecycleState,\n initialStatewireLifecycle,\n isStatewireChannelLive,\n statewireLifecycleReducer,\n} from '../runtime/statewire-lifecycle';\nimport type { AthenaStatewireTokenGetter } from '../runtime/statewire-auth-headers';\nimport { resolveAgentProp } from '../runtime/statewire-run-config';\nimport {\n type ProviderThreadConfig,\n providerThreadConfig,\n} from '../runtime/statewire-thread-config-lane';\nimport { mintThreadId } from '../threads/mint-thread-id';\nimport { AthenaStatewireLifecycleContext } from './statewire-lifecycle-context';\nimport {\n ComposerHandoffContext,\n clearComposerHandoff,\n createComposerHandoffStore,\n drainComposerHandoff,\n useComposerHandoffStore,\n useComposerReady,\n} from '../composer/composer-handoff';\nimport { StatewireToolOutputsContext } from './statewire-window-context';\nimport { StatewireClientToolBridge } from '../chat/StatewireClientToolBridge';\nimport { StatewireThreadConfigLaneSync } from '../runtime/StatewireThreadConfigLaneSync';\nimport {\n type AthenaStatewireServerLane,\n AthenaStatewireServerLaneContext,\n nextServerLane,\n STATEWIRE_SERVER_LANE_PENDING,\n} from '../runtime/statewire-server-lane-context';\nimport {\n athenaDiagnostics,\n debugPropToDiagnosticsConfig,\n installAthenaDiagnosticsGlobal,\n type AthenaDiagnosticEvent,\n type AthenaDiagnosticLevel,\n type AthenaDiagnosticsConfig,\n} from '../diagnostics/athena-diagnostics';\nimport { AthenaSdkError } from '../diagnostics/errors';\nimport {\n backendDeclaredFrontendToolIds,\n resolveClientToolSurface,\n} from '../chat/statewire-client-tools';\nimport { TooltipProvider } from '../ui/tooltip';\nimport { DEFAULT_AUTO_OPEN_TOOLS } from '../tools/auto-open-tools';\nimport { AthenaContext, type AthenaConfig } from './AthenaContext';\nimport { type AthenaAgentSelection, AthenaAgentSelectionContext } from './agent-selection-context';\nimport { type AthenaChatModeSelection, AthenaChatModeSelectionContext } from './chat-mode-context';\nimport type { AthenaProviderConfig } from './config';\nimport type {\n AthenaCitationLinkOptions,\n AthenaLinkClickOptions,\n} from './citation-links';\nimport {\n AthenaStatewireThreadIdContext,\n AthenaThreadIdContext,\n useAthenaStatewireThreadId,\n} from '../threads/thread-id-context';\nimport {\n AthenaStatewireThreadListContext,\n AthenaStatewireThreadListProvider,\n StatewireThreadTitlePoller,\n useAthenaStatewireThreadList,\n} from '../threads/statewire-thread-list';\nimport { type AssetOpener, useAssetPanelStore } from '../assets/asset-panel-store';\nimport { themeToStyleVars, type AthenaTheme } from '../theme';\nimport { AthenaThemeStyleContext } from './theme-style-context';\nimport { PostHogProvider, type PostHogConfig } from './PostHogProvider';\n\nexport interface AthenaProviderProps {\n children: ReactNode;\n\n /** Preferred structured config for auth and Athena endpoint settings. */\n config?: AthenaProviderConfig;\n\n /** @deprecated Prefer `config.apiKey`. API key for authentication in standalone mode. */\n apiKey?: string;\n\n /** @deprecated Prefer `config.token`. PropelAuth token. If provided, takes priority over apiKey. If omitted, the SDK\n * will automatically listen for a token from the parent window via PostMessage. */\n token?: string | null;\n\n /** Run the thread AS a published collab agent. The only accepted shape is\n * `collab_agent:<asset_id>`: the thread then uses that agent's prompt,\n * tools, and model default, and the caller must have view access to the\n * agent asset. Omit it (or pass a blank string) to run the Athena deep agent.\n *\n * Any other non-blank value throws at render — the statewire host cannot\n * honour named agents, and a selector that is silently dropped would let a\n * misconfigured deployment answer as the wrong agent. */\n agent?: string;\n\n /** Collab-agent channel id — a built-in channel (`email`, `sms`, …) or a\n * user-defined custom channel id from the agent's Channels tab. Selects\n * that channel's configuration overrides and stamps the session's origin.\n * Only meaningful together with a `collab_agent:<asset_id>` `agent`; sent\n * as `collab_channel_id`. An unknown or disabled channel rejects the run\n * with a structured, teaching error. */\n channel?: string;\n\n /** The agent's modes people can switch between in this chat, by id: `base`\n * (the agent as configured) or a mode's id from the agent's Modes tab.\n * `AthenaChat` shows a mode menu in its composer with the ones the agent's\n * published definition offers on `channel` (its start mode, the channel\n * itself, and the modes its author lists for it); `useAthenaChatMode`\n * drives a menu of your own. A pick applies to the open session's next\n * send. On a channel the author locks, people pick the mode before a\n * session's first message and it stays. Only meaningful with a collab\n * `agent`; omit it for no menu. */\n modes?: readonly string[];\n\n /** LLM model identifier. Defaults to the deep-agent default model\n * (`DEFAULT_STATEWIRE_MODEL`) — or, when a collab agent is selected, to\n * the model its author configured.\n *\n * Changing it while a thread is open applies to that thread's next turn:\n * on a thread whose server config already exists the SDK writes the new\n * model there (`undefined` clears it, so the agent's model applies). The\n * value a thread is opened with is not written; read the thread's own\n * model with `useAthenaThreadModel`. */\n model?: string;\n\n /** Backend toolkit IDs to enable (e.g. 'document_toolkit', 'web_search_browse_toolkit').\n *\n * Sent with the backend-bound `frontendTools` as `enabled_tools`. Like\n * `model`, a change while a thread is open applies to its next turn: on a\n * thread whose server config exists the SDK writes the new list there (an\n * empty list clears it, so a collab agent's own tools apply). The list a\n * thread is opened with is not written. */\n tools?: string[];\n\n /** Frontend tools that execute in the browser. The agent can invoke these.\n * Merged on top of the SDK's default auto-open tools; entries here take\n * precedence over defaults with the same name. Tools with a local\n * `execute` are declared to the backend as `client_tools` and run through\n * the statewire client-tool bridge. */\n frontendTools?: Toolkit;\n\n /** Disable the SDK's default auto-open behavior for created/touched assets. */\n disableAutoOpen?: boolean;\n\n /** @deprecated Prefer `config.apiUrl`. URL on the Iris host fronting the\n * deployment; its origin derives the statewire sync mount when\n * `statewireSyncUrl` is not set. */\n apiUrl?: string;\n\n /** @deprecated Prefer `config.backendUrl`. URL for the Athena backend API. */\n backendUrl?: string;\n\n /** @deprecated Prefer `config.appUrl`. URL for the Athena frontend app origin. */\n appUrl?: string;\n\n /** @deprecated Prefer `config.environment`. Athena environment preset used when URLs are not explicitly provided. */\n environment?: AthenaEnvironment;\n\n /** Resolve the latest auth token immediately before a request (for\n * expiring clients). Takes priority over `token` when it resolves.\n * Prefer `config.getToken` (see its `force` contract for refused\n * credentials). */\n getToken?: AthenaStatewireTokenGetter;\n\n /** Additional fields merged into runConfig.custom. Prefer\n * `config.extraRunConfig`. */\n extraRunConfig?: Record<string, unknown>;\n\n /** Statewire sync base URL override (the `…/v2/threads` mount). Defaults to\n * the mount a Marathon host mints, then the effective `apiUrl` host +\n * `/v2/threads`. Prefer `config.statewireSyncUrl`. */\n statewireSyncUrl?: string;\n\n /** Asset IDs to include in the workbench. A change while a thread is open\n * is written to its server config, as `model` is (empty clears it). */\n workbench?: string[];\n\n /** Knowledge base IDs for RAG context. A change while a thread is open is\n * written to its server config, as `model` is (empty clears it). */\n knowledgeBase?: string[];\n\n /** System prompt override. A change while a thread is open is written to\n * its server config, as `model` is (blank clears it, so a collab agent's\n * own prompt applies). */\n systemPrompt?: string;\n\n /** Client app identifier for session filtering.\n * Sessions created with this ID can be filtered in the thread list.\n * E.g. \"olympus\", \"athena-app\", or a computer asset ID like \"asset_<uuid>\". */\n appId?: string;\n\n /** Thread ID override. Auto-generated if not provided. */\n threadId?: string;\n\n /**\n * With `threadId` and no thread list: the host minted that id\n * (`mintThreadId`) for a chat that has not started, which attaches as a new\n * chat until this turns false. Turn it false once the backend lists the\n * thread (a host showing several chats keeps each one's id across a remount\n * this way). Default `false`: a given `threadId` names an existing thread.\n */\n threadIsNew?: boolean;\n\n /** Enable thread list management (sidebar thread switching). */\n enableThreadList?: boolean;\n\n /** Ask the thread list for live pull-request state on each session\n * (`include_pull_requests`), which `SessionList` renders as chips.\n * Defaults to `true` in thread-list mode; turn it off in a host that never\n * shows them to spare the server the lookup. */\n threadListIncludePullRequests?: boolean;\n\n /** Other client apps whose sessions the thread list shows beside this\n * provider's own (`appId`), e.g. a desktop app listing the sessions of the\n * desktop app it replaced. New sessions are still tagged `appId`. */\n threadListAdditionalAppIds?: readonly string[];\n\n /** Theme configuration. Pass a preset from `themes` or a custom `AthenaTheme` object.\n * Injects CSS variables on a wrapper element — no CSS files needed.\n *\n * @example\n * import { themes } from '@athenaintel/react';\n * <AthenaProvider theme={themes.dark}>\n *\n * @example\n * <AthenaProvider theme={{ primary: '#8b5cf6', radius: '1rem' }}>\n *\n * @example\n * <AthenaProvider theme={{ ...themes.dark, primary: '#22c55e' }}>\n */\n theme?: AthenaTheme;\n\n /** Customize how rendered chat links behave. */\n linkClicks?: AthenaLinkClickOptions;\n\n /** @deprecated Prefer `linkClicks`. Customize how Athena citation links rendered in chat messages behave. */\n citationLinks?: AthenaCitationLinkOptions;\n\n /** Opens assets the host's own way (a desktop app's tabs, a route of its own). While set, every\n * request to open an asset goes here before the SDK's asset panel: a tool card's Open, an\n * Athena citation or asset link in a message (which the SDK then intercepts as it does with an\n * asset panel mounted), and the auto-open after a tool created or touched an asset\n * (`origin: 'auto'`). Return `false` to let the panel open it as before. */\n onOpenAsset?: AssetOpener;\n\n /** PostHog analytics configuration. When omitted or keys are missing, PostHog is silently disabled.\n * Prefer `config.posthog` for structured configuration. */\n posthog?: PostHogConfig;\n\n /** SDK diagnostics.\n *\n * - `true` / a level: echo structured `[AthenaSDK]` events to the console\n * at that level (`true` = 'debug').\n * - An object: full diagnostics config (console level, PostHog timing\n * forwarding, buffer size).\n *\n * Independent of the prop, `localStorage.setItem('athena:debug','debug')`\n * (or `window.__ATHENA_SDK__.diagnostics.enableConsole()`) turns console\n * echo on at runtime without a rebuild. Errors log once even when off. */\n debug?: boolean | AthenaDiagnosticLevel | Partial<AthenaDiagnosticsConfig>;\n\n /** Receives every diagnostics event (timings, warnings, errors) — the hook\n * for shipping SDK telemetry to the host app's own pipeline. */\n onDiagnostic?: (event: AthenaDiagnosticEvent) => void;\n\n /** Receives every SDK error as a typed `AthenaSdkError` (stable `code`,\n * `hint`, structured server `detail`). Fires in addition to the UI's own\n * error handling, so integrations never fail silently. */\n onError?: (error: AthenaSdkError, event: AthenaDiagnosticEvent) => void;\n}\n\nconst resolveTokenOverride = ({\n config,\n token,\n}: {\n config?: AthenaProviderConfig;\n token?: string | null;\n}): string | null | undefined => {\n if (config?.token !== undefined) {\n return config.token;\n }\n return token;\n};\n\nconst useAthenaConfigValue = ({\n backendUrl,\n appUrl,\n apiKey,\n token,\n getToken,\n enabledToolkits,\n linkClicks,\n citationLinks,\n}: {\n backendUrl: string;\n appUrl: string;\n apiKey?: string;\n token?: string | null;\n getToken?: AthenaStatewireTokenGetter;\n enabledToolkits: string[];\n linkClicks?: AthenaLinkClickOptions;\n citationLinks?: AthenaCitationLinkOptions;\n}): AthenaConfig => {\n const linkClicksRef = useRef(linkClicks);\n linkClicksRef.current = linkClicks;\n const citationLinksRef = useRef(citationLinks);\n citationLinksRef.current = citationLinks;\n // Keep token in a ref so its value can update without invalidating the\n // config object identity. PropelAuth rotates tokens on window focus —\n // if token were a memo dep, every rotation would publish a new config\n // object to context and force every consumer (e.g. AssetIframe) to\n // re-render, causing asset panel flicker.\n const tokenRef = useRef(token);\n tokenRef.current = token;\n const getTokenRef = useRef(getToken);\n getTokenRef.current = getToken;\n\n return useMemo(\n () => ({\n backendUrl,\n appUrl,\n apiKey,\n enabledToolkits,\n get token() {\n return tokenRef.current;\n },\n get getToken() {\n return getTokenRef.current;\n },\n get linkClicks() {\n return linkClicksRef.current;\n },\n get citationLinks() {\n return citationLinksRef.current;\n },\n }),\n [backendUrl, appUrl, apiKey, enabledToolkits],\n );\n};\n\n/**\n * Delivers composer writes that were made before this mount was ready\n * (`useAppendToComposer` / `useSendMessage` queue them in the provider-level\n * store, which outlives the keyed per-thread mount). Lives under the\n * `AuiProvider` so it can read the thread's own loading state.\n */\nfunction ComposerHandoffDrain(): null {\n const aui = useAui();\n const store = useComposerHandoffStore();\n const threadId = useContext(AthenaStatewireThreadIdContext);\n const ready = useComposerReady();\n useEffect(() => {\n if (!ready || !store) return;\n // Writes bound to another thread are dropped here, not applied.\n drainComposerHandoff({ store, target: aui, threadId });\n }, [aui, ready, store, threadId]);\n return null;\n}\n\n// ─── Standalone Mode ──────────────────────────────────────────────────\n\nconst EMPTY_MODES: readonly string[] = [];\n\n/** `record` with `key` set to `value` (`null` drops it); the same object when nothing changes. */\nfunction withEntry(\n record: Readonly<Record<string, string>>,\n key: string,\n value: string | null,\n): Readonly<Record<string, string>> {\n if (value === null) {\n if (!(key in record)) return record;\n const { [key]: _dropped, ...rest } = record;\n return rest;\n }\n return record[key] === value ? record : { ...record, [key]: value };\n}\n\n/** Everything the per-thread runtime needs to attach and run a thread. */\ninterface AthenaStatewireRuntimeProps {\n syncUrl: string;\n apiKey?: string;\n token?: string | null;\n getToken?: AthenaStatewireTokenGetter;\n model?: string;\n agent?: string;\n channel?: string;\n /** The mode picked for this thread (`AthenaProviderProps.modes`). */\n mode?: string;\n tools: string[];\n frontendToolIds: string[];\n frontendTools: Toolkit;\n workbench?: string[];\n knowledgeBase?: string[];\n systemPrompt?: string;\n appId?: string;\n extraRunConfig?: Record<string, unknown>;\n /** The provider-owned snapshot cache (see `AthenaProvider`). */\n snapshotCache: DeepAgentThreadSnapshotCache;\n /** The provider-owned store of fetched-back cut tool outputs (see `AthenaProvider`). */\n toolOutputs: DeepAgentToolOutputStore;\n}\n\ninterface AthenaStatewireStandaloneProps extends AthenaStatewireRuntimeProps {\n children: ReactNode;\n backendUrl: string;\n appUrl: string;\n /** `AthenaProviderProps.modes`. */\n modes?: readonly string[];\n threadId?: string;\n /** `AthenaProviderProps.threadIsNew`. */\n threadIsNew?: boolean;\n /**\n * Thread-list mode. The list owns the active id and alone knows whether the\n * backend has listed it yet: `isNewChat` overrides the \"new chat\"\n * derivation (the list mints ids for brand-new chats, which must still load\n * as new), and the scope publishes `AthenaThreadIdContext` — the backend id,\n * withheld while the chat is unpersisted. Absent outside thread-list mode,\n * where that context stays untouched.\n */\n threadList?: { isNewChat: boolean };\n linkClicks?: AthenaLinkClickOptions;\n citationLinks?: AthenaCitationLinkOptions;\n}\n\n/**\n * What one per-thread runtime mount hands to the stable scope around the\n * host's children: the assistant client attached to `threadId` and the\n * transport lifecycle observed on that attach. Published as ONE value so the\n * scope can never pair a thread's id with another thread's client.\n */\ninterface AthenaStatewireRuntimeSnapshot {\n threadId: string;\n isNewChat: boolean;\n client: AssistantClient;\n lifecycle: AthenaStatewireLifecycleState;\n /** The thread's server config lane as the host sent it on this attach. */\n serverLane: AthenaStatewireServerLane;\n /**\n * The provider-owned thread-config values this thread's sends carry (the\n * model, system prompt, enabled tools, workbench and knowledge base, each\n * under its `extraRunConfig` override), published with the thread they apply\n * to: during a switch the scope still holds the outgoing thread for a render\n * while the host's props already describe the incoming one, and pairing them\n * would write the new values into the session being left.\n */\n threadConfig: ProviderThreadConfig;\n}\n\n/**\n * {@link providerThreadConfig} for the props, as one object per VALUE: hosts\n * pass fresh array literals (and the provider defaults `tools` to a new `[]`)\n * on every render, and a new object per render would republish the thread's\n * snapshot, which re-renders this mount, without end.\n */\nfunction useProviderThreadConfig(\n inputs: Parameters<typeof providerThreadConfig>[0],\n): ProviderThreadConfig {\n const value = providerThreadConfig(inputs);\n const key = JSON.stringify(value);\n // `key` is the value-stable form of `value`.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => value, [key]);\n}\n\n/**\n * The per-thread half of the statewire lane: owns the runtime hook (statewire\n * client, pending-message lane, `useAui` client) and the lifecycle reducer\n * behind the connection/error banners, and renders nothing itself. Mounted\n * under `key={threadId}` so a switch — or a new chat — gets a fresh instance\n * of everything here, exactly as when the whole provider subtree was keyed,\n * without remounting the host's UI.\n *\n * An assistant client's readable state only advances when its tap fibers\n * commit (in effects), so an in-place `threadId` change on one mounted hook\n * would leave a commit in which the new id is published but `useAuiState`\n * still reads the previous thread's committed state; a fresh mount publishes\n * its own state on its first render. That is why the runtime is remounted per\n * thread rather than switched in place.\n *\n * The snapshot is published from a layout effect: React flushes the state\n * update a layout effect schedules synchronously, before the browser paints,\n * so the scope re-renders against this client in the same task as this\n * mount's commit — the previous client is never painted under the new id.\n */\nfunction AthenaStatewireRuntimeMount({\n threadId,\n isNewChat,\n onPublish,\n syncUrl,\n apiKey,\n token,\n getToken,\n model,\n agent,\n channel,\n mode,\n tools,\n frontendToolIds,\n frontendTools,\n workbench,\n knowledgeBase,\n systemPrompt,\n appId,\n extraRunConfig,\n snapshotCache,\n toolOutputs,\n}: AthenaStatewireRuntimeProps & {\n threadId: string;\n isNewChat: boolean;\n onPublish: (snapshot: AthenaStatewireRuntimeSnapshot) => void;\n}): null {\n const [lifecycle, dispatchLifecycle] = useReducer(\n statewireLifecycleReducer,\n initialStatewireLifecycle,\n );\n const [serverLane, setServerLane] = useState<AthenaStatewireServerLane>(\n STATEWIRE_SERVER_LANE_PENDING,\n );\n\n const client = useAthenaStatewireRuntime({\n syncUrl,\n threadId,\n isNewChat,\n apiKey,\n token,\n getToken,\n model,\n agent,\n channel,\n mode,\n tools,\n frontendToolIds,\n frontendToolkit: frontendTools,\n workbench,\n knowledgeBase,\n systemPrompt,\n appId,\n extraRunConfig,\n snapshotCache,\n toolOutputs,\n // The runtime already records every transport error on the diagnostics\n // bus (with the channel-teardown split), so this layer only maps it to\n // the banner notice.\n onError: (error) => {\n const notice = athenaStatewireErrorNotice(error);\n if (notice) dispatchLifecycle({ type: 'error', error: notice });\n },\n onConnectionChange: (connection) => {\n dispatchLifecycle({ type: 'connection', connection });\n },\n onRawConnectionChange: (connection) => {\n dispatchLifecycle({ type: 'raw-connection', reconnect: connection.reconnect });\n },\n // The lane as the host holds it: anything that decides from the lane waits\n // for this, never the placeholder or remembered snapshot rendered before.\n onServerState: (state) => {\n const config = readServerConfig(state);\n setServerLane((previous) => nextServerLane({ previous, config }));\n },\n });\n\n // A thread the host stopped for refusing its credential reconnects as soon\n // as a new token exists, instead of waiting for a retry click.\n useRestartAfterAuthRefusal({\n connection: lifecycle.connection,\n reconnect: lifecycle.reconnect,\n });\n\n const dismissError = useCallback(\n () => dispatchLifecycle({ type: 'error', error: null }),\n [],\n );\n const lifecycleValue = useMemo<AthenaStatewireLifecycleState>(\n () => ({\n connection: lifecycle.connection,\n error: lifecycle.error,\n reconnect: lifecycle.reconnect,\n dismissError,\n }),\n [lifecycle, dismissError],\n );\n\n const threadConfig = useProviderThreadConfig({\n model,\n systemPrompt,\n tools,\n frontendToolIds,\n workbench,\n knowledgeBase,\n extraRunConfig,\n });\n const snapshot = useMemo<AthenaStatewireRuntimeSnapshot>(\n () => ({\n threadId,\n isNewChat,\n client,\n lifecycle: lifecycleValue,\n serverLane,\n threadConfig,\n }),\n [threadId, isNewChat, client, lifecycleValue, serverLane, threadConfig],\n );\n useLayoutEffect(() => {\n onPublish(snapshot);\n }, [onPublish, snapshot]);\n\n return null;\n}\n\n/**\n * The stable half of the statewire lane: the scope around the host's\n * `children`. It mounts one `AthenaStatewireRuntimeMount` per thread beside\n * them and provides whatever that mount last published — client, thread ids,\n * lifecycle — so a thread switch swaps the client under the host's UI instead\n * of remounting it. Until the first mount has published, the children are\n * withheld: they need a client, and the first publication lands in the same\n * task as the mount's commit.\n *\n * A server render runs no effects, so it would withhold the children too.\n * That changes nothing today: `AthenaProvider` renders `null` until the parent\n * bridge reports ready, which only ever happens in an effect (`useParentBridge`\n * starts `ready: false`), so the SDK has never server-rendered the host UI —\n * it hydrates it. A future SSR-ready bridge would need the first publication\n * to happen in render as well.\n */\nfunction AthenaStatewireStandalone({\n children,\n backendUrl,\n appUrl,\n threadId: threadIdProp,\n threadIsNew = false,\n threadList,\n linkClicks,\n citationLinks,\n modes,\n ...runtimeProps\n}: AthenaStatewireStandaloneProps) {\n // Statewire attaches to `${syncUrl}/${threadId}`, so a thread ID must exist\n // up front. An auto-generated ID is by definition a never-started local chat.\n const generatedIdRef = useRef<string | null>(null);\n if (generatedIdRef.current === null) {\n generatedIdRef.current = mintThreadId();\n }\n const threadId = threadIdProp ?? generatedIdRef.current;\n const isNewChat = threadList?.isNewChat ?? (!threadIdProp || threadIsNew);\n\n const [published, setPublished] = useState<AthenaStatewireRuntimeSnapshot | null>(null);\n\n // The mode menu (`modes`), kept across thread switches per agent, channel\n // and thread: the mode this browser picked and has not yet seen the session\n // run in, and the channel each session runs on as last read. A send names\n // the pick, else the session's channel, so it never moves a session another\n // browser switched; a pick the host no longer lists is never sent.\n const agentSelection = useContext(AthenaAgentSelectionContext);\n const modeScope = `${agentSelection?.agentAssetId ?? ''}\\u0000${agentSelection?.channel ?? ''}`;\n const [modePicks, setModePicks] = useState<Readonly<Record<string, string>>>({});\n const [sessionChannels, setSessionChannels] = useState<Readonly<Record<string, string>>>({});\n const setModePick = useCallback(\n ({ threadId: pickedThread, modeId }: { threadId: string; modeId: string | null }) =>\n setModePicks((picks) => withEntry(picks, `${modeScope}\\u0000${pickedThread}`, modeId)),\n [modeScope],\n );\n const setSessionChannel = useCallback(\n ({ threadId: readThread, channel }: { threadId: string; channel: string | null }) =>\n setSessionChannels((channels) =>\n withEntry(channels, `${modeScope}\\u0000${readThread}`, channel),\n ),\n [modeScope],\n );\n const hostModes = modes ?? EMPTY_MODES;\n const modeKey = hostModes.join('\\u0000');\n const listedPick = (thread: string): string | null => {\n const pick = modePicks[`${modeScope}\\u0000${thread}`];\n return pick !== undefined && hostModes.includes(pick) ? pick : null;\n };\n const threadMode =\n hostModes.length > 0\n ? (listedPick(threadId) ?? sessionChannels[`${modeScope}\\u0000${threadId}`])\n : undefined;\n\n const clientTools = useStatewireClientTools(runtimeProps.frontendTools);\n\n // The runtime binds `client_tools` only for a recognised `app_id`; with none\n // it drops every declaration without telling the client, and the model then\n // sees \"not a valid tool\". Say so here, once per configuration, as an error\n // so it reaches `onError` and the console even with diagnostics off.\n const clientToolNamesKey = clientTools.map((tool) => tool.definition.name).join(',');\n const clientToolAppId = runtimeProps.appId;\n useEffect(() => {\n if (clientTools.length === 0 || resolveClientToolSurface(clientToolAppId) !== null) return;\n athenaDiagnostics.emit('sdk.config.warning', {\n level: 'error',\n error: new AthenaSdkError({\n code: 'config_invalid',\n message: `frontendTools with an execute() need a recognised appId; ${clientTools.length} tool(s) will not be bound.`,\n hint:\n \"Pass appId={publicAppId} on <AthenaProvider> (a computer-asset app reads it from athena-public-config.json as computer_asset_<uuid>). Without it the deep-agent runtime drops every client tool.\",\n context: { appId: clientToolAppId ?? null, tools: clientToolNamesKey.split(',') },\n }),\n data: { appId: clientToolAppId ?? null, tools: clientToolNamesKey.split(',') },\n });\n // clientToolNamesKey is the value-stable form of the tool list.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [clientToolAppId, clientToolNamesKey]);\n\n const athenaConfig = useAthenaConfigValue({\n backendUrl,\n appUrl,\n apiKey: runtimeProps.apiKey,\n token: runtimeProps.token,\n getToken: runtimeProps.getToken,\n enabledToolkits: runtimeProps.tools,\n linkClicks,\n citationLinks,\n });\n\n const chatModeSelection = useMemo<AthenaChatModeSelection | null>(\n () =>\n published\n ? {\n hostModes,\n threadId: published.threadId,\n isNewChat: published.isNewChat,\n pick: listedPick(published.threadId),\n sessionChannel: sessionChannels[`${modeScope}\\u0000${published.threadId}`] ?? null,\n setPick: setModePick,\n setSessionChannel,\n }\n : null,\n // modeKey is the value-stable form of hostModes, which listedPick reads.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [modeKey, modeScope, modePicks, sessionChannels, published, setModePick, setSessionChannel],\n );\n\n const scope = published && (\n <AuiProvider value={published.client}>\n <AthenaContext.Provider value={athenaConfig}>\n <AthenaStatewireThreadIdContext.Provider value={published.threadId}>\n <AthenaStatewireLifecycleContext.Provider value={published.lifecycle}>\n <DeepAgentConnectionContext.Provider value={published.lifecycle.connection}>\n <AthenaStatewireServerLaneContext.Provider value={published.serverLane}>\n <StatewireToolOutputsContext.Provider value={runtimeProps.toolOutputs}>\n <TooltipProvider>\n <StatewireClientToolBridge tools={clientTools} threadId={published.threadId} />\n {/* Keyed per thread: each attach starts with no pending lane write. */}\n <StatewireThreadConfigLaneSync\n key={published.threadId}\n threadId={published.threadId}\n config={published.threadConfig}\n lane={published.serverLane}\n channelLive={isStatewireChannelLive(published.lifecycle.connection)}\n />\n <ComposerHandoffDrain />\n <AthenaChatModeSelectionContext.Provider value={chatModeSelection}>\n {children}\n </AthenaChatModeSelectionContext.Provider>\n </TooltipProvider>\n </StatewireToolOutputsContext.Provider>\n </AthenaStatewireServerLaneContext.Provider>\n </DeepAgentConnectionContext.Provider>\n </AthenaStatewireLifecycleContext.Provider>\n </AthenaStatewireThreadIdContext.Provider>\n </AthenaContext.Provider>\n </AuiProvider>\n );\n\n return (\n <>\n <AthenaStatewireRuntimeMount\n key={threadId}\n threadId={threadId}\n isNewChat={isNewChat}\n onPublish={setPublished}\n mode={threadMode}\n {...runtimeProps}\n />\n {/* The backend id rides the same snapshot as the client, so\n history-gated UI (e.g. the loading overlay) never judges one thread\n by another's state; it is undefined for a never-started chat, which\n must not read as pending history. */}\n {threadList && published ? (\n <AthenaThreadIdContext.Provider\n value={published.isNewChat ? undefined : published.threadId}\n >\n {scope}\n </AthenaThreadIdContext.Provider>\n ) : (\n scope\n )}\n </>\n );\n}\n\n// ─── Thread List Mode ─────────────────────────────────────────────────\n\nfunction AthenaStatewireWithThreadList({\n children,\n backendUrl,\n syncUrl,\n appId,\n apiKey,\n token,\n getToken,\n initialThreadId,\n includePullRequests,\n additionalListAppIds,\n ...standaloneProps\n}: Omit<AthenaStatewireStandaloneProps, 'threadId' | 'threadList'> & {\n initialThreadId?: string;\n includePullRequests?: boolean;\n additionalListAppIds?: readonly string[];\n}) {\n return (\n <AthenaStatewireThreadListProvider\n backendUrl={backendUrl}\n syncUrl={syncUrl}\n apiKey={apiKey}\n token={token}\n getToken={getToken}\n appId={appId}\n additionalListAppIds={additionalListAppIds}\n initialThreadId={initialThreadId}\n includePullRequests={includePullRequests}\n // The list's hover prefetch warms the same cache the active-thread\n // mount seeds from, so a hovered-then-selected session paints at once.\n snapshotCache={standaloneProps.snapshotCache}\n >\n <AthenaStatewireActiveThreadHost\n backendUrl={backendUrl}\n syncUrl={syncUrl}\n appId={appId}\n apiKey={apiKey}\n token={token}\n getToken={getToken}\n {...standaloneProps}\n >\n {children}\n </AthenaStatewireActiveThreadHost>\n </AthenaStatewireThreadListProvider>\n );\n}\n\nfunction AthenaStatewireActiveThreadHost({\n children,\n ...standaloneProps\n}: Omit<AthenaStatewireStandaloneProps, 'threadId' | 'threadList'>) {\n const list = useAthenaStatewireThreadList();\n if (!list) return null;\n\n // Not keyed: the scope keeps the host's children mounted across a switch\n // and remounts only its per-thread runtime against the new\n // `…/v2/threads/{id}` URL (see `AthenaStatewireStandalone`).\n return (\n <AthenaStatewireStandalone\n threadId={list.activeThreadId}\n threadList={{ isNewChat: list.isNewChat }}\n {...standaloneProps}\n >\n <StatewireThreadTitlePoller />\n <AssetPanelThreadSync />\n {children}\n </AthenaStatewireStandalone>\n );\n}\n\n/**\n * Syncs the active thread ID into the asset panel store so that open asset\n * tabs are scoped per-thread automatically.\n *\n * Scoped by the attached thread's minted id from creation onward — NOT by\n * `useAthenaThreadManager().activeThreadId`, which is deliberately `null`\n * while a new chat is unpersisted (so URL sync never names it). The minted id\n * is the id the thread persists under, so tabs opened in a brand-new chat\n * stay put when the backend first lists it instead of being left behind in a\n * `null` scope the store never restores. Read from the statewire scope (the\n * id published with its client) rather than the list's selection, which runs\n * one commit ahead of the client during a switch.\n */\nfunction AssetPanelThreadSync() {\n const threadId = useAthenaStatewireThreadId();\n const setCurrentThread = useAssetPanelStore((s) => s.setCurrentThread);\n\n useEffect(() => {\n setCurrentThread(threadId);\n }, [threadId, setCurrentThread]);\n\n return null;\n}\n\n// ─── Main Provider ────────────────────────────────────────────────────\n\nexport function AthenaProvider({\n children,\n config,\n apiKey,\n token: tokenProp,\n agent,\n channel,\n modes,\n model,\n tools = [],\n frontendTools = {},\n disableAutoOpen = false,\n apiUrl,\n backendUrl,\n appUrl,\n environment,\n statewireSyncUrl,\n getToken,\n extraRunConfig,\n workbench,\n knowledgeBase,\n systemPrompt,\n appId,\n threadId: threadIdProp,\n threadIsNew,\n enableThreadList = false,\n threadListIncludePullRequests = true,\n threadListAdditionalAppIds,\n theme,\n linkClicks,\n citationLinks,\n onOpenAsset,\n posthog: posthogProp,\n debug,\n onDiagnostic,\n onError,\n}: AthenaProviderProps) {\n // Fail loud before any effect, bridge wait, or network call: an `agent`\n // outside the collab_agent namespace can never apply, so a misconfigured\n // deployment must die at first render rather than answer as the wrong agent.\n const agentAssetId = resolveAgentProp({ agent });\n // The channel rides only with an agent, as the run config sends it.\n const trimmedChannel = channel?.trim() ?? '';\n const agentChannel = agentAssetId && trimmedChannel !== '' ? trimmedChannel : null;\n const agentSelection = useMemo<AthenaAgentSelection>(\n () => ({ agentAssetId, channel: agentChannel }),\n [agentAssetId, agentChannel],\n );\n\n // Diagnostics wiring first, so everything below is observable. Callbacks\n // ride refs: a per-render closure must not re-register the consumer. Each\n // provider registers its OWN consumer (additive, cleaned up on unmount), so\n // two mounted providers never clobber each other's onDiagnostic/onError —\n // only the console/PostHog/buffer settings are global (last writer wins).\n const onDiagnosticRef = useRef(onDiagnostic);\n onDiagnosticRef.current = onDiagnostic;\n const onErrorRef = useRef(onError);\n onErrorRef.current = onError;\n useEffect(() => {\n installAthenaDiagnosticsGlobal();\n return athenaDiagnostics.addConsumer({\n onEvent: (event) => onDiagnosticRef.current?.(event),\n onError: (error, event) => onErrorRef.current?.(error, event),\n });\n }, []);\n // A host that opens assets its own way takes every request the SDK makes to open one, on the\n // shared asset store. The callback rides a ref, so a new one each render does not re-register.\n const onOpenAssetRef = useRef(onOpenAsset);\n onOpenAssetRef.current = onOpenAsset;\n const opensAssets = onOpenAsset !== undefined;\n useEffect(() => {\n if (!opensAssets) return;\n // The host's answer as given: anything but `false` (a callback returning nothing included)\n // means it opened the asset.\n return useAssetPanelStore.getState().registerAssetOpener((request) => {\n const open = onOpenAssetRef.current;\n return open ? open(request) : false;\n });\n }, [opensAssets]);\n const debugKey = JSON.stringify(debugPropToDiagnosticsConfig(debug));\n useEffect(() => {\n athenaDiagnostics.configure(debugPropToDiagnosticsConfig(debug));\n // debugKey is the value-stable form of `debug` (consumers pass literals).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [debugKey]);\n // Only declarations WITHOUT a local `execute` ride `enabled_tools`: they name\n // registry tools the backend binds itself. Executable tools are declared\n // through `client_tools` instead — listing them here too would switch on a\n // backend toolkit owning a tool of the same name, and the backend wins that\n // collision (the client tool is silently dropped).\n const frontendToolNames = useMemo(\n () => backendDeclaredFrontendToolIds(frontendTools),\n [frontendTools],\n );\n // Merge SDK auto-open defaults under the consumer's frontendTools. Consumer\n // entries win on name collision; auto-open tool names are NOT added to\n // frontendToolIds (they are already backend-advertised by their toolkits).\n const effectiveFrontendTools = useMemo<Toolkit>(\n () => (disableAutoOpen ? frontendTools : { ...DEFAULT_AUTO_OPEN_TOOLS, ...frontendTools }),\n [disableAutoOpen, frontendTools],\n );\n const themeStyleVars = useMemo(() => theme ? themeToStyleVars(theme) : undefined, [theme]);\n const configuredEnvironment = config?.environment ?? environment;\n const environmentUrls = useMemo(\n () => getAthenaEnvironmentUrls({ environment: configuredEnvironment }),\n [configuredEnvironment],\n );\n const configuredApiKey = config?.apiKey ?? apiKey;\n const configuredToken = resolveTokenOverride({ config, token: tokenProp });\n const configuredApiUrl = config?.apiUrl ?? apiUrl;\n const configuredBackendUrl = config?.backendUrl ?? backendUrl;\n const configuredAppUrl = config?.appUrl ?? appUrl;\n const configuredStatewireSyncUrl = config?.statewireSyncUrl ?? statewireSyncUrl;\n const configuredGetToken = config?.getToken ?? getToken;\n const configuredExtraRunConfig = config?.extraRunConfig ?? extraRunConfig;\n const configuredTrustedParentOrigins = config?.trustedParentOrigins;\n const posthogConfig: PostHogConfig | undefined = config?.posthog ?? posthogProp;\n\n // Statewire is the SDK's only chat transport; the gauge/event stay on the\n // diagnostics contract so dashboards keyed on them keep reading a value.\n useEffect(() => {\n athenaDiagnostics.gauge('sdk.transport', 'statewire');\n athenaDiagnostics.emit('sdk.transport', {\n level: 'debug',\n data: { transport: 'statewire', thread_list: enableThreadList },\n });\n }, [enableThreadList]);\n\n const bridge = useParentBridge({\n trustedOrigins: configuredTrustedParentOrigins,\n });\n\n // If an AthenaAuthProvider is present above us, use its access token automatically.\n const authContext = useContext(AthenaAuthContext);\n const authProviderToken = authContext?.accessToken ?? null;\n\n // Per-provider snapshot cache: a switch back to a recently-visited thread\n // mounts with its last-known snapshot instead of a loading spinner. Owned\n // here, above the per-thread keyed mount, so it survives switches; cleared\n // when the acting identity changes so a snapshot captured under one account\n // never seeds a mount under another.\n const [snapshotCache] = useState(() => createDeepAgentThreadSnapshotCache());\n // Composer writes that arrive before the per-thread mount is ready wait\n // here, above that mount, so a thread-list remount cannot drop them.\n const [composerHandoff] = useState(createComposerHandoffStore);\n // The windowed wire's fetched-back tool outputs, owned alongside the cache\n // for the same reasons: shared across the provider's thread switches (a\n // tool message id is unique across threads), dropped with the identity.\n const [toolOutputs] = useState(() => createDeepAgentToolOutputStore());\n const principal = authContext?.user?.userId ?? '';\n useEffect(() => {\n snapshotCache.clear();\n toolOutputs.clear();\n // A draft or send queued under the previous identity must never land in\n // this one's composer.\n clearComposerHandoff({ store: composerHandoff, reason: 'the signed-in identity changed' });\n }, [snapshotCache, toolOutputs, composerHandoff, principal, configuredApiKey]);\n // Nothing drains after the provider is gone: settle what still waits so no\n // `useSendMessage` caller hangs.\n useEffect(\n () => () => clearComposerHandoff({ store: composerHandoff, reason: 'the chat provider unmounted' }),\n [composerHandoff],\n );\n\n const effectiveToken = configuredToken !== undefined\n ? configuredToken\n : authProviderToken ?? bridge.token;\n\n // One credential source for every network path below: it presents the\n // token chosen above and renews it the way its origin can. A host's own\n // `getToken` owns renewal; a host's static `token` never renews; a sign-in\n // provider's token renews through its getter (PropelAuth, SSO); a host\n // bridge token through the bridge (a Marathon re-mint, or the parent\n // window's next `athena-auth`).\n const authProviderGetToken = authContext?.getToken;\n const credentialInputsRef = useRef<AthenaCredentialInputs>({ token: null });\n credentialInputsRef.current = {\n hostGetToken: configuredGetToken,\n token: effectiveToken,\n renew:\n configuredToken !== undefined\n ? undefined\n : authProviderToken !== null\n ? authProviderGetToken\n ? async ({ force }) => (await authProviderGetToken({ force })) ?? null\n : undefined\n : bridge.token !== null\n ? bridge.renewToken\n : undefined,\n };\n const [credentials] = useState(() =>\n createAthenaCredentialSource(() => credentialInputsRef.current),\n );\n useEffect(() => {\n credentials.notifyTokenChanged();\n }, [credentials, effectiveToken]);\n // Only a provider that holds a token (or a host getter) hands one out, so\n // \"has credentials\" checks downstream keep meaning what they did.\n const credentialGetToken =\n configuredGetToken !== undefined || effectiveToken ? credentials.getToken : undefined;\n // Explicit config wins. A Marathon host mints the statewire mount, the bare\n // Agora base and the app origin outright (`/_athena/auth`, or a trusted\n // parent's `athena-config`); the environment preset is the last resort, and\n // the sync mount derives from the `apiUrl` host when no host minted one.\n const effectiveApiUrl = configuredApiUrl ?? environmentUrls.apiUrl;\n // Published as the bare Agora base: a historical `…/api/assistant-ui` value\n // is trimmed here once rather than by each REST helper.\n const effectiveBackendUrl = getAthenaApiBaseUrl(\n configuredBackendUrl ?? bridge.backendBaseUrl ?? environmentUrls.backendUrl,\n );\n const hostStatewireSyncUrl = configuredStatewireSyncUrl ?? bridge.statewireSyncUrl ?? undefined;\n const effectiveAppUrl = configuredAppUrl\n ?? bridge.appUrl\n ?? deriveAthenaAppUrl({ apiUrl: effectiveApiUrl, backendUrl: effectiveBackendUrl })\n ?? environmentUrls.appUrl;\n\n // Wait for the parent bridge to deliver config/auth before rendering.\n // This prevents the thread list from fetching with wrong URLs or no token.\n // An iframe bridge falls back after a short timeout (2s) if no parent\n // answers; a Marathon mint is ready once its bounded retry cycle ends.\n if (!bridge.ready) {\n return null;\n }\n\n // Fail closed when the host's mint gave up and nothing else can\n // authenticate: the chat would otherwise attach with no credential (and to\n // the environment preset, since no host minted a mount). The bridge has\n // already reported the typed `auth_bridge_failed` / `auth_bridge_timeout`\n // error to `onError`; remounting the provider starts a new bounded mint.\n if (\n bridge.error &&\n !effectiveToken &&\n configuredGetToken === undefined &&\n !configuredApiKey\n ) {\n return null;\n }\n\n // Both throw on an unresolvable configuration instead of falling back to an\n // Athena default — a custom deployment's credentials must never be sent to\n // a host the consumer didn't configure. A host that answered the bridge\n // without minting the statewire mount is that case: its token would\n // otherwise ride the environment preset.\n assertHostMintedStatewireMount({\n hostAnswered: bridge.hostAnswered,\n hostStatewireSyncUrl: bridge.statewireSyncUrl,\n statewireSyncUrl: configuredStatewireSyncUrl,\n apiUrl: configuredApiUrl,\n });\n const effectiveStatewireSyncUrl = resolveStatewireSyncUrl({\n statewireSyncUrl: hostStatewireSyncUrl,\n apiUrl: effectiveApiUrl,\n });\n\n const statewireProps = {\n syncUrl: effectiveStatewireSyncUrl,\n backendUrl: effectiveBackendUrl,\n appUrl: effectiveAppUrl,\n apiKey: configuredApiKey,\n token: effectiveToken,\n getToken: credentialGetToken,\n model,\n agent,\n channel,\n modes,\n tools,\n frontendToolIds: frontendToolNames,\n frontendTools: effectiveFrontendTools,\n workbench,\n knowledgeBase,\n systemPrompt,\n appId,\n extraRunConfig: configuredExtraRunConfig,\n snapshotCache,\n toolOutputs,\n linkClicks,\n citationLinks,\n };\n\n // Each provider's assistant client is a root of its own (`extends={null}`): one mounted under\n // another provider's (a host showing several chats side by side) would otherwise extend that\n // client and define every tool a second time. The empty config is built per render (configs are\n // identity-insensitive), never at import, which a host's test stub of assistant-ui could not take.\n const inner: ReactNode = (\n <AuiProvider extends={null} config={AuiConfig({})}>\n {enableThreadList ? (\n <AthenaStatewireWithThreadList\n {...statewireProps}\n initialThreadId={threadIdProp}\n includePullRequests={threadListIncludePullRequests}\n additionalListAppIds={threadListAdditionalAppIds}\n >\n {children}\n </AthenaStatewireWithThreadList>\n ) : (\n // A provider without a thread list is its own chat: one nested under a thread-list\n // provider (a host showing several chats side by side) must not read that list as its\n // own, or its banners and composer would follow the other chat's thread.\n <AthenaStatewireThreadListContext.Provider value={null}>\n <AthenaStatewireStandalone\n {...statewireProps}\n threadId={threadIdProp}\n threadIsNew={threadIsNew}\n >\n {children}\n </AthenaStatewireStandalone>\n </AthenaStatewireThreadListContext.Provider>\n )}\n </AuiProvider>\n );\n\n // The .athena-sdk wrapper (display: contents) anchors the SDK's design\n // tokens and scoped preflight from styles.css, so the stylesheet works\n // in hosts without their own Tailwind build. PostHog gracefully no-ops\n // when its config is missing.\n return (\n <div\n className={themeStyleVars ? \"athena-sdk athena-themed\" : \"athena-sdk\"}\n style={themeStyleVars as React.CSSProperties | undefined}\n >\n <PostHogProvider config={posthogConfig}>\n <ComposerHandoffContext.Provider value={composerHandoff}>\n <AthenaThemeStyleContext.Provider value={themeStyleVars}>\n <AthenaCredentialSourceContext.Provider value={credentials}>\n <AthenaAgentSelectionContext.Provider value={agentSelection}>\n {inner}\n </AthenaAgentSelectionContext.Provider>\n </AthenaCredentialSourceContext.Provider>\n </AthenaThemeStyleContext.Provider>\n </ComposerHandoffContext.Provider>\n </PostHogProvider>\n </div>\n );\n}\n"],"names":["_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuTA,MAAM,uBAAuB,CAAC;AAAA,EAC5B;AAAA,EACA;AACF,MAGiC;AAC/B,OAAI,iCAAQ,WAAU,QAAW;AAC/B,WAAO,OAAO;AAAA,EAChB;AACA,SAAO;AACT;AAEA,MAAM,uBAAuB,CAAC;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MASoB;AAClB,QAAM,gBAAgB,OAAO,UAAU;AACvC,gBAAc,UAAU;AACxB,QAAM,mBAAmB,OAAO,aAAa;AAC7C,mBAAiB,UAAU;AAM3B,QAAM,WAAW,OAAO,KAAK;AAC7B,WAAS,UAAU;AACnB,QAAM,cAAc,OAAO,QAAQ;AACnC,cAAY,UAAU;AAEtB,SAAO;AAAA,IACL,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AA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ACA,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAOF,QAAM,QACJ,oBAAC,aAAA,EAAY,SAAS,MAAM,QAAQ,UAAU,CAAA,CAAE,GAC7C,UAAA,mBACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,iBAAiB;AAAA,MACjB,qBAAqB;AAAA,MACrB,sBAAsB;AAAA,MAErB;AAAA,IAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,IAMH,oBAAC,iCAAiC,UAAjC,EAA0C,OAAO,MAChD,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,QACJ,UAAU;AAAA,QACV;AAAA,QAEC;AAAA,MAAA;AAAA,IAAA,EACH,CACF;AAAA,KAEJ;AAOF,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW,iBAAiB,6BAA6B;AAAA,MACzD,OAAO;AAAA,MAEP,UAAA,oBAAC,iBAAA,EAAgB,QAAQ,eACvB,8BAAC,uBAAuB,UAAvB,EAAgC,OAAO,iBACtC,UAAA,oBAAC,wBAAwB,UAAxB,EAAiC,OAAO,gBACvC,UAAA,oBAAC,8BAA8B,UAA9B,EAAuC,OAAO,aAC7C,8BAAC,4BAA4B,UAA5B,EAAqC,OAAO,gBAC1C,UAAA,MAAA,CACH,GACF,EAAA,CACF,GACF,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const AthenaAgentSelectionContext = react.createContext(null);
|
|
5
|
+
exports.AthenaAgentSelectionContext = AthenaAgentSelectionContext;
|
|
6
|
+
//# sourceMappingURL=agent-selection-context.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-selection-context.cjs","sources":["../../src/provider/agent-selection-context.ts"],"sourcesContent":["import { createContext } from 'react';\n\n/**\n * The collab agent (and channel) the nearest `AthenaProvider` runs its chat\n * as, from its `agent` and `channel` props. `ChatModelPicker` reads it to offer\n * the agent's own models when the host says an agent is selected without\n * naming it.\n */\nexport interface AthenaAgentSelection {\n /** The collab agent's asset id; `null` when the provider runs the Athena deep agent. */\n agentAssetId: string | null;\n /** The collab channel the provider sends (`collab_channel_id`); `null` for the agent's base config. */\n channel: string | null;\n}\n\n/** Provided by `AthenaProvider`; `null` outside one. */\nexport const AthenaAgentSelectionContext = createContext<AthenaAgentSelection | null>(null);\n"],"names":["createContext"],"mappings":";;;AAgBO,MAAM,8BAA8BA,MAAAA,cAA2C,IAAI;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The collab agent (and channel) the nearest `AthenaProvider` runs its chat
|
|
3
|
+
* as, from its `agent` and `channel` props. `ChatModelPicker` reads it to offer
|
|
4
|
+
* the agent's own models when the host says an agent is selected without
|
|
5
|
+
* naming it.
|
|
6
|
+
*/
|
|
7
|
+
export interface AthenaAgentSelection {
|
|
8
|
+
/** The collab agent's asset id; `null` when the provider runs the Athena deep agent. */
|
|
9
|
+
agentAssetId: string | null;
|
|
10
|
+
/** The collab channel the provider sends (`collab_channel_id`); `null` for the agent's base config. */
|
|
11
|
+
channel: string | null;
|
|
12
|
+
}
|
|
13
|
+
/** Provided by `AthenaProvider`; `null` outside one. */
|
|
14
|
+
export declare const AthenaAgentSelectionContext: import("react").Context<AthenaAgentSelection | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-selection-context.js","sources":["../../src/provider/agent-selection-context.ts"],"sourcesContent":["import { createContext } from 'react';\n\n/**\n * The collab agent (and channel) the nearest `AthenaProvider` runs its chat\n * as, from its `agent` and `channel` props. `ChatModelPicker` reads it to offer\n * the agent's own models when the host says an agent is selected without\n * naming it.\n */\nexport interface AthenaAgentSelection {\n /** The collab agent's asset id; `null` when the provider runs the Athena deep agent. */\n agentAssetId: string | null;\n /** The collab channel the provider sends (`collab_channel_id`); `null` for the agent's base config. */\n channel: string | null;\n}\n\n/** Provided by `AthenaProvider`; `null` outside one. */\nexport const AthenaAgentSelectionContext = createContext<AthenaAgentSelection | null>(null);\n"],"names":[],"mappings":";AAgBO,MAAM,8BAA8B,cAA2C,IAAI;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const react = require("react");
|
|
4
|
+
const AthenaChatModeSelectionContext = react.createContext(null);
|
|
5
|
+
exports.AthenaChatModeSelectionContext = AthenaChatModeSelectionContext;
|
|
6
|
+
//# sourceMappingURL=chat-mode-context.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-mode-context.cjs","sources":["../../src/provider/chat-mode-context.ts"],"sourcesContent":["import { createContext } from 'react';\n\n/**\n * The mode menu's state for the chat the nearest `AthenaProvider` shows: the\n * modes its host listed (`modes`), the open thread, the mode this browser\n * picked for it and has not yet seen the session run in, and the channel the\n * session runs on as last read. Both are kept per agent, channel and thread.\n * A send names the pick, else the session's channel, as `collab_channel_id`\n * (the provider's `channel` then rides as `collab_entry_channel_id`), so an\n * untouched send continues the session where it is. `useAthenaChatMode` reads\n * and keeps both.\n */\nexport interface AthenaChatModeSelection {\n /** The modes the host listed, by id; empty when it offers no menu. */\n hostModes: readonly string[];\n /** The open thread. */\n threadId: string;\n /** Whether the provider knows the open thread has never been sent to. */\n isNewChat: boolean;\n /** The mode this browser picked for the open thread and has not yet seen the\n * session run in, if any. */\n pick: string | null;\n /** The channel the open session runs on as last read, if it has one. */\n sessionChannel: string | null;\n /** Pick `modeId` for `threadId`, or drop its pick (`null`). */\n setPick: (args: { threadId: string; modeId: string | null }) => void;\n /** Record the channel `threadId`'s session runs on (`null`: none yet). */\n setSessionChannel: (args: { threadId: string; channel: string | null }) => void;\n}\n\n/** Provided by `AthenaProvider`; `null` outside one. */\nexport const AthenaChatModeSelectionContext = createContext<AthenaChatModeSelection | null>(null);\n"],"names":["createContext"],"mappings":";;;AA+BO,MAAM,iCAAiCA,MAAAA,cAA8C,IAAI;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The mode menu's state for the chat the nearest `AthenaProvider` shows: the
|
|
3
|
+
* modes its host listed (`modes`), the open thread, the mode this browser
|
|
4
|
+
* picked for it and has not yet seen the session run in, and the channel the
|
|
5
|
+
* session runs on as last read. Both are kept per agent, channel and thread.
|
|
6
|
+
* A send names the pick, else the session's channel, as `collab_channel_id`
|
|
7
|
+
* (the provider's `channel` then rides as `collab_entry_channel_id`), so an
|
|
8
|
+
* untouched send continues the session where it is. `useAthenaChatMode` reads
|
|
9
|
+
* and keeps both.
|
|
10
|
+
*/
|
|
11
|
+
export interface AthenaChatModeSelection {
|
|
12
|
+
/** The modes the host listed, by id; empty when it offers no menu. */
|
|
13
|
+
hostModes: readonly string[];
|
|
14
|
+
/** The open thread. */
|
|
15
|
+
threadId: string;
|
|
16
|
+
/** Whether the provider knows the open thread has never been sent to. */
|
|
17
|
+
isNewChat: boolean;
|
|
18
|
+
/** The mode this browser picked for the open thread and has not yet seen the
|
|
19
|
+
* session run in, if any. */
|
|
20
|
+
pick: string | null;
|
|
21
|
+
/** The channel the open session runs on as last read, if it has one. */
|
|
22
|
+
sessionChannel: string | null;
|
|
23
|
+
/** Pick `modeId` for `threadId`, or drop its pick (`null`). */
|
|
24
|
+
setPick: (args: {
|
|
25
|
+
threadId: string;
|
|
26
|
+
modeId: string | null;
|
|
27
|
+
}) => void;
|
|
28
|
+
/** Record the channel `threadId`'s session runs on (`null`: none yet). */
|
|
29
|
+
setSessionChannel: (args: {
|
|
30
|
+
threadId: string;
|
|
31
|
+
channel: string | null;
|
|
32
|
+
}) => void;
|
|
33
|
+
}
|
|
34
|
+
/** Provided by `AthenaProvider`; `null` outside one. */
|
|
35
|
+
export declare const AthenaChatModeSelectionContext: import("react").Context<AthenaChatModeSelection | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-mode-context.js","sources":["../../src/provider/chat-mode-context.ts"],"sourcesContent":["import { createContext } from 'react';\n\n/**\n * The mode menu's state for the chat the nearest `AthenaProvider` shows: the\n * modes its host listed (`modes`), the open thread, the mode this browser\n * picked for it and has not yet seen the session run in, and the channel the\n * session runs on as last read. Both are kept per agent, channel and thread.\n * A send names the pick, else the session's channel, as `collab_channel_id`\n * (the provider's `channel` then rides as `collab_entry_channel_id`), so an\n * untouched send continues the session where it is. `useAthenaChatMode` reads\n * and keeps both.\n */\nexport interface AthenaChatModeSelection {\n /** The modes the host listed, by id; empty when it offers no menu. */\n hostModes: readonly string[];\n /** The open thread. */\n threadId: string;\n /** Whether the provider knows the open thread has never been sent to. */\n isNewChat: boolean;\n /** The mode this browser picked for the open thread and has not yet seen the\n * session run in, if any. */\n pick: string | null;\n /** The channel the open session runs on as last read, if it has one. */\n sessionChannel: string | null;\n /** Pick `modeId` for `threadId`, or drop its pick (`null`). */\n setPick: (args: { threadId: string; modeId: string | null }) => void;\n /** Record the channel `threadId`'s session runs on (`null`: none yet). */\n setSessionChannel: (args: { threadId: string; channel: string | null }) => void;\n}\n\n/** Provided by `AthenaProvider`; `null` outside one. */\nexport const AthenaChatModeSelectionContext = createContext<AthenaChatModeSelection | null>(null);\n"],"names":[],"mappings":";AA+BO,MAAM,iCAAiC,cAA8C,IAAI;"}
|