@axiom-lattice/gateway 11.1.0 → 11.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 (102) hide show
  1. package/dist/{chunk-JUA3VJE7.mjs → chunk-MQQGGIWU.mjs} +5 -19
  2. package/dist/{chunk-JUA3VJE7.mjs.map → chunk-MQQGGIWU.mjs.map} +1 -1
  3. package/dist/chunk-PSOMTQPW.mjs +138 -0
  4. package/dist/chunk-PSOMTQPW.mjs.map +1 -0
  5. package/dist/embed/embed-page-AgentDetailSideApp-UGLFIWJ3.js +1 -0
  6. package/dist/embed/embed-page-AgentGovernanceWorkbench-HZXQSMH2.js +1 -0
  7. package/dist/embed/{embed-page-LangfuseDashboard-HEHIDTTV.js → embed-page-LangfuseDashboard-L2LCWTBP.js} +1 -1
  8. package/dist/embed/embed-page-MessageGraph-BQUYKIK3.js +6 -0
  9. package/dist/embed/embed-page-ReactChart-5C6FIRZ4.js +1 -0
  10. package/dist/embed/embed-page-SkillFlow-MP72HEKD.js +1 -0
  11. package/dist/embed/{embed-page-TasksSideApp-PJ5LIIMG.js → embed-page-TasksSideApp-5JDZKFUH.js} +1 -1
  12. package/dist/embed/embed-page-TenantMonitorPanel-TIGNG44X.js +1 -0
  13. package/dist/embed/embed-page-ThreadMaintenancePanel-3OPCUQTF.js +1 -0
  14. package/dist/embed/{embed-page-TopologyRuntimeView-4UNE3VG5.js → embed-page-TopologyRuntimeView-7BRFAWID.js} +1 -1
  15. package/dist/embed/{embed-page-WorkflowAutomationView-AMNUEPOW.js → embed-page-WorkflowAutomationView-DKFNUAZY.js} +1 -1
  16. package/dist/embed/{embed-page-abnfDiagram-N423BO3Z-4HBLZWO7.js → embed-page-abnfDiagram-N423BO3Z-CRB43OW3.js} +1 -1
  17. package/dist/embed/embed-page-all-BS2CILLD.js +1 -0
  18. package/dist/embed/{embed-page-architectureDiagram-T3A2C74G-ZMH2RUZR.js → embed-page-architectureDiagram-T3A2C74G-N4QJM7EZ.js} +1 -1
  19. package/dist/embed/{embed-page-chunk-YW3P73TT.js → embed-page-chunk-32KEPBH4.js} +1 -1
  20. package/dist/embed/{embed-page-chunk-DFAZQFX4.js → embed-page-chunk-36VOH7DG.js} +13 -13
  21. package/dist/embed/{embed-page-chunk-UE7LEPK3.js → embed-page-chunk-77S6GKXR.js} +1 -1
  22. package/dist/embed/{embed-page-chunk-QPWSDWJ2.js → embed-page-chunk-7EEAFSMK.js} +1 -1
  23. package/dist/embed/{embed-page-chunk-EEHCG6K2.js → embed-page-chunk-A4EW4WEZ.js} +1 -1
  24. package/dist/embed/{embed-page-chunk-2LEOOAXJ.js → embed-page-chunk-A4I7H7RP.js} +1 -1
  25. package/dist/embed/{embed-page-chunk-UWC5QL3B.js → embed-page-chunk-BPNG3LLL.js} +1 -1
  26. package/dist/embed/{embed-page-chunk-YGBGMNRQ.js → embed-page-chunk-CBD4QXF2.js} +1 -1
  27. package/dist/embed/{embed-page-chunk-W4W6GR5T.js → embed-page-chunk-CR6PEMSJ.js} +1 -1
  28. package/dist/embed/{embed-page-chunk-JUZFORQA.js → embed-page-chunk-CS6LWVK2.js} +1 -1
  29. package/dist/embed/{embed-page-chunk-GD245YMF.js → embed-page-chunk-CSRF4YQD.js} +6 -6
  30. package/dist/embed/{embed-page-chunk-RPGUOUD3.js → embed-page-chunk-EMCH2FMD.js} +1 -1
  31. package/dist/embed/{embed-page-chunk-V5NE4FIR.js → embed-page-chunk-F52TPGBP.js} +1 -1
  32. package/dist/embed/embed-page-chunk-F5RPCW5O.js +216 -0
  33. package/dist/embed/embed-page-chunk-FYIVKZA2.js +1 -0
  34. package/dist/embed/{embed-page-chunk-TUVY65HW.js → embed-page-chunk-HGFIZATQ.js} +1 -1
  35. package/dist/embed/{embed-page-chunk-52VIWQVA.js → embed-page-chunk-HJYCGHWQ.js} +139 -139
  36. package/dist/embed/{embed-page-chunk-BJESMNTG.js → embed-page-chunk-I6Q3MSI4.js} +1 -1
  37. package/dist/embed/{embed-page-chunk-ZYYH2WHW.js → embed-page-chunk-IKESLNJH.js} +1 -1
  38. package/dist/embed/{embed-page-chunk-7IPWMDQ3.js → embed-page-chunk-OZUFLDHF.js} +1 -1
  39. package/dist/embed/embed-page-chunk-Q54ZBF3I.js +2 -0
  40. package/dist/embed/{embed-page-chunk-TWJOR2LG.js → embed-page-chunk-QWLZN3EX.js} +102 -102
  41. package/dist/embed/embed-page-chunk-VRVIRMMM.js +1 -0
  42. package/dist/embed/{embed-page-chunk-7TINC3YA.js → embed-page-chunk-WMHFEZXB.js} +1 -1
  43. package/dist/embed/{embed-page-chunk-SFG3O43S.js → embed-page-chunk-XGZYUTPS.js} +1 -1
  44. package/dist/embed/{embed-page-chunk-NY2J2ZAX.js → embed-page-chunk-ZX5EBQI5.js} +1 -1
  45. package/dist/embed/{embed-page-classDiagram-JCYQIIEL-QS7YU54N.js → embed-page-classDiagram-JCYQIIEL-NUQ6QNVB.js} +1 -1
  46. package/dist/embed/{embed-page-classDiagram-v2-OCEON4UE-EMQVQCCM.js → embed-page-classDiagram-v2-OCEON4UE-PGDM7DLE.js} +1 -1
  47. package/dist/embed/{embed-page-code-highlighter-LFX62WWR.js → embed-page-code-highlighter-VEQOWOHE.js} +1 -1
  48. package/dist/embed/{embed-page-cynefinDiagram-MW4NZA55-PAQOPJV2.js → embed-page-cynefinDiagram-MW4NZA55-WVU5T5A4.js} +1 -1
  49. package/dist/embed/{embed-page-dagre-VZM6K2ZE-35URH6ZO.js → embed-page-dagre-VZM6K2ZE-CAXZPEHO.js} +1 -1
  50. package/dist/embed/{embed-page-diagram-7IWD3JNH-CYEWFX2M.js → embed-page-diagram-7IWD3JNH-2RDNXDA6.js} +1 -1
  51. package/dist/embed/{embed-page-diagram-B4RE2ZJO-YQLA7HKI.js → embed-page-diagram-B4RE2ZJO-ZQTDRA2Q.js} +1 -1
  52. package/dist/embed/{embed-page-diagram-LBJQPF4R-R5X23WLT.js → embed-page-diagram-LBJQPF4R-QMUPQDDN.js} +1 -1
  53. package/dist/embed/{embed-page-diagram-Q27KOJAE-CSOUXGQI.js → embed-page-diagram-Q27KOJAE-SNK7KL7X.js} +1 -1
  54. package/dist/embed/{embed-page-diagram-UB23O5K3-ZYKI7DKR.js → embed-page-diagram-UB23O5K3-BTZB45HL.js} +1 -1
  55. package/dist/embed/{embed-page-ebnfDiagram-BXEA7PRR-AXHHSO6J.js → embed-page-ebnfDiagram-BXEA7PRR-6YXIIO2V.js} +1 -1
  56. package/dist/embed/{embed-page-en-3ML3AIGI.js → embed-page-en-2PUUB6AU.js} +1 -1
  57. package/dist/embed/embed-page-en-WCGOIHE7.js +1 -0
  58. package/dist/embed/{embed-page-erDiagram-JOGREHBK-TIWNY54V.js → embed-page-erDiagram-JOGREHBK-L5HOOC7O.js} +1 -1
  59. package/dist/embed/{embed-page-flowDiagram-UKHOOZJN-YZBV5FD5.js → embed-page-flowDiagram-UKHOOZJN-DG3SO7VX.js} +1 -1
  60. package/dist/embed/{embed-page-gitGraphDiagram-DS77QQ5N-JXOCEBS4.js → embed-page-gitGraphDiagram-DS77QQ5N-N2FD2D7W.js} +1 -1
  61. package/dist/embed/{embed-page-infoDiagram-6WML65LV-JXXYLFOE.js → embed-page-infoDiagram-6WML65LV-EQW3XJ3V.js} +1 -1
  62. package/dist/embed/{embed-page-kanban-definition-27J2QSJJ-GLES277J.js → embed-page-kanban-definition-27J2QSJJ-N2UULQCD.js} +1 -1
  63. package/dist/embed/{embed-page-mermaid-TRGRXQWI.js → embed-page-mermaid-VMLRSGBS.js} +2 -2
  64. package/dist/embed/{embed-page-mindmap-definition-FAOFIHXS-IK7SJKOY.js → embed-page-mindmap-definition-FAOFIHXS-HTKLKWBW.js} +1 -1
  65. package/dist/embed/{embed-page-pegDiagram-VL7TDLO6-WTW3QO5Z.js → embed-page-pegDiagram-VL7TDLO6-SA6LNRAH.js} +1 -1
  66. package/dist/embed/{embed-page-pieDiagram-7S7Q4E2Y-IO7RF3AF.js → embed-page-pieDiagram-7S7Q4E2Y-OMYAEVGG.js} +1 -1
  67. package/dist/embed/{embed-page-railroadDiagram-AXF67PYL-OW3L5JI4.js → embed-page-railroadDiagram-AXF67PYL-BDS2I2BL.js} +1 -1
  68. package/dist/embed/{embed-page-requirementDiagram-LRYGKXZP-APMTCGOA.js → embed-page-requirementDiagram-LRYGKXZP-7TQTEVRC.js} +1 -1
  69. package/dist/embed/{embed-page-stateDiagram-OKZ733FA-DYGG6K57.js → embed-page-stateDiagram-OKZ733FA-AJO67KCZ.js} +1 -1
  70. package/dist/embed/{embed-page-stateDiagram-v2-UEYNNEHI-BZIFN7WW.js → embed-page-stateDiagram-v2-UEYNNEHI-4ISQYRGQ.js} +1 -1
  71. package/dist/embed/{embed-page-swimlanes-SLNWSIFB-OKHSRANK.js → embed-page-swimlanes-SLNWSIFB-PEXIKADL.js} +1 -1
  72. package/dist/embed/{embed-page-swimlanesDiagram-ULZ7WXOC-CTOAIWO4.js → embed-page-swimlanesDiagram-ULZ7WXOC-M76ES3LS.js} +1 -1
  73. package/dist/embed/embed-page-t4-vb-FJS5HDYF.js +1 -0
  74. package/dist/embed/{embed-page-wardleyDiagram-T6FBY63Y-DL57P2VA.js → embed-page-wardleyDiagram-T6FBY63Y-B4SOYBIA.js} +1 -1
  75. package/dist/embed/embed-page-zh-JI3RZIRT.js +1 -0
  76. package/dist/embed/{embed-page-zh-ARIKNWNS.js → embed-page-zh-NFR2SOHA.js} +1 -1
  77. package/dist/embed/embed-page.js +1 -1
  78. package/dist/embed/mcp-app-page.js +36 -36
  79. package/dist/index.js +1383 -1075
  80. package/dist/index.js.map +1 -1
  81. package/dist/index.mjs +606 -452
  82. package/dist/index.mjs.map +1 -1
  83. package/dist/{open-TJLQARLV.mjs → open-IA7RD66P.mjs} +3 -2
  84. package/dist/{open-TJLQARLV.mjs.map → open-IA7RD66P.mjs.map} +1 -1
  85. package/dist/open-audit-B756NMRP.mjs +67 -0
  86. package/dist/open-audit-B756NMRP.mjs.map +1 -0
  87. package/dist/{open-files-QIMOTHSN.mjs → open-files-JKHNZ5FF.mjs} +3 -2
  88. package/dist/{open-files-QIMOTHSN.mjs.map → open-files-JKHNZ5FF.mjs.map} +1 -1
  89. package/package.json +8 -8
  90. package/dist/embed/embed-page-AgentDetailSideApp-CZFD577F.js +0 -1
  91. package/dist/embed/embed-page-AgentGovernanceWorkbench-BPNTELS5.js +0 -1
  92. package/dist/embed/embed-page-MessageGraph-W5KMRMHF.js +0 -6
  93. package/dist/embed/embed-page-ReactChart-LOQULL4T.js +0 -1
  94. package/dist/embed/embed-page-SkillFlow-4KLNJILK.js +0 -1
  95. package/dist/embed/embed-page-ThreadMaintenancePanel-NTWT4SEQ.js +0 -1
  96. package/dist/embed/embed-page-all-6R5IZE46.js +0 -1
  97. package/dist/embed/embed-page-chunk-LMWLK4X2.js +0 -1
  98. package/dist/embed/embed-page-chunk-ZZPEVBX2.js +0 -217
  99. package/dist/embed/embed-page-t4-vb-5IKMGA3I.js +0 -1
  100. package/dist/open-audit-UJ3NXCGW.mjs +0 -32
  101. package/dist/open-audit-UJ3NXCGW.mjs.map +0 -1
  102. /package/dist/embed/{embed-page-chunk-XRN4MSDO.js → embed-page-chunk-3NCDEXPW.js} +0 -0
package/dist/index.mjs CHANGED
@@ -45,6 +45,10 @@ import {
45
45
  import {
46
46
  buildPreviewTokenScript
47
47
  } from "./chunk-WKHTSTB6.mjs";
48
+ import {
49
+ PLATFORM_AUDIT_MAX_CAPTURE_BYTES,
50
+ PlatformAuditService
51
+ } from "./chunk-PSOMTQPW.mjs";
48
52
  import "./chunk-EXPERMZR.mjs";
49
53
  import {
50
54
  A2A_KEY_CHANGED_TOPIC,
@@ -4372,6 +4376,45 @@ function registerThreadReadRoutes(app2) {
4372
4376
  );
4373
4377
  }
4374
4378
 
4379
+ // src/routes/tenant-monitor.ts
4380
+ import {
4381
+ getStoreLattice as getStoreLattice11
4382
+ } from "@axiom-lattice/core";
4383
+
4384
+ // src/controllers/tenant-scope.ts
4385
+ var TenantScopeError = class extends Error {
4386
+ /** Creates a tenant scope error. */
4387
+ constructor(code, statusCode, message) {
4388
+ super(message);
4389
+ this.code = code;
4390
+ this.statusCode = statusCode;
4391
+ this.name = "TenantScopeError";
4392
+ }
4393
+ };
4394
+ function resolveTenantScope(request, authRequired2) {
4395
+ const authenticated = request.user?.tenantId;
4396
+ const header2 = request.headers["x-tenant-id"];
4397
+ const requested = Array.isArray(header2) ? header2[0] : header2;
4398
+ if (authenticated) {
4399
+ if (requested && requested !== authenticated) {
4400
+ throw new TenantScopeError(
4401
+ "TENANT_ACCESS_DENIED",
4402
+ 403,
4403
+ "Tenant access denied"
4404
+ );
4405
+ }
4406
+ return { tenantId: authenticated, userId: request.user?.id };
4407
+ }
4408
+ if (authRequired2) {
4409
+ throw new TenantScopeError(
4410
+ "UNAUTHENTICATED",
4411
+ 401,
4412
+ "Console session required"
4413
+ );
4414
+ }
4415
+ return { tenantId: requested || "default" };
4416
+ }
4417
+
4375
4418
  // src/routes/run-lifecycle.ts
4376
4419
  import {
4377
4420
  AgentRunDuplicateMessageIdError as AgentRunDuplicateMessageIdError2,
@@ -5593,6 +5636,276 @@ function registerRunLifecycleRoutes(app2, deps = {}) {
5593
5636
  );
5594
5637
  }
5595
5638
 
5639
+ // src/routes/tenant-monitor.ts
5640
+ var THREAD_KINDS = /* @__PURE__ */ new Set([
5641
+ "conversation",
5642
+ "room_presence",
5643
+ "task_execution",
5644
+ "open_api",
5645
+ "web_app",
5646
+ "cron",
5647
+ "channel"
5648
+ ]);
5649
+ var RUN_STATUSES = /* @__PURE__ */ new Set([
5650
+ "pending",
5651
+ "running",
5652
+ "success",
5653
+ "error",
5654
+ "interrupted",
5655
+ "cancelled",
5656
+ "timeout"
5657
+ ]);
5658
+ var RUN_SOURCES = /* @__PURE__ */ new Set(["run_api", "legacy", "project_task"]);
5659
+ var MAX_LIMIT = 200;
5660
+ var DEFAULT_LIMIT = 50;
5661
+ function toMonitorRun(run2) {
5662
+ return {
5663
+ ...toSafeRun(run2),
5664
+ assistantId: run2.assistantId,
5665
+ threadId: run2.threadId,
5666
+ ...run2.workspaceId ? { workspaceId: run2.workspaceId } : {},
5667
+ ...run2.projectId ? { projectId: run2.projectId } : {},
5668
+ source: run2.source ?? "legacy",
5669
+ ...run2.taskId ? { taskId: run2.taskId } : {},
5670
+ leaseExpiresAt: run2.leaseExpiresAt
5671
+ };
5672
+ }
5673
+ function unavailable2(reply, code, error) {
5674
+ return reply.status(503).send({ success: false, code, error });
5675
+ }
5676
+ function badQuery(reply, error) {
5677
+ return reply.status(400).send({ success: false, code: "BAD_QUERY", error });
5678
+ }
5679
+ function firstValue(value) {
5680
+ if (typeof value === "string") return value;
5681
+ if (Array.isArray(value) && typeof value[0] === "string") return value[0];
5682
+ return void 0;
5683
+ }
5684
+ function parseLimit(value) {
5685
+ const raw = firstValue(value);
5686
+ if (raw === void 0) return DEFAULT_LIMIT;
5687
+ const parsed = Number(raw);
5688
+ if (!Number.isInteger(parsed) || parsed < 1) return void 0;
5689
+ return Math.min(MAX_LIMIT, parsed);
5690
+ }
5691
+ function parseOffset(value) {
5692
+ const raw = firstValue(value);
5693
+ if (raw === void 0) return 0;
5694
+ const parsed = Number(raw);
5695
+ if (!Number.isInteger(parsed) || parsed < 0) return void 0;
5696
+ return parsed;
5697
+ }
5698
+ function parseDate(value) {
5699
+ const raw = firstValue(value);
5700
+ if (raw === void 0 || raw === "") return void 0;
5701
+ const parsed = Date.parse(raw);
5702
+ return Number.isFinite(parsed) ? new Date(parsed).toISOString() : null;
5703
+ }
5704
+ async function authorize(request, reply, deps) {
5705
+ let scope;
5706
+ try {
5707
+ scope = resolveTenantScope(request, deps.authRequired);
5708
+ } catch (error) {
5709
+ if (error instanceof TenantScopeError) {
5710
+ reply.status(error.statusCode).send({
5711
+ success: false,
5712
+ code: error.code,
5713
+ error: error.message
5714
+ });
5715
+ return void 0;
5716
+ }
5717
+ throw error;
5718
+ }
5719
+ if (!scope.userId) return scope;
5720
+ const link = await deps.userTenantLinkStore.getLink(
5721
+ scope.userId,
5722
+ scope.tenantId
5723
+ );
5724
+ if (!link) {
5725
+ reply.status(403).send({
5726
+ success: false,
5727
+ code: "TENANT_ACCESS_DENIED",
5728
+ error: "Tenant access denied"
5729
+ });
5730
+ return void 0;
5731
+ }
5732
+ if (link.role !== "owner" && link.role !== "admin") {
5733
+ reply.status(403).send({
5734
+ success: false,
5735
+ code: "FORBIDDEN_ROLE",
5736
+ error: "Only tenant owner or admin can view the monitor"
5737
+ });
5738
+ return void 0;
5739
+ }
5740
+ return scope;
5741
+ }
5742
+ function resolveThreadStore(deps) {
5743
+ try {
5744
+ return deps.getThreadStore?.() ?? getStoreLattice11("default", "thread").store;
5745
+ } catch {
5746
+ return void 0;
5747
+ }
5748
+ }
5749
+ function resolveRunLedger(deps) {
5750
+ try {
5751
+ return deps.getRunLedger?.() ?? getStoreLattice11("default", "agentRun").store;
5752
+ } catch {
5753
+ return void 0;
5754
+ }
5755
+ }
5756
+ function resolveQueueStore(deps) {
5757
+ try {
5758
+ return deps.getQueueStore?.() ?? getStoreLattice11("default", "threadMessageQueue").store;
5759
+ } catch {
5760
+ return void 0;
5761
+ }
5762
+ }
5763
+ function registerTenantMonitorRoutes(app2, deps) {
5764
+ const now = deps.now ?? Date.now;
5765
+ app2.get(
5766
+ "/api/tenant-monitor/overview",
5767
+ { preHandler: platformTenantPlaneGuard },
5768
+ async (request, reply) => {
5769
+ const scope = await authorize(request, reply, deps);
5770
+ if (!scope) return;
5771
+ const rawHours = firstValue(
5772
+ request.query.sinceHours
5773
+ );
5774
+ let sinceHours = 24;
5775
+ if (rawHours !== void 0) {
5776
+ const parsed = Number(rawHours);
5777
+ if (!Number.isFinite(parsed)) {
5778
+ return badQuery(reply, "Invalid sinceHours");
5779
+ }
5780
+ sinceHours = Math.min(720, Math.max(1, parsed));
5781
+ }
5782
+ const ledger = resolveRunLedger(deps);
5783
+ const queueStore = resolveQueueStore(deps);
5784
+ if (!ledger) {
5785
+ return unavailable2(
5786
+ reply,
5787
+ "RUN_LEDGER_UNAVAILABLE",
5788
+ "Run ledger is not available"
5789
+ );
5790
+ }
5791
+ if (!queueStore) {
5792
+ return unavailable2(
5793
+ reply,
5794
+ "QUEUE_STORE_UNAVAILABLE",
5795
+ "Queue store is not available"
5796
+ );
5797
+ }
5798
+ const since = new Date(now() - sinceHours * 60 * 60 * 1e3).toISOString();
5799
+ const [summary, pending2] = await Promise.all([
5800
+ ledger.summaryByTenant(scope.tenantId, { since }),
5801
+ queueStore.getThreadsWithPendingMessages(scope.tenantId)
5802
+ ]);
5803
+ return reply.send({
5804
+ success: true,
5805
+ data: {
5806
+ since,
5807
+ counts: summary.counts,
5808
+ oldestPendingAgeMs: summary.oldestPendingAgeMs,
5809
+ stuckRunning: summary.stuckRunning,
5810
+ pendingThreads: pending2.filter((thread) => thread.hasPending === true).length
5811
+ }
5812
+ });
5813
+ }
5814
+ );
5815
+ app2.get(
5816
+ "/api/tenant-monitor/threads",
5817
+ { preHandler: platformTenantPlaneGuard },
5818
+ async (request, reply) => {
5819
+ const scope = await authorize(request, reply, deps);
5820
+ if (!scope) return;
5821
+ const query = request.query;
5822
+ const limit = parseLimit(query.limit);
5823
+ const offset = parseOffset(query.offset);
5824
+ const createdAfter = parseDate(query.createdAfter);
5825
+ if (limit === void 0 || offset === void 0) {
5826
+ return badQuery(reply, "Invalid pagination");
5827
+ }
5828
+ if (createdAfter === null) {
5829
+ return badQuery(reply, "Invalid createdAfter");
5830
+ }
5831
+ const kind = firstValue(query.kind);
5832
+ if (kind !== void 0 && !THREAD_KINDS.has(kind)) {
5833
+ return badQuery(reply, "Invalid kind");
5834
+ }
5835
+ const store2 = resolveThreadStore(deps);
5836
+ if (!store2) {
5837
+ return unavailable2(
5838
+ reply,
5839
+ "THREAD_STORE_UNAVAILABLE",
5840
+ "Thread store is not available"
5841
+ );
5842
+ }
5843
+ const result = await store2.listThreadsByTenant(scope.tenantId, {
5844
+ limit,
5845
+ offset,
5846
+ ...kind ? { kind } : {},
5847
+ ...firstValue(query.assistantId) ? { assistantId: firstValue(query.assistantId) } : {},
5848
+ ...createdAfter ? { createdAfter } : {}
5849
+ });
5850
+ return reply.send({
5851
+ success: true,
5852
+ data: { ...result, limit, offset }
5853
+ });
5854
+ }
5855
+ );
5856
+ app2.get(
5857
+ "/api/tenant-monitor/runs",
5858
+ { preHandler: platformTenantPlaneGuard },
5859
+ async (request, reply) => {
5860
+ const scope = await authorize(request, reply, deps);
5861
+ if (!scope) return;
5862
+ const query = request.query;
5863
+ const limit = parseLimit(query.limit);
5864
+ const offset = parseOffset(query.offset);
5865
+ const createdAfter = parseDate(query.createdAfter);
5866
+ if (limit === void 0 || offset === void 0) {
5867
+ return badQuery(reply, "Invalid pagination");
5868
+ }
5869
+ if (createdAfter === null) {
5870
+ return badQuery(reply, "Invalid createdAfter");
5871
+ }
5872
+ const status = firstValue(query.status);
5873
+ if (status !== void 0 && !RUN_STATUSES.has(status)) {
5874
+ return badQuery(reply, "Invalid status");
5875
+ }
5876
+ const source = firstValue(query.source);
5877
+ if (source !== void 0 && !RUN_SOURCES.has(source)) {
5878
+ return badQuery(reply, "Invalid source");
5879
+ }
5880
+ const ledger = resolveRunLedger(deps);
5881
+ if (!ledger) {
5882
+ return unavailable2(
5883
+ reply,
5884
+ "RUN_LEDGER_UNAVAILABLE",
5885
+ "Run ledger is not available"
5886
+ );
5887
+ }
5888
+ const result = await ledger.listRunsByTenant(scope.tenantId, {
5889
+ limit,
5890
+ offset,
5891
+ ...status ? { status } : {},
5892
+ ...source ? { source } : {},
5893
+ ...firstValue(query.assistantId) ? { assistantId: firstValue(query.assistantId) } : {},
5894
+ ...createdAfter ? { createdAfter } : {}
5895
+ });
5896
+ return reply.send({
5897
+ success: true,
5898
+ data: {
5899
+ records: result.records.map(toMonitorRun),
5900
+ total: result.total,
5901
+ limit,
5902
+ offset
5903
+ }
5904
+ });
5905
+ }
5906
+ );
5907
+ }
5908
+
5596
5909
  // src/controllers/thread-events.ts
5597
5910
  import {
5598
5911
  chunkBufferStreamKey as chunkBufferStreamKey4,
@@ -6645,7 +6958,7 @@ function registerCommandRoutes(app2) {
6645
6958
  import { randomUUID as randomUUID9 } from "crypto";
6646
6959
  import {
6647
6960
  getReplicaId as getReplicaId4,
6648
- getStoreLattice as getStoreLattice11,
6961
+ getStoreLattice as getStoreLattice12,
6649
6962
  tryAcquireThreadRun
6650
6963
  } from "@axiom-lattice/core";
6651
6964
 
@@ -6693,7 +7006,7 @@ function metadataString3(metadata, key) {
6693
7006
  return typeof value === "string" && value.length > 0 ? value : void 0;
6694
7007
  }
6695
7008
  async function threadHasPendingMessages(thread, request) {
6696
- const queueStore = getStoreLattice11("default", "threadMessageQueue").store;
7009
+ const queueStore = getStoreLattice12("default", "threadMessageQueue").store;
6697
7010
  const pending2 = await queueStore.getPendingMessages(
6698
7011
  thread.id,
6699
7012
  queueScopeFromThread(thread, {
@@ -6723,7 +7036,7 @@ async function copyThreadHandler(request, reply) {
6723
7036
  let lease;
6724
7037
  try {
6725
7038
  lease = await tryAcquireThreadRun({
6726
- store: getStoreLattice11("default", "lease").store,
7039
+ store: getStoreLattice12("default", "lease").store,
6727
7040
  tenantId,
6728
7041
  assistantId,
6729
7042
  threadId,
@@ -6746,7 +7059,7 @@ async function copyThreadHandler(request, reply) {
6746
7059
  return reply.status(501).send({ success: false, error: MAINTENANCE_UNAVAILABLE });
6747
7060
  }
6748
7061
  try {
6749
- const threadStore = getStoreLattice11("default", "thread").store;
7062
+ const threadStore = getStoreLattice12("default", "thread").store;
6750
7063
  const targetId = randomUUID9();
6751
7064
  const metadata = {
6752
7065
  ...thread.metadata ?? {},
@@ -6811,7 +7124,7 @@ async function pruneThreadHandler(request, reply) {
6811
7124
  let lease;
6812
7125
  try {
6813
7126
  lease = await tryAcquireThreadRun({
6814
- store: getStoreLattice11("default", "lease").store,
7127
+ store: getStoreLattice12("default", "lease").store,
6815
7128
  tenantId,
6816
7129
  assistantId,
6817
7130
  threadId,
@@ -6880,7 +7193,7 @@ import {
6880
7193
  STORE_IDENTITY_SEPARATOR,
6881
7194
  storeExpiresAt
6882
7195
  } from "@axiom-lattice/protocols";
6883
- import { getStoreLattice as getStoreLattice12 } from "@axiom-lattice/core";
7196
+ import { getStoreLattice as getStoreLattice13 } from "@axiom-lattice/core";
6884
7197
  var MAX_NAMESPACE_SEGMENTS = 32;
6885
7198
  var MAX_NAMESPACE_SEGMENT_LENGTH = 256;
6886
7199
  var MAX_KEY_LENGTH2 = 1024;
@@ -6925,7 +7238,7 @@ function parseNamespaceQuery(value) {
6925
7238
  }
6926
7239
  return validNamespace([value]);
6927
7240
  }
6928
- function parseLimit(value, fallback, max) {
7241
+ function parseLimit2(value, fallback, max) {
6929
7242
  if (value === void 0) return fallback;
6930
7243
  if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) return void 0;
6931
7244
  return Math.min(value, max);
@@ -6949,7 +7262,7 @@ function storeFailure(request, reply, error) {
6949
7262
  return reply.status(500).send({ success: false, error: "Store operation failed" });
6950
7263
  }
6951
7264
  function store() {
6952
- return getStoreLattice12("default", "store").store;
7265
+ return getStoreLattice13("default", "store").store;
6953
7266
  }
6954
7267
  async function putStoreItem(request, reply) {
6955
7268
  const body = isPlainObject2(request.body) ? request.body : {};
@@ -7016,8 +7329,8 @@ async function searchStoreItems(request, reply) {
7016
7329
  if (body.query !== void 0 && typeof body.query !== "string") {
7017
7330
  return badRequest3(reply, "query must be a string");
7018
7331
  }
7019
- const limit = parseLimit(body.limit, DEFAULT_SEARCH_LIMIT, MAX_SEARCH_LIMIT);
7020
- const offset = parseLimit(body.offset, 0, Number.MAX_SAFE_INTEGER);
7332
+ const limit = parseLimit2(body.limit, DEFAULT_SEARCH_LIMIT, MAX_SEARCH_LIMIT);
7333
+ const offset = parseLimit2(body.offset, 0, Number.MAX_SAFE_INTEGER);
7021
7334
  if (limit === void 0) return badRequest3(reply, "limit must be a non-negative integer");
7022
7335
  if (offset === void 0) return badRequest3(reply, "offset must be a non-negative integer");
7023
7336
  const input = {
@@ -7040,7 +7353,7 @@ async function listStoreNamespaces(request, reply) {
7040
7353
  prefix = validPrefix(body.prefix);
7041
7354
  if (!prefix) return badRequest3(reply, "prefix must be a string array");
7042
7355
  }
7043
- const limit = parseLimit(body.limit, DEFAULT_NAMESPACE_LIMIT, MAX_NAMESPACE_LIMIT);
7356
+ const limit = parseLimit2(body.limit, DEFAULT_NAMESPACE_LIMIT, MAX_NAMESPACE_LIMIT);
7044
7357
  if (limit === void 0) return badRequest3(reply, "limit must be a non-negative integer");
7045
7358
  try {
7046
7359
  const namespaces = await store().listNamespaces(getTenantId10(request), prefix, limit);
@@ -7063,7 +7376,7 @@ import {
7063
7376
  agentLatticeManager as agentLatticeManager4,
7064
7377
  parseCronExpression,
7065
7378
  scheduleLatticeManager,
7066
- getStoreLattice as getStoreLattice13
7379
+ getStoreLattice as getStoreLattice14
7067
7380
  } from "@axiom-lattice/core";
7068
7381
 
7069
7382
  // src/services/crons/agentCronService.ts
@@ -7243,8 +7556,8 @@ function registerAgentCronHandler(scheduleLattice, deps) {
7243
7556
  import {
7244
7557
  ScheduledTaskStatus
7245
7558
  } from "@axiom-lattice/protocols";
7246
- var DEFAULT_LIMIT = 50;
7247
- var MAX_LIMIT = 100;
7559
+ var DEFAULT_LIMIT2 = 50;
7560
+ var MAX_LIMIT2 = 100;
7248
7561
  var SHARED_ASSISTANT_TENANT_ID = "default";
7249
7562
  function getTenantId11(request) {
7250
7563
  const userTenantId = request.user?.tenantId;
@@ -7289,7 +7602,7 @@ function badRequest4(reply, error) {
7289
7602
  function notFound5(reply) {
7290
7603
  return reply.status(404).send({ success: false, error: "Cron not found" });
7291
7604
  }
7292
- function unavailable2(reply) {
7605
+ function unavailable3(reply) {
7293
7606
  return reply.status(503).send({ success: false, error: "Scheduling is not configured" });
7294
7607
  }
7295
7608
  function failure2(request, reply, error) {
@@ -7313,7 +7626,7 @@ async function resolveCronScope(body, tenantId) {
7313
7626
  }
7314
7627
  if (projectId !== void 0) {
7315
7628
  try {
7316
- const projectStore = getStoreLattice13("default", "project").store;
7629
+ const projectStore = getStoreLattice14("default", "project").store;
7317
7630
  const project = await projectStore.getProjectById(tenantId, projectId);
7318
7631
  if (!project || project.tenantId !== tenantId) {
7319
7632
  return { ok: false, status: 404, error: "Project not found" };
@@ -7338,7 +7651,7 @@ async function resolveCronScope(body, tenantId) {
7338
7651
  }
7339
7652
  if (workspaceId !== void 0) {
7340
7653
  try {
7341
- const workspaceStore = getStoreLattice13("default", "workspace").store;
7654
+ const workspaceStore = getStoreLattice14("default", "workspace").store;
7342
7655
  const workspace = await workspaceStore.getWorkspaceById(tenantId, workspaceId);
7343
7656
  if (!workspace || workspace.tenantId !== tenantId) {
7344
7657
  return { ok: false, status: 404, error: "Workspace not found" };
@@ -7437,7 +7750,7 @@ async function createThreadCron(request, reply) {
7437
7750
  }
7438
7751
  let thread;
7439
7752
  try {
7440
- thread = await getStoreLattice13("default", "thread").store.getThreadById(
7753
+ thread = await getStoreLattice14("default", "thread").store.getThreadById(
7441
7754
  tenantId,
7442
7755
  request.params.threadId
7443
7756
  );
@@ -7446,7 +7759,7 @@ async function createThreadCron(request, reply) {
7446
7759
  }
7447
7760
  if (!thread) return reply.status(404).send({ success: false, error: "Thread not found" });
7448
7761
  const lattice = schedule();
7449
- if (!lattice || !storageOf(lattice)) return unavailable2(reply);
7762
+ if (!lattice || !storageOf(lattice)) return unavailable3(reply);
7450
7763
  const cronId = randomUUID11();
7451
7764
  try {
7452
7765
  const scheduled = await lattice.client.scheduleCron(cronId, AGENT_CRON_TASK_TYPE, payload, {
@@ -7498,7 +7811,7 @@ async function createStatelessCron(request, reply) {
7498
7811
  }
7499
7812
  const tenantId = getTenantId11(request);
7500
7813
  try {
7501
- const assistant = await getStoreLattice13("default", "assistant").store.getAssistantById(
7814
+ const assistant = await getStoreLattice14("default", "assistant").store.getAssistantById(
7502
7815
  tenantId,
7503
7816
  body.assistant_id
7504
7817
  );
@@ -7520,7 +7833,7 @@ async function createStatelessCron(request, reply) {
7520
7833
  });
7521
7834
  }
7522
7835
  const lattice = schedule();
7523
- if (!lattice || !storageOf(lattice)) return unavailable2(reply);
7836
+ if (!lattice || !storageOf(lattice)) return unavailable3(reply);
7524
7837
  const cronId = randomUUID11();
7525
7838
  try {
7526
7839
  const scheduled = await lattice.client.scheduleCron(cronId, AGENT_CRON_TASK_TYPE, payload, {
@@ -7557,9 +7870,9 @@ function filtersFromBody(body) {
7557
7870
  if (body.enabled !== void 0 && typeof body.enabled !== "boolean") {
7558
7871
  return "enabled must be a boolean";
7559
7872
  }
7560
- const limit = body.limit === void 0 ? DEFAULT_LIMIT : body.limit;
7561
- if (typeof limit !== "number" || !Number.isSafeInteger(limit) || limit < 0 || limit > MAX_LIMIT) {
7562
- return `limit must be an integer between 0 and ${MAX_LIMIT}`;
7873
+ const limit = body.limit === void 0 ? DEFAULT_LIMIT2 : body.limit;
7874
+ if (typeof limit !== "number" || !Number.isSafeInteger(limit) || limit < 0 || limit > MAX_LIMIT2) {
7875
+ return `limit must be an integer between 0 and ${MAX_LIMIT2}`;
7563
7876
  }
7564
7877
  const offset = body.offset === void 0 ? 0 : body.offset;
7565
7878
  if (typeof offset !== "number" || !Number.isSafeInteger(offset) || offset < 0) {
@@ -7579,7 +7892,7 @@ async function searchCrons(request, reply) {
7579
7892
  if (typeof filters === "string") return badRequest4(reply, filters);
7580
7893
  const lattice = schedule();
7581
7894
  const storage = lattice ? storageOf(lattice) : null;
7582
- if (!lattice || !storage) return unavailable2(reply);
7895
+ if (!lattice || !storage) return unavailable3(reply);
7583
7896
  try {
7584
7897
  const tasks = await storage.getAllTasks({
7585
7898
  tenantId: getTenantId11(request),
@@ -7601,7 +7914,7 @@ async function countCrons(request, reply) {
7601
7914
  if (typeof filters === "string") return badRequest4(reply, filters);
7602
7915
  const lattice = schedule();
7603
7916
  const storage = lattice ? storageOf(lattice) : null;
7604
- if (!lattice || !storage) return unavailable2(reply);
7917
+ if (!lattice || !storage) return unavailable3(reply);
7605
7918
  try {
7606
7919
  const count = await storage.countTasks({
7607
7920
  tenantId: getTenantId11(request),
@@ -7617,7 +7930,7 @@ async function countCrons(request, reply) {
7617
7930
  }
7618
7931
  async function getCron(request, reply) {
7619
7932
  const lattice = schedule();
7620
- if (!lattice) return unavailable2(reply);
7933
+ if (!lattice) return unavailable3(reply);
7621
7934
  try {
7622
7935
  const task = await findOwnedCron(lattice, getTenantId11(request), request.params.cronId);
7623
7936
  if (!task) return notFound5(reply);
@@ -7633,7 +7946,7 @@ async function patchCron(request, reply) {
7633
7946
  return badRequest4(reply, "only enabled can be patched");
7634
7947
  }
7635
7948
  const lattice = schedule();
7636
- if (!lattice) return unavailable2(reply);
7949
+ if (!lattice) return unavailable3(reply);
7637
7950
  try {
7638
7951
  const task = await findOwnedCron(lattice, getTenantId11(request), request.params.cronId);
7639
7952
  if (!task) return notFound5(reply);
@@ -7663,7 +7976,7 @@ async function patchCron(request, reply) {
7663
7976
  }
7664
7977
  async function deleteCron(request, reply) {
7665
7978
  const lattice = schedule();
7666
- if (!lattice) return unavailable2(reply);
7979
+ if (!lattice) return unavailable3(reply);
7667
7980
  try {
7668
7981
  const task = await findOwnedCron(lattice, getTenantId11(request), request.params.cronId);
7669
7982
  if (!task) return notFound5(reply);
@@ -8010,7 +8323,7 @@ async function updateModels(request, reply) {
8010
8323
  }
8011
8324
 
8012
8325
  // src/services/multiReplicaReadiness.ts
8013
- import { getStoreLattice as getStoreLattice14 } from "@axiom-lattice/core";
8326
+ import { getStoreLattice as getStoreLattice15 } from "@axiom-lattice/core";
8014
8327
 
8015
8328
  // src/services/sharedStore.ts
8016
8329
  var NON_SHARED_STORE_PREFIXES = ["InMemory", "Local"];
@@ -8054,7 +8367,7 @@ function isMultiReplicaDeclared() {
8054
8367
  }
8055
8368
  function storeInstance(kind) {
8056
8369
  try {
8057
- return getStoreLattice14("default", kind).store;
8370
+ return getStoreLattice15("default", kind).store;
8058
8371
  } catch {
8059
8372
  return void 0;
8060
8373
  }
@@ -8250,42 +8563,6 @@ import {
8250
8563
  ObservabilityDashboardUnsupportedError,
8251
8564
  ObservabilityLatticeManager
8252
8565
  } from "@axiom-lattice/core";
8253
-
8254
- // src/controllers/tenant-scope.ts
8255
- var TenantScopeError = class extends Error {
8256
- /** Creates a tenant scope error. */
8257
- constructor(code, statusCode, message) {
8258
- super(message);
8259
- this.code = code;
8260
- this.statusCode = statusCode;
8261
- this.name = "TenantScopeError";
8262
- }
8263
- };
8264
- function resolveTenantScope(request, authRequired2) {
8265
- const authenticated = request.user?.tenantId;
8266
- const header2 = request.headers["x-tenant-id"];
8267
- const requested = Array.isArray(header2) ? header2[0] : header2;
8268
- if (authenticated) {
8269
- if (requested && requested !== authenticated) {
8270
- throw new TenantScopeError(
8271
- "TENANT_ACCESS_DENIED",
8272
- 403,
8273
- "Tenant access denied"
8274
- );
8275
- }
8276
- return { tenantId: authenticated, userId: request.user?.id };
8277
- }
8278
- if (authRequired2) {
8279
- throw new TenantScopeError(
8280
- "UNAUTHENTICATED",
8281
- 401,
8282
- "Console session required"
8283
- );
8284
- }
8285
- return { tenantId: requested || "default" };
8286
- }
8287
-
8288
- // src/controllers/observability.ts
8289
8566
  var logger = new Logger({ serviceName: "lattice/gateway/observability" });
8290
8567
  var DASHBOARD_RANGES = /* @__PURE__ */ new Set([
8291
8568
  "1h",
@@ -8400,7 +8677,7 @@ async function getObservabilityDashboard(request, reply) {
8400
8677
  // src/controllers/system-metrics.ts
8401
8678
  import {
8402
8679
  getReplicaId as getReplicaId5,
8403
- getStoreLattice as getStoreLattice15
8680
+ getStoreLattice as getStoreLattice16
8404
8681
  } from "@axiom-lattice/core";
8405
8682
 
8406
8683
  // src/services/execution/executionSupervisorRuntime.ts
@@ -8771,14 +9048,14 @@ function resolveSystemMetricsDeps() {
8771
9048
  }
8772
9049
  function optionalRunLedger() {
8773
9050
  try {
8774
- return getStoreLattice15("default", "agentRun").store;
9051
+ return getStoreLattice16("default", "agentRun").store;
8775
9052
  } catch {
8776
9053
  return void 0;
8777
9054
  }
8778
9055
  }
8779
9056
  function optionalQueueStore() {
8780
9057
  try {
8781
- return getStoreLattice15("default", "threadMessageQueue").store;
9058
+ return getStoreLattice16("default", "threadMessageQueue").store;
8782
9059
  } catch {
8783
9060
  return void 0;
8784
9061
  }
@@ -9946,7 +10223,7 @@ async function getToolConfigs(request, reply) {
9946
10223
 
9947
10224
  // src/controllers/data-query.ts
9948
10225
  import {
9949
- getStoreLattice as getStoreLattice16,
10226
+ getStoreLattice as getStoreLattice17,
9950
10227
  metricsServerManager
9951
10228
  } from "@axiom-lattice/core";
9952
10229
  function getTenantId15(request) {
@@ -9979,7 +10256,7 @@ async function executeDataQuery(request, reply) {
9979
10256
  message: "Cannot provide both metrics and customSql. Use one query type only."
9980
10257
  };
9981
10258
  }
9982
- const storeLattice = getStoreLattice16("default", "metrics");
10259
+ const storeLattice = getStoreLattice17("default", "metrics");
9983
10260
  const store2 = storeLattice.store;
9984
10261
  if (!body.serverKey) {
9985
10262
  reply.code(400);
@@ -10088,7 +10365,7 @@ async function executeSqlQuery(client, body, reply) {
10088
10365
 
10089
10366
  // src/controllers/workflow-tracking.ts
10090
10367
  import {
10091
- getStoreLattice as getStoreLattice17,
10368
+ getStoreLattice as getStoreLattice18,
10092
10369
  agentInstanceManager as agentInstanceManager7,
10093
10370
  ThreadStatus as ThreadStatus2,
10094
10371
  abortWorkflowRun as signalAbort
@@ -10180,7 +10457,7 @@ function getTenantId16(request) {
10180
10457
  }
10181
10458
  function getTrackingStore() {
10182
10459
  try {
10183
- const storeLattice = getStoreLattice17("default", "workflowTracking");
10460
+ const storeLattice = getStoreLattice18("default", "workflowTracking");
10184
10461
  return storeLattice.store;
10185
10462
  } catch {
10186
10463
  return null;
@@ -10196,7 +10473,7 @@ async function getAllWorkflowRuns(request, reply) {
10196
10473
  }
10197
10474
  const nameMap = {};
10198
10475
  try {
10199
- const asStoreLattice = getStoreLattice17("default", "assistant");
10476
+ const asStoreLattice = getStoreLattice18("default", "assistant");
10200
10477
  const assistantStore = asStoreLattice.store;
10201
10478
  const assistants = await assistantStore.getAllAssistants(tenantId);
10202
10479
  for (const a of assistants) {
@@ -10249,7 +10526,7 @@ async function getInboxItems(request, reply) {
10249
10526
  }
10250
10527
  const nameMap = {};
10251
10528
  try {
10252
- const asStoreLattice = getStoreLattice17("default", "assistant");
10529
+ const asStoreLattice = getStoreLattice18("default", "assistant");
10253
10530
  const assistantStore = asStoreLattice.store;
10254
10531
  const assistants = await assistantStore.getAllAssistants(tenantId);
10255
10532
  for (const a of assistants) {
@@ -10578,7 +10855,7 @@ async function replyInboxTask(request, reply) {
10578
10855
  async function requestWorkflowCancel(request, tenantId, run2) {
10579
10856
  let agentRun;
10580
10857
  try {
10581
- const ledger = getStoreLattice17("default", "agentRun").store;
10858
+ const ledger = getStoreLattice18("default", "agentRun").store;
10582
10859
  agentRun = await ledger.findRunning(tenantId, run2.threadId);
10583
10860
  } catch {
10584
10861
  }
@@ -10602,7 +10879,7 @@ async function requestWorkflowCancel(request, tenantId, run2) {
10602
10879
  }
10603
10880
  }
10604
10881
  try {
10605
- const ledger = getStoreLattice17("default", "agentRun").store;
10882
+ const ledger = getStoreLattice18("default", "agentRun").store;
10606
10883
  const result = await ledger.requestCancel(tenantId, agentRun.runId);
10607
10884
  if (result === "not_found") return "not_found";
10608
10885
  if (result === "terminal") return "terminal";
@@ -10680,7 +10957,7 @@ async function abortWorkflowRun(request, reply) {
10680
10957
  }
10681
10958
 
10682
10959
  // src/controllers/personal-assistant.ts
10683
- import { eventBus as eventBus2, getStoreLattice as getStoreLattice18, PersonalAssistantConfig, agentLatticeManager as agentLatticeManager5, purgePersonalMcpForAssistant as purgePersonalMcpForAssistant2 } from "@axiom-lattice/core";
10960
+ import { eventBus as eventBus2, getStoreLattice as getStoreLattice19, PersonalAssistantConfig, agentLatticeManager as agentLatticeManager5, purgePersonalMcpForAssistant as purgePersonalMcpForAssistant2 } from "@axiom-lattice/core";
10684
10961
  import { randomUUID as randomUUID12 } from "crypto";
10685
10962
  function getWorkspaceId2(request) {
10686
10963
  return request.headers["x-workspace-id"] || "default";
@@ -10696,19 +10973,19 @@ function getUserId6(request) {
10696
10973
  return userId;
10697
10974
  }
10698
10975
  function getLinkStore() {
10699
- return getStoreLattice18("default", "userTenantLink").store;
10976
+ return getStoreLattice19("default", "userTenantLink").store;
10700
10977
  }
10701
10978
  function getAssistantStore2() {
10702
- return getStoreLattice18("default", "assistant").store;
10979
+ return getStoreLattice19("default", "assistant").store;
10703
10980
  }
10704
10981
  function getProjectStore() {
10705
- return getStoreLattice18("default", "project").store;
10982
+ return getStoreLattice19("default", "project").store;
10706
10983
  }
10707
10984
  function getMembershipStore() {
10708
- return getStoreLattice18("default", "projectMembership").store;
10985
+ return getStoreLattice19("default", "projectMembership").store;
10709
10986
  }
10710
10987
  function getRoomStore() {
10711
- return getStoreLattice18("default", "projectRoom").store;
10988
+ return getStoreLattice19("default", "projectRoom").store;
10712
10989
  }
10713
10990
  async function getLinkMeta(userId, tenantId) {
10714
10991
  const link = await getLinkStore().getLink(userId, tenantId);
@@ -10829,7 +11106,7 @@ async function deletePersonalAssistant(request, reply) {
10829
11106
  } catch (error) {
10830
11107
  console.warn("Failed to purge personal MCP for deleted assistant:", error);
10831
11108
  }
10832
- const threadStore = getStoreLattice18("default", "thread").store;
11109
+ const threadStore = getStoreLattice19("default", "thread").store;
10833
11110
  try {
10834
11111
  const threads = await threadStore.getThreadsByAssistantId(tenantId, assistant.id);
10835
11112
  for (const t2 of threads) {
@@ -12294,7 +12571,7 @@ import * as fs2 from "fs/promises";
12294
12571
  import * as path2 from "path";
12295
12572
  import { constants as fsConstants } from "fs";
12296
12573
  import * as os2 from "os";
12297
- import { getStoreLattice as getStoreLattice19 } from "@axiom-lattice/core";
12574
+ import { getStoreLattice as getStoreLattice20 } from "@axiom-lattice/core";
12298
12575
  import { SandboxFilesystem, FilesystemBackend } from "@axiom-lattice/core";
12299
12576
  import { getSandBoxManager as getSandBoxManager3, resolveSandboxAgentsPathAlias as resolveSandboxAgentsPathAlias2 } from "@axiom-lattice/core";
12300
12577
  import { v4 as uuidv42 } from "uuid";
@@ -12675,13 +12952,13 @@ var WorkspaceController = class {
12675
12952
  constructor(projectCollaboration, projectAccess) {
12676
12953
  this.projectCollaboration = projectCollaboration;
12677
12954
  this.projectAccess = projectAccess;
12678
- this.workspaceStore = getStoreLattice19("default", "workspace").store;
12679
- this.projectStore = getStoreLattice19("default", "project").store;
12680
- const roomStore = getStoreLattice19("default", "projectRoom").store;
12681
- const botMembershipStore = getStoreLattice19("default", "projectBotMembership").store;
12682
- const assistantStore = getStoreLattice19("default", "assistant").store;
12683
- const threadStore = getStoreLattice19("default", "thread").store;
12684
- const tenantStore = getStoreLattice19("default", "tenant").store;
12955
+ this.workspaceStore = getStoreLattice20("default", "workspace").store;
12956
+ this.projectStore = getStoreLattice20("default", "project").store;
12957
+ const roomStore = getStoreLattice20("default", "projectRoom").store;
12958
+ const botMembershipStore = getStoreLattice20("default", "projectBotMembership").store;
12959
+ const assistantStore = getStoreLattice20("default", "assistant").store;
12960
+ const threadStore = getStoreLattice20("default", "thread").store;
12961
+ const tenantStore = getStoreLattice20("default", "tenant").store;
12685
12962
  const coordinatorProvisioner = new RoomCoordinatorProvisioner({
12686
12963
  getAssistantById: assistantStore.getAssistantById.bind(assistantStore),
12687
12964
  createAssistant: assistantStore.createAssistant.bind(assistantStore),
@@ -13740,7 +14017,7 @@ function registerWorkspaceRoutes(app2, projectCollaboration, projectAccess) {
13740
14017
 
13741
14018
  // src/controllers/database-configs.ts
13742
14019
  import {
13743
- getStoreLattice as getStoreLattice20,
14020
+ getStoreLattice as getStoreLattice21,
13744
14021
  sqlDatabaseManager
13745
14022
  } from "@axiom-lattice/core";
13746
14023
  import { randomUUID as randomUUID15 } from "crypto";
@@ -13754,7 +14031,7 @@ function getTenantId18(request) {
13754
14031
  async function getDatabaseConfigList(request, reply) {
13755
14032
  const tenantId = getTenantId18(request);
13756
14033
  try {
13757
- const storeLattice = getStoreLattice20("default", "database");
14034
+ const storeLattice = getStoreLattice21("default", "database");
13758
14035
  const store2 = storeLattice.store;
13759
14036
  const configs = await store2.getAllConfigs(tenantId);
13760
14037
  console.log("Backend: getAllConfigs returned:", configs);
@@ -13785,7 +14062,7 @@ async function getDatabaseConfig(request, reply) {
13785
14062
  const tenantId = getTenantId18(request);
13786
14063
  const { key } = request.params;
13787
14064
  try {
13788
- const storeLattice = getStoreLattice20("default", "database");
14065
+ const storeLattice = getStoreLattice21("default", "database");
13789
14066
  const store2 = storeLattice.store;
13790
14067
  const config = await store2.getConfigByKey(tenantId, key);
13791
14068
  if (!config) {
@@ -13811,7 +14088,7 @@ async function createDatabaseConfig(request, reply) {
13811
14088
  const tenantId = getTenantId18(request);
13812
14089
  const body = request.body;
13813
14090
  try {
13814
- const storeLattice = getStoreLattice20("default", "database");
14091
+ const storeLattice = getStoreLattice21("default", "database");
13815
14092
  const store2 = storeLattice.store;
13816
14093
  const existing = await store2.getConfigByKey(tenantId, body.key);
13817
14094
  if (existing) {
@@ -13847,7 +14124,7 @@ async function updateDatabaseConfig(request, reply) {
13847
14124
  const { key } = request.params;
13848
14125
  const updates = request.body;
13849
14126
  try {
13850
- const storeLattice = getStoreLattice20("default", "database");
14127
+ const storeLattice = getStoreLattice21("default", "database");
13851
14128
  const store2 = storeLattice.store;
13852
14129
  const existing = await store2.getConfigByKey(tenantId, key);
13853
14130
  if (!existing) {
@@ -13888,7 +14165,7 @@ async function deleteDatabaseConfig(request, reply) {
13888
14165
  const tenantId = getTenantId18(request);
13889
14166
  const { keyOrId } = request.params;
13890
14167
  try {
13891
- const storeLattice = getStoreLattice20("default", "database");
14168
+ const storeLattice = getStoreLattice21("default", "database");
13892
14169
  const store2 = storeLattice.store;
13893
14170
  console.log("Delete request - keyOrId:", keyOrId);
13894
14171
  let config = await store2.getConfigByKey(tenantId, keyOrId);
@@ -13937,7 +14214,7 @@ async function testDatabaseConnection(request, reply) {
13937
14214
  const tenantId = getTenantId18(request);
13938
14215
  const { key } = request.params;
13939
14216
  try {
13940
- const storeLattice = getStoreLattice20("default", "database");
14217
+ const storeLattice = getStoreLattice21("default", "database");
13941
14218
  const store2 = storeLattice.store;
13942
14219
  const config = await store2.getConfigByKey(tenantId, key);
13943
14220
  if (!config) {
@@ -14022,7 +14299,7 @@ function registerDatabaseConfigRoutes(app2) {
14022
14299
 
14023
14300
  // src/controllers/metrics-configs.ts
14024
14301
  import {
14025
- getStoreLattice as getStoreLattice21,
14302
+ getStoreLattice as getStoreLattice22,
14026
14303
  metricsServerManager as metricsServerManager2,
14027
14304
  SemanticMetricsClient as SemanticMetricsClient2
14028
14305
  } from "@axiom-lattice/core";
@@ -14037,7 +14314,7 @@ function getTenantId19(request) {
14037
14314
  async function getMetricsServerConfigList(request, reply) {
14038
14315
  const tenantId = getTenantId19(request);
14039
14316
  try {
14040
- const storeLattice = getStoreLattice21("default", "metrics");
14317
+ const storeLattice = getStoreLattice22("default", "metrics");
14041
14318
  const store2 = storeLattice.store;
14042
14319
  const configs = await store2.getAllConfigs(tenantId);
14043
14320
  return {
@@ -14064,7 +14341,7 @@ async function getMetricsServerConfig(request, reply) {
14064
14341
  const tenantId = getTenantId19(request);
14065
14342
  const { key } = request.params;
14066
14343
  try {
14067
- const storeLattice = getStoreLattice21("default", "metrics");
14344
+ const storeLattice = getStoreLattice22("default", "metrics");
14068
14345
  const store2 = storeLattice.store;
14069
14346
  const config = await store2.getConfigByKey(tenantId, key);
14070
14347
  if (!config) {
@@ -14090,7 +14367,7 @@ async function createMetricsServerConfig(request, reply) {
14090
14367
  const tenantId = getTenantId19(request);
14091
14368
  const body = request.body;
14092
14369
  try {
14093
- const storeLattice = getStoreLattice21("default", "metrics");
14370
+ const storeLattice = getStoreLattice22("default", "metrics");
14094
14371
  const store2 = storeLattice.store;
14095
14372
  const existing = await store2.getConfigByKey(tenantId, body.key);
14096
14373
  if (existing) {
@@ -14142,7 +14419,7 @@ async function updateMetricsServerConfig(request, reply) {
14142
14419
  const { key } = request.params;
14143
14420
  const updates = request.body;
14144
14421
  try {
14145
- const storeLattice = getStoreLattice21("default", "metrics");
14422
+ const storeLattice = getStoreLattice22("default", "metrics");
14146
14423
  const store2 = storeLattice.store;
14147
14424
  const existing = await store2.getConfigByKey(tenantId, key);
14148
14425
  if (!existing) {
@@ -14192,7 +14469,7 @@ async function deleteMetricsServerConfig(request, reply) {
14192
14469
  const tenantId = getTenantId19(request);
14193
14470
  const { keyOrId } = request.params;
14194
14471
  try {
14195
- const storeLattice = getStoreLattice21("default", "metrics");
14472
+ const storeLattice = getStoreLattice22("default", "metrics");
14196
14473
  const store2 = storeLattice.store;
14197
14474
  let config = await store2.getConfigByKey(tenantId, keyOrId);
14198
14475
  let configKey = keyOrId;
@@ -14239,7 +14516,7 @@ async function testMetricsServerConnection(request, reply) {
14239
14516
  const tenantId = getTenantId19(request);
14240
14517
  const { key } = request.params;
14241
14518
  try {
14242
- const storeLattice = getStoreLattice21("default", "metrics");
14519
+ const storeLattice = getStoreLattice22("default", "metrics");
14243
14520
  const store2 = storeLattice.store;
14244
14521
  const config = await store2.getConfigByKey(tenantId, key);
14245
14522
  if (!config) {
@@ -14290,7 +14567,7 @@ async function listAvailableMetrics(request, reply) {
14290
14567
  const tenantId = getTenantId19(request);
14291
14568
  const { key } = request.params;
14292
14569
  try {
14293
- const storeLattice = getStoreLattice21("default", "metrics");
14570
+ const storeLattice = getStoreLattice22("default", "metrics");
14294
14571
  const store2 = storeLattice.store;
14295
14572
  const config = await store2.getConfigByKey(tenantId, key);
14296
14573
  if (!config) {
@@ -14329,7 +14606,7 @@ async function queryMetricsData(request, reply) {
14329
14606
  const { key } = request.params;
14330
14607
  const { metricName, startTime, endTime, step, labels: labels2 } = request.body;
14331
14608
  try {
14332
- const storeLattice = getStoreLattice21("default", "metrics");
14609
+ const storeLattice = getStoreLattice22("default", "metrics");
14333
14610
  const store2 = storeLattice.store;
14334
14611
  const config = await store2.getConfigByKey(tenantId, key);
14335
14612
  if (!config) {
@@ -14376,7 +14653,7 @@ async function getDataSources(request, reply) {
14376
14653
  const tenantId = getTenantId19(request);
14377
14654
  const { key } = request.params;
14378
14655
  try {
14379
- const storeLattice = getStoreLattice21("default", "metrics");
14656
+ const storeLattice = getStoreLattice22("default", "metrics");
14380
14657
  const store2 = storeLattice.store;
14381
14658
  const config = await store2.getConfigByKey(tenantId, key);
14382
14659
  if (!config) {
@@ -14417,7 +14694,7 @@ async function getDatasourceMetrics(request, reply) {
14417
14694
  const tenantId = getTenantId19(request);
14418
14695
  const { key, datasourceId } = request.params;
14419
14696
  try {
14420
- const storeLattice = getStoreLattice21("default", "metrics");
14697
+ const storeLattice = getStoreLattice22("default", "metrics");
14421
14698
  const store2 = storeLattice.store;
14422
14699
  const config = await store2.getConfigByKey(tenantId, key);
14423
14700
  if (!config) {
@@ -14455,7 +14732,7 @@ async function querySemanticMetrics(request, reply) {
14455
14732
  const { key } = request.params;
14456
14733
  const body = request.body;
14457
14734
  try {
14458
- const storeLattice = getStoreLattice21("default", "metrics");
14735
+ const storeLattice = getStoreLattice22("default", "metrics");
14459
14736
  const store2 = storeLattice.store;
14460
14737
  const config = await store2.getConfigByKey(tenantId, key);
14461
14738
  if (!config) {
@@ -14763,14 +15040,14 @@ function connectionRoutes(fastify2) {
14763
15040
  }
14764
15041
 
14765
15042
  // src/controllers/eval.ts
14766
- import { getStoreLattice as getStoreLattice23, hasModelLatticeForTenant as hasModelLatticeForTenant2, modelLatticeManager as modelLatticeManager2 } from "@axiom-lattice/core";
15043
+ import { getStoreLattice as getStoreLattice24, hasModelLatticeForTenant as hasModelLatticeForTenant2, modelLatticeManager as modelLatticeManager2 } from "@axiom-lattice/core";
14767
15044
  import { v4 as uuidv44 } from "uuid";
14768
15045
 
14769
15046
  // src/services/eval-runner.ts
14770
15047
  import { EventEmitter } from "events";
14771
15048
  import {
14772
15049
  getReplicaId as getReplicaId6,
14773
- getStoreLattice as getStoreLattice22,
15050
+ getStoreLattice as getStoreLattice23,
14774
15051
  hasModelLatticeForTenant,
14775
15052
  listModelLatticesForTenant,
14776
15053
  LatticeEvalProject,
@@ -14854,7 +15131,7 @@ var EvalRunner = class {
14854
15131
  };
14855
15132
  }
14856
15133
  getLeaseStore() {
14857
- return getStoreLattice22("default", "lease").store;
15134
+ return getStoreLattice23("default", "lease").store;
14858
15135
  }
14859
15136
  async startLeasedRun(tenantId, projectId, suiteIds, caseIds, runConfig, taskId, leaseKey, leaseToken, releaseExecutionLease) {
14860
15137
  const store2 = this.getEvalStore();
@@ -15160,7 +15437,7 @@ var EvalRunner = class {
15160
15437
  return ctx !== void 0 && !ctx.terminal.workerSettled && (tenantId === void 0 || ctx.tenantId === tenantId);
15161
15438
  }
15162
15439
  getEvalStore() {
15163
- return getStoreLattice22("default", "eval").store;
15440
+ return getStoreLattice23("default", "eval").store;
15164
15441
  }
15165
15442
  releaseProjectLease(leaseKey, leaseToken) {
15166
15443
  if (this.projectLeases.get(leaseKey) === leaseToken) this.projectLeases.delete(leaseKey);
@@ -15177,7 +15454,7 @@ function getTenantId20(request) {
15177
15454
  return request.headers["x-tenant-id"] || "default";
15178
15455
  }
15179
15456
  function getEvalStore() {
15180
- return getStoreLattice23("default", "eval").store;
15457
+ return getStoreLattice24("default", "eval").store;
15181
15458
  }
15182
15459
  async function getOwnedSuite(store2, tenantId, projectId, suiteId) {
15183
15460
  const project = await store2.getProjectById(tenantId, projectId);
@@ -15711,11 +15988,11 @@ data: ${JSON.stringify(data)}
15711
15988
  }
15712
15989
 
15713
15990
  // src/controllers/users.ts
15714
- import { getStoreLattice as getStoreLattice25 } from "@axiom-lattice/core";
15991
+ import { getStoreLattice as getStoreLattice26 } from "@axiom-lattice/core";
15715
15992
  import { v4 as uuidv46 } from "uuid";
15716
15993
 
15717
15994
  // src/controllers/auth.ts
15718
- import { getStoreLattice as getStoreLattice24 } from "@axiom-lattice/core";
15995
+ import { getStoreLattice as getStoreLattice25 } from "@axiom-lattice/core";
15719
15996
  import { v4 as uuidv45 } from "uuid";
15720
15997
  import { createHmac, randomBytes, timingSafeEqual } from "crypto";
15721
15998
  import {
@@ -15786,9 +16063,9 @@ var defaultAuthConfig = {
15786
16063
  };
15787
16064
  var AuthController = class {
15788
16065
  constructor(config = {}) {
15789
- this.userStore = getStoreLattice24("default", "user").store;
15790
- this.tenantStore = getStoreLattice24("default", "tenant").store;
15791
- this.userTenantLinkStore = getStoreLattice24("default", "userTenantLink").store;
16066
+ this.userStore = getStoreLattice25("default", "user").store;
16067
+ this.tenantStore = getStoreLattice25("default", "tenant").store;
16068
+ this.userTenantLinkStore = getStoreLattice25("default", "userTenantLink").store;
15792
16069
  this.config = {
15793
16070
  ...defaultAuthConfig,
15794
16071
  ...config,
@@ -16053,7 +16330,7 @@ var AuthController = class {
16053
16330
  const linkMeta = link?.metadata || {};
16054
16331
  let personalAssistant = null;
16055
16332
  if (linkMeta.personalAssistantId) {
16056
- const assistantStore = getStoreLattice24("default", "assistant").store;
16333
+ const assistantStore = getStoreLattice25("default", "assistant").store;
16057
16334
  const exists = await assistantStore.hasAssistant(tenantId, linkMeta.personalAssistantId);
16058
16335
  if (exists) {
16059
16336
  personalAssistant = {
@@ -16459,7 +16736,7 @@ function resolveUserRouteOptions(options) {
16459
16736
  }
16460
16737
  function optionalStore(type) {
16461
16738
  try {
16462
- const lattice = getStoreLattice25("default", type);
16739
+ const lattice = getStoreLattice26("default", type);
16463
16740
  return lattice?.store;
16464
16741
  } catch {
16465
16742
  return void 0;
@@ -16467,7 +16744,7 @@ function optionalStore(type) {
16467
16744
  }
16468
16745
  var UsersController = class {
16469
16746
  constructor(options = {}) {
16470
- this.userStore = getStoreLattice25("default", "user").store;
16747
+ this.userStore = getStoreLattice26("default", "user").store;
16471
16748
  this.options = resolveUserRouteOptions(options);
16472
16749
  this.platformMemberStore = optionalStore(
16473
16750
  "platformMember"
@@ -16811,7 +17088,7 @@ function registerUserRoutes(app2, options) {
16811
17088
  }
16812
17089
 
16813
17090
  // src/controllers/tenants.ts
16814
- import { getStoreLattice as getStoreLattice26 } from "@axiom-lattice/core";
17091
+ import { getStoreLattice as getStoreLattice27 } from "@axiom-lattice/core";
16815
17092
  import {
16816
17093
  PLATFORM_TENANT_PROTECTED_ERROR as PLATFORM_TENANT_PROTECTED_ERROR3,
16817
17094
  isPlatformTenantId as isPlatformTenantId3
@@ -16862,7 +17139,7 @@ function resolveTenantRouteOptions(options) {
16862
17139
  };
16863
17140
  }
16864
17141
  function resolveLinkStore(options) {
16865
- return options.userTenantLinkStore ?? getStoreLattice26("default", "userTenantLink").store;
17142
+ return options.userTenantLinkStore ?? getStoreLattice27("default", "userTenantLink").store;
16866
17143
  }
16867
17144
  function attachCaller(request, caller) {
16868
17145
  request.user = caller;
@@ -16919,7 +17196,7 @@ function createTenantUpdateGuard(options) {
16919
17196
  }
16920
17197
  var TenantsController = class {
16921
17198
  constructor(tenantStore) {
16922
- this.tenantStore = tenantStore ?? getStoreLattice26("default", "tenant").store;
17199
+ this.tenantStore = tenantStore ?? getStoreLattice27("default", "tenant").store;
16923
17200
  }
16924
17201
  // ==================== Tenant CRUD ====================
16925
17202
  async listTenants(request, reply) {
@@ -17029,7 +17306,7 @@ function registerTenantRoutes(app2, options) {
17029
17306
 
17030
17307
  // src/controllers/platform-admin.ts
17031
17308
  import { v4 as uuidv48 } from "uuid";
17032
- import { getStoreLattice as getStoreLattice27 } from "@axiom-lattice/core";
17309
+ import { getStoreLattice as getStoreLattice28 } from "@axiom-lattice/core";
17033
17310
  import {
17034
17311
  PLATFORM_TENANT_PROTECTED_ERROR as PLATFORM_TENANT_PROTECTED_ERROR4,
17035
17312
  isPlatformTenantId as isPlatformTenantId4
@@ -17960,20 +18237,20 @@ var PlatformAdminController = class {
17960
18237
  function resolveRouteOptions(options = {}) {
17961
18238
  const authRequired2 = options.authRequired ?? process.env.AUTH_REQUIRED === "true";
17962
18239
  const tokenSecret = options.tokenSecret ?? resolveConsoleTokenSecret(authRequired2);
17963
- const userStore = options.userStore ?? getStoreLattice27("default", "user").store;
17964
- const platformMemberStore = options.platformMemberStore ?? getStoreLattice27("default", "platformMember").store;
18240
+ const userStore = options.userStore ?? getStoreLattice28("default", "user").store;
18241
+ const platformMemberStore = options.platformMemberStore ?? getStoreLattice28("default", "platformMember").store;
17965
18242
  return {
17966
18243
  authRequired: authRequired2,
17967
18244
  tokenSecret,
17968
18245
  platformAccess: options.platformAccess ?? getDefaultPlatformAccessService(),
17969
18246
  userStore,
17970
18247
  platformMemberStore,
17971
- tenantStore: options.tenantStore ?? getStoreLattice27("default", "tenant").store,
17972
- userTenantLinkStore: options.userTenantLinkStore ?? getStoreLattice27("default", "userTenantLink").store,
18248
+ tenantStore: options.tenantStore ?? getStoreLattice28("default", "tenant").store,
18249
+ userTenantLinkStore: options.userTenantLinkStore ?? getStoreLattice28("default", "userTenantLink").store,
17973
18250
  invitationService: options.invitationService ?? new PlatformInvitationService({
17974
18251
  userStore,
17975
18252
  platformMemberStore,
17976
- platformInvitationStore: getStoreLattice27("default", "platformInvitation").store,
18253
+ platformInvitationStore: getStoreLattice28("default", "platformInvitation").store,
17977
18254
  audit: options.audit
17978
18255
  }),
17979
18256
  audit: options.audit
@@ -18076,7 +18353,7 @@ var STATUSES = /* @__PURE__ */ new Set([
18076
18353
  "error",
18077
18354
  "cancelled"
18078
18355
  ]);
18079
- var MAX_LIMIT2 = 200;
18356
+ var MAX_LIMIT3 = 200;
18080
18357
  var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
18081
18358
  var InvalidAuditQueryError = class extends Error {
18082
18359
  };
@@ -18116,7 +18393,7 @@ function parseAuditQuery(raw) {
18116
18393
  const status = readEnum(raw, "status", STATUSES);
18117
18394
  const from = readString(raw, "from");
18118
18395
  const to = readString(raw, "to");
18119
- const limit = readInteger(raw, "limit", 1, MAX_LIMIT2);
18396
+ const limit = readInteger(raw, "limit", 1, MAX_LIMIT3);
18120
18397
  const offset = readInteger(raw, "offset", 0);
18121
18398
  return {
18122
18399
  ...initiatorUserId === void 0 ? {} : { initiatorUserId },
@@ -19479,8 +19756,8 @@ function collectChangedKeys(patch, resetPaths) {
19479
19756
  const keys2 = new Set(resetPaths);
19480
19757
  for (const [section, value] of Object.entries(patch)) {
19481
19758
  if (!isRecord10(value)) continue;
19482
- for (const [leaf, leafValue2] of Object.entries(value)) {
19483
- if (leafValue2 !== void 0) keys2.add(`${section}.${leaf}`);
19759
+ for (const [leaf, leafValue] of Object.entries(value)) {
19760
+ if (leafValue !== void 0) keys2.add(`${section}.${leaf}`);
19484
19761
  }
19485
19762
  }
19486
19763
  return [...keys2].sort();
@@ -19787,133 +20064,6 @@ function registerBrandingRoutes(app2, options) {
19787
20064
  );
19788
20065
  }
19789
20066
 
19790
- // src/services/platform-audit/PlatformAuditService.ts
19791
- var PLATFORM_AUDIT_MAX_CAPTURE_BYTES = 16 * 1024;
19792
- var REDACTED = "[redacted]";
19793
- var CIRCULAR = "[circular]";
19794
- var MAX_DEPTH_MARKER = "[max-depth]";
19795
- var UNSERIALIZABLE = "[unserializable]";
19796
- var MAX_DEPTH2 = 6;
19797
- var SENSITIVE_FRAGMENTS = [
19798
- "password",
19799
- "passwd",
19800
- "secret",
19801
- "token",
19802
- "apikey",
19803
- "clientsecret",
19804
- "credential",
19805
- "authorization",
19806
- "cookie",
19807
- "privatekey",
19808
- "accesskey",
19809
- "session"
19810
- ];
19811
- var UNSAFE_KEYS2 = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
19812
- var BEARER_PATH_PATTERNS = [
19813
- /(\/invite\/)([^/?#\s"'<>]+)/gi,
19814
- /(\/s\/)([^/?#\s"'<>]+)/gi
19815
- ];
19816
- var SECRET_PARAM_PATTERN = /(^|[?&;])(token|access_token|refresh_token|api_key|secret|key)=([^&#\s"']+)/gi;
19817
- function redactString(value) {
19818
- let output = value;
19819
- for (const pattern of BEARER_PATH_PATTERNS) {
19820
- output = output.replace(pattern, "$1[redacted]");
19821
- }
19822
- return output.replace(SECRET_PARAM_PATTERN, "$1$2=[redacted]");
19823
- }
19824
- function isSensitiveKey(key) {
19825
- const normalized = key.replace(/[_-]/g, "").toLowerCase();
19826
- return SENSITIVE_FRAGMENTS.some((fragment) => normalized.includes(fragment));
19827
- }
19828
- function isPlainObject5(value) {
19829
- const prototype = Object.getPrototypeOf(value);
19830
- return prototype === Object.prototype || prototype === null;
19831
- }
19832
- function leafValue(value) {
19833
- if (value instanceof RegExp) return redactString(value.toString());
19834
- if (value instanceof URL) return redactString(value.toString());
19835
- if (value instanceof Error) {
19836
- return redactString(`${value.name}: ${value.message}`);
19837
- }
19838
- const text = String(value);
19839
- return text === "[object Object]" ? UNSERIALIZABLE : redactString(text);
19840
- }
19841
- function redact(value, depth = 0, seen = /* @__PURE__ */ new WeakSet()) {
19842
- if (value === null) return value;
19843
- if (typeof value === "string") return redactString(value);
19844
- if (typeof value !== "object") return value;
19845
- if (seen.has(value)) return CIRCULAR;
19846
- if (depth >= MAX_DEPTH2) return MAX_DEPTH_MARKER;
19847
- if (value instanceof Date) return redactString(value.toISOString());
19848
- if (value instanceof Map) {
19849
- seen.add(value);
19850
- const entries = [];
19851
- for (const [key, entry] of value) {
19852
- entries.push([key, entry]);
19853
- }
19854
- const output2 = redact(Object.fromEntries(entries), depth + 1, seen);
19855
- seen.delete(value);
19856
- return output2;
19857
- }
19858
- if (value instanceof Set) {
19859
- seen.add(value);
19860
- const output2 = redact(Array.from(value), depth + 1, seen);
19861
- seen.delete(value);
19862
- return output2;
19863
- }
19864
- if (Array.isArray(value)) {
19865
- seen.add(value);
19866
- const output2 = value.map((entry) => redact(entry, depth + 1, seen));
19867
- seen.delete(value);
19868
- return output2;
19869
- }
19870
- if (!isPlainObject5(value)) {
19871
- return leafValue(value);
19872
- }
19873
- seen.add(value);
19874
- const output = {};
19875
- for (const [key, entry] of Object.entries(value)) {
19876
- if (UNSAFE_KEYS2.has(key)) continue;
19877
- output[key] = isSensitiveKey(key) ? REDACTED : redact(entry, depth + 1, seen);
19878
- }
19879
- seen.delete(value);
19880
- return output;
19881
- }
19882
- function serializedByteLength(value) {
19883
- try {
19884
- const serialized = JSON.stringify(value);
19885
- return serialized === void 0 ? 0 : Buffer.byteLength(serialized);
19886
- } catch {
19887
- return PLATFORM_AUDIT_MAX_CAPTURE_BYTES + 1;
19888
- }
19889
- }
19890
- function capCapture(value) {
19891
- const bytes = serializedByteLength(value);
19892
- if (bytes > PLATFORM_AUDIT_MAX_CAPTURE_BYTES) {
19893
- return { truncated: true, bytes };
19894
- }
19895
- return value;
19896
- }
19897
- var PlatformAuditService = class {
19898
- constructor(store2) {
19899
- this.store = store2;
19900
- }
19901
- async record(input) {
19902
- return this.store.append({
19903
- ...input,
19904
- summary: capCapture(redact(input.summary)),
19905
- ...input.before ? { before: capCapture(redact(input.before)) } : {},
19906
- ...input.after ? { after: capCapture(redact(input.after)) } : {}
19907
- });
19908
- }
19909
- async get(id3) {
19910
- return this.store.get(id3);
19911
- }
19912
- async query(params) {
19913
- return this.store.query(params);
19914
- }
19915
- };
19916
-
19917
20067
  // src/services/platform-audit/PlatformAuditHttpHook.ts
19918
20068
  var MUTATING_METHODS = /* @__PURE__ */ new Set(["POST", "PUT", "PATCH", "DELETE"]);
19919
20069
  var capturedPayloads = /* @__PURE__ */ new WeakMap();
@@ -19935,7 +20085,7 @@ function asRecord(value) {
19935
20085
  function plainRecord(value) {
19936
20086
  return Object.fromEntries(Object.entries(asRecord(value)));
19937
20087
  }
19938
- function serializedByteLength2(value) {
20088
+ function serializedByteLength(value) {
19939
20089
  try {
19940
20090
  const serialized = JSON.stringify(value);
19941
20091
  return serialized === void 0 ? 0 : Buffer.byteLength(serialized);
@@ -19944,7 +20094,7 @@ function serializedByteLength2(value) {
19944
20094
  }
19945
20095
  }
19946
20096
  function capCapturedObject(value) {
19947
- const bytes = serializedByteLength2(value);
20097
+ const bytes = serializedByteLength(value);
19948
20098
  if (bytes > PLATFORM_AUDIT_MAX_CAPTURE_BYTES) {
19949
20099
  return { truncated: true, bytes };
19950
20100
  }
@@ -23772,7 +23922,7 @@ import { randomUUID as randomUUID23 } from "crypto";
23772
23922
  import {
23773
23923
  descriptorDataValue
23774
23924
  } from "@axiom-lattice/protocols";
23775
- import { getStoreLattice as getStoreLattice28 } from "@axiom-lattice/core";
23925
+ import { getStoreLattice as getStoreLattice29 } from "@axiom-lattice/core";
23776
23926
  var _adapterRegistry;
23777
23927
  var _router;
23778
23928
  var _onInstallationChanged;
@@ -23913,7 +24063,7 @@ function snapshotPlainObject(value) {
23913
24063
  }
23914
24064
  }
23915
24065
  async function getInstallationStore() {
23916
- const store2 = getStoreLattice28("default", "channelInstallation").store;
24066
+ const store2 = getStoreLattice29("default", "channelInstallation").store;
23917
24067
  if (store2) return store2;
23918
24068
  const { PostgreSQLChannelInstallationStore } = await import("@axiom-lattice/pg-stores");
23919
24069
  const databaseUrl = process.env.DATABASE_URL;
@@ -24248,7 +24398,7 @@ import {
24248
24398
  DuplicateChannelBindingSubjectError,
24249
24399
  descriptorDataValue as descriptorDataValue2
24250
24400
  } from "@axiom-lattice/protocols";
24251
- import { getBindingRegistry, getStoreLattice as getStoreLattice29 } from "@axiom-lattice/core";
24401
+ import { getBindingRegistry, getStoreLattice as getStoreLattice30 } from "@axiom-lattice/core";
24252
24402
  function getTenantId22(request) {
24253
24403
  const userTenantId = request.user?.tenantId;
24254
24404
  if (typeof userTenantId === "string" && userTenantId) return userTenantId;
@@ -24306,7 +24456,7 @@ function snapshotPublicUpdate(value) {
24306
24456
  return body;
24307
24457
  }
24308
24458
  function getInstallationStore2() {
24309
- return getStoreLattice29("default", "channelInstallation").store;
24459
+ return getStoreLattice30("default", "channelInstallation").store;
24310
24460
  }
24311
24461
  async function isValidPublicInstallation(tenantId, channelInstallationId, channel) {
24312
24462
  const installation = await getInstallationStore2().getInstallationById(channelInstallationId);
@@ -24831,7 +24981,7 @@ var registerSTTRoutes = (app2) => {
24831
24981
  };
24832
24982
 
24833
24983
  // src/controllers/local-a2a.ts
24834
- import { getStoreLattice as getStoreLattice30 } from "@axiom-lattice/core";
24984
+ import { getStoreLattice as getStoreLattice31 } from "@axiom-lattice/core";
24835
24985
  import {
24836
24986
  AgentType as AgentType2
24837
24987
  } from "@axiom-lattice/protocols";
@@ -24847,7 +24997,7 @@ function getLocalRuntime(assistant) {
24847
24997
  return graphDefinition.localRuntime;
24848
24998
  }
24849
24999
  async function getLocalA2AAssistants(tenantId) {
24850
- const storeLattice = getStoreLattice30("default", "assistant");
25000
+ const storeLattice = getStoreLattice31("default", "assistant");
24851
25001
  const assistants = await storeLattice.store.getAllAssistants(tenantId);
24852
25002
  const results = [];
24853
25003
  for (const assistant of assistants) {
@@ -24859,7 +25009,7 @@ async function getLocalA2AAssistants(tenantId) {
24859
25009
  return results;
24860
25010
  }
24861
25011
  async function getLocalA2AAssistant(tenantId, assistantId) {
24862
- const storeLattice = getStoreLattice30("default", "assistant");
25012
+ const storeLattice = getStoreLattice31("default", "assistant");
24863
25013
  const assistant = await storeLattice.store.getAssistantById(tenantId, assistantId);
24864
25014
  if (!assistant) return null;
24865
25015
  const runtime = getLocalRuntime(assistant);
@@ -25112,7 +25262,7 @@ import {
25112
25262
  createTrustedAgentMessageDispatcher,
25113
25263
  executionAuthorityRegistry,
25114
25264
  getReplicaId as getReplicaId10,
25115
- getStoreLattice as getStoreLattice31,
25265
+ getStoreLattice as getStoreLattice32,
25116
25266
  hasModelLatticeForTenant as hasModelLatticeForTenant4,
25117
25267
  ManagedTaskStartError,
25118
25268
  modelLatticeManager as modelLatticeManager3,
@@ -26938,43 +27088,43 @@ function withErrors(handler) {
26938
27088
  }
26939
27089
  };
26940
27090
  }
26941
- async function authorizeRead(request, task, authorize2) {
27091
+ async function authorizeRead(request, task, authorize3) {
26942
27092
  if (!task.projectId || task.projectId === "default") {
26943
27093
  if (task.ownerType !== "user" || task.ownerId !== getUserId7(request)) throw notFound6();
26944
27094
  return;
26945
27095
  }
26946
27096
  let project;
26947
27097
  try {
26948
- ({ project } = await authorize2(request, task.projectId, "read"));
27098
+ ({ project } = await authorize3(request, task.projectId, "read"));
26949
27099
  } catch (error) {
26950
27100
  if (error instanceof ProjectCollaborationError) throw notFound6();
26951
27101
  throw error;
26952
27102
  }
26953
27103
  if (task.workspaceId !== project.workspaceId) throw new HttpTaskError(404, "TASK_NOT_FOUND");
26954
27104
  }
26955
- async function authorizeCommand(request, task, authorize2, capability2) {
27105
+ async function authorizeCommand(request, task, authorize3, capability2) {
26956
27106
  if (!task.projectId || task.projectId === "default") {
26957
27107
  if (task.ownerType !== "user" || task.ownerId !== getUserId7(request)) throw notFound6();
26958
27108
  return;
26959
27109
  }
26960
27110
  let project;
26961
27111
  try {
26962
- ({ project } = await authorize2(request, task.projectId, capability2));
27112
+ ({ project } = await authorize3(request, task.projectId, capability2));
26963
27113
  } catch (error) {
26964
27114
  if (error instanceof ProjectCollaborationError) throw notFound6();
26965
27115
  throw error;
26966
27116
  }
26967
27117
  if (task.workspaceId !== project.workspaceId) throw new HttpTaskError(404, "TASK_NOT_FOUND");
26968
27118
  }
26969
- async function authorizeMutation(request, task, authorize2) {
27119
+ async function authorizeMutation(request, task, authorize3) {
26970
27120
  const capability2 = task.ownerType === "agent" || task.ownerId !== getUserId7(request) ? "manage" : "send";
26971
- return authorizeCommand(request, task, authorize2, capability2);
27121
+ return authorizeCommand(request, task, authorize3, capability2);
26972
27122
  }
26973
- async function preauthorizeExplicitProject(request, authorize2) {
27123
+ async function preauthorizeExplicitProject(request, authorize3) {
26974
27124
  const projectId = header(request, "x-project-id");
26975
27125
  if (!projectId || projectId === "default") return;
26976
27126
  try {
26977
- const { project } = await authorize2(request, projectId, "read");
27127
+ const { project } = await authorize3(request, projectId, "read");
26978
27128
  const workspaceId = header(request, "x-workspace-id");
26979
27129
  if (workspaceId !== void 0 && workspaceId !== project.workspaceId) throw notFound6();
26980
27130
  } catch (error) {
@@ -27009,7 +27159,7 @@ async function validateReferences(store2, task, parentId, dependencies) {
27009
27159
  }
27010
27160
  function createTaskController(deps) {
27011
27161
  const mutationMutex = deps.projectMutationMutex ?? projectMutationMutex;
27012
- const authorize2 = async (request, projectId, capability2) => deps.access.requireProjectAccess({
27162
+ const authorize3 = async (request, projectId, capability2) => deps.access.requireProjectAccess({
27013
27163
  tenantId: getTenantId25(request),
27014
27164
  userId: getUserId7(request),
27015
27165
  projectId,
@@ -27022,8 +27172,8 @@ function createTaskController(deps) {
27022
27172
  if (!current3 || current3.tenantId !== initial.tenantId || current3.workspaceId !== initial.workspaceId || current3.projectId !== initial.projectId || current3.ownerType !== initial.ownerType || current3.ownerId !== initial.ownerId || current3.status !== initial.status || current3.updatedAt.getTime() !== initial.updatedAt.getTime()) {
27023
27173
  throw new HttpTaskError(409, "TASK_STATUS_CONFLICT");
27024
27174
  }
27025
- if (capability2) await authorizeCommand(request, current3, authorize2, capability2);
27026
- else await authorizeMutation(request, current3, authorize2);
27175
+ if (capability2) await authorizeCommand(request, current3, authorize3, capability2);
27176
+ else await authorizeMutation(request, current3, authorize3);
27027
27177
  return operation(current3);
27028
27178
  });
27029
27179
  };
@@ -27082,7 +27232,7 @@ function createTaskController(deps) {
27082
27232
  const rows2 = merged.slice(effectiveOffset, effectiveOffset + effectiveLimit);
27083
27233
  return { success: true, data: rows2, count: rows2.length };
27084
27234
  }
27085
- const { project } = await authorize2(request, projectId, "read");
27235
+ const { project } = await authorize3(request, projectId, "read");
27086
27236
  const rows = await deps.tasks.list({
27087
27237
  tenantId,
27088
27238
  workspaceId: project.workspaceId,
@@ -27099,10 +27249,10 @@ function createTaskController(deps) {
27099
27249
  return { success: true, data: rows, count: rows.length };
27100
27250
  });
27101
27251
  const get = withErrors(async (request, reply) => {
27102
- await preauthorizeExplicitProject(request, authorize2);
27252
+ await preauthorizeExplicitProject(request, authorize3);
27103
27253
  const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
27104
27254
  if (!current3) return sendNotFound(reply);
27105
- await authorizeRead(request, current3, authorize2);
27255
+ await authorizeRead(request, current3, authorize3);
27106
27256
  return { success: true, data: current3 };
27107
27257
  });
27108
27258
  const create = withErrors(async (request, reply) => {
@@ -27117,9 +27267,9 @@ function createTaskController(deps) {
27117
27267
  return reply.code(201).send({ success: true, data: created });
27118
27268
  }
27119
27269
  const capability2 = body.ownerType === "agent" ? "manage" : "send";
27120
- const { project } = await authorize2(request, body.projectId, capability2);
27270
+ const { project } = await authorize3(request, body.projectId, capability2);
27121
27271
  return mutationMutex.runExclusive({ tenantId, projectId: project.id }, async () => {
27122
- const lockedAccess = await authorize2(request, project.id, capability2);
27272
+ const lockedAccess = await authorize3(request, project.id, capability2);
27123
27273
  const candidate = {
27124
27274
  id: body.id ?? "__new_task__",
27125
27275
  tenantId,
@@ -27162,10 +27312,10 @@ function createTaskController(deps) {
27162
27312
  const update = withErrors(async (request, reply) => {
27163
27313
  const body = snapshotUpdate(request.body);
27164
27314
  if ("status" in body) throw new HttpTaskError(400, "STATUS_USES_COMMAND");
27165
- await preauthorizeExplicitProject(request, authorize2);
27315
+ await preauthorizeExplicitProject(request, authorize3);
27166
27316
  const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
27167
27317
  if (!current3) return sendNotFound(reply);
27168
- await authorizeMutation(request, current3, authorize2);
27318
+ await authorizeMutation(request, current3, authorize3);
27169
27319
  return lockedTask(request, current3, async (locked) => {
27170
27320
  if (body.projectId !== void 0 && body.projectId !== locked.projectId || body.workspaceId !== void 0 && body.workspaceId !== locked.workspaceId) throw notFound6();
27171
27321
  await validateReferences(deps.tasks, locked, body.parentId, body.dependencies);
@@ -27178,10 +27328,10 @@ function createTaskController(deps) {
27178
27328
  });
27179
27329
  });
27180
27330
  const remove = withErrors(async (request, reply) => {
27181
- await preauthorizeExplicitProject(request, authorize2);
27331
+ await preauthorizeExplicitProject(request, authorize3);
27182
27332
  const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
27183
27333
  if (!current3) return sendNotFound(reply);
27184
- await authorizeMutation(request, current3, authorize2);
27334
+ await authorizeMutation(request, current3, authorize3);
27185
27335
  return lockedTask(request, current3, async (locked) => {
27186
27336
  if (deps.commands) {
27187
27337
  const actor3 = `user:${getUserId7(request)}`;
@@ -27197,10 +27347,10 @@ function createTaskController(deps) {
27197
27347
  });
27198
27348
  const complete = withErrors(async (request, reply) => {
27199
27349
  const body = snapshotComplete(request.body);
27200
- await preauthorizeExplicitProject(request, authorize2);
27350
+ await preauthorizeExplicitProject(request, authorize3);
27201
27351
  const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
27202
27352
  if (!current3) return sendNotFound(reply);
27203
- await authorizeMutation(request, current3, authorize2);
27353
+ await authorizeMutation(request, current3, authorize3);
27204
27354
  return lockedTask(request, current3, async (locked) => {
27205
27355
  if (locked.ownerType === "agent") return reply.code(403).send({ success: false, code: "AGENT_RUNTIME_REQUIRED" });
27206
27356
  const updated = await deps.tasks.updateIfSnapshot(
@@ -27215,11 +27365,11 @@ function createTaskController(deps) {
27215
27365
  });
27216
27366
  const command = withErrors(async (request, reply) => {
27217
27367
  const body = snapshotCommand(request.body);
27218
- await preauthorizeExplicitProject(request, authorize2);
27368
+ await preauthorizeExplicitProject(request, authorize3);
27219
27369
  const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
27220
27370
  if (!current3) return sendNotFound(reply);
27221
27371
  const capability2 = commandCapability(body.type);
27222
- await authorizeCommand(request, current3, authorize2, capability2);
27372
+ await authorizeCommand(request, current3, authorize3, capability2);
27223
27373
  if (!deps.commands) return reply.code(503).send({ success: false, code: "TASK_COMMAND_UNAVAILABLE" });
27224
27374
  return lockedTask(request, current3, async (locked) => {
27225
27375
  if (body.expectedUpdatedAt && body.expectedUpdatedAt !== locked.updatedAt.toISOString()) {
@@ -27230,10 +27380,10 @@ function createTaskController(deps) {
27230
27380
  }, capability2);
27231
27381
  });
27232
27382
  const workItems = withErrors(async (request, reply) => {
27233
- await preauthorizeExplicitProject(request, authorize2);
27383
+ await preauthorizeExplicitProject(request, authorize3);
27234
27384
  const current3 = await deps.tasks.getById(getTenantId25(request), request.params.id);
27235
27385
  if (!current3) return sendNotFound(reply);
27236
- await authorizeRead(request, current3, authorize2);
27386
+ await authorizeRead(request, current3, authorize3);
27237
27387
  const query = exactObject(request.query, ["action", "limit", "offset"]);
27238
27388
  const rows = await deps.workItems.list({
27239
27389
  tenantId: current3.tenantId,
@@ -37381,33 +37531,33 @@ async function transferGovernedDispatchOwner(task, options, deps) {
37381
37531
  function broadcastModelProviderChanged(tenantId, providerId2) {
37382
37532
  if (!tenantId) return;
37383
37533
  try {
37384
- const outbox = getStoreLattice31("default", "outbox").store;
37534
+ const outbox = getStoreLattice32("default", "outbox").store;
37385
37535
  void publishModelProviderChanged(outbox, getReplicaId10(), tenantId, providerId2);
37386
37536
  } catch {
37387
37537
  }
37388
37538
  }
37389
37539
  var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
37390
37540
  const platformAuditService = new PlatformAuditService(
37391
- getStoreLattice31("default", "platformAudit").store
37541
+ getStoreLattice32("default", "platformAudit").store
37392
37542
  );
37393
37543
  registerPlatformAuditHook(app2, {
37394
37544
  service: platformAuditService,
37395
37545
  platformAccess: getDefaultPlatformAccessService()
37396
37546
  });
37397
37547
  app2.addHook("preHandler", platformTenantGlobalGuard);
37398
- const webAppStore = getStoreLattice31("default", "agentWebApp").store;
37399
- const assistantStore = getStoreLattice31("default", "assistant").store;
37400
- const projectStore = getStoreLattice31("default", "project").store;
37401
- const projectMembershipStore = getStoreLattice31("default", "projectMembership").store;
37402
- const userTenantLinkStore = getStoreLattice31("default", "userTenantLink").store;
37403
- const projectRoomStore = getStoreLattice31("default", "projectRoom").store;
37404
- const projectBotMembershipStore = getStoreLattice31("default", "projectBotMembership").store;
37405
- const projectRoomMessageStore = getStoreLattice31("default", "projectRoomMessage").store;
37406
- const projectRoomReadStateStore = getStoreLattice31("default", "projectRoomReadState").store;
37407
- const userPushSubscriptionStore = getStoreLattice31("default", "userPushSubscription").store;
37408
- const threadStore = getStoreLattice31("default", "thread").store;
37409
- const taskStore = getStoreLattice31("default", "task").store;
37410
- const taskWorkItemStore = getStoreLattice31("default", "taskWorkItem").store;
37548
+ const webAppStore = getStoreLattice32("default", "agentWebApp").store;
37549
+ const assistantStore = getStoreLattice32("default", "assistant").store;
37550
+ const projectStore = getStoreLattice32("default", "project").store;
37551
+ const projectMembershipStore = getStoreLattice32("default", "projectMembership").store;
37552
+ const userTenantLinkStore = getStoreLattice32("default", "userTenantLink").store;
37553
+ const projectRoomStore = getStoreLattice32("default", "projectRoom").store;
37554
+ const projectBotMembershipStore = getStoreLattice32("default", "projectBotMembership").store;
37555
+ const projectRoomMessageStore = getStoreLattice32("default", "projectRoomMessage").store;
37556
+ const projectRoomReadStateStore = getStoreLattice32("default", "projectRoomReadState").store;
37557
+ const userPushSubscriptionStore = getStoreLattice32("default", "userPushSubscription").store;
37558
+ const threadStore = getStoreLattice32("default", "thread").store;
37559
+ const taskStore = getStoreLattice32("default", "task").store;
37560
+ const taskWorkItemStore = getStoreLattice32("default", "taskWorkItem").store;
37411
37561
  const projectTaskEnabled = options.projectTaskEnabled ?? process.env.AXIOM_PROJECT_TASK_EXECUTION_ENABLED !== "false";
37412
37562
  const accessService = new ProjectAccessService({ projectStore, membershipStore: projectMembershipStore, userTenantLinkStore });
37413
37563
  setA2AProjectAccess(accessService);
@@ -37481,7 +37631,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
37481
37631
  updateAssistant: assistantStore.updateAssistant.bind(assistantStore)
37482
37632
  });
37483
37633
  const resolveCoordinatorMentionName = async (tenantId) => {
37484
- const tenant2 = await getStoreLattice31("default", "tenant").store.getTenantById(tenantId);
37634
+ const tenant2 = await getStoreLattice32("default", "tenant").store.getTenantById(tenantId);
37485
37635
  const value = tenant2?.metadata?.coordinatorMentionName;
37486
37636
  return typeof value === "string" && value.length > 0 ? value : void 0;
37487
37637
  };
@@ -37674,7 +37824,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
37674
37824
  readStateService,
37675
37825
  interruptService: roomInterruptService,
37676
37826
  userDirectory: {
37677
- getUserById: (id3) => getStoreLattice31("default", "user").store.getUserById(id3).then((u) => u ? { name: u.name } : null)
37827
+ getUserById: (id3) => getStoreLattice32("default", "user").store.getUserById(id3).then((u) => u ? { name: u.name } : null)
37678
37828
  }
37679
37829
  });
37680
37830
  registerProjectRosterRoutes(app2, { service: rosterService });
@@ -37685,7 +37835,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
37685
37835
  createProject: projectStore.createProject.bind(projectStore)
37686
37836
  },
37687
37837
  workspaceStore: {
37688
- getWorkspaceById: (tenantId, id3) => getStoreLattice31("default", "workspace").store.getWorkspaceById(tenantId, id3)
37838
+ getWorkspaceById: (tenantId, id3) => getStoreLattice32("default", "workspace").store.getWorkspaceById(tenantId, id3)
37689
37839
  },
37690
37840
  membershipStore: {
37691
37841
  list: projectMembershipStore.list.bind(projectMembershipStore),
@@ -37708,7 +37858,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
37708
37858
  getUsersByTenant: userTenantLinkStore.getUsersByTenant.bind(userTenantLinkStore)
37709
37859
  },
37710
37860
  userStore: {
37711
- getUserById: (id3) => getStoreLattice31("default", "user").store.getUserById(id3).then((u) => u ? { id: u.id, name: u.name, email: u.email } : null)
37861
+ getUserById: (id3) => getStoreLattice32("default", "user").store.getUserById(id3).then((u) => u ? { id: u.id, name: u.name, email: u.email } : null)
37712
37862
  },
37713
37863
  assistantStore: {
37714
37864
  getAssistantById: assistantStore.getAssistantById.bind(assistantStore),
@@ -37730,11 +37880,11 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
37730
37880
  }
37731
37881
  });
37732
37882
  registerCapabilityBundleRoutes(app2, new CapabilityBundleController({
37733
- bundleStore: getStoreLattice31("default", "capabilityBundle").store,
37883
+ bundleStore: getStoreLattice32("default", "capabilityBundle").store,
37734
37884
  projectStore
37735
37885
  }, { authRequired: process.env.AUTH_REQUIRED === "true" }));
37736
37886
  const modelProviderService = new ModelProviderService({
37737
- providerStore: getStoreLattice31("default", "modelProvider").store,
37887
+ providerStore: getStoreLattice32("default", "modelProvider").store,
37738
37888
  userTenantLinkStore,
37739
37889
  registry: {
37740
37890
  register: (tenantId, modelKey2, config) => modelLatticeManager3.registerLatticeWithTenant(tenantId, modelKey2, config),
@@ -37825,7 +37975,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
37825
37975
  }),
37826
37976
  service: new AgentWebAppRuntimeService({
37827
37977
  webAppStore,
37828
- threadStore: getStoreLattice31("default", "thread").store,
37978
+ threadStore: getStoreLattice32("default", "thread").store,
37829
37979
  projectStore,
37830
37980
  assistantResolver: {
37831
37981
  resolve: async (tenantId, assistantId) => {
@@ -38022,6 +38172,10 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
38022
38172
  deleteThread
38023
38173
  );
38024
38174
  registerThreadReadRoutes(app2);
38175
+ registerTenantMonitorRoutes(app2, {
38176
+ authRequired: process.env.AUTH_REQUIRED === "true",
38177
+ userTenantLinkStore
38178
+ });
38025
38179
  registerRunLifecycleRoutes(app2);
38026
38180
  registerThreadEventRoutes(app2);
38027
38181
  registerThreadEventWebSocketRoute(app2);
@@ -38136,13 +38290,13 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
38136
38290
  const oidcAllowedPrivateHosts = parseAllowedPrivateHosts3(
38137
38291
  process.env.OIDC_ALLOWED_PRIVATE_HOSTS
38138
38292
  );
38139
- const leaseStore = getStoreLattice31("default", "lease").store;
38140
- const userExternalIdentityStore = getStoreLattice31("default", "userExternalIdentity").store;
38141
- const oidcProviderConfigStore = getStoreLattice31("default", "oidcProviderConfig").store;
38142
- const platformMemberStore = getStoreLattice31("default", "platformMember").store;
38143
- const platformInvitationStore = getStoreLattice31("default", "platformInvitation").store;
38144
- const oidcIdentityClaimStore = getStoreLattice31("default", "oidcIdentityClaim").store;
38145
- const inviteLinkStore = getStoreLattice31("default", "inviteLink").store;
38293
+ const leaseStore = getStoreLattice32("default", "lease").store;
38294
+ const userExternalIdentityStore = getStoreLattice32("default", "userExternalIdentity").store;
38295
+ const oidcProviderConfigStore = getStoreLattice32("default", "oidcProviderConfig").store;
38296
+ const platformMemberStore = getStoreLattice32("default", "platformMember").store;
38297
+ const platformInvitationStore = getStoreLattice32("default", "platformInvitation").store;
38298
+ const oidcIdentityClaimStore = getStoreLattice32("default", "oidcIdentityClaim").store;
38299
+ const inviteLinkStore = getStoreLattice32("default", "inviteLink").store;
38146
38300
  const oidcDeploymentGuard = Promise.all([
38147
38301
  oidcProviderConfigStore.list(),
38148
38302
  platformMemberStore.list()
@@ -38188,7 +38342,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
38188
38342
  logger: { warn: (event) => app2.log.warn(event) }
38189
38343
  });
38190
38344
  const ssoBootstrap = new PlatformSsoBootstrapService({
38191
- userStore: getStoreLattice31("default", "user").store,
38345
+ userStore: getStoreLattice32("default", "user").store,
38192
38346
  userExternalIdentityStore,
38193
38347
  platformMemberStore,
38194
38348
  leaseStore,
@@ -38199,7 +38353,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
38199
38353
  }
38200
38354
  });
38201
38355
  const platformInvitationService = new PlatformInvitationService({
38202
- userStore: getStoreLattice31("default", "user").store,
38356
+ userStore: getStoreLattice32("default", "user").store,
38203
38357
  platformMemberStore,
38204
38358
  platformInvitationStore,
38205
38359
  userExternalIdentityStore,
@@ -38214,11 +38368,11 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
38214
38368
  },
38215
38369
  audit: (event) => app2.log.info(event)
38216
38370
  });
38217
- const platformSettingsStore = getStoreLattice31(
38371
+ const platformSettingsStore = getStoreLattice32(
38218
38372
  "default",
38219
38373
  "platformSettings"
38220
38374
  ).store;
38221
- const platformSettingsOutbox = getStoreLattice31("default", "outbox").store;
38375
+ const platformSettingsOutbox = getStoreLattice32("default", "outbox").store;
38222
38376
  const platformSettingsService = new PlatformSettingsService({
38223
38377
  store: platformSettingsStore,
38224
38378
  env: process.env,
@@ -38242,8 +38396,8 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
38242
38396
  rebuildRateLimitPolicies();
38243
38397
  registerOidcAuthRoutes(app2, {
38244
38398
  registry: oidcProviderRegistry,
38245
- userStore: getStoreLattice31("default", "user").store,
38246
- userTenantLinkStore: getStoreLattice31("default", "userTenantLink").store,
38399
+ userStore: getStoreLattice32("default", "user").store,
38400
+ userTenantLinkStore: getStoreLattice32("default", "userTenantLink").store,
38247
38401
  userExternalIdentityStore,
38248
38402
  leaseStore,
38249
38403
  sessionSecret: consoleTokenSecret,
@@ -38285,7 +38439,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
38285
38439
  registerOidcProviderRoutes(app2, {
38286
38440
  registry: oidcProviderRegistry,
38287
38441
  store: oidcProviderConfigStore,
38288
- tenantStore: getStoreLattice31("default", "tenant").store,
38442
+ tenantStore: getStoreLattice32("default", "tenant").store,
38289
38443
  envConfig: oidcConfig,
38290
38444
  publicGatewayUrl: process.env.PUBLIC_GATEWAY_URL,
38291
38445
  nodeEnv: process.env.NODE_ENV,
@@ -38374,10 +38528,10 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
38374
38528
  });
38375
38529
  const oidcIdentityClaimService = new OidcIdentityClaimService({
38376
38530
  claimStore: oidcIdentityClaimStore,
38377
- userStore: getStoreLattice31("default", "user").store,
38531
+ userStore: getStoreLattice32("default", "user").store,
38378
38532
  userExternalIdentityStore,
38379
- userTenantLinkStore: getStoreLattice31("default", "userTenantLink").store,
38380
- tenantStore: getStoreLattice31("default", "tenant").store,
38533
+ userTenantLinkStore: getStoreLattice32("default", "userTenantLink").store,
38534
+ tenantStore: getStoreLattice32("default", "tenant").store,
38381
38535
  inviteLinkStore,
38382
38536
  platformMemberStore,
38383
38537
  platformAccess: getDefaultPlatformAccessService(),
@@ -38393,9 +38547,9 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
38393
38547
  const publicConsoleUrl = process.env.PUBLIC_CONSOLE_URL?.trim() || safeUrlOrigin(process.env.OIDC_POST_LOGIN_REDIRECT_URI) || process.env.PUBLIC_GATEWAY_URL?.trim() || "http://localhost:4000";
38394
38548
  const inviteLinkService = new InviteLinkService({
38395
38549
  store: inviteLinkStore,
38396
- userStore: getStoreLattice31("default", "user").store,
38397
- tenantStore: getStoreLattice31("default", "tenant").store,
38398
- userTenantLinkStore: getStoreLattice31("default", "userTenantLink").store,
38550
+ userStore: getStoreLattice32("default", "user").store,
38551
+ tenantStore: getStoreLattice32("default", "tenant").store,
38552
+ userTenantLinkStore: getStoreLattice32("default", "userTenantLink").store,
38399
38553
  claimStore: oidcIdentityClaimStore,
38400
38554
  publicConsoleUrl,
38401
38555
  defaults: platformSettingsService
@@ -38404,7 +38558,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
38404
38558
  authRequired: authRequired2,
38405
38559
  tokenSecret: consoleTokenSecret,
38406
38560
  service: inviteLinkService,
38407
- userStore: getStoreLattice31("default", "user").store,
38561
+ userStore: getStoreLattice32("default", "user").store,
38408
38562
  audit: (event) => app2.log.info(event)
38409
38563
  });
38410
38564
  registerPlatformOpsRoutes(app2, {
@@ -38560,9 +38714,9 @@ function tryCreateProjectTaskRuntime(input) {
38560
38714
  let stores;
38561
38715
  try {
38562
38716
  stores = {
38563
- tenants: getStoreLattice31("default", "tenant").store,
38564
- workspaces: getStoreLattice31("default", "workspace").store,
38565
- ledger: getStoreLattice31("default", "agentRun").store
38717
+ tenants: getStoreLattice32("default", "tenant").store,
38718
+ workspaces: getStoreLattice32("default", "workspace").store,
38719
+ ledger: getStoreLattice32("default", "agentRun").store
38566
38720
  };
38567
38721
  const missing = missingRuntimeMethod(input, stores);
38568
38722
  if (missing) return { reason: missing };
@@ -38934,9 +39088,9 @@ var skillRegistration = {
38934
39088
  };
38935
39089
 
38936
39090
  // src/export_registrations/agent.registration.ts
38937
- import { getStoreLattice as getStoreLattice32 } from "@axiom-lattice/core";
39091
+ import { getStoreLattice as getStoreLattice33 } from "@axiom-lattice/core";
38938
39092
  function getStore2() {
38939
- return getStoreLattice32("default", "assistant").store;
39093
+ return getStoreLattice33("default", "assistant").store;
38940
39094
  }
38941
39095
  var agentRegistration = {
38942
39096
  entityType: "agent",
@@ -39016,9 +39170,9 @@ var agentRegistration = {
39016
39170
  };
39017
39171
 
39018
39172
  // src/export_registrations/database-config.registration.ts
39019
- import { getStoreLattice as getStoreLattice33 } from "@axiom-lattice/core";
39173
+ import { getStoreLattice as getStoreLattice34 } from "@axiom-lattice/core";
39020
39174
  function getStore3() {
39021
- return getStoreLattice33("default", "database").store;
39175
+ return getStoreLattice34("default", "database").store;
39022
39176
  }
39023
39177
  var databaseConfigRegistration = {
39024
39178
  entityType: "database_config",
@@ -39098,9 +39252,9 @@ var databaseConfigRegistration = {
39098
39252
  };
39099
39253
 
39100
39254
  // src/export_registrations/metrics-config.registration.ts
39101
- import { getStoreLattice as getStoreLattice34 } from "@axiom-lattice/core";
39255
+ import { getStoreLattice as getStoreLattice35 } from "@axiom-lattice/core";
39102
39256
  function getStore4() {
39103
- return getStoreLattice34("default", "metrics").store;
39257
+ return getStoreLattice35("default", "metrics").store;
39104
39258
  }
39105
39259
  var metricsConfigRegistration = {
39106
39260
  entityType: "metrics_config",
@@ -39180,9 +39334,9 @@ var metricsConfigRegistration = {
39180
39334
  };
39181
39335
 
39182
39336
  // src/export_registrations/mcp-config.registration.ts
39183
- import { getStoreLattice as getStoreLattice35 } from "@axiom-lattice/core";
39337
+ import { getStoreLattice as getStoreLattice36 } from "@axiom-lattice/core";
39184
39338
  function getStore5() {
39185
- return getStoreLattice35("default", "mcp").store;
39339
+ return getStoreLattice36("default", "mcp").store;
39186
39340
  }
39187
39341
  var mcpConfigRegistration = {
39188
39342
  entityType: "mcp_config",
@@ -39265,9 +39419,9 @@ var mcpConfigRegistration = {
39265
39419
  };
39266
39420
 
39267
39421
  // src/export_registrations/connection.registration.ts
39268
- import { getStoreLattice as getStoreLattice36 } from "@axiom-lattice/core";
39422
+ import { getStoreLattice as getStoreLattice37 } from "@axiom-lattice/core";
39269
39423
  function getStore6() {
39270
- return getStoreLattice36("default", "connection").store;
39424
+ return getStoreLattice37("default", "connection").store;
39271
39425
  }
39272
39426
  async function listAllConnections(tenantId) {
39273
39427
  const store2 = getStore6();
@@ -39352,9 +39506,9 @@ var connectionRegistration = {
39352
39506
  };
39353
39507
 
39354
39508
  // src/export_registrations/collection.registration.ts
39355
- import { getStoreLattice as getStoreLattice37 } from "@axiom-lattice/core";
39509
+ import { getStoreLattice as getStoreLattice38 } from "@axiom-lattice/core";
39356
39510
  function getStore7() {
39357
- return getStoreLattice37("default", "collection").store;
39511
+ return getStoreLattice38("default", "collection").store;
39358
39512
  }
39359
39513
  var collectionRegistration = {
39360
39514
  entityType: "collection",
@@ -39425,7 +39579,7 @@ var collectionRegistration = {
39425
39579
  };
39426
39580
 
39427
39581
  // src/export_registrations/channel-installation.registration.ts
39428
- import { getStoreLattice as getStoreLattice38 } from "@axiom-lattice/core";
39582
+ import { getStoreLattice as getStoreLattice39 } from "@axiom-lattice/core";
39429
39583
  import { randomUUID as randomUUID38 } from "crypto";
39430
39584
  var UUID_PATTERN3 = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
39431
39585
  var PUBLIC_CHANNELS = /* @__PURE__ */ new Set(["lark", "email", "slack", "wechat", "wecom"]);
@@ -39462,7 +39616,7 @@ function validateImportData(data) {
39462
39616
  };
39463
39617
  }
39464
39618
  function getStore8() {
39465
- return getStoreLattice38("default", "channelInstallation").store;
39619
+ return getStoreLattice39("default", "channelInstallation").store;
39466
39620
  }
39467
39621
  function getOverwriteError(tenantId, incomingChannel, existing) {
39468
39622
  if (!existing) return "Channel installation overwrite target must exist";
@@ -39596,9 +39750,9 @@ var channelInstallationRegistration = {
39596
39750
  };
39597
39751
 
39598
39752
  // src/export_registrations/menu.registration.ts
39599
- import { getStoreLattice as getStoreLattice39 } from "@axiom-lattice/core";
39753
+ import { getStoreLattice as getStoreLattice40 } from "@axiom-lattice/core";
39600
39754
  function getStore9() {
39601
- return getStoreLattice39("default", "menu").store;
39755
+ return getStoreLattice40("default", "menu").store;
39602
39756
  }
39603
39757
  var menuRegistration = {
39604
39758
  entityType: "menu",
@@ -39676,9 +39830,9 @@ var menuRegistration = {
39676
39830
  };
39677
39831
 
39678
39832
  // src/export_registrations/eval.registration.ts
39679
- import { getStoreLattice as getStoreLattice40 } from "@axiom-lattice/core";
39833
+ import { getStoreLattice as getStoreLattice41 } from "@axiom-lattice/core";
39680
39834
  function getStore10() {
39681
- return getStoreLattice40("default", "eval").store;
39835
+ return getStoreLattice41("default", "eval").store;
39682
39836
  }
39683
39837
  var evalRegistration = {
39684
39838
  entityType: "eval",
@@ -40175,14 +40329,14 @@ function parseWecomTextFrame(frame) {
40175
40329
  }
40176
40330
 
40177
40331
  // src/channels/wecom/cardTool.ts
40178
- import { getStoreLattice as getStoreLattice41, getToolLattice, registerToolLattice } from "@axiom-lattice/core";
40332
+ import { getStoreLattice as getStoreLattice42, getToolLattice, registerToolLattice } from "@axiom-lattice/core";
40179
40333
  import { z as z12 } from "zod";
40180
40334
  var CARD_TTL_MS = 10 * 6e4;
40181
40335
  var SHARED_NAMESPACE = ["channel-runtime", "wecom-card"];
40182
40336
  var SHARED_TTL_MINUTES = 10;
40183
40337
  function sharedStore() {
40184
40338
  try {
40185
- return getStoreLattice41("default", "store").store;
40339
+ return getStoreLattice42("default", "store").store;
40186
40340
  } catch {
40187
40341
  return null;
40188
40342
  }
@@ -41104,7 +41258,7 @@ import {
41104
41258
  SANDBOX_LEGACY_ROOT,
41105
41259
  SANDBOX_HOME,
41106
41260
  SANDBOX_DEFAULT_IMAGE,
41107
- getStoreLattice as getStoreLattice46,
41261
+ getStoreLattice as getStoreLattice47,
41108
41262
  agentInstanceManager as agentInstanceManager13,
41109
41263
  createSandboxProvider,
41110
41264
  TokenCache,
@@ -41807,7 +41961,7 @@ import { RoomAgentMessageService } from "@axiom-lattice/core";
41807
41961
 
41808
41962
  // src/router/MessageRouter.ts
41809
41963
  import {
41810
- getStoreLattice as getStoreLattice42,
41964
+ getStoreLattice as getStoreLattice43,
41811
41965
  agentInstanceManager as agentInstanceManager10
41812
41966
  } from "@axiom-lattice/core";
41813
41967
  import {
@@ -42132,7 +42286,7 @@ var _MessageRouter = class _MessageRouter {
42132
42286
  channel: message.channel,
42133
42287
  adapterChannel: adapter.channel
42134
42288
  }, "Thread resolved by adapter strategy");
42135
- const threadStore = getStoreLattice42("default", "thread").store;
42289
+ const threadStore = getStoreLattice43("default", "thread").store;
42136
42290
  try {
42137
42291
  await threadStore.createThread(
42138
42292
  tenantId,
@@ -42169,7 +42323,7 @@ var _MessageRouter = class _MessageRouter {
42169
42323
  }
42170
42324
  }
42171
42325
  if (!threadId) {
42172
- const threadStore = getStoreLattice42("default", "thread").store;
42326
+ const threadStore = getStoreLattice43("default", "thread").store;
42173
42327
  const newThreadId = randomUUID40();
42174
42328
  console.log({
42175
42329
  event: "dispatch:thread:create",
@@ -42404,8 +42558,8 @@ var _MessageRouter = class _MessageRouter {
42404
42558
  ...metadata && typeof metadata === "object" && !Array.isArray(metadata) ? metadata : {},
42405
42559
  channelRun: true
42406
42560
  };
42407
- const runLedger = getStoreLattice42("default", "agentRun").store;
42408
- const jobStore = getStoreLattice42("default", "channelReplyJob").store;
42561
+ const runLedger = getStoreLattice43("default", "agentRun").store;
42562
+ const jobStore = getStoreLattice43("default", "channelReplyJob").store;
42409
42563
  const runId = randomUUID40();
42410
42564
  await jobStore.create({
42411
42565
  runId,
@@ -43923,7 +44077,7 @@ import {
43923
44077
  isLinkLocalOrMetadataAddress as isLinkLocalOrMetadataAddress2,
43924
44078
  probeOidcProvider as probeOidcProvider2
43925
44079
  } from "@axiom-lattice/auth-oidc";
43926
- import { getStoreLattice as getStoreLattice43 } from "@axiom-lattice/core";
44080
+ import { getStoreLattice as getStoreLattice44 } from "@axiom-lattice/core";
43927
44081
 
43928
44082
  // src/services/platform-ops/loginPreviewApp.ts
43929
44083
  var LOGIN_PREVIEW_UI_RESOURCE = "ui://platform-ops/login-preview";
@@ -44068,29 +44222,29 @@ function resolvePlatformAccess(deps) {
44068
44222
  return deps.platformAccess ?? safeResolve(() => getDefaultPlatformAccessService());
44069
44223
  }
44070
44224
  function resolveUsers(deps) {
44071
- return deps.users ?? safeResolve(() => getStoreLattice43("default", "user").store);
44225
+ return deps.users ?? safeResolve(() => getStoreLattice44("default", "user").store);
44072
44226
  }
44073
44227
  function resolveTenants(deps) {
44074
- return deps.tenants ?? safeResolve(() => getStoreLattice43("default", "tenant").store);
44228
+ return deps.tenants ?? safeResolve(() => getStoreLattice44("default", "tenant").store);
44075
44229
  }
44076
44230
  function resolvePlatformMembers(deps) {
44077
- return deps.platformMembers ?? safeResolve(() => getStoreLattice43("default", "platformMember").store);
44231
+ return deps.platformMembers ?? safeResolve(() => getStoreLattice44("default", "platformMember").store);
44078
44232
  }
44079
44233
  function resolvePlatformInvitations(deps) {
44080
- return deps.platformInvitations ?? safeResolve(() => getStoreLattice43("default", "platformInvitation").store);
44234
+ return deps.platformInvitations ?? safeResolve(() => getStoreLattice44("default", "platformInvitation").store);
44081
44235
  }
44082
44236
  function resolveInviteLinks(deps) {
44083
- return deps.inviteLinks ?? safeResolve(() => getStoreLattice43("default", "inviteLink").store);
44237
+ return deps.inviteLinks ?? safeResolve(() => getStoreLattice44("default", "inviteLink").store);
44084
44238
  }
44085
44239
  function resolveUserTenantLinks(deps) {
44086
44240
  if ("userTenantLinks" in deps) return deps.userTenantLinks;
44087
- return safeResolve(() => getStoreLattice43("default", "userTenantLink").store);
44241
+ return safeResolve(() => getStoreLattice44("default", "userTenantLink").store);
44088
44242
  }
44089
44243
  function resolveOidcProviders(deps) {
44090
- return deps.oidcProviders ?? safeResolve(() => getStoreLattice43("default", "oidcProviderConfig").store);
44244
+ return deps.oidcProviders ?? safeResolve(() => getStoreLattice44("default", "oidcProviderConfig").store);
44091
44245
  }
44092
44246
  function resolveOidcIdentityClaims(deps) {
44093
- return deps.oidcIdentityClaims ?? safeResolve(() => getStoreLattice43("default", "oidcIdentityClaim").store);
44247
+ return deps.oidcIdentityClaims ?? safeResolve(() => getStoreLattice44("default", "oidcIdentityClaim").store);
44094
44248
  }
44095
44249
  function resolveSettings(deps) {
44096
44250
  return deps.settings ?? safeResolve(() => getPlatformSettingsProvider());
@@ -44106,7 +44260,7 @@ function resolveEnvironment(deps, settings) {
44106
44260
  });
44107
44261
  }
44108
44262
  function resolveUserExternalIdentities(deps) {
44109
- return deps.userExternalIdentities ?? safeResolve(() => getStoreLattice43("default", "userExternalIdentity").store);
44263
+ return deps.userExternalIdentities ?? safeResolve(() => getStoreLattice44("default", "userExternalIdentity").store);
44110
44264
  }
44111
44265
  function resolvePlatformInvitationService(deps) {
44112
44266
  return deps.platformInvitationService;
@@ -44120,7 +44274,7 @@ function resolveOidcIdentityClaimService(deps) {
44120
44274
  function resolvePlatformAudit(deps) {
44121
44275
  return deps.platformAudit ?? safeResolve(
44122
44276
  () => new PlatformAuditService(
44123
- getStoreLattice43("default", "platformAudit").store
44277
+ getStoreLattice44("default", "platformAudit").store
44124
44278
  )
44125
44279
  );
44126
44280
  }
@@ -44146,7 +44300,7 @@ async function authorizeForUser(userId, deps) {
44146
44300
  if (!role) throw new PlatformOpsToolError(PLATFORM_ROLE_REQUIRED);
44147
44301
  return { userId, role };
44148
44302
  }
44149
- async function authorize(exeConfig, deps) {
44303
+ async function authorize2(exeConfig, deps) {
44150
44304
  const userId = runtimeUserId(exeConfig);
44151
44305
  if (!userId) throw new PlatformOpsToolError(PLATFORM_ROLE_REQUIRED);
44152
44306
  return authorizeForUser(userId, deps);
@@ -44379,7 +44533,7 @@ function readTool(name, description, schema2, deps, handler) {
44379
44533
  return tool$1(
44380
44534
  async (input, exeConfig) => {
44381
44535
  try {
44382
- const caller = await authorize(exeConfig, deps);
44536
+ const caller = await authorize2(exeConfig, deps);
44383
44537
  return success(await handler(input, caller));
44384
44538
  } catch (error) {
44385
44539
  if (error instanceof PlatformOpsToolError) {
@@ -44480,7 +44634,7 @@ function writeTool(name, description, schema2, deps, handler) {
44480
44634
  const context2 = runtimeCallerContext(exeConfig);
44481
44635
  let caller;
44482
44636
  try {
44483
- caller = await authorize(exeConfig, deps);
44637
+ caller = await authorize2(exeConfig, deps);
44484
44638
  } catch (error) {
44485
44639
  return writeFailure(resolveWriteError(error));
44486
44640
  }
@@ -44549,7 +44703,7 @@ function playbookTool(name, description, schema2, deps, handler) {
44549
44703
  const context2 = runtimeCallerContext(exeConfig);
44550
44704
  let caller;
44551
44705
  try {
44552
- caller = await authorize(exeConfig, deps);
44706
+ caller = await authorize2(exeConfig, deps);
44553
44707
  } catch (error) {
44554
44708
  return writeFailure(resolveWriteError(error));
44555
44709
  }
@@ -46102,7 +46256,7 @@ function createPlatformOpsTools(deps = {}) {
46102
46256
  const previewLoginTool = tool$1(
46103
46257
  async (input, exeConfig) => {
46104
46258
  try {
46105
- await authorize(exeConfig, deps);
46259
+ await authorize2(exeConfig, deps);
46106
46260
  const consoleUrl = process.env.PUBLIC_CONSOLE_URL?.replace(/\/$/, "");
46107
46261
  if (!consoleUrl) return failure3(AUTH_PREVIEW_UNAVAILABLE);
46108
46262
  const settings = required(resolveSettings(deps));
@@ -48921,7 +49075,7 @@ function resolveRetentionMs(value) {
48921
49075
  // src/services/execution/threadTtlSweeper.ts
48922
49076
  import {
48923
49077
  getReplicaId as getReplicaId11,
48924
- getStoreLattice as getStoreLattice44,
49078
+ getStoreLattice as getStoreLattice45,
48925
49079
  tryAcquireThreadRun as tryAcquireThreadRun2
48926
49080
  } from "@axiom-lattice/core";
48927
49081
  function createThreadTtlSweeper(options) {
@@ -48939,7 +49093,7 @@ function createThreadTtlSweeper(options) {
48939
49093
  const result = { scanned: 0, pruned: 0, skipped: 0, errors: 0 };
48940
49094
  let expired;
48941
49095
  try {
48942
- expired = await getStoreLattice44("default", "thread").store.listExpiredThreads(now(), batchSize);
49096
+ expired = await getStoreLattice45("default", "thread").store.listExpiredThreads(now(), batchSize);
48943
49097
  } catch (error) {
48944
49098
  result.errors += 1;
48945
49099
  log2.warn("Thread TTL sweep failed to list expired threads", {
@@ -48952,7 +49106,7 @@ function createThreadTtlSweeper(options) {
48952
49106
  let lease;
48953
49107
  try {
48954
49108
  lease = await tryAcquireThreadRun2({
48955
- store: getStoreLattice44("default", "lease").store,
49109
+ store: getStoreLattice45("default", "lease").store,
48956
49110
  tenantId: thread.tenantId,
48957
49111
  assistantId: thread.assistantId,
48958
49112
  threadId: thread.id,
@@ -48972,7 +49126,7 @@ function createThreadTtlSweeper(options) {
48972
49126
  continue;
48973
49127
  }
48974
49128
  try {
48975
- const queueStore = getStoreLattice44("default", "threadMessageQueue").store;
49129
+ const queueStore = getStoreLattice45("default", "threadMessageQueue").store;
48976
49130
  const pending2 = await queueStore.getPendingMessages(thread.id, queueScopeFromThread(thread));
48977
49131
  if (pending2.length > 0) {
48978
49132
  result.skipped += 1;
@@ -49049,7 +49203,7 @@ function createThreadTtlSweeper(options) {
49049
49203
  }
49050
49204
 
49051
49205
  // src/services/execution/storeTtlSweeper.ts
49052
- import { getStoreLattice as getStoreLattice45 } from "@axiom-lattice/core";
49206
+ import { getStoreLattice as getStoreLattice46 } from "@axiom-lattice/core";
49053
49207
  function parsePositiveInteger(value, fallback) {
49054
49208
  const parsed = Number(value);
49055
49209
  return Number.isSafeInteger(parsed) && parsed >= 1 ? parsed : fallback;
@@ -49072,7 +49226,7 @@ function createStoreTtlSweeper(options) {
49072
49226
  const performSweep = async () => {
49073
49227
  let store2;
49074
49228
  try {
49075
- store2 = getStoreLattice45("default", "store").store;
49229
+ store2 = getStoreLattice46("default", "store").store;
49076
49230
  } catch (error) {
49077
49231
  if (!warnedMissingStore) {
49078
49232
  warnedMissingStore = true;
@@ -51582,7 +51736,7 @@ function isSecretKey(key) {
51582
51736
  function redactText(value) {
51583
51737
  return value.replace(/Bearer\s+[A-Za-z0-9._~+/=-]+/gi, "Bearer [redacted]").replace(/sk-[A-Za-z0-9_-]{8,}/g, "[redacted]");
51584
51738
  }
51585
- function redactString2(value) {
51739
+ function redactString(value) {
51586
51740
  const first = value.trimStart()[0];
51587
51741
  if (first === "{" || first === "[" || first === '"') {
51588
51742
  try {
@@ -51594,7 +51748,7 @@ function redactString2(value) {
51594
51748
  return redactText(value);
51595
51749
  }
51596
51750
  function redactLangfuseValue(value) {
51597
- if (typeof value === "string") return redactString2(value);
51751
+ if (typeof value === "string") return redactString(value);
51598
51752
  if (Array.isArray(value)) return value.map(redactLangfuseValue);
51599
51753
  if (typeof value === "object" && value !== null) {
51600
51754
  return Object.fromEntries(
@@ -51997,7 +52151,7 @@ function getConfiguredSandboxProvider() {
51997
52151
  }
51998
52152
  async function restoreMcpConnections() {
51999
52153
  try {
52000
- const storeLattice = getStoreLattice46("default", "mcp");
52154
+ const storeLattice = getStoreLattice47("default", "mcp");
52001
52155
  const store2 = storeLattice.store;
52002
52156
  if (!store2) {
52003
52157
  logger8.info("MCP store not configured, skipping connection restoration");
@@ -52077,7 +52231,7 @@ var start = async (config) => {
52077
52231
  const channelLeaders = [];
52078
52232
  let runLedger;
52079
52233
  try {
52080
- runLedger = getStoreLattice46("default", "agentRun").store;
52234
+ runLedger = getStoreLattice47("default", "agentRun").store;
52081
52235
  } catch {
52082
52236
  }
52083
52237
  if (runLedger) agentInstanceManager13.setRunLedger(runLedger);
@@ -52180,9 +52334,9 @@ var start = async (config) => {
52180
52334
  let projectRoomRealtimeRuntime;
52181
52335
  if (projectRoomRealtimeMode === "single-gateway") {
52182
52336
  projectRoomRealtimeRuntime = createProjectRoomRealtimeRuntime({
52183
- tasks: getStoreLattice46("default", "task").store,
52184
- rooms: getStoreLattice46("default", "projectRoom").store,
52185
- memberships: getStoreLattice46("default", "projectBotMembership").store,
52337
+ tasks: getStoreLattice47("default", "task").store,
52338
+ rooms: getStoreLattice47("default", "projectRoom").store,
52339
+ memberships: getStoreLattice47("default", "projectBotMembership").store,
52186
52340
  log: { warn: (message, context2) => logger8.warn(message, context2) }
52187
52341
  });
52188
52342
  }
@@ -52198,7 +52352,7 @@ var start = async (config) => {
52198
52352
  try {
52199
52353
  const infrastructure = createChannelInfrastructure({
52200
52354
  adapterRegistry,
52201
- getStore: ((kind) => getStoreLattice46("default", kind).store),
52355
+ getStore: ((kind) => getStoreLattice47("default", kind).store),
52202
52356
  trustedDispatcher: createTrustedAgentMessageDispatcher2((scope) => agentInstanceManager13.getAgent(scope)),
52203
52357
  middlewares: [
52204
52358
  createDeduplicationMiddleware(),
@@ -52230,8 +52384,8 @@ var start = async (config) => {
52230
52384
  if (channelDeps && durableChannelRuns) {
52231
52385
  try {
52232
52386
  channelReplyDispatcher = new ChannelReplyDispatcher({
52233
- jobStore: getStoreLattice46("default", "channelReplyJob").store,
52234
- runLedger: getStoreLattice46("default", "agentRun").store,
52387
+ jobStore: getStoreLattice47("default", "channelReplyJob").store,
52388
+ runLedger: getStoreLattice47("default", "agentRun").store,
52235
52389
  loadFinalReplyText: createCheckpointFinalReplyLoader(),
52236
52390
  adapterRegistry: channelDeps.adapterRegistry,
52237
52391
  installationStore: channelDeps.installationStore,
@@ -52257,7 +52411,7 @@ var start = async (config) => {
52257
52411
  }
52258
52412
  setEvalRunService(evalRunner);
52259
52413
  try {
52260
- const menuStore = getStoreLattice46("default", "menu").store;
52414
+ const menuStore = getStoreLattice47("default", "menu").store;
52261
52415
  setMenuRegistry(menuStore);
52262
52416
  logger8.info("Menu registry initialized");
52263
52417
  } catch {
@@ -52269,7 +52423,7 @@ var start = async (config) => {
52269
52423
  router: channelDeps.router,
52270
52424
  onInstallationChanged: async ({ tenantId, installationId }) => {
52271
52425
  try {
52272
- const outbox = getStoreLattice46("default", "outbox").store;
52426
+ const outbox = getStoreLattice47("default", "outbox").store;
52273
52427
  await publishChannelInstallationChanged(outbox, getReplicaId12(), {
52274
52428
  tenantId,
52275
52429
  installationId
@@ -52283,11 +52437,11 @@ var start = async (config) => {
52283
52437
  });
52284
52438
  }
52285
52439
  platformBootstrapPromise ?? (platformBootstrapPromise = new PlatformBootstrapService({
52286
- userStore: getStoreLattice46("default", "user").store,
52287
- platformMemberStore: getStoreLattice46("default", "platformMember").store,
52440
+ userStore: getStoreLattice47("default", "user").store,
52441
+ platformMemberStore: getStoreLattice47("default", "platformMember").store,
52288
52442
  // Serialize the read-check-write across replicas; a peer that loses the
52289
52443
  // race waits briefly for the winner's owner instead of writing concurrently.
52290
- leaseStore: getStoreLattice46("default", "lease").store,
52444
+ leaseStore: getStoreLattice47("default", "lease").store,
52291
52445
  holder: getReplicaId12(),
52292
52446
  logger: {
52293
52447
  info: (message, context2) => logger8.info(message, context2),
@@ -52305,15 +52459,15 @@ var start = async (config) => {
52305
52459
  try {
52306
52460
  PluginRegistry2.register(
52307
52461
  createPlatformOpsPlugin({
52308
- users: getStoreLattice46("default", "user").store,
52309
- tenants: getStoreLattice46("default", "tenant").store,
52310
- platformMembers: getStoreLattice46("default", "platformMember").store,
52311
- platformInvitations: getStoreLattice46("default", "platformInvitation").store,
52312
- inviteLinks: getStoreLattice46("default", "inviteLink").store,
52313
- userTenantLinks: getStoreLattice46("default", "userTenantLink").store,
52314
- userExternalIdentities: getStoreLattice46("default", "userExternalIdentity").store,
52462
+ users: getStoreLattice47("default", "user").store,
52463
+ tenants: getStoreLattice47("default", "tenant").store,
52464
+ platformMembers: getStoreLattice47("default", "platformMember").store,
52465
+ platformInvitations: getStoreLattice47("default", "platformInvitation").store,
52466
+ inviteLinks: getStoreLattice47("default", "inviteLink").store,
52467
+ userTenantLinks: getStoreLattice47("default", "userTenantLink").store,
52468
+ userExternalIdentities: getStoreLattice47("default", "userExternalIdentity").store,
52315
52469
  oidcProviders: routes.oidcProviderConfigStore,
52316
- oidcIdentityClaims: getStoreLattice46("default", "oidcIdentityClaim").store,
52470
+ oidcIdentityClaims: getStoreLattice47("default", "oidcIdentityClaim").store,
52317
52471
  settings: routes.platformSettingsService,
52318
52472
  platformInvitationService: routes.platformInvitationService,
52319
52473
  inviteLinkService: routes.inviteLinkService,
@@ -52324,9 +52478,9 @@ var start = async (config) => {
52324
52478
  })
52325
52479
  );
52326
52480
  await new PlatformOpsProvisioner({
52327
- tenantStore: getStoreLattice46("default", "tenant").store,
52328
- workspaceStore: getStoreLattice46("default", "workspace").store,
52329
- projectStore: getStoreLattice46("default", "project").store,
52481
+ tenantStore: getStoreLattice47("default", "tenant").store,
52482
+ workspaceStore: getStoreLattice47("default", "workspace").store,
52483
+ projectStore: getStoreLattice47("default", "project").store,
52330
52484
  ensurePluginAgents: ensurePluginAgentsForTenant,
52331
52485
  logger: {
52332
52486
  info: (message, context2) => logger8.info(message, context2),
@@ -52342,10 +52496,10 @@ var start = async (config) => {
52342
52496
  const { A2AAuthService: A2AAuthService2, parseEnvKeys: parseEnvKeys2 } = await import("./A2AAuthService-UYWSDE5L.mjs");
52343
52497
  const { registerA2AStandardRoutes } = await import("./a2a-standard-2IJP4JG5.mjs");
52344
52498
  const a2a = await import("./a2a-OCCSVNWB.mjs");
52345
- const a2aKeyStore = getStoreLattice46("default", "a2aApiKey").store;
52346
- const assistantStore = getStoreLattice46("default", "assistant").store;
52347
- const projectStore = getStoreLattice46("default", "project").store;
52348
- const taskStore = getStoreLattice46("default", "task").store;
52499
+ const a2aKeyStore = getStoreLattice47("default", "a2aApiKey").store;
52500
+ const assistantStore = getStoreLattice47("default", "assistant").store;
52501
+ const projectStore = getStoreLattice47("default", "project").store;
52502
+ const taskStore = getStoreLattice47("default", "task").store;
52349
52503
  const authService = new A2AAuthService2({
52350
52504
  keyStore: a2aKeyStore,
52351
52505
  assistantStore,
@@ -52370,19 +52524,19 @@ var start = async (config) => {
52370
52524
  });
52371
52525
  }
52372
52526
  try {
52373
- const { registerOpenRoutes } = await import("./open-TJLQARLV.mjs");
52527
+ const { registerOpenRoutes } = await import("./open-IA7RD66P.mjs");
52374
52528
  const { registerOpenSessionRoutes } = await import("./open-session-F5H6PFSN.mjs");
52375
52529
  const { registerOpenCatalogRoutes } = await import("./open-catalog-LLTMSZGH.mjs");
52376
- const { registerOpenFilesRoutes } = await import("./open-files-QIMOTHSN.mjs");
52377
- const { registerOpenAuditRoutes } = await import("./open-audit-UJ3NXCGW.mjs");
52530
+ const { registerOpenFilesRoutes } = await import("./open-files-JKHNZ5FF.mjs");
52531
+ const { registerOpenAuditRoutes } = await import("./open-audit-B756NMRP.mjs");
52378
52532
  const { registerOpenExposureRoutes } = await import("./open-exposure-2CSXJTM3.mjs");
52379
52533
  const { openLattice } = await import("./openLattice-KFUREFWM.mjs");
52380
52534
  const { createOpenSandboxProvider } = await import("./sandboxProvider-LA6B5SKU.mjs");
52381
52535
  const { createAgentProvider } = await import("./agentProvider-X4FVQPKW.mjs");
52382
52536
  const { registerExposedPluginTools } = await import("./registerExposedPlugins-N6ENBBKN.mjs");
52383
52537
  openLattice.register(createOpenSandboxProvider());
52384
- const threadStore = getStoreLattice46("default", "thread").store;
52385
- const assistantStore = getStoreLattice46("default", "assistant").store;
52538
+ const threadStore = getStoreLattice47("default", "thread").store;
52539
+ const assistantStore = getStoreLattice47("default", "assistant").store;
52386
52540
  openLattice.register(
52387
52541
  createAgentProvider({
52388
52542
  threadStore,
@@ -52422,9 +52576,9 @@ var start = async (config) => {
52422
52576
  }
52423
52577
  if (isPluginDeploymentRuntimeEnabled()) {
52424
52578
  try {
52425
- const pluginDeploymentStore = getStoreLattice46("default", "pluginDeployment").store;
52426
- const tenantStore = getStoreLattice46("default", "tenant").store;
52427
- const leaseStore2 = getStoreLattice46("default", "lease").store;
52579
+ const pluginDeploymentStore = getStoreLattice47("default", "pluginDeployment").store;
52580
+ const tenantStore = getStoreLattice47("default", "tenant").store;
52581
+ const leaseStore2 = getStoreLattice47("default", "lease").store;
52428
52582
  const listAllDeployments = async () => {
52429
52583
  const tenants = await tenantStore.getAllTenants();
52430
52584
  const lists = await Promise.all(
@@ -52466,7 +52620,7 @@ var start = async (config) => {
52466
52620
  }
52467
52621
  try {
52468
52622
  const { ResourceController } = await import("./resources-53PXMFQI.mjs");
52469
- const sharedResourceStore = getStoreLattice46("default", "sharedResource").store;
52623
+ const sharedResourceStore = getStoreLattice47("default", "sharedResource").store;
52470
52624
  const cache = new TokenCache();
52471
52625
  const resourceController = new ResourceController({
52472
52626
  store: sharedResourceStore,
@@ -52491,8 +52645,8 @@ var start = async (config) => {
52491
52645
  if (channelDeps && process.env.CHANNELS_ENABLED !== "false") {
52492
52646
  try {
52493
52647
  const shardCount = parsePositiveInteger2(process.env.CHANNEL_SHARDS, 1);
52494
- const leaseStore2 = getStoreLattice46("default", "lease").store;
52495
- const installationStore = getStoreLattice46("default", "channelInstallation").store;
52648
+ const leaseStore2 = getStoreLattice47("default", "lease").store;
52649
+ const installationStore = getStoreLattice47("default", "channelInstallation").store;
52496
52650
  for (let shard = 0; shard < shardCount; shard += 1) {
52497
52651
  const leader = new ChannelConnectionLeader({
52498
52652
  leaseStore: leaseStore2,
@@ -52529,8 +52683,8 @@ var start = async (config) => {
52529
52683
  }
52530
52684
  }
52531
52685
  const target_port = config?.port || Number(process.env.PORT) || 4001;
52532
- configureCoordinationLeaseStore(getStoreLattice46("default", "lease").store);
52533
- const outboxStore = getStoreLattice46("default", "outbox").store;
52686
+ configureCoordinationLeaseStore(getStoreLattice47("default", "lease").store);
52687
+ const outboxStore = getStoreLattice47("default", "outbox").store;
52534
52688
  taskLifecycleNotifier3.setOutbox(outboxStore);
52535
52689
  projectTaskAdmissionNotifier2.setOutbox(outboxStore);
52536
52690
  configurePluginCatalogSync({ outbox: outboxStore, owner: getReplicaId12() });
@@ -52567,7 +52721,7 @@ var start = async (config) => {
52567
52721
  },
52568
52722
  [A2A_KEY_CHANGED_TOPIC]: (payload) => handleA2AKeyChanged(payload, () => refreshStoreKeyMap()),
52569
52723
  [MCP_CONFIG_CHANGED_TOPIC]: (payload) => reconcileMcpConfigChange(payload, {
52570
- store: getStoreLattice46("default", "mcp").store,
52724
+ store: getStoreLattice47("default", "mcp").store,
52571
52725
  manager: mcpManager2,
52572
52726
  convertToConnection: convertToConnection2
52573
52727
  }),
@@ -52630,7 +52784,7 @@ var start = async (config) => {
52630
52784
  } catch (err) {
52631
52785
  logger8.warn("Outbox poller failed to start", { error: err instanceof Error ? err.message : String(err) });
52632
52786
  }
52633
- const leaseStore = getStoreLattice46("default", "lease").store;
52787
+ const leaseStore = getStoreLattice47("default", "lease").store;
52634
52788
  if (leaseStore.constructor?.name === "InMemoryLeaseStore") {
52635
52789
  logger8.warn(
52636
52790
  "Startup recovery leader gate uses a non-distributed lease store (per-process only); configure a shared 'lease' store for multi-replica deployments",
@@ -52640,9 +52794,9 @@ var start = async (config) => {
52640
52794
  if (scheduleLatticeManager3.hasLattice("default")) {
52641
52795
  registerAgentCronHandler(scheduleLatticeManager3.getScheduleLattice("default"), {
52642
52796
  getAgent: (params) => agentInstanceManager13.getAgent(params),
52643
- createThread: (tenantId, assistantId, threadId, data) => getStoreLattice46("default", "thread").store.createThread(tenantId, assistantId, threadId, data),
52797
+ createThread: (tenantId, assistantId, threadId, data) => getStoreLattice47("default", "thread").store.createThread(tenantId, assistantId, threadId, data),
52644
52798
  acquireThreadRun: (tenantId, assistantId, threadId) => tryAcquireThreadRun5({
52645
- store: getStoreLattice46("default", "lease").store,
52799
+ store: getStoreLattice47("default", "lease").store,
52646
52800
  tenantId,
52647
52801
  assistantId,
52648
52802
  threadId,
@@ -52666,9 +52820,9 @@ var start = async (config) => {
52666
52820
  const { createOrphanRecoveryRuntime: createOrphanRecoveryRuntime2 } = await import("./OrphanRecoveryRuntime-T4T5NOZU.mjs");
52667
52821
  const { createRecoveryCallerDeps: createRecoveryCallerDeps2 } = await import("./RecoveryCallerDeps-6SJUYJ5S.mjs");
52668
52822
  const runtime = createOrphanRecoveryRuntime2({
52669
- taskStore: getStoreLattice46("default", "task").store,
52670
- workItemStore: getStoreLattice46("default", "taskWorkItem").store,
52671
- tenantStore: getStoreLattice46("default", "tenant").store,
52823
+ taskStore: getStoreLattice47("default", "task").store,
52824
+ workItemStore: getStoreLattice47("default", "taskWorkItem").store,
52825
+ tenantStore: getStoreLattice47("default", "tenant").store,
52672
52826
  ...createRecoveryCallerDeps2(),
52673
52827
  log: logger8
52674
52828
  });
@@ -52704,7 +52858,7 @@ var start = async (config) => {
52704
52858
  }
52705
52859
  if (process.env.EXECUTION_WORKER_ENABLED === "true") {
52706
52860
  try {
52707
- const queueStore = getStoreLattice46("default", "threadMessageQueue").store;
52861
+ const queueStore = getStoreLattice47("default", "threadMessageQueue").store;
52708
52862
  executionSupervisor = new ThreadExecutionSupervisor({
52709
52863
  queueStore,
52710
52864
  runLedger,
@@ -52745,12 +52899,12 @@ var start = async (config) => {
52745
52899
  if (runTaskWake) setRunTaskWakePublisher(runTaskWake);
52746
52900
  try {
52747
52901
  const projectTaskRunHooks = createProjectTaskRunHooks({
52748
- tasks: getStoreLattice46("default", "task").store,
52749
- workItems: getStoreLattice46("default", "taskWorkItem").store,
52750
- projects: getStoreLattice46("default", "project").store,
52751
- rooms: getStoreLattice46("default", "projectRoom").store,
52752
- bots: getStoreLattice46("default", "projectBotMembership").store,
52753
- threads: getStoreLattice46("default", "thread").store,
52902
+ tasks: getStoreLattice47("default", "task").store,
52903
+ workItems: getStoreLattice47("default", "taskWorkItem").store,
52904
+ projects: getStoreLattice47("default", "project").store,
52905
+ rooms: getStoreLattice47("default", "projectRoom").store,
52906
+ bots: getStoreLattice47("default", "projectBotMembership").store,
52907
+ threads: getStoreLattice47("default", "thread").store,
52754
52908
  getThreadState: async ({ task, thread }) => agentInstanceManager13.getAgent({
52755
52909
  tenant_id: task.tenantId,
52756
52910
  assistant_id: task.ownerId,