@athenaintel/react 0.17.0 → 0.19.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 +179 -43
- package/dist/AthenaContext-B1QMhIP-.cjs.map +1 -1
- package/dist/AthenaContext-MOslgOmE.js.map +1 -1
- package/dist/SuperGroupingCard-BsWbHyV_.js +795 -0
- package/dist/SuperGroupingCard-BsWbHyV_.js.map +1 -0
- package/dist/SuperGroupingCard-CRRFUgjN.cjs +794 -0
- package/dist/SuperGroupingCard-CRRFUgjN.cjs.map +1 -0
- package/dist/chat/StatewireApprovalCard.d.ts +59 -2
- package/dist/chat/StatewireClientToolBridge.d.ts +3 -3
- package/dist/chat/StatewireQueuedMessages.d.ts +105 -6
- package/dist/chat/statewire-approval.d.ts +1 -1
- package/dist/chat/statewire-banners.d.ts +5 -9
- package/dist/chat/statewire-client-tools.d.ts +15 -21
- package/dist/chat/super-grouping/CollapsibleGroup.d.ts +52 -11
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +78 -21
- package/dist/chat/super-grouping/activity-timeline.d.ts +91 -0
- package/dist/chat/super-grouping/grouping-function.d.ts +13 -10
- package/dist/chat/super-grouping/index.d.ts +12 -0
- package/dist/chat/super-grouping/toolkit-map.d.ts +8 -1
- package/dist/chat/use-statewire-approval-request.d.ts +44 -0
- package/dist/chat-ui/header/conversation-history-panel.d.ts +11 -1
- package/dist/chat-ui/index.d.ts +9 -0
- package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +24 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +5 -0
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +1 -1
- package/dist/chat-ui/mentions/suggestions/shims.d.ts +0 -4
- package/dist/chat-ui/messages/continue-pill.d.ts +13 -0
- package/dist/chat-ui/messages/message-components.d.ts +7 -2
- package/dist/chat-ui/messages/runtime-message.d.ts +21 -0
- package/dist/chat-ui/messages/statewire-continue-run.d.ts +82 -0
- package/dist/chat-ui/messages/user-edit-composer.d.ts +5 -2
- package/dist/chat-ui/statewire.d.ts +19 -0
- package/dist/chat-ui/thread/chat-composer-dock.d.ts +1 -1
- package/dist/chat-ui/thread/chat-thread-shell.d.ts +7 -1
- package/dist/chat-ui/thread/statewire-history-edge.d.ts +52 -0
- package/dist/chat-ui-statewire.cjs +25 -0
- package/dist/chat-ui-statewire.cjs.map +1 -0
- package/dist/chat-ui-statewire.js +25 -0
- package/dist/chat-ui-statewire.js.map +1 -0
- package/dist/chat-ui.cjs +292 -252
- package/dist/chat-ui.cjs.map +1 -1
- package/dist/chat-ui.js +289 -248
- package/dist/chat-ui.js.map +1 -1
- package/dist/diagnostics/athena-diagnostics.d.ts +1 -1
- package/dist/diagnostics/errors.d.ts +4 -4
- package/dist/index.cjs +20237 -26233
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +25 -14
- package/dist/index.js +18465 -24458
- package/dist/index.js.map +1 -1
- package/dist/lib/athena-urls.d.ts +0 -2
- package/dist/lib/posthog/wrap-posthog-client.d.ts +3 -1
- package/dist/misc-tool-uis-B2e0Okkn.cjs +43 -0
- package/dist/misc-tool-uis-B2e0Okkn.cjs.map +1 -0
- package/dist/misc-tool-uis-gAiQw0Yl.js +44 -0
- package/dist/misc-tool-uis-gAiQw0Yl.js.map +1 -0
- package/dist/provider/AthenaContext.d.ts +0 -7
- package/dist/provider/AthenaProvider.d.ts +28 -52
- package/dist/provider/config.d.ts +19 -15
- package/dist/provider/statewire-lifecycle-context.d.ts +3 -4
- package/dist/provider/statewire-window-context.d.ts +12 -0
- package/dist/provider/types.d.ts +0 -1
- package/dist/runtime/statewire-auth-headers.d.ts +38 -0
- package/dist/runtime/statewire-lifecycle.d.ts +25 -1
- package/dist/runtime/statewire-run-config.d.ts +18 -5
- package/dist/runtime/statewire-session-key.d.ts +13 -0
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +42 -16
- package/dist/statewire-continue-run-D34gS7_1.js +132 -0
- package/dist/statewire-continue-run-D34gS7_1.js.map +1 -0
- package/dist/statewire-continue-run-nE9VCKUh.cjs +131 -0
- package/dist/statewire-continue-run-nE9VCKUh.cjs.map +1 -0
- package/dist/statewire-history-edge-C8uyTEjX.cjs +1711 -0
- package/dist/statewire-history-edge-C8uyTEjX.cjs.map +1 -0
- package/dist/statewire-history-edge-CPohUKMt.js +1712 -0
- package/dist/statewire-history-edge-CPohUKMt.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/super-grouping.cjs +22 -0
- package/dist/super-grouping.cjs.map +1 -0
- package/dist/super-grouping.js +22 -0
- package/dist/super-grouping.js.map +1 -0
- package/dist/threads/ThreadList.d.ts +6 -1
- package/dist/threads/mint-thread-id.d.ts +8 -0
- package/dist/threads/statewire-thread-list.d.ts +26 -9
- package/dist/threads/thread-id-context.d.ts +9 -0
- package/dist/threads/use-statewire-conversation-history.d.ts +2 -0
- package/dist/threads/useAthenaThreadManager.d.ts +24 -12
- package/dist/tool-fallback-DkQ3DLkn.js +4281 -0
- package/dist/tool-fallback-DkQ3DLkn.js.map +1 -0
- package/dist/tool-fallback-kfhpJQZa.cjs +4297 -0
- package/dist/tool-fallback-kfhpJQZa.cjs.map +1 -0
- package/dist/tools/index.d.ts +14 -0
- package/dist/tools/misc-tool-uis.d.ts +2 -0
- package/dist/tools/primitives.d.ts +41 -0
- package/dist/tools/tool-fallback.d.ts +78 -6
- package/dist/tools/tool-icons.d.ts +10 -0
- package/dist/tools/tool-uis.d.ts +1 -23
- package/dist/tools.cjs +41 -0
- package/dist/tools.cjs.map +1 -0
- package/dist/tools.js +41 -0
- package/dist/tools.js.map +1 -0
- package/dist/trash-2-B5OaNAL7.cjs +5096 -0
- package/dist/trash-2-B5OaNAL7.cjs.map +1 -0
- package/dist/trash-2-CCwSURL-.js +5081 -0
- package/dist/trash-2-CCwSURL-.js.map +1 -0
- package/dist/{use-rest-conversation-history-BdnG8jEP.cjs → use-rest-conversation-history-Cm8qMRxp.cjs} +985 -5405
- package/dist/use-rest-conversation-history-Cm8qMRxp.cjs.map +1 -0
- package/dist/{use-rest-conversation-history-DpEswBqQ.js → use-rest-conversation-history-veDZS-oL.js} +1035 -5455
- package/dist/use-rest-conversation-history-veDZS-oL.js.map +1 -0
- package/dist/wrench-BEf72cyP.cjs +417 -0
- package/dist/wrench-BEf72cyP.cjs.map +1 -0
- package/dist/wrench-CbrOlVYm.js +418 -0
- package/dist/wrench-CbrOlVYm.js.map +1 -0
- package/dist/x-Dfd2NzK0.cjs +42 -0
- package/dist/x-Dfd2NzK0.cjs.map +1 -0
- package/dist/x-_DntAa_a.js +43 -0
- package/dist/x-_DntAa_a.js.map +1 -0
- package/package.json +29 -11
- package/dist/chat/super-grouping/tool-status-labels.d.ts +0 -1
- package/dist/runtime/converter.d.ts +0 -5
- package/dist/runtime/external-message-converter.d.ts +0 -21
- package/dist/runtime/schemas.d.ts +0 -24
- package/dist/runtime/transport.d.ts +0 -39
- package/dist/runtime/useAthenaRuntime.d.ts +0 -47
- package/dist/threads/adapter.d.ts +0 -42
- package/dist/threads/useActiveThreadStateHydration.d.ts +0 -12
- package/dist/threads/useThreadTitlePolling.d.ts +0 -14
- package/dist/use-rest-conversation-history-BdnG8jEP.cjs.map +0 -1
- package/dist/use-rest-conversation-history-DpEswBqQ.js.map +0 -1
|
@@ -5,8 +5,6 @@ export interface AthenaEnvironmentUrls {
|
|
|
5
5
|
appUrl: string;
|
|
6
6
|
}
|
|
7
7
|
export declare const DEFAULT_ATHENA_ENVIRONMENT: AthenaEnvironment;
|
|
8
|
-
export declare const DEFAULT_API_URL: string;
|
|
9
|
-
export declare const DEFAULT_BACKEND_URL: string;
|
|
10
8
|
export declare const DEFAULT_APP_URL: string;
|
|
11
9
|
/** Production statewire sync endpoint — the same host the mobile app and
|
|
12
10
|
* Chrome extension ship as their production statewire base. Exported as a
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { CaptureResult, PostHog, Properties } from 'posthog-js';
|
|
2
2
|
import type { CaptureOptions } from 'posthog-js';
|
|
3
3
|
import { PosthogCaptureGate } from './capture-gate';
|
|
4
|
+
type PosthogCaptureExceptionFn = (error: unknown, additionalProperties?: Properties) => CaptureResult | undefined;
|
|
4
5
|
export type PosthogCaptureClient = Pick<PostHog, 'capture'> & {
|
|
5
|
-
captureException?:
|
|
6
|
+
captureException?: PosthogCaptureExceptionFn;
|
|
6
7
|
};
|
|
7
8
|
export declare function getPosthogCaptureGate(): PosthogCaptureGate;
|
|
8
9
|
export declare function resetPosthogCaptureGateForTests(): void;
|
|
9
10
|
export declare function wrapPosthogClient<TClient extends PosthogCaptureClient>(client: TClient): TClient;
|
|
10
11
|
export declare function capturePosthogEvent(client: PosthogCaptureClient | null | undefined, event: string, properties?: Properties, options?: CaptureOptions): void;
|
|
11
12
|
export declare function capturePosthogException(client: PosthogCaptureClient | null | undefined, error: Error, properties?: Properties, options?: CaptureOptions): void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
3
|
+
const React = require("react");
|
|
4
|
+
require("./trash-2-B5OaNAL7.cjs");
|
|
5
|
+
require("@assistant-ui/tap");
|
|
6
|
+
require("statewire");
|
|
7
|
+
const toolFallback = require("./tool-fallback-kfhpJQZa.cjs");
|
|
8
|
+
require("@assistant-ui/react-statewire");
|
|
9
|
+
require("@assistant-ui/store");
|
|
10
|
+
require("@assistant-ui/core");
|
|
11
|
+
const wrench = require("./wrench-BEf72cyP.cjs");
|
|
12
|
+
const InstallPackageToolUIImpl = (props) => {
|
|
13
|
+
const { toolName, args, result, status } = props;
|
|
14
|
+
if (toolFallback.classifyToolResult({ status, result }).state === "rejected") {
|
|
15
|
+
return /* @__PURE__ */ jsxRuntime.jsx(toolFallback.ToolFallback, { ...props, icon: wrench.Package });
|
|
16
|
+
}
|
|
17
|
+
const typedArgs = args ?? {};
|
|
18
|
+
const packageName = toolFallback.describePackage(typedArgs);
|
|
19
|
+
const isRunning = (status == null ? void 0 : status.type) === "running";
|
|
20
|
+
const isFailed = (status == null ? void 0 : status.type) === "incomplete" || (status == null ? void 0 : status.type) === "complete" && !toolFallback.isToolResultSuccess(result);
|
|
21
|
+
const data = toolFallback.normalizeResult(result);
|
|
22
|
+
const detail = typeof result === "string" ? result : data ? JSON.stringify(data, null, 2) : null;
|
|
23
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
+
toolFallback.ToolCard,
|
|
25
|
+
{
|
|
26
|
+
icon: wrench.Package,
|
|
27
|
+
status: isFailed && (status == null ? void 0 : status.type) === "complete" ? "incomplete" : (status == null ? void 0 : status.type) ?? "complete",
|
|
28
|
+
title: isRunning ? "Installing package..." : isFailed ? "Couldn't install package" : "Installed package",
|
|
29
|
+
subtitle: packageName,
|
|
30
|
+
toolName,
|
|
31
|
+
error: (status == null ? void 0 : status.type) === "incomplete" ? String(status.error ?? "") || void 0 : void 0,
|
|
32
|
+
args: typedArgs,
|
|
33
|
+
result,
|
|
34
|
+
children: !isRunning && detail ? /* @__PURE__ */ jsxRuntime.jsx(toolFallback.ExpandableSection, { label: "Show output", children: /* @__PURE__ */ jsxRuntime.jsx("pre", { className: "max-h-64 overflow-auto whitespace-pre-wrap break-all text-[11px] leading-snug text-muted-foreground", children: detail }) }) : null
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
const InstallPackageToolUI = React.memo(
|
|
39
|
+
InstallPackageToolUIImpl
|
|
40
|
+
);
|
|
41
|
+
InstallPackageToolUI.displayName = "InstallPackageToolUI";
|
|
42
|
+
exports.InstallPackageToolUI = InstallPackageToolUI;
|
|
43
|
+
//# sourceMappingURL=misc-tool-uis-B2e0Okkn.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"misc-tool-uis-B2e0Okkn.cjs","sources":["../src/tools/misc-tool-uis.tsx"],"sourcesContent":["/**\n * Small dedicated cards for tools whose generic fallback rendering read\n * poorly: currently the pip installer (Olympus registers it; the SDK's own\n * registry includes it).\n */\nimport { PackageIcon } from \"lucide-react\";\nimport { memo } from \"react\";\nimport type { ToolCallMessagePartComponent } from \"@assistant-ui/react\";\nimport {\n classifyToolResult,\n describePackage,\n isToolResultSuccess,\n} from \"@athenaintel/agent-runtime\";\nimport { ExpandableSection, normalizeResult, ToolCard } from \"./primitives\";\nimport { ToolFallback } from \"./tool-fallback\";\n\nconst InstallPackageToolUIImpl: ToolCallMessagePartComponent = (props) => {\n const { toolName, args, result, status } = props;\n // An install the user refused at the approval gate is neither installed\n // nor failed: the generic card owns the rejected treatment.\n if (classifyToolResult({ status, result }).state === \"rejected\") {\n return <ToolFallback {...props} icon={PackageIcon} />;\n }\n const typedArgs = (args ?? {}) as Record<string, unknown>;\n const packageName = describePackage(typedArgs);\n const isRunning = status?.type === \"running\";\n const isFailed =\n status?.type === \"incomplete\" || (status?.type === \"complete\" && !isToolResultSuccess(result));\n const data = normalizeResult(result);\n const detail =\n typeof result === \"string\" ? result : data ? JSON.stringify(data, null, 2) : null;\n\n return (\n <ToolCard\n icon={PackageIcon}\n status={isFailed && status?.type === \"complete\" ? \"incomplete\" : (status?.type ?? \"complete\")}\n title={\n isRunning\n ? \"Installing package...\"\n : isFailed\n ? \"Couldn't install package\"\n : \"Installed package\"\n }\n subtitle={packageName}\n toolName={toolName}\n error={status?.type === \"incomplete\" ? String(status.error ?? \"\") || undefined : undefined}\n args={typedArgs}\n result={result}\n >\n {!isRunning && detail ? (\n <ExpandableSection label=\"Show output\">\n <pre className=\"max-h-64 overflow-auto whitespace-pre-wrap break-all text-[11px] leading-snug text-muted-foreground\">\n {detail}\n </pre>\n </ExpandableSection>\n ) : null}\n </ToolCard>\n );\n};\n\nexport const InstallPackageToolUI = memo(\n InstallPackageToolUIImpl,\n) as unknown as ToolCallMessagePartComponent;\nInstallPackageToolUI.displayName = \"InstallPackageToolUI\";\n"],"names":["classifyToolResult","jsx","ToolFallback","PackageIcon","describePackage","isToolResultSuccess","normalizeResult","ToolCard","ExpandableSection","memo"],"mappings":";;;;;;;;;;;AAgBA,MAAM,2BAAyD,CAAC,UAAU;AACxE,QAAM,EAAE,UAAU,MAAM,QAAQ,WAAW;AAG3C,MAAIA,aAAAA,mBAAmB,EAAE,QAAQ,QAAQ,EAAE,UAAU,YAAY;AAC/D,WAAOC,2BAAAA,IAACC,aAAAA,cAAA,EAAc,GAAG,OAAO,MAAMC,OAAAA,SAAa;AAAA,EACrD;AACA,QAAM,YAAa,QAAQ,CAAA;AAC3B,QAAM,cAAcC,aAAAA,gBAAgB,SAAS;AAC7C,QAAM,aAAY,iCAAQ,UAAS;AACnC,QAAM,YACJ,iCAAQ,UAAS,iBAAiB,iCAAQ,UAAS,cAAc,CAACC,aAAAA,oBAAoB,MAAM;AAC9F,QAAM,OAAOC,aAAAA,gBAAgB,MAAM;AACnC,QAAM,SACJ,OAAO,WAAW,WAAW,SAAS,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI;AAE/E,SACEL,2BAAAA;AAAAA,IAACM,aAAAA;AAAAA,IAAA;AAAA,MACC,MAAMJ,OAAAA;AAAAA,MACN,QAAQ,aAAY,iCAAQ,UAAS,aAAa,gBAAgB,iCAAQ,SAAQ;AAAA,MAClF,OACE,YACI,0BACA,WACE,6BACA;AAAA,MAER,UAAU;AAAA,MACV;AAAA,MACA,QAAO,iCAAQ,UAAS,eAAe,OAAO,OAAO,SAAS,EAAE,KAAK,SAAY;AAAA,MACjF,MAAM;AAAA,MACN;AAAA,MAEC,UAAA,CAAC,aAAa,SACbF,2BAAAA,IAACO,gCAAA,EAAkB,OAAM,eACvB,UAAAP,2BAAAA,IAAC,OAAA,EAAI,WAAU,uGACZ,UAAA,OAAA,CACH,GACF,IACE;AAAA,IAAA;AAAA,EAAA;AAGV;AAEO,MAAM,uBAAuBQ,MAAAA;AAAAA,EAClC;AACF;AACA,qBAAqB,cAAc;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import "./trash-2-CCwSURL-.js";
|
|
4
|
+
import "@assistant-ui/tap";
|
|
5
|
+
import "statewire";
|
|
6
|
+
import { k as classifyToolResult, c as ToolFallback, y as describePackage, p as isToolResultSuccess, q as normalizeResult, b as ToolCard, E as ExpandableSection } from "./tool-fallback-DkQ3DLkn.js";
|
|
7
|
+
import "@assistant-ui/react-statewire";
|
|
8
|
+
import "@assistant-ui/store";
|
|
9
|
+
import "@assistant-ui/core";
|
|
10
|
+
import { P as Package } from "./wrench-CbrOlVYm.js";
|
|
11
|
+
const InstallPackageToolUIImpl = (props) => {
|
|
12
|
+
const { toolName, args, result, status } = props;
|
|
13
|
+
if (classifyToolResult({ status, result }).state === "rejected") {
|
|
14
|
+
return /* @__PURE__ */ jsx(ToolFallback, { ...props, icon: Package });
|
|
15
|
+
}
|
|
16
|
+
const typedArgs = args ?? {};
|
|
17
|
+
const packageName = describePackage(typedArgs);
|
|
18
|
+
const isRunning = (status == null ? void 0 : status.type) === "running";
|
|
19
|
+
const isFailed = (status == null ? void 0 : status.type) === "incomplete" || (status == null ? void 0 : status.type) === "complete" && !isToolResultSuccess(result);
|
|
20
|
+
const data = normalizeResult(result);
|
|
21
|
+
const detail = typeof result === "string" ? result : data ? JSON.stringify(data, null, 2) : null;
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
ToolCard,
|
|
24
|
+
{
|
|
25
|
+
icon: Package,
|
|
26
|
+
status: isFailed && (status == null ? void 0 : status.type) === "complete" ? "incomplete" : (status == null ? void 0 : status.type) ?? "complete",
|
|
27
|
+
title: isRunning ? "Installing package..." : isFailed ? "Couldn't install package" : "Installed package",
|
|
28
|
+
subtitle: packageName,
|
|
29
|
+
toolName,
|
|
30
|
+
error: (status == null ? void 0 : status.type) === "incomplete" ? String(status.error ?? "") || void 0 : void 0,
|
|
31
|
+
args: typedArgs,
|
|
32
|
+
result,
|
|
33
|
+
children: !isRunning && detail ? /* @__PURE__ */ jsx(ExpandableSection, { label: "Show output", children: /* @__PURE__ */ jsx("pre", { className: "max-h-64 overflow-auto whitespace-pre-wrap break-all text-[11px] leading-snug text-muted-foreground", children: detail }) }) : null
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
const InstallPackageToolUI = memo(
|
|
38
|
+
InstallPackageToolUIImpl
|
|
39
|
+
);
|
|
40
|
+
InstallPackageToolUI.displayName = "InstallPackageToolUI";
|
|
41
|
+
export {
|
|
42
|
+
InstallPackageToolUI as I
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=misc-tool-uis-gAiQw0Yl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"misc-tool-uis-gAiQw0Yl.js","sources":["../src/tools/misc-tool-uis.tsx"],"sourcesContent":["/**\n * Small dedicated cards for tools whose generic fallback rendering read\n * poorly: currently the pip installer (Olympus registers it; the SDK's own\n * registry includes it).\n */\nimport { PackageIcon } from \"lucide-react\";\nimport { memo } from \"react\";\nimport type { ToolCallMessagePartComponent } from \"@assistant-ui/react\";\nimport {\n classifyToolResult,\n describePackage,\n isToolResultSuccess,\n} from \"@athenaintel/agent-runtime\";\nimport { ExpandableSection, normalizeResult, ToolCard } from \"./primitives\";\nimport { ToolFallback } from \"./tool-fallback\";\n\nconst InstallPackageToolUIImpl: ToolCallMessagePartComponent = (props) => {\n const { toolName, args, result, status } = props;\n // An install the user refused at the approval gate is neither installed\n // nor failed: the generic card owns the rejected treatment.\n if (classifyToolResult({ status, result }).state === \"rejected\") {\n return <ToolFallback {...props} icon={PackageIcon} />;\n }\n const typedArgs = (args ?? {}) as Record<string, unknown>;\n const packageName = describePackage(typedArgs);\n const isRunning = status?.type === \"running\";\n const isFailed =\n status?.type === \"incomplete\" || (status?.type === \"complete\" && !isToolResultSuccess(result));\n const data = normalizeResult(result);\n const detail =\n typeof result === \"string\" ? result : data ? JSON.stringify(data, null, 2) : null;\n\n return (\n <ToolCard\n icon={PackageIcon}\n status={isFailed && status?.type === \"complete\" ? \"incomplete\" : (status?.type ?? \"complete\")}\n title={\n isRunning\n ? \"Installing package...\"\n : isFailed\n ? \"Couldn't install package\"\n : \"Installed package\"\n }\n subtitle={packageName}\n toolName={toolName}\n error={status?.type === \"incomplete\" ? String(status.error ?? \"\") || undefined : undefined}\n args={typedArgs}\n result={result}\n >\n {!isRunning && detail ? (\n <ExpandableSection label=\"Show output\">\n <pre className=\"max-h-64 overflow-auto whitespace-pre-wrap break-all text-[11px] leading-snug text-muted-foreground\">\n {detail}\n </pre>\n </ExpandableSection>\n ) : null}\n </ToolCard>\n );\n};\n\nexport const InstallPackageToolUI = memo(\n InstallPackageToolUIImpl,\n) as unknown as ToolCallMessagePartComponent;\nInstallPackageToolUI.displayName = \"InstallPackageToolUI\";\n"],"names":["PackageIcon"],"mappings":";;;;;;;;;;AAgBA,MAAM,2BAAyD,CAAC,UAAU;AACxE,QAAM,EAAE,UAAU,MAAM,QAAQ,WAAW;AAG3C,MAAI,mBAAmB,EAAE,QAAQ,QAAQ,EAAE,UAAU,YAAY;AAC/D,WAAO,oBAAC,cAAA,EAAc,GAAG,OAAO,MAAMA,SAAa;AAAA,EACrD;AACA,QAAM,YAAa,QAAQ,CAAA;AAC3B,QAAM,cAAc,gBAAgB,SAAS;AAC7C,QAAM,aAAY,iCAAQ,UAAS;AACnC,QAAM,YACJ,iCAAQ,UAAS,iBAAiB,iCAAQ,UAAS,cAAc,CAAC,oBAAoB,MAAM;AAC9F,QAAM,OAAO,gBAAgB,MAAM;AACnC,QAAM,SACJ,OAAO,WAAW,WAAW,SAAS,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC,IAAI;AAE/E,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAMA;AAAAA,MACN,QAAQ,aAAY,iCAAQ,UAAS,aAAa,gBAAgB,iCAAQ,SAAQ;AAAA,MAClF,OACE,YACI,0BACA,WACE,6BACA;AAAA,MAER,UAAU;AAAA,MACV;AAAA,MACA,QAAO,iCAAQ,UAAS,eAAe,OAAO,OAAO,SAAS,EAAE,KAAK,SAAY;AAAA,MACjF,MAAM;AAAA,MACN;AAAA,MAEC,UAAA,CAAC,aAAa,SACb,oBAAC,mBAAA,EAAkB,OAAM,eACvB,UAAA,oBAAC,OAAA,EAAI,WAAU,uGACZ,UAAA,OAAA,CACH,GACF,IACE;AAAA,IAAA;AAAA,EAAA;AAGV;AAEO,MAAM,uBAAuB;AAAA,EAClC;AACF;AACA,qBAAqB,cAAc;"}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import type { AthenaTransport } from '../runtime/transport';
|
|
2
1
|
import type { AthenaProviderConfig } from './config';
|
|
3
2
|
import type { AthenaCitationLinkOptions, AthenaLinkClickOptions } from './citation-links';
|
|
4
3
|
export interface AthenaConfig extends Pick<AthenaProviderConfig, 'apiKey' | 'token'> {
|
|
5
4
|
backendUrl: string;
|
|
6
5
|
appUrl: string;
|
|
7
6
|
enabledToolkits: string[];
|
|
8
|
-
/** Effective chat transport — the lane the provider actually mounted (the
|
|
9
|
-
* SDK defaults to 'statewire'; see `DEFAULT_ATHENA_TRANSPORT`). Optional
|
|
10
|
-
* only so hand-built `AthenaConfig` literals keep compiling; capability
|
|
11
|
-
* gates treat an absent value as the conservative legacy lane (e.g.
|
|
12
|
-
* `allowsMidRunSend(undefined)` is false). */
|
|
13
|
-
transport?: AthenaTransport;
|
|
14
7
|
linkClicks?: AthenaLinkClickOptions;
|
|
15
8
|
citationLinks?: AthenaCitationLinkOptions;
|
|
16
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { Toolkit } from '@assistant-ui/react';
|
|
3
3
|
import { type AthenaEnvironment } from '../lib/athena-urls';
|
|
4
|
+
import type { AthenaStatewireTokenGetter } from '../runtime/statewire-auth-headers';
|
|
4
5
|
import { type AthenaDiagnosticEvent, type AthenaDiagnosticLevel, type AthenaDiagnosticsConfig } from '../diagnostics/athena-diagnostics';
|
|
5
6
|
import type { AthenaSdkError } from '../diagnostics/errors';
|
|
6
|
-
import { type AthenaTransport } from '../runtime/transport';
|
|
7
7
|
import type { AthenaProviderConfig } from './config';
|
|
8
8
|
import type { AthenaCitationLinkOptions, AthenaLinkClickOptions } from './citation-links';
|
|
9
9
|
import { type AthenaTheme } from '../theme';
|
|
@@ -17,35 +17,39 @@ export interface AthenaProviderProps {
|
|
|
17
17
|
/** @deprecated Prefer `config.token`. PropelAuth token. If provided, takes priority over apiKey. If omitted, the SDK
|
|
18
18
|
* will automatically listen for a token from the parent window via PostMessage. */
|
|
19
19
|
token?: string | null;
|
|
20
|
-
/**
|
|
20
|
+
/** Run the thread AS a published collab agent. The only accepted shape is
|
|
21
|
+
* `collab_agent:<asset_id>`: the thread then uses that agent's prompt,
|
|
22
|
+
* tools, and model default, and the caller must have view access to the
|
|
23
|
+
* agent asset. Omit it (or pass a blank string) to run the Athena deep agent.
|
|
21
24
|
*
|
|
22
|
-
* -
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* thread then runs AS that published collab agent (its prompt, tools, and
|
|
26
|
-
* model default), and the caller must have view access to the agent
|
|
27
|
-
* asset. Any other value is ignored with a `sdk.config.warning`
|
|
28
|
-
* diagnostic, because the statewire host always runs the Athena deep
|
|
29
|
-
* agent. */
|
|
25
|
+
* Any other non-blank value throws at render — the statewire host cannot
|
|
26
|
+
* honour named agents, and a selector that is silently dropped would let a
|
|
27
|
+
* misconfigured deployment answer as the wrong agent. */
|
|
30
28
|
agent?: string;
|
|
31
29
|
/** Collab-agent channel id — a built-in channel (`email`, `sms`, …) or a
|
|
32
30
|
* user-defined custom channel id from the agent's Channels tab. Selects
|
|
33
31
|
* that channel's configuration overrides and stamps the session's origin.
|
|
34
|
-
* Only meaningful with a `collab_agent:<asset_id>` `agent
|
|
35
|
-
*
|
|
36
|
-
*
|
|
32
|
+
* Only meaningful together with a `collab_agent:<asset_id>` `agent`; sent
|
|
33
|
+
* as `collab_channel_id`. An unknown or disabled channel rejects the run
|
|
34
|
+
* with a structured, teaching error. */
|
|
37
35
|
channel?: string;
|
|
38
|
-
/** LLM model identifier. Defaults to
|
|
36
|
+
/** LLM model identifier. Defaults to the deep-agent default model
|
|
37
|
+
* (`DEFAULT_STATEWIRE_MODEL`) — or, when a collab agent is selected, to
|
|
38
|
+
* the model its author configured. */
|
|
39
39
|
model?: string;
|
|
40
40
|
/** Backend toolkit IDs to enable (e.g. 'document_toolkit', 'web_search_browse_toolkit'). */
|
|
41
41
|
tools?: string[];
|
|
42
42
|
/** Frontend tools that execute in the browser. The agent can invoke these.
|
|
43
43
|
* Merged on top of the SDK's default auto-open tools; entries here take
|
|
44
|
-
* precedence over defaults with the same name.
|
|
44
|
+
* precedence over defaults with the same name. Tools with a local
|
|
45
|
+
* `execute` are declared to the backend as `client_tools` and run through
|
|
46
|
+
* the statewire client-tool bridge. */
|
|
45
47
|
frontendTools?: Toolkit;
|
|
46
48
|
/** Disable the SDK's default auto-open behavior for created/touched assets. */
|
|
47
49
|
disableAutoOpen?: boolean;
|
|
48
|
-
/** @deprecated Prefer `config.apiUrl`. URL
|
|
50
|
+
/** @deprecated Prefer `config.apiUrl`. URL on the Iris host fronting the
|
|
51
|
+
* deployment; its origin derives the statewire sync mount when
|
|
52
|
+
* `statewireSyncUrl` is not set. */
|
|
49
53
|
apiUrl?: string;
|
|
50
54
|
/** @deprecated Prefer `config.backendUrl`. URL for the Athena backend API. */
|
|
51
55
|
backendUrl?: string;
|
|
@@ -53,29 +57,17 @@ export interface AthenaProviderProps {
|
|
|
53
57
|
appUrl?: string;
|
|
54
58
|
/** @deprecated Prefer `config.environment`. Athena environment preset used when URLs are not explicitly provided. */
|
|
55
59
|
environment?: AthenaEnvironment;
|
|
56
|
-
/** Chat transport mode. Defaults to 'statewire' (the deep-agent statewire
|
|
57
|
-
* sync host, `…/v2/threads`): the thread is hosted server-side and
|
|
58
|
-
* replicated live, so history, reconnect, and run scheduling come from the
|
|
59
|
-
* server snapshot. Works with and without `enableThreadList`.
|
|
60
|
-
*
|
|
61
|
-
* Pass 'legacy' to opt a deployment back onto the legacy Iris `/api/chat`
|
|
62
|
-
* assistant-transport stream. Threads are transport-scoped: conversations
|
|
63
|
-
* created on one transport are read-only from the other.
|
|
64
|
-
*
|
|
65
|
-
* On statewire the `agent` prop only accepts `collab_agent:<asset_id>`
|
|
66
|
-
* refs (the host always runs the Athena deep agent), and `model` defaults
|
|
67
|
-
* to the deep-agent default model. */
|
|
68
|
-
transport?: AthenaTransport;
|
|
69
60
|
/** Resolve the latest auth token immediately before a request (for
|
|
70
61
|
* expiring clients). Takes priority over `token` when it resolves.
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
* Prefer `config.getToken` (see its `force` contract for refused
|
|
63
|
+
* credentials). */
|
|
64
|
+
getToken?: AthenaStatewireTokenGetter;
|
|
65
|
+
/** Additional fields merged into runConfig.custom. Prefer
|
|
66
|
+
* `config.extraRunConfig`. */
|
|
75
67
|
extraRunConfig?: Record<string, unknown>;
|
|
76
68
|
/** Statewire sync base URL override (the `…/v2/threads` mount). Defaults to
|
|
77
|
-
* the
|
|
78
|
-
*
|
|
69
|
+
* the mount a Marathon host mints, then the effective `apiUrl` host +
|
|
70
|
+
* `/v2/threads`. Prefer `config.statewireSyncUrl`. */
|
|
79
71
|
statewireSyncUrl?: string;
|
|
80
72
|
/** Asset IDs to include in the workbench. */
|
|
81
73
|
workbench?: string[];
|
|
@@ -83,22 +75,6 @@ export interface AthenaProviderProps {
|
|
|
83
75
|
knowledgeBase?: string[];
|
|
84
76
|
/** System prompt override. */
|
|
85
77
|
systemPrompt?: string;
|
|
86
|
-
/** Custom tool configurations (e.g. MCP servers).
|
|
87
|
-
* Legacy transport only: passed through as `custom_tool_configs` in
|
|
88
|
-
* runConfig.custom. The deep-agent statewire lane never sends it — that
|
|
89
|
-
* runtime has no `custom_tool_configs` reader (MCP configuration is the
|
|
90
|
-
* parsed `mcp_server_configs` key).
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* <AthenaProvider customToolConfigs={{
|
|
94
|
-
* mcp: {
|
|
95
|
-
* "my-server": {
|
|
96
|
-
* config: { transport: "streamable_http", url: "https://..." },
|
|
97
|
-
* }
|
|
98
|
-
* }
|
|
99
|
-
* }}>
|
|
100
|
-
*/
|
|
101
|
-
customToolConfigs?: Record<string, unknown>;
|
|
102
78
|
/** Client app identifier for session filtering.
|
|
103
79
|
* Sessions created with this ID can be filtered in the thread list.
|
|
104
80
|
* E.g. "olympus", "athena-app", or a computer asset ID like "asset_<uuid>". */
|
|
@@ -147,4 +123,4 @@ export interface AthenaProviderProps {
|
|
|
147
123
|
* error handling, so integrations never fail silently. */
|
|
148
124
|
onError?: (error: AthenaSdkError, event: AthenaDiagnosticEvent) => void;
|
|
149
125
|
}
|
|
150
|
-
export declare function AthenaProvider({ children, config, apiKey, token: tokenProp, agent, channel, model, tools, frontendTools, disableAutoOpen, apiUrl, backendUrl, appUrl, environment,
|
|
126
|
+
export declare function AthenaProvider({ children, config, apiKey, token: tokenProp, agent, channel, model, tools, frontendTools, disableAutoOpen, apiUrl, backendUrl, appUrl, environment, statewireSyncUrl, getToken, extraRunConfig, workbench, knowledgeBase, systemPrompt, appId, threadId: threadIdProp, enableThreadList, theme, linkClicks, citationLinks, posthog: posthogProp, debug, onDiagnostic, onError, }: AthenaProviderProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,29 +1,33 @@
|
|
|
1
1
|
import type { AthenaEnvironment } from '../lib/athena-urls';
|
|
2
|
-
import type {
|
|
2
|
+
import type { AthenaStatewireTokenGetter } from '../runtime/statewire-auth-headers';
|
|
3
3
|
import type { PostHogConfig } from './PostHogProvider';
|
|
4
4
|
export interface AthenaProviderConfig {
|
|
5
5
|
/** Resolve the latest auth token immediately before a request (for expiring
|
|
6
|
-
* clients).
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*
|
|
6
|
+
* clients). Takes priority over `token` when it resolves.
|
|
7
|
+
*
|
|
8
|
+
* Called with `{ force: true }` right after the statewire host refused the
|
|
9
|
+
* previous credential (the transport's `staleAuth` signal): a getter that
|
|
10
|
+
* caches must then mint a fresh token instead of returning the refused one.
|
|
11
|
+
* Otherwise it is called with `{ force: false }` and may serve a cached
|
|
12
|
+
* token. A getter that ignores the argument keeps working. */
|
|
13
|
+
getToken?: AthenaStatewireTokenGetter;
|
|
14
|
+
/** Additional fields merged into runConfig.custom. */
|
|
10
15
|
extraRunConfig?: Record<string, unknown>;
|
|
11
16
|
/** API key for standalone authentication when no token is provided. */
|
|
12
17
|
apiKey?: string;
|
|
13
18
|
/** PropelAuth token. Takes priority over apiKey when provided. */
|
|
14
19
|
token?: string | null;
|
|
15
|
-
/** URL
|
|
20
|
+
/** URL on the Iris host that fronts the deployment (historically the
|
|
21
|
+
* `…/api/chat` endpoint). Its origin derives the statewire sync mount when
|
|
22
|
+
* `statewireSyncUrl` is not set, and known Athena hosts map to the matching
|
|
23
|
+
* app origin. Defaults to the matching Athena environment. */
|
|
16
24
|
apiUrl?: string;
|
|
17
|
-
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
|
|
21
|
-
/** Statewire sync base URL override (the `…/v2/threads` mount). Only used
|
|
22
|
-
* when transport is 'statewire'. Resolution order: this value, then the
|
|
23
|
-
* `statewireSyncUrl` a Marathon host mints via `/_athena/auth` (or a
|
|
24
|
-
* trusted parent posts), then the effective `apiUrl` host + `/v2/threads`. */
|
|
25
|
+
/** Statewire sync base URL override (the `…/v2/threads` mount). Resolution
|
|
26
|
+
* order: this value, then the `statewireSyncUrl` a Marathon host mints via
|
|
27
|
+
* `/_athena/auth` (or a trusted parent posts), then the effective `apiUrl`
|
|
28
|
+
* host + `/v2/threads`. */
|
|
25
29
|
statewireSyncUrl?: string;
|
|
26
|
-
/** URL for the Athena backend API — the bare Agora base or the
|
|
30
|
+
/** URL for the Athena backend API — the bare Agora base or the historical
|
|
27
31
|
* `…/api/assistant-ui` endpoint (REST helpers accept both). Defaults to
|
|
28
32
|
* the host-provided value, then the matching Athena environment. */
|
|
29
33
|
backendUrl?: string;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { AthenaStatewireLifecycleState } from '../runtime/statewire-lifecycle';
|
|
2
2
|
/**
|
|
3
3
|
* Statewire transport lifecycle (connection status, transport errors,
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* renders nothing there.
|
|
4
|
+
* reconnect handle). Provided by `AthenaProvider`; `null` outside the
|
|
5
|
+
* provider, so lifecycle-driven UI renders nothing there.
|
|
7
6
|
*/
|
|
8
7
|
export declare const AthenaStatewireLifecycleContext: import("react").Context<AthenaStatewireLifecycleState | null>;
|
|
9
|
-
/** Read the statewire lifecycle, or null outside
|
|
8
|
+
/** Read the statewire lifecycle, or null outside `AthenaProvider`. */
|
|
10
9
|
export declare function useAthenaStatewireLifecycle(): AthenaStatewireLifecycleState | null;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DeepAgentToolOutputStore } from '@athenaintel/agent-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* The store of full tool outputs fetched back for a windowed wire's cut tool
|
|
4
|
+
* messages — the SAME instance the thread converts with
|
|
5
|
+
* (`useAthenaStatewireRuntime({ toolOutputs })`), so the edge row's lazy
|
|
6
|
+
* fetch and the converter's substitution meet. Provided by `AthenaProvider`
|
|
7
|
+
* (one per provider, cleared with the acting identity); hosts that mount the
|
|
8
|
+
* runtime themselves pass the store to `StatewireHistoryEdge` directly.
|
|
9
|
+
*/
|
|
10
|
+
export declare const StatewireToolOutputsContext: import("react").Context<DeepAgentToolOutputStore | null>;
|
|
11
|
+
/** The provider's tool-output store, or `null` outside `AthenaProvider`. */
|
|
12
|
+
export declare function useStatewireToolOutputs(): DeepAgentToolOutputStore | null;
|
package/dist/provider/types.d.ts
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the caller's current auth token immediately before a statewire
|
|
3
|
+
* attach or request. `force` is true right after the statewire host refused
|
|
4
|
+
* the previous credential (the transport's `staleAuth` signal): a getter that
|
|
5
|
+
* caches must then mint a fresh token instead of returning the one that was
|
|
6
|
+
* just refused. `force: false` (or no argument) may serve a cached token.
|
|
7
|
+
*/
|
|
8
|
+
export type AthenaStatewireTokenGetter = (options?: {
|
|
9
|
+
force?: boolean;
|
|
10
|
+
}) => string | null | Promise<string | null>;
|
|
11
|
+
export interface StatewireAuthSource {
|
|
12
|
+
/** API key for standalone authentication; used when no token resolves. */
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
/** A token the host already holds; `getToken` takes priority when it resolves one. */
|
|
15
|
+
token?: string | null;
|
|
16
|
+
/** Live token resolver for expiring credentials. */
|
|
17
|
+
getToken?: AthenaStatewireTokenGetter;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The token a statewire attach or REST request presents: `getToken` (with the
|
|
21
|
+
* transport's `staleAuth` as `force`) when provided, falling back to the
|
|
22
|
+
* host-held `token` when the getter resolves nothing. A getter failure
|
|
23
|
+
* propagates — a request must fail rather than silently go anonymous.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveStatewireAuthToken(source: StatewireAuthSource, { staleAuth }: {
|
|
26
|
+
staleAuth: boolean;
|
|
27
|
+
}): Promise<string | null | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* The auth headers a statewire attach or request carries — the same credential
|
|
30
|
+
* plumbing the legacy transport used: a token (resolved live through
|
|
31
|
+
* `getToken` when provided, with the transport's `staleAuth` passed as `force`)
|
|
32
|
+
* rides `Authorization: Bearer`, and an API key falls back to `X-API-KEY`. Both
|
|
33
|
+
* are accepted by the statewire host. Credential rotation reaches the next
|
|
34
|
+
* request because callers read `source` fresh per resolve.
|
|
35
|
+
*/
|
|
36
|
+
export declare function resolveStatewireAuthHeaders(source: StatewireAuthSource, { staleAuth }: {
|
|
37
|
+
staleAuth: boolean;
|
|
38
|
+
}): Promise<Record<string, string>>;
|
|
@@ -16,7 +16,31 @@ export declare function athenaStatewireErrorNotice(error: unknown): AthenaStatew
|
|
|
16
16
|
export interface AthenaStatewireLifecycleState {
|
|
17
17
|
connection: DeepAgentConnectionState | null;
|
|
18
18
|
error: AthenaStatewireErrorNotice | null;
|
|
19
|
-
legacyReadOnly: boolean;
|
|
20
19
|
reconnect: (() => void) | null;
|
|
21
20
|
dismissError: () => void;
|
|
22
21
|
}
|
|
22
|
+
/** The provider's reducer state behind {@link AthenaStatewireLifecycleState}. */
|
|
23
|
+
export interface StatewireLifecycleReducerState {
|
|
24
|
+
connection: DeepAgentConnectionState | null;
|
|
25
|
+
error: AthenaStatewireErrorNotice | null;
|
|
26
|
+
reconnect: (() => void) | null;
|
|
27
|
+
}
|
|
28
|
+
export type StatewireLifecycleAction = {
|
|
29
|
+
type: 'connection';
|
|
30
|
+
connection: DeepAgentConnectionState | null;
|
|
31
|
+
} | {
|
|
32
|
+
type: 'error';
|
|
33
|
+
error: AthenaStatewireErrorNotice | null;
|
|
34
|
+
} | {
|
|
35
|
+
type: 'raw-connection';
|
|
36
|
+
reconnect: () => void;
|
|
37
|
+
};
|
|
38
|
+
export declare const initialStatewireLifecycle: StatewireLifecycleReducerState;
|
|
39
|
+
/**
|
|
40
|
+
* Folds the runtime's lifecycle observations into the banner state. A healthy
|
|
41
|
+
* channel — connected, or disconnected only because the instance is quiet
|
|
42
|
+
* (`idle`) or the chat has not sent yet (`deferred`) — clears a stale
|
|
43
|
+
* send/transport error: leaving it up tells the user the chat is broken after
|
|
44
|
+
* it has come back.
|
|
45
|
+
*/
|
|
46
|
+
export declare function statewireLifecycleReducer(state: StatewireLifecycleReducerState, action: StatewireLifecycleAction): StatewireLifecycleReducerState;
|
|
@@ -1,19 +1,32 @@
|
|
|
1
|
-
/** Deep-agent default model — matches the Olympus and mobile statewire hosts.
|
|
2
|
-
* The legacy transport keeps its own default model. */
|
|
1
|
+
/** Deep-agent default model — matches the Olympus and mobile statewire hosts. */
|
|
3
2
|
export declare const DEFAULT_STATEWIRE_MODEL = "claude-sonnet-5";
|
|
4
3
|
/** Agent-id namespace for collab agents (`collab_agent:<asset_id>`). */
|
|
5
4
|
export declare const COLLAB_AGENT_REF_PREFIX = "collab_agent:";
|
|
5
|
+
/** The only shape the `agent` prop accepts, for error messages and docs. */
|
|
6
|
+
export declare const COLLAB_AGENT_REF_SHAPE = "collab_agent:<asset_id>";
|
|
6
7
|
/** The asset id when `agent` is a `collab_agent:<asset_id>` ref, else null. */
|
|
7
8
|
export declare function parseCollabAgentRef(agent: string | undefined | null): string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the provider's `agent` prop to a collab-agent asset id.
|
|
11
|
+
*
|
|
12
|
+
* An omitted or blank `agent` means "no agent selected" — the thread runs the
|
|
13
|
+
* Athena deep agent — and resolves to `null`. A `collab_agent:<asset_id>` ref
|
|
14
|
+
* resolves to the asset id. Any other non-blank value throws: the statewire
|
|
15
|
+
* host cannot honour it, and a selector that is silently dropped would let a
|
|
16
|
+
* misconfigured deployment ship answers from the wrong agent.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveAgentProp({ agent }: {
|
|
19
|
+
agent: string | undefined | null;
|
|
20
|
+
}): string | null;
|
|
8
21
|
export interface StatewireRunConfigOptions {
|
|
9
22
|
/** LLM model identifier. Defaults to the deep-agent default model — unless a
|
|
10
23
|
* collab agent is selected and its author set one (the backend overlay
|
|
11
24
|
* applies the agent's model when the run sends none), in which case no
|
|
12
25
|
* model is sent so the agent's choice wins. */
|
|
13
26
|
model?: string;
|
|
14
|
-
/** Agent selector.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
27
|
+
/** Agent selector. Only the `collab_agent:<asset_id>` shape is accepted: the
|
|
28
|
+
* run executes AS that published collab agent (prompt, tools, model
|
|
29
|
+
* default). Any other non-empty value throws (see {@link resolveAgentProp}). */
|
|
17
30
|
agent?: string;
|
|
18
31
|
/** Collab-agent channel id (built-in like `email`/`sms`, or a user-defined
|
|
19
32
|
* custom channel id) selecting that channel's configuration overrides.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope of the persisted statewire command lane: the sync host, the signed-in
|
|
3
|
+
* principal, and the thread. A thread id is only meaningful against the
|
|
4
|
+
* backend that minted it, and a shared browser must never resend one user's
|
|
5
|
+
* un-settled commands under the next user's token — so the key carries WHO is
|
|
6
|
+
* signed in as well as where. The principal is a non-secret user id;
|
|
7
|
+
* API-key-only hosts (no auth provider above) share one anonymous scope.
|
|
8
|
+
*/
|
|
9
|
+
export declare function statewireSessionKey({ syncUrl, principal, threadId, }: {
|
|
10
|
+
syncUrl: string;
|
|
11
|
+
principal: string;
|
|
12
|
+
threadId: string;
|
|
13
|
+
}): string;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import type { AssistantClient, Toolkit } from '@assistant-ui/react';
|
|
2
|
-
import { type UseDeepAgentThreadOptions } from '@athenaintel/agent-runtime';
|
|
3
|
-
import { type
|
|
2
|
+
import { type DeepAgentMessageWindowDeclaration, type DeepAgentThreadSnapshotCache, type DeepAgentToolOutputStore, type RegisteredClientTool, type UseDeepAgentThreadOptions } from '@athenaintel/agent-runtime';
|
|
3
|
+
import { type AthenaStatewireTokenGetter } from './statewire-auth-headers';
|
|
4
4
|
import { DEFAULT_STATEWIRE_MODEL } from './statewire-run-config';
|
|
5
5
|
export { DEFAULT_STATEWIRE_MODEL };
|
|
6
|
+
/**
|
|
7
|
+
* The message window every SDK attach declares (`x-athena-deep-agent-window`):
|
|
8
|
+
* the hello carries the transcript's tail plus the `messagesWindow` lane
|
|
9
|
+
* instead of every message — megabytes on long threads, over the 1 MiB frame
|
|
10
|
+
* limit of stock websocket clients. Older pages load from the
|
|
11
|
+
* `StatewireHistoryEdge` row the chat UI mounts above the messages, and cut
|
|
12
|
+
* tool outputs are fetched back for the cards that show them.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ATHENA_SDK_MESSAGE_WINDOW: DeepAgentMessageWindowDeclaration;
|
|
6
15
|
export interface AthenaStatewireRuntimeConfig {
|
|
7
16
|
/** Base URL of the statewire sync host (the `…/v2/threads` mount). */
|
|
8
17
|
syncUrl: string;
|
|
@@ -15,12 +24,35 @@ export interface AthenaStatewireRuntimeConfig {
|
|
|
15
24
|
apiKey?: string;
|
|
16
25
|
/** Auth token. Takes priority over apiKey. */
|
|
17
26
|
token?: string | null;
|
|
18
|
-
/** Resolve the latest token immediately before a request (for expiring
|
|
19
|
-
|
|
27
|
+
/** Resolve the latest token immediately before a request (for expiring
|
|
28
|
+
* clients). Called with `{ force: true }` right after the host refused the
|
|
29
|
+
* previous credential (the transport's `staleAuth`), so a caching getter
|
|
30
|
+
* mints a fresh token instead of returning the refused one. */
|
|
31
|
+
getToken?: AthenaStatewireTokenGetter;
|
|
32
|
+
/**
|
|
33
|
+
* Per-provider LRU of each thread's last wire state. A switch back to a
|
|
34
|
+
* remembered thread mounts with that snapshot and projects ready on the
|
|
35
|
+
* first frame instead of a loading treatment; the attach snapshot then
|
|
36
|
+
* replaces it. Owned above the per-thread mount so it survives switches.
|
|
37
|
+
*/
|
|
38
|
+
snapshotCache?: DeepAgentThreadSnapshotCache;
|
|
39
|
+
/**
|
|
40
|
+
* The message window declared on the attach (see
|
|
41
|
+
* {@link ATHENA_SDK_MESSAGE_WINDOW}, the default). `false` keeps the full
|
|
42
|
+
* snapshot for a host that renders no history loader.
|
|
43
|
+
*/
|
|
44
|
+
messageWindow?: DeepAgentMessageWindowDeclaration | false;
|
|
45
|
+
/**
|
|
46
|
+
* Full tool outputs fetched back for a windowed wire's cut tool messages;
|
|
47
|
+
* the thread re-converts when one lands. `AthenaProvider` owns one per
|
|
48
|
+
* provider and hands the same store to `StatewireHistoryEdge`.
|
|
49
|
+
*/
|
|
50
|
+
toolOutputs?: DeepAgentToolOutputStore;
|
|
20
51
|
/** LLM model identifier. Defaults to the deep-agent default model. */
|
|
21
52
|
model?: string;
|
|
22
|
-
/** Agent selector: only `collab_agent:<asset_id>` refs are
|
|
23
|
-
*
|
|
53
|
+
/** Agent selector: only `collab_agent:<asset_id>` refs are accepted (the run
|
|
54
|
+
* executes AS that published collab agent). Any other non-empty value
|
|
55
|
+
* throws — see `resolveAgentProp`. */
|
|
24
56
|
agent?: string;
|
|
25
57
|
/** Collab-agent channel id selecting that channel's overrides. */
|
|
26
58
|
channel?: string;
|
|
@@ -38,10 +70,6 @@ export interface AthenaStatewireRuntimeConfig {
|
|
|
38
70
|
knowledgeBase?: string[];
|
|
39
71
|
/** System prompt override. */
|
|
40
72
|
systemPrompt?: string;
|
|
41
|
-
/** Legacy-transport option accepted for shared-config compatibility, never
|
|
42
|
-
* sent: the deep-agent runtime has no `custom_tool_configs` reader (MCP
|
|
43
|
-
* configuration is the parsed `mcp_server_configs` key). */
|
|
44
|
-
customToolConfigs?: Record<string, unknown>;
|
|
45
73
|
/** Client app identifier for session filtering. Sent as app_id in runConfig.custom. */
|
|
46
74
|
appId?: string;
|
|
47
75
|
/** Additional fields merged into runConfig.custom. */
|
|
@@ -52,14 +80,12 @@ export interface AthenaStatewireRuntimeConfig {
|
|
|
52
80
|
onConnectionChange?: UseDeepAgentThreadOptions['onConnectionChange'];
|
|
53
81
|
/** Raw connection observer — carries the transport's reconnect handle. */
|
|
54
82
|
onRawConnectionChange?: UseDeepAgentThreadOptions['onRawConnectionChange'];
|
|
55
|
-
/** Notified when the snapshot flags a read-only pre-cutover thread. */
|
|
56
|
-
onLegacyReadOnly?: UseDeepAgentThreadOptions['onLegacyReadOnly'];
|
|
57
83
|
/** Notified when a run starts/stops. */
|
|
58
84
|
onRunningChange?: UseDeepAgentThreadOptions['onRunningChange'];
|
|
59
85
|
}
|
|
60
86
|
/** The client tools derived from the runtime's frontend toolkit — exposed so
|
|
61
87
|
* the provider can mount the client-tool bridge with the same set. */
|
|
62
|
-
export declare function useStatewireClientTools(frontendToolkit: Toolkit | undefined):
|
|
88
|
+
export declare function useStatewireClientTools(frontendToolkit: Toolkit | undefined): RegisteredClientTool[];
|
|
63
89
|
/**
|
|
64
90
|
* Statewire runtime for the Athena SDK — a thin shim over the shared
|
|
65
91
|
* `@athenaintel/agent-runtime` `useDeepAgentRuntime`: it attaches to the
|
|
@@ -67,8 +93,8 @@ export declare function useStatewireClientTools(frontendToolkit: Toolkit | undef
|
|
|
67
93
|
* `AssistantClient` to mount via `AuiProvider` — the same integration shape as
|
|
68
94
|
* the Olympus, Chrome extension, Office, and mobile statewire hosts.
|
|
69
95
|
*
|
|
70
|
-
* Auth
|
|
71
|
-
*
|
|
72
|
-
*
|
|
96
|
+
* Auth: a token (resolved live through `getToken` when provided) rides
|
|
97
|
+
* `Authorization: Bearer`, and an API key falls back to `X-API-KEY` — both
|
|
98
|
+
* accepted by the statewire host.
|
|
73
99
|
*/
|
|
74
100
|
export declare function useAthenaStatewireRuntime(config: AthenaStatewireRuntimeConfig): AssistantClient;
|