@axiom-lattice/gateway 8.1.1 → 8.2.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 (30) hide show
  1. package/dist/embed/{embed-page-AgentDetailSideApp-RY4FAEAM.js → embed-page-AgentDetailSideApp-WDDE7BEH.js} +1 -1
  2. package/dist/embed/{embed-page-AgentGovernanceWorkbench-UFDULZ5A.js → embed-page-AgentGovernanceWorkbench-7YPU3QB2.js} +1 -1
  3. package/dist/embed/{embed-page-LangfuseDashboard-GNNJGAA2.js → embed-page-LangfuseDashboard-BEOJDMWF.js} +1 -1
  4. package/dist/embed/{embed-page-MessageGraph-S7GCLNLR.js → embed-page-MessageGraph-LNNMCH6I.js} +1 -1
  5. package/dist/embed/{embed-page-ReactChart-LWZPH244.js → embed-page-ReactChart-D7RZQB2H.js} +1 -1
  6. package/dist/embed/{embed-page-SkillFlow-OVIGJFUH.js → embed-page-SkillFlow-3X24ILKU.js} +1 -1
  7. package/dist/embed/{embed-page-TasksSideApp-AOS4MZAI.js → embed-page-TasksSideApp-KD4S22SL.js} +1 -1
  8. package/dist/embed/{embed-page-ThreadMaintenancePanel-PXL2TJBO.js → embed-page-ThreadMaintenancePanel-V327PV5R.js} +1 -1
  9. package/dist/embed/{embed-page-TopologyRuntimeView-GRM34Z2Z.js → embed-page-TopologyRuntimeView-Z7MY6U5T.js} +1 -1
  10. package/dist/embed/{embed-page-WorkflowAutomationView-JV26AHRB.js → embed-page-WorkflowAutomationView-4MY4HG7R.js} +1 -1
  11. package/dist/embed/embed-page-chunk-4XKCMM5C.js +211 -0
  12. package/dist/embed/{embed-page-chunk-YCTDKWKW.js → embed-page-chunk-ASEIOK7X.js} +1 -1
  13. package/dist/embed/{embed-page-chunk-6ZHR5GWS.js → embed-page-chunk-BSRASK7V.js} +6 -6
  14. package/dist/embed/{embed-page-chunk-ABGWNVMG.js → embed-page-chunk-BZKAPY7M.js} +1 -1
  15. package/dist/embed/embed-page-chunk-CFFDP526.js +6835 -0
  16. package/dist/embed/{embed-page-chunk-5XP4FJW7.js → embed-page-chunk-EM6VGUZ2.js} +1 -1
  17. package/dist/embed/{embed-page-chunk-3UK7XM33.js → embed-page-chunk-G5MXFDNZ.js} +1 -1
  18. package/dist/embed/{embed-page-chunk-OQUMCCF5.js → embed-page-chunk-G5PDHDBZ.js} +1 -1
  19. package/dist/embed/{embed-page-chunk-YM76GTXK.js → embed-page-chunk-HZZ5HNTF.js} +1 -1
  20. package/dist/embed/{embed-page-chunk-ONXC5S22.js → embed-page-chunk-PMOGSY6W.js} +1 -1
  21. package/dist/embed/{embed-page-en-G5J7KW6V.js → embed-page-en-JOTELYAL.js} +1 -1
  22. package/dist/embed/{embed-page-zh-72QSTYRF.js → embed-page-zh-BPO6ZSJM.js} +1 -1
  23. package/dist/embed/embed-page.js +1 -1
  24. package/dist/index.js +148 -38
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +148 -38
  27. package/dist/index.mjs.map +1 -1
  28. package/package.json +2 -2
  29. package/dist/embed/embed-page-chunk-NNQHJZ5Q.js +0 -211
  30. package/dist/embed/embed-page-chunk-SQSVDSG6.js +0 -6746
@@ -1,4 +1,4 @@
1
- import{b as h}from"./embed-page-chunk-YM76GTXK.js";import"./embed-page-chunk-SQSVDSG6.js";import"./embed-page-chunk-NNQHJZ5Q.js";import"./embed-page-chunk-ONXC5S22.js";import"./embed-page-chunk-6ZHR5GWS.js";import"./embed-page-chunk-F7ZUYG42.js";import"./embed-page-chunk-YCTDKWKW.js";import{a as E}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-34RWKVD7.js";import"./embed-page-chunk-B2KNZ3EW.js";import{a as b}from"./embed-page-chunk-F7TA3LRH.js";import"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{b as f}from"./embed-page-chunk-6IIMW7OG.js";import{c as z,f as l}from"./embed-page-chunk-QBTAJ2YI.js";var x=z(m=>{"use strict";var y=b();m.createRoot=y.createRoot,m.hydrateRoot=y.hydrateRoot;var te});var T=l(x()),M=l(b());var w="axiom-web-app-embed";var _=["axiom:hello","axiom:identity","axiom:send","axiom:config"];function R(e,t){return{source:w,version:1,type:e,payload:t}}var B=6,H=40,Q=500;function q(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=Object.keys(t);return n.length!==2||!n.includes("label")||!n.includes("text")?!1:typeof t.label=="string"&&t.label.length>=1&&t.label.length<=H&&typeof t.text=="string"&&t.text.length>=1&&t.text.length<=Q}function G(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(t.length>=B)break;q(n)&&t.push({label:n.label,text:n.text})}return t}function C(e){if(typeof e!="object"||e===null)return null;let t=e,n={};if(typeof t.welcome=="string"&&t.welcome.length>0&&(n.welcome=t.welcome),Array.isArray(t.quicks)){let a=G(t.quicks);(a.length>0||t.quicks.length===0)&&(n.quicks=a)}return n.welcome===void 0&&n.quicks===void 0?null:n}function A(e,t){if(typeof e!="object"||e===null)return null;let n=e;return n.source!==w||n.version!==1||typeof n.type!="string"||!t.includes(n.type)?null:{type:n.type,payload:n.payload}}var r=l(E()),S=/^[A-Za-z0-9._:@-]{1,128}$/,v="axiom-embed-root",k="axiom-embed-style",P=32768,j=`
1
+ import{b as h}from"./embed-page-chunk-HZZ5HNTF.js";import"./embed-page-chunk-CFFDP526.js";import"./embed-page-chunk-4XKCMM5C.js";import"./embed-page-chunk-PMOGSY6W.js";import"./embed-page-chunk-BSRASK7V.js";import"./embed-page-chunk-F7ZUYG42.js";import"./embed-page-chunk-ASEIOK7X.js";import{a as E}from"./embed-page-chunk-QV7QAJ4N.js";import"./embed-page-chunk-VW3NF5NT.js";import"./embed-page-chunk-34RWKVD7.js";import"./embed-page-chunk-B2KNZ3EW.js";import{a as b}from"./embed-page-chunk-F7TA3LRH.js";import"./embed-page-chunk-R5QL57JJ.js";import"./embed-page-chunk-QOWM3LMZ.js";import"./embed-page-chunk-EUOOO2LS.js";import"./embed-page-chunk-5JDQ456X.js";import{b as f}from"./embed-page-chunk-6IIMW7OG.js";import{c as z,f as l}from"./embed-page-chunk-QBTAJ2YI.js";var x=z(m=>{"use strict";var y=b();m.createRoot=y.createRoot,m.hydrateRoot=y.hydrateRoot;var te});var T=l(x()),M=l(b());var w="axiom-web-app-embed";var _=["axiom:hello","axiom:identity","axiom:send","axiom:config"];function R(e,t){return{source:w,version:1,type:e,payload:t}}var B=6,H=40,Q=500;function q(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=e,n=Object.keys(t);return n.length!==2||!n.includes("label")||!n.includes("text")?!1:typeof t.label=="string"&&t.label.length>=1&&t.label.length<=H&&typeof t.text=="string"&&t.text.length>=1&&t.text.length<=Q}function G(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(t.length>=B)break;q(n)&&t.push({label:n.label,text:n.text})}return t}function C(e){if(typeof e!="object"||e===null)return null;let t=e,n={};if(typeof t.welcome=="string"&&t.welcome.length>0&&(n.welcome=t.welcome),Array.isArray(t.quicks)){let a=G(t.quicks);(a.length>0||t.quicks.length===0)&&(n.quicks=a)}return n.welcome===void 0&&n.quicks===void 0?null:n}function A(e,t){if(typeof e!="object"||e===null)return null;let n=e;return n.source!==w||n.version!==1||typeof n.type!="string"||!t.includes(n.type)?null:{type:n.type,payload:n.payload}}var r=l(E()),S=/^[A-Za-z0-9._:@-]{1,128}$/,v="axiom-embed-root",k="axiom-embed-style",P=32768,j=`
2
2
  html, body, #${v} { 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.js CHANGED
@@ -11744,6 +11744,29 @@ async function listAllRuns(ledger, tenantId, threadId) {
11744
11744
  if (page.length < ACTIVE_RUN_PAGE_SIZE) return runs;
11745
11745
  }
11746
11746
  }
11747
+ var INPUT_PREVIEW_MAX = 200;
11748
+ function contentToPreview(content) {
11749
+ if (typeof content === "string") return content;
11750
+ if (!Array.isArray(content)) return "";
11751
+ return content.map((part) => {
11752
+ if (typeof part === "string") return part;
11753
+ return isRecord(part) && typeof part.text === "string" ? part.text : "";
11754
+ }).join("");
11755
+ }
11756
+ function inputPreview(input) {
11757
+ if (!isRecord(input)) return null;
11758
+ if (typeof input.message === "string") {
11759
+ return input.message.trim().slice(0, INPUT_PREVIEW_MAX) || null;
11760
+ }
11761
+ const messages = Array.isArray(input.messages) ? input.messages : [];
11762
+ for (const message of messages) {
11763
+ if (!isRecord(message)) continue;
11764
+ if (message.role !== void 0 && message.role !== "human") continue;
11765
+ const text = contentToPreview(message.content).trim();
11766
+ if (text) return text.slice(0, INPUT_PREVIEW_MAX);
11767
+ }
11768
+ return null;
11769
+ }
11747
11770
  function toSafeRun(run2) {
11748
11771
  return {
11749
11772
  runId: run2.runId,
@@ -11755,7 +11778,9 @@ function toSafeRun(run2) {
11755
11778
  createdAt: run2.createdAt,
11756
11779
  updatedAt: run2.updatedAt,
11757
11780
  startedAt: run2.startedAt,
11758
- finishedAt: run2.finishedAt
11781
+ finishedAt: run2.finishedAt,
11782
+ messageId: run2.inputMessageIds[0] ?? null,
11783
+ inputPreview: inputPreview(run2.input)
11759
11784
  };
11760
11785
  }
11761
11786
  function isTerminal(run2) {
@@ -11885,6 +11910,35 @@ function createRunLifecycleHandlers(deps = {}) {
11885
11910
  const pollIntervalMs = deps.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
11886
11911
  const now = deps.now ?? Date.now;
11887
11912
  const sleep = deps.sleep ?? ((ms) => new Promise((resolve4) => setTimeout(resolve4, ms)));
11913
+ const withRunCreateLock = async (request, reply, tenantId, assistantId, threadId, operation) => {
11914
+ const key = runCreateScopeKey(tenantId, assistantId, threadId);
11915
+ return serializeRunCreate(key, async () => {
11916
+ const leaseStore = resolveLeaseStore();
11917
+ if (!leaseStore) return operation();
11918
+ try {
11919
+ return await (0, import_core9.withLease)(
11920
+ leaseStore,
11921
+ key,
11922
+ (0, import_core9.getReplicaId)(),
11923
+ operation,
11924
+ RUN_CREATE_LEASE
11925
+ );
11926
+ } catch (error) {
11927
+ if (error instanceof import_core9.LeaseAcquisitionTimeoutError) {
11928
+ request.log.warn(
11929
+ { err: error, leaseKey: key },
11930
+ "Run create lease acquisition timed out"
11931
+ );
11932
+ return unavailable(
11933
+ reply,
11934
+ RUN_CREATE_LOCK_TIMEOUT,
11935
+ "Could not serialize run creation for this thread; retry shortly"
11936
+ );
11937
+ }
11938
+ throw error;
11939
+ }
11940
+ });
11941
+ };
11888
11942
  const waitForTerminal = async (tenantId, params, initial) => {
11889
11943
  let current4 = initial;
11890
11944
  const deadline = now() + waitTimeoutMs;
@@ -12114,35 +12168,6 @@ function createRunLifecycleHandlers(deps = {}) {
12114
12168
  const outcome2 = await createPending();
12115
12169
  return outcome2.ok ? respondCreated(outcome2.run) : outcome2.response;
12116
12170
  };
12117
- const withRunCreateLock = async (operation) => {
12118
- const key = runCreateScopeKey(tenantId, assistantId, threadId);
12119
- return serializeRunCreate(key, async () => {
12120
- const leaseStore = resolveLeaseStore();
12121
- if (!leaseStore) return operation();
12122
- try {
12123
- return await (0, import_core9.withLease)(
12124
- leaseStore,
12125
- key,
12126
- (0, import_core9.getReplicaId)(),
12127
- operation,
12128
- RUN_CREATE_LEASE
12129
- );
12130
- } catch (error) {
12131
- if (error instanceof import_core9.LeaseAcquisitionTimeoutError) {
12132
- request.log.warn(
12133
- { err: error, leaseKey: key },
12134
- "Run create lease acquisition timed out"
12135
- );
12136
- return unavailable(
12137
- reply,
12138
- RUN_CREATE_LOCK_TIMEOUT,
12139
- "Could not serialize run creation for this thread; retry shortly"
12140
- );
12141
- }
12142
- throw error;
12143
- }
12144
- });
12145
- };
12146
12171
  const scopedRunApiRuns = (runs) => runs.filter(
12147
12172
  (run2) => run2.tenantId === tenantId && run2.threadId === threadId && run2.assistantId === assistantId && run2.source === "run_api"
12148
12173
  );
@@ -12162,7 +12187,7 @@ function createRunLifecycleHandlers(deps = {}) {
12162
12187
  }
12163
12188
  };
12164
12189
  if (strategy === "reject") {
12165
- return withRunCreateLock(async () => {
12190
+ return withRunCreateLock(request, reply, tenantId, assistantId, threadId, async () => {
12166
12191
  const read = await readThreadRuns();
12167
12192
  if (!read.ok) return read.response;
12168
12193
  const active2 = scopedRunApiRuns(read.runs).filter(isActiveRun);
@@ -12178,7 +12203,7 @@ function createRunLifecycleHandlers(deps = {}) {
12178
12203
  });
12179
12204
  }
12180
12205
  if (strategy === "interrupt") {
12181
- return withRunCreateLock(async () => {
12206
+ return withRunCreateLock(request, reply, tenantId, assistantId, threadId, async () => {
12182
12207
  const read = await readThreadRuns();
12183
12208
  if (!read.ok) return read.response;
12184
12209
  const scoped = scopedRunApiRuns(read.runs);
@@ -12241,8 +12266,8 @@ function createRunLifecycleHandlers(deps = {}) {
12241
12266
  return createAndRespond();
12242
12267
  });
12243
12268
  }
12244
- if (strategy !== "rollback") return withRunCreateLock(createAndRespond);
12245
- return withRunCreateLock(async () => {
12269
+ if (strategy !== "rollback") return withRunCreateLock(request, reply, tenantId, assistantId, threadId, createAndRespond);
12270
+ return withRunCreateLock(request, reply, tenantId, assistantId, threadId, async () => {
12246
12271
  const active2 = (await listAllRuns(ledger, tenantId, threadId)).filter(
12247
12272
  (run2) => run2.tenantId === tenantId && run2.threadId === threadId && run2.assistantId === assistantId && run2.source !== "legacy" && (run2.status === "pending" || run2.status === "running")
12248
12273
  );
@@ -12377,6 +12402,76 @@ function createRunLifecycleHandlers(deps = {}) {
12377
12402
  return createAndRespond();
12378
12403
  });
12379
12404
  };
12405
+ const cancelActive = async (request, reply) => {
12406
+ if (!ledger) {
12407
+ return unavailable(reply, RUN_LEDGER_UNAVAILABLE, "Run ledger is not available");
12408
+ }
12409
+ const tenantId = getTenantId4(request);
12410
+ const { assistantId, threadId } = request.params;
12411
+ if (!await ownsThread(tenantId, assistantId, threadId)) {
12412
+ return notFound2(reply, THREAD_NOT_FOUND2, "Thread not found");
12413
+ }
12414
+ const router = resolveRouter();
12415
+ return withRunCreateLock(request, reply, tenantId, assistantId, threadId, async () => {
12416
+ let runs;
12417
+ try {
12418
+ runs = await listAllRuns(ledger, tenantId, threadId);
12419
+ } catch (error) {
12420
+ request.log.error({ err: error }, "Active run read failed");
12421
+ return unavailable(reply, RUN_CREATE_UNAVAILABLE2, "Run queue is not available");
12422
+ }
12423
+ const active2 = runs.filter(
12424
+ (run2) => run2.tenantId === tenantId && run2.assistantId === assistantId && run2.threadId === threadId && run2.source === "run_api" && isActiveRun(run2)
12425
+ );
12426
+ const cancelled = [];
12427
+ const requested = [];
12428
+ const failed = [];
12429
+ for (const run2 of active2) {
12430
+ try {
12431
+ if (run2.status === "pending") {
12432
+ const status2 = await ledger.requestCancel(tenantId, run2.runId);
12433
+ if (status2 === "cancelled") {
12434
+ const latest = await ledger.getRun(tenantId, run2.runId);
12435
+ if (latest) cancelled.push(toSafeRun(latest));
12436
+ } else if (status2 === "requested") {
12437
+ requested.push(toSafeRun(run2));
12438
+ }
12439
+ continue;
12440
+ }
12441
+ if (router) {
12442
+ const status2 = await router.requestCancelById({
12443
+ tenantId,
12444
+ assistantId,
12445
+ threadId,
12446
+ runId: run2.runId,
12447
+ reason: "abort"
12448
+ });
12449
+ if (status2 === "requested" || status2 === "cancelled") {
12450
+ requested.push(toSafeRun(run2));
12451
+ }
12452
+ continue;
12453
+ }
12454
+ const status = await ledger.requestCancel(tenantId, run2.runId);
12455
+ if (status === "requested" || status === "cancelled") {
12456
+ requested.push(toSafeRun(run2));
12457
+ }
12458
+ } catch (error) {
12459
+ failed.push({
12460
+ runId: run2.runId,
12461
+ code: "RUN_CANCEL_FAILED",
12462
+ message: error instanceof Error ? error.message : String(error)
12463
+ });
12464
+ }
12465
+ }
12466
+ return reply.status(200).send({
12467
+ success: true,
12468
+ accepted: failed.length === 0,
12469
+ cancelled,
12470
+ requested,
12471
+ failed
12472
+ });
12473
+ });
12474
+ };
12380
12475
  const list = async (request, reply) => {
12381
12476
  if (!ledger) {
12382
12477
  return unavailable(reply, RUN_LEDGER_UNAVAILABLE, "Run ledger is not available");
@@ -12386,12 +12481,14 @@ function createRunLifecycleHandlers(deps = {}) {
12386
12481
  if (!await ownsThread(tenantId, assistantId, threadId)) {
12387
12482
  return notFound2(reply, THREAD_NOT_FOUND2, "Thread not found");
12388
12483
  }
12389
- const runs = (await ledger.listRuns(tenantId, threadId)).filter(
12390
- (run2) => run2.tenantId === tenantId && run2.threadId === threadId && run2.assistantId === assistantId
12484
+ const activeOnly = request.query.active === "true" || request.query.active === "1";
12485
+ const source = request.query.source;
12486
+ const scoped = (activeOnly ? await listAllRuns(ledger, tenantId, threadId) : await ledger.listRuns(tenantId, threadId)).filter(
12487
+ (run2) => run2.tenantId === tenantId && run2.threadId === threadId && run2.assistantId === assistantId && (!activeOnly || isActiveRun(run2)) && (source === void 0 || run2.source === source)
12391
12488
  );
12392
12489
  return reply.status(200).send({
12393
12490
  success: true,
12394
- data: { runs: runs.map(toSafeRun) }
12491
+ data: { runs: scoped.map(toSafeRun) }
12395
12492
  });
12396
12493
  };
12397
12494
  const get = async (request, reply) => {
@@ -12747,7 +12844,7 @@ function createRunLifecycleHandlers(deps = {}) {
12747
12844
  run: toSafeRun(outcome2.run)
12748
12845
  });
12749
12846
  };
12750
- return { create, list, get, join: join5, cancel };
12847
+ return { create, list, get, join: join5, cancel, cancelActive };
12751
12848
  }
12752
12849
  function registerRunLifecycleRoutes(app2, deps = {}) {
12753
12850
  const handlers = createRunLifecycleHandlers(deps);
@@ -12759,6 +12856,10 @@ function registerRunLifecycleRoutes(app2, deps = {}) {
12759
12856
  "/api/assistants/:assistantId/threads/:threadId/runs",
12760
12857
  handlers.list
12761
12858
  );
12859
+ app2.post(
12860
+ "/api/assistants/:assistantId/threads/:threadId/runs/cancel-active",
12861
+ handlers.cancelActive
12862
+ );
12762
12863
  app2.get(
12763
12864
  "/api/assistants/:assistantId/threads/:threadId/runs/:runId",
12764
12865
  handlers.get
@@ -29565,6 +29666,15 @@ function registerAgentWebAppRuntimeRoutes(app2, deps) {
29565
29666
  return normalizeError2(reply, error);
29566
29667
  }
29567
29668
  });
29669
+ routes.post(`${prefix}/assistants/:assistantId/threads/:threadId/runs/cancel-active`, async (request, reply) => {
29670
+ try {
29671
+ const params = mirrorThreadParams.parse(request.params);
29672
+ const { proxy } = await authorizeRunMirror(request, params);
29673
+ return await runLifecycle.cancelActive(proxy, reply);
29674
+ } catch (error) {
29675
+ return normalizeError2(reply, error);
29676
+ }
29677
+ });
29568
29678
  routes.post(`${prefix}/assistants/:assistantId/threads/:threadId/runs/:runId/cancel`, async (request, reply) => {
29569
29679
  try {
29570
29680
  const params = mirrorRunParams.parse(request.params);