@axiom-lattice/react-sdk 4.1.2 → 4.1.3

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 (57) hide show
  1. package/dist/{AgentDetailSideApp-BANXDHGC.mjs → AgentDetailSideApp-KVL27KAF.mjs} +6 -6
  2. package/dist/{AgentGovernanceWorkbench-PNF7MG6Q.mjs → AgentGovernanceWorkbench-I6S4XU3T.mjs} +7 -7
  3. package/dist/{MessageGraph-JYJJGID6.mjs → MessageGraph-LOSAZQ2V.mjs} +2 -2
  4. package/dist/{ReactChart-YSVXA36V.mjs → ReactChart-NDLIHCJJ.mjs} +2 -2
  5. package/dist/{TasksSideApp-BHSO6MME.mjs → TasksSideApp-37YKH7HV.mjs} +3 -3
  6. package/dist/{TeamWorkspace-UX5XZOBG.mjs → TeamWorkspace-EAFZU3KS.mjs} +2 -2
  7. package/dist/{TopologyRuntimeView-7RTCOJL6.mjs → TopologyRuntimeView-53OCKDYA.mjs} +3 -3
  8. package/dist/{WorkflowAutomationView-ZXWX7KAO.mjs → WorkflowAutomationView-R4EHXT7I.mjs} +5 -5
  9. package/dist/{chunk-2ZHLPYFM.mjs → chunk-EWLXRAWY.mjs} +64 -10
  10. package/dist/chunk-EWLXRAWY.mjs.map +1 -0
  11. package/dist/{chunk-PCVIQHMU.mjs → chunk-FKK4AXDU.mjs} +4 -4
  12. package/dist/{chunk-U3IFNUHY.mjs → chunk-N4C7TX7T.mjs} +2 -2
  13. package/dist/{chunk-TIJF2N43.mjs → chunk-OT7IZRSM.mjs} +2 -2
  14. package/dist/{chunk-YHTQIFV7.mjs → chunk-SLXJAOF2.mjs} +2 -2
  15. package/dist/{chunk-XVKJMRHA.mjs → chunk-WQBBDRPU.mjs} +11 -11
  16. package/dist/{chunk-V4IPV2ZK.mjs → chunk-YYP5ASCR.mjs} +4 -4
  17. package/dist/{embed-page-AgentDetailSideApp-2LI6OOO7.js → embed-page-AgentDetailSideApp-3LBCEKFU.js} +1 -1
  18. package/dist/{embed-page-AgentGovernanceWorkbench-M4H7NQNZ.js → embed-page-AgentGovernanceWorkbench-K3JUQNBW.js} +1 -1
  19. package/dist/{embed-page-MessageGraph-C3WBV4X7.js → embed-page-MessageGraph-3X4ROEN6.js} +1 -1
  20. package/dist/{embed-page-ReactChart-7K7Z2GKH.js → embed-page-ReactChart-F6VYCIYY.js} +1 -1
  21. package/dist/{embed-page-SkillFlow-MAXK7HAQ.js → embed-page-SkillFlow-3CF7R3CW.js} +1 -1
  22. package/dist/{embed-page-TasksSideApp-LJDTRCAB.js → embed-page-TasksSideApp-3WRDBZU3.js} +1 -1
  23. package/dist/{embed-page-TeamWorkspace-GXWDJBUR.js → embed-page-TeamWorkspace-6JSMZYUF.js} +1 -1
  24. package/dist/{embed-page-TopologyRuntimeView-JCAZCHS7.js → embed-page-TopologyRuntimeView-YDFENLHH.js} +1 -1
  25. package/dist/{embed-page-WorkflowAutomationView-4MAB62HK.js → embed-page-WorkflowAutomationView-MP5B7Q2Q.js} +1 -1
  26. package/dist/{embed-page-chunk-GZXI22WX.js → embed-page-chunk-B2E2XOH2.js} +8 -8
  27. package/dist/{embed-page-chunk-UVYHBMEW.js → embed-page-chunk-FFO7CAYL.js} +1 -1
  28. package/dist/{embed-page-chunk-HCLU6MDW.js → embed-page-chunk-GDTBDOUE.js} +4 -4
  29. package/dist/{embed-page-chunk-YPHDGMDG.js → embed-page-chunk-IRP6JSSX.js} +1 -1
  30. package/dist/{embed-page-chunk-Z6HFQXM5.js → embed-page-chunk-PAJ5NG2Z.js} +1 -1
  31. package/dist/{embed-page-chunk-DFJ7Y4ID.js → embed-page-chunk-QEYWJHEK.js} +1 -1
  32. package/dist/{embed-page-chunk-E7PTLQAG.js → embed-page-chunk-RVXX5HKF.js} +1 -1
  33. package/dist/{embed-page-chunk-7LQKELZI.js → embed-page-chunk-UOL6CUAL.js} +1 -1
  34. package/dist/{embed-page-chunk-J2VPD2GD.js → embed-page-chunk-URNZX66S.js} +1 -1
  35. package/dist/{embed-page-chunk-E46G4ZHX.js → embed-page-chunk-YMJGPA3F.js} +118 -118
  36. package/dist/embed-page.js +1 -1
  37. package/dist/index.d.mts +6 -0
  38. package/dist/index.d.ts +6 -0
  39. package/dist/index.js +59 -5
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +7 -7
  42. package/package.json +3 -3
  43. package/dist/chunk-2ZHLPYFM.mjs.map +0 -1
  44. /package/dist/{AgentDetailSideApp-BANXDHGC.mjs.map → AgentDetailSideApp-KVL27KAF.mjs.map} +0 -0
  45. /package/dist/{AgentGovernanceWorkbench-PNF7MG6Q.mjs.map → AgentGovernanceWorkbench-I6S4XU3T.mjs.map} +0 -0
  46. /package/dist/{MessageGraph-JYJJGID6.mjs.map → MessageGraph-LOSAZQ2V.mjs.map} +0 -0
  47. /package/dist/{ReactChart-YSVXA36V.mjs.map → ReactChart-NDLIHCJJ.mjs.map} +0 -0
  48. /package/dist/{TasksSideApp-BHSO6MME.mjs.map → TasksSideApp-37YKH7HV.mjs.map} +0 -0
  49. /package/dist/{TeamWorkspace-UX5XZOBG.mjs.map → TeamWorkspace-EAFZU3KS.mjs.map} +0 -0
  50. /package/dist/{TopologyRuntimeView-7RTCOJL6.mjs.map → TopologyRuntimeView-53OCKDYA.mjs.map} +0 -0
  51. /package/dist/{WorkflowAutomationView-ZXWX7KAO.mjs.map → WorkflowAutomationView-R4EHXT7I.mjs.map} +0 -0
  52. /package/dist/{chunk-PCVIQHMU.mjs.map → chunk-FKK4AXDU.mjs.map} +0 -0
  53. /package/dist/{chunk-U3IFNUHY.mjs.map → chunk-N4C7TX7T.mjs.map} +0 -0
  54. /package/dist/{chunk-TIJF2N43.mjs.map → chunk-OT7IZRSM.mjs.map} +0 -0
  55. /package/dist/{chunk-YHTQIFV7.mjs.map → chunk-SLXJAOF2.mjs.map} +0 -0
  56. /package/dist/{chunk-XVKJMRHA.mjs.map → chunk-WQBBDRPU.mjs.map} +0 -0
  57. /package/dist/{chunk-V4IPV2ZK.mjs.map → chunk-YYP5ASCR.mjs.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{h as b}from"./embed-page-chunk-HCLU6MDW.js";import"./embed-page-chunk-GZXI22WX.js";import"./embed-page-chunk-E7PTLQAG.js";import"./embed-page-chunk-UVYHBMEW.js";import"./embed-page-chunk-E46G4ZHX.js";import"./embed-page-chunk-J2VPD2GD.js";import{a as c}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-Z7USDLHI.js";import{a as u}from"./embed-page-chunk-O4QK5LWZ.js";import"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{b as k,e as s}from"./embed-page-chunk-6Y3UYJ6Z.js";var f=k(l=>{"use strict";var g=u();l.createRoot=g.createRoot,l.hydrateRoot=g.hydrateRoot;var F});var R=s(f()),v=s(u());var E="axiom-web-app-embed";var y=["axiom:hello","axiom:identity","axiom:send"];function h(e,t){return{source:E,version:1,type:e,payload:t}}function x(e,t){if(typeof e!="object"||e===null)return null;let n=e;return n.source!==E||n.version!==1||typeof n.type!="string"||!t.includes(n.type)?null:{type:n.type,payload:n.payload}}var p=s(c()),S=/^[A-Za-z0-9._:@-]{1,128}$/,D="Open this chat from the host page embed to start chatting.",T="axiom-embed-root",w="axiom-embed-style",_=32768,L=`
1
+ import{h as b}from"./embed-page-chunk-GDTBDOUE.js";import"./embed-page-chunk-B2E2XOH2.js";import"./embed-page-chunk-RVXX5HKF.js";import"./embed-page-chunk-FFO7CAYL.js";import"./embed-page-chunk-YMJGPA3F.js";import"./embed-page-chunk-URNZX66S.js";import{a as c}from"./embed-page-chunk-MB65DZAX.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-5JDQ456X.js";import"./embed-page-chunk-Z7USDLHI.js";import{a as u}from"./embed-page-chunk-O4QK5LWZ.js";import"./embed-page-chunk-4BKXE5ON.js";import"./embed-page-chunk-IX4WLWCY.js";import"./embed-page-chunk-EUOOO2LS.js";import{b as k,e as s}from"./embed-page-chunk-6Y3UYJ6Z.js";var f=k(l=>{"use strict";var g=u();l.createRoot=g.createRoot,l.hydrateRoot=g.hydrateRoot;var F});var R=s(f()),v=s(u());var E="axiom-web-app-embed";var y=["axiom:hello","axiom:identity","axiom:send"];function h(e,t){return{source:E,version:1,type:e,payload:t}}function x(e,t){if(typeof e!="object"||e===null)return null;let n=e;return n.source!==E||n.version!==1||typeof n.type!="string"||!t.includes(n.type)?null:{type:n.type,payload:n.payload}}var p=s(c()),S=/^[A-Za-z0-9._:@-]{1,128}$/,D="Open this chat from the host page embed to start chatting.",T="axiom-embed-root",w="axiom-embed-style",_=32768,L=`
2
2
  html, body, #${T} { height: 100%; margin: 0; }
3
3
  .axiom-embed-fill { height: 100% !important; min-height: 0 !important; }
4
4
  .axiom-embed-card { display: flex; align-items: center; justify-content: center; height: 100%; margin: 0; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: #64748b; padding: 24px; box-sizing: border-box; text-align: center; }
package/dist/index.d.mts CHANGED
@@ -115,6 +115,12 @@ interface ChatState {
115
115
  * Error that occurred during sending a message
116
116
  */
117
117
  error: Error | null;
118
+ /**
119
+ * Why the last run stopped without a normal completion. Set to `aborted`
120
+ * when the user stops the run and `superseded` when a newer message
121
+ * interrupted it. Real failures populate {@link error} instead.
122
+ */
123
+ stopReason?: "aborted" | "superseded" | null;
118
124
  /**
119
125
  * Interrupt data when agent requires user intervention
120
126
  */
package/dist/index.d.ts CHANGED
@@ -115,6 +115,12 @@ interface ChatState {
115
115
  * Error that occurred during sending a message
116
116
  */
117
117
  error: Error | null;
118
+ /**
119
+ * Why the last run stopped without a normal completion. Set to `aborted`
120
+ * when the user stops the run and `superseded` when a newer message
121
+ * interrupted it. Real failures populate {@link error} instead.
122
+ */
123
+ stopReason?: "aborted" | "superseded" | null;
118
124
  /**
119
125
  * Interrupt data when agent requires user intervention
120
126
  */
package/dist/index.js CHANGED
@@ -571,6 +571,20 @@ function useChat(threadId, assistantId, options = {}) {
571
571
  const handleStreamEvent = (0, import_react3.useCallback)(
572
572
  (chunk) => {
573
573
  const anyChunk = chunk;
574
+ if (anyChunk.type === "error") {
575
+ const code = typeof anyChunk.data?.code === "string" ? anyChunk.data.code : "stream_error";
576
+ const isStop = code === "aborted" || code === "superseded";
577
+ setState((prev) => ({
578
+ ...prev,
579
+ messages: chunkMessageMerger.current.getMessages(),
580
+ isLoading: false,
581
+ streamingMessage: null,
582
+ error: isStop ? null : new Error(
583
+ typeof anyChunk.data?.content === "string" && anyChunk.data.content ? anyChunk.data.content : "Stream error"
584
+ )
585
+ }));
586
+ return;
587
+ }
574
588
  let interrupt;
575
589
  if (chunk.type === "interrupt") {
576
590
  interrupt = chunk;
@@ -4332,6 +4346,7 @@ function AgentThreadProvider({
4332
4346
  messages: options.initialMessages || [],
4333
4347
  isLoading: false,
4334
4348
  error: null,
4349
+ stopReason: null,
4335
4350
  interrupts: void 0,
4336
4351
  agentState: null,
4337
4352
  // 新增队列状态
@@ -4442,6 +4457,23 @@ function AgentThreadProvider({
4442
4457
  (chunk) => {
4443
4458
  if (currentThreadIdRef.current !== threadId) return;
4444
4459
  const anyChunk = chunk;
4460
+ if (anyChunk.type === "error") {
4461
+ const code = typeof anyChunk.data?.code === "string" ? anyChunk.data.code : "stream_error";
4462
+ const isStop = code === "aborted" || code === "superseded";
4463
+ streamActiveRef.current = false;
4464
+ const isLoading = getOwnedLoading();
4465
+ isLoadingRef.current = isLoading;
4466
+ setState((prev) => ({
4467
+ ...prev,
4468
+ messages: chunkMessageMerger.current.getMessages(),
4469
+ isLoading,
4470
+ stopReason: isStop ? code : null,
4471
+ error: isStop ? null : new Error(
4472
+ typeof anyChunk.data?.content === "string" && anyChunk.data.content ? anyChunk.data.content : "Stream error"
4473
+ )
4474
+ }));
4475
+ return;
4476
+ }
4445
4477
  if (anyChunk.type === "human") {
4446
4478
  const chunkId = anyChunk.data?.id;
4447
4479
  const chunkContent = anyChunk.data?.content;
@@ -4519,6 +4551,7 @@ function AgentThreadProvider({
4519
4551
  todos: todos || prev.todos,
4520
4552
  messages: chunkMessageMerger.current.getMessages(),
4521
4553
  isLoading,
4554
+ stopReason: null,
4522
4555
  interrupts: interrupt ? [interrupt] : void 0
4523
4556
  };
4524
4557
  });
@@ -4533,7 +4566,8 @@ function AgentThreadProvider({
4533
4566
  ...prev,
4534
4567
  todos: todos || prev.todos,
4535
4568
  messages: chunkMessageMerger.current.getMessages(),
4536
- isLoading
4569
+ isLoading,
4570
+ stopReason: null
4537
4571
  }));
4538
4572
  });
4539
4573
  }
@@ -4575,8 +4609,11 @@ function AgentThreadProvider({
4575
4609
  ...prev,
4576
4610
  isLoading,
4577
4611
  error: null,
4612
+ stopReason: null,
4578
4613
  interrupts: void 0
4579
4614
  }));
4615
+ } else {
4616
+ setState((prev) => prev.stopReason == null ? prev : { ...prev, stopReason: null });
4580
4617
  }
4581
4618
  pendingIdsRef.current.add(userMessage.id);
4582
4619
  setState((prev) => ({
@@ -4730,7 +4767,7 @@ function AgentThreadProvider({
4730
4767
  isLoadingRef.current = initialIsLoading;
4731
4768
  setState((prev) => {
4732
4769
  if (currentThreadIdRef.current !== capturedThreadId) return prev;
4733
- return { ...prev, messages: [], isLoading: initialIsLoading, error: null };
4770
+ return { ...prev, messages: [], isLoading: initialIsLoading, error: null, stopReason: null };
4734
4771
  });
4735
4772
  try {
4736
4773
  const agentState = await client.getAgentState(threadId);
@@ -4816,7 +4853,8 @@ function AgentThreadProvider({
4816
4853
  const clearError = (0, import_react14.useCallback)(() => {
4817
4854
  setState((prev) => ({
4818
4855
  ...prev,
4819
- error: null
4856
+ error: null,
4857
+ stopReason: null
4820
4858
  }));
4821
4859
  }, []);
4822
4860
  const removePendingMessage = (0, import_react14.useCallback)(
@@ -4845,7 +4883,11 @@ function AgentThreadProvider({
4845
4883
  [client, threadId, assistantId, clientAssistantId]
4846
4884
  );
4847
4885
  const abortAgent = (0, import_react14.useCallback)(async () => {
4886
+ const wasActive = getOwnedLoading();
4848
4887
  stopStreaming();
4888
+ if (wasActive) {
4889
+ setState((prev) => ({ ...prev, stopReason: "aborted", error: null }));
4890
+ }
4849
4891
  if (assistantId && threadId) {
4850
4892
  try {
4851
4893
  await client.chat.abort({
@@ -4856,7 +4898,7 @@ function AgentThreadProvider({
4856
4898
  console.error("Failed to abort agent:", error);
4857
4899
  }
4858
4900
  }
4859
- }, [stopStreaming, assistantId, threadId, client]);
4901
+ }, [stopStreaming, getOwnedLoading, assistantId, threadId, client]);
4860
4902
  (0, import_react14.useLayoutEffect)(() => {
4861
4903
  if (threadId && state.threadId !== threadId) {
4862
4904
  chunkMessageMerger.current.reset();
@@ -4870,7 +4912,8 @@ function AgentThreadProvider({
4870
4912
  agentState: null,
4871
4913
  interrupts: void 0,
4872
4914
  isLoading,
4873
- error: null
4915
+ error: null,
4916
+ stopReason: null
4874
4917
  }));
4875
4918
  }
4876
4919
  }, [getOwnedLoading, threadId, state.threadId]);
@@ -96656,6 +96699,7 @@ var init_Chating = __esm({
96656
96699
  loadMessages,
96657
96700
  isLoading,
96658
96701
  error,
96702
+ stopReason,
96659
96703
  interrupts,
96660
96704
  tenantId,
96661
96705
  clearError,
@@ -97267,6 +97311,16 @@ ${nextContent}`;
97267
97311
  message: `${error.message}`
97268
97312
  }
97269
97313
  ) }),
97314
+ !error && stopReason && /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(
97315
+ import_antd80.Alert,
97316
+ {
97317
+ type: "info",
97318
+ banner: true,
97319
+ closable: true,
97320
+ onClose: () => clearError(),
97321
+ message: stopReason === "superseded" ? "Response interrupted by a new message." : "Response stopped."
97322
+ }
97323
+ ) }),
97270
97324
  showHITL && /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(HITLContainer, {}),
97271
97325
  /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(PendingMessagesContainer, {}),
97272
97326
  showSender && /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(