@axiom-lattice/gateway 4.11.0 → 6.0.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 (46) hide show
  1. package/README.md +0 -2
  2. package/dist/{OrphanRecoveryRuntime-BEFILJMU.mjs → OrphanRecoveryRuntime-T4T5NOZU.mjs} +2 -2
  3. package/dist/{a2a-standard-PBYPNHOA.mjs → a2a-standard-3OZFXDCW.mjs} +1 -1
  4. package/dist/a2a-standard-3OZFXDCW.mjs.map +1 -0
  5. package/dist/{sandboxOpenCredentialProvider-USIU7Z7H.mjs → chunk-GL7RV5L3.mjs} +29 -59
  6. package/dist/chunk-GL7RV5L3.mjs.map +1 -0
  7. package/dist/{chunk-ZBTG3T7K.mjs → chunk-NZXKECNN.mjs} +4 -19
  8. package/dist/{chunk-ZBTG3T7K.mjs.map → chunk-NZXKECNN.mjs.map} +1 -1
  9. package/dist/embed/{embed-page-AgentDetailSideApp-FHC56ARN.js → embed-page-AgentDetailSideApp-JYVZKSUU.js} +1 -1
  10. package/dist/embed/embed-page-AgentGovernanceWorkbench-SD2EHW2B.js +1 -0
  11. package/dist/embed/{embed-page-MessageGraph-DMP5EZBM.js → embed-page-MessageGraph-GLQXKAVC.js} +1 -1
  12. package/dist/embed/{embed-page-ReactChart-PYGNSRHG.js → embed-page-ReactChart-74MHCE2K.js} +1 -1
  13. package/dist/embed/{embed-page-SkillFlow-6LPE2VG3.js → embed-page-SkillFlow-NDAK3GAD.js} +1 -1
  14. package/dist/embed/{embed-page-TasksSideApp-MPYOPRXW.js → embed-page-TasksSideApp-DA4LUTMD.js} +5 -5
  15. package/dist/embed/{embed-page-TeamWorkspace-EXUAXKAH.js → embed-page-TeamWorkspace-DUB3L6V6.js} +1 -1
  16. package/dist/embed/{embed-page-TopologyRuntimeView-MH4YMU7D.js → embed-page-TopologyRuntimeView-NFBHAICN.js} +1 -1
  17. package/dist/embed/{embed-page-WorkflowAutomationView-KQYFSLLH.js → embed-page-WorkflowAutomationView-43YGTXGF.js} +1 -1
  18. package/dist/embed/{embed-page-chunk-O44JEYLD.js → embed-page-chunk-2PFKLMTR.js} +5 -5
  19. package/dist/embed/{embed-page-chunk-NW37OVAX.js → embed-page-chunk-BVSC3MSO.js} +1 -1
  20. package/dist/embed/{embed-page-chunk-YQZI5LNV.js → embed-page-chunk-C4ZV4IXK.js} +2 -2
  21. package/dist/embed/{embed-page-chunk-QGXGVLAX.js → embed-page-chunk-DWIBLGBW.js} +1 -1
  22. package/dist/embed/{embed-page-chunk-I7BVN6EY.js → embed-page-chunk-GKHIPXZ2.js} +1 -1
  23. package/dist/embed/{embed-page-chunk-QHXKZNDU.js → embed-page-chunk-P477ZTUO.js} +307 -191
  24. package/dist/embed/{embed-page-chunk-JSAUTBU5.js → embed-page-chunk-UHH575CK.js} +1 -1
  25. package/dist/embed/{embed-page-en-PQZ2ZCEH.js → embed-page-en-GLT2HEZZ.js} +1 -1
  26. package/dist/embed/{embed-page-zh-D3EX4GW4.js → embed-page-zh-XMEJPDMF.js} +1 -1
  27. package/dist/embed/embed-page.js +1 -1
  28. package/dist/index.d.mts +8 -7
  29. package/dist/index.d.ts +8 -7
  30. package/dist/index.js +1028 -1235
  31. package/dist/index.js.map +1 -1
  32. package/dist/index.mjs +349 -567
  33. package/dist/index.mjs.map +1 -1
  34. package/dist/{open-GNBMCHYA.mjs → open-MDC4VCR7.mjs} +18 -1
  35. package/dist/open-MDC4VCR7.mjs.map +1 -0
  36. package/dist/{resources-2L3KSUUU.mjs → resources-DAU5ZIPB.mjs} +2 -17
  37. package/dist/resources-DAU5ZIPB.mjs.map +1 -0
  38. package/dist/sandboxOpenCredentialProvider-AT227D4N.mjs +66 -0
  39. package/dist/sandboxOpenCredentialProvider-AT227D4N.mjs.map +1 -0
  40. package/package.json +4 -4
  41. package/dist/a2a-standard-PBYPNHOA.mjs.map +0 -1
  42. package/dist/embed/embed-page-AgentGovernanceWorkbench-KAPZJBE6.js +0 -5
  43. package/dist/open-GNBMCHYA.mjs.map +0 -1
  44. package/dist/resources-2L3KSUUU.mjs.map +0 -1
  45. package/dist/sandboxOpenCredentialProvider-USIU7Z7H.mjs.map +0 -1
  46. /package/dist/{OrphanRecoveryRuntime-BEFILJMU.mjs.map → OrphanRecoveryRuntime-T4T5NOZU.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -1,3 +1,7 @@
1
+ import {
2
+ invalidateAgentReflectionCache,
3
+ invalidatePluginReflectionCache
4
+ } from "./chunk-GL7RV5L3.mjs";
1
5
  import {
2
6
  getContentTypeFromFilename,
3
7
  getFilenameFromPath,
@@ -44,7 +48,7 @@ import {
44
48
  resolveTaskOwnerMembership,
45
49
  resolveTopCaller,
46
50
  runOrphanRecovery
47
- } from "./chunk-ZBTG3T7K.mjs";
51
+ } from "./chunk-NZXKECNN.mjs";
48
52
  import {
49
53
  createRecoveryCallerDeps
50
54
  } from "./chunk-NOXGKYUV.mjs";
@@ -66,7 +70,7 @@ import staticPlugin from "@fastify/static";
66
70
  import path4 from "path";
67
71
 
68
72
  // src/routes/index.ts
69
- import { randomUUID as randomUUID24 } from "crypto";
73
+ import { randomUUID as randomUUID23 } from "crypto";
70
74
  import {
71
75
  descriptorDataValue as descriptorDataValue3,
72
76
  snapshotExactRecord as snapshotExactRecord14,
@@ -772,11 +776,7 @@ async function getAssistantStats(request, reply) {
772
776
  const assistantMap = /* @__PURE__ */ new Map();
773
777
  codeConfiguredAssistants.forEach((a) => assistantMap.set(a.id, a));
774
778
  storedAssistants.forEach((a) => assistantMap.set(a.id, a));
775
- const userId = getUserId(request);
776
- const assistants = Array.from(assistantMap.values()).filter((a) => {
777
- if (!a.ownerUserId) return true;
778
- return a.ownerUserId === userId;
779
- });
779
+ const assistants = Array.from(assistantMap.values());
780
780
  const threadStore = getStoreLattice("default", "thread").store;
781
781
  const evalStore = getStoreLattice("default", "eval").store;
782
782
  const now = Date.now();
@@ -1812,198 +1812,6 @@ async function resumeScheduledTask(request, reply) {
1812
1812
  }
1813
1813
  }
1814
1814
 
1815
- // src/config.ts
1816
- var ConfigService = class {
1817
- constructor() {
1818
- this.config = this.loadFromEnv();
1819
- }
1820
- /**
1821
- * Load configuration from environment variables
1822
- */
1823
- loadFromEnv() {
1824
- return {
1825
- port: process.env.PORT ? Number(process.env.PORT) : void 0,
1826
- queueServiceType: process.env.QUEUE_SERVICE_TYPE,
1827
- redisUrl: process.env.REDIS_URL,
1828
- redisPassword: process.env.REDIS_PASSWORD,
1829
- queueName: process.env.QUEUE_NAME
1830
- };
1831
- }
1832
- /**
1833
- * Update configuration from JSON object
1834
- * This will update both the internal config and process.env
1835
- */
1836
- updateConfig(jsonConfig) {
1837
- for (const [key, value] of Object.entries(jsonConfig)) {
1838
- if (value !== null && value !== void 0) {
1839
- if (typeof value === "object" && !Array.isArray(value)) {
1840
- for (const [nestedKey, nestedValue] of Object.entries(value)) {
1841
- const envKey = `${key.toUpperCase()}_${nestedKey.toUpperCase()}`;
1842
- process.env[envKey] = String(nestedValue);
1843
- }
1844
- } else {
1845
- process.env[key.toUpperCase()] = String(value);
1846
- }
1847
- }
1848
- }
1849
- this.config = this.loadFromEnv();
1850
- this.config = this.deepMerge(this.config, jsonConfig);
1851
- }
1852
- /**
1853
- * Deep merge two objects
1854
- */
1855
- deepMerge(target, source) {
1856
- const output = { ...target };
1857
- if (this.isObject(target) && this.isObject(source)) {
1858
- Object.keys(source).forEach((key) => {
1859
- if (this.isObject(source[key])) {
1860
- if (!(key in target)) {
1861
- Object.assign(output, { [key]: source[key] });
1862
- } else {
1863
- output[key] = this.deepMerge(target[key], source[key]);
1864
- }
1865
- } else {
1866
- Object.assign(output, { [key]: source[key] });
1867
- }
1868
- });
1869
- }
1870
- return output;
1871
- }
1872
- /**
1873
- * Check if value is a plain object
1874
- */
1875
- isObject(item) {
1876
- return item && typeof item === "object" && !Array.isArray(item);
1877
- }
1878
- /**
1879
- * Get current configuration
1880
- */
1881
- getConfig() {
1882
- return { ...this.config };
1883
- }
1884
- };
1885
- var configService = new ConfigService();
1886
-
1887
- // src/services/queue_service.ts
1888
- import {
1889
- queueLatticeManager,
1890
- registerQueueLattice,
1891
- getQueueLattice
1892
- } from "@axiom-lattice/core";
1893
- import { QueueType } from "@axiom-lattice/protocols";
1894
- import { RedisQueueClient } from "@axiom-lattice/queue-redis";
1895
- var DEFAULT_QUEUE_KEY = "default";
1896
- var queueServiceType = process.env.QUEUE_SERVICE_TYPE || "memory";
1897
- var setQueueServiceType = (type) => {
1898
- queueServiceType = type;
1899
- console.log(`Queue service type set to: ${type}`);
1900
- const queueName = process.env.QUEUE_NAME || "tasks";
1901
- const config = {
1902
- name: "Default Queue Service",
1903
- description: `Default ${type} queue service`,
1904
- type: type === "redis" ? QueueType.REDIS : QueueType.MEMORY,
1905
- queueName,
1906
- options: type === "redis" ? {
1907
- redisUrl: process.env.REDIS_URL,
1908
- redisPassword: process.env.REDIS_PASSWORD
1909
- } : void 0
1910
- };
1911
- if (queueLatticeManager.hasLattice(DEFAULT_QUEUE_KEY)) {
1912
- queueLatticeManager.removeLattice(DEFAULT_QUEUE_KEY);
1913
- }
1914
- let client;
1915
- if (type === "redis") {
1916
- client = new RedisQueueClient(queueName, {
1917
- redisUrl: process.env.REDIS_URL,
1918
- redisPassword: process.env.REDIS_PASSWORD
1919
- });
1920
- }
1921
- registerQueueLattice(DEFAULT_QUEUE_KEY, config, client);
1922
- };
1923
- var getQueueService = () => {
1924
- if (!queueLatticeManager.hasLattice(DEFAULT_QUEUE_KEY)) {
1925
- setQueueServiceType(queueServiceType);
1926
- }
1927
- return getQueueLattice(DEFAULT_QUEUE_KEY);
1928
- };
1929
- var popAgentTaskFromQueue = async () => {
1930
- const queue = getQueueService();
1931
- const result = await queue.pop();
1932
- return result;
1933
- };
1934
-
1935
- // src/controllers/config.ts
1936
- async function updateConfig(request, reply) {
1937
- try {
1938
- const { config: jsonConfig } = request.body;
1939
- if (!jsonConfig || typeof jsonConfig !== "object") {
1940
- return reply.status(400).send({
1941
- success: false,
1942
- error: "Invalid configuration: config must be an object"
1943
- });
1944
- }
1945
- configService.updateConfig(jsonConfig);
1946
- const warnings = [];
1947
- const requiresRestart = [];
1948
- if (jsonConfig.port !== void 0) {
1949
- requiresRestart.push("PORT");
1950
- warnings.push("Port change requires server restart to take effect");
1951
- }
1952
- if (jsonConfig.queueServiceType) {
1953
- setQueueServiceType(jsonConfig.queueServiceType);
1954
- }
1955
- if ((jsonConfig.redisUrl || jsonConfig.redisPassword) && (process.env.QUEUE_SERVICE_TYPE === "redis" || jsonConfig.queueServiceType === "redis")) {
1956
- const currentType = jsonConfig.queueServiceType || process.env.QUEUE_SERVICE_TYPE || "memory";
1957
- if (currentType === "redis") {
1958
- setQueueServiceType("redis");
1959
- }
1960
- }
1961
- const updatedConfig = configService.getConfig();
1962
- const safeConfig = {
1963
- ...updatedConfig,
1964
- redisPassword: updatedConfig.redisPassword ? "***" : updatedConfig.redisPassword
1965
- };
1966
- return reply.send({
1967
- success: true,
1968
- message: "Configuration updated successfully",
1969
- data: safeConfig,
1970
- warnings: warnings.length > 0 ? warnings : void 0,
1971
- requiresRestart: requiresRestart.length > 0 ? requiresRestart : void 0
1972
- });
1973
- } catch (error) {
1974
- console.error("Failed to update configuration", {
1975
- error: error.message,
1976
- stack: error.stack
1977
- });
1978
- return reply.status(500).send({
1979
- success: false,
1980
- error: error.message || "Failed to update configuration"
1981
- });
1982
- }
1983
- }
1984
- async function getConfig(request, reply) {
1985
- try {
1986
- const currentConfig = configService.getConfig();
1987
- const safeConfig = {
1988
- ...currentConfig,
1989
- redisPassword: currentConfig.redisPassword ? "***" : currentConfig.redisPassword
1990
- };
1991
- return reply.send({
1992
- success: true,
1993
- data: safeConfig
1994
- });
1995
- } catch (error) {
1996
- console.error("Failed to get configuration", {
1997
- error: error.message,
1998
- stack: error.stack
1999
- });
2000
- return reply.status(500).send({
2001
- success: false,
2002
- error: error.message || "Failed to get configuration"
2003
- });
2004
- }
2005
- }
2006
-
2007
1815
  // src/controllers/models.ts
2008
1816
  import { registerModelLattice, modelLatticeManager } from "@axiom-lattice/core";
2009
1817
  async function getModels(request, reply) {
@@ -2117,6 +1925,119 @@ async function updateModels(request, reply) {
2117
1925
  }
2118
1926
  }
2119
1927
 
1928
+ // src/services/multiReplicaReadiness.ts
1929
+ import { getStoreLattice as getStoreLattice3 } from "@axiom-lattice/core";
1930
+
1931
+ // src/services/queue_service.ts
1932
+ import {
1933
+ queueLatticeManager,
1934
+ registerQueueLattice,
1935
+ getQueueLattice
1936
+ } from "@axiom-lattice/core";
1937
+ import { QueueType } from "@axiom-lattice/protocols";
1938
+ import { RedisQueueClient } from "@axiom-lattice/queue-redis";
1939
+ var DEFAULT_QUEUE_KEY = "default";
1940
+ var queueServiceType = process.env.QUEUE_SERVICE_TYPE || "memory";
1941
+ var setQueueServiceType = (type) => {
1942
+ queueServiceType = type;
1943
+ console.log(`Queue service type set to: ${type}`);
1944
+ const queueName = process.env.QUEUE_NAME || "tasks";
1945
+ const config = {
1946
+ name: "Default Queue Service",
1947
+ description: `Default ${type} queue service`,
1948
+ type: type === "redis" ? QueueType.REDIS : QueueType.MEMORY,
1949
+ queueName,
1950
+ options: type === "redis" ? {
1951
+ redisUrl: process.env.REDIS_URL,
1952
+ redisPassword: process.env.REDIS_PASSWORD
1953
+ } : void 0
1954
+ };
1955
+ if (queueLatticeManager.hasLattice(DEFAULT_QUEUE_KEY)) {
1956
+ queueLatticeManager.removeLattice(DEFAULT_QUEUE_KEY);
1957
+ }
1958
+ let client;
1959
+ if (type === "redis") {
1960
+ client = new RedisQueueClient(queueName, {
1961
+ redisUrl: process.env.REDIS_URL,
1962
+ redisPassword: process.env.REDIS_PASSWORD
1963
+ });
1964
+ }
1965
+ registerQueueLattice(DEFAULT_QUEUE_KEY, config, client);
1966
+ };
1967
+ var getQueueServiceType = () => {
1968
+ return queueServiceType;
1969
+ };
1970
+ var getQueueService = () => {
1971
+ if (!queueLatticeManager.hasLattice(DEFAULT_QUEUE_KEY)) {
1972
+ setQueueServiceType(queueServiceType);
1973
+ }
1974
+ return getQueueLattice(DEFAULT_QUEUE_KEY);
1975
+ };
1976
+ var popAgentTaskFromQueue = async () => {
1977
+ const queue = getQueueService();
1978
+ const result = await queue.pop();
1979
+ return result;
1980
+ };
1981
+
1982
+ // src/services/multiReplicaReadiness.ts
1983
+ var SHARED_STORE_KINDS = [
1984
+ "lease",
1985
+ "outbox",
1986
+ "threadMessageQueue",
1987
+ "task",
1988
+ "taskWorkItem",
1989
+ "channelInstallation"
1990
+ ];
1991
+ function isMultiReplicaDeclared() {
1992
+ return typeof process.env.AXIOM_REPLICA_ID === "string" && process.env.AXIOM_REPLICA_ID.trim() !== "";
1993
+ }
1994
+ function storeClassName(kind) {
1995
+ try {
1996
+ return getStoreLattice3("default", kind).store.constructor?.name;
1997
+ } catch {
1998
+ return void 0;
1999
+ }
2000
+ }
2001
+ function computeMultiReplicaReadiness() {
2002
+ const multiReplicaDeclared = isMultiReplicaDeclared();
2003
+ const warnings = [];
2004
+ if (!multiReplicaDeclared) {
2005
+ return { multiReplicaDeclared, ok: true, warnings };
2006
+ }
2007
+ for (const kind of SHARED_STORE_KINDS) {
2008
+ const name = storeClassName(kind);
2009
+ if (name === void 0 || !name.startsWith("InMemory")) continue;
2010
+ warnings.push(`Multi-replica: store '${kind}' is ${name} (not shared); configure a shared store`);
2011
+ }
2012
+ if (!process.env.AUTH_TOKEN_SECRET?.trim() && !process.env.JWT_SECRET?.trim()) {
2013
+ warnings.push(
2014
+ "Multi-replica: AUTH_TOKEN_SECRET/JWT_SECRET unset; console sessions are signed per-process and will not verify across replicas"
2015
+ );
2016
+ }
2017
+ if (!process.env.LATTICE_ENCRYPTION_KEY?.trim()) {
2018
+ warnings.push(
2019
+ "Multi-replica: LATTICE_ENCRYPTION_KEY unset; stored credentials use the shared dev default and may not decrypt across differing keys"
2020
+ );
2021
+ }
2022
+ if (getQueueServiceType() !== "redis") {
2023
+ warnings.push(
2024
+ "Multi-replica: task queue service is 'memory' (not shared); set QUEUE_SERVICE_TYPE=redis so queued work is visible across replicas"
2025
+ );
2026
+ }
2027
+ return { multiReplicaDeclared, ok: warnings.length === 0, warnings };
2028
+ }
2029
+ function warnMultiReplicaReadiness(logger8) {
2030
+ const { multiReplicaDeclared, warnings } = computeMultiReplicaReadiness();
2031
+ if (!multiReplicaDeclared) return;
2032
+ for (const message of warnings) {
2033
+ logger8.warn(message, { phase: "multi_replica_readiness" });
2034
+ }
2035
+ logger8.warn(
2036
+ "Multi-replica: agent run SSE and resume_stream are process-local; route a thread's follow-up runs to the replica streaming it (sticky routing) or share the stream/queue state",
2037
+ { phase: "multi_replica_readiness", feature: "agent-run-sse" }
2038
+ );
2039
+ }
2040
+
2120
2041
  // src/controllers/health.ts
2121
2042
  async function getHealth(request, reply) {
2122
2043
  try {
@@ -2125,7 +2046,8 @@ async function getHealth(request, reply) {
2125
2046
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
2126
2047
  uptime: process.uptime(),
2127
2048
  service: "lattice-gateway",
2128
- version: process.env.npm_package_version || "1.0.0"
2049
+ version: process.env.npm_package_version || "1.0.0",
2050
+ readiness: computeMultiReplicaReadiness()
2129
2051
  };
2130
2052
  return reply.send({
2131
2053
  success: true,
@@ -2846,7 +2768,7 @@ async function getToolConfigs(request, reply) {
2846
2768
 
2847
2769
  // src/controllers/data-query.ts
2848
2770
  import {
2849
- getStoreLattice as getStoreLattice3,
2771
+ getStoreLattice as getStoreLattice4,
2850
2772
  metricsServerManager
2851
2773
  } from "@axiom-lattice/core";
2852
2774
  function getTenantId5(request) {
@@ -2879,7 +2801,7 @@ async function executeDataQuery(request, reply) {
2879
2801
  message: "Cannot provide both metrics and customSql. Use one query type only."
2880
2802
  };
2881
2803
  }
2882
- const storeLattice = getStoreLattice3("default", "metrics");
2804
+ const storeLattice = getStoreLattice4("default", "metrics");
2883
2805
  const store = storeLattice.store;
2884
2806
  if (!body.serverKey) {
2885
2807
  reply.code(400);
@@ -2987,7 +2909,7 @@ async function executeSqlQuery(client, body, reply) {
2987
2909
  }
2988
2910
 
2989
2911
  // src/controllers/workflow-tracking.ts
2990
- import { getStoreLattice as getStoreLattice4, agentInstanceManager as agentInstanceManager4, ThreadStatus as ThreadStatus2, abortWorkflowRun as signalAbort } from "@axiom-lattice/core";
2912
+ import { getStoreLattice as getStoreLattice5, agentInstanceManager as agentInstanceManager4, ThreadStatus as ThreadStatus2, abortWorkflowRun as signalAbort } from "@axiom-lattice/core";
2991
2913
  import { MessageChunkTypes as MessageChunkTypes2 } from "@axiom-lattice/protocols";
2992
2914
  function getTenantId6(request) {
2993
2915
  const userTenantId = request.user?.tenantId;
@@ -2996,7 +2918,7 @@ function getTenantId6(request) {
2996
2918
  }
2997
2919
  function getTrackingStore() {
2998
2920
  try {
2999
- const storeLattice = getStoreLattice4("default", "workflowTracking");
2921
+ const storeLattice = getStoreLattice5("default", "workflowTracking");
3000
2922
  return storeLattice.store;
3001
2923
  } catch {
3002
2924
  return null;
@@ -3004,7 +2926,7 @@ function getTrackingStore() {
3004
2926
  }
3005
2927
  async function getDefinitionsFromAssistants(tenantId) {
3006
2928
  try {
3007
- const storeLattice = getStoreLattice4("default", "assistant");
2929
+ const storeLattice = getStoreLattice5("default", "assistant");
3008
2930
  const assistantStore = storeLattice.store;
3009
2931
  const assistants = await assistantStore.getAllAssistants(tenantId);
3010
2932
  const results = [];
@@ -3084,7 +3006,7 @@ async function getAllWorkflowRuns(request, reply) {
3084
3006
  }
3085
3007
  const nameMap = {};
3086
3008
  try {
3087
- const asStoreLattice = getStoreLattice4("default", "assistant");
3009
+ const asStoreLattice = getStoreLattice5("default", "assistant");
3088
3010
  const assistantStore = asStoreLattice.store;
3089
3011
  const assistants = await assistantStore.getAllAssistants(tenantId);
3090
3012
  for (const a of assistants) {
@@ -3137,7 +3059,7 @@ async function getInboxItems(request, reply) {
3137
3059
  }
3138
3060
  const nameMap = {};
3139
3061
  try {
3140
- const asStoreLattice = getStoreLattice4("default", "assistant");
3062
+ const asStoreLattice = getStoreLattice5("default", "assistant");
3141
3063
  const assistantStore = asStoreLattice.store;
3142
3064
  const assistants = await assistantStore.getAllAssistants(tenantId);
3143
3065
  for (const a of assistants) {
@@ -3511,7 +3433,7 @@ async function abortWorkflowRun(request, reply) {
3511
3433
  }
3512
3434
 
3513
3435
  // src/controllers/personal-assistant.ts
3514
- import { eventBus as eventBus2, getStoreLattice as getStoreLattice5, PersonalAssistantConfig } from "@axiom-lattice/core";
3436
+ import { eventBus as eventBus2, getStoreLattice as getStoreLattice6, PersonalAssistantConfig } from "@axiom-lattice/core";
3515
3437
  import { randomUUID as randomUUID3 } from "crypto";
3516
3438
  function getWorkspaceId2(request) {
3517
3439
  return request.headers["x-workspace-id"] || "default";
@@ -3527,13 +3449,13 @@ function getUserId3(request) {
3527
3449
  return userId;
3528
3450
  }
3529
3451
  function getLinkStore() {
3530
- return getStoreLattice5("default", "userTenantLink").store;
3452
+ return getStoreLattice6("default", "userTenantLink").store;
3531
3453
  }
3532
3454
  function getAssistantStore() {
3533
- return getStoreLattice5("default", "assistant").store;
3455
+ return getStoreLattice6("default", "assistant").store;
3534
3456
  }
3535
3457
  function getProjectStore() {
3536
- return getStoreLattice5("default", "project").store;
3458
+ return getStoreLattice6("default", "project").store;
3537
3459
  }
3538
3460
  async function getLinkMeta(userId, tenantId) {
3539
3461
  const link = await getLinkStore().getLink(userId, tenantId);
@@ -3609,7 +3531,7 @@ async function deletePersonalAssistant(request, reply) {
3609
3531
  return reply.status(500).send({ success: false, message: "Failed to delete personal assistant" });
3610
3532
  }
3611
3533
  eventBus2.publish("assistant:deleted", { id: assistant.id, tenantId });
3612
- const threadStore = getStoreLattice5("default", "thread").store;
3534
+ const threadStore = getStoreLattice6("default", "thread").store;
3613
3535
  try {
3614
3536
  const threads = await threadStore.getThreadsByAssistantId(tenantId, assistant.id);
3615
3537
  for (const t2 of threads) {
@@ -3635,25 +3557,14 @@ async function deletePersonalAssistant(request, reply) {
3635
3557
 
3636
3558
  // src/services/ExportImportService.ts
3637
3559
  import { ExportableEntityRegistry, DependencyResolver, IdRemapper, isBuiltInSkill } from "@axiom-lattice/core";
3638
- import { randomUUID as randomUUID4 } from "crypto";
3639
3560
  import * as fs from "fs/promises";
3640
3561
  import * as os from "os";
3641
3562
  import * as path from "path";
3642
3563
  import * as tar from "tar";
3643
3564
  import * as zlib from "zlib";
3644
- var exportJobs = /* @__PURE__ */ new Map();
3645
- var JOB_TTL_MS = 60 * 60 * 1e3;
3646
3565
  var MAX_ARCHIVE_ENTRIES = 1e4;
3647
3566
  var MAX_ARCHIVE_FILE_BYTES = 100 * 1024 * 1024;
3648
3567
  var MAX_ARCHIVE_TOTAL_BYTES = 512 * 1024 * 1024;
3649
- function cleanExpiredJobs() {
3650
- const now = Date.now();
3651
- for (const [id3, entry] of exportJobs) {
3652
- if (now - entry.createdAt > JOB_TTL_MS) {
3653
- exportJobs.delete(id3);
3654
- }
3655
- }
3656
- }
3657
3568
  function archiveFileKey(entityType, entityId, relPath) {
3658
3569
  return `files/${entityType}/${entityId}/${relPath}`;
3659
3570
  }
@@ -3676,7 +3587,8 @@ var ExportImportService = class {
3676
3587
  }
3677
3588
  /**
3678
3589
  * Generate a full export (bundle + file content) for the given tenant and entity types.
3679
- * Stores the data in-memory and returns a jobId for download.
3590
+ * The result is returned directly so the caller can pack and stream it in the same
3591
+ * request, with no process-local job state that would break across Gateway replicas.
3680
3592
  */
3681
3593
  async export(tenantId, entityTypes, entityIds, context) {
3682
3594
  const { dependencyOrder, entities: rawEntities } = await this.resolveExportSelection(
@@ -3735,18 +3647,7 @@ var ExportImportService = class {
3735
3647
  dependencyOrder,
3736
3648
  _warning: "This file contains plaintext secrets (passwords, API keys, tokens). Store it securely and delete after import."
3737
3649
  };
3738
- const jobId = randomUUID4();
3739
- exportJobs.set(jobId, { data: { bundle, files }, tenantId, createdAt: Date.now() });
3740
- return { jobId, data: { bundle, files } };
3741
- }
3742
- /**
3743
- * Retrieve a previously generated export job data by jobId with tenant validation.
3744
- */
3745
- getExportJob(jobId, tenantId) {
3746
- cleanExpiredJobs();
3747
- const entry = exportJobs.get(jobId);
3748
- if (!entry || entry.tenantId !== tenantId) return void 0;
3749
- return entry.data;
3650
+ return { bundle, files };
3750
3651
  }
3751
3652
  /**
3752
3653
  * Pack an ExportJobData into a tar.gz buffer.
@@ -4331,6 +4232,12 @@ function safeArchiveFilename(sourceTenantId) {
4331
4232
  const safeTenantId = sourceTenantId.replace(/[^A-Za-z0-9._-]/g, "_");
4332
4233
  return `tenant-export-${safeTenantId}.tar.gz`;
4333
4234
  }
4235
+ async function sendArchive(reply, data) {
4236
+ const tarGz = await service.packTarGz(data);
4237
+ reply.type("application/gzip");
4238
+ reply.header("Content-Disposition", `attachment; filename="${safeArchiveFilename(data.bundle.sourceTenantId)}"`);
4239
+ reply.send(tarGz);
4240
+ }
4334
4241
  function assertCompleteFile(file) {
4335
4242
  if (file.truncated) {
4336
4243
  throw new Error("Uploaded file was truncated because it exceeds the configured file size limit");
@@ -4418,30 +4325,14 @@ async function exportConfig(request, reply) {
4418
4325
  }
4419
4326
  });
4420
4327
  }
4421
- const { jobId, data } = await service.export(tenantId, entityTypes, entityIds, getContext(request));
4422
- return reply.send({
4423
- success: true,
4424
- data: {
4425
- jobId,
4426
- summary: Object.fromEntries(
4427
- Object.entries(data.bundle.entities).map(([type, entities]) => [type, entities.length])
4428
- )
4429
- }
4430
- });
4328
+ const data = await service.export(tenantId, entityTypes, entityIds, getContext(request));
4329
+ return sendArchive(reply, data);
4431
4330
  }
4432
4331
  async function exportConfigConfirm(request, reply) {
4433
4332
  const tenantId = resolveTenantId(request, request.params.tenantId);
4434
4333
  const { entityTypes, entityIds } = request.body;
4435
- const { jobId, data } = await service.export(tenantId, entityTypes, entityIds, getContext(request));
4436
- return reply.send({
4437
- success: true,
4438
- data: {
4439
- jobId,
4440
- summary: Object.fromEntries(
4441
- Object.entries(data.bundle.entities).map(([type, entities]) => [type, entities.length])
4442
- )
4443
- }
4444
- });
4334
+ const data = await service.export(tenantId, entityTypes, entityIds, getContext(request));
4335
+ return sendArchive(reply, data);
4445
4336
  }
4446
4337
  async function previewEntities(request, reply) {
4447
4338
  const tenantId = resolveTenantId(request, request.params.tenantId);
@@ -4464,18 +4355,6 @@ async function previewEntities(request, reply) {
4464
4355
  return reply.status(400).send({ success: false, message: err.message });
4465
4356
  }
4466
4357
  }
4467
- async function downloadExport(request, reply) {
4468
- const tenantId = resolveTenantId(request, request.params.tenantId);
4469
- const data = service.getExportJob(request.params.jobId, tenantId);
4470
- if (!data) {
4471
- return reply.status(404).send({ success: false, message: "Export job not found or expired" });
4472
- }
4473
- const tarGz = await service.packTarGz(data);
4474
- const filename = safeArchiveFilename(data.bundle.sourceTenantId);
4475
- reply.type("application/gzip");
4476
- reply.header("Content-Disposition", `attachment; filename="${filename}"`);
4477
- return reply.send(tarGz);
4478
- }
4479
4358
  async function importPreview(request, reply) {
4480
4359
  const tenantId = resolveTenantId(request, request.params.tenantId);
4481
4360
  try {
@@ -4805,77 +4684,6 @@ var triggerAgentTaskSchema = {
4805
4684
  }
4806
4685
  }
4807
4686
  };
4808
- var updateConfigSchema = {
4809
- description: "Update gateway configuration",
4810
- tags: ["Configuration"],
4811
- summary: "Update Configuration",
4812
- body: {
4813
- type: "object",
4814
- properties: {
4815
- config: {
4816
- type: "object",
4817
- description: "Configuration object to update",
4818
- properties: {
4819
- port: { type: "number", description: "Server port" },
4820
- queueServiceType: {
4821
- type: "string",
4822
- enum: ["memory", "redis"],
4823
- description: "Queue service type"
4824
- },
4825
- redisUrl: { type: "string", description: "Redis URL" },
4826
- redisPassword: { type: "string", description: "Redis password" },
4827
- queueName: { type: "string", description: "Queue name" }
4828
- }
4829
- }
4830
- },
4831
- required: ["config"]
4832
- },
4833
- response: {
4834
- 200: {
4835
- type: "object",
4836
- properties: {
4837
- success: { type: "boolean" },
4838
- message: { type: "string" },
4839
- data: { type: "object" }
4840
- }
4841
- },
4842
- 400: {
4843
- type: "object",
4844
- properties: {
4845
- success: { type: "boolean" },
4846
- error: { type: "string" }
4847
- }
4848
- },
4849
- 500: {
4850
- type: "object",
4851
- properties: {
4852
- success: { type: "boolean" },
4853
- error: { type: "string" }
4854
- }
4855
- }
4856
- }
4857
- };
4858
- var getConfigSchema = {
4859
- description: "Get current gateway configuration",
4860
- tags: ["Configuration"],
4861
- summary: "Get Configuration",
4862
- response: {
4863
- 200: {
4864
- type: "object",
4865
- properties: {
4866
- success: { type: "boolean" },
4867
- data: { type: "object" }
4868
- }
4869
- },
4870
- 500: {
4871
- type: "object",
4872
- properties: {
4873
- success: { type: "boolean" },
4874
- error: { type: "string" }
4875
- }
4876
- }
4877
- }
4878
- };
4879
4687
  var getHealthSchema = {
4880
4688
  description: "Health check endpoint for monitoring and load balancer checks",
4881
4689
  tags: ["Health"],
@@ -4892,7 +4700,15 @@ var getHealthSchema = {
4892
4700
  timestamp: { type: "string" },
4893
4701
  uptime: { type: "number" },
4894
4702
  service: { type: "string" },
4895
- version: { type: "string" }
4703
+ version: { type: "string" },
4704
+ readiness: {
4705
+ type: "object",
4706
+ properties: {
4707
+ multiReplicaDeclared: { type: "boolean" },
4708
+ ok: { type: "boolean" },
4709
+ warnings: { type: "array", items: { type: "string" } }
4710
+ }
4711
+ }
4896
4712
  }
4897
4713
  }
4898
4714
  }
@@ -5238,7 +5054,7 @@ import * as fs2 from "fs/promises";
5238
5054
  import * as path2 from "path";
5239
5055
  import { constants as fsConstants } from "fs";
5240
5056
  import * as os2 from "os";
5241
- import { getStoreLattice as getStoreLattice6 } from "@axiom-lattice/core";
5057
+ import { getStoreLattice as getStoreLattice7 } from "@axiom-lattice/core";
5242
5058
  import { SandboxFilesystem, FilesystemBackend } from "@axiom-lattice/core";
5243
5059
  import { getSandBoxManager as getSandBoxManager3 } from "@axiom-lattice/core";
5244
5060
  import { v4 as uuidv4 } from "uuid";
@@ -5291,7 +5107,7 @@ var RoomCoordinatorProvisioner = class {
5291
5107
  };
5292
5108
 
5293
5109
  // src/services/collaboration/RoomCoordinatorEnsurer.ts
5294
- import { randomUUID as randomUUID5 } from "crypto";
5110
+ import { randomUUID as randomUUID4 } from "crypto";
5295
5111
 
5296
5112
  // src/services/collaboration/ProjectMutationMutex.ts
5297
5113
  import {
@@ -5332,7 +5148,7 @@ var RoomCoordinatorEnsurer = class {
5332
5148
  constructor(deps) {
5333
5149
  this.deps = deps;
5334
5150
  this.mutex = deps.mutationMutex ?? projectMutationMutex;
5335
- this.idFactory = deps.idFactory ?? randomUUID5;
5151
+ this.idFactory = deps.idFactory ?? randomUUID4;
5336
5152
  }
5337
5153
  /**
5338
5154
  * Ensures the coordinator membership for one room.
@@ -5417,7 +5233,7 @@ var NoopRoomBindingLifecycle = class {
5417
5233
 
5418
5234
  // src/services/collaboration/WorkspacePublicRoomService.ts
5419
5235
  import { createHash } from "crypto";
5420
- import { randomUUID as randomUUID6 } from "crypto";
5236
+ import { randomUUID as randomUUID5 } from "crypto";
5421
5237
  import { WORKSPACE_PUBLIC_ROOM_PROJECT_PREFIX } from "@axiom-lattice/protocols";
5422
5238
  var PUBLIC_ROOM_PROJECT_NAME = "General";
5423
5239
  var PUBLIC_ROOM_PROJECT_DESCRIPTION = "Public room for everyone in the workspace";
@@ -5429,7 +5245,7 @@ var WorkspacePublicRoomService = class {
5429
5245
  /** Creates the service from explicitly injected stores and provisioners. */
5430
5246
  constructor(deps) {
5431
5247
  this.deps = deps;
5432
- this.idFactory = deps.idFactory ?? randomUUID6;
5248
+ this.idFactory = deps.idFactory ?? randomUUID5;
5433
5249
  }
5434
5250
  /**
5435
5251
  * Returns the workspace's public room project and room, creating them on first call.
@@ -5618,13 +5434,13 @@ function createProjectCollaborationInitializer(deps) {
5618
5434
  var WorkspaceController = class {
5619
5435
  constructor(projectCollaboration) {
5620
5436
  this.projectCollaboration = projectCollaboration;
5621
- this.workspaceStore = getStoreLattice6("default", "workspace").store;
5622
- this.projectStore = getStoreLattice6("default", "project").store;
5623
- const roomStore = getStoreLattice6("default", "projectRoom").store;
5624
- const botMembershipStore = getStoreLattice6("default", "projectBotMembership").store;
5625
- const assistantStore = getStoreLattice6("default", "assistant").store;
5626
- const threadStore = getStoreLattice6("default", "thread").store;
5627
- const tenantStore = getStoreLattice6("default", "tenant").store;
5437
+ this.workspaceStore = getStoreLattice7("default", "workspace").store;
5438
+ this.projectStore = getStoreLattice7("default", "project").store;
5439
+ const roomStore = getStoreLattice7("default", "projectRoom").store;
5440
+ const botMembershipStore = getStoreLattice7("default", "projectBotMembership").store;
5441
+ const assistantStore = getStoreLattice7("default", "assistant").store;
5442
+ const threadStore = getStoreLattice7("default", "thread").store;
5443
+ const tenantStore = getStoreLattice7("default", "tenant").store;
5628
5444
  const coordinatorProvisioner = new RoomCoordinatorProvisioner({
5629
5445
  getAssistantById: assistantStore.getAssistantById.bind(assistantStore),
5630
5446
  createAssistant: assistantStore.createAssistant.bind(assistantStore),
@@ -6594,7 +6410,7 @@ function registerWorkspaceRoutes(app2, projectCollaboration) {
6594
6410
  }
6595
6411
 
6596
6412
  // src/services/collaboration/ProjectAccessService.ts
6597
- import { randomUUID as randomUUID7 } from "crypto";
6413
+ import { randomUUID as randomUUID6 } from "crypto";
6598
6414
  var ProjectCollaborationError = class extends Error {
6599
6415
  /** Creates a project collaboration error. */
6600
6416
  constructor(code, statusCode, message) {
@@ -6620,7 +6436,7 @@ var ProjectAccessService = class {
6620
6436
  /** Creates a project access service from explicitly injected stores. */
6621
6437
  constructor(deps) {
6622
6438
  this.deps = deps;
6623
- this.idFactory = deps.idFactory ?? randomUUID7;
6439
+ this.idFactory = deps.idFactory ?? randomUUID6;
6624
6440
  }
6625
6441
  /** Returns the project and active membership when the user has the requested capability. */
6626
6442
  async requireProjectAccess(input) {
@@ -6786,10 +6602,10 @@ var ProjectAccessService = class {
6786
6602
 
6787
6603
  // src/controllers/database-configs.ts
6788
6604
  import {
6789
- getStoreLattice as getStoreLattice7,
6605
+ getStoreLattice as getStoreLattice8,
6790
6606
  sqlDatabaseManager
6791
6607
  } from "@axiom-lattice/core";
6792
- import { randomUUID as randomUUID8 } from "crypto";
6608
+ import { randomUUID as randomUUID7 } from "crypto";
6793
6609
  function getTenantId8(request) {
6794
6610
  const userTenantId = request.user?.tenantId;
6795
6611
  if (userTenantId) {
@@ -6800,7 +6616,7 @@ function getTenantId8(request) {
6800
6616
  async function getDatabaseConfigList(request, reply) {
6801
6617
  const tenantId = getTenantId8(request);
6802
6618
  try {
6803
- const storeLattice = getStoreLattice7("default", "database");
6619
+ const storeLattice = getStoreLattice8("default", "database");
6804
6620
  const store = storeLattice.store;
6805
6621
  const configs = await store.getAllConfigs(tenantId);
6806
6622
  console.log("Backend: getAllConfigs returned:", configs);
@@ -6831,7 +6647,7 @@ async function getDatabaseConfig(request, reply) {
6831
6647
  const tenantId = getTenantId8(request);
6832
6648
  const { key } = request.params;
6833
6649
  try {
6834
- const storeLattice = getStoreLattice7("default", "database");
6650
+ const storeLattice = getStoreLattice8("default", "database");
6835
6651
  const store = storeLattice.store;
6836
6652
  const config = await store.getConfigByKey(tenantId, key);
6837
6653
  if (!config) {
@@ -6857,7 +6673,7 @@ async function createDatabaseConfig(request, reply) {
6857
6673
  const tenantId = getTenantId8(request);
6858
6674
  const body = request.body;
6859
6675
  try {
6860
- const storeLattice = getStoreLattice7("default", "database");
6676
+ const storeLattice = getStoreLattice8("default", "database");
6861
6677
  const store = storeLattice.store;
6862
6678
  const existing = await store.getConfigByKey(tenantId, body.key);
6863
6679
  if (existing) {
@@ -6867,7 +6683,7 @@ async function createDatabaseConfig(request, reply) {
6867
6683
  message: "Database configuration with this key already exists"
6868
6684
  };
6869
6685
  }
6870
- const id3 = body.id || randomUUID8();
6686
+ const id3 = body.id || randomUUID7();
6871
6687
  const config = await store.createConfig(tenantId, id3, body);
6872
6688
  try {
6873
6689
  sqlDatabaseManager.registerDatabase(tenantId, config.key, config.config);
@@ -6893,7 +6709,7 @@ async function updateDatabaseConfig(request, reply) {
6893
6709
  const { key } = request.params;
6894
6710
  const updates = request.body;
6895
6711
  try {
6896
- const storeLattice = getStoreLattice7("default", "database");
6712
+ const storeLattice = getStoreLattice8("default", "database");
6897
6713
  const store = storeLattice.store;
6898
6714
  const existing = await store.getConfigByKey(tenantId, key);
6899
6715
  if (!existing) {
@@ -6934,7 +6750,7 @@ async function deleteDatabaseConfig(request, reply) {
6934
6750
  const tenantId = getTenantId8(request);
6935
6751
  const { keyOrId } = request.params;
6936
6752
  try {
6937
- const storeLattice = getStoreLattice7("default", "database");
6753
+ const storeLattice = getStoreLattice8("default", "database");
6938
6754
  const store = storeLattice.store;
6939
6755
  console.log("Delete request - keyOrId:", keyOrId);
6940
6756
  let config = await store.getConfigByKey(tenantId, keyOrId);
@@ -6983,7 +6799,7 @@ async function testDatabaseConnection(request, reply) {
6983
6799
  const tenantId = getTenantId8(request);
6984
6800
  const { key } = request.params;
6985
6801
  try {
6986
- const storeLattice = getStoreLattice7("default", "database");
6802
+ const storeLattice = getStoreLattice8("default", "database");
6987
6803
  const store = storeLattice.store;
6988
6804
  const config = await store.getConfigByKey(tenantId, key);
6989
6805
  if (!config) {
@@ -7068,11 +6884,11 @@ function registerDatabaseConfigRoutes(app2) {
7068
6884
 
7069
6885
  // src/controllers/metrics-configs.ts
7070
6886
  import {
7071
- getStoreLattice as getStoreLattice8,
6887
+ getStoreLattice as getStoreLattice9,
7072
6888
  metricsServerManager as metricsServerManager2,
7073
6889
  SemanticMetricsClient as SemanticMetricsClient2
7074
6890
  } from "@axiom-lattice/core";
7075
- import { randomUUID as randomUUID9 } from "crypto";
6891
+ import { randomUUID as randomUUID8 } from "crypto";
7076
6892
  function getTenantId9(request) {
7077
6893
  const userTenantId = request.user?.tenantId;
7078
6894
  if (userTenantId) {
@@ -7083,7 +6899,7 @@ function getTenantId9(request) {
7083
6899
  async function getMetricsServerConfigList(request, reply) {
7084
6900
  const tenantId = getTenantId9(request);
7085
6901
  try {
7086
- const storeLattice = getStoreLattice8("default", "metrics");
6902
+ const storeLattice = getStoreLattice9("default", "metrics");
7087
6903
  const store = storeLattice.store;
7088
6904
  const configs = await store.getAllConfigs(tenantId);
7089
6905
  return {
@@ -7110,7 +6926,7 @@ async function getMetricsServerConfig(request, reply) {
7110
6926
  const tenantId = getTenantId9(request);
7111
6927
  const { key } = request.params;
7112
6928
  try {
7113
- const storeLattice = getStoreLattice8("default", "metrics");
6929
+ const storeLattice = getStoreLattice9("default", "metrics");
7114
6930
  const store = storeLattice.store;
7115
6931
  const config = await store.getConfigByKey(tenantId, key);
7116
6932
  if (!config) {
@@ -7136,7 +6952,7 @@ async function createMetricsServerConfig(request, reply) {
7136
6952
  const tenantId = getTenantId9(request);
7137
6953
  const body = request.body;
7138
6954
  try {
7139
- const storeLattice = getStoreLattice8("default", "metrics");
6955
+ const storeLattice = getStoreLattice9("default", "metrics");
7140
6956
  const store = storeLattice.store;
7141
6957
  const existing = await store.getConfigByKey(tenantId, body.key);
7142
6958
  if (existing) {
@@ -7153,7 +6969,7 @@ async function createMetricsServerConfig(request, reply) {
7153
6969
  message: "selectedDataSources is required for semantic metrics servers"
7154
6970
  };
7155
6971
  }
7156
- const id3 = body.id || randomUUID9();
6972
+ const id3 = body.id || randomUUID8();
7157
6973
  const configData = {
7158
6974
  key: body.key,
7159
6975
  name: body.name,
@@ -7188,7 +7004,7 @@ async function updateMetricsServerConfig(request, reply) {
7188
7004
  const { key } = request.params;
7189
7005
  const updates = request.body;
7190
7006
  try {
7191
- const storeLattice = getStoreLattice8("default", "metrics");
7007
+ const storeLattice = getStoreLattice9("default", "metrics");
7192
7008
  const store = storeLattice.store;
7193
7009
  const existing = await store.getConfigByKey(tenantId, key);
7194
7010
  if (!existing) {
@@ -7238,7 +7054,7 @@ async function deleteMetricsServerConfig(request, reply) {
7238
7054
  const tenantId = getTenantId9(request);
7239
7055
  const { keyOrId } = request.params;
7240
7056
  try {
7241
- const storeLattice = getStoreLattice8("default", "metrics");
7057
+ const storeLattice = getStoreLattice9("default", "metrics");
7242
7058
  const store = storeLattice.store;
7243
7059
  let config = await store.getConfigByKey(tenantId, keyOrId);
7244
7060
  let configKey = keyOrId;
@@ -7285,7 +7101,7 @@ async function testMetricsServerConnection(request, reply) {
7285
7101
  const tenantId = getTenantId9(request);
7286
7102
  const { key } = request.params;
7287
7103
  try {
7288
- const storeLattice = getStoreLattice8("default", "metrics");
7104
+ const storeLattice = getStoreLattice9("default", "metrics");
7289
7105
  const store = storeLattice.store;
7290
7106
  const config = await store.getConfigByKey(tenantId, key);
7291
7107
  if (!config) {
@@ -7336,7 +7152,7 @@ async function listAvailableMetrics(request, reply) {
7336
7152
  const tenantId = getTenantId9(request);
7337
7153
  const { key } = request.params;
7338
7154
  try {
7339
- const storeLattice = getStoreLattice8("default", "metrics");
7155
+ const storeLattice = getStoreLattice9("default", "metrics");
7340
7156
  const store = storeLattice.store;
7341
7157
  const config = await store.getConfigByKey(tenantId, key);
7342
7158
  if (!config) {
@@ -7375,7 +7191,7 @@ async function queryMetricsData(request, reply) {
7375
7191
  const { key } = request.params;
7376
7192
  const { metricName, startTime, endTime, step, labels } = request.body;
7377
7193
  try {
7378
- const storeLattice = getStoreLattice8("default", "metrics");
7194
+ const storeLattice = getStoreLattice9("default", "metrics");
7379
7195
  const store = storeLattice.store;
7380
7196
  const config = await store.getConfigByKey(tenantId, key);
7381
7197
  if (!config) {
@@ -7422,7 +7238,7 @@ async function getDataSources(request, reply) {
7422
7238
  const tenantId = getTenantId9(request);
7423
7239
  const { key } = request.params;
7424
7240
  try {
7425
- const storeLattice = getStoreLattice8("default", "metrics");
7241
+ const storeLattice = getStoreLattice9("default", "metrics");
7426
7242
  const store = storeLattice.store;
7427
7243
  const config = await store.getConfigByKey(tenantId, key);
7428
7244
  if (!config) {
@@ -7463,7 +7279,7 @@ async function getDatasourceMetrics(request, reply) {
7463
7279
  const tenantId = getTenantId9(request);
7464
7280
  const { key, datasourceId } = request.params;
7465
7281
  try {
7466
- const storeLattice = getStoreLattice8("default", "metrics");
7282
+ const storeLattice = getStoreLattice9("default", "metrics");
7467
7283
  const store = storeLattice.store;
7468
7284
  const config = await store.getConfigByKey(tenantId, key);
7469
7285
  if (!config) {
@@ -7501,7 +7317,7 @@ async function querySemanticMetrics(request, reply) {
7501
7317
  const { key } = request.params;
7502
7318
  const body = request.body;
7503
7319
  try {
7504
- const storeLattice = getStoreLattice8("default", "metrics");
7320
+ const storeLattice = getStoreLattice9("default", "metrics");
7505
7321
  const store = storeLattice.store;
7506
7322
  const config = await store.getConfigByKey(tenantId, key);
7507
7323
  if (!config) {
@@ -7810,13 +7626,13 @@ function connectionRoutes(fastify2) {
7810
7626
 
7811
7627
  // src/controllers/mcp-configs.ts
7812
7628
  import {
7813
- getStoreLattice as getStoreLattice9,
7629
+ getStoreLattice as getStoreLattice10,
7814
7630
  getReplicaId as getReplicaId2,
7815
7631
  mcpManager,
7816
7632
  McpLatticeManager,
7817
7633
  convertToConnection
7818
7634
  } from "@axiom-lattice/core";
7819
- import { randomUUID as randomUUID10 } from "crypto";
7635
+ import { randomUUID as randomUUID9 } from "crypto";
7820
7636
 
7821
7637
  // src/services/mcpConfigSync.ts
7822
7638
  var MCP_CONFIG_CHANGED_TOPIC = "mcp-config-changed";
@@ -7864,7 +7680,7 @@ function getTenantId10(request) {
7864
7680
  function broadcastMcpConfigChanged(tenantId, serverKey) {
7865
7681
  if (!tenantId || !serverKey) return;
7866
7682
  try {
7867
- const outbox = getStoreLattice9("default", "outbox").store;
7683
+ const outbox = getStoreLattice10("default", "outbox").store;
7868
7684
  void publishMcpConfigChanged(outbox, getReplicaId2(), tenantId, serverKey);
7869
7685
  } catch {
7870
7686
  }
@@ -7872,7 +7688,7 @@ function broadcastMcpConfigChanged(tenantId, serverKey) {
7872
7688
  async function getMcpServerConfigList(request, reply) {
7873
7689
  const tenantId = getTenantId10(request);
7874
7690
  try {
7875
- const storeLattice = getStoreLattice9("default", "mcp");
7691
+ const storeLattice = getStoreLattice10("default", "mcp");
7876
7692
  const store = storeLattice.store;
7877
7693
  const configs = await store.getAllConfigs(tenantId);
7878
7694
  return {
@@ -7899,7 +7715,7 @@ async function getMcpServerConfig(request, reply) {
7899
7715
  const tenantId = getTenantId10(request);
7900
7716
  const { key } = request.params;
7901
7717
  try {
7902
- const storeLattice = getStoreLattice9("default", "mcp");
7718
+ const storeLattice = getStoreLattice10("default", "mcp");
7903
7719
  const store = storeLattice.store;
7904
7720
  const config = await store.getConfigByKey(tenantId, key);
7905
7721
  if (!config) {
@@ -7925,7 +7741,7 @@ async function createMcpServerConfig(request, reply) {
7925
7741
  const tenantId = getTenantId10(request);
7926
7742
  const body = request.body;
7927
7743
  try {
7928
- const storeLattice = getStoreLattice9("default", "mcp");
7744
+ const storeLattice = getStoreLattice10("default", "mcp");
7929
7745
  const store = storeLattice.store;
7930
7746
  const existing = await store.getConfigByKey(tenantId, body.key);
7931
7747
  if (existing) {
@@ -7935,7 +7751,7 @@ async function createMcpServerConfig(request, reply) {
7935
7751
  message: "MCP server configuration with this key already exists"
7936
7752
  };
7937
7753
  }
7938
- const id3 = body.id || randomUUID10();
7754
+ const id3 = body.id || randomUUID9();
7939
7755
  const config = await store.createConfig(tenantId, id3, body);
7940
7756
  try {
7941
7757
  await connectAndRegisterTools(config);
@@ -7966,7 +7782,7 @@ async function updateMcpServerConfig(request, reply) {
7966
7782
  const { key } = request.params;
7967
7783
  const updates = request.body;
7968
7784
  try {
7969
- const storeLattice = getStoreLattice9("default", "mcp");
7785
+ const storeLattice = getStoreLattice10("default", "mcp");
7970
7786
  const store = storeLattice.store;
7971
7787
  const existing = await store.getConfigByKey(tenantId, key);
7972
7788
  if (!existing) {
@@ -8036,7 +7852,7 @@ async function deleteMcpServerConfig(request, reply) {
8036
7852
  const tenantId = getTenantId10(request);
8037
7853
  const { keyOrId } = request.params;
8038
7854
  try {
8039
- const storeLattice = getStoreLattice9("default", "mcp");
7855
+ const storeLattice = getStoreLattice10("default", "mcp");
8040
7856
  const store = storeLattice.store;
8041
7857
  let config = await store.getConfigByKey(tenantId, keyOrId);
8042
7858
  let configKey = keyOrId;
@@ -8084,7 +7900,7 @@ async function testMcpServerConnection(request, reply) {
8084
7900
  const tenantId = getTenantId10(request);
8085
7901
  const { key } = request.params;
8086
7902
  try {
8087
- const storeLattice = getStoreLattice9("default", "mcp");
7903
+ const storeLattice = getStoreLattice10("default", "mcp");
8088
7904
  const store = storeLattice.store;
8089
7905
  const config = await store.getConfigByKey(tenantId, key);
8090
7906
  if (!config) {
@@ -8132,7 +7948,7 @@ async function listMcpServerTools(request, reply) {
8132
7948
  const tenantId = getTenantId10(request);
8133
7949
  const { key } = request.params;
8134
7950
  try {
8135
- const storeLattice = getStoreLattice9("default", "mcp");
7951
+ const storeLattice = getStoreLattice10("default", "mcp");
8136
7952
  const store = storeLattice.store;
8137
7953
  const config = await store.getConfigByKey(tenantId, key);
8138
7954
  if (!config) {
@@ -8173,7 +7989,7 @@ async function connectMcpServer(request, reply) {
8173
7989
  const tenantId = getTenantId10(request);
8174
7990
  const { key } = request.params;
8175
7991
  try {
8176
- const storeLattice = getStoreLattice9("default", "mcp");
7992
+ const storeLattice = getStoreLattice10("default", "mcp");
8177
7993
  const store = storeLattice.store;
8178
7994
  const config = await store.getConfigByKey(tenantId, key);
8179
7995
  if (!config) {
@@ -8195,7 +8011,7 @@ async function connectMcpServer(request, reply) {
8195
8011
  };
8196
8012
  } catch (error) {
8197
8013
  console.error("Failed to connect MCP server:", error);
8198
- const storeLattice = getStoreLattice9("default", "mcp");
8014
+ const storeLattice = getStoreLattice10("default", "mcp");
8199
8015
  const store = storeLattice.store;
8200
8016
  const config = await store.getConfigByKey(tenantId, key);
8201
8017
  if (config) {
@@ -8212,7 +8028,7 @@ async function disconnectMcpServer(request, reply) {
8212
8028
  const tenantId = getTenantId10(request);
8213
8029
  const { key } = request.params;
8214
8030
  try {
8215
- const storeLattice = getStoreLattice9("default", "mcp");
8031
+ const storeLattice = getStoreLattice10("default", "mcp");
8216
8032
  const store = storeLattice.store;
8217
8033
  const config = await store.getConfigByKey(tenantId, key);
8218
8034
  if (!config) {
@@ -8360,6 +8176,17 @@ var UiResourceResolver = class {
8360
8176
  async invalidate(tenantId, ref) {
8361
8177
  await this.deps.store.delete(this.fullKey(tenantId, ref));
8362
8178
  }
8179
+ /**
8180
+ * Evict every cached plugin UI resource for a tenant.
8181
+ *
8182
+ * @param tenantId Tenant whose plugin UI resources to drop.
8183
+ * @remarks Called when a tenant's plugin catalog changes so an edited
8184
+ * `ui/*.html` is re-fetched instead of being served from the TTL cache
8185
+ * (which is keyed by ref identity, not content).
8186
+ */
8187
+ async invalidateTenantPlugins(tenantId) {
8188
+ await this.deps.store.deleteByPrefix(`${tenantId}\0plugin\0`);
8189
+ }
8363
8190
  async fetchAndCache(tenantId, ref, key, cached) {
8364
8191
  try {
8365
8192
  const fresh = ref.kind === "mcp" ? await this.deps.fetchMcp(tenantId, ref.serverKey, ref.resourceUri) : await this.deps.fetchPlugin(tenantId, ref.pluginType, ref.resource);
@@ -8684,12 +8511,17 @@ function createDefaultPluginBackend() {
8684
8511
  }
8685
8512
  };
8686
8513
  }
8514
+ var uiResourceResolverSingleton;
8515
+ function getMcpUiResourceResolver() {
8516
+ return uiResourceResolverSingleton;
8517
+ }
8687
8518
  function resolveMcpAppDeps(pluginBackend = createDefaultPluginBackend()) {
8688
8519
  const uiResourceResolver = new UiResourceResolver({
8689
8520
  store: new InMemoryMcpUiResourceCacheStore(),
8690
8521
  fetchMcp: (tenantId, serverKey, resourceUri) => mcpManager2.readUiResource(tenantId, serverKey, resourceUri),
8691
8522
  fetchPlugin: (tenantId, pluginType, resource) => fetchPluginUiResource(pluginBackend, tenantId, pluginType, resource)
8692
8523
  });
8524
+ uiResourceResolverSingleton = uiResourceResolver;
8693
8525
  return {
8694
8526
  resolveUiResource: (tenantId, ref) => uiResourceResolver.resolve(tenantId, ref),
8695
8527
  callTool: (tenantId, ref, name, args, context) => ref.kind === "mcp" ? mcpManager2.callServerTool(tenantId, ref.serverKey, name, args) : callPluginTool(pluginBackend, tenantId, ref, name, args, context),
@@ -8741,13 +8573,13 @@ function registerMcpAppRoutes(fastify2) {
8741
8573
  }
8742
8574
 
8743
8575
  // src/controllers/eval.ts
8744
- import { getStoreLattice as getStoreLattice11, hasModelLatticeForTenant as hasModelLatticeForTenant2, modelLatticeManager as modelLatticeManager2 } from "@axiom-lattice/core";
8576
+ import { getStoreLattice as getStoreLattice12, hasModelLatticeForTenant as hasModelLatticeForTenant2, modelLatticeManager as modelLatticeManager2 } from "@axiom-lattice/core";
8745
8577
  import { v4 as uuidv43 } from "uuid";
8746
8578
 
8747
8579
  // src/services/eval-runner.ts
8748
8580
  import { EventEmitter } from "events";
8749
8581
  import {
8750
- getStoreLattice as getStoreLattice10,
8582
+ getStoreLattice as getStoreLattice11,
8751
8583
  hasModelLatticeForTenant,
8752
8584
  listModelLatticesForTenant,
8753
8585
  LatticeEvalProject
@@ -9078,7 +8910,7 @@ var EvalRunner = class {
9078
8910
  return ctx !== void 0 && !ctx.terminal.workerSettled && (tenantId === void 0 || ctx.tenantId === tenantId);
9079
8911
  }
9080
8912
  getEvalStore() {
9081
- return getStoreLattice10("default", "eval").store;
8913
+ return getStoreLattice11("default", "eval").store;
9082
8914
  }
9083
8915
  releaseProjectLease(leaseKey, leaseToken) {
9084
8916
  if (this.projectLeases.get(leaseKey) === leaseToken) this.projectLeases.delete(leaseKey);
@@ -9095,7 +8927,7 @@ function getTenantId11(request) {
9095
8927
  return request.headers["x-tenant-id"] || "default";
9096
8928
  }
9097
8929
  function getEvalStore() {
9098
- return getStoreLattice11("default", "eval").store;
8930
+ return getStoreLattice12("default", "eval").store;
9099
8931
  }
9100
8932
  async function getOwnedSuite(store, tenantId, projectId, suiteId) {
9101
8933
  const project = await store.getProjectById(tenantId, projectId);
@@ -9622,11 +9454,11 @@ data: ${JSON.stringify(event.data)}
9622
9454
  }
9623
9455
 
9624
9456
  // src/controllers/users.ts
9625
- import { getStoreLattice as getStoreLattice12 } from "@axiom-lattice/core";
9457
+ import { getStoreLattice as getStoreLattice13 } from "@axiom-lattice/core";
9626
9458
  import { v4 as uuidv44 } from "uuid";
9627
9459
  var UsersController = class {
9628
9460
  constructor() {
9629
- this.userStore = getStoreLattice12("default", "user").store;
9461
+ this.userStore = getStoreLattice13("default", "user").store;
9630
9462
  }
9631
9463
  async listUsers(request, reply) {
9632
9464
  const { email } = request.query;
@@ -9704,11 +9536,11 @@ function registerUserRoutes(app2) {
9704
9536
  }
9705
9537
 
9706
9538
  // src/controllers/tenants.ts
9707
- import { getStoreLattice as getStoreLattice13 } from "@axiom-lattice/core";
9539
+ import { getStoreLattice as getStoreLattice14 } from "@axiom-lattice/core";
9708
9540
  import { v4 as uuidv45 } from "uuid";
9709
9541
  var TenantsController = class {
9710
9542
  constructor() {
9711
- this.tenantStore = getStoreLattice13("default", "tenant").store;
9543
+ this.tenantStore = getStoreLattice14("default", "tenant").store;
9712
9544
  }
9713
9545
  // ==================== Tenant CRUD ====================
9714
9546
  async listTenants(request, reply) {
@@ -9772,7 +9604,7 @@ function registerTenantRoutes(app2) {
9772
9604
  }
9773
9605
 
9774
9606
  // src/controllers/auth.ts
9775
- import { getStoreLattice as getStoreLattice14 } from "@axiom-lattice/core";
9607
+ import { getStoreLattice as getStoreLattice15 } from "@axiom-lattice/core";
9776
9608
  import { v4 as uuidv46 } from "uuid";
9777
9609
  import { createHmac, randomBytes, timingSafeEqual } from "crypto";
9778
9610
  var defaultAuthConfig = {
@@ -9782,9 +9614,9 @@ var defaultAuthConfig = {
9782
9614
  };
9783
9615
  var AuthController = class {
9784
9616
  constructor(config = {}) {
9785
- this.userStore = getStoreLattice14("default", "user").store;
9786
- this.tenantStore = getStoreLattice14("default", "tenant").store;
9787
- this.userTenantLinkStore = getStoreLattice14("default", "userTenantLink").store;
9617
+ this.userStore = getStoreLattice15("default", "user").store;
9618
+ this.tenantStore = getStoreLattice15("default", "tenant").store;
9619
+ this.userTenantLinkStore = getStoreLattice15("default", "userTenantLink").store;
9788
9620
  this.config = { ...defaultAuthConfig, ...config };
9789
9621
  }
9790
9622
  async register(request, reply) {
@@ -9943,7 +9775,7 @@ var AuthController = class {
9943
9775
  const linkMeta = link?.metadata || {};
9944
9776
  let personalAssistant = null;
9945
9777
  if (linkMeta.personalAssistantId) {
9946
- const assistantStore = getStoreLattice14("default", "assistant").store;
9778
+ const assistantStore = getStoreLattice15("default", "assistant").store;
9947
9779
  const exists = await assistantStore.hasAssistant(tenantId, linkMeta.personalAssistantId);
9948
9780
  if (exists) {
9949
9781
  personalAssistant = {
@@ -10635,11 +10467,11 @@ function registerChannelRoutes(app2, dependencies) {
10635
10467
  }
10636
10468
 
10637
10469
  // src/controllers/channel-installations.ts
10638
- import { randomUUID as randomUUID11 } from "crypto";
10470
+ import { randomUUID as randomUUID10 } from "crypto";
10639
10471
  import {
10640
10472
  descriptorDataValue
10641
10473
  } from "@axiom-lattice/protocols";
10642
- import { getStoreLattice as getStoreLattice15 } from "@axiom-lattice/core";
10474
+ import { getStoreLattice as getStoreLattice16 } from "@axiom-lattice/core";
10643
10475
  var _adapterRegistry;
10644
10476
  var _router;
10645
10477
  function setChannelControllerDeps(deps) {
@@ -10770,7 +10602,7 @@ function snapshotPlainObject(value) {
10770
10602
  }
10771
10603
  }
10772
10604
  async function getInstallationStore() {
10773
- const store = getStoreLattice15("default", "channelInstallation").store;
10605
+ const store = getStoreLattice16("default", "channelInstallation").store;
10774
10606
  if (store) return store;
10775
10607
  const { PostgreSQLChannelInstallationStore } = await import("@axiom-lattice/pg-stores");
10776
10608
  const databaseUrl = process.env.DATABASE_URL;
@@ -10846,7 +10678,7 @@ async function createChannelInstallation(request, reply) {
10846
10678
  };
10847
10679
  }
10848
10680
  const store = await getInstallationStore();
10849
- const installationId = randomUUID11();
10681
+ const installationId = randomUUID10();
10850
10682
  const createInput = {
10851
10683
  channel: body.channel,
10852
10684
  name: body.name,
@@ -11089,7 +10921,7 @@ import {
11089
10921
  DuplicateChannelBindingSubjectError,
11090
10922
  descriptorDataValue as descriptorDataValue2
11091
10923
  } from "@axiom-lattice/protocols";
11092
- import { getBindingRegistry, getStoreLattice as getStoreLattice16 } from "@axiom-lattice/core";
10924
+ import { getBindingRegistry, getStoreLattice as getStoreLattice17 } from "@axiom-lattice/core";
11093
10925
  function getTenantId13(request) {
11094
10926
  const userTenantId = request.user?.tenantId;
11095
10927
  if (typeof userTenantId === "string" && userTenantId) return userTenantId;
@@ -11147,7 +10979,7 @@ function snapshotPublicUpdate(value) {
11147
10979
  return body;
11148
10980
  }
11149
10981
  function getInstallationStore2() {
11150
- return getStoreLattice16("default", "channelInstallation").store;
10982
+ return getStoreLattice17("default", "channelInstallation").store;
11151
10983
  }
11152
10984
  async function isValidPublicInstallation(tenantId, channelInstallationId, channel) {
11153
10985
  const installation = await getInstallationStore2().getInstallationById(channelInstallationId);
@@ -11647,7 +11479,7 @@ var registerSTTRoutes = (app2) => {
11647
11479
  };
11648
11480
 
11649
11481
  // src/controllers/local-a2a.ts
11650
- import { getStoreLattice as getStoreLattice17 } from "@axiom-lattice/core";
11482
+ import { getStoreLattice as getStoreLattice18 } from "@axiom-lattice/core";
11651
11483
  import {
11652
11484
  AgentType as AgentType2
11653
11485
  } from "@axiom-lattice/protocols";
@@ -11663,7 +11495,7 @@ function getLocalRuntime(assistant) {
11663
11495
  return graphDefinition.localRuntime;
11664
11496
  }
11665
11497
  async function getLocalA2AAssistants(tenantId) {
11666
- const storeLattice = getStoreLattice17("default", "assistant");
11498
+ const storeLattice = getStoreLattice18("default", "assistant");
11667
11499
  const assistants = await storeLattice.store.getAllAssistants(tenantId);
11668
11500
  const results = [];
11669
11501
  for (const assistant of assistants) {
@@ -11675,7 +11507,7 @@ async function getLocalA2AAssistants(tenantId) {
11675
11507
  return results;
11676
11508
  }
11677
11509
  async function getLocalA2AAssistant(tenantId, assistantId) {
11678
- const storeLattice = getStoreLattice17("default", "assistant");
11510
+ const storeLattice = getStoreLattice18("default", "assistant");
11679
11511
  const assistant = await storeLattice.store.getAssistantById(tenantId, assistantId);
11680
11512
  if (!assistant) return null;
11681
11513
  const runtime = getLocalRuntime(assistant);
@@ -11806,7 +11638,7 @@ async function getLocalA2ATemplates(_request, reply) {
11806
11638
  }
11807
11639
 
11808
11640
  // src/routes/a2a-test-connection.ts
11809
- import { randomUUID as randomUUID12 } from "crypto";
11641
+ import { randomUUID as randomUUID11 } from "crypto";
11810
11642
  function describeTestConnectionError(error, agentCardUrl) {
11811
11643
  if (!(error instanceof Error)) {
11812
11644
  return `Failed to fetch agent card from ${agentCardUrl}: ${String(error)}`;
@@ -11846,7 +11678,7 @@ async function ensureLocalRuntimeForConnectionTest(localRuntime, agentCardUrl) {
11846
11678
  return { error: portValidation.error };
11847
11679
  }
11848
11680
  const state = await localA2AService.startProvider(
11849
- `test-${randomUUID12()}`,
11681
+ `test-${randomUUID11()}`,
11850
11682
  testRuntime
11851
11683
  );
11852
11684
  if (state.status === "running") return { runtimeId: state.runtimeId };
@@ -11925,7 +11757,7 @@ import {
11925
11757
  createTrustedAgentMessageDispatcher,
11926
11758
  executionAuthorityRegistry,
11927
11759
  getReplicaId as getReplicaId6,
11928
- getStoreLattice as getStoreLattice18,
11760
+ getStoreLattice as getStoreLattice19,
11929
11761
  hasModelLatticeForTenant as hasModelLatticeForTenant3,
11930
11762
  ManagedTaskStartError,
11931
11763
  modelLatticeManager as modelLatticeManager3,
@@ -12261,7 +12093,7 @@ function snapshotEnsureInput(input) {
12261
12093
  import { createHash as createHash3 } from "crypto";
12262
12094
 
12263
12095
  // src/services/collaboration/ProjectTaskExecutionService.ts
12264
- import { randomUUID as randomUUID13 } from "crypto";
12096
+ import { randomUUID as randomUUID12 } from "crypto";
12265
12097
  import {
12266
12098
  createTaskRunBridge,
12267
12099
  ThreadStatus as ThreadStatus3
@@ -12724,7 +12556,7 @@ var ProjectTaskExecutionService = class {
12724
12556
  return current;
12725
12557
  }
12726
12558
  async dispatchRun(task, thread, mode, rosterExempt, signal, options) {
12727
- const messageId = (this.options.idFactory ?? randomUUID13)();
12559
+ const messageId = (this.options.idFactory ?? randomUUID12)();
12728
12560
  if (signal?.aborted) return this.compensateCancellation(task, thread, messageId, false);
12729
12561
  const armed = await this.armAndEnqueue(task, thread, mode, messageId, rosterExempt, signal, options);
12730
12562
  if (armed.cancelled) return this.cancelSettlement(armed.settlement, task, thread, messageId, false);
@@ -12781,7 +12613,7 @@ var ProjectTaskExecutionService = class {
12781
12613
  * phantom in-progress run is left behind.
12782
12614
  */
12783
12615
  async enqueueDetached(task, thread, mode, rosterExempt, options) {
12784
- const messageId = (this.options.idFactory ?? randomUUID13)();
12616
+ const messageId = (this.options.idFactory ?? randomUUID12)();
12785
12617
  const armed = await this.armAndEnqueue(task, thread, mode, messageId, rosterExempt, void 0, options);
12786
12618
  void armed.settlement.promise.catch(() => void 0);
12787
12619
  if (!armed.queued) {
@@ -14251,7 +14083,7 @@ import { createHmac as createHmac3 } from "crypto";
14251
14083
  import { z as z5, ZodError as ZodError2 } from "zod";
14252
14084
 
14253
14085
  // src/services/agent-web-app/AgentWebAppRuntimeService.ts
14254
- import { createHash as createHash4, randomUUID as randomUUID14 } from "crypto";
14086
+ import { createHash as createHash4, randomUUID as randomUUID13 } from "crypto";
14255
14087
  import { MessageChunkTypes as MessageChunkTypes3, parseAgentWebAppGenUIBlock, buildAffinityMissChunk as buildAffinityMissChunk2 } from "@axiom-lattice/protocols";
14256
14088
  import { getReplicaId as getReplicaId3, getThreadRunOwner as getThreadRunOwner2 } from "@axiom-lattice/core";
14257
14089
  function isRecord2(value) {
@@ -14470,7 +14302,7 @@ ${formatFileRefsSection(refs)}` : input.content;
14470
14302
  const userDigest = createHash4("sha256").update(userId, "utf8").digest("hex");
14471
14303
  const contentDigest = createHash4("sha256").update(file.bytes).digest("hex");
14472
14304
  const displayName = file.name;
14473
- const physicalName = `${randomUUID14()}-${sanitizePhysicalFilename(file.name)}`;
14305
+ const physicalName = `${randomUUID13()}-${sanitizePhysicalFilename(file.name)}`;
14474
14306
  const saved = await this.deps.saveProjectFile({
14475
14307
  tenantId: runtime.webApp.tenantId,
14476
14308
  workspaceId: runtime.project.workspaceId,
@@ -14622,7 +14454,7 @@ ${formatFileRefsSection(refs)}` : input.content;
14622
14454
  const thread = await this.deps.threadStore.createThread(
14623
14455
  runtime.webApp.tenantId,
14624
14456
  runtime.webApp.assistantId,
14625
- randomUUID14(),
14457
+ randomUUID13(),
14626
14458
  { metadata: this.metadata(runtime, userId, normalizeLabel(rawLabel)) }
14627
14459
  );
14628
14460
  return toRuntimeThread(thread);
@@ -15884,7 +15716,7 @@ function registerCapabilityBundleRoutes(app2, controller) {
15884
15716
  import { ZodError as ZodError3 } from "zod";
15885
15717
 
15886
15718
  // src/services/model-provider/ModelProviderService.ts
15887
- import { randomUUID as randomUUID15 } from "crypto";
15719
+ import { randomUUID as randomUUID14 } from "crypto";
15888
15720
  import { toModelKey } from "@axiom-lattice/protocols";
15889
15721
  import {
15890
15722
  assertSafeUpstreamUrl,
@@ -16102,7 +15934,7 @@ var unsafeReasonToErrorCode = {
16102
15934
  var ModelProviderService = class {
16103
15935
  constructor(deps) {
16104
15936
  this.deps = deps;
16105
- this.idFactory = deps.idFactory ?? (() => randomUUID15());
15937
+ this.idFactory = deps.idFactory ?? (() => randomUUID14());
16106
15938
  }
16107
15939
  /**
16108
15940
  * List the tenant's provider configurations.
@@ -17167,12 +16999,12 @@ async function handleModelProviderChanged(payload, reconcile) {
17167
16999
  }
17168
17000
 
17169
17001
  // src/services/collaboration/ProjectRoomService.ts
17170
- import { randomUUID as randomUUID16 } from "crypto";
17002
+ import { randomUUID as randomUUID15 } from "crypto";
17171
17003
  var ProjectRoomService = class {
17172
17004
  /** Creates a project room service from explicitly injected collaborators. */
17173
17005
  constructor(deps) {
17174
17006
  this.deps = deps;
17175
- this.idFactory = deps.idFactory ?? randomUUID16;
17007
+ this.idFactory = deps.idFactory ?? randomUUID15;
17176
17008
  }
17177
17009
  /**
17178
17010
  * Authorizes read access and ensures the project's main room.
@@ -17232,7 +17064,7 @@ var ProjectRoomService = class {
17232
17064
  };
17233
17065
 
17234
17066
  // src/services/collaboration/ProjectMembershipService.ts
17235
- import { randomUUID as randomUUID17 } from "crypto";
17067
+ import { randomUUID as randomUUID16 } from "crypto";
17236
17068
  var ProjectMembershipServiceError = class extends Error {
17237
17069
  constructor(code, statusCode, message) {
17238
17070
  super(message);
@@ -17248,7 +17080,7 @@ function isMembershipConflict(error) {
17248
17080
  var ProjectMembershipService = class {
17249
17081
  constructor(deps) {
17250
17082
  this.deps = deps;
17251
- this.idFactory = deps.idFactory ?? randomUUID17;
17083
+ this.idFactory = deps.idFactory ?? randomUUID16;
17252
17084
  this.mutationMutex = deps.projectMutationMutex ?? projectMutationMutex;
17253
17085
  }
17254
17086
  async list(actor3) {
@@ -17382,7 +17214,7 @@ var ProjectMembershipService = class {
17382
17214
  };
17383
17215
 
17384
17216
  // src/services/collaboration/ProjectRosterService.ts
17385
- import { randomUUID as randomUUID18 } from "crypto";
17217
+ import { randomUUID as randomUUID17 } from "crypto";
17386
17218
  var ProjectRosterServiceError = class extends Error {
17387
17219
  /** Creates a stable roster service error. */
17388
17220
  constructor(code, statusCode, message) {
@@ -17401,7 +17233,7 @@ var ProjectRosterService = class {
17401
17233
  /** Creates a roster service from explicitly injected collaborators. */
17402
17234
  constructor(deps) {
17403
17235
  this.deps = deps;
17404
- this.idFactory = deps.idFactory ?? randomUUID18;
17236
+ this.idFactory = deps.idFactory ?? randomUUID17;
17405
17237
  this.mutationMutex = deps.projectMutationMutex ?? projectMutationMutex;
17406
17238
  }
17407
17239
  /**
@@ -17508,7 +17340,7 @@ var ProjectRosterService = class {
17508
17340
  const agent = (await this.deps.agents.list(actor3.tenantId, actor3.userId)).find((item) => item.assistantId === assistantId);
17509
17341
  if (!agent || agent.ownerUserId !== void 0) throw new ProjectRosterServiceError("ASSISTANT_NOT_FOUND", 404, "Agent not found");
17510
17342
  const room = await this.deps.roomStore.ensureMainRoom({
17511
- id: randomUUID18(),
17343
+ id: randomUUID17(),
17512
17344
  tenantId: actor3.tenantId,
17513
17345
  workspaceId: project.workspaceId,
17514
17346
  projectId: actor3.projectId,
@@ -17852,7 +17684,7 @@ function virtualPublicProjectBot(project, room, agent, mentionName, now) {
17852
17684
  }
17853
17685
 
17854
17686
  // src/services/collaboration/RoomMessageService.ts
17855
- import { createHash as createHash6, randomUUID as randomUUID19 } from "crypto";
17687
+ import { createHash as createHash6, randomUUID as randomUUID18 } from "crypto";
17856
17688
 
17857
17689
  // src/services/collaboration/ProjectBotMembershipSnapshot.ts
17858
17690
  import { snapshotExactRecord as snapshotExactRecord5 } from "@axiom-lattice/protocols";
@@ -17941,7 +17773,7 @@ var RoomMessageService = class {
17941
17773
  constructor(deps, options = {}) {
17942
17774
  this.deps = deps;
17943
17775
  this.idempotentOutcomes = /* @__PURE__ */ new Map();
17944
- this.idFactory = deps.idFactory ?? randomUUID19;
17776
+ this.idFactory = deps.idFactory ?? randomUUID18;
17945
17777
  const limit = options.idempotentOutcomeLimit ?? 1e3;
17946
17778
  if (!Number.isSafeInteger(limit) || limit < 1) throw new RangeError("idempotentOutcomeLimit must be a positive safe integer");
17947
17779
  this.idempotentOutcomeLimit = limit;
@@ -18227,7 +18059,7 @@ import { ZodError as ZodError4 } from "zod";
18227
18059
  import { toProjectRoomPublicMessage } from "@axiom-lattice/protocols";
18228
18060
 
18229
18061
  // src/services/collaboration/RoomInterruptService.ts
18230
- import { randomUUID as randomUUID20 } from "crypto";
18062
+ import { randomUUID as randomUUID19 } from "crypto";
18231
18063
  var RESUMABLE_TASK_INTERRUPT_CODES = /* @__PURE__ */ new Set([
18232
18064
  "PROJECT_TASK_NOT_RESUMABLE",
18233
18065
  "PROJECT_TASK_NOT_READY",
@@ -18248,7 +18080,7 @@ var RoomInterruptService = class {
18248
18080
  /** Creates the service from explicitly injected stores and dispatcher. */
18249
18081
  constructor(deps) {
18250
18082
  this.deps = deps;
18251
- this.idFactory = deps.idFactory ?? randomUUID20;
18083
+ this.idFactory = deps.idFactory ?? randomUUID19;
18252
18084
  }
18253
18085
  /** Resolves a pending clarify interrupt with no answers. */
18254
18086
  async skip(input) {
@@ -18572,7 +18404,7 @@ async function execute(reply, operation) {
18572
18404
  }
18573
18405
 
18574
18406
  // src/routes/cospace.ts
18575
- import { randomUUID as randomUUID21 } from "crypto";
18407
+ import { randomUUID as randomUUID20 } from "crypto";
18576
18408
  import { ZodError as ZodError6 } from "zod";
18577
18409
  import {
18578
18410
  generateDirectHumanProjectId,
@@ -18606,7 +18438,7 @@ async function computeUnread(deps, tenantId, userId, roomId, lastMessage) {
18606
18438
  });
18607
18439
  }
18608
18440
  function registerCoSpaceRoutes(app2, deps) {
18609
- const idFactory = deps.idFactory ?? (() => randomUUID21());
18441
+ const idFactory = deps.idFactory ?? (() => randomUUID20());
18610
18442
  app2.get(
18611
18443
  "/api/workspaces/:workspaceId/rooms",
18612
18444
  async (request, reply) => {
@@ -19573,7 +19405,7 @@ function exactValues(value, required, optional = []) {
19573
19405
  }
19574
19406
 
19575
19407
  // src/services/collaboration/CoordinatorWakeNotifier.ts
19576
- import { randomUUID as randomUUID22 } from "crypto";
19408
+ import { randomUUID as randomUUID21 } from "crypto";
19577
19409
  import {
19578
19410
  snapshotExactRecord as snapshotExactRecord7
19579
19411
  } from "@axiom-lattice/protocols";
@@ -19589,7 +19421,7 @@ var CoordinatorWakeNotifier = class {
19589
19421
  this.accepted = /* @__PURE__ */ new Set();
19590
19422
  this.maxPending = deps.maxPending ?? 1024;
19591
19423
  if (!Number.isSafeInteger(this.maxPending) || this.maxPending < 1) throw new RangeError("maxPending must be a positive safe integer");
19592
- this.idFactory = deps.idFactory ?? randomUUID22;
19424
+ this.idFactory = deps.idFactory ?? randomUUID21;
19593
19425
  }
19594
19426
  /** Admits one notification without awaiting any store or dispatch operation. */
19595
19427
  handle(value, anchorMessageId) {
@@ -21259,7 +21091,7 @@ function isRecord3(value) {
21259
21091
  import { taskLifecycleNotifier } from "@axiom-lattice/core";
21260
21092
 
21261
21093
  // src/services/collaboration/ProjectRoomEventBroker.ts
21262
- import { randomUUID as randomUUID23 } from "crypto";
21094
+ import { randomUUID as randomUUID22 } from "crypto";
21263
21095
  import {
21264
21096
  parseProjectRoomEventId,
21265
21097
  ProjectRoomBrokerCapacityError,
@@ -21290,7 +21122,7 @@ var ProjectRoomEventBroker = class {
21290
21122
  this.subscriberCount = 0;
21291
21123
  this.usageClock = 0;
21292
21124
  this.closed = false;
21293
- this.epoch = options.epoch ?? randomUUID23();
21125
+ this.epoch = options.epoch ?? randomUUID22();
21294
21126
  if (!UUID_PATTERN.test(this.epoch)) {
21295
21127
  throw new TypeError("Project Room event epoch must be a lowercase canonical UUID");
21296
21128
  }
@@ -22916,25 +22748,25 @@ async function transferGovernedDispatchOwner(task, options, deps) {
22916
22748
  function broadcastModelProviderChanged(tenantId, providerId2) {
22917
22749
  if (!tenantId) return;
22918
22750
  try {
22919
- const outbox = getStoreLattice18("default", "outbox").store;
22751
+ const outbox = getStoreLattice19("default", "outbox").store;
22920
22752
  void publishModelProviderChanged(outbox, getReplicaId6(), tenantId, providerId2);
22921
22753
  } catch {
22922
22754
  }
22923
22755
  }
22924
22756
  var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
22925
- const webAppStore = getStoreLattice18("default", "agentWebApp").store;
22926
- const assistantStore = getStoreLattice18("default", "assistant").store;
22927
- const projectStore = getStoreLattice18("default", "project").store;
22928
- const projectMembershipStore = getStoreLattice18("default", "projectMembership").store;
22929
- const userTenantLinkStore = getStoreLattice18("default", "userTenantLink").store;
22930
- const projectRoomStore = getStoreLattice18("default", "projectRoom").store;
22931
- const projectBotMembershipStore = getStoreLattice18("default", "projectBotMembership").store;
22932
- const projectRoomMessageStore = getStoreLattice18("default", "projectRoomMessage").store;
22933
- const projectRoomReadStateStore = getStoreLattice18("default", "projectRoomReadState").store;
22934
- const userPushSubscriptionStore = getStoreLattice18("default", "userPushSubscription").store;
22935
- const threadStore = getStoreLattice18("default", "thread").store;
22936
- const taskStore = getStoreLattice18("default", "task").store;
22937
- const taskWorkItemStore = getStoreLattice18("default", "taskWorkItem").store;
22757
+ const webAppStore = getStoreLattice19("default", "agentWebApp").store;
22758
+ const assistantStore = getStoreLattice19("default", "assistant").store;
22759
+ const projectStore = getStoreLattice19("default", "project").store;
22760
+ const projectMembershipStore = getStoreLattice19("default", "projectMembership").store;
22761
+ const userTenantLinkStore = getStoreLattice19("default", "userTenantLink").store;
22762
+ const projectRoomStore = getStoreLattice19("default", "projectRoom").store;
22763
+ const projectBotMembershipStore = getStoreLattice19("default", "projectBotMembership").store;
22764
+ const projectRoomMessageStore = getStoreLattice19("default", "projectRoomMessage").store;
22765
+ const projectRoomReadStateStore = getStoreLattice19("default", "projectRoomReadState").store;
22766
+ const userPushSubscriptionStore = getStoreLattice19("default", "userPushSubscription").store;
22767
+ const threadStore = getStoreLattice19("default", "thread").store;
22768
+ const taskStore = getStoreLattice19("default", "task").store;
22769
+ const taskWorkItemStore = getStoreLattice19("default", "taskWorkItem").store;
22938
22770
  const projectTaskEnabled = options.projectTaskEnabled ?? process.env.AXIOM_PROJECT_TASK_EXECUTION_ENABLED !== "false";
22939
22771
  const accessService = new ProjectAccessService({ projectStore, membershipStore: projectMembershipStore, userTenantLinkStore });
22940
22772
  const realtimeMode = resolveProjectRoomRealtimeMode();
@@ -23000,7 +22832,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
23000
22832
  updateAssistant: assistantStore.updateAssistant.bind(assistantStore)
23001
22833
  });
23002
22834
  const resolveCoordinatorMentionName = async (tenantId) => {
23003
- const tenant2 = await getStoreLattice18("default", "tenant").store.getTenantById(tenantId);
22835
+ const tenant2 = await getStoreLattice19("default", "tenant").store.getTenantById(tenantId);
23004
22836
  const value = tenant2?.metadata?.coordinatorMentionName;
23005
22837
  return typeof value === "string" && value.length > 0 ? value : void 0;
23006
22838
  };
@@ -23104,7 +22936,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
23104
22936
  });
23105
22937
  }
23106
22938
  if (projectTaskComposition) app2.addHook("onClose", async () => projectTaskComposition.lease.release());
23107
- const taskThreadService = projectTaskComposition?.lease.runtime.threads ?? new ProjectTaskThreadService({ threads: threadStore, idFactory: randomUUID24 });
22939
+ const taskThreadService = projectTaskComposition?.lease.runtime.threads ?? new ProjectTaskThreadService({ threads: threadStore, idFactory: randomUUID23 });
23108
22940
  const taskLifecycle = projectTaskComposition?.lease.runtime.lifecycle ?? createTaskLifecycleService({ taskStore, workItemStore: taskWorkItemStore });
23109
22941
  const reassignmentAuthorizer = createProjectTaskReassignmentAuthorizer(
23110
22942
  new ProjectTaskOwnerPolicy(projectBotMembershipStore),
@@ -23187,7 +23019,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
23187
23019
  readStateService,
23188
23020
  interruptService: roomInterruptService,
23189
23021
  userDirectory: {
23190
- getUserById: (id3) => getStoreLattice18("default", "user").store.getUserById(id3).then((u) => u ? { name: u.name } : null)
23022
+ getUserById: (id3) => getStoreLattice19("default", "user").store.getUserById(id3).then((u) => u ? { name: u.name } : null)
23191
23023
  }
23192
23024
  });
23193
23025
  registerProjectRosterRoutes(app2, { service: rosterService });
@@ -23198,7 +23030,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
23198
23030
  createProject: projectStore.createProject.bind(projectStore)
23199
23031
  },
23200
23032
  workspaceStore: {
23201
- getWorkspaceById: (tenantId, id3) => getStoreLattice18("default", "workspace").store.getWorkspaceById(tenantId, id3)
23033
+ getWorkspaceById: (tenantId, id3) => getStoreLattice19("default", "workspace").store.getWorkspaceById(tenantId, id3)
23202
23034
  },
23203
23035
  membershipStore: {
23204
23036
  list: projectMembershipStore.list.bind(projectMembershipStore),
@@ -23221,7 +23053,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
23221
23053
  getUsersByTenant: userTenantLinkStore.getUsersByTenant.bind(userTenantLinkStore)
23222
23054
  },
23223
23055
  userStore: {
23224
- getUserById: (id3) => getStoreLattice18("default", "user").store.getUserById(id3).then((u) => u ? { id: u.id, name: u.name, email: u.email } : null)
23056
+ getUserById: (id3) => getStoreLattice19("default", "user").store.getUserById(id3).then((u) => u ? { id: u.id, name: u.name, email: u.email } : null)
23225
23057
  },
23226
23058
  assistantStore: {
23227
23059
  getAssistantById: assistantStore.getAssistantById.bind(assistantStore),
@@ -23243,11 +23075,11 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
23243
23075
  }
23244
23076
  });
23245
23077
  registerCapabilityBundleRoutes(app2, new CapabilityBundleController({
23246
- bundleStore: getStoreLattice18("default", "capabilityBundle").store,
23078
+ bundleStore: getStoreLattice19("default", "capabilityBundle").store,
23247
23079
  projectStore
23248
23080
  }, { authRequired: process.env.AUTH_REQUIRED === "true" }));
23249
23081
  const modelProviderController = new ModelProviderController({
23250
- providerStore: getStoreLattice18("default", "modelProvider").store,
23082
+ providerStore: getStoreLattice19("default", "modelProvider").store,
23251
23083
  userTenantLinkStore,
23252
23084
  registry: {
23253
23085
  register: (tenantId, modelKey2, config) => modelLatticeManager3.registerLatticeWithTenant(tenantId, modelKey2, config),
@@ -23320,7 +23152,7 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
23320
23152
  }),
23321
23153
  service: new AgentWebAppRuntimeService({
23322
23154
  webAppStore,
23323
- threadStore: getStoreLattice18("default", "thread").store,
23155
+ threadStore: getStoreLattice19("default", "thread").store,
23324
23156
  projectStore,
23325
23157
  assistantResolver: {
23326
23158
  resolve: async (tenantId, assistantId) => {
@@ -23502,16 +23334,6 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
23502
23334
  "/api/assistants/:assistantId/threads/:threadId",
23503
23335
  deleteThread
23504
23336
  );
23505
- app2.get(
23506
- "/api/config",
23507
- { schema: getConfigSchema },
23508
- getConfig
23509
- );
23510
- app2.put(
23511
- "/api/config",
23512
- { schema: updateConfigSchema },
23513
- updateConfig
23514
- );
23515
23337
  app2.get("/api/models", getModels);
23516
23338
  app2.put("/api/models", updateModels);
23517
23339
  app2.get("/api/tools", getToolConfigs);
@@ -23710,10 +23532,6 @@ var registerLatticeRoutes = (app2, channelDeps, options = {}) => {
23710
23532
  "/api/tenants/:tenantId/export/entities",
23711
23533
  previewEntities
23712
23534
  );
23713
- app2.get(
23714
- "/api/tenants/:tenantId/export/:jobId/download",
23715
- downloadExport
23716
- );
23717
23535
  app2.post(
23718
23536
  "/api/tenants/:tenantId/import/preview",
23719
23537
  importPreview
@@ -23746,9 +23564,9 @@ function tryCreateProjectTaskRuntime(input) {
23746
23564
  let stores;
23747
23565
  try {
23748
23566
  stores = {
23749
- tenants: getStoreLattice18("default", "tenant").store,
23750
- workspaces: getStoreLattice18("default", "workspace").store,
23751
- queue: getStoreLattice18("default", "threadMessageQueue").store
23567
+ tenants: getStoreLattice19("default", "tenant").store,
23568
+ workspaces: getStoreLattice19("default", "workspace").store,
23569
+ queue: getStoreLattice19("default", "threadMessageQueue").store
23752
23570
  };
23753
23571
  const missing = missingRuntimeMethod(input, stores);
23754
23572
  if (missing) return { reason: missing };
@@ -23779,7 +23597,7 @@ function tryCreateProjectTaskRuntime(input) {
23779
23597
  function createRuntime(input, stores, log2) {
23780
23598
  const controller = new AbortController();
23781
23599
  const mutex = new ProjectTaskExecutionMutex();
23782
- const threads = new ProjectTaskThreadService({ threads: input.threadStore, idFactory: randomUUID24 });
23600
+ const threads = new ProjectTaskThreadService({ threads: input.threadStore, idFactory: randomUUID23 });
23783
23601
  const lifecycle = createTaskLifecycleService({ taskStore: input.taskStore, workItemStore: input.taskWorkItemStore });
23784
23602
  const projection = new RoomProjectionService({
23785
23603
  messages: input.projectRoomMessageStore,
@@ -23788,7 +23606,7 @@ function createRuntime(input, stores, log2) {
23788
23606
  warnings: input.taskWorkItemStore,
23789
23607
  log: log2,
23790
23608
  realtime: input.realtime,
23791
- idFactory: randomUUID24
23609
+ idFactory: randomUUID23
23792
23610
  });
23793
23611
  const agentFor = (task, thread) => agentInstanceManager6.getAgent({
23794
23612
  tenant_id: task.tenantId,
@@ -24131,9 +23949,9 @@ var skillRegistration = {
24131
23949
  };
24132
23950
 
24133
23951
  // src/export_registrations/agent.registration.ts
24134
- import { getStoreLattice as getStoreLattice19 } from "@axiom-lattice/core";
23952
+ import { getStoreLattice as getStoreLattice20 } from "@axiom-lattice/core";
24135
23953
  function getStore2() {
24136
- return getStoreLattice19("default", "assistant").store;
23954
+ return getStoreLattice20("default", "assistant").store;
24137
23955
  }
24138
23956
  var agentRegistration = {
24139
23957
  entityType: "agent",
@@ -24213,9 +24031,9 @@ var agentRegistration = {
24213
24031
  };
24214
24032
 
24215
24033
  // src/export_registrations/database-config.registration.ts
24216
- import { getStoreLattice as getStoreLattice20 } from "@axiom-lattice/core";
24034
+ import { getStoreLattice as getStoreLattice21 } from "@axiom-lattice/core";
24217
24035
  function getStore3() {
24218
- return getStoreLattice20("default", "database").store;
24036
+ return getStoreLattice21("default", "database").store;
24219
24037
  }
24220
24038
  var databaseConfigRegistration = {
24221
24039
  entityType: "database_config",
@@ -24295,9 +24113,9 @@ var databaseConfigRegistration = {
24295
24113
  };
24296
24114
 
24297
24115
  // src/export_registrations/metrics-config.registration.ts
24298
- import { getStoreLattice as getStoreLattice21 } from "@axiom-lattice/core";
24116
+ import { getStoreLattice as getStoreLattice22 } from "@axiom-lattice/core";
24299
24117
  function getStore4() {
24300
- return getStoreLattice21("default", "metrics").store;
24118
+ return getStoreLattice22("default", "metrics").store;
24301
24119
  }
24302
24120
  var metricsConfigRegistration = {
24303
24121
  entityType: "metrics_config",
@@ -24377,9 +24195,9 @@ var metricsConfigRegistration = {
24377
24195
  };
24378
24196
 
24379
24197
  // src/export_registrations/mcp-config.registration.ts
24380
- import { getStoreLattice as getStoreLattice22 } from "@axiom-lattice/core";
24198
+ import { getStoreLattice as getStoreLattice23 } from "@axiom-lattice/core";
24381
24199
  function getStore5() {
24382
- return getStoreLattice22("default", "mcp").store;
24200
+ return getStoreLattice23("default", "mcp").store;
24383
24201
  }
24384
24202
  var mcpConfigRegistration = {
24385
24203
  entityType: "mcp_config",
@@ -24462,9 +24280,9 @@ var mcpConfigRegistration = {
24462
24280
  };
24463
24281
 
24464
24282
  // src/export_registrations/connection.registration.ts
24465
- import { getStoreLattice as getStoreLattice23 } from "@axiom-lattice/core";
24283
+ import { getStoreLattice as getStoreLattice24 } from "@axiom-lattice/core";
24466
24284
  function getStore6() {
24467
- return getStoreLattice23("default", "connection").store;
24285
+ return getStoreLattice24("default", "connection").store;
24468
24286
  }
24469
24287
  async function listAllConnections(tenantId) {
24470
24288
  const store = getStore6();
@@ -24549,9 +24367,9 @@ var connectionRegistration = {
24549
24367
  };
24550
24368
 
24551
24369
  // src/export_registrations/collection.registration.ts
24552
- import { getStoreLattice as getStoreLattice24 } from "@axiom-lattice/core";
24370
+ import { getStoreLattice as getStoreLattice25 } from "@axiom-lattice/core";
24553
24371
  function getStore7() {
24554
- return getStoreLattice24("default", "collection").store;
24372
+ return getStoreLattice25("default", "collection").store;
24555
24373
  }
24556
24374
  var collectionRegistration = {
24557
24375
  entityType: "collection",
@@ -24622,8 +24440,8 @@ var collectionRegistration = {
24622
24440
  };
24623
24441
 
24624
24442
  // src/export_registrations/channel-installation.registration.ts
24625
- import { getStoreLattice as getStoreLattice25 } from "@axiom-lattice/core";
24626
- import { randomUUID as randomUUID25 } from "crypto";
24443
+ import { getStoreLattice as getStoreLattice26 } from "@axiom-lattice/core";
24444
+ import { randomUUID as randomUUID24 } from "crypto";
24627
24445
  var UUID_PATTERN2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
24628
24446
  var PUBLIC_CHANNELS = /* @__PURE__ */ new Set(["lark", "email", "slack", "wechat", "wecom"]);
24629
24447
  function isPublicChannel(channel) {
@@ -24659,7 +24477,7 @@ function validateImportData(data) {
24659
24477
  };
24660
24478
  }
24661
24479
  function getStore8() {
24662
- return getStoreLattice25("default", "channelInstallation").store;
24480
+ return getStoreLattice26("default", "channelInstallation").store;
24663
24481
  }
24664
24482
  function getOverwriteError(tenantId, incomingChannel, existing) {
24665
24483
  if (!existing) return "Channel installation overwrite target must exist";
@@ -24785,7 +24603,7 @@ var channelInstallationRegistration = {
24785
24603
  }
24786
24604
  id3 = sourceId;
24787
24605
  } else {
24788
- id3 = randomUUID25();
24606
+ id3 = randomUUID24();
24789
24607
  }
24790
24608
  await store.createInstallation(tenantId, id3, createInput);
24791
24609
  return { newId: id3 };
@@ -24793,9 +24611,9 @@ var channelInstallationRegistration = {
24793
24611
  };
24794
24612
 
24795
24613
  // src/export_registrations/menu.registration.ts
24796
- import { getStoreLattice as getStoreLattice26 } from "@axiom-lattice/core";
24614
+ import { getStoreLattice as getStoreLattice27 } from "@axiom-lattice/core";
24797
24615
  function getStore9() {
24798
- return getStoreLattice26("default", "menu").store;
24616
+ return getStoreLattice27("default", "menu").store;
24799
24617
  }
24800
24618
  var menuRegistration = {
24801
24619
  entityType: "menu",
@@ -24873,9 +24691,9 @@ var menuRegistration = {
24873
24691
  };
24874
24692
 
24875
24693
  // src/export_registrations/eval.registration.ts
24876
- import { getStoreLattice as getStoreLattice27 } from "@axiom-lattice/core";
24694
+ import { getStoreLattice as getStoreLattice28 } from "@axiom-lattice/core";
24877
24695
  function getStore10() {
24878
- return getStoreLattice27("default", "eval").store;
24696
+ return getStoreLattice28("default", "eval").store;
24879
24697
  }
24880
24698
  var evalRegistration = {
24881
24699
  entityType: "eval",
@@ -25334,7 +25152,7 @@ function createAuditLoggerMiddleware() {
25334
25152
  import { setBindingRegistry, setMenuRegistry, setEvalRunService } from "@axiom-lattice/core";
25335
25153
 
25336
25154
  // src/channels/wecom/WecomChannelAdapter.ts
25337
- import { randomUUID as randomUUID26 } from "crypto";
25155
+ import { randomUUID as randomUUID25 } from "crypto";
25338
25156
  import { z as z12 } from "zod";
25339
25157
  import * as WecomAiBot from "@wecom/aibot-node-sdk";
25340
25158
 
@@ -25379,7 +25197,7 @@ function streamIdFor(replyTarget) {
25379
25197
  const key = streamKeyOf(replyTarget);
25380
25198
  let streamId = streamIdsByReqId.get(key);
25381
25199
  if (!streamId) {
25382
- streamId = randomUUID26();
25200
+ streamId = randomUUID25();
25383
25201
  streamIdsByReqId.set(key, streamId);
25384
25202
  if (streamIdsByReqId.size > MAX_TRACKED_STREAMS) {
25385
25203
  const oldest = streamIdsByReqId.keys().next().value;
@@ -25632,7 +25450,7 @@ var configureSwagger = async (app2, customSwaggerConfig, customSwaggerUiConfig)
25632
25450
  };
25633
25451
 
25634
25452
  // src/services/agent_task_consumer.ts
25635
- import { randomUUID as randomUUID27 } from "crypto";
25453
+ import { randomUUID as randomUUID26 } from "crypto";
25636
25454
  import { eventBus as eventBus3, AGENT_TASK_EVENT, agentInstanceManager as agentInstanceManager7, QueueMode as QueueMode2 } from "@axiom-lattice/core";
25637
25455
  import { resolveRunScope } from "@axiom-lattice/protocols";
25638
25456
  var handleAgentTask = async (taskRequest, retryCount = 0) => {
@@ -25656,7 +25474,7 @@ var handleAgentTask = async (taskRequest, retryCount = 0) => {
25656
25474
  const agent = agentInstanceManager7.getAgent({ assistant_id, thread_id, tenant_id, workspace_id: scope.workspaceId, project_id: scope.projectId, custom_run_config: runConfig });
25657
25475
  if (callback_event) {
25658
25476
  const callbackEvent = callback_event;
25659
- const messageId = typeof input?.id === "string" && input.id !== "" ? input.id : randomUUID27();
25477
+ const messageId = typeof input?.id === "string" && input.id !== "" ? input.id : randomUUID26();
25660
25478
  let settled = false;
25661
25479
  const subscriptions = [];
25662
25480
  const dispose = () => {
@@ -26003,7 +25821,7 @@ import { RoomAgentMessageService } from "@axiom-lattice/core";
26003
25821
 
26004
25822
  // src/router/MessageRouter.ts
26005
25823
  import {
26006
- getStoreLattice as getStoreLattice28,
25824
+ getStoreLattice as getStoreLattice29,
26007
25825
  agentInstanceManager as agentInstanceManager8
26008
25826
  } from "@axiom-lattice/core";
26009
25827
  import {
@@ -26011,7 +25829,7 @@ import {
26011
25829
  snapshotExactRecord as snapshotExactRecord15,
26012
25830
  MessageChunkTypes as MessageChunkTypes4
26013
25831
  } from "@axiom-lattice/protocols";
26014
- import { randomUUID as randomUUID28 } from "crypto";
25832
+ import { randomUUID as randomUUID27 } from "crypto";
26015
25833
  var BindingNotFoundError = class extends Error {
26016
25834
  constructor(message) {
26017
25835
  super(message);
@@ -26304,7 +26122,7 @@ var _MessageRouter = class _MessageRouter {
26304
26122
  channel: message.channel,
26305
26123
  adapterChannel: adapter.channel
26306
26124
  }, "Thread resolved by adapter strategy");
26307
- const threadStore = getStoreLattice28("default", "thread").store;
26125
+ const threadStore = getStoreLattice29("default", "thread").store;
26308
26126
  try {
26309
26127
  await threadStore.createThread(
26310
26128
  tenantId,
@@ -26341,8 +26159,8 @@ var _MessageRouter = class _MessageRouter {
26341
26159
  }
26342
26160
  }
26343
26161
  if (!threadId) {
26344
- const threadStore = getStoreLattice28("default", "thread").store;
26345
- const newThreadId = randomUUID28();
26162
+ const threadStore = getStoreLattice29("default", "thread").store;
26163
+ const newThreadId = randomUUID27();
26346
26164
  console.log({
26347
26165
  event: "dispatch:thread:create",
26348
26166
  agentId,
@@ -26388,7 +26206,7 @@ var _MessageRouter = class _MessageRouter {
26388
26206
  workspace_id: binding?.workspaceId || "",
26389
26207
  project_id: binding?.projectId || ""
26390
26208
  });
26391
- const inputMessageId = randomUUID28();
26209
+ const inputMessageId = randomUUID27();
26392
26210
  const replyTarget = internalRoom ? correlatedRoomReplyTarget(message.replyTarget, inputMessageId) : message.replyTarget;
26393
26211
  const replyAdapter = replyTarget ? this.adapterRegistry.get(replyTarget.adapterChannel) : void 0;
26394
26212
  if (options.trustedMessageOptions && (!this.trustedDispatcher || !replyTarget || !replyAdapter)) {
@@ -26765,7 +26583,7 @@ async function prepareProjectTaskRuntime(runtime, log2) {
26765
26583
  import { setPluginDeploymentService } from "@axiom-lattice/core";
26766
26584
 
26767
26585
  // src/services/plugins/PluginDeploymentService.ts
26768
- import { randomUUID as randomUUID29 } from "crypto";
26586
+ import { randomUUID as randomUUID28 } from "crypto";
26769
26587
  import {
26770
26588
  PLUGIN_HOST_DIR,
26771
26589
  PluginDeploymentRuntimeRegistry
@@ -26909,7 +26727,7 @@ var PluginDeploymentService = class {
26909
26727
  const failedAt = this.nowIso();
26910
26728
  await this.store.upsert(
26911
26729
  this.buildRecord({
26912
- id: existing?.id ?? randomUUID29(),
26730
+ id: existing?.id ?? randomUUID28(),
26913
26731
  tenantId,
26914
26732
  pluginType,
26915
26733
  pluginVersion: manifest.version,
@@ -26931,7 +26749,7 @@ var PluginDeploymentService = class {
26931
26749
  );
26932
26750
  }
26933
26751
  const record = this.buildRecord({
26934
- id: existing?.id ?? randomUUID29(),
26752
+ id: existing?.id ?? randomUUID28(),
26935
26753
  tenantId,
26936
26754
  pluginType,
26937
26755
  pluginVersion: manifest.version,
@@ -27687,51 +27505,6 @@ function errorMessage5(error) {
27687
27505
  return error instanceof Error ? error.message : String(error);
27688
27506
  }
27689
27507
 
27690
- // src/services/multiReplicaReadiness.ts
27691
- import { getStoreLattice as getStoreLattice29 } from "@axiom-lattice/core";
27692
- var SHARED_STORE_KINDS = [
27693
- "lease",
27694
- "outbox",
27695
- "threadMessageQueue",
27696
- "task",
27697
- "taskWorkItem",
27698
- "channelInstallation"
27699
- ];
27700
- function storeClassName(kind) {
27701
- try {
27702
- return getStoreLattice29("default", kind).store.constructor?.name;
27703
- } catch {
27704
- return void 0;
27705
- }
27706
- }
27707
- function warnMultiReplicaReadiness(logger8) {
27708
- if (typeof process.env.AXIOM_REPLICA_ID !== "string" || process.env.AXIOM_REPLICA_ID.trim() === "") return;
27709
- for (const kind of SHARED_STORE_KINDS) {
27710
- const name = storeClassName(kind);
27711
- if (name === void 0 || !name.startsWith("InMemory")) continue;
27712
- logger8.warn(`Multi-replica: store '${kind}' is ${name} (not shared); configure a shared store`, {
27713
- phase: "multi_replica_readiness",
27714
- store: kind
27715
- });
27716
- }
27717
- if (!process.env.AUTH_TOKEN_SECRET?.trim() && !process.env.JWT_SECRET?.trim()) {
27718
- logger8.warn(
27719
- "Multi-replica: AUTH_TOKEN_SECRET/JWT_SECRET unset; console sessions are signed per-process and will not verify across replicas",
27720
- { phase: "multi_replica_readiness", env: "AUTH_TOKEN_SECRET" }
27721
- );
27722
- }
27723
- if (!process.env.LATTICE_ENCRYPTION_KEY?.trim()) {
27724
- logger8.warn(
27725
- "Multi-replica: LATTICE_ENCRYPTION_KEY unset; stored credentials use the shared dev default and may not decrypt across differing keys",
27726
- { phase: "multi_replica_readiness", env: "LATTICE_ENCRYPTION_KEY" }
27727
- );
27728
- }
27729
- logger8.warn(
27730
- "Multi-replica: agent run SSE and resume_stream are process-local; route a thread's follow-up runs to the replica streaming it (sticky routing) or share the stream/queue state",
27731
- { phase: "multi_replica_readiness", feature: "agent-run-sse" }
27732
- );
27733
- }
27734
-
27735
27508
  // src/services/OutboxRetentionJob.ts
27736
27509
  var HOUR_MS = 60 * 60 * 1e3;
27737
27510
  var DEFAULT_INTERVAL_MS2 = 6 * HOUR_MS;
@@ -28103,7 +27876,7 @@ var start = async (config) => {
28103
27876
  });
28104
27877
  try {
28105
27878
  const { A2AAuthService: A2AAuthService2, parseEnvKeys: parseEnvKeys2 } = await import("./A2AAuthService-7UGQ7GMW.mjs");
28106
- const { registerA2AStandardRoutes } = await import("./a2a-standard-PBYPNHOA.mjs");
27879
+ const { registerA2AStandardRoutes } = await import("./a2a-standard-3OZFXDCW.mjs");
28107
27880
  const a2a = await import("./a2a-BHBLACJV.mjs");
28108
27881
  const a2aKeyStore = getStoreLattice30("default", "a2aApiKey").store;
28109
27882
  const assistantStore = getStoreLattice30("default", "assistant").store;
@@ -28133,7 +27906,7 @@ var start = async (config) => {
28133
27906
  });
28134
27907
  }
28135
27908
  try {
28136
- const { registerOpenRoutes } = await import("./open-GNBMCHYA.mjs");
27909
+ const { registerOpenRoutes } = await import("./open-MDC4VCR7.mjs");
28137
27910
  const { registerOpenSessionRoutes } = await import("./open-session-2Y7XJJW2.mjs");
28138
27911
  const { registerOpenCatalogRoutes } = await import("./open-catalog-SZQ435AY.mjs");
28139
27912
  const { registerOpenFilesRoutes } = await import("./open-files-FS5AN6Q6.mjs");
@@ -28184,7 +27957,7 @@ var start = async (config) => {
28184
27957
  });
28185
27958
  }
28186
27959
  try {
28187
- const { registerGatewaySandboxOpenCredentialProvider } = await import("./sandboxOpenCredentialProvider-USIU7Z7H.mjs");
27960
+ const { registerGatewaySandboxOpenCredentialProvider } = await import("./sandboxOpenCredentialProvider-AT227D4N.mjs");
28188
27961
  registerGatewaySandboxOpenCredentialProvider((error) => {
28189
27962
  logger7.warn("sandbox open-credential provider failed", { error });
28190
27963
  });
@@ -28243,7 +28016,7 @@ var start = async (config) => {
28243
28016
  }
28244
28017
  }
28245
28018
  try {
28246
- const { ResourceController } = await import("./resources-2L3KSUUU.mjs");
28019
+ const { ResourceController } = await import("./resources-DAU5ZIPB.mjs");
28247
28020
  const sharedResourceStore = getStoreLattice30("default", "sharedResource").store;
28248
28021
  const cache = new TokenCache();
28249
28022
  const resourceController = new ResourceController({
@@ -28305,7 +28078,11 @@ var start = async (config) => {
28305
28078
  [ROOM_EVENT_TOPIC]: async (payload) => {
28306
28079
  if (projectRoomRealtimeRuntime) ingestRoomEvent(payload, projectRoomRealtimeRuntime.broker);
28307
28080
  },
28308
- "assistant-changed": (payload) => handleAssistantChanged(payload, (tenantId) => agentLatticeManager5.initializeStoredAssistantsForTenant(tenantId)),
28081
+ "assistant-changed": (payload) => handleAssistantChanged(payload, async (tenantId) => {
28082
+ await agentLatticeManager5.initializeStoredAssistantsForTenant(tenantId);
28083
+ invalidateAgentReflectionCache(tenantId);
28084
+ invalidatePluginReflectionCache(tenantId);
28085
+ }),
28309
28086
  [A2A_KEY_CHANGED_TOPIC]: (payload) => handleA2AKeyChanged(payload, () => refreshStoreKeyMap()),
28310
28087
  [MCP_CONFIG_CHANGED_TOPIC]: (payload) => reconcileMcpConfigChange(payload, {
28311
28088
  store: getStoreLattice30("default", "mcp").store,
@@ -28314,7 +28091,12 @@ var start = async (config) => {
28314
28091
  }),
28315
28092
  [PLUGIN_CATALOG_CHANGED_TOPIC]: async (payload) => {
28316
28093
  const tenantId = payload?.tenantId;
28317
- if (typeof tenantId === "string" && tenantId.length > 0) getSandboxPluginCatalog3().invalidate(tenantId);
28094
+ if (typeof tenantId === "string" && tenantId.length > 0) {
28095
+ getSandboxPluginCatalog3().invalidate(tenantId);
28096
+ invalidatePluginReflectionCache(tenantId);
28097
+ invalidateAgentReflectionCache(tenantId);
28098
+ await getMcpUiResourceResolver()?.invalidateTenantPlugins(tenantId);
28099
+ }
28318
28100
  },
28319
28101
  [MODEL_PROVIDER_CHANGED_TOPIC]: async (payload) => {
28320
28102
  const controller = routes.modelProviderController;
@@ -28343,7 +28125,7 @@ var start = async (config) => {
28343
28125
  }
28344
28126
  if (process.env.AXIOM_TASK_ORPHAN_RECOVERY === "true") {
28345
28127
  try {
28346
- const { createOrphanRecoveryRuntime: createOrphanRecoveryRuntime2 } = await import("./OrphanRecoveryRuntime-BEFILJMU.mjs");
28128
+ const { createOrphanRecoveryRuntime: createOrphanRecoveryRuntime2 } = await import("./OrphanRecoveryRuntime-T4T5NOZU.mjs");
28347
28129
  const { createRecoveryCallerDeps: createRecoveryCallerDeps2 } = await import("./RecoveryCallerDeps-6SJUYJ5S.mjs");
28348
28130
  const runtime = createOrphanRecoveryRuntime2({
28349
28131
  taskStore: getStoreLattice30("default", "task").store,