@athenaintel/react 0.60.0 → 0.61.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 +225 -2
- package/dist/agent-runtime/src/client-tool-bridge.cjs +20 -2
- package/dist/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
- package/dist/agent-runtime/src/client-tool-bridge.d.ts +9 -4
- package/dist/agent-runtime/src/client-tool-bridge.js +20 -2
- package/dist/agent-runtime/src/client-tool-bridge.js.map +1 -1
- package/dist/agent-runtime/src/client-tools.cjs.map +1 -1
- package/dist/agent-runtime/src/client-tools.d.ts +9 -0
- package/dist/agent-runtime/src/client-tools.js.map +1 -1
- package/dist/agent-ui/AgentTarget.cjs +11 -0
- package/dist/agent-ui/AgentTarget.cjs.map +1 -0
- package/dist/agent-ui/AgentTarget.d.ts +17 -0
- package/dist/agent-ui/AgentTarget.js +11 -0
- package/dist/agent-ui/AgentTarget.js.map +1 -0
- package/dist/agent-ui/AgentUiLayer.cjs +387 -0
- package/dist/agent-ui/AgentUiLayer.cjs.map +1 -0
- package/dist/agent-ui/AgentUiLayer.d.ts +40 -0
- package/dist/agent-ui/AgentUiLayer.js +387 -0
- package/dist/agent-ui/AgentUiLayer.js.map +1 -0
- package/dist/agent-ui/contract.cjs +104 -0
- package/dist/agent-ui/contract.cjs.map +1 -0
- package/dist/agent-ui/contract.d.ts +113 -0
- package/dist/agent-ui/contract.js +104 -0
- package/dist/agent-ui/contract.js.map +1 -0
- package/dist/agent-ui/driver.cjs +335 -0
- package/dist/agent-ui/driver.cjs.map +1 -0
- package/dist/agent-ui/driver.d.ts +66 -0
- package/dist/agent-ui/driver.js +335 -0
- package/dist/agent-ui/driver.js.map +1 -0
- package/dist/agent-ui/index.cjs +33 -0
- package/dist/agent-ui/index.cjs.map +1 -0
- package/dist/agent-ui/index.d.ts +19 -0
- package/dist/agent-ui/index.js +33 -0
- package/dist/agent-ui/index.js.map +1 -0
- package/dist/agent-ui/pace.cjs +121 -0
- package/dist/agent-ui/pace.cjs.map +1 -0
- package/dist/agent-ui/pace.d.ts +66 -0
- package/dist/agent-ui/pace.js +121 -0
- package/dist/agent-ui/pace.js.map +1 -0
- package/dist/agent-ui/screen.cjs +471 -0
- package/dist/agent-ui/screen.cjs.map +1 -0
- package/dist/agent-ui/screen.d.ts +97 -0
- package/dist/agent-ui/screen.js +471 -0
- package/dist/agent-ui/screen.js.map +1 -0
- package/dist/agent-ui/secret-fields.cjs +50 -0
- package/dist/agent-ui/secret-fields.cjs.map +1 -0
- package/dist/agent-ui/secret-fields.d.ts +15 -0
- package/dist/agent-ui/secret-fields.js +50 -0
- package/dist/agent-ui/secret-fields.js.map +1 -0
- package/dist/agent-ui/stage.cjs +196 -0
- package/dist/agent-ui/stage.cjs.map +1 -0
- package/dist/agent-ui/stage.d.ts +110 -0
- package/dist/agent-ui/stage.js +196 -0
- package/dist/agent-ui/stage.js.map +1 -0
- package/dist/agent-ui/tools.cjs +448 -0
- package/dist/agent-ui/tools.cjs.map +1 -0
- package/dist/agent-ui/tools.d.ts +103 -0
- package/dist/agent-ui/tools.js +448 -0
- package/dist/agent-ui/tools.js.map +1 -0
- package/dist/agent-ui/use-agent-target.cjs +63 -0
- package/dist/agent-ui/use-agent-target.cjs.map +1 -0
- package/dist/agent-ui/use-agent-target.d.ts +27 -0
- package/dist/agent-ui/use-agent-target.js +63 -0
- package/dist/agent-ui/use-agent-target.js.map +1 -0
- package/dist/agent-ui/use-agent-ui.cjs +15 -0
- package/dist/agent-ui/use-agent-ui.cjs.map +1 -0
- package/dist/agent-ui/use-agent-ui.d.ts +24 -0
- package/dist/agent-ui/use-agent-ui.js +15 -0
- package/dist/agent-ui/use-agent-ui.js.map +1 -0
- package/dist/chat/AthenaChat.cjs +19 -4
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +13 -0
- package/dist/chat/AthenaChat.js +19 -4
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +74 -1
- package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
- package/dist/chat/StatewireClientToolBridge.d.ts +16 -1
- package/dist/chat/StatewireClientToolBridge.js +75 -2
- package/dist/chat/StatewireClientToolBridge.js.map +1 -1
- package/dist/chat/StatewireClientToolConsentCard.cjs +66 -0
- package/dist/chat/StatewireClientToolConsentCard.cjs.map +1 -0
- package/dist/chat/StatewireClientToolConsentCard.d.ts +25 -0
- package/dist/chat/StatewireClientToolConsentCard.js +66 -0
- package/dist/chat/StatewireClientToolConsentCard.js.map +1 -0
- package/dist/chat/chat-voice-controls.cjs +5 -2
- package/dist/chat/chat-voice-controls.cjs.map +1 -1
- package/dist/chat/chat-voice-controls.d.ts +6 -1
- package/dist/chat/chat-voice-controls.js +6 -3
- package/dist/chat/chat-voice-controls.js.map +1 -1
- package/dist/chat/client-tool-write-consent.cjs +122 -0
- package/dist/chat/client-tool-write-consent.cjs.map +1 -0
- package/dist/chat/client-tool-write-consent.d.ts +79 -0
- package/dist/chat/client-tool-write-consent.js +122 -0
- package/dist/chat/client-tool-write-consent.js.map +1 -0
- package/dist/chat/statewire-client-tools.cjs +30 -5
- package/dist/chat/statewire-client-tools.cjs.map +1 -1
- package/dist/chat/statewire-client-tools.d.ts +34 -2
- package/dist/chat/statewire-client-tools.js +30 -5
- package/dist/chat/statewire-client-tools.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs +13 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.d.ts +12 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js +13 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +2 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +3 -2
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/mentions/use-asset-icon-app-url.cjs +2 -1
- package/dist/chat-ui/mentions/use-asset-icon-app-url.cjs.map +1 -1
- package/dist/chat-ui/mentions/use-asset-icon-app-url.d.ts +2 -1
- package/dist/chat-ui/mentions/use-asset-icon-app-url.js +2 -1
- package/dist/chat-ui/mentions/use-asset-icon-app-url.js.map +1 -1
- package/dist/chat-ui/messages/message-components.cjs +1 -1
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.d.ts +2 -2
- package/dist/chat-ui/messages/message-components.js +1 -1
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/statewire.cjs +4 -0
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +2 -0
- package/dist/chat-ui/statewire.js +4 -0
- package/dist/chat-ui/statewire.js.map +1 -1
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/dist/provider/AthenaProvider.cjs +59 -11
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.d.ts +25 -1
- package/dist/provider/AthenaProvider.js +55 -7
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +6 -1
|
@@ -35,7 +35,11 @@ import { StatewireThreadConfigLaneSync } from "../runtime/StatewireThreadConfigL
|
|
|
35
35
|
import { AthenaStatewireServerLaneContext, STATEWIRE_SERVER_LANE_PENDING, nextServerLane } from "../runtime/statewire-server-lane-context.js";
|
|
36
36
|
import { installAthenaDiagnosticsGlobal, athenaDiagnostics, debugPropToDiagnosticsConfig } from "../diagnostics/athena-diagnostics.js";
|
|
37
37
|
import { AthenaSdkError } from "../diagnostics/errors.js";
|
|
38
|
-
import { backendDeclaredFrontendToolIds, resolveClientToolSurface } from "../chat/statewire-client-tools.js";
|
|
38
|
+
import { backendDeclaredFrontendToolIds, requiresWriteConsent, clientToolWriteConsentSummaries, resolveClientToolSurface } from "../chat/statewire-client-tools.js";
|
|
39
|
+
import { useClientToolWriteConsentStore, ClientToolWriteConsentContext } from "../chat/client-tool-write-consent.js";
|
|
40
|
+
import { AgentUiLayer } from "../agent-ui/AgentUiLayer.js";
|
|
41
|
+
import { AGENT_UI_TOOL_NAMES, AGENT_UI_ACT_SUMMARY } from "../agent-ui/tools.js";
|
|
42
|
+
import { useAgentUi } from "../agent-ui/use-agent-ui.js";
|
|
39
43
|
import { TooltipProvider } from "../ui/tooltip.js";
|
|
40
44
|
import { DEFAULT_AUTO_OPEN_TOOLS } from "../tools/auto-open-tools.js";
|
|
41
45
|
import { AthenaContext } from "./AthenaContext.js";
|
|
@@ -58,6 +62,8 @@ import { DeepAgentConnectionContext } from "../agent-runtime/src/thread-status.j
|
|
|
58
62
|
import { DeepAgentChatOutboxContext, useDeepAgentChatOutbox } from "../agent-runtime/src/use-deep-agent-chat-outbox.js";
|
|
59
63
|
import { documentVisibleSignal, browserOnlineSignal, allChatOutboxSignals } from "../agent-runtime/src/chat-outbox-signals.js";
|
|
60
64
|
import { readServerConfig } from "../agent-runtime/src/use-deep-agent-config.js";
|
|
65
|
+
const EMPTY_AGENT_UI_OPTIONS = {};
|
|
66
|
+
const EMPTY_TOOLKIT = {};
|
|
61
67
|
const resolveTokenOverride = ({
|
|
62
68
|
config,
|
|
63
69
|
token
|
|
@@ -389,6 +395,8 @@ function AthenaStatewireStandalone({
|
|
|
389
395
|
linkClicks,
|
|
390
396
|
citationLinks,
|
|
391
397
|
modes,
|
|
398
|
+
confirmClientToolWrites,
|
|
399
|
+
clientToolConsentAgentName,
|
|
392
400
|
...runtimeProps
|
|
393
401
|
}) {
|
|
394
402
|
const generatedIdRef = useRef(null);
|
|
@@ -422,6 +430,13 @@ function AthenaStatewireStandalone({
|
|
|
422
430
|
};
|
|
423
431
|
const threadMode = hostModes.length > 0 ? listedPick(threadId) ?? sessionChannels[`${modeScope}\0${threadId}`] : void 0;
|
|
424
432
|
const clientTools = useStatewireClientTools(runtimeProps.frontendTools);
|
|
433
|
+
const writeConsentStore = useClientToolWriteConsentStore(
|
|
434
|
+
`${principal ?? "signing-in"}\0${runtimeProps.syncUrl}`
|
|
435
|
+
);
|
|
436
|
+
const writeConsentSummaries = useMemo(
|
|
437
|
+
() => clientToolWriteConsentSummaries(runtimeProps.frontendTools),
|
|
438
|
+
[runtimeProps.frontendTools]
|
|
439
|
+
);
|
|
425
440
|
const clientToolNamesKey = clientTools.map((tool) => tool.definition.name).join(",");
|
|
426
441
|
const clientToolAppId = runtimeProps.appId;
|
|
427
442
|
useEffect(() => {
|
|
@@ -461,8 +476,17 @@ function AthenaStatewireStandalone({
|
|
|
461
476
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
462
477
|
[modeKey, modeScope, modePicks, sessionChannels, published, setModePick, setSessionChannel]
|
|
463
478
|
);
|
|
464
|
-
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__ */ jsx(TurnStepsControlContext.Provider, { value: EarlierStepsButton, children: /* @__PURE__ */ jsx(StatewireHistoryContext.Provider, { value: runtimeProps.historyStore, children: /* @__PURE__ */
|
|
465
|
-
/* @__PURE__ */ jsx(
|
|
479
|
+
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__ */ jsx(TurnStepsControlContext.Provider, { value: EarlierStepsButton, children: /* @__PURE__ */ jsx(StatewireHistoryContext.Provider, { value: runtimeProps.historyStore, children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(ClientToolWriteConsentContext.Provider, { value: writeConsentStore, children: [
|
|
480
|
+
/* @__PURE__ */ jsx(
|
|
481
|
+
StatewireClientToolBridge,
|
|
482
|
+
{
|
|
483
|
+
tools: clientTools,
|
|
484
|
+
threadId: published.threadId,
|
|
485
|
+
writeConsentSummaries,
|
|
486
|
+
writeConsentAgentName: clientToolConsentAgentName,
|
|
487
|
+
confirmWrites: confirmClientToolWrites
|
|
488
|
+
}
|
|
489
|
+
),
|
|
466
490
|
/* @__PURE__ */ jsx(
|
|
467
491
|
StatewireThreadConfigLaneSync,
|
|
468
492
|
{
|
|
@@ -492,7 +516,7 @@ function AthenaStatewireStandalone({
|
|
|
492
516
|
children
|
|
493
517
|
}
|
|
494
518
|
) }) })
|
|
495
|
-
] }) }) }) }) }) }) }) }) }) });
|
|
519
|
+
] }) }) }) }) }) }) }) }) }) }) });
|
|
496
520
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
497
521
|
/* @__PURE__ */ jsx(
|
|
498
522
|
AthenaStatewireRuntimeMount,
|
|
@@ -618,6 +642,8 @@ function AthenaProvider({
|
|
|
618
642
|
model,
|
|
619
643
|
tools = [],
|
|
620
644
|
frontendTools = {},
|
|
645
|
+
confirmClientToolWrites,
|
|
646
|
+
agentUi: agentUiProp = false,
|
|
621
647
|
disableAutoOpen = false,
|
|
622
648
|
apiUrl,
|
|
623
649
|
backendUrl,
|
|
@@ -692,9 +718,26 @@ function AthenaProvider({
|
|
|
692
718
|
() => backendDeclaredFrontendToolIds(frontendTools),
|
|
693
719
|
[frontendTools]
|
|
694
720
|
);
|
|
721
|
+
const agentUiEnabled = agentUiProp === true || typeof agentUiProp === "object" && agentUiProp !== null;
|
|
722
|
+
const { classNames: agentUiClassNames, ...agentUiOptions } = typeof agentUiProp === "object" && agentUiProp !== null ? agentUiProp : EMPTY_AGENT_UI_OPTIONS;
|
|
723
|
+
const agentUiActConsent = agentUiOptions.actConsent ?? "host";
|
|
724
|
+
const agentUiHost = useAgentUi({ ...agentUiOptions, actConsent: agentUiActConsent });
|
|
725
|
+
const agentUiTools = useMemo(() => {
|
|
726
|
+
if (!agentUiEnabled) return EMPTY_TOOLKIT;
|
|
727
|
+
const act = agentUiHost.tools[AGENT_UI_TOOL_NAMES.actOn];
|
|
728
|
+
if (!act || agentUiActConsent !== "host") return agentUiHost.tools;
|
|
729
|
+
return {
|
|
730
|
+
...agentUiHost.tools,
|
|
731
|
+
[AGENT_UI_TOOL_NAMES.actOn]: requiresWriteConsent(act, { summary: AGENT_UI_ACT_SUMMARY })
|
|
732
|
+
};
|
|
733
|
+
}, [agentUiActConsent, agentUiEnabled, agentUiHost.tools]);
|
|
695
734
|
const effectiveFrontendTools = useMemo(
|
|
696
|
-
() =>
|
|
697
|
-
|
|
735
|
+
() => ({
|
|
736
|
+
...disableAutoOpen ? {} : DEFAULT_AUTO_OPEN_TOOLS,
|
|
737
|
+
...agentUiTools,
|
|
738
|
+
...frontendTools
|
|
739
|
+
}),
|
|
740
|
+
[agentUiTools, disableAutoOpen, frontendTools]
|
|
698
741
|
);
|
|
699
742
|
const themeStyleVars = useMemo(() => theme ? themeToStyleVars(theme) : void 0, [theme]);
|
|
700
743
|
const configuredEnvironment = (config == null ? void 0 : config.environment) ?? environment;
|
|
@@ -919,6 +962,8 @@ function AthenaProvider({
|
|
|
919
962
|
tools,
|
|
920
963
|
frontendToolIds: frontendToolNames,
|
|
921
964
|
frontendTools: effectiveFrontendTools,
|
|
965
|
+
confirmClientToolWrites,
|
|
966
|
+
clientToolConsentAgentName: agentUiEnabled ? agentUiOptions.agentName : void 0,
|
|
922
967
|
workbench,
|
|
923
968
|
knowledgeBase,
|
|
924
969
|
systemPrompt,
|
|
@@ -964,7 +1009,10 @@ function AthenaProvider({
|
|
|
964
1009
|
{
|
|
965
1010
|
className: themeStyleVars ? "athena-sdk athena-themed" : "athena-sdk",
|
|
966
1011
|
style: themeStyleVars,
|
|
967
|
-
children: /* @__PURE__ */ jsx(PostHogProvider, { config: posthogConfig, children: /* @__PURE__ */ jsx(ComposerHandoffContext.Provider, { value: composerHandoff, children: /* @__PURE__ */ jsx(StatewireSessionLaneContext.Provider, { value: sessionLane, children: /* @__PURE__ */
|
|
1012
|
+
children: /* @__PURE__ */ jsx(PostHogProvider, { config: posthogConfig, children: /* @__PURE__ */ jsx(ComposerHandoffContext.Provider, { value: composerHandoff, children: /* @__PURE__ */ jsx(StatewireSessionLaneContext.Provider, { value: sessionLane, children: /* @__PURE__ */ jsxs(AthenaThemeStyleContext.Provider, { value: themeStyleVars, children: [
|
|
1013
|
+
agentUiEnabled ? /* @__PURE__ */ jsx(AgentUiLayer, { agentUi: agentUiHost.agentUi, classNames: agentUiClassNames }) : null,
|
|
1014
|
+
/* @__PURE__ */ jsx(AthenaCredentialSourceContext.Provider, { value: credentials, children: /* @__PURE__ */ jsx(AthenaAgentSelectionContext.Provider, { value: agentSelection, children: /* @__PURE__ */ jsx(AthenaOfflineSnapshotsContext.Provider, { value: offlineSnapshots, children: /* @__PURE__ */ jsx(AthenaDataQueryClientProvider, { children: awaitingKeptSnapshots ? null : inner }) }) }) })
|
|
1015
|
+
] }) }) }) })
|
|
968
1016
|
}
|
|
969
1017
|
);
|
|
970
1018
|
}
|