@athenaintel/react 0.18.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.
Files changed (101) hide show
  1. package/README.md +106 -4
  2. package/dist/SuperGroupingCard-BsWbHyV_.js +795 -0
  3. package/dist/SuperGroupingCard-BsWbHyV_.js.map +1 -0
  4. package/dist/SuperGroupingCard-CRRFUgjN.cjs +794 -0
  5. package/dist/SuperGroupingCard-CRRFUgjN.cjs.map +1 -0
  6. package/dist/chat/StatewireApprovalCard.d.ts +59 -2
  7. package/dist/chat/StatewireClientToolBridge.d.ts +3 -3
  8. package/dist/chat/StatewireQueuedMessages.d.ts +105 -6
  9. package/dist/chat/statewire-approval.d.ts +1 -1
  10. package/dist/chat/statewire-client-tools.d.ts +15 -21
  11. package/dist/chat/super-grouping/CollapsibleGroup.d.ts +52 -11
  12. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +78 -21
  13. package/dist/chat/super-grouping/activity-timeline.d.ts +91 -0
  14. package/dist/chat/super-grouping/grouping-function.d.ts +13 -10
  15. package/dist/chat/super-grouping/index.d.ts +12 -0
  16. package/dist/chat/super-grouping/toolkit-map.d.ts +8 -1
  17. package/dist/chat/use-statewire-approval-request.d.ts +44 -0
  18. package/dist/chat-ui/header/conversation-history-panel.d.ts +11 -1
  19. package/dist/chat-ui/index.d.ts +7 -1
  20. package/dist/chat-ui/mentions/suggestions/shims.d.ts +0 -4
  21. package/dist/chat-ui/messages/runtime-message.d.ts +2 -3
  22. package/dist/chat-ui/messages/statewire-continue-run.d.ts +48 -7
  23. package/dist/chat-ui/messages/user-edit-composer.d.ts +5 -2
  24. package/dist/chat-ui/statewire.d.ts +19 -0
  25. package/dist/chat-ui/thread/chat-thread-shell.d.ts +7 -1
  26. package/dist/chat-ui/thread/statewire-history-edge.d.ts +52 -0
  27. package/dist/chat-ui-statewire.cjs +25 -0
  28. package/dist/chat-ui-statewire.cjs.map +1 -0
  29. package/dist/chat-ui-statewire.js +25 -0
  30. package/dist/chat-ui-statewire.js.map +1 -0
  31. package/dist/chat-ui.cjs +174 -357
  32. package/dist/chat-ui.cjs.map +1 -1
  33. package/dist/chat-ui.js +173 -355
  34. package/dist/chat-ui.js.map +1 -1
  35. package/dist/diagnostics/athena-diagnostics.d.ts +1 -1
  36. package/dist/diagnostics/errors.d.ts +4 -0
  37. package/dist/index.cjs +2222 -5183
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.ts +21 -6
  40. package/dist/index.js +4193 -7151
  41. package/dist/index.js.map +1 -1
  42. package/dist/misc-tool-uis-B2e0Okkn.cjs +43 -0
  43. package/dist/misc-tool-uis-B2e0Okkn.cjs.map +1 -0
  44. package/dist/misc-tool-uis-gAiQw0Yl.js +44 -0
  45. package/dist/misc-tool-uis-gAiQw0Yl.js.map +1 -0
  46. package/dist/provider/AthenaProvider.d.ts +4 -2
  47. package/dist/provider/config.d.ts +9 -2
  48. package/dist/provider/statewire-window-context.d.ts +12 -0
  49. package/dist/runtime/statewire-auth-headers.d.ts +38 -0
  50. package/dist/runtime/statewire-lifecycle.d.ts +25 -0
  51. package/dist/runtime/statewire-session-key.d.ts +13 -0
  52. package/dist/runtime/useAthenaStatewireRuntime.d.ts +36 -5
  53. package/dist/statewire-continue-run-D34gS7_1.js +132 -0
  54. package/dist/statewire-continue-run-D34gS7_1.js.map +1 -0
  55. package/dist/statewire-continue-run-nE9VCKUh.cjs +131 -0
  56. package/dist/statewire-continue-run-nE9VCKUh.cjs.map +1 -0
  57. package/dist/statewire-history-edge-C8uyTEjX.cjs +1711 -0
  58. package/dist/statewire-history-edge-C8uyTEjX.cjs.map +1 -0
  59. package/dist/statewire-history-edge-CPohUKMt.js +1712 -0
  60. package/dist/statewire-history-edge-CPohUKMt.js.map +1 -0
  61. package/dist/styles.css +1 -1
  62. package/dist/super-grouping.cjs +22 -0
  63. package/dist/super-grouping.cjs.map +1 -0
  64. package/dist/super-grouping.js +22 -0
  65. package/dist/super-grouping.js.map +1 -0
  66. package/dist/threads/mint-thread-id.d.ts +8 -0
  67. package/dist/threads/statewire-thread-list.d.ts +20 -4
  68. package/dist/tool-fallback-DkQ3DLkn.js +4281 -0
  69. package/dist/tool-fallback-DkQ3DLkn.js.map +1 -0
  70. package/dist/tool-fallback-kfhpJQZa.cjs +4297 -0
  71. package/dist/tool-fallback-kfhpJQZa.cjs.map +1 -0
  72. package/dist/tools/index.d.ts +14 -0
  73. package/dist/tools/misc-tool-uis.d.ts +2 -0
  74. package/dist/tools/primitives.d.ts +41 -0
  75. package/dist/tools/tool-fallback.d.ts +78 -6
  76. package/dist/tools/tool-icons.d.ts +10 -0
  77. package/dist/tools/tool-uis.d.ts +1 -23
  78. package/dist/tools.cjs +41 -0
  79. package/dist/tools.cjs.map +1 -0
  80. package/dist/tools.js +41 -0
  81. package/dist/tools.js.map +1 -0
  82. package/dist/trash-2-B5OaNAL7.cjs +5096 -0
  83. package/dist/trash-2-B5OaNAL7.cjs.map +1 -0
  84. package/dist/trash-2-CCwSURL-.js +5081 -0
  85. package/dist/trash-2-CCwSURL-.js.map +1 -0
  86. package/dist/{use-rest-conversation-history-Dm0rdQgT.cjs → use-rest-conversation-history-Cm8qMRxp.cjs} +445 -5406
  87. package/dist/use-rest-conversation-history-Cm8qMRxp.cjs.map +1 -0
  88. package/dist/{use-rest-conversation-history-Bs5qn5G3.js → use-rest-conversation-history-veDZS-oL.js} +491 -5452
  89. package/dist/use-rest-conversation-history-veDZS-oL.js.map +1 -0
  90. package/dist/wrench-BEf72cyP.cjs +417 -0
  91. package/dist/wrench-BEf72cyP.cjs.map +1 -0
  92. package/dist/wrench-CbrOlVYm.js +418 -0
  93. package/dist/wrench-CbrOlVYm.js.map +1 -0
  94. package/dist/x-Dfd2NzK0.cjs +42 -0
  95. package/dist/x-Dfd2NzK0.cjs.map +1 -0
  96. package/dist/x-_DntAa_a.js +43 -0
  97. package/dist/x-_DntAa_a.js.map +1 -0
  98. package/package.json +29 -11
  99. package/dist/chat/super-grouping/tool-status-labels.d.ts +0 -1
  100. package/dist/use-rest-conversation-history-Bs5qn5G3.js.map +0 -1
  101. package/dist/use-rest-conversation-history-Dm0rdQgT.cjs.map +0 -1
@@ -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,6 +1,7 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import type { Toolkit } from '@assistant-ui/react';
3
3
  import { type AthenaEnvironment } from '../lib/athena-urls';
4
+ import type { 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
7
  import type { AthenaProviderConfig } from './config';
@@ -58,8 +59,9 @@ export interface AthenaProviderProps {
58
59
  environment?: AthenaEnvironment;
59
60
  /** Resolve the latest auth token immediately before a request (for
60
61
  * expiring clients). Takes priority over `token` when it resolves.
61
- * Prefer `config.getToken`. */
62
- getToken?: () => string | null | Promise<string | null>;
62
+ * Prefer `config.getToken` (see its `force` contract for refused
63
+ * credentials). */
64
+ getToken?: AthenaStatewireTokenGetter;
63
65
  /** Additional fields merged into runConfig.custom. Prefer
64
66
  * `config.extraRunConfig`. */
65
67
  extraRunConfig?: Record<string, unknown>;
@@ -1,9 +1,16 @@
1
1
  import type { AthenaEnvironment } from '../lib/athena-urls';
2
+ import type { AthenaStatewireTokenGetter } from '../runtime/statewire-auth-headers';
2
3
  import type { PostHogConfig } from './PostHogProvider';
3
4
  export interface AthenaProviderConfig {
4
5
  /** Resolve the latest auth token immediately before a request (for expiring
5
- * clients). Takes priority over `token` when it resolves. */
6
- getToken?: () => string | null | Promise<string | null>;
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;
7
14
  /** Additional fields merged into runConfig.custom. */
8
15
  extraRunConfig?: Record<string, unknown>;
9
16
  /** API key for standalone authentication when no token is provided. */
@@ -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;
@@ -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>>;
@@ -19,3 +19,28 @@ export interface AthenaStatewireLifecycleState {
19
19
  reconnect: (() => void) | null;
20
20
  dismissError: () => void;
21
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;
@@ -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 StatewireClientTool } from '../chat/statewire-client-tools';
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,8 +24,30 @@ 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 clients). */
19
- getToken?: () => string | null | Promise<string | null>;
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
53
  /** Agent selector: only `collab_agent:<asset_id>` refs are accepted (the run
@@ -54,7 +85,7 @@ export interface AthenaStatewireRuntimeConfig {
54
85
  }
55
86
  /** The client tools derived from the runtime's frontend toolkit — exposed so
56
87
  * the provider can mount the client-tool bridge with the same set. */
57
- export declare function useStatewireClientTools(frontendToolkit: Toolkit | undefined): StatewireClientTool[];
88
+ export declare function useStatewireClientTools(frontendToolkit: Toolkit | undefined): RegisteredClientTool[];
58
89
  /**
59
90
  * Statewire runtime for the Athena SDK — a thin shim over the shared
60
91
  * `@athenaintel/agent-runtime` `useDeepAgentRuntime`: it attaches to the
@@ -0,0 +1,132 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useAuiState } from "@assistant-ui/react";
3
+ import { useStatewireRuns, useStatewireSendCommand } from "@assistant-ui/react-statewire";
4
+ import { r as readRunMarkerFromSourceMessages, A as ATHENA_RUN_MARKER_CANCELLED, a as ATHENA_RUN_MARKER_FAILED, c as cn } from "./trash-2-CCwSURL-.js";
5
+ import "react";
6
+ import "@assistant-ui/tap";
7
+ import "statewire";
8
+ import { h as hasStatewireThreadExtras, f as useDeepAgentThreadStatus, C as ContinuePill, R as RuntimeMessageCard, r as readRuntimeMessageFromSourceMessages } from "./statewire-history-edge-CPohUKMt.js";
9
+ import "@assistant-ui/store";
10
+ function StatewireContinueRunButton({
11
+ allowReadyFallback = false,
12
+ onContinue
13
+ } = {}) {
14
+ const status = useDeepAgentThreadStatus();
15
+ const { runId } = useStatewireRuns();
16
+ const sendCommand = useStatewireSendCommand();
17
+ const isSettled = status === "stopped" || status === "error";
18
+ if (!isSettled && !(allowReadyFallback && status === "ready")) return null;
19
+ return /* @__PURE__ */ jsx(
20
+ ContinuePill,
21
+ {
22
+ ariaLabel: "Continue this run from where it stopped",
23
+ dataTestId: "statewire-continue-run",
24
+ onClick: () => {
25
+ onContinue == null ? void 0 : onContinue({ status, runId });
26
+ sendCommand({
27
+ type: "run/continue",
28
+ ...runId !== null && { runId }
29
+ });
30
+ }
31
+ }
32
+ );
33
+ }
34
+ function StatewireContinueRunAffordance() {
35
+ const messageId = useAuiState((state) => state.message.id);
36
+ const lastMessageId = useAuiState(
37
+ (state) => {
38
+ var _a;
39
+ return (_a = state.thread.messages.at(-1)) == null ? void 0 : _a.id;
40
+ }
41
+ );
42
+ const runMarker = useAuiState(
43
+ (state) => {
44
+ var _a;
45
+ return (_a = readRunMarkerFromSourceMessages(state.message)) == null ? void 0 : _a.marker;
46
+ }
47
+ );
48
+ const threadExtras = useAuiState((state) => state.thread.extras);
49
+ const isContinuableMarker = runMarker === ATHENA_RUN_MARKER_CANCELLED || runMarker === ATHENA_RUN_MARKER_FAILED;
50
+ if (messageId !== lastMessageId || !isContinuableMarker) return null;
51
+ if (!hasStatewireThreadExtras(threadExtras)) return null;
52
+ return /* @__PURE__ */ jsx("div", { className: "flex w-full justify-center py-1", children: /* @__PURE__ */ jsx(StatewireContinueRunButton, { allowReadyFallback: true }) });
53
+ }
54
+ const readRuntimeTailEnding = (message) => {
55
+ const runtime = readRuntimeMessageFromSourceMessages(message);
56
+ return runtime ? { kind: runtime.kind, silent: runtime.silent } : null;
57
+ };
58
+ function StatewireRunEndedFooter({
59
+ className,
60
+ readTailEnding,
61
+ renderActions
62
+ } = {}) {
63
+ const threadExtras = useAuiState((state) => state.thread.extras);
64
+ if (!hasStatewireThreadExtras(threadExtras)) return null;
65
+ return /* @__PURE__ */ jsx(
66
+ StatewireRunEndedFooterContent,
67
+ {
68
+ className,
69
+ readTailEnding,
70
+ renderActions
71
+ }
72
+ );
73
+ }
74
+ function StatewireRunEndedFooterContent({
75
+ className,
76
+ readTailEnding = readRuntimeTailEnding,
77
+ renderActions
78
+ }) {
79
+ const status = useDeepAgentThreadStatus();
80
+ const { error } = useStatewireRuns();
81
+ const tailEndingKind = useAuiState((state) => {
82
+ var _a;
83
+ const last = state.thread.messages.at(-1);
84
+ return last ? ((_a = readTailEnding(last)) == null ? void 0 : _a.kind) ?? null : null;
85
+ });
86
+ const tailEndingSilent = useAuiState((state) => {
87
+ var _a;
88
+ const last = state.thread.messages.at(-1);
89
+ return last ? ((_a = readTailEnding(last)) == null ? void 0 : _a.silent) ?? false : false;
90
+ });
91
+ if (status !== "stopped" && status !== "error") return null;
92
+ if (status === "stopped" && tailEndingSilent) return null;
93
+ const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;
94
+ const tailMatchesStatus = status === "error" ? tailEndingKind === "failed" : tailEndingKind === "stopped" || tailEndingKind === "paused";
95
+ if (tailRendersEnding && tailMatchesStatus) return null;
96
+ const tailOwnsContinue = tailRendersEnding && tailEndingKind !== "handoff";
97
+ const action = renderActions ? renderActions({ status, tailEndingKind: tailRendersEnding ? tailEndingKind : null }) : tailOwnsContinue ? void 0 : /* @__PURE__ */ jsx(StatewireContinueRunButton, {});
98
+ const message = status === "error" ? {
99
+ kind: "failed",
100
+ reason: "error",
101
+ severity: "error",
102
+ title: "Run failed",
103
+ detail: void 0,
104
+ text: (error == null ? void 0 : error.message) ? `⚠️ The run failed: ${error.message}` : void 0,
105
+ silent: false,
106
+ isSoleSourceMessage: true
107
+ } : {
108
+ kind: "stopped",
109
+ reason: void 0,
110
+ severity: "info",
111
+ title: "Conversation stopped",
112
+ detail: void 0,
113
+ text: void 0,
114
+ silent: false,
115
+ isSoleSourceMessage: true
116
+ };
117
+ return /* @__PURE__ */ jsx(
118
+ RuntimeMessageCard,
119
+ {
120
+ "data-testid": "statewire-run-ended-footer",
121
+ message,
122
+ action,
123
+ className: cn("mx-auto max-w-[95%]", className)
124
+ }
125
+ );
126
+ }
127
+ export {
128
+ StatewireContinueRunAffordance as S,
129
+ StatewireContinueRunButton as a,
130
+ StatewireRunEndedFooter as b
131
+ };
132
+ //# sourceMappingURL=statewire-continue-run-D34gS7_1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statewire-continue-run-D34gS7_1.js","sources":["../src/chat-ui/messages/statewire-continue-run.tsx"],"sourcesContent":["import { type ThreadMessage, useAuiState } from \"@assistant-ui/react\";\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n} from \"@assistant-ui/react-statewire\";\nimport {\n ATHENA_RUN_MARKER_CANCELLED,\n ATHENA_RUN_MARKER_FAILED,\n type AthenaRuntimeMessage,\n type AthenaRuntimeMessageKind,\n type DeepAgentThreadStatus,\n hasStatewireThreadExtras,\n readRunMarkerFromSourceMessages,\n readRuntimeMessageFromSourceMessages,\n useDeepAgentThreadStatus,\n} from \"@athenaintel/agent-runtime\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { ContinuePill } from \"./continue-pill\";\nimport { RuntimeMessageCard } from \"./runtime-message\";\n\nexport interface StatewireContinueRunButtonProps {\n /**\n * Also offer Continue while the thread projects `ready`. An old snapshot\n * can report a resting thread whose last persisted ending is still\n * continuable; the marker row that mounts this button knows that.\n */\n allowReadyFallback?: boolean;\n /**\n * Called as the continue dispatches (after the pill's exit animation) —\n * the host's telemetry hook. Receives the settled status and live run id.\n */\n onContinue?: (context: { status: DeepAgentThreadStatus; runId: string | null }) => void;\n}\n\n/**\n * Dispatches the bare `run/continue` for the live Statewire thread — the\n * heal-then-continue recovery for stopped, errored, and pod-drained runs. The\n * command is exactly what the library's `onResume` emits, so it inherits the\n * optimistic running-flip (the pill unmounts once the dispatch is accepted)\n * and routes rejections to the runtime's shared `onError` policy.\n *\n * Gated on the LIVE thread status, never on the persisted marker: markers live\n * in the transcript forever, while continuability is a property of the\n * current run state. Requires `capabilities.continue` on the host thread and\n * a statewire aui scope (throws outside one, like every `useStatewire*` hook).\n */\nexport function StatewireContinueRunButton({\n allowReadyFallback = false,\n onContinue,\n}: StatewireContinueRunButtonProps = {}): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { runId } = useStatewireRuns();\n const sendCommand = useStatewireSendCommand();\n\n const isSettled = status === \"stopped\" || status === \"error\";\n if (!isSettled && !(allowReadyFallback && status === \"ready\")) return null;\n\n return (\n <ContinuePill\n ariaLabel=\"Continue this run from where it stopped\"\n dataTestId=\"statewire-continue-run\"\n onClick={() => {\n onContinue?.({ status, runId });\n sendCommand({\n type: \"run/continue\",\n ...(runId !== null && { runId }),\n });\n }}\n />\n );\n}\n\n/**\n * Recovery affordance for the latest persisted stopped/failed run marker,\n * for the `runtimeMessageAction` slot of `createAssistantMessage`.\n *\n * Marker messages remain in history forever, so only the current last message\n * may continue. The extras guard keeps Statewire hooks out of read-only or\n * legacy runtimes where they would throw.\n */\nexport function StatewireContinueRunAffordance(): ReactElement | null {\n const messageId = useAuiState((state) => state.message.id);\n const lastMessageId = useAuiState(\n (state) => state.thread.messages.at(-1)?.id,\n );\n const runMarker = useAuiState(\n (state) => readRunMarkerFromSourceMessages(state.message)?.marker,\n );\n const threadExtras = useAuiState((state) => state.thread.extras);\n\n const isContinuableMarker =\n runMarker === ATHENA_RUN_MARKER_CANCELLED ||\n runMarker === ATHENA_RUN_MARKER_FAILED;\n if (messageId !== lastMessageId || !isContinuableMarker) return null;\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n\n return (\n <div className=\"flex w-full justify-center py-1\">\n <StatewireContinueRunButton allowReadyFallback />\n </div>\n );\n}\n\n/** The ending a transcript row paints, as the footer needs to know it. */\nexport interface StatewireTailEnding {\n kind: AthenaRuntimeMessageKind;\n /** A send-now cancellation: kept in the data, painted as nothing. */\n silent: boolean;\n}\n\n/** Reads the runtime ending (marker or handoff) a message row renders, if any. */\nexport type ReadStatewireTailEnding = (message: ThreadMessage) => StatewireTailEnding | null;\n\nconst readRuntimeTailEnding: ReadStatewireTailEnding = (message) => {\n const runtime = readRuntimeMessageFromSourceMessages(message);\n return runtime ? { kind: runtime.kind, silent: runtime.silent } : null;\n};\n\nexport interface StatewireRunEndedFooterActionsContext {\n /** The live settled status the footer describes. */\n status: \"stopped\" | \"error\";\n /** The ending the tail row renders, when it renders one (silent markers read as none). */\n tailEndingKind: AthenaRuntimeMessageKind | null;\n}\n\nexport interface StatewireRunEndedFooterProps {\n /** Merged onto the recovery card's default classes. */\n className?: string;\n /**\n * How the host's assistant row paints the transcript tail. The default reads\n * the runtime ending only (a persisted marker or handoff); a host whose row\n * also styles an assistant-ui error status as a failed ending passes a\n * reader that reports it, so the footer never doubles that row's recovery.\n */\n readTailEnding?: ReadStatewireTailEnding;\n /**\n * The recovery controls. The default renders Continue unless the tail row\n * (a marker of another kind) already carries it; hosts with richer recovery\n * (Retry + Continue) supply their own and decide ownership from the context.\n */\n renderActions?: (context: StatewireRunEndedFooterActionsContext) => ReactNode;\n}\n\n/**\n * Recovery row for a settled run whose persisted ending is no longer the\n * transcript tail — rendered after the messages (`renderMessages`). Rewinds,\n * compaction, and older snapshots can all leave the durable run state\n * recoverable without a marker row that owns the action. The failure copy\n * comes from the replicated run error (`runs.error.message`) — the same text\n * the marker would have carried. Renders nothing on legacy (non-statewire)\n * threads.\n */\nexport function StatewireRunEndedFooter({\n className,\n readTailEnding,\n renderActions,\n}: StatewireRunEndedFooterProps = {}): ReactElement | null {\n const threadExtras = useAuiState((state) => state.thread.extras);\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n return (\n <StatewireRunEndedFooterContent\n className={className}\n readTailEnding={readTailEnding}\n renderActions={renderActions}\n />\n );\n}\n\nfunction StatewireRunEndedFooterContent({\n className,\n readTailEnding = readRuntimeTailEnding,\n renderActions,\n}: StatewireRunEndedFooterProps): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { error } = useStatewireRuns();\n // The reader builds a fresh object per call; select primitives so the\n // snapshots stay stable under `Object.is` comparison.\n const tailEndingKind = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.kind ?? null) : null;\n });\n const tailEndingSilent = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.silent ?? false) : false;\n });\n\n if (status !== \"stopped\" && status !== \"error\") return null;\n\n // A send-now promotion intentionally cancels the superseded run without a\n // visible ending. Statewire can briefly report that cancellation as stopped;\n // preserve the silent contract instead of presenting a false recovery state.\n // A genuine error still wins and remains recoverable below.\n if (status === \"stopped\" && tailEndingSilent) return null;\n\n const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;\n const tailMatchesStatus =\n status === \"error\"\n ? tailEndingKind === \"failed\"\n : tailEndingKind === \"stopped\" || tailEndingKind === \"paused\";\n if (tailRendersEnding && tailMatchesStatus) return null;\n\n // An older run's marker at the tail still carries its own Continue (the\n // marker-row affordance); a handoff banner does not.\n const tailOwnsContinue = tailRendersEnding && tailEndingKind !== \"handoff\";\n const action = renderActions ? (\n renderActions({ status, tailEndingKind: tailRendersEnding ? tailEndingKind : null })\n ) : tailOwnsContinue ? undefined : (\n <StatewireContinueRunButton />\n );\n const message: AthenaRuntimeMessage =\n status === \"error\"\n ? {\n kind: \"failed\",\n reason: \"error\",\n severity: \"error\",\n title: \"Run failed\",\n detail: undefined,\n text: error?.message ? `⚠️ The run failed: ${error.message}` : undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"stopped\",\n reason: undefined,\n severity: \"info\",\n title: \"Conversation stopped\",\n detail: undefined,\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n };\n\n return (\n <RuntimeMessageCard\n data-testid=\"statewire-run-ended-footer\"\n message={message}\n action={action}\n className={cn(\"mx-auto max-w-[95%]\", className)}\n />\n );\n}\n"],"names":[],"mappings":"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"}
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const react = require("@assistant-ui/react");
4
+ const reactStatewire = require("@assistant-ui/react-statewire");
5
+ const trash2 = require("./trash-2-B5OaNAL7.cjs");
6
+ require("react");
7
+ require("@assistant-ui/tap");
8
+ require("statewire");
9
+ const statewireHistoryEdge = require("./statewire-history-edge-C8uyTEjX.cjs");
10
+ require("@assistant-ui/store");
11
+ function StatewireContinueRunButton({
12
+ allowReadyFallback = false,
13
+ onContinue
14
+ } = {}) {
15
+ const status = statewireHistoryEdge.useDeepAgentThreadStatus();
16
+ const { runId } = reactStatewire.useStatewireRuns();
17
+ const sendCommand = reactStatewire.useStatewireSendCommand();
18
+ const isSettled = status === "stopped" || status === "error";
19
+ if (!isSettled && !(allowReadyFallback && status === "ready")) return null;
20
+ return /* @__PURE__ */ jsxRuntime.jsx(
21
+ statewireHistoryEdge.ContinuePill,
22
+ {
23
+ ariaLabel: "Continue this run from where it stopped",
24
+ dataTestId: "statewire-continue-run",
25
+ onClick: () => {
26
+ onContinue == null ? void 0 : onContinue({ status, runId });
27
+ sendCommand({
28
+ type: "run/continue",
29
+ ...runId !== null && { runId }
30
+ });
31
+ }
32
+ }
33
+ );
34
+ }
35
+ function StatewireContinueRunAffordance() {
36
+ const messageId = react.useAuiState((state) => state.message.id);
37
+ const lastMessageId = react.useAuiState(
38
+ (state) => {
39
+ var _a;
40
+ return (_a = state.thread.messages.at(-1)) == null ? void 0 : _a.id;
41
+ }
42
+ );
43
+ const runMarker = react.useAuiState(
44
+ (state) => {
45
+ var _a;
46
+ return (_a = trash2.readRunMarkerFromSourceMessages(state.message)) == null ? void 0 : _a.marker;
47
+ }
48
+ );
49
+ const threadExtras = react.useAuiState((state) => state.thread.extras);
50
+ const isContinuableMarker = runMarker === trash2.ATHENA_RUN_MARKER_CANCELLED || runMarker === trash2.ATHENA_RUN_MARKER_FAILED;
51
+ if (messageId !== lastMessageId || !isContinuableMarker) return null;
52
+ if (!statewireHistoryEdge.hasStatewireThreadExtras(threadExtras)) return null;
53
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-center py-1", children: /* @__PURE__ */ jsxRuntime.jsx(StatewireContinueRunButton, { allowReadyFallback: true }) });
54
+ }
55
+ const readRuntimeTailEnding = (message) => {
56
+ const runtime = statewireHistoryEdge.readRuntimeMessageFromSourceMessages(message);
57
+ return runtime ? { kind: runtime.kind, silent: runtime.silent } : null;
58
+ };
59
+ function StatewireRunEndedFooter({
60
+ className,
61
+ readTailEnding,
62
+ renderActions
63
+ } = {}) {
64
+ const threadExtras = react.useAuiState((state) => state.thread.extras);
65
+ if (!statewireHistoryEdge.hasStatewireThreadExtras(threadExtras)) return null;
66
+ return /* @__PURE__ */ jsxRuntime.jsx(
67
+ StatewireRunEndedFooterContent,
68
+ {
69
+ className,
70
+ readTailEnding,
71
+ renderActions
72
+ }
73
+ );
74
+ }
75
+ function StatewireRunEndedFooterContent({
76
+ className,
77
+ readTailEnding = readRuntimeTailEnding,
78
+ renderActions
79
+ }) {
80
+ const status = statewireHistoryEdge.useDeepAgentThreadStatus();
81
+ const { error } = reactStatewire.useStatewireRuns();
82
+ const tailEndingKind = react.useAuiState((state) => {
83
+ var _a;
84
+ const last = state.thread.messages.at(-1);
85
+ return last ? ((_a = readTailEnding(last)) == null ? void 0 : _a.kind) ?? null : null;
86
+ });
87
+ const tailEndingSilent = react.useAuiState((state) => {
88
+ var _a;
89
+ const last = state.thread.messages.at(-1);
90
+ return last ? ((_a = readTailEnding(last)) == null ? void 0 : _a.silent) ?? false : false;
91
+ });
92
+ if (status !== "stopped" && status !== "error") return null;
93
+ if (status === "stopped" && tailEndingSilent) return null;
94
+ const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;
95
+ const tailMatchesStatus = status === "error" ? tailEndingKind === "failed" : tailEndingKind === "stopped" || tailEndingKind === "paused";
96
+ if (tailRendersEnding && tailMatchesStatus) return null;
97
+ const tailOwnsContinue = tailRendersEnding && tailEndingKind !== "handoff";
98
+ const action = renderActions ? renderActions({ status, tailEndingKind: tailRendersEnding ? tailEndingKind : null }) : tailOwnsContinue ? void 0 : /* @__PURE__ */ jsxRuntime.jsx(StatewireContinueRunButton, {});
99
+ const message = status === "error" ? {
100
+ kind: "failed",
101
+ reason: "error",
102
+ severity: "error",
103
+ title: "Run failed",
104
+ detail: void 0,
105
+ text: (error == null ? void 0 : error.message) ? `⚠️ The run failed: ${error.message}` : void 0,
106
+ silent: false,
107
+ isSoleSourceMessage: true
108
+ } : {
109
+ kind: "stopped",
110
+ reason: void 0,
111
+ severity: "info",
112
+ title: "Conversation stopped",
113
+ detail: void 0,
114
+ text: void 0,
115
+ silent: false,
116
+ isSoleSourceMessage: true
117
+ };
118
+ return /* @__PURE__ */ jsxRuntime.jsx(
119
+ statewireHistoryEdge.RuntimeMessageCard,
120
+ {
121
+ "data-testid": "statewire-run-ended-footer",
122
+ message,
123
+ action,
124
+ className: trash2.cn("mx-auto max-w-[95%]", className)
125
+ }
126
+ );
127
+ }
128
+ exports.StatewireContinueRunAffordance = StatewireContinueRunAffordance;
129
+ exports.StatewireContinueRunButton = StatewireContinueRunButton;
130
+ exports.StatewireRunEndedFooter = StatewireRunEndedFooter;
131
+ //# sourceMappingURL=statewire-continue-run-nE9VCKUh.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statewire-continue-run-nE9VCKUh.cjs","sources":["../src/chat-ui/messages/statewire-continue-run.tsx"],"sourcesContent":["import { type ThreadMessage, useAuiState } from \"@assistant-ui/react\";\nimport {\n useStatewireRuns,\n useStatewireSendCommand,\n} from \"@assistant-ui/react-statewire\";\nimport {\n ATHENA_RUN_MARKER_CANCELLED,\n ATHENA_RUN_MARKER_FAILED,\n type AthenaRuntimeMessage,\n type AthenaRuntimeMessageKind,\n type DeepAgentThreadStatus,\n hasStatewireThreadExtras,\n readRunMarkerFromSourceMessages,\n readRuntimeMessageFromSourceMessages,\n useDeepAgentThreadStatus,\n} from \"@athenaintel/agent-runtime\";\nimport type { ReactElement, ReactNode } from \"react\";\nimport { cn } from \"../../lib/utils\";\nimport { ContinuePill } from \"./continue-pill\";\nimport { RuntimeMessageCard } from \"./runtime-message\";\n\nexport interface StatewireContinueRunButtonProps {\n /**\n * Also offer Continue while the thread projects `ready`. An old snapshot\n * can report a resting thread whose last persisted ending is still\n * continuable; the marker row that mounts this button knows that.\n */\n allowReadyFallback?: boolean;\n /**\n * Called as the continue dispatches (after the pill's exit animation) —\n * the host's telemetry hook. Receives the settled status and live run id.\n */\n onContinue?: (context: { status: DeepAgentThreadStatus; runId: string | null }) => void;\n}\n\n/**\n * Dispatches the bare `run/continue` for the live Statewire thread — the\n * heal-then-continue recovery for stopped, errored, and pod-drained runs. The\n * command is exactly what the library's `onResume` emits, so it inherits the\n * optimistic running-flip (the pill unmounts once the dispatch is accepted)\n * and routes rejections to the runtime's shared `onError` policy.\n *\n * Gated on the LIVE thread status, never on the persisted marker: markers live\n * in the transcript forever, while continuability is a property of the\n * current run state. Requires `capabilities.continue` on the host thread and\n * a statewire aui scope (throws outside one, like every `useStatewire*` hook).\n */\nexport function StatewireContinueRunButton({\n allowReadyFallback = false,\n onContinue,\n}: StatewireContinueRunButtonProps = {}): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { runId } = useStatewireRuns();\n const sendCommand = useStatewireSendCommand();\n\n const isSettled = status === \"stopped\" || status === \"error\";\n if (!isSettled && !(allowReadyFallback && status === \"ready\")) return null;\n\n return (\n <ContinuePill\n ariaLabel=\"Continue this run from where it stopped\"\n dataTestId=\"statewire-continue-run\"\n onClick={() => {\n onContinue?.({ status, runId });\n sendCommand({\n type: \"run/continue\",\n ...(runId !== null && { runId }),\n });\n }}\n />\n );\n}\n\n/**\n * Recovery affordance for the latest persisted stopped/failed run marker,\n * for the `runtimeMessageAction` slot of `createAssistantMessage`.\n *\n * Marker messages remain in history forever, so only the current last message\n * may continue. The extras guard keeps Statewire hooks out of read-only or\n * legacy runtimes where they would throw.\n */\nexport function StatewireContinueRunAffordance(): ReactElement | null {\n const messageId = useAuiState((state) => state.message.id);\n const lastMessageId = useAuiState(\n (state) => state.thread.messages.at(-1)?.id,\n );\n const runMarker = useAuiState(\n (state) => readRunMarkerFromSourceMessages(state.message)?.marker,\n );\n const threadExtras = useAuiState((state) => state.thread.extras);\n\n const isContinuableMarker =\n runMarker === ATHENA_RUN_MARKER_CANCELLED ||\n runMarker === ATHENA_RUN_MARKER_FAILED;\n if (messageId !== lastMessageId || !isContinuableMarker) return null;\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n\n return (\n <div className=\"flex w-full justify-center py-1\">\n <StatewireContinueRunButton allowReadyFallback />\n </div>\n );\n}\n\n/** The ending a transcript row paints, as the footer needs to know it. */\nexport interface StatewireTailEnding {\n kind: AthenaRuntimeMessageKind;\n /** A send-now cancellation: kept in the data, painted as nothing. */\n silent: boolean;\n}\n\n/** Reads the runtime ending (marker or handoff) a message row renders, if any. */\nexport type ReadStatewireTailEnding = (message: ThreadMessage) => StatewireTailEnding | null;\n\nconst readRuntimeTailEnding: ReadStatewireTailEnding = (message) => {\n const runtime = readRuntimeMessageFromSourceMessages(message);\n return runtime ? { kind: runtime.kind, silent: runtime.silent } : null;\n};\n\nexport interface StatewireRunEndedFooterActionsContext {\n /** The live settled status the footer describes. */\n status: \"stopped\" | \"error\";\n /** The ending the tail row renders, when it renders one (silent markers read as none). */\n tailEndingKind: AthenaRuntimeMessageKind | null;\n}\n\nexport interface StatewireRunEndedFooterProps {\n /** Merged onto the recovery card's default classes. */\n className?: string;\n /**\n * How the host's assistant row paints the transcript tail. The default reads\n * the runtime ending only (a persisted marker or handoff); a host whose row\n * also styles an assistant-ui error status as a failed ending passes a\n * reader that reports it, so the footer never doubles that row's recovery.\n */\n readTailEnding?: ReadStatewireTailEnding;\n /**\n * The recovery controls. The default renders Continue unless the tail row\n * (a marker of another kind) already carries it; hosts with richer recovery\n * (Retry + Continue) supply their own and decide ownership from the context.\n */\n renderActions?: (context: StatewireRunEndedFooterActionsContext) => ReactNode;\n}\n\n/**\n * Recovery row for a settled run whose persisted ending is no longer the\n * transcript tail — rendered after the messages (`renderMessages`). Rewinds,\n * compaction, and older snapshots can all leave the durable run state\n * recoverable without a marker row that owns the action. The failure copy\n * comes from the replicated run error (`runs.error.message`) — the same text\n * the marker would have carried. Renders nothing on legacy (non-statewire)\n * threads.\n */\nexport function StatewireRunEndedFooter({\n className,\n readTailEnding,\n renderActions,\n}: StatewireRunEndedFooterProps = {}): ReactElement | null {\n const threadExtras = useAuiState((state) => state.thread.extras);\n if (!hasStatewireThreadExtras(threadExtras)) return null;\n return (\n <StatewireRunEndedFooterContent\n className={className}\n readTailEnding={readTailEnding}\n renderActions={renderActions}\n />\n );\n}\n\nfunction StatewireRunEndedFooterContent({\n className,\n readTailEnding = readRuntimeTailEnding,\n renderActions,\n}: StatewireRunEndedFooterProps): ReactElement | null {\n const status = useDeepAgentThreadStatus();\n const { error } = useStatewireRuns();\n // The reader builds a fresh object per call; select primitives so the\n // snapshots stay stable under `Object.is` comparison.\n const tailEndingKind = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.kind ?? null) : null;\n });\n const tailEndingSilent = useAuiState((state) => {\n const last = state.thread.messages.at(-1);\n return last ? (readTailEnding(last)?.silent ?? false) : false;\n });\n\n if (status !== \"stopped\" && status !== \"error\") return null;\n\n // A send-now promotion intentionally cancels the superseded run without a\n // visible ending. Statewire can briefly report that cancellation as stopped;\n // preserve the silent contract instead of presenting a false recovery state.\n // A genuine error still wins and remains recoverable below.\n if (status === \"stopped\" && tailEndingSilent) return null;\n\n const tailRendersEnding = tailEndingKind !== null && !tailEndingSilent;\n const tailMatchesStatus =\n status === \"error\"\n ? tailEndingKind === \"failed\"\n : tailEndingKind === \"stopped\" || tailEndingKind === \"paused\";\n if (tailRendersEnding && tailMatchesStatus) return null;\n\n // An older run's marker at the tail still carries its own Continue (the\n // marker-row affordance); a handoff banner does not.\n const tailOwnsContinue = tailRendersEnding && tailEndingKind !== \"handoff\";\n const action = renderActions ? (\n renderActions({ status, tailEndingKind: tailRendersEnding ? tailEndingKind : null })\n ) : tailOwnsContinue ? undefined : (\n <StatewireContinueRunButton />\n );\n const message: AthenaRuntimeMessage =\n status === \"error\"\n ? {\n kind: \"failed\",\n reason: \"error\",\n severity: \"error\",\n title: \"Run failed\",\n detail: undefined,\n text: error?.message ? `⚠️ The run failed: ${error.message}` : undefined,\n silent: false,\n isSoleSourceMessage: true,\n }\n : {\n kind: \"stopped\",\n reason: undefined,\n severity: \"info\",\n title: \"Conversation stopped\",\n detail: undefined,\n text: undefined,\n silent: false,\n isSoleSourceMessage: true,\n };\n\n return (\n <RuntimeMessageCard\n data-testid=\"statewire-run-ended-footer\"\n message={message}\n action={action}\n className={cn(\"mx-auto max-w-[95%]\", className)}\n />\n );\n}\n"],"names":["useDeepAgentThreadStatus","useStatewireRuns","useStatewireSendCommand","jsx","ContinuePill","useAuiState","readRunMarkerFromSourceMessages","ATHENA_RUN_MARKER_CANCELLED","ATHENA_RUN_MARKER_FAILED","hasStatewireThreadExtras","readRuntimeMessageFromSourceMessages","RuntimeMessageCard","cn"],"mappings":"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"}