@axiom-lattice/react-sdk 10.8.0 → 10.9.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 (62) hide show
  1. package/dist/{AgentDetailSideApp-MC2QAFUQ.mjs → AgentDetailSideApp-KIJALOS5.mjs} +7 -7
  2. package/dist/{AgentGovernanceWorkbench-PR2CUMHR.mjs → AgentGovernanceWorkbench-MQX3BH35.mjs} +8 -8
  3. package/dist/{AgentWebAppProvider-CIabimVC.d.mts → AgentWebAppProvider-x5lVhkhO.d.mts} +6 -0
  4. package/dist/{AgentWebAppProvider-CIabimVC.d.ts → AgentWebAppProvider-x5lVhkhO.d.ts} +6 -0
  5. package/dist/{MessageGraph-IUDE2EDC.mjs → MessageGraph-6EQTQAAR.mjs} +2 -2
  6. package/dist/{ReactChart-TPOQ6BXW.mjs → ReactChart-DZICSFTV.mjs} +2 -2
  7. package/dist/{TasksSideApp-QDLOQLZS.mjs → TasksSideApp-CLHMMR4L.mjs} +3 -3
  8. package/dist/{TopologyRuntimeView-JKGKNV7C.mjs → TopologyRuntimeView-BLBB5PQP.mjs} +3 -3
  9. package/dist/{WorkflowAutomationView-5AJ2QGM2.mjs → WorkflowAutomationView-IPW72SR6.mjs} +5 -5
  10. package/dist/agent-chat-loader.js +1 -1
  11. package/dist/{chunk-IIB5BEMF.mjs → chunk-2BFZHC3S.mjs} +2 -2
  12. package/dist/{chunk-BFKG2OIX.mjs → chunk-3S4RAOOF.mjs} +4 -4
  13. package/dist/{chunk-WCBQEED7.mjs → chunk-6XN2KL76.mjs} +2 -2
  14. package/dist/{chunk-DTZPCOY2.mjs → chunk-FVJMVJR2.mjs} +4 -2
  15. package/dist/chunk-FVJMVJR2.mjs.map +1 -0
  16. package/dist/{chunk-4AQVKTZZ.mjs → chunk-J7NG35IU.mjs} +2 -2
  17. package/dist/{chunk-25QAUXI3.mjs → chunk-OTQDEU5U.mjs} +10 -9
  18. package/dist/chunk-OTQDEU5U.mjs.map +1 -0
  19. package/dist/{chunk-YGZX4CDC.mjs → chunk-QJTPXXPS.mjs} +4 -4
  20. package/dist/{chunk-PPMYPBGP.mjs → chunk-YGNARZGO.mjs} +10 -10
  21. package/dist/{embed-page-AgentDetailSideApp-L2GPADRT.js → embed-page-AgentDetailSideApp-OXIDUA5Q.js} +1 -1
  22. package/dist/{embed-page-AgentGovernanceWorkbench-YXVJ5FJK.js → embed-page-AgentGovernanceWorkbench-AMQYURAT.js} +1 -1
  23. package/dist/{embed-page-MessageGraph-IFPNLCXQ.js → embed-page-MessageGraph-3DHT34VK.js} +1 -1
  24. package/dist/{embed-page-ReactChart-LBU6Y2BP.js → embed-page-ReactChart-V7HF2DHF.js} +1 -1
  25. package/dist/{embed-page-TasksSideApp-GRQXWFJ2.js → embed-page-TasksSideApp-KTQESBCT.js} +1 -1
  26. package/dist/{embed-page-TopologyRuntimeView-MAQLZ4DX.js → embed-page-TopologyRuntimeView-MIDX2DWN.js} +1 -1
  27. package/dist/{embed-page-WorkflowAutomationView-VZPD4WA3.js → embed-page-WorkflowAutomationView-4IR6R7HJ.js} +1 -1
  28. package/dist/{embed-page-chunk-R4YUWCMY.js → embed-page-chunk-3KAR3CFT.js} +1 -1
  29. package/dist/{embed-page-chunk-2XQNSJVY.js → embed-page-chunk-6X6A2D25.js} +5 -5
  30. package/dist/{embed-page-chunk-7PUQYEF4.js → embed-page-chunk-CEOKXM64.js} +1 -1
  31. package/dist/{embed-page-chunk-BMLFBT5Q.js → embed-page-chunk-TA3SPNRO.js} +1 -1
  32. package/dist/{embed-page-chunk-OXQV7DZF.js → embed-page-chunk-W6NJJTMF.js} +1 -1
  33. package/dist/embed-page-chunk-YVQDSZ77.js +8 -0
  34. package/dist/embed-page.js +3 -3
  35. package/dist/index.d.mts +7 -1
  36. package/dist/index.d.ts +7 -1
  37. package/dist/index.js +7 -4
  38. package/dist/index.js.map +1 -1
  39. package/dist/index.mjs +8 -8
  40. package/dist/web-app.d.mts +2 -2
  41. package/dist/web-app.d.ts +2 -2
  42. package/dist/web-app.js +7 -4
  43. package/dist/web-app.js.map +1 -1
  44. package/dist/web-app.mjs +5 -4
  45. package/dist/web-app.mjs.map +1 -1
  46. package/package.json +1 -1
  47. package/dist/chunk-25QAUXI3.mjs.map +0 -1
  48. package/dist/chunk-DTZPCOY2.mjs.map +0 -1
  49. package/dist/embed-page-chunk-PNDVX33M.js +0 -8
  50. /package/dist/{AgentDetailSideApp-MC2QAFUQ.mjs.map → AgentDetailSideApp-KIJALOS5.mjs.map} +0 -0
  51. /package/dist/{AgentGovernanceWorkbench-PR2CUMHR.mjs.map → AgentGovernanceWorkbench-MQX3BH35.mjs.map} +0 -0
  52. /package/dist/{MessageGraph-IUDE2EDC.mjs.map → MessageGraph-6EQTQAAR.mjs.map} +0 -0
  53. /package/dist/{ReactChart-TPOQ6BXW.mjs.map → ReactChart-DZICSFTV.mjs.map} +0 -0
  54. /package/dist/{TasksSideApp-QDLOQLZS.mjs.map → TasksSideApp-CLHMMR4L.mjs.map} +0 -0
  55. /package/dist/{TopologyRuntimeView-JKGKNV7C.mjs.map → TopologyRuntimeView-BLBB5PQP.mjs.map} +0 -0
  56. /package/dist/{WorkflowAutomationView-5AJ2QGM2.mjs.map → WorkflowAutomationView-IPW72SR6.mjs.map} +0 -0
  57. /package/dist/{chunk-IIB5BEMF.mjs.map → chunk-2BFZHC3S.mjs.map} +0 -0
  58. /package/dist/{chunk-BFKG2OIX.mjs.map → chunk-3S4RAOOF.mjs.map} +0 -0
  59. /package/dist/{chunk-WCBQEED7.mjs.map → chunk-6XN2KL76.mjs.map} +0 -0
  60. /package/dist/{chunk-4AQVKTZZ.mjs.map → chunk-J7NG35IU.mjs.map} +0 -0
  61. /package/dist/{chunk-YGZX4CDC.mjs.map → chunk-QJTPXXPS.mjs.map} +0 -0
  62. /package/dist/{chunk-PPMYPBGP.mjs.map → chunk-YGNARZGO.mjs.map} +0 -0
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  AgentDetailView
3
- } from "./chunk-25QAUXI3.mjs";
3
+ } from "./chunk-OTQDEU5U.mjs";
4
4
  import "./chunk-J37GWFPA.mjs";
5
- import "./chunk-4AQVKTZZ.mjs";
6
- import "./chunk-IIB5BEMF.mjs";
7
- import "./chunk-WCBQEED7.mjs";
5
+ import "./chunk-J7NG35IU.mjs";
6
+ import "./chunk-2BFZHC3S.mjs";
7
+ import "./chunk-6XN2KL76.mjs";
8
8
  import "./chunk-3YVWKHQ2.mjs";
9
9
  import {
10
10
  ProjectScopeProvider_default,
11
11
  useSideAppOpener
12
- } from "./chunk-PPMYPBGP.mjs";
12
+ } from "./chunk-YGNARZGO.mjs";
13
13
  import "./chunk-G43OF5CV.mjs";
14
14
  import "./chunk-XCVYHCTY.mjs";
15
15
  import "./chunk-XC6TB6PI.mjs";
@@ -19,7 +19,7 @@ import {
19
19
  } from "./chunk-MHCOIJGQ.mjs";
20
20
  import "./chunk-26OZOK7P.mjs";
21
21
  import "./chunk-BKVZCHO4.mjs";
22
- import "./chunk-DTZPCOY2.mjs";
22
+ import "./chunk-FVJMVJR2.mjs";
23
23
  import "./chunk-HLVE2SB7.mjs";
24
24
  import "./chunk-6GVLXVXA.mjs";
25
25
  import {
@@ -165,4 +165,4 @@ var AgentDetailSideApp = ({ data }) => {
165
165
  export {
166
166
  AgentDetailSideApp
167
167
  };
168
- //# sourceMappingURL=AgentDetailSideApp-MC2QAFUQ.mjs.map
168
+ //# sourceMappingURL=AgentDetailSideApp-KIJALOS5.mjs.map
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  AgentGovernanceWorkbench
3
- } from "./chunk-YGZX4CDC.mjs";
4
- import "./chunk-25QAUXI3.mjs";
3
+ } from "./chunk-QJTPXXPS.mjs";
4
+ import "./chunk-OTQDEU5U.mjs";
5
5
  import "./chunk-J37GWFPA.mjs";
6
- import "./chunk-4AQVKTZZ.mjs";
7
- import "./chunk-IIB5BEMF.mjs";
8
- import "./chunk-WCBQEED7.mjs";
6
+ import "./chunk-J7NG35IU.mjs";
7
+ import "./chunk-2BFZHC3S.mjs";
8
+ import "./chunk-6XN2KL76.mjs";
9
9
  import "./chunk-3YVWKHQ2.mjs";
10
- import "./chunk-PPMYPBGP.mjs";
10
+ import "./chunk-YGNARZGO.mjs";
11
11
  import "./chunk-G43OF5CV.mjs";
12
12
  import "./chunk-XCVYHCTY.mjs";
13
13
  import "./chunk-XC6TB6PI.mjs";
@@ -15,7 +15,7 @@ import "./chunk-XAGSG72Y.mjs";
15
15
  import "./chunk-MHCOIJGQ.mjs";
16
16
  import "./chunk-26OZOK7P.mjs";
17
17
  import "./chunk-BKVZCHO4.mjs";
18
- import "./chunk-DTZPCOY2.mjs";
18
+ import "./chunk-FVJMVJR2.mjs";
19
19
  import "./chunk-HLVE2SB7.mjs";
20
20
  import "./chunk-6GVLXVXA.mjs";
21
21
  import "./chunk-NBXUIQIA.mjs";
@@ -23,4 +23,4 @@ import "./chunk-32GKV6EM.mjs";
23
23
  export {
24
24
  AgentGovernanceWorkbench
25
25
  };
26
- //# sourceMappingURL=AgentGovernanceWorkbench-PR2CUMHR.mjs.map
26
+ //# sourceMappingURL=AgentGovernanceWorkbench-MQX3BH35.mjs.map
@@ -23,6 +23,12 @@ interface AgentWebAppProviderProps {
23
23
  children: React__default.ReactNode;
24
24
  onError?: (error: AgentWebAppRuntimeClientError) => void;
25
25
  fetch?: typeof globalThis.fetch;
26
+ /**
27
+ * Fetch credentials mode for runtime requests. Defaults to `"omit"` (no
28
+ * cookies). Set `"same-origin"` when a same-origin proxy/session cookie must
29
+ * accompany runtime calls.
30
+ */
31
+ credentials?: RequestCredentials;
26
32
  }
27
33
  declare function AgentWebAppProvider(props: AgentWebAppProviderProps): React__default.ReactElement;
28
34
 
@@ -23,6 +23,12 @@ interface AgentWebAppProviderProps {
23
23
  children: React__default.ReactNode;
24
24
  onError?: (error: AgentWebAppRuntimeClientError) => void;
25
25
  fetch?: typeof globalThis.fetch;
26
+ /**
27
+ * Fetch credentials mode for runtime requests. Defaults to `"omit"` (no
28
+ * cookies). Set `"same-origin"` when a same-origin proxy/session cookie must
29
+ * accompany runtime calls.
30
+ */
31
+ credentials?: RequestCredentials;
26
32
  }
27
33
  declare function AgentWebAppProvider(props: AgentWebAppProviderProps): React__default.ReactElement;
28
34
 
@@ -11,7 +11,7 @@ import {
11
11
  collapseOlderPhases,
12
12
  formatToolName,
13
13
  toolResponseText
14
- } from "./chunk-PPMYPBGP.mjs";
14
+ } from "./chunk-YGNARZGO.mjs";
15
15
  import "./chunk-G43OF5CV.mjs";
16
16
  import "./chunk-XCVYHCTY.mjs";
17
17
  import {
@@ -387,4 +387,4 @@ var MessageGraph = ({
387
387
  export {
388
388
  MessageGraph
389
389
  };
390
- //# sourceMappingURL=MessageGraph-IUDE2EDC.mjs.map
390
+ //# sourceMappingURL=MessageGraph-6EQTQAAR.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GenericDataTable
3
- } from "./chunk-PPMYPBGP.mjs";
3
+ } from "./chunk-YGNARZGO.mjs";
4
4
  import "./chunk-G43OF5CV.mjs";
5
5
  import "./chunk-XCVYHCTY.mjs";
6
6
  import "./chunk-MHCOIJGQ.mjs";
@@ -461,4 +461,4 @@ var ReactChart = (props) => {
461
461
  export {
462
462
  ReactChart
463
463
  };
464
- //# sourceMappingURL=ReactChart-TPOQ6BXW.mjs.map
464
+ //# sourceMappingURL=ReactChart-DZICSFTV.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TaskOutlineList
3
- } from "./chunk-WCBQEED7.mjs";
3
+ } from "./chunk-6XN2KL76.mjs";
4
4
  import {
5
5
  WorkflowGraphBase,
6
6
  applyDagreLayout
@@ -18,7 +18,7 @@ import {
18
18
  taskOrigin,
19
19
  useOpenTaskChat,
20
20
  useTaskCommands
21
- } from "./chunk-PPMYPBGP.mjs";
21
+ } from "./chunk-YGNARZGO.mjs";
22
22
  import {
23
23
  useWorkspaceContext
24
24
  } from "./chunk-G43OF5CV.mjs";
@@ -1179,4 +1179,4 @@ var TasksSideApp = ({ statusFilter, getOwnerLabel, showProjectFilter = true, ini
1179
1179
  export {
1180
1180
  TasksSideApp
1181
1181
  };
1182
- //# sourceMappingURL=TasksSideApp-QDLOQLZS.mjs.map
1182
+ //# sourceMappingURL=TasksSideApp-CLHMMR4L.mjs.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  WorkflowCanvas,
3
3
  expandWorkflow
4
- } from "./chunk-IIB5BEMF.mjs";
4
+ } from "./chunk-2BFZHC3S.mjs";
5
5
  import "./chunk-3YVWKHQ2.mjs";
6
6
  import {
7
7
  MDResponse
8
- } from "./chunk-PPMYPBGP.mjs";
8
+ } from "./chunk-YGNARZGO.mjs";
9
9
  import "./chunk-G43OF5CV.mjs";
10
10
  import "./chunk-XCVYHCTY.mjs";
11
11
  import {
@@ -807,4 +807,4 @@ var TopologyRuntimeView = () => {
807
807
  export {
808
808
  TopologyRuntimeView
809
809
  };
810
- //# sourceMappingURL=TopologyRuntimeView-JKGKNV7C.mjs.map
810
+ //# sourceMappingURL=TopologyRuntimeView-BLBB5PQP.mjs.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  WorkflowAutomationView,
3
3
  WorkflowAutomationView_default
4
- } from "./chunk-BFKG2OIX.mjs";
5
- import "./chunk-4AQVKTZZ.mjs";
6
- import "./chunk-IIB5BEMF.mjs";
4
+ } from "./chunk-3S4RAOOF.mjs";
5
+ import "./chunk-J7NG35IU.mjs";
6
+ import "./chunk-2BFZHC3S.mjs";
7
7
  import "./chunk-3YVWKHQ2.mjs";
8
- import "./chunk-PPMYPBGP.mjs";
8
+ import "./chunk-YGNARZGO.mjs";
9
9
  import "./chunk-G43OF5CV.mjs";
10
10
  import "./chunk-XCVYHCTY.mjs";
11
11
  import "./chunk-XC6TB6PI.mjs";
@@ -21,4 +21,4 @@ export {
21
21
  WorkflowAutomationView,
22
22
  WorkflowAutomationView_default as default
23
23
  };
24
- //# sourceMappingURL=WorkflowAutomationView-5AJ2QGM2.mjs.map
24
+ //# sourceMappingURL=WorkflowAutomationView-IPW72SR6.mjs.map
@@ -1 +1 @@
1
- "use strict";var __axiomEmbedInternal=(()=>{var _="axiom-web-app-embed";var T=["axiom:ready","axiom:unread","axiom:error","axiom:message"];function R(e,n){return{source:_,version:1,type:e,payload:n}}var J=6,ee=40,ne=500;function te(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=Object.keys(n);return t.length!==2||!t.includes("label")||!t.includes("text")?!1:typeof n.label=="string"&&n.label.length>=1&&n.label.length<=ee&&typeof n.text=="string"&&n.text.length>=1&&n.text.length<=ne}function O(e){if(!Array.isArray(e))return[];let n=[];for(let t of e){if(n.length>=J)break;te(t)&&n.push({label:t.label,text:t.text})}return n}function L(e,n){if(typeof e!="object"||e===null)return null;let t=e;return t.source!==_||t.version!==1||typeof t.type!="string"||!n.includes(t.type)?null:{type:t.type,payload:t.payload}}var oe=/^[A-Za-z0-9._:@-]{1,128}$/,ie=640,C=56,re=12,h="default";function m(e,n,t){let o=e[n];return typeof o=="number"&&Number.isFinite(o)?o:t}function u(e,n){let t=e[n];return typeof t=="string"&&t.length>0?t:null}function $(e,n,t){let o=e.offset;return typeof o!="object"||o===null?t:m(o,n,t)}function ae(e){if(e===void 0)return;if(!Array.isArray(e)){console.warn("[AxiomChat] settings.quicks must be an array; ignoring it.");return}let n=O(e);return n.length!==e.length&&console.warn(`[AxiomChat] settings.quicks: kept ${n.length} of ${e.length} entries (max 6; label 1-40; text 1-500).`),n}function D(e,n,t,o){let s=u(e,"webAppId")??n("web-app-id");if(s===null)return null;let d=u(e,"gatewayUrl")??n("gateway-url"),f=(d!==null?d:t).replace(/\/+$/,"");return{id:o,base:f,webAppId:s,mode:e.mode==="inline"||n("mode")==="inline"?"inline":"bubble",containerSelector:u(e,"containerSelector")??n("container-selector"),bubble:!(e.bubble===!1||n("bubble")==="false"),width:m(e,"width",380),height:m(e,"height",640),position:e.position==="bottom-left"||n("position")==="bottom-left"?"bottom-left":"bottom-right",offsetX:m(e,"offsetX",$(e,"x",20)),offsetY:m(e,"offsetY",$(e,"y",20)),zIndex:m(e,"zIndex",9999),userId:u(e,"userId")??n("user-id"),welcome:u(e,"welcome"),quicks:ae(e.quicks)}}function q(){return window.innerWidth<=ie}function B(e){let n=null,t=null,o=!1,s=!1,d=[],f=[],M=[];function g(i,r){let a=n;if(a===null)return;let p=a.contentWindow;p!==null&&p.postMessage(R(i,r),new URL(a.src).origin)}function N(){return e.bubble!==!1&&e.mode==="bubble"}function E(i,r){let a=e.offsetY+(N()?C+re:0),p=Math.min(e.width,Math.max(window.innerWidth-e.offsetX*2,240)),Z=Math.min(e.height,Math.max(window.innerHeight-a-e.offsetY,240));Object.assign(i.style,q()?{position:"fixed",inset:"0px",width:"100%",height:"100%",border:"none",display:r?"block":"none",zIndex:String(e.zIndex)}:{position:"fixed",bottom:`${a}px`,left:e.position==="bottom-left"?`${e.offsetX}px`:"auto",right:e.position==="bottom-right"?`${e.offsetX}px`:"auto",width:`${p}px`,height:`${Z}px`,border:"none",borderRadius:"16px",boxShadow:"0 12px 40px rgba(23, 32, 51, 0.24)",background:"#ffffff",display:r?"block":"none",zIndex:String(e.zIndex)})}function j(){let i=t;if(i===null)return;let r=e.position==="bottom-right"?{right:`${e.offsetX}px`,left:"auto"}:{left:`${e.offsetX}px`,right:"auto"};if(q()&&o){Object.assign(i.style,{...r,top:`${e.offsetY}px`,bottom:"auto"});return}Object.assign(i.style,{...r,top:"auto",bottom:`${e.offsetY}px`})}function b(){if(n!==null)return n;let i=document.createElement("iframe");if(i.src=`${e.base}/api/web-apps/${encodeURIComponent(e.webAppId)}/chat?mode=embed`,i.title="Agent chat",i.setAttribute("aria-label","Agent chat"),e.mode==="inline"){let r=e.containerSelector!==null?document.querySelector(e.containerSelector):null;r===null&&console.warn(`[AxiomChat] inline container not found: ${e.containerSelector??"(none)"}`),Object.assign(i.style,{width:"100%",height:"100%",border:"none",display:"block"}),(r??document.body).appendChild(i)}else E(i,o),document.body.appendChild(i);return i.addEventListener("load",()=>{g("axiom:hello",{webAppId:e.webAppId})}),n=i,i}function x(i){for(let r of f)r(i)}function y(){t!==null&&(t.setAttribute("aria-expanded",o?"true":"false"),j())}function w(){if(e.mode==="bubble"){let i=b();o=!0,E(i,!0)}else b();y()}function A(){e.mode!=="bubble"||n===null||(o=!1,E(n,!1),y())}function k(){o?A():w()}function X(i){if(typeof i!="object"||i===null)return!1;let r=i;return(r.role==="human"||r.role==="ai")&&typeof r.content=="string"}function S(i){if(typeof i!="string")return;let r=i.trim();if(r.length===0){x({code:"INVALID_REQUEST",message:"AxiomChat.sendMessage requires non-empty text."});return}n===null&&b(),g("axiom:send",{text:r})}function I(i){s?i():d.push(i)}function v(i){f.push(i)}function P(i){M.push(i)}function V(){if(e.bubble===!1||e.mode!=="bubble")return;let i=document.createElement("button");i.type="button",i.setAttribute("aria-label","Agent chat"),i.setAttribute("aria-expanded","false"),Object.assign(i.style,{position:"fixed",width:`${C}px`,height:`${C}px`,border:"none",borderRadius:"9999px",background:"#4f46e5",color:"#ffffff",cursor:"pointer",boxShadow:"0 8px 24px rgba(23, 32, 51, 0.28)",zIndex:String(e.zIndex+1),display:"flex",alignItems:"center",justifyContent:"center"}),i.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H9l-4.05 3.24A1 1 0 0 1 3.2 18.4V5.5Z" fill="currentColor"/></svg>',i.addEventListener("click",()=>{k()}),t=i,document.body.appendChild(i)}function W(i){let r=L(i,T);if(r!==null){if(r.type==="axiom:ready"){if(e.userId!==null&&oe.test(e.userId)){if(g("axiom:identity",{userId:e.userId}),s=!0,e.welcome!==null||e.quicks!==void 0){let a={};e.welcome!==null&&(a.welcome=e.welcome),e.quicks!==void 0&&(a.quicks=e.quicks),g("axiom:config",a)}for(let a of d)a()}else x({code:"USER_ID_REQUIRED",message:"A stable userId must be configured for the embed."});return}if(r.type==="axiom:error"){let a=r.payload;x({code:typeof a.code=="string"?a.code:"UNKNOWN",message:typeof a.message=="string"?a.message:"Unknown error"});return}if(r.type==="axiom:message"){if(!X(r.payload))return;for(let a of M)a(r.payload)}}}function F(){V(),y(),e.mode==="inline"&&b()}let K={id:e.id,open:w,hide:A,toggle:k,sendMessage:S,onReady:I,onMessage:P,onError:v};return{settings:e,handle:K,getPanel:()=>n,activate:F,open:w,hide:A,toggle:k,sendMessage:S,registerReady:I,registerError:v,registerMessage:P,handleIncoming:W}}var c=new Map;function se(e){let n=e,t=2;for(;c.has(n);)n=`${e}-${t}`,t+=1;return n}function Q(e){if(typeof e!="object"||e===null)throw new Error("[AxiomChat] mount(settings) requires a settings object with a webAppId.");let n=e;if(u(n,"webAppId")===null)throw new Error("[AxiomChat] mount(settings) requires a webAppId.");let t=u(n,"id");if(t!==null){let f=c.get(t);if(f!==void 0)return console.warn(`[AxiomChat] mount: instance id "${t}" is already in use; returning the existing instance.`),f.handle}let o=t??se(u(n,"webAppId")??""),s=D(n,()=>null,Y,o);if(s===null)throw new Error("[AxiomChat] mount(settings) requires a webAppId.");let d=B(s);return c.set(o,d),d.activate(),d.handle}function le(e){return c.get(e)?.handle}function l(e){let n=c.get(h);if(n===void 0){console.warn("[AxiomChat] not configured");return}e(n)}function H(e){if(Array.isArray(e)===!1)return;let[n,t]=e;if(n==="mount"){try{Q(t)}catch(o){console.warn("[AxiomChat] mount failed:",o)}return}if(n==="onReady"&&typeof t=="function"){l(o=>o.registerReady(t));return}if(n==="onError"&&typeof t=="function"){l(o=>o.registerError(t));return}if(n==="onMessage"&&typeof t=="function"){l(o=>o.registerMessage(t));return}if(n==="sendMessage"&&typeof t=="string"){l(o=>o.sendMessage(t));return}n==="open"?l(o=>o.open()):n==="hide"?l(o=>o.hide()):n==="toggle"&&l(o=>o.toggle())}function U(e){for(let n of c.values()){let t=n.getPanel();if(t!==null&&e.origin===new URL(t.src).origin&&!(e.source===null||e.source!==t.contentWindow)){n.handleIncoming(e.data);return}}}var G="__axiomChatMessageListener";function de(){let e=window,n=e[G];typeof n=="function"&&window.removeEventListener("message",n),e[G]=U,window.addEventListener("message",U)}function ue(e){if(e===null||e.length===0)return window.location.origin;try{let n=new URL(e),o=n.pathname.lastIndexOf("/embed/"),s=o>=0?n.pathname.slice(0,o):"";return`${n.origin}${s}`}catch{return window.location.origin}}var z=document.currentScript,ce=z?.src||null,Y=ue(ce);function fe(){let e=t=>{let o=z?.getAttribute(`data-${t}`);return typeof o=="string"&&o.length>0?o:null},n=window.AxiomChatSettings??{};return D(n,e,Y,h)}function me(){let e=fe();e!==null?c.set(h,B(e)):console.warn("[AxiomChat] Missing webAppId (set window.AxiomChatSettings.webAppId or data-web-app-id)."),de();let n=(o=>{o!==void 0&&H(o)});n.open=()=>l(o=>o.open()),n.hide=()=>l(o=>o.hide()),n.toggle=()=>l(o=>o.toggle()),n.sendMessage=o=>l(s=>s.sendMessage(o)),n.mount=Q,n.get=le;let t=window.AxiomChat;if(Array.isArray(t))for(let o of t)H(o);window.AxiomChat=n,c.get(h)?.activate()}me();})();
1
+ "use strict";var __axiomEmbedInternal=(()=>{var P="axiom-web-app-embed";var T=["axiom:ready","axiom:unread","axiom:error","axiom:message"];function R(e,n){return{source:P,version:1,type:e,payload:n}}var O=["omit","same-origin","include"],ee=6,ne=40,te=500;function oe(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=e,t=Object.keys(n);return t.length!==2||!t.includes("label")||!t.includes("text")?!1:typeof n.label=="string"&&n.label.length>=1&&n.label.length<=ne&&typeof n.text=="string"&&n.text.length>=1&&n.text.length<=te}function L(e){if(!Array.isArray(e))return[];let n=[];for(let t of e){if(n.length>=ee)break;oe(t)&&n.push({label:t.label,text:t.text})}return n}function D(e,n){if(typeof e!="object"||e===null)return null;let t=e;return t.source!==P||t.version!==1||typeof t.type!="string"||!n.includes(t.type)?null:{type:t.type,payload:t.payload}}var ie=/^[A-Za-z0-9._:@-]{1,128}$/,re=640,C=56,ae=12,h="default";function m(e,n,t){let o=e[n];return typeof o=="number"&&Number.isFinite(o)?o:t}function c(e,n){let t=e[n];return typeof t=="string"&&t.length>0?t:null}function $(e,n,t){let o=e.offset;return typeof o!="object"||o===null?t:m(o,n,t)}function se(e){return e!==null&&O.includes(e)?e:null}function le(e){if(e===void 0)return;if(!Array.isArray(e)){console.warn("[AxiomChat] settings.quicks must be an array; ignoring it.");return}let n=L(e);return n.length!==e.length&&console.warn(`[AxiomChat] settings.quicks: kept ${n.length} of ${e.length} entries (max 6; label 1-40; text 1-500).`),n}function G(e,n,t,o){let s=c(e,"webAppId")??n("web-app-id");if(s===null)return null;let d=c(e,"gatewayUrl")??n("gateway-url"),f=(d!==null?d:t).replace(/\/+$/,"");return{id:o,base:f,webAppId:s,mode:e.mode==="inline"||n("mode")==="inline"?"inline":"bubble",containerSelector:c(e,"containerSelector")??n("container-selector"),bubble:!(e.bubble===!1||n("bubble")==="false"),width:m(e,"width",380),height:m(e,"height",640),position:e.position==="bottom-left"||n("position")==="bottom-left"?"bottom-left":"bottom-right",offsetX:m(e,"offsetX",$(e,"x",20)),offsetY:m(e,"offsetY",$(e,"y",20)),zIndex:m(e,"zIndex",9999),userId:c(e,"userId")??n("user-id"),welcome:c(e,"welcome"),quicks:le(e.quicks),credentials:se(c(e,"credentials")??n("credentials"))}}function q(){return window.innerWidth<=re}function z(e){let n=null,t=null,o=!1,s=!1,d=[],f=[],k=[];function g(i,r){let a=n;if(a===null)return;let p=a.contentWindow;p!==null&&p.postMessage(R(i,r),new URL(a.src).origin)}function j(){return e.bubble!==!1&&e.mode==="bubble"}function E(i,r){let a=e.offsetY+(j()?C+ae:0),p=Math.min(e.width,Math.max(window.innerWidth-e.offsetX*2,240)),J=Math.min(e.height,Math.max(window.innerHeight-a-e.offsetY,240));Object.assign(i.style,q()?{position:"fixed",inset:"0px",width:"100%",height:"100%",border:"none",display:r?"block":"none",zIndex:String(e.zIndex)}:{position:"fixed",bottom:`${a}px`,left:e.position==="bottom-left"?`${e.offsetX}px`:"auto",right:e.position==="bottom-right"?`${e.offsetX}px`:"auto",width:`${p}px`,height:`${J}px`,border:"none",borderRadius:"16px",boxShadow:"0 12px 40px rgba(23, 32, 51, 0.24)",background:"#ffffff",display:r?"block":"none",zIndex:String(e.zIndex)})}function X(){let i=t;if(i===null)return;let r=e.position==="bottom-right"?{right:`${e.offsetX}px`,left:"auto"}:{left:`${e.offsetX}px`,right:"auto"};if(q()&&o){Object.assign(i.style,{...r,top:`${e.offsetY}px`,bottom:"auto"});return}Object.assign(i.style,{...r,top:"auto",bottom:`${e.offsetY}px`})}function b(){if(n!==null)return n;let i=document.createElement("iframe");if(i.src=`${e.base}/api/web-apps/${encodeURIComponent(e.webAppId)}/chat?mode=embed`,i.title="Agent chat",i.setAttribute("aria-label","Agent chat"),e.mode==="inline"){let r=e.containerSelector!==null?document.querySelector(e.containerSelector):null;r===null&&console.warn(`[AxiomChat] inline container not found: ${e.containerSelector??"(none)"}`),Object.assign(i.style,{width:"100%",height:"100%",border:"none",display:"block"}),(r??document.body).appendChild(i)}else E(i,o),document.body.appendChild(i);return i.addEventListener("load",()=>{g("axiom:hello",{webAppId:e.webAppId})}),n=i,i}function x(i){for(let r of f)r(i)}function y(){t!==null&&(t.setAttribute("aria-expanded",o?"true":"false"),X())}function w(){if(e.mode==="bubble"){let i=b();o=!0,E(i,!0)}else b();y()}function A(){e.mode!=="bubble"||n===null||(o=!1,E(n,!1),y())}function M(){o?A():w()}function V(i){if(typeof i!="object"||i===null)return!1;let r=i;return(r.role==="human"||r.role==="ai")&&typeof r.content=="string"}function S(i){if(typeof i!="string")return;let r=i.trim();if(r.length===0){x({code:"INVALID_REQUEST",message:"AxiomChat.sendMessage requires non-empty text."});return}n===null&&b(),g("axiom:send",{text:r})}function I(i){s?i():d.push(i)}function v(i){f.push(i)}function _(i){k.push(i)}function W(){if(e.bubble===!1||e.mode!=="bubble")return;let i=document.createElement("button");i.type="button",i.setAttribute("aria-label","Agent chat"),i.setAttribute("aria-expanded","false"),Object.assign(i.style,{position:"fixed",width:`${C}px`,height:`${C}px`,border:"none",borderRadius:"9999px",background:"#4f46e5",color:"#ffffff",cursor:"pointer",boxShadow:"0 8px 24px rgba(23, 32, 51, 0.28)",zIndex:String(e.zIndex+1),display:"flex",alignItems:"center",justifyContent:"center"}),i.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H9l-4.05 3.24A1 1 0 0 1 3.2 18.4V5.5Z" fill="currentColor"/></svg>',i.addEventListener("click",()=>{M()}),t=i,document.body.appendChild(i)}function F(i){let r=D(i,T);if(r!==null){if(r.type==="axiom:ready"){if(e.userId!==null&&ie.test(e.userId)){if(g("axiom:identity",{userId:e.userId}),s=!0,e.welcome!==null||e.quicks!==void 0||e.credentials!==null){let a={};e.welcome!==null&&(a.welcome=e.welcome),e.quicks!==void 0&&(a.quicks=e.quicks),e.credentials!==null&&(a.credentials=e.credentials),g("axiom:config",a)}for(let a of d)a()}else x({code:"USER_ID_REQUIRED",message:"A stable userId must be configured for the embed."});return}if(r.type==="axiom:error"){let a=r.payload;x({code:typeof a.code=="string"?a.code:"UNKNOWN",message:typeof a.message=="string"?a.message:"Unknown error"});return}if(r.type==="axiom:message"){if(!V(r.payload))return;for(let a of k)a(r.payload)}}}function K(){W(),y(),e.mode==="inline"&&b()}let Z={id:e.id,open:w,hide:A,toggle:M,sendMessage:S,onReady:I,onMessage:_,onError:v};return{settings:e,handle:Z,getPanel:()=>n,activate:K,open:w,hide:A,toggle:M,sendMessage:S,registerReady:I,registerError:v,registerMessage:_,handleIncoming:F}}var u=new Map;function de(e){let n=e,t=2;for(;u.has(n);)n=`${e}-${t}`,t+=1;return n}function N(e){if(typeof e!="object"||e===null)throw new Error("[AxiomChat] mount(settings) requires a settings object with a webAppId.");let n=e;if(c(n,"webAppId")===null)throw new Error("[AxiomChat] mount(settings) requires a webAppId.");let t=c(n,"id");if(t!==null){let f=u.get(t);if(f!==void 0)return console.warn(`[AxiomChat] mount: instance id "${t}" is already in use; returning the existing instance.`),f.handle}let o=t??de(c(n,"webAppId")??""),s=G(n,()=>null,Y,o);if(s===null)throw new Error("[AxiomChat] mount(settings) requires a webAppId.");let d=z(s);return u.set(o,d),d.activate(),d.handle}function ce(e){return u.get(e)?.handle}function l(e){let n=u.get(h);if(n===void 0){console.warn("[AxiomChat] not configured");return}e(n)}function H(e){if(Array.isArray(e)===!1)return;let[n,t]=e;if(n==="mount"){try{N(t)}catch(o){console.warn("[AxiomChat] mount failed:",o)}return}if(n==="onReady"&&typeof t=="function"){l(o=>o.registerReady(t));return}if(n==="onError"&&typeof t=="function"){l(o=>o.registerError(t));return}if(n==="onMessage"&&typeof t=="function"){l(o=>o.registerMessage(t));return}if(n==="sendMessage"&&typeof t=="string"){l(o=>o.sendMessage(t));return}n==="open"?l(o=>o.open()):n==="hide"?l(o=>o.hide()):n==="toggle"&&l(o=>o.toggle())}function B(e){for(let n of u.values()){let t=n.getPanel();if(t!==null&&e.origin===new URL(t.src).origin&&!(e.source===null||e.source!==t.contentWindow)){n.handleIncoming(e.data);return}}}var U="__axiomChatMessageListener";function ue(){let e=window,n=e[U];typeof n=="function"&&window.removeEventListener("message",n),e[U]=B,window.addEventListener("message",B)}function fe(e){if(e===null||e.length===0)return window.location.origin;try{let n=new URL(e),o=n.pathname.lastIndexOf("/embed/"),s=o>=0?n.pathname.slice(0,o):"";return`${n.origin}${s}`}catch{return window.location.origin}}var Q=document.currentScript,me=Q?.src||null,Y=fe(me);function ge(){let e=t=>{let o=Q?.getAttribute(`data-${t}`);return typeof o=="string"&&o.length>0?o:null},n=window.AxiomChatSettings??{};return G(n,e,Y,h)}function be(){let e=ge();e!==null?u.set(h,z(e)):console.warn("[AxiomChat] Missing webAppId (set window.AxiomChatSettings.webAppId or data-web-app-id)."),ue();let n=(o=>{o!==void 0&&H(o)});n.open=()=>l(o=>o.open()),n.hide=()=>l(o=>o.hide()),n.toggle=()=>l(o=>o.toggle()),n.sendMessage=o=>l(s=>s.sendMessage(o)),n.mount=N,n.get=ce;let t=window.AxiomChat;if(Array.isArray(t))for(let o of t)H(o);window.AxiomChat=n,u.get(h)?.activate()}be();})();
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-3YVWKHQ2.mjs";
6
6
  import {
7
7
  MDResponse
8
- } from "./chunk-PPMYPBGP.mjs";
8
+ } from "./chunk-YGNARZGO.mjs";
9
9
  import {
10
10
  Handle,
11
11
  MarkerType,
@@ -1087,4 +1087,4 @@ export {
1087
1087
  WorkflowCanvas_default,
1088
1088
  expandWorkflow
1089
1089
  };
1090
- //# sourceMappingURL=chunk-IIB5BEMF.mjs.map
1090
+ //# sourceMappingURL=chunk-2BFZHC3S.mjs.map
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  CopilotPanel,
3
3
  TrainingContextCard
4
- } from "./chunk-4AQVKTZZ.mjs";
4
+ } from "./chunk-J7NG35IU.mjs";
5
5
  import {
6
6
  WorkflowCanvas_default,
7
7
  expandWorkflow
8
- } from "./chunk-IIB5BEMF.mjs";
8
+ } from "./chunk-2BFZHC3S.mjs";
9
9
  import {
10
10
  MDResponse,
11
11
  ProjectScopeProvider
12
- } from "./chunk-PPMYPBGP.mjs";
12
+ } from "./chunk-YGNARZGO.mjs";
13
13
  import {
14
14
  useWorkspaceContext
15
15
  } from "./chunk-G43OF5CV.mjs";
@@ -1283,4 +1283,4 @@ export {
1283
1283
  WorkflowAutomationView,
1284
1284
  WorkflowAutomationView_default
1285
1285
  };
1286
- //# sourceMappingURL=chunk-BFKG2OIX.mjs.map
1286
+ //# sourceMappingURL=chunk-3S4RAOOF.mjs.map
@@ -4,7 +4,7 @@ import {
4
4
  TaskActionsButton,
5
5
  isHiddenStatus,
6
6
  taskOrigin
7
- } from "./chunk-PPMYPBGP.mjs";
7
+ } from "./chunk-YGNARZGO.mjs";
8
8
  import {
9
9
  useT
10
10
  } from "./chunk-NBXUIQIA.mjs";
@@ -491,4 +491,4 @@ var TaskOutlineList = ({
491
491
  export {
492
492
  TaskOutlineList
493
493
  };
494
- //# sourceMappingURL=chunk-WCBQEED7.mjs.map
494
+ //# sourceMappingURL=chunk-6XN2KL76.mjs.map
@@ -252,10 +252,12 @@ var AgentWebAppRuntimeClient = class {
252
252
  this.options = options;
253
253
  this.baseUrl = `${options.gatewayUrl.replace(/\/+$/, "")}/api/web-apps/${encodeURIComponent(options.webAppId)}/runtime`;
254
254
  this.fetchImplementation = options.fetch ?? globalThis.fetch.bind(globalThis);
255
+ this.credentials = options.credentials ?? "omit";
255
256
  this.translate = options.translate;
256
257
  }
257
258
  baseUrl;
258
259
  fetchImplementation;
260
+ credentials;
259
261
  translate;
260
262
  async bootstrap(selection = {}, signal) {
261
263
  return this.request("bootstrap", parseBootstrap, { query: selection, signal });
@@ -464,7 +466,7 @@ var AgentWebAppRuntimeClient = class {
464
466
  headers.set("Content-Type", "application/json");
465
467
  body = JSON.stringify(options.body);
466
468
  }
467
- return this.fetchImplementation(url, { method: options.method ?? "GET", headers, body, signal: options.signal, credentials: "omit" });
469
+ return this.fetchImplementation(url, { method: options.method ?? "GET", headers, body, signal: options.signal, credentials: this.credentials });
468
470
  }
469
471
  async throwResponseError(response) {
470
472
  let value;
@@ -488,4 +490,4 @@ export {
488
490
  AgentWebAppRuntimeClientError,
489
491
  AgentWebAppRuntimeClient
490
492
  };
491
- //# sourceMappingURL=chunk-DTZPCOY2.mjs.map
493
+ //# sourceMappingURL=chunk-FVJMVJR2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/integrations/web-app/error.ts","../src/integrations/web-app/sse-parser.ts","../src/integrations/web-app/client.ts"],"sourcesContent":["import type { AgentWebAppErrorCode } from \"./types\";\n\nexport class AgentWebAppRuntimeClientError extends Error {\n readonly code: AgentWebAppErrorCode;\n readonly retryable: boolean;\n readonly status?: number;\n\n constructor(code: AgentWebAppErrorCode, message: string, retryable: boolean, status?: number) {\n super(message);\n this.name = \"AgentWebAppRuntimeClientError\";\n this.code = code;\n this.retryable = retryable;\n this.status = status;\n }\n}\n\nexport function streamFailed(): AgentWebAppRuntimeClientError {\n return new AgentWebAppRuntimeClientError(\"STREAM_FAILED\", \"Stream failed\", true);\n}\n","import { streamFailed } from \"./error\";\nimport {\n MessageChunkTypes,\n createAgentWebAppStreamProjectionContext,\n parseAgentWebAppGenUIBlock,\n projectAgentWebAppChunk,\n type AgentWebAppStreamProjectionContext,\n} from \"@axiom-lattice/protocols\";\nimport type {\n AgentWebAppError,\n AgentWebAppErrorCode,\n AgentWebAppInterrupt,\n AgentWebAppStreamEvent,\n AgentWebAppStreamEventHandler,\n} from \"./types\";\n\nconst errorCodes = new Set<AgentWebAppErrorCode>([\n \"WEB_APP_NOT_FOUND\", \"WEB_APP_DISABLED\", \"USER_ID_REQUIRED\", \"INVALID_USER_ID\",\n \"PROJECT_NOT_ALLOWED\", \"PROJECT_SELECTOR_DISABLED\", \"MODEL_NOT_ALLOWED\", \"FEATURE_DISABLED\",\n \"THREAD_NOT_FOUND\", \"STREAM_CONFLICT\", \"STREAM_FAILED\", \"INVALID_REQUEST\", \"INTERNAL_ERROR\",\n]);\n\nfunction record(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction exact(value: Record<string, unknown>, keys: string[]): boolean {\n const actual = Object.keys(value);\n return actual.length === keys.length && keys.every((key) => key in value);\n}\n\nfunction validError(value: unknown): value is AgentWebAppError {\n return record(value)\n && exact(value, [\"code\", \"message\", \"retryable\"])\n && typeof value.code === \"string\" && errorCodes.has(value.code as AgentWebAppErrorCode)\n && typeof value.message === \"string\" && typeof value.retryable === \"boolean\";\n}\n\nfunction validInterrupt(value: unknown): value is AgentWebAppInterrupt {\n if (!record(value)) return false;\n const keys = value.data === undefined ? [\"id\", \"type\", \"prompt\"] : [\"id\", \"type\", \"prompt\", \"data\"];\n return exact(value, keys) && typeof value.id === \"string\" && typeof value.type === \"string\"\n && typeof value.prompt === \"string\" && (value.data === undefined || record(value.data));\n}\n\nconst nativeChunkTypes = new Set<string>([\n MessageChunkTypes.HUMAN, MessageChunkTypes.AI, MessageChunkTypes.TOOL,\n MessageChunkTypes.INTERRUPT, MessageChunkTypes.MESSAGE_COMPLETED,\n MessageChunkTypes.MESSAGE_FAILED, MessageChunkTypes.THREAD_IDLE,\n]);\n\nfunction parseEvents(data: string, projection: AgentWebAppStreamProjectionContext): AgentWebAppStreamEvent[] {\n let value: unknown;\n try { value = JSON.parse(data); } catch { throw streamFailed(); }\n if (!record(value) || typeof value.type !== \"string\") throw streamFailed();\n // Native run-protocol chunk (the gateway's messages/stream since Phase 2).\n if (nativeChunkTypes.has(value.type) || (value.type === \"error\" && record(value.data) && !record(value.error))) {\n const projected = projectAgentWebAppChunk(value as never, projection);\n if (projected.length === 0) return [];\n return projected;\n }\n // Legacy projected public event (gateway /v1 path or an older gateway).\n switch (value.type) {\n case \"message.delta\":\n if (exact(value, [\"type\", \"text\"]) && typeof value.text === \"string\") return [value as unknown as AgentWebAppStreamEvent];\n break;\n case \"message.completed\":\n if (exact(value, [\"type\", \"messageId\"]) && typeof value.messageId === \"string\") return [value as unknown as AgentWebAppStreamEvent];\n break;\n case \"tool.started\":\n if (exact(value, [\"type\", \"id\", \"name\"]) && typeof value.id === \"string\" && typeof value.name === \"string\") return [value as unknown as AgentWebAppStreamEvent];\n break;\n case \"tool.completed\":\n if (exact(value, [\"type\", \"id\"]) && typeof value.id === \"string\") return [value as unknown as AgentWebAppStreamEvent];\n break;\n case \"interrupt.created\":\n if (exact(value, [\"type\", \"interrupt\"]) && validInterrupt(value.interrupt)) return [value as unknown as AgentWebAppStreamEvent];\n break;\n case \"genui.render\":\n if (exact(value, [\"type\", \"block\"]) && parseAgentWebAppGenUIBlock(value.block)) return [value as unknown as AgentWebAppStreamEvent];\n break;\n case \"error\":\n if (exact(value, [\"type\", \"error\"]) && validError(value.error)) return [value as unknown as AgentWebAppStreamEvent];\n break;\n case \"stream.completed\":\n if (exact(value, [\"type\"])) return [value as unknown as AgentWebAppStreamEvent];\n break;\n }\n throw streamFailed();\n}\n\nfunction isAbortError(error: unknown): boolean {\n return error instanceof Error && error.name === \"AbortError\";\n}\n\nexport async function parseAgentWebAppEventStream(\n body: ReadableStream<Uint8Array>,\n onEvent: AgentWebAppStreamEventHandler,\n): Promise<void> {\n const projection = createAgentWebAppStreamProjectionContext({ allowGenUI: true, allowInterrupts: true });\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n let completed = false;\n let reachedEof = false;\n try {\n while (!completed) {\n let result: ReadableStreamReadResult<Uint8Array>;\n try { result = await reader.read(); }\n catch (error) {\n if (isAbortError(error)) return;\n throw streamFailed();\n }\n if (result.done) reachedEof = true;\n try { buffer += decoder.decode(result.value, { stream: !result.done }); }\n catch { throw streamFailed(); }\n const blocks = buffer.split(/\\r?\\n\\r?\\n/);\n buffer = result.done ? \"\" : blocks.pop() ?? \"\";\n for (const block of blocks) {\n const data = block.split(/\\r?\\n/)\n .filter((line) => line === \"data\" || line.startsWith(\"data:\"))\n .map((line) => line === \"data\" ? \"\" : line.slice(5).replace(/^ /, \"\"));\n if (data.length === 0) continue;\n for (const event of parseEvents(data.join(\"\\n\"), projection)) {\n await onEvent(event);\n completed = event.type === \"stream.completed\";\n if (completed) break;\n }\n if (completed) break;\n }\n if (result.done) break;\n }\n if (!completed) throw streamFailed();\n } finally {\n if (!reachedEof) {\n try { await reader.cancel(); } catch { /* Best-effort cleanup must not replace the primary outcome. */ }\n }\n reader.releaseLock();\n }\n}\n","import { AgentWebAppRuntimeClientError } from \"./error\";\nimport { parseAgentWebAppEventStream } from \"./sse-parser\";\nimport {\n MessageChunkTypes,\n createAgentWebAppStreamProjectionContext,\n parseAgentWebAppGenUIBlock,\n projectAgentWebAppChunk,\n type AgentInterrupt,\n type MessageChunk,\n} from \"@axiom-lattice/protocols\";\nimport type { SdkTFunction } from \"../../i18n\";\nimport type {\n AgentWebAppAttachment,\n AgentWebAppBootstrap,\n AgentWebAppCreateThreadInput,\n AgentWebAppError,\n AgentWebAppMessageList,\n AgentWebAppProjectSelection,\n AgentWebAppResumeInterruptInput,\n AgentWebAppRuntimeClientOptions,\n AgentWebAppRuntimeSelection,\n AgentWebAppRuntimeThread,\n AgentWebAppStreamEvent,\n AgentWebAppStreamEventHandler,\n AgentWebAppStreamMessageInput,\n AgentWebAppThreadList,\n AgentWebAppUpdateThreadInput,\n} from \"./types\";\n\ninterface ErrorEnvelope { success: false; error: AgentWebAppError }\n\nconst errorCodes = new Set<AgentWebAppError[\"code\"]>([\n \"WEB_APP_NOT_FOUND\", \"WEB_APP_DISABLED\", \"USER_ID_REQUIRED\", \"INVALID_USER_ID\",\n \"PROJECT_NOT_ALLOWED\", \"PROJECT_SELECTOR_DISABLED\", \"MODEL_NOT_ALLOWED\", \"FEATURE_DISABLED\",\n \"THREAD_NOT_FOUND\", \"STREAM_CONFLICT\", \"STREAM_FAILED\",\n \"RUN_CANCEL_UNAVAILABLE\", \"RUN_CANCEL_STORE_UNAVAILABLE\", \"INVALID_REQUEST\", \"INTERNAL_ERROR\",\n]);\n\nfunction record(value: unknown): value is Record<string, unknown> {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction exact(value: Record<string, unknown>, required: string[], optional: string[] = []): boolean {\n const keys = Object.keys(value);\n return required.every((key) => key in value) && keys.every((key) => required.includes(key) || optional.includes(key));\n}\n\nfunction string(value: unknown): value is string { return typeof value === \"string\"; }\n\nfunction parseThread(value: unknown): AgentWebAppRuntimeThread | undefined {\n if (!record(value) || !exact(value, [\"id\", \"projectId\", \"createdAt\", \"updatedAt\"], [\"label\"])) return undefined;\n if (!string(value.id) || !string(value.projectId) || (value.label !== undefined && !string(value.label))) return undefined;\n if (!string(value.createdAt) || !string(value.updatedAt)) return undefined;\n const createdAt = new Date(value.createdAt); const updatedAt = new Date(value.updatedAt);\n if (Number.isNaN(createdAt.getTime()) || Number.isNaN(updatedAt.getTime())) return undefined;\n return { id: value.id, projectId: value.projectId, ...(value.label === undefined ? {} : { label: value.label }), createdAt, updatedAt };\n}\n\nfunction isErrorEnvelope(value: unknown): value is ErrorEnvelope {\n if (!record(value) || value.success !== false || !record(value.error)) return false;\n const error = value.error;\n return exact(value, [\"success\", \"error\"])\n && exact(error, [\"code\", \"message\", \"retryable\"])\n && typeof error.code === \"string\" && errorCodes.has(error.code as AgentWebAppError[\"code\"])\n && typeof error.message === \"string\" && typeof error.retryable === \"boolean\";\n}\n\nfunction validFeatures(value: unknown): boolean {\n if (!record(value)) return false;\n const keys = [\"projectSelector\", \"modelSelector\", \"threadManagement\", \"attachments\", \"hitl\", \"genUI\"];\n return exact(value, keys, [\"files\"]) && keys.every((key) => typeof value[key] === \"boolean\")\n && (value.files === undefined || typeof value.files === \"boolean\");\n}\n\nfunction validQuickPrompts(value: unknown): boolean {\n return Array.isArray(value)\n && value.length <= 6\n && value.every((prompt) => record(prompt)\n && exact(prompt, [\"label\", \"text\"])\n && string(prompt.label) && prompt.label.length >= 1 && prompt.label.length <= 40\n && string(prompt.text) && prompt.text.length >= 1 && prompt.text.length <= 500);\n}\n\nfunction validAppearance(value: unknown): boolean {\n return record(value) && exact(value, [], [\"title\", \"welcomeMessage\", \"primaryColor\", \"quickPrompts\"])\n && (value.title === undefined || string(value.title))\n && (value.welcomeMessage === undefined || string(value.welcomeMessage))\n && (value.primaryColor === undefined || string(value.primaryColor))\n && (value.quickPrompts === undefined || validQuickPrompts(value.quickPrompts));\n}\n\nfunction parseBootstrap(value: unknown): AgentWebAppBootstrap | undefined {\n if (!record(value) || !exact(value, [\"webApp\", \"projects\", \"models\"], [\"thread\"]) || !record(value.webApp)) return undefined;\n const webApp = value.webApp;\n if (!exact(webApp, [\"id\", \"name\", \"assistant\", \"defaultProjectId\", \"features\", \"appearance\", \"identityAssurance\"], [\"description\", \"defaultModelKey\"])\n || !string(webApp.id) || !string(webApp.name) || !string(webApp.defaultProjectId)\n || (webApp.description !== undefined && !string(webApp.description)) || (webApp.defaultModelKey !== undefined && !string(webApp.defaultModelKey))\n || webApp.identityAssurance !== \"unverified\" || !record(webApp.assistant)\n || !exact(webApp.assistant, [\"id\", \"name\"], [\"description\"]) || !string(webApp.assistant.id) || !string(webApp.assistant.name)\n || (webApp.assistant.description !== undefined && !string(webApp.assistant.description))\n || !validFeatures(webApp.features) || !validAppearance(webApp.appearance)\n || !Array.isArray(value.projects) || !value.projects.every((item) => record(item) && exact(item, [\"id\", \"name\"]) && string(item.id) && string(item.name))\n || !Array.isArray(value.models) || !value.models.every((item) => record(item) && exact(item, [\"key\", \"label\"]) && string(item.key) && string(item.label))) return undefined;\n const thread = value.thread === undefined ? undefined : parseThread(value.thread);\n if (value.thread !== undefined && !thread) return undefined;\n return { ...value, ...(thread ? { thread } : {}) } as unknown as AgentWebAppBootstrap;\n}\n\nfunction parseThreadList(value: unknown): AgentWebAppThreadList | undefined {\n if (!record(value) || !exact(value, [\"records\", \"total\"]) || !Array.isArray(value.records) || typeof value.total !== \"number\") return undefined;\n const records = value.records.map(parseThread);\n return records.every((item): item is AgentWebAppRuntimeThread => item !== undefined) ? { records, total: value.total } : undefined;\n}\n\nfunction validMessage(value: unknown): boolean {\n return record(value) && string(value.id) && (value.role === \"human\" || value.role === \"ai\")\n && (value.content === undefined || string(value.content)\n || (Array.isArray(value.content) && value.content.every((block) => parseAgentWebAppGenUIBlock(block) !== undefined)));\n}\n\nfunction parseMessages(value: unknown): AgentWebAppMessageList | undefined {\n return record(value) && exact(value, [\"messages\"]) && Array.isArray(value.messages) && value.messages.every(validMessage)\n ? value as unknown as AgentWebAppMessageList : undefined;\n}\n\nfunction parseAttachment(value: unknown): AgentWebAppAttachment | undefined {\n return record(value) && exact(value, [\"ref\", \"name\", \"mimeType\", \"size\"])\n && string(value.ref) && string(value.name) && string(value.mimeType) && typeof value.size === \"number\"\n ? value as unknown as AgentWebAppAttachment : undefined;\n}\n\nfunction objectWith<T>(keys: string[], checks: (value: Record<string, unknown>) => boolean): (value: unknown) => T | undefined {\n return (value) => record(value) && exact(value, keys) && checks(value) ? value as unknown as T : undefined;\n}\n\ninterface RuntimeThreadEvent {\n type?: string;\n seq?: string;\n params?: { data?: unknown };\n}\n\nfunction toWidgetInterrupt(interrupt: AgentInterrupt) {\n const payload = record(interrupt.payload) ? interrupt.payload : {};\n const prompt = typeof payload.prompt === \"string\"\n ? payload.prompt\n : typeof payload.message === \"string\" ? payload.message : \"Input required\";\n return {\n id: interrupt.interruptId,\n type: interrupt.type,\n prompt,\n ...(record(payload.data) ? { data: payload.data } : {}),\n };\n}\n\nexport class AgentWebAppRuntimeClient {\n private readonly baseUrl: string;\n private readonly fetchImplementation: typeof globalThis.fetch;\n private readonly credentials: RequestCredentials;\n private readonly translate?: SdkTFunction;\n\n constructor(private readonly options: AgentWebAppRuntimeClientOptions) {\n this.baseUrl = `${options.gatewayUrl.replace(/\\/+$/, \"\")}/api/web-apps/${encodeURIComponent(options.webAppId)}/runtime`;\n this.fetchImplementation = options.fetch ?? globalThis.fetch.bind(globalThis);\n this.credentials = options.credentials ?? \"omit\";\n this.translate = options.translate;\n }\n\n async bootstrap(selection: AgentWebAppRuntimeSelection = {}, signal?: AbortSignal): Promise<AgentWebAppBootstrap> {\n return this.request(\"bootstrap\", parseBootstrap, { query: selection, signal });\n }\n\n async listThreads(selection: AgentWebAppProjectSelection = {}, signal?: AbortSignal): Promise<AgentWebAppThreadList> {\n return this.request(\"threads\", parseThreadList, { query: selection, signal });\n }\n\n async createThread(input: AgentWebAppCreateThreadInput = {}, signal?: AbortSignal): Promise<AgentWebAppRuntimeThread> {\n return this.request(\"threads\", parseThread, { method: \"POST\", body: input, signal });\n }\n\n async updateThread(threadId: string, input: AgentWebAppUpdateThreadInput, signal?: AbortSignal): Promise<AgentWebAppRuntimeThread> {\n return this.request(`threads/${encodeURIComponent(threadId)}`, parseThread, { method: \"PATCH\", body: input, signal });\n }\n\n async deleteThread(threadId: string, selection: AgentWebAppProjectSelection = {}, signal?: AbortSignal): Promise<void> {\n await this.request(`threads/${encodeURIComponent(threadId)}`, objectWith<{ id: string }>([\"id\"], (value) => string(value.id)), { method: \"DELETE\", query: selection, signal });\n }\n\n async getMessages(threadId: string, selection: AgentWebAppProjectSelection = {}, signal?: AbortSignal): Promise<AgentWebAppMessageList> {\n return this.request(`threads/${encodeURIComponent(threadId)}/messages`, parseMessages, { query: selection, signal });\n }\n\n async streamMessage(threadId: string, input: AgentWebAppStreamMessageInput, onEvent: AgentWebAppStreamEventHandler, signal?: AbortSignal): Promise<void> {\n return this.streamRequest(`threads/${encodeURIComponent(threadId)}/messages/stream`, input, onEvent, signal);\n }\n\n async resumeInterrupt(threadId: string, interruptId: string, input: AgentWebAppResumeInterruptInput, onEvent: AgentWebAppStreamEventHandler, signal?: AbortSignal): Promise<void> {\n return this.streamRequest(`threads/${encodeURIComponent(threadId)}/interrupts/${encodeURIComponent(interruptId)}/resume`, input, onEvent, signal);\n }\n\n private async streamRequest(path: string, body: object, onEvent: AgentWebAppStreamEventHandler, signal?: AbortSignal): Promise<void> {\n let response: Response;\n try {\n response = await this.fetchRequest(path, { method: \"POST\", body, signal });\n } catch (error) {\n if (isAbortError(error)) throw error;\n if (error instanceof AgentWebAppRuntimeClientError) throw error;\n throw new AgentWebAppRuntimeClientError(\"STREAM_FAILED\", this.translate?.(\"integration.error.streamFailed\") ?? \"Stream failed\", true);\n }\n if (!response.ok) await this.throwResponseError(response);\n if (!response.body || !response.headers.get(\"content-type\")?.toLowerCase().includes(\"text/event-stream\")) {\n if (response.body) try { await response.body.cancel(); } catch { /* Best effort. */ }\n throw new AgentWebAppRuntimeClientError(\"STREAM_FAILED\", this.translate?.(\"integration.error.streamFailed\") ?? \"Stream failed\", true, response.status);\n }\n await parseAgentWebAppEventStream(response.body, onEvent);\n }\n\n /** Run a new turn through the Agent Server command surface. */\n async commandsRunStart(\n assistantId: string,\n threadId: string,\n args: { input: { message?: string; messages?: unknown[]; files?: string[] }; config?: Record<string, unknown>; multitask_strategy?: string },\n selection: AgentWebAppProjectSelection = {},\n signal?: AbortSignal,\n ): Promise<{ messageId: string }> {\n return this.request(\n `api/assistants/${encodeURIComponent(assistantId)}/threads/${encodeURIComponent(threadId)}/commands`,\n (value) => record(value) && typeof value.messageId === \"string\" ? { messageId: value.messageId } : undefined,\n { method: \"POST\", query: selection, body: { command: \"run.start\", args }, signal },\n );\n }\n\n /** Answer a pending interrupt through the Agent Server command surface. */\n async commandsRespond(\n assistantId: string,\n threadId: string,\n args: { interrupt_id: string; resume: Record<string, unknown>; config?: Record<string, unknown>; expected_interrupt_id?: string },\n selection: AgentWebAppProjectSelection = {},\n signal?: AbortSignal,\n ): Promise<{ messageId: string; interruptId: string; accepted?: boolean; commandId?: string }> {\n return this.request(\n `api/assistants/${encodeURIComponent(assistantId)}/threads/${encodeURIComponent(threadId)}/commands`,\n (value) => {\n if (!record(value) || typeof value.messageId !== \"string\" || typeof value.interruptId !== \"string\") return undefined;\n const accepted = typeof value.accepted === \"boolean\" ? value.accepted : undefined;\n const commandId = typeof value.commandId === \"string\" ? value.commandId : undefined;\n return {\n messageId: value.messageId,\n interruptId: value.interruptId,\n ...(accepted === undefined ? {} : { accepted }),\n ...(commandId === undefined ? {} : { commandId }),\n };\n },\n { method: \"POST\", query: selection, body: { command: \"input.respond\", args }, signal },\n );\n }\n\n /** Read run status and normalize pending interrupts for the widget UI. */\n async getThreadStatus(\n assistantId: string,\n threadId: string,\n selection: AgentWebAppProjectSelection = {},\n signal?: AbortSignal,\n ): Promise<{ status: string; pendingMessages: number; interrupts: ReturnType<typeof toWidgetInterrupt>[] }> {\n return this.request(\n `api/assistants/${encodeURIComponent(assistantId)}/threads/${encodeURIComponent(threadId)}/status`,\n (value) => record(value) && typeof value.status === \"string\" && typeof value.pendingMessages === \"number\" && Array.isArray(value.interrupts)\n ? {\n status: value.status,\n pendingMessages: value.pendingMessages,\n interrupts: value.interrupts.map((item) => toWidgetInterrupt(item as AgentInterrupt)),\n }\n : undefined,\n { query: selection, signal },\n );\n }\n\n /**\n * Consume the thread-wide event stream and project each chunk onto the\n * public widget event contract (the same projection the hosted runtime uses).\n */\n async streamThreadEvents(\n assistantId: string,\n threadId: string,\n options: { anchor: string; projectId?: string; modelKey?: string; allowInterrupts?: boolean; allowGenUI?: boolean; since?: string },\n onEvent: AgentWebAppStreamEventHandler,\n signal?: AbortSignal,\n ): Promise<void> {\n const response = await this.fetchRequest(\n `api/assistants/${encodeURIComponent(assistantId)}/threads/${encodeURIComponent(threadId)}/stream/events`,\n {\n method: \"POST\",\n query: { projectId: options.projectId, modelKey: options.modelKey },\n body: { channels: [\"messages\", \"tools\", \"input\", \"lifecycle\"], ...(options.since ? { since: options.since } : {}) },\n signal,\n },\n );\n if (!response.ok) await this.throwResponseError(response);\n if (!response.body) throw new AgentWebAppRuntimeClientError(\"STREAM_FAILED\", this.translate?.(\"integration.error.streamFailed\") ?? \"Stream failed\", true, response.status);\n const context = createAgentWebAppStreamProjectionContext({\n allowInterrupts: options.allowInterrupts ?? true,\n allowGenUI: options.allowGenUI ?? false,\n });\n const decoder = new TextDecoder();\n let buffer = \"\";\n let anchored = false;\n const reader = response.body.getReader();\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) break;\n buffer += decoder.decode(value, { stream: true });\n let boundary = buffer.indexOf(\"\\n\\n\");\n while (boundary >= 0) {\n const frame = buffer.slice(0, boundary);\n buffer = buffer.slice(boundary + 2);\n boundary = buffer.indexOf(\"\\n\\n\");\n const data = frame.split(\"\\n\")\n .filter((line) => line.startsWith(\"data:\"))\n .map((line) => line.slice(5).trim())\n .join(\"\\n\");\n if (!data) continue;\n let event: RuntimeThreadEvent;\n try { event = JSON.parse(data) as RuntimeThreadEvent; } catch { continue; }\n if (event.type === \"error\") {\n const value = event as unknown as { code?: unknown; message?: unknown };\n onEvent({\n type: \"error\",\n error: {\n code: \"STREAM_FAILED\",\n message: typeof value.message === \"string\" ? value.message : \"Stream failed\",\n retryable: true,\n },\n });\n return;\n }\n if (event.type !== \"event\" || !record(event.params) || event.params.data === undefined) continue;\n const payload = event.params.data;\n if (record(payload) && (payload.kind === \"start\" || payload.kind === \"end\")) {\n if (payload.kind === \"end\" && anchored) {\n onEvent({ type: \"stream.completed\" });\n return;\n }\n continue;\n }\n if (!record(payload) || typeof payload.type !== \"string\" || !record(payload.data)) continue;\n const message = payload as unknown as MessageChunk;\n if (!anchored) {\n if (message.data.id !== options.anchor) continue;\n anchored = true;\n }\n for (const projected of projectAgentWebAppChunk(message, context)) onEvent(projected);\n if (\n message.type === MessageChunkTypes.MESSAGE_COMPLETED\n || message.type === MessageChunkTypes.MESSAGE_FAILED\n || message.type === MessageChunkTypes.ERROR\n || message.type === MessageChunkTypes.THREAD_IDLE\n || message.type === MessageChunkTypes.INTERRUPT\n ) return;\n }\n }\n } finally {\n reader.releaseLock();\n }\n if (anchored) onEvent({ type: \"stream.completed\" });\n }\n\n async abort(threadId: string, selection: AgentWebAppProjectSelection = {}, signal?: AbortSignal): Promise<void> {\n await this.request(`threads/${encodeURIComponent(threadId)}/abort`, objectWith<{ aborted: boolean }>([\"aborted\"], (value) => typeof value.aborted === \"boolean\"), { method: \"POST\", query: selection, signal });\n }\n\n async uploadAttachment(threadId: string, file: Blob, selection: AgentWebAppProjectSelection = {}, signal?: AbortSignal): Promise<AgentWebAppAttachment> {\n const form = new FormData();\n const filename = typeof File !== \"undefined\" && file instanceof File ? file.name : \"attachment\";\n form.append(\"file\", file, filename);\n return this.request(`threads/${encodeURIComponent(threadId)}/attachments`, parseAttachment, { method: \"POST\", query: selection, body: form, signal });\n }\n\n private async request<T>(path: string, parse: (value: unknown) => T | undefined, init: RequestOptions = {}): Promise<T> {\n let response: Response;\n try { response = await this.fetchRequest(path, init); }\n catch (error) {\n if (isAbortError(error)) throw error;\n if (error instanceof AgentWebAppRuntimeClientError) throw error;\n throw new AgentWebAppRuntimeClientError(\"INTERNAL_ERROR\", this.translate?.(\"integration.error.requestFailed\") ?? \"Request failed\", true);\n }\n let value: unknown;\n try { value = await response.json(); } catch { throw this.internalError(response.status); }\n if (isErrorEnvelope(value)) {\n throw new AgentWebAppRuntimeClientError(value.error.code, value.error.message, value.error.retryable, response.status);\n }\n if (!response.ok || !record(value) || !exact(value, [\"success\", \"data\"]) || value.success !== true) throw this.internalError(response.status);\n const data = parse(value.data);\n if (data === undefined) throw this.internalError(response.status);\n return data;\n }\n\n private async fetchRequest(path: string, options: RequestOptions): Promise<Response> {\n const identity = await this.options.identityProvider.getIdentity(options.signal);\n const url = new URL(`${this.baseUrl}/${path}`);\n for (const [key, value] of Object.entries(options.query ?? {})) if (value !== undefined) url.searchParams.set(key, value);\n const headers = new Headers();\n if (identity.bearerToken !== undefined) {\n headers.set(\"Authorization\", `Bearer ${identity.bearerToken}`);\n } else {\n headers.set(\"X-Axiom-External-User-Id\", identity.externalUserId ?? \"\");\n }\n let body: BodyInit | undefined;\n if (options.body instanceof FormData) body = options.body;\n else if (options.body !== undefined) { headers.set(\"Content-Type\", \"application/json\"); body = JSON.stringify(options.body); }\n return this.fetchImplementation(url, { method: options.method ?? \"GET\", headers, body, signal: options.signal, credentials: this.credentials });\n }\n\n private async throwResponseError(response: Response): Promise<never> {\n let value: unknown;\n try { value = await response.json(); } catch { throw this.internalError(response.status); }\n if (isErrorEnvelope(value)) throw new AgentWebAppRuntimeClientError(value.error.code, value.error.message, value.error.retryable, response.status);\n throw this.internalError(response.status);\n }\n\n private internalError(status?: number): AgentWebAppRuntimeClientError {\n return new AgentWebAppRuntimeClientError(\"INTERNAL_ERROR\", this.translate?.(\"integration.error.invalidServerResponse\") ?? \"Invalid server response\", false, status);\n }\n}\n\nfunction isAbortError(error: unknown): boolean {\n return typeof error === \"object\" && error !== null && \"name\" in error && error.name === \"AbortError\";\n}\n\ninterface RequestOptions {\n method?: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\";\n query?: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AAA,IAAG;AAC7H,WAAO,KAAK,oBAAoB,KAAK,EAAE,QAAQ,QAAQ,UAAU,OAAO,SAAS,MAAM,QAAQ,QAAQ,QAAQ,aAAa,KAAK,YAAY,CAAC;AAAA,EAChJ;AAAA,EAEA,MAAc,mBAAmB,UAAoC;AACnE,QAAI;AACJ,QAAI;AAAE,cAAQ,MAAM,SAAS,KAAK;AAAA,IAAG,QAAQ;AAAE,YAAM,KAAK,cAAc,SAAS,MAAM;AAAA,IAAG;AAC1F,QAAI,gBAAgB,KAAK,EAAG,OAAM,IAAI,8BAA8B,MAAM,MAAM,MAAM,MAAM,MAAM,SAAS,MAAM,MAAM,WAAW,SAAS,MAAM;AACjJ,UAAM,KAAK,cAAc,SAAS,MAAM;AAAA,EAC1C;AAAA,EAEQ,cAAc,QAAgD;AACpE,WAAO,IAAI,8BAA8B,kBAAkB,KAAK,YAAY,yCAAyC,KAAK,2BAA2B,OAAO,MAAM;AAAA,EACpK;AACF;AAEA,SAASC,cAAa,OAAyB;AAC7C,SAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,UAAU,SAAS,MAAM,SAAS;AAC1F;","names":["MessageChunkTypes","createAgentWebAppStreamProjectionContext","parseAgentWebAppGenUIBlock","projectAgentWebAppChunk","errorCodes","record","exact","isAbortError","value"]}
@@ -3,7 +3,7 @@ import {
3
3
  Chating,
4
4
  InitialMessageSubmitter,
5
5
  ProjectSelector
6
- } from "./chunk-PPMYPBGP.mjs";
6
+ } from "./chunk-YGNARZGO.mjs";
7
7
  import {
8
8
  useClient
9
9
  } from "./chunk-BKVZCHO4.mjs";
@@ -193,4 +193,4 @@ export {
193
193
  TrainingContextCard,
194
194
  CopilotPanel
195
195
  };
196
- //# sourceMappingURL=chunk-4AQVKTZZ.mjs.map
196
+ //# sourceMappingURL=chunk-J7NG35IU.mjs.map
@@ -4,14 +4,14 @@ import {
4
4
  import {
5
5
  CopilotPanel,
6
6
  TrainingContextCard
7
- } from "./chunk-4AQVKTZZ.mjs";
7
+ } from "./chunk-J7NG35IU.mjs";
8
8
  import {
9
9
  WorkflowCanvas_default,
10
10
  expandWorkflow
11
- } from "./chunk-IIB5BEMF.mjs";
11
+ } from "./chunk-2BFZHC3S.mjs";
12
12
  import {
13
13
  TaskOutlineList
14
- } from "./chunk-WCBQEED7.mjs";
14
+ } from "./chunk-6XN2KL76.mjs";
15
15
  import {
16
16
  WorkflowGraphBase,
17
17
  applyDagreLayout
@@ -48,7 +48,7 @@ import {
48
48
  useTaskCommands,
49
49
  useWorkbenchNavStyles,
50
50
  withBoundProjectOptions
51
- } from "./chunk-PPMYPBGP.mjs";
51
+ } from "./chunk-YGNARZGO.mjs";
52
52
  import {
53
53
  ConversationContextProvider,
54
54
  useChatUIContext,
@@ -88,7 +88,7 @@ import {
88
88
  import {
89
89
  AgentWebAppRuntimeClient,
90
90
  AgentWebAppRuntimeClientError
91
- } from "./chunk-DTZPCOY2.mjs";
91
+ } from "./chunk-FVJMVJR2.mjs";
92
92
  import {
93
93
  LocaleLayerIfAbsent
94
94
  } from "./chunk-6GVLXVXA.mjs";
@@ -600,7 +600,7 @@ function identityScopeKey(identity) {
600
600
  }
601
601
  function AgentChatApp(props) {
602
602
  validateProps(props);
603
- const scopeKey = `${props.gatewayUrl}\0${props.webAppId}\0${identityScopeKey(props.identity)}`;
603
+ const scopeKey = `${props.gatewayUrl}\0${props.webAppId}\0${identityScopeKey(props.identity)}\0${props.credentials ?? "omit"}`;
604
604
  const storageKey = props.storageKey ?? DEFAULT_LOCALE_STORAGE_KEY;
605
605
  const initialLocale = useMemo(
606
606
  () => props.locale ?? readStoredLocale(storageKey) ?? "en-US",
@@ -622,7 +622,7 @@ function AgentChatApp(props) {
622
622
  )
623
623
  );
624
624
  }
625
- function ScopedAgentChatApp({ gatewayUrl, webAppId, identity, onError, onChatReady, onChatMessage, fetch: fetchImplementation, className, welcome, quickPrompts, locale = "en-US" }) {
625
+ function ScopedAgentChatApp({ gatewayUrl, webAppId, identity, onError, onChatReady, onChatMessage, fetch: fetchImplementation, credentials, className, welcome, quickPrompts, locale = "en-US" }) {
626
626
  const t = useT();
627
627
  const [state, setState] = useState2({ status: "loading" });
628
628
  const identityRef = useRef2(identity);
@@ -646,7 +646,8 @@ function ScopedAgentChatApp({ gatewayUrl, webAppId, identity, onError, onChatRea
646
646
  }
647
647
  },
648
648
  translate: t,
649
- ...fetchImplementation ? { fetch: fetchImplementation } : {}
649
+ ...fetchImplementation ? { fetch: fetchImplementation } : {},
650
+ ...credentials ? { credentials } : {}
650
651
  });
651
652
  }
652
653
  useEffect3(() => installRuntimeUploadAuth({ gatewayUrl, webAppId, identity }), [gatewayUrl, webAppId, identity]);
@@ -8909,4 +8910,4 @@ export {
8909
8910
  AgentConfigGraph,
8910
8911
  AgentDetailView
8911
8912
  };
8912
- //# sourceMappingURL=chunk-25QAUXI3.mjs.map
8913
+ //# sourceMappingURL=chunk-OTQDEU5U.mjs.map