@axiom-lattice/core 4.0.0 → 4.0.1
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.d.mts +25 -2
- package/dist/index.d.ts +25 -2
- package/dist/index.js +121 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +110 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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:
|
|
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
|
|
2676
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
2577
2677
|
function generateApiKey() {
|
|
2578
|
-
return `a2a_${
|
|
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:
|
|
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();
|
|
@@ -21473,7 +21575,7 @@ ${body}` : `${frontmatter}
|
|
|
21473
21575
|
};
|
|
21474
21576
|
|
|
21475
21577
|
// src/store_lattice/InMemoryMenuStore.ts
|
|
21476
|
-
import { randomUUID as
|
|
21578
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
21477
21579
|
var InMemoryMenuStore = class {
|
|
21478
21580
|
constructor() {
|
|
21479
21581
|
this.items = /* @__PURE__ */ new Map();
|
|
@@ -21494,7 +21596,7 @@ var InMemoryMenuStore = class {
|
|
|
21494
21596
|
async create(input) {
|
|
21495
21597
|
const now = /* @__PURE__ */ new Date();
|
|
21496
21598
|
const item = {
|
|
21497
|
-
id:
|
|
21599
|
+
id: randomUUID4(),
|
|
21498
21600
|
tenantId: input.tenantId,
|
|
21499
21601
|
menuTarget: input.menuTarget,
|
|
21500
21602
|
group: input.group,
|
|
@@ -34153,6 +34255,7 @@ export {
|
|
|
34153
34255
|
HumanMessage6 as HumanMessage,
|
|
34154
34256
|
IdRemapper,
|
|
34155
34257
|
InMemoryA2AApiKeyStore,
|
|
34258
|
+
InMemoryAgentWebAppStore,
|
|
34156
34259
|
InMemoryAssistantStore,
|
|
34157
34260
|
InMemoryBindingStore,
|
|
34158
34261
|
InMemoryChannelInstallationStore,
|