@axiom-lattice/gateway 8.1.0 → 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 +198 -40
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +198 -40
  27. package/dist/index.mjs.map +1 -1
  28. package/package.json +4 -4
  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
@@ -11421,6 +11421,52 @@ var import_core8 = require("@axiom-lattice/core");
11421
11421
 
11422
11422
  // src/services/threads/threadOwnership.ts
11423
11423
  var import_core7 = require("@axiom-lattice/core");
11424
+ var DELEGATED_THREAD_SEPARATOR = "____";
11425
+ var MAX_DELEGATED_THREAD_LINEAGE = 8;
11426
+ async function threadHasTenantRecord(tenantId, threadId) {
11427
+ try {
11428
+ const thread = await (0, import_core7.getStoreLattice)("default", "thread").store.getThreadById(
11429
+ tenantId,
11430
+ threadId
11431
+ );
11432
+ if (thread) return true;
11433
+ } catch {
11434
+ }
11435
+ try {
11436
+ const ledger = (0, import_core7.getStoreLattice)("default", "agentRun").store;
11437
+ const runs = await ledger.listRuns(tenantId, threadId, { limit: 1 });
11438
+ if (runs.length > 0) return true;
11439
+ } catch {
11440
+ }
11441
+ try {
11442
+ const tasks = (0, import_core7.getStoreLattice)("default", "task").store;
11443
+ const matches = await tasks.list({ tenantId, threadId, limit: 1 });
11444
+ return matches.length > 0;
11445
+ } catch {
11446
+ return false;
11447
+ }
11448
+ }
11449
+ async function threadLineageRootedInTenant(tenantId, threadId) {
11450
+ let candidate = threadId;
11451
+ for (let depth = 0; depth < MAX_DELEGATED_THREAD_LINEAGE; depth += 1) {
11452
+ if (await threadHasTenantRecord(tenantId, candidate)) return true;
11453
+ const boundary = candidate.lastIndexOf(DELEGATED_THREAD_SEPARATOR);
11454
+ if (boundary <= 0) return false;
11455
+ candidate = candidate.slice(0, boundary);
11456
+ }
11457
+ return false;
11458
+ }
11459
+ async function delegatedThreadOwnedBy(tenantId, assistantId, threadId) {
11460
+ const marker = `${DELEGATED_THREAD_SEPARATOR}${assistantId}_`;
11461
+ let boundary = threadId.indexOf(marker);
11462
+ while (boundary > 0) {
11463
+ if (await threadLineageRootedInTenant(tenantId, threadId.slice(0, boundary))) {
11464
+ return true;
11465
+ }
11466
+ boundary = threadId.indexOf(marker, boundary + DELEGATED_THREAD_SEPARATOR.length);
11467
+ }
11468
+ return false;
11469
+ }
11424
11470
  async function threadOwnedBy(tenantId, assistantId, threadId) {
11425
11471
  try {
11426
11472
  const thread = await (0, import_core7.getStoreLattice)("default", "thread").store.getThreadById(
@@ -11439,10 +11485,12 @@ async function threadOwnedBy(tenantId, assistantId, threadId) {
11439
11485
  try {
11440
11486
  const tasks = (0, import_core7.getStoreLattice)("default", "task").store;
11441
11487
  const matches = await tasks.list({ tenantId, threadId, limit: 1 });
11442
- return matches.some((task) => task.ownerType === "agent" && task.ownerId === assistantId);
11488
+ if (matches.some((task) => task.ownerType === "agent" && task.ownerId === assistantId)) {
11489
+ return true;
11490
+ }
11443
11491
  } catch {
11444
- return false;
11445
11492
  }
11493
+ return delegatedThreadOwnedBy(tenantId, assistantId, threadId);
11446
11494
  }
11447
11495
  async function threadIsNewForTenant(tenantId, threadId) {
11448
11496
  try {
@@ -11696,6 +11744,29 @@ async function listAllRuns(ledger, tenantId, threadId) {
11696
11744
  if (page.length < ACTIVE_RUN_PAGE_SIZE) return runs;
11697
11745
  }
11698
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
+ }
11699
11770
  function toSafeRun(run2) {
11700
11771
  return {
11701
11772
  runId: run2.runId,
@@ -11707,7 +11778,9 @@ function toSafeRun(run2) {
11707
11778
  createdAt: run2.createdAt,
11708
11779
  updatedAt: run2.updatedAt,
11709
11780
  startedAt: run2.startedAt,
11710
- finishedAt: run2.finishedAt
11781
+ finishedAt: run2.finishedAt,
11782
+ messageId: run2.inputMessageIds[0] ?? null,
11783
+ inputPreview: inputPreview(run2.input)
11711
11784
  };
11712
11785
  }
11713
11786
  function isTerminal(run2) {
@@ -11837,6 +11910,35 @@ function createRunLifecycleHandlers(deps = {}) {
11837
11910
  const pollIntervalMs = deps.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
11838
11911
  const now = deps.now ?? Date.now;
11839
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
+ };
11840
11942
  const waitForTerminal = async (tenantId, params, initial) => {
11841
11943
  let current4 = initial;
11842
11944
  const deadline = now() + waitTimeoutMs;
@@ -12066,35 +12168,6 @@ function createRunLifecycleHandlers(deps = {}) {
12066
12168
  const outcome2 = await createPending();
12067
12169
  return outcome2.ok ? respondCreated(outcome2.run) : outcome2.response;
12068
12170
  };
12069
- const withRunCreateLock = async (operation) => {
12070
- const key = runCreateScopeKey(tenantId, assistantId, threadId);
12071
- return serializeRunCreate(key, async () => {
12072
- const leaseStore = resolveLeaseStore();
12073
- if (!leaseStore) return operation();
12074
- try {
12075
- return await (0, import_core9.withLease)(
12076
- leaseStore,
12077
- key,
12078
- (0, import_core9.getReplicaId)(),
12079
- operation,
12080
- RUN_CREATE_LEASE
12081
- );
12082
- } catch (error) {
12083
- if (error instanceof import_core9.LeaseAcquisitionTimeoutError) {
12084
- request.log.warn(
12085
- { err: error, leaseKey: key },
12086
- "Run create lease acquisition timed out"
12087
- );
12088
- return unavailable(
12089
- reply,
12090
- RUN_CREATE_LOCK_TIMEOUT,
12091
- "Could not serialize run creation for this thread; retry shortly"
12092
- );
12093
- }
12094
- throw error;
12095
- }
12096
- });
12097
- };
12098
12171
  const scopedRunApiRuns = (runs) => runs.filter(
12099
12172
  (run2) => run2.tenantId === tenantId && run2.threadId === threadId && run2.assistantId === assistantId && run2.source === "run_api"
12100
12173
  );
@@ -12114,7 +12187,7 @@ function createRunLifecycleHandlers(deps = {}) {
12114
12187
  }
12115
12188
  };
12116
12189
  if (strategy === "reject") {
12117
- return withRunCreateLock(async () => {
12190
+ return withRunCreateLock(request, reply, tenantId, assistantId, threadId, async () => {
12118
12191
  const read = await readThreadRuns();
12119
12192
  if (!read.ok) return read.response;
12120
12193
  const active2 = scopedRunApiRuns(read.runs).filter(isActiveRun);
@@ -12130,7 +12203,7 @@ function createRunLifecycleHandlers(deps = {}) {
12130
12203
  });
12131
12204
  }
12132
12205
  if (strategy === "interrupt") {
12133
- return withRunCreateLock(async () => {
12206
+ return withRunCreateLock(request, reply, tenantId, assistantId, threadId, async () => {
12134
12207
  const read = await readThreadRuns();
12135
12208
  if (!read.ok) return read.response;
12136
12209
  const scoped = scopedRunApiRuns(read.runs);
@@ -12193,8 +12266,8 @@ function createRunLifecycleHandlers(deps = {}) {
12193
12266
  return createAndRespond();
12194
12267
  });
12195
12268
  }
12196
- if (strategy !== "rollback") return withRunCreateLock(createAndRespond);
12197
- return withRunCreateLock(async () => {
12269
+ if (strategy !== "rollback") return withRunCreateLock(request, reply, tenantId, assistantId, threadId, createAndRespond);
12270
+ return withRunCreateLock(request, reply, tenantId, assistantId, threadId, async () => {
12198
12271
  const active2 = (await listAllRuns(ledger, tenantId, threadId)).filter(
12199
12272
  (run2) => run2.tenantId === tenantId && run2.threadId === threadId && run2.assistantId === assistantId && run2.source !== "legacy" && (run2.status === "pending" || run2.status === "running")
12200
12273
  );
@@ -12329,6 +12402,76 @@ function createRunLifecycleHandlers(deps = {}) {
12329
12402
  return createAndRespond();
12330
12403
  });
12331
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
+ };
12332
12475
  const list = async (request, reply) => {
12333
12476
  if (!ledger) {
12334
12477
  return unavailable(reply, RUN_LEDGER_UNAVAILABLE, "Run ledger is not available");
@@ -12338,12 +12481,14 @@ function createRunLifecycleHandlers(deps = {}) {
12338
12481
  if (!await ownsThread(tenantId, assistantId, threadId)) {
12339
12482
  return notFound2(reply, THREAD_NOT_FOUND2, "Thread not found");
12340
12483
  }
12341
- const runs = (await ledger.listRuns(tenantId, threadId)).filter(
12342
- (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)
12343
12488
  );
12344
12489
  return reply.status(200).send({
12345
12490
  success: true,
12346
- data: { runs: runs.map(toSafeRun) }
12491
+ data: { runs: scoped.map(toSafeRun) }
12347
12492
  });
12348
12493
  };
12349
12494
  const get = async (request, reply) => {
@@ -12699,7 +12844,7 @@ function createRunLifecycleHandlers(deps = {}) {
12699
12844
  run: toSafeRun(outcome2.run)
12700
12845
  });
12701
12846
  };
12702
- return { create, list, get, join: join5, cancel };
12847
+ return { create, list, get, join: join5, cancel, cancelActive };
12703
12848
  }
12704
12849
  function registerRunLifecycleRoutes(app2, deps = {}) {
12705
12850
  const handlers = createRunLifecycleHandlers(deps);
@@ -12711,6 +12856,10 @@ function registerRunLifecycleRoutes(app2, deps = {}) {
12711
12856
  "/api/assistants/:assistantId/threads/:threadId/runs",
12712
12857
  handlers.list
12713
12858
  );
12859
+ app2.post(
12860
+ "/api/assistants/:assistantId/threads/:threadId/runs/cancel-active",
12861
+ handlers.cancelActive
12862
+ );
12714
12863
  app2.get(
12715
12864
  "/api/assistants/:assistantId/threads/:threadId/runs/:runId",
12716
12865
  handlers.get
@@ -29517,6 +29666,15 @@ function registerAgentWebAppRuntimeRoutes(app2, deps) {
29517
29666
  return normalizeError2(reply, error);
29518
29667
  }
29519
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
+ });
29520
29678
  routes.post(`${prefix}/assistants/:assistantId/threads/:threadId/runs/:runId/cancel`, async (request, reply) => {
29521
29679
  try {
29522
29680
  const params = mirrorRunParams.parse(request.params);