@axiom-lattice/core 4.0.0 → 4.1.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.
package/dist/index.mjs CHANGED
@@ -1881,6 +1881,106 @@ var InMemoryMcpServerConfigStore = class {
1881
1881
  }
1882
1882
  };
1883
1883
 
1884
+ // src/store_lattice/InMemoryAgentWebAppStore.ts
1885
+ import { randomUUID } from "crypto";
1886
+ function cloneWebApp(webApp) {
1887
+ return {
1888
+ ...webApp,
1889
+ integration: { ...webApp.integration },
1890
+ scope: {
1891
+ ...webApp.scope,
1892
+ allowedProjectIds: [...webApp.scope.allowedProjectIds],
1893
+ allowedModelKeys: webApp.scope.allowedModelKeys ? [...webApp.scope.allowedModelKeys] : void 0
1894
+ },
1895
+ features: { ...webApp.features },
1896
+ appearance: { ...webApp.appearance },
1897
+ createdAt: new Date(webApp.createdAt),
1898
+ updatedAt: new Date(webApp.updatedAt)
1899
+ };
1900
+ }
1901
+ var InMemoryAgentWebAppStore = class {
1902
+ constructor() {
1903
+ this.webApps = /* @__PURE__ */ new Map();
1904
+ }
1905
+ async list(tenantId2, assistantId) {
1906
+ const tenantWebApps = this.webApps.get(tenantId2);
1907
+ if (!tenantWebApps) return [];
1908
+ return Array.from(tenantWebApps.values()).map((webApp, insertionIndex) => ({ webApp, insertionIndex })).filter(
1909
+ ({ webApp }) => assistantId === void 0 ? true : webApp.assistantId === assistantId
1910
+ ).sort(
1911
+ (left, right) => right.webApp.createdAt.getTime() - left.webApp.createdAt.getTime() || right.insertionIndex - left.insertionIndex
1912
+ ).map(({ webApp }) => cloneWebApp(webApp));
1913
+ }
1914
+ async getById(tenantId2, webAppId) {
1915
+ const webApp = this.webApps.get(tenantId2)?.get(webAppId);
1916
+ return webApp ? cloneWebApp(webApp) : null;
1917
+ }
1918
+ async findById(webAppId) {
1919
+ for (const tenantWebApps of this.webApps.values()) {
1920
+ const webApp = tenantWebApps.get(webAppId);
1921
+ if (webApp) return cloneWebApp(webApp);
1922
+ }
1923
+ return null;
1924
+ }
1925
+ async create(tenantId2, input) {
1926
+ const now = /* @__PURE__ */ new Date();
1927
+ const webApp = {
1928
+ id: `webapp_${randomUUID().replace(/-/g, "")}`,
1929
+ tenantId: tenantId2,
1930
+ assistantId: input.assistantId,
1931
+ name: input.name,
1932
+ description: input.description,
1933
+ status: "draft",
1934
+ integration: { ...input.integration },
1935
+ scope: {
1936
+ ...input.scope,
1937
+ allowedProjectIds: [...input.scope.allowedProjectIds],
1938
+ allowedModelKeys: input.scope.allowedModelKeys ? [...input.scope.allowedModelKeys] : void 0
1939
+ },
1940
+ features: { ...input.features },
1941
+ appearance: { ...input.appearance },
1942
+ createdAt: now,
1943
+ updatedAt: now
1944
+ };
1945
+ let tenantWebApps = this.webApps.get(tenantId2);
1946
+ if (!tenantWebApps) {
1947
+ tenantWebApps = /* @__PURE__ */ new Map();
1948
+ this.webApps.set(tenantId2, tenantWebApps);
1949
+ }
1950
+ tenantWebApps.set(webApp.id, webApp);
1951
+ return cloneWebApp(webApp);
1952
+ }
1953
+ async update(tenantId2, webAppId, patch, options) {
1954
+ const tenantWebApps = this.webApps.get(tenantId2);
1955
+ const existing = tenantWebApps?.get(webAppId);
1956
+ if (!tenantWebApps || !existing) return null;
1957
+ if (options?.expectedUpdatedAt && existing.updatedAt.getTime() !== options.expectedUpdatedAt.getTime()) return null;
1958
+ const hasUpdate = patch.name !== void 0 || Object.prototype.hasOwnProperty.call(patch, "description") || patch.scope !== void 0 || patch.features !== void 0 || patch.appearance !== void 0 || patch.status !== void 0;
1959
+ if (!hasUpdate) return cloneWebApp(existing);
1960
+ const updated = {
1961
+ ...existing,
1962
+ ...patch.name !== void 0 ? { name: patch.name } : {},
1963
+ ...Object.prototype.hasOwnProperty.call(patch, "description") ? { description: patch.description } : {},
1964
+ ...patch.scope ? {
1965
+ scope: {
1966
+ ...patch.scope,
1967
+ allowedProjectIds: [...patch.scope.allowedProjectIds],
1968
+ allowedModelKeys: patch.scope.allowedModelKeys ? [...patch.scope.allowedModelKeys] : void 0
1969
+ }
1970
+ } : {},
1971
+ ...patch.features ? { features: { ...patch.features } } : {},
1972
+ ...patch.appearance ? { appearance: { ...patch.appearance } } : {},
1973
+ ...patch.status !== void 0 ? { status: patch.status } : {},
1974
+ updatedAt: new Date(Math.max(Date.now(), existing.updatedAt.getTime() + 1))
1975
+ };
1976
+ tenantWebApps.set(webAppId, updated);
1977
+ return cloneWebApp(updated);
1978
+ }
1979
+ async delete(tenantId2, webAppId) {
1980
+ return this.webApps.get(tenantId2)?.delete(webAppId) ?? false;
1981
+ }
1982
+ };
1983
+
1884
1984
  // src/store_lattice/InMemoryUserStore.ts
1885
1985
  var InMemoryUserStore = class {
1886
1986
  constructor() {
@@ -2446,7 +2546,7 @@ var InMemoryChannelInstallationStore = class {
2446
2546
  };
2447
2547
 
2448
2548
  // src/store_lattice/InMemoryBindingStore.ts
2449
- import { randomUUID } from "crypto";
2549
+ import { randomUUID as randomUUID2 } from "crypto";
2450
2550
  var InMemoryBindingStore = class {
2451
2551
  constructor() {
2452
2552
  this.bindings = /* @__PURE__ */ new Map();
@@ -2478,7 +2578,7 @@ var InMemoryBindingStore = class {
2478
2578
  async create(input) {
2479
2579
  const now = /* @__PURE__ */ new Date();
2480
2580
  const binding = {
2481
- id: randomUUID(),
2581
+ id: randomUUID2(),
2482
2582
  channel: input.channel,
2483
2583
  channelInstallationId: input.channelInstallationId,
2484
2584
  tenantId: input.tenantId,
@@ -2573,9 +2673,9 @@ var InMemoryBindingStore = class {
2573
2673
  };
2574
2674
 
2575
2675
  // src/store_lattice/InMemoryA2AApiKeyStore.ts
2576
- import { randomUUID as randomUUID2 } from "crypto";
2676
+ import { randomUUID as randomUUID3 } from "crypto";
2577
2677
  function generateApiKey() {
2578
- return `a2a_${randomUUID2().replace(/-/g, "")}`;
2678
+ return `a2a_${randomUUID3().replace(/-/g, "")}`;
2579
2679
  }
2580
2680
  var InMemoryA2AApiKeyStore = class {
2581
2681
  constructor() {
@@ -2603,7 +2703,7 @@ var InMemoryA2AApiKeyStore = class {
2603
2703
  async create(input) {
2604
2704
  const now = /* @__PURE__ */ new Date();
2605
2705
  const record = {
2606
- id: randomUUID2(),
2706
+ id: randomUUID3(),
2607
2707
  key: generateApiKey(),
2608
2708
  tenantId: input.tenantId,
2609
2709
  projectId: input.projectId,
@@ -3199,6 +3299,7 @@ var defaultProjectStore = new InMemoryProjectStore();
3199
3299
  var defaultDatabaseConfigStore = new InMemoryDatabaseConfigStore();
3200
3300
  var defaultMetricsServerConfigStore = new InMemoryMetricsServerConfigStore();
3201
3301
  var defaultMcpServerConfigStore = new InMemoryMcpServerConfigStore();
3302
+ var defaultAgentWebAppStore = new InMemoryAgentWebAppStore();
3202
3303
  storeLatticeManager.registerLattice("default", "thread", defaultThreadStore);
3203
3304
  storeLatticeManager.registerLattice(
3204
3305
  "default",
@@ -3211,6 +3312,7 @@ storeLatticeManager.registerLattice("default", "project", defaultProjectStore);
3211
3312
  storeLatticeManager.registerLattice("default", "database", defaultDatabaseConfigStore);
3212
3313
  storeLatticeManager.registerLattice("default", "metrics", defaultMetricsServerConfigStore);
3213
3314
  storeLatticeManager.registerLattice("default", "mcp", defaultMcpServerConfigStore);
3315
+ storeLatticeManager.registerLattice("default", "agentWebApp", defaultAgentWebAppStore);
3214
3316
  var defaultUserStore = new InMemoryUserStore();
3215
3317
  var defaultTenantStore = new InMemoryTenantStore();
3216
3318
  var defaultUserTenantLinkStore = new InMemoryUserTenantLinkStore();
@@ -7873,7 +7975,8 @@ var StateBackend = class {
7873
7975
  path: k,
7874
7976
  is_dir: false,
7875
7977
  size,
7876
- modified_at: fd.modified_at
7978
+ modified_at: fd.modified_at,
7979
+ created_at: fd.created_at
7877
7980
  });
7878
7981
  }
7879
7982
  for (const subdir of Array.from(subdirs).sort()) {
@@ -7881,7 +7984,8 @@ var StateBackend = class {
7881
7984
  path: subdir,
7882
7985
  is_dir: true,
7883
7986
  size: 0,
7884
- modified_at: ""
7987
+ modified_at: "",
7988
+ created_at: ""
7885
7989
  });
7886
7990
  }
7887
7991
  infos.sort((a, b) => a.path.localeCompare(b.path));
@@ -16771,7 +16875,8 @@ var StoreBackend = class {
16771
16875
  path: itemKey,
16772
16876
  is_dir: false,
16773
16877
  size,
16774
- modified_at: fd.modified_at
16878
+ modified_at: fd.modified_at,
16879
+ created_at: fd.created_at
16775
16880
  });
16776
16881
  } catch {
16777
16882
  continue;
@@ -16782,7 +16887,8 @@ var StoreBackend = class {
16782
16887
  path: subdir,
16783
16888
  is_dir: true,
16784
16889
  size: 0,
16785
- modified_at: ""
16890
+ modified_at: "",
16891
+ created_at: ""
16786
16892
  });
16787
16893
  }
16788
16894
  infos.sort((a, b) => a.path.localeCompare(b.path));
@@ -17089,14 +17195,16 @@ var FilesystemBackend = class {
17089
17195
  path: fullPath,
17090
17196
  is_dir: false,
17091
17197
  size: entryStat.size,
17092
- modified_at: entryStat.mtime.toISOString()
17198
+ modified_at: entryStat.mtime.toISOString(),
17199
+ created_at: entryStat.birthtime.toISOString()
17093
17200
  });
17094
17201
  } else if (isDir) {
17095
17202
  results.push({
17096
17203
  path: fullPath + path4.sep,
17097
17204
  is_dir: true,
17098
17205
  size: 0,
17099
- modified_at: entryStat.mtime.toISOString()
17206
+ modified_at: entryStat.mtime.toISOString(),
17207
+ created_at: entryStat.birthtime.toISOString()
17100
17208
  });
17101
17209
  }
17102
17210
  } else {
@@ -17115,14 +17223,16 @@ var FilesystemBackend = class {
17115
17223
  path: virtPath,
17116
17224
  is_dir: false,
17117
17225
  size: entryStat.size,
17118
- modified_at: entryStat.mtime.toISOString()
17226
+ modified_at: entryStat.mtime.toISOString(),
17227
+ created_at: entryStat.birthtime.toISOString()
17119
17228
  });
17120
17229
  } else if (isDir) {
17121
17230
  results.push({
17122
17231
  path: virtPath + "/",
17123
17232
  is_dir: true,
17124
17233
  size: 0,
17125
- modified_at: entryStat.mtime.toISOString()
17234
+ modified_at: entryStat.mtime.toISOString(),
17235
+ created_at: entryStat.birthtime.toISOString()
17126
17236
  });
17127
17237
  }
17128
17238
  }
@@ -17599,7 +17709,8 @@ var CompositeBackend = class {
17599
17709
  path: routePrefix,
17600
17710
  is_dir: true,
17601
17711
  size: 0,
17602
- modified_at: ""
17712
+ modified_at: "",
17713
+ created_at: ""
17603
17714
  });
17604
17715
  }
17605
17716
  results.sort((a, b) => a.path.localeCompare(b.path));
@@ -17757,7 +17868,8 @@ var MemoryBackend = class {
17757
17868
  path: k,
17758
17869
  is_dir: false,
17759
17870
  size,
17760
- modified_at: fd.modified_at
17871
+ modified_at: fd.modified_at,
17872
+ created_at: fd.created_at
17761
17873
  });
17762
17874
  }
17763
17875
  for (const subdir of Array.from(subdirs).sort()) {
@@ -17765,7 +17877,8 @@ var MemoryBackend = class {
17765
17877
  path: subdir,
17766
17878
  is_dir: true,
17767
17879
  size: 0,
17768
- modified_at: ""
17880
+ modified_at: "",
17881
+ created_at: ""
17769
17882
  });
17770
17883
  }
17771
17884
  infos.sort((a, b) => a.path.localeCompare(b.path));
@@ -21473,7 +21586,7 @@ ${body}` : `${frontmatter}
21473
21586
  };
21474
21587
 
21475
21588
  // src/store_lattice/InMemoryMenuStore.ts
21476
- import { randomUUID as randomUUID3 } from "crypto";
21589
+ import { randomUUID as randomUUID4 } from "crypto";
21477
21590
  var InMemoryMenuStore = class {
21478
21591
  constructor() {
21479
21592
  this.items = /* @__PURE__ */ new Map();
@@ -21494,7 +21607,7 @@ var InMemoryMenuStore = class {
21494
21607
  async create(input) {
21495
21608
  const now = /* @__PURE__ */ new Date();
21496
21609
  const item = {
21497
- id: randomUUID3(),
21610
+ id: randomUUID4(),
21498
21611
  tenantId: input.tenantId,
21499
21612
  menuTarget: input.menuTarget,
21500
21613
  group: input.group,
@@ -34153,6 +34266,7 @@ export {
34153
34266
  HumanMessage6 as HumanMessage,
34154
34267
  IdRemapper,
34155
34268
  InMemoryA2AApiKeyStore,
34269
+ InMemoryAgentWebAppStore,
34156
34270
  InMemoryAssistantStore,
34157
34271
  InMemoryBindingStore,
34158
34272
  InMemoryChannelInstallationStore,