@axiom-lattice/gateway 2.1.112 → 2.1.114

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
@@ -281,6 +281,20 @@ var createRun = async (request, reply) => {
281
281
  project_id,
282
282
  custom_run_config: mergedConfig
283
283
  });
284
+ if (background) {
285
+ const messageInput = message_id ? { ...input, id: message_id } : input;
286
+ const result = await agent.addMessage({
287
+ input: messageInput,
288
+ command,
289
+ custom_run_config: mergedConfig
290
+ }, mode);
291
+ reply.status(202).send({
292
+ success: true,
293
+ messageId: result.messageId,
294
+ queued: true
295
+ });
296
+ return;
297
+ }
284
298
  if (streaming) {
285
299
  reply.hijack();
286
300
  reply.raw.writeHead(200, {
@@ -366,8 +380,13 @@ var resumeStream = async (request, reply) => {
366
380
  workspace_id,
367
381
  project_id
368
382
  });
369
- const stream = agent.chunkStream(message_id, [MessageChunkTypes.THREAD_IDLE]);
383
+ const stream = agent.chunkStream(message_id, []);
384
+ let closed = false;
385
+ request.raw.on("close", () => {
386
+ closed = true;
387
+ });
370
388
  for await (const chunk of stream) {
389
+ if (closed || reply.raw.destroyed) break;
371
390
  reply.raw.write(`data: ${JSON.stringify(chunk)}
372
391
 
373
392
  `);
@@ -3012,6 +3031,334 @@ async function completeTask(request, reply) {
3012
3031
  }
3013
3032
  }
3014
3033
 
3034
+ // src/services/ExportImportService.ts
3035
+ import { ExportableEntityRegistry, DependencyResolver, IdRemapper } from "@axiom-lattice/core";
3036
+ import { randomUUID as randomUUID4 } from "crypto";
3037
+ var exportJobs = /* @__PURE__ */ new Map();
3038
+ var JOB_TTL_MS = 60 * 60 * 1e3;
3039
+ function cleanExpiredJobs() {
3040
+ const now = Date.now();
3041
+ for (const [id, entry] of exportJobs) {
3042
+ if (now - entry.createdAt > JOB_TTL_MS) {
3043
+ exportJobs.delete(id);
3044
+ }
3045
+ }
3046
+ }
3047
+ var ExportImportService = class {
3048
+ constructor() {
3049
+ this.registry = ExportableEntityRegistry.getInstance();
3050
+ }
3051
+ /**
3052
+ * Preview an export: check which types would be auto-included, which dependencies are missing.
3053
+ */
3054
+ async exportPreview(tenantId, selectedTypes) {
3055
+ const allDefs = this.registry.getAll();
3056
+ const expanded = DependencyResolver.expandCascade(allDefs, selectedTypes);
3057
+ const cascadeAdditions = expanded.filter((t) => !selectedTypes.includes(t));
3058
+ const deps = DependencyResolver.computeDependencies(allDefs, expanded);
3059
+ const registeredTypes = new Set(allDefs.map((d) => d.entityType));
3060
+ const missingDependencies = deps.missing.filter((t) => registeredTypes.has(t));
3061
+ return { missingDependencies, cascadeAdditions };
3062
+ }
3063
+ /**
3064
+ * Generate a full ExportBundle for the given tenant and entity types.
3065
+ * Stores the bundle in-memory and returns a jobId for download.
3066
+ */
3067
+ async export(tenantId, entityTypes, entityIds) {
3068
+ const allDefs = this.registry.getAll();
3069
+ const expanded = DependencyResolver.expandCascade(allDefs, entityTypes);
3070
+ const finalTypes = [.../* @__PURE__ */ new Set([...expanded, ...entityTypes])];
3071
+ const dependencyOrder = DependencyResolver.resolveOrder(
3072
+ finalTypes.map((t) => this.registry.get(t))
3073
+ );
3074
+ const entities = {};
3075
+ let exportCounter = 0;
3076
+ for (const type of dependencyOrder) {
3077
+ const def = this.registry.get(type);
3078
+ let raw = await def.listForExport(tenantId);
3079
+ if (entityIds && entityIds[type] && entityIds[type].length > 0) {
3080
+ const idSet = new Set(entityIds[type]);
3081
+ raw = raw.filter((e) => idSet.has(e.data.id));
3082
+ }
3083
+ entities[type] = raw.map((e) => ({
3084
+ ...e,
3085
+ _exportId: `exp-${type}-${String(++exportCounter).padStart(3, "0")}`,
3086
+ data: this.sanitizeEntityData(e.data)
3087
+ }));
3088
+ }
3089
+ const rawIdToExportId = /* @__PURE__ */ new Map();
3090
+ for (const [, entityList] of Object.entries(entities)) {
3091
+ for (const entity of entityList) {
3092
+ const rawId = entity.data.id;
3093
+ if (rawId) {
3094
+ rawIdToExportId.set(rawId, entity._exportId);
3095
+ }
3096
+ }
3097
+ }
3098
+ for (const [type, entityList] of Object.entries(entities)) {
3099
+ const def = this.registry.get(type);
3100
+ const refFields = def.referenceFields || {};
3101
+ for (const entity of entityList) {
3102
+ for (const [fieldName, refEntityType] of Object.entries(refFields)) {
3103
+ const rawValue = entity.data[fieldName];
3104
+ if (typeof rawValue === "string" && rawValue) {
3105
+ const exportId = rawIdToExportId.get(rawValue);
3106
+ if (exportId) {
3107
+ entity.data[fieldName] = `@${refEntityType}/${exportId}`;
3108
+ }
3109
+ }
3110
+ }
3111
+ }
3112
+ }
3113
+ const bundle = {
3114
+ version: 1,
3115
+ exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
3116
+ sourceTenantId: tenantId,
3117
+ entities,
3118
+ dependencyOrder,
3119
+ _warning: "This file contains plaintext secrets (passwords, API keys, tokens). Store it securely and delete after import."
3120
+ };
3121
+ const jobId = randomUUID4();
3122
+ exportJobs.set(jobId, { bundle, tenantId, createdAt: Date.now() });
3123
+ return { jobId, bundle };
3124
+ }
3125
+ /**
3126
+ * Retrieve a previously generated export bundle by jobId with tenant validation.
3127
+ */
3128
+ getExportJob(jobId, tenantId) {
3129
+ cleanExpiredJobs();
3130
+ const entry = exportJobs.get(jobId);
3131
+ if (!entry || entry.tenantId !== tenantId) return void 0;
3132
+ return entry.bundle;
3133
+ }
3134
+ /**
3135
+ * Preview import: validate bundle and detect conflicts.
3136
+ */
3137
+ async previewImport(tenantId, bundle) {
3138
+ this.validateBundle(bundle);
3139
+ const allConflicts = [];
3140
+ const allInsertions = [];
3141
+ const allErrors = [];
3142
+ for (const [entityType, entities] of Object.entries(bundle.entities)) {
3143
+ if (entities.length === 0) continue;
3144
+ try {
3145
+ const def = this.registry.get(entityType);
3146
+ const result = await def.previewImport(tenantId, entities);
3147
+ allConflicts.push(...result.conflicts);
3148
+ allInsertions.push(...result.insertions);
3149
+ allErrors.push(...result.errors);
3150
+ } catch (err) {
3151
+ for (const entity of entities) {
3152
+ allErrors.push({
3153
+ _exportId: entity._exportId,
3154
+ entityType,
3155
+ error: `Preview failed: ${err.message}`
3156
+ });
3157
+ }
3158
+ }
3159
+ }
3160
+ return { conflicts: allConflicts, insertions: allInsertions, errors: allErrors };
3161
+ }
3162
+ /**
3163
+ * Apply import: create entities in dependency order with ID remapping.
3164
+ */
3165
+ async applyImport(tenantId, bundle, resolutions) {
3166
+ this.validateBundle(bundle);
3167
+ const results = [];
3168
+ const idMap = {};
3169
+ const skillIdRemap = {};
3170
+ for (const entityType of bundle.dependencyOrder) {
3171
+ const entities = bundle.entities[entityType];
3172
+ if (!entities || entities.length === 0) continue;
3173
+ const def = this.registry.get(entityType);
3174
+ const remapper = new IdRemapper(idMap);
3175
+ for (const entity of entities) {
3176
+ const resolution = resolutions[entity._exportId];
3177
+ if (resolution?.action === "skip") {
3178
+ results.push({ _exportId: entity._exportId, entityType, status: "skipped" });
3179
+ continue;
3180
+ }
3181
+ try {
3182
+ const remappedData = remapper.remapReferences(entity.data);
3183
+ if (entityType === "agent" && Object.keys(skillIdRemap).length > 0) {
3184
+ const skillRemapper = new IdRemapper({});
3185
+ remappedData.graphDefinition = skillRemapper.remapSkillIds(
3186
+ remappedData.graphDefinition || {},
3187
+ skillIdRemap
3188
+ );
3189
+ }
3190
+ if (resolution?.action === "rename" && resolution.newId) {
3191
+ remappedData.id = resolution.newId;
3192
+ }
3193
+ const entityWithRemappedData = { ...entity, data: remappedData };
3194
+ const { newId } = await def.applyImport(
3195
+ tenantId,
3196
+ entityWithRemappedData,
3197
+ resolution ?? { _exportId: entity._exportId, action: "overwrite" }
3198
+ );
3199
+ if (newId) {
3200
+ idMap[entity._exportId] = newId;
3201
+ if (entityType === "skill" && newId) {
3202
+ const oldSkillId = remappedData.id;
3203
+ if (oldSkillId !== newId) {
3204
+ skillIdRemap[oldSkillId] = newId;
3205
+ }
3206
+ }
3207
+ results.push({
3208
+ _exportId: entity._exportId,
3209
+ entityType,
3210
+ status: resolution?.action === "overwrite" ? "updated" : "created",
3211
+ newId
3212
+ });
3213
+ }
3214
+ } catch (err) {
3215
+ results.push({
3216
+ _exportId: entity._exportId,
3217
+ entityType,
3218
+ status: "failed",
3219
+ error: err.message
3220
+ });
3221
+ }
3222
+ }
3223
+ }
3224
+ return { results, idMap };
3225
+ }
3226
+ /**
3227
+ * List all registered exportable types (for frontend).
3228
+ */
3229
+ listExportableTypes() {
3230
+ return this.registry.listTypes();
3231
+ }
3232
+ validateBundle(bundle) {
3233
+ if (bundle.version !== 1) {
3234
+ throw new Error(`Unsupported bundle version: ${bundle.version}. Expected: 1`);
3235
+ }
3236
+ if (!bundle.entities || typeof bundle.entities !== "object") {
3237
+ throw new Error("Invalid bundle: missing entities");
3238
+ }
3239
+ if (!Array.isArray(bundle.dependencyOrder)) {
3240
+ throw new Error("Invalid bundle: missing dependencyOrder");
3241
+ }
3242
+ }
3243
+ sanitizeEntityData(data) {
3244
+ const sanitized = { ...data };
3245
+ delete sanitized.tenantId;
3246
+ delete sanitized.createdAt;
3247
+ delete sanitized.updatedAt;
3248
+ return sanitized;
3249
+ }
3250
+ };
3251
+
3252
+ // src/controllers/export-import.ts
3253
+ import { ExportableEntityRegistry as ExportableEntityRegistry2 } from "@axiom-lattice/core";
3254
+ var service = new ExportImportService();
3255
+ function getTenantId10(request) {
3256
+ return request.user?.tenantId || request.headers["x-tenant-id"] || "default";
3257
+ }
3258
+ async function getExportableTypes(_request, reply) {
3259
+ const types = service.listExportableTypes();
3260
+ return reply.send({ success: true, data: types });
3261
+ }
3262
+ async function exportConfig(request, reply) {
3263
+ const tenantId = getTenantId10(request) || request.params.tenantId;
3264
+ const { entityTypes, entityIds } = request.body;
3265
+ if (!Array.isArray(entityTypes) || entityTypes.length === 0) {
3266
+ return reply.status(400).send({ success: false, message: "entityTypes must be a non-empty array" });
3267
+ }
3268
+ const preview = await service.exportPreview(tenantId, entityTypes);
3269
+ if (preview.missingDependencies.length > 0 || preview.cascadeAdditions.length > 0) {
3270
+ return reply.send({
3271
+ success: true,
3272
+ data: {
3273
+ needsConfirmation: true,
3274
+ missingDependencies: preview.missingDependencies,
3275
+ cascadeAdditions: preview.cascadeAdditions
3276
+ }
3277
+ });
3278
+ }
3279
+ const { jobId, bundle } = await service.export(tenantId, entityTypes, entityIds);
3280
+ return reply.send({
3281
+ success: true,
3282
+ data: {
3283
+ jobId,
3284
+ summary: Object.fromEntries(
3285
+ Object.entries(bundle.entities).map(([type, entities]) => [type, entities.length])
3286
+ )
3287
+ }
3288
+ });
3289
+ }
3290
+ async function exportConfigConfirm(request, reply) {
3291
+ const tenantId = getTenantId10(request) || request.params.tenantId;
3292
+ const { entityTypes, entityIds } = request.body;
3293
+ const { jobId, bundle } = await service.export(tenantId, entityTypes, entityIds);
3294
+ return reply.send({
3295
+ success: true,
3296
+ data: {
3297
+ jobId,
3298
+ summary: Object.fromEntries(
3299
+ Object.entries(bundle.entities).map(([type, entities]) => [type, entities.length])
3300
+ )
3301
+ }
3302
+ });
3303
+ }
3304
+ async function previewEntities(request, reply) {
3305
+ const tenantId = getTenantId10(request) || request.params.tenantId;
3306
+ const { entityTypes } = request.body;
3307
+ try {
3308
+ const registry = ExportableEntityRegistry2.getInstance();
3309
+ const result = {};
3310
+ for (const type of entityTypes) {
3311
+ const def = registry.get(type);
3312
+ const entities = await def.listForExport(tenantId);
3313
+ result[type] = entities.map((e) => ({
3314
+ id: e.data.id,
3315
+ name: e.data.name || e.data.id,
3316
+ description: e.data.description
3317
+ }));
3318
+ }
3319
+ return reply.send({ success: true, data: result });
3320
+ } catch (err) {
3321
+ return reply.status(400).send({ success: false, message: err.message });
3322
+ }
3323
+ }
3324
+ async function downloadExport(request, reply) {
3325
+ const tenantId = getTenantId10(request) || request.params.tenantId;
3326
+ const bundle = service.getExportJob(request.params.jobId, tenantId);
3327
+ if (!bundle) {
3328
+ return reply.status(404).send({ success: false, message: "Export job not found or expired" });
3329
+ }
3330
+ return reply.header("Content-Type", "application/json").header("Content-Disposition", `attachment; filename="tenant-export-${bundle.sourceTenantId}.json"`).send({ success: true, data: bundle });
3331
+ }
3332
+ async function importPreview(request, reply) {
3333
+ const tenantId = getTenantId10(request) || request.params.tenantId;
3334
+ const { bundle } = request.body;
3335
+ if (!bundle) {
3336
+ return reply.status(400).send({ success: false, message: "No bundle provided in request body" });
3337
+ }
3338
+ try {
3339
+ const preview = await service.previewImport(tenantId, bundle);
3340
+ return reply.send({ success: true, data: preview });
3341
+ } catch (err) {
3342
+ return reply.status(400).send({
3343
+ success: false,
3344
+ message: `Invalid export file: ${err.message}`
3345
+ });
3346
+ }
3347
+ }
3348
+ async function importApply(request, reply) {
3349
+ const tenantId = getTenantId10(request) || request.params.tenantId;
3350
+ try {
3351
+ const { bundle, resolutions } = request.body;
3352
+ const result = await service.applyImport(tenantId, bundle, resolutions);
3353
+ return reply.send({ success: true, data: result });
3354
+ } catch (err) {
3355
+ return reply.status(400).send({
3356
+ success: false,
3357
+ message: `Import failed: ${err.message}`
3358
+ });
3359
+ }
3360
+ }
3361
+
3015
3362
  // src/controllers/middleware-types.ts
3016
3363
  import { PluginRegistry } from "@axiom-lattice/core";
3017
3364
  function middlewareTypesRoutes(fastify2) {
@@ -4081,7 +4428,7 @@ var WorkspaceController = class {
4081
4428
  async uploadFile(request, reply) {
4082
4429
  const tenantId = this.getTenantId(request);
4083
4430
  const { workspaceId, projectId } = request.params;
4084
- const assistantId = request.query.assistantId;
4431
+ const assistantId = request.query.assistantId || request.headers["x-assistant-id"];
4085
4432
  const workspace = await this.workspaceStore.getWorkspaceById(
4086
4433
  tenantId,
4087
4434
  workspaceId
@@ -4115,6 +4462,8 @@ var WorkspaceController = class {
4115
4462
  const volumeBackend = await sandboxManager.getVolumeBackendForPath(volumeConfig, realPath);
4116
4463
  if (volumeBackend && !isBinary) {
4117
4464
  await volumeBackend.write(realPath, buffer.toString("utf-8"));
4465
+ } else if (volumeBackend && volumeBackend.writeBinary) {
4466
+ await volumeBackend.writeBinary(realPath, buffer);
4118
4467
  } else {
4119
4468
  const sandbox = await sandboxManager.getSandboxFromConfig(volumeConfig);
4120
4469
  await sandbox.file.uploadFile({ file: realPath, data: buffer });
@@ -4214,8 +4563,8 @@ import {
4214
4563
  getStoreLattice as getStoreLattice8,
4215
4564
  sqlDatabaseManager
4216
4565
  } from "@axiom-lattice/core";
4217
- import { randomUUID as randomUUID4 } from "crypto";
4218
- function getTenantId10(request) {
4566
+ import { randomUUID as randomUUID5 } from "crypto";
4567
+ function getTenantId11(request) {
4219
4568
  const userTenantId = request.user?.tenantId;
4220
4569
  if (userTenantId) {
4221
4570
  return userTenantId;
@@ -4223,7 +4572,7 @@ function getTenantId10(request) {
4223
4572
  return request.headers["x-tenant-id"] || "default";
4224
4573
  }
4225
4574
  async function getDatabaseConfigList(request, reply) {
4226
- const tenantId = getTenantId10(request);
4575
+ const tenantId = getTenantId11(request);
4227
4576
  try {
4228
4577
  const storeLattice = getStoreLattice8("default", "database");
4229
4578
  const store = storeLattice.store;
@@ -4253,7 +4602,7 @@ async function getDatabaseConfigList(request, reply) {
4253
4602
  }
4254
4603
  }
4255
4604
  async function getDatabaseConfig(request, reply) {
4256
- const tenantId = getTenantId10(request);
4605
+ const tenantId = getTenantId11(request);
4257
4606
  const { key } = request.params;
4258
4607
  try {
4259
4608
  const storeLattice = getStoreLattice8("default", "database");
@@ -4279,7 +4628,7 @@ async function getDatabaseConfig(request, reply) {
4279
4628
  }
4280
4629
  }
4281
4630
  async function createDatabaseConfig(request, reply) {
4282
- const tenantId = getTenantId10(request);
4631
+ const tenantId = getTenantId11(request);
4283
4632
  const body = request.body;
4284
4633
  try {
4285
4634
  const storeLattice = getStoreLattice8("default", "database");
@@ -4292,7 +4641,7 @@ async function createDatabaseConfig(request, reply) {
4292
4641
  message: "Database configuration with this key already exists"
4293
4642
  };
4294
4643
  }
4295
- const id = body.id || randomUUID4();
4644
+ const id = body.id || randomUUID5();
4296
4645
  const config = await store.createConfig(tenantId, id, body);
4297
4646
  try {
4298
4647
  sqlDatabaseManager.registerDatabase(tenantId, config.key, config.config);
@@ -4314,7 +4663,7 @@ async function createDatabaseConfig(request, reply) {
4314
4663
  }
4315
4664
  }
4316
4665
  async function updateDatabaseConfig(request, reply) {
4317
- const tenantId = getTenantId10(request);
4666
+ const tenantId = getTenantId11(request);
4318
4667
  const { key } = request.params;
4319
4668
  const updates = request.body;
4320
4669
  try {
@@ -4356,7 +4705,7 @@ async function updateDatabaseConfig(request, reply) {
4356
4705
  }
4357
4706
  }
4358
4707
  async function deleteDatabaseConfig(request, reply) {
4359
- const tenantId = getTenantId10(request);
4708
+ const tenantId = getTenantId11(request);
4360
4709
  const { keyOrId } = request.params;
4361
4710
  try {
4362
4711
  const storeLattice = getStoreLattice8("default", "database");
@@ -4405,7 +4754,7 @@ async function deleteDatabaseConfig(request, reply) {
4405
4754
  }
4406
4755
  }
4407
4756
  async function testDatabaseConnection(request, reply) {
4408
- const tenantId = getTenantId10(request);
4757
+ const tenantId = getTenantId11(request);
4409
4758
  const { key } = request.params;
4410
4759
  try {
4411
4760
  const storeLattice = getStoreLattice8("default", "database");
@@ -4497,8 +4846,8 @@ import {
4497
4846
  metricsServerManager as metricsServerManager2,
4498
4847
  SemanticMetricsClient as SemanticMetricsClient2
4499
4848
  } from "@axiom-lattice/core";
4500
- import { randomUUID as randomUUID5 } from "crypto";
4501
- function getTenantId11(request) {
4849
+ import { randomUUID as randomUUID6 } from "crypto";
4850
+ function getTenantId12(request) {
4502
4851
  const userTenantId = request.user?.tenantId;
4503
4852
  if (userTenantId) {
4504
4853
  return userTenantId;
@@ -4506,7 +4855,7 @@ function getTenantId11(request) {
4506
4855
  return request.headers["x-tenant-id"] || "default";
4507
4856
  }
4508
4857
  async function getMetricsServerConfigList(request, reply) {
4509
- const tenantId = getTenantId11(request);
4858
+ const tenantId = getTenantId12(request);
4510
4859
  try {
4511
4860
  const storeLattice = getStoreLattice9("default", "metrics");
4512
4861
  const store = storeLattice.store;
@@ -4532,7 +4881,7 @@ async function getMetricsServerConfigList(request, reply) {
4532
4881
  }
4533
4882
  }
4534
4883
  async function getMetricsServerConfig(request, reply) {
4535
- const tenantId = getTenantId11(request);
4884
+ const tenantId = getTenantId12(request);
4536
4885
  const { key } = request.params;
4537
4886
  try {
4538
4887
  const storeLattice = getStoreLattice9("default", "metrics");
@@ -4558,7 +4907,7 @@ async function getMetricsServerConfig(request, reply) {
4558
4907
  }
4559
4908
  }
4560
4909
  async function createMetricsServerConfig(request, reply) {
4561
- const tenantId = getTenantId11(request);
4910
+ const tenantId = getTenantId12(request);
4562
4911
  const body = request.body;
4563
4912
  try {
4564
4913
  const storeLattice = getStoreLattice9("default", "metrics");
@@ -4578,7 +4927,7 @@ async function createMetricsServerConfig(request, reply) {
4578
4927
  message: "selectedDataSources is required for semantic metrics servers"
4579
4928
  };
4580
4929
  }
4581
- const id = body.id || randomUUID5();
4930
+ const id = body.id || randomUUID6();
4582
4931
  const configData = {
4583
4932
  key: body.key,
4584
4933
  name: body.name,
@@ -4609,7 +4958,7 @@ async function createMetricsServerConfig(request, reply) {
4609
4958
  }
4610
4959
  }
4611
4960
  async function updateMetricsServerConfig(request, reply) {
4612
- const tenantId = getTenantId11(request);
4961
+ const tenantId = getTenantId12(request);
4613
4962
  const { key } = request.params;
4614
4963
  const updates = request.body;
4615
4964
  try {
@@ -4660,7 +5009,7 @@ async function updateMetricsServerConfig(request, reply) {
4660
5009
  }
4661
5010
  }
4662
5011
  async function deleteMetricsServerConfig(request, reply) {
4663
- const tenantId = getTenantId11(request);
5012
+ const tenantId = getTenantId12(request);
4664
5013
  const { keyOrId } = request.params;
4665
5014
  try {
4666
5015
  const storeLattice = getStoreLattice9("default", "metrics");
@@ -4707,7 +5056,7 @@ async function deleteMetricsServerConfig(request, reply) {
4707
5056
  }
4708
5057
  }
4709
5058
  async function testMetricsServerConnection(request, reply) {
4710
- const tenantId = getTenantId11(request);
5059
+ const tenantId = getTenantId12(request);
4711
5060
  const { key } = request.params;
4712
5061
  try {
4713
5062
  const storeLattice = getStoreLattice9("default", "metrics");
@@ -4758,7 +5107,7 @@ async function testMetricsServerConnection(request, reply) {
4758
5107
  }
4759
5108
  }
4760
5109
  async function listAvailableMetrics(request, reply) {
4761
- const tenantId = getTenantId11(request);
5110
+ const tenantId = getTenantId12(request);
4762
5111
  const { key } = request.params;
4763
5112
  try {
4764
5113
  const storeLattice = getStoreLattice9("default", "metrics");
@@ -4796,7 +5145,7 @@ async function listAvailableMetrics(request, reply) {
4796
5145
  }
4797
5146
  }
4798
5147
  async function queryMetricsData(request, reply) {
4799
- const tenantId = getTenantId11(request);
5148
+ const tenantId = getTenantId12(request);
4800
5149
  const { key } = request.params;
4801
5150
  const { metricName, startTime, endTime, step, labels } = request.body;
4802
5151
  try {
@@ -4844,7 +5193,7 @@ async function queryMetricsData(request, reply) {
4844
5193
  }
4845
5194
  }
4846
5195
  async function getDataSources(request, reply) {
4847
- const tenantId = getTenantId11(request);
5196
+ const tenantId = getTenantId12(request);
4848
5197
  const { key } = request.params;
4849
5198
  try {
4850
5199
  const storeLattice = getStoreLattice9("default", "metrics");
@@ -4885,7 +5234,7 @@ async function getDataSources(request, reply) {
4885
5234
  }
4886
5235
  }
4887
5236
  async function getDatasourceMetrics(request, reply) {
4888
- const tenantId = getTenantId11(request);
5237
+ const tenantId = getTenantId12(request);
4889
5238
  const { key, datasourceId } = request.params;
4890
5239
  try {
4891
5240
  const storeLattice = getStoreLattice9("default", "metrics");
@@ -4922,7 +5271,7 @@ async function getDatasourceMetrics(request, reply) {
4922
5271
  }
4923
5272
  }
4924
5273
  async function querySemanticMetrics(request, reply) {
4925
- const tenantId = getTenantId11(request);
5274
+ const tenantId = getTenantId12(request);
4926
5275
  const { key } = request.params;
4927
5276
  const body = request.body;
4928
5277
  try {
@@ -5430,7 +5779,7 @@ var EvalRunner = class {
5430
5779
  var evalRunner = new EvalRunner();
5431
5780
 
5432
5781
  // src/controllers/eval.ts
5433
- function getTenantId12(request) {
5782
+ function getTenantId13(request) {
5434
5783
  const userTenantId = request.user?.tenantId;
5435
5784
  if (userTenantId) {
5436
5785
  return userTenantId;
@@ -5442,7 +5791,7 @@ function getEvalStore() {
5442
5791
  }
5443
5792
  async function createProject(request, reply) {
5444
5793
  try {
5445
- const tenantId = getTenantId12(request);
5794
+ const tenantId = getTenantId13(request);
5446
5795
  const store = getEvalStore();
5447
5796
  const id = uuidv44();
5448
5797
  const data = request.body;
@@ -5482,7 +5831,7 @@ async function createProject(request, reply) {
5482
5831
  }
5483
5832
  async function listProjects(request, reply) {
5484
5833
  try {
5485
- const tenantId = getTenantId12(request);
5834
+ const tenantId = getTenantId13(request);
5486
5835
  const store = getEvalStore();
5487
5836
  let projects = await store.getProjectsByTenant(tenantId);
5488
5837
  if (projects.length === 0) {
@@ -5516,7 +5865,7 @@ async function listProjects(request, reply) {
5516
5865
  }
5517
5866
  async function getProject(request, reply) {
5518
5867
  try {
5519
- const tenantId = getTenantId12(request);
5868
+ const tenantId = getTenantId13(request);
5520
5869
  const store = getEvalStore();
5521
5870
  const { pid } = request.params;
5522
5871
  const project = await store.getProjectById(tenantId, pid);
@@ -5536,7 +5885,7 @@ async function getProject(request, reply) {
5536
5885
  }
5537
5886
  async function updateProject(request, reply) {
5538
5887
  try {
5539
- const tenantId = getTenantId12(request);
5888
+ const tenantId = getTenantId13(request);
5540
5889
  const store = getEvalStore();
5541
5890
  const { pid } = request.params;
5542
5891
  const existing = await store.getProjectById(tenantId, pid);
@@ -5579,7 +5928,7 @@ async function updateProject(request, reply) {
5579
5928
  }
5580
5929
  async function deleteProject(request, reply) {
5581
5930
  try {
5582
- const tenantId = getTenantId12(request);
5931
+ const tenantId = getTenantId13(request);
5583
5932
  const store = getEvalStore();
5584
5933
  const { pid } = request.params;
5585
5934
  const existing = await store.getProjectById(tenantId, pid);
@@ -5598,7 +5947,7 @@ async function deleteProject(request, reply) {
5598
5947
  }
5599
5948
  async function createSuite(request, reply) {
5600
5949
  try {
5601
- const tenantId = getTenantId12(request);
5950
+ const tenantId = getTenantId13(request);
5602
5951
  const store = getEvalStore();
5603
5952
  const { pid } = request.params;
5604
5953
  const project = await store.getProjectById(tenantId, pid);
@@ -5620,7 +5969,7 @@ async function createSuite(request, reply) {
5620
5969
  }
5621
5970
  async function updateSuite(request, reply) {
5622
5971
  try {
5623
- const tenantId = getTenantId12(request);
5972
+ const tenantId = getTenantId13(request);
5624
5973
  const store = getEvalStore();
5625
5974
  const { sid } = request.params;
5626
5975
  const existing = await store.getSuiteById(tenantId, sid);
@@ -5640,7 +5989,7 @@ async function updateSuite(request, reply) {
5640
5989
  }
5641
5990
  async function deleteSuite(request, reply) {
5642
5991
  try {
5643
- const tenantId = getTenantId12(request);
5992
+ const tenantId = getTenantId13(request);
5644
5993
  const store = getEvalStore();
5645
5994
  const { sid } = request.params;
5646
5995
  const existing = await store.getSuiteById(tenantId, sid);
@@ -5659,7 +6008,7 @@ async function deleteSuite(request, reply) {
5659
6008
  }
5660
6009
  async function createCase(request, reply) {
5661
6010
  try {
5662
- const tenantId = getTenantId12(request);
6011
+ const tenantId = getTenantId13(request);
5663
6012
  const store = getEvalStore();
5664
6013
  const { sid } = request.params;
5665
6014
  const suite = await store.getSuiteById(tenantId, sid);
@@ -5688,7 +6037,7 @@ async function createCase(request, reply) {
5688
6037
  }
5689
6038
  async function listCasesForSuite(request, reply) {
5690
6039
  try {
5691
- const tenantId = getTenantId12(request);
6040
+ const tenantId = getTenantId13(request);
5692
6041
  const store = getEvalStore();
5693
6042
  const { sid } = request.params;
5694
6043
  const cases = await store.getCasesBySuite(tenantId, sid);
@@ -5704,7 +6053,7 @@ async function listCasesForSuite(request, reply) {
5704
6053
  }
5705
6054
  async function updateCase(request, reply) {
5706
6055
  try {
5707
- const tenantId = getTenantId12(request);
6056
+ const tenantId = getTenantId13(request);
5708
6057
  const store = getEvalStore();
5709
6058
  const { cid } = request.params;
5710
6059
  const existing = await store.getCaseById(tenantId, cid);
@@ -5724,7 +6073,7 @@ async function updateCase(request, reply) {
5724
6073
  }
5725
6074
  async function deleteCase(request, reply) {
5726
6075
  try {
5727
- const tenantId = getTenantId12(request);
6076
+ const tenantId = getTenantId13(request);
5728
6077
  const store = getEvalStore();
5729
6078
  const { cid } = request.params;
5730
6079
  const existing = await store.getCaseById(tenantId, cid);
@@ -5756,7 +6105,7 @@ function registerEvalRoutes(app2) {
5756
6105
  app2.delete("/api/eval/projects/:pid/suites/:sid/cases/:cid", deleteCase);
5757
6106
  app2.post("/api/eval/projects/:pid/runs", async (request, reply) => {
5758
6107
  try {
5759
- const tenantId = getTenantId12(request);
6108
+ const tenantId = getTenantId13(request);
5760
6109
  const { pid } = request.params;
5761
6110
  const runId = await evalRunner.startRun(tenantId, pid);
5762
6111
  reply.status(202).send({ success: true, message: "Run started", data: { run_id: runId } });
@@ -5768,7 +6117,7 @@ function registerEvalRoutes(app2) {
5768
6117
  });
5769
6118
  app2.get("/api/eval/runs", async (request, reply) => {
5770
6119
  try {
5771
- const tenantId = getTenantId12(request);
6120
+ const tenantId = getTenantId13(request);
5772
6121
  const query = request.query;
5773
6122
  const runs = await getEvalStore().getRunsByTenant(tenantId, { projectId: query.project_id, status: query.status });
5774
6123
  reply.send({ success: true, message: "Ok", data: { records: runs, total: runs.length } });
@@ -5778,7 +6127,7 @@ function registerEvalRoutes(app2) {
5778
6127
  });
5779
6128
  app2.get("/api/eval/runs/:rid", async (request, reply) => {
5780
6129
  try {
5781
- const tenantId = getTenantId12(request);
6130
+ const tenantId = getTenantId13(request);
5782
6131
  const { rid } = request.params;
5783
6132
  const run = await getEvalStore().getRunById(tenantId, rid);
5784
6133
  if (!run) return reply.status(404).send({ success: false, message: "Run not found" });
@@ -5800,7 +6149,7 @@ function registerEvalRoutes(app2) {
5800
6149
  const emitter = evalRunner.getEventEmitter();
5801
6150
  const eventKey = `run:${rid}`;
5802
6151
  if (!evalRunner.isRunning(rid)) {
5803
- const tenantId = getTenantId12(request);
6152
+ const tenantId = getTenantId13(request);
5804
6153
  const run = await getEvalStore().getRunById(tenantId, rid);
5805
6154
  if (run) {
5806
6155
  const eventType = run.status === "completed" ? "completed" : "error";
@@ -5839,7 +6188,7 @@ data: ${JSON.stringify(event.data)}
5839
6188
  });
5840
6189
  app2.delete("/api/eval/runs/:rid", async (request, reply) => {
5841
6190
  try {
5842
- const tenantId = getTenantId12(request);
6191
+ const tenantId = getTenantId13(request);
5843
6192
  const { rid } = request.params;
5844
6193
  const deleted = await getEvalStore().deleteRun(tenantId, rid);
5845
6194
  if (!deleted) return reply.status(404).send({ success: false, message: "Run not found" });
@@ -5850,7 +6199,7 @@ data: ${JSON.stringify(event.data)}
5850
6199
  });
5851
6200
  app2.get("/api/eval/reports/projects/:pid", async (request, reply) => {
5852
6201
  try {
5853
- const tenantId = getTenantId12(request);
6202
+ const tenantId = getTenantId13(request);
5854
6203
  const { pid } = request.params;
5855
6204
  const report = await getEvalStore().getProjectReport(tenantId, pid);
5856
6205
  if (!report) return reply.status(404).send({ success: false, message: "Project not found" });
@@ -6728,14 +7077,14 @@ function registerChannelRoutes(app2, dependencies) {
6728
7077
  }
6729
7078
 
6730
7079
  // src/controllers/channel-installations.ts
6731
- import { randomUUID as randomUUID6 } from "crypto";
7080
+ import { randomUUID as randomUUID7 } from "crypto";
6732
7081
  var _adapterRegistry;
6733
7082
  var _router;
6734
7083
  function setChannelControllerDeps(deps) {
6735
7084
  _adapterRegistry = deps.adapterRegistry;
6736
7085
  _router = deps.router;
6737
7086
  }
6738
- function getTenantId13(request) {
7087
+ function getTenantId14(request) {
6739
7088
  const userTenantId = request.user?.tenantId;
6740
7089
  if (userTenantId) {
6741
7090
  return userTenantId;
@@ -6743,8 +7092,8 @@ function getTenantId13(request) {
6743
7092
  return request.headers["x-tenant-id"] || "default";
6744
7093
  }
6745
7094
  async function getInstallationStore() {
6746
- const { getStoreLattice: getStoreLattice17 } = await import("@axiom-lattice/core");
6747
- const store = getStoreLattice17("default", "channelInstallation").store;
7095
+ const { getStoreLattice: getStoreLattice30 } = await import("@axiom-lattice/core");
7096
+ const store = getStoreLattice30("default", "channelInstallation").store;
6748
7097
  if (store) return store;
6749
7098
  const { PostgreSQLChannelInstallationStore } = await import("@axiom-lattice/pg-stores");
6750
7099
  const databaseUrl = process.env.DATABASE_URL;
@@ -6756,7 +7105,7 @@ async function getInstallationStore() {
6756
7105
  });
6757
7106
  }
6758
7107
  async function getChannelInstallationList(request, reply) {
6759
- const tenantId = getTenantId13(request);
7108
+ const tenantId = getTenantId14(request);
6760
7109
  const { channel } = request.query;
6761
7110
  try {
6762
7111
  const store = await getInstallationStore();
@@ -6782,7 +7131,7 @@ async function getChannelInstallationList(request, reply) {
6782
7131
  }
6783
7132
  }
6784
7133
  async function getChannelInstallation(request, reply) {
6785
- const tenantId = getTenantId13(request);
7134
+ const tenantId = getTenantId14(request);
6786
7135
  const { installationId } = request.params;
6787
7136
  try {
6788
7137
  const store = await getInstallationStore();
@@ -6815,7 +7164,7 @@ async function getChannelInstallation(request, reply) {
6815
7164
  }
6816
7165
  }
6817
7166
  async function createChannelInstallation(request, reply) {
6818
- const tenantId = getTenantId13(request);
7167
+ const tenantId = getTenantId14(request);
6819
7168
  const body = request.body;
6820
7169
  try {
6821
7170
  if (!body.channel) {
@@ -6850,7 +7199,7 @@ async function createChannelInstallation(request, reply) {
6850
7199
  }
6851
7200
  }
6852
7201
  const store = await getInstallationStore();
6853
- const installationId = body.id || randomUUID6();
7202
+ const installationId = body.id || randomUUID7();
6854
7203
  const installation = await store.createInstallation(
6855
7204
  tenantId,
6856
7205
  installationId,
@@ -6888,7 +7237,7 @@ async function createChannelInstallation(request, reply) {
6888
7237
  }
6889
7238
  }
6890
7239
  async function updateChannelInstallation(request, reply) {
6891
- const tenantId = getTenantId13(request);
7240
+ const tenantId = getTenantId14(request);
6892
7241
  const { installationId } = request.params;
6893
7242
  const body = request.body;
6894
7243
  try {
@@ -6942,7 +7291,7 @@ async function updateChannelInstallation(request, reply) {
6942
7291
  }
6943
7292
  }
6944
7293
  async function deleteChannelInstallation(request, reply) {
6945
- const tenantId = getTenantId13(request);
7294
+ const tenantId = getTenantId14(request);
6946
7295
  const { installationId } = request.params;
6947
7296
  try {
6948
7297
  const store = await getInstallationStore();
@@ -7003,13 +7352,13 @@ function registerChannelInstallationRoutes(app2) {
7003
7352
 
7004
7353
  // src/controllers/channel-bindings.ts
7005
7354
  import { getBindingRegistry } from "@axiom-lattice/core";
7006
- function getTenantId14(request) {
7355
+ function getTenantId15(request) {
7007
7356
  const userTenantId = request.user?.tenantId;
7008
7357
  if (userTenantId) return userTenantId;
7009
7358
  return request.headers["x-tenant-id"] || "default";
7010
7359
  }
7011
7360
  async function getBindingList(request, _reply) {
7012
- const tenantId = getTenantId14(request);
7361
+ const tenantId = getTenantId15(request);
7013
7362
  const { channel, agentId, channelInstallationId, limit, offset } = request.query;
7014
7363
  try {
7015
7364
  const registry = getBindingRegistry();
@@ -7021,7 +7370,7 @@ async function getBindingList(request, _reply) {
7021
7370
  }
7022
7371
  }
7023
7372
  async function getBinding(request, reply) {
7024
- const tenantId = getTenantId14(request);
7373
+ const tenantId = getTenantId15(request);
7025
7374
  try {
7026
7375
  const registry = getBindingRegistry();
7027
7376
  const bindings = await registry.list({ tenantId });
@@ -7037,7 +7386,7 @@ async function getBinding(request, reply) {
7037
7386
  }
7038
7387
  }
7039
7388
  async function createBinding(request, reply) {
7040
- const tenantId = getTenantId14(request);
7389
+ const tenantId = getTenantId15(request);
7041
7390
  try {
7042
7391
  const registry = getBindingRegistry();
7043
7392
  const binding = await registry.create({ ...request.body, tenantId });
@@ -7051,7 +7400,7 @@ async function createBinding(request, reply) {
7051
7400
  }
7052
7401
  async function updateBinding(request, reply) {
7053
7402
  try {
7054
- const tenantId = getTenantId14(request);
7403
+ const tenantId = getTenantId15(request);
7055
7404
  const registry = getBindingRegistry();
7056
7405
  const bindings = await registry.list({ tenantId });
7057
7406
  const existing = bindings.find((b) => b.id === request.params.id);
@@ -7069,7 +7418,7 @@ async function updateBinding(request, reply) {
7069
7418
  }
7070
7419
  async function deleteBinding(request, reply) {
7071
7420
  try {
7072
- const tenantId = getTenantId14(request);
7421
+ const tenantId = getTenantId15(request);
7073
7422
  const registry = getBindingRegistry();
7074
7423
  const bindings = await registry.list({ tenantId });
7075
7424
  const existing = bindings.find((b) => b.id === request.params.id);
@@ -7086,7 +7435,7 @@ async function deleteBinding(request, reply) {
7086
7435
  }
7087
7436
  }
7088
7437
  async function resolveBinding(request, _reply) {
7089
- const tenantId = getTenantId14(request);
7438
+ const tenantId = getTenantId15(request);
7090
7439
  const { channel, senderId, channelInstallationId } = request.query;
7091
7440
  try {
7092
7441
  const registry = getBindingRegistry();
@@ -7113,7 +7462,7 @@ function registerChannelBindingRoutes(app2) {
7113
7462
 
7114
7463
  // src/controllers/menu-items.ts
7115
7464
  import { getMenuRegistry } from "@axiom-lattice/core";
7116
- function getTenantId15(request) {
7465
+ function getTenantId16(request) {
7117
7466
  const userTenantId = request.user?.tenantId;
7118
7467
  if (userTenantId) return userTenantId;
7119
7468
  return request.headers["x-tenant-id"] || "default";
@@ -7122,7 +7471,7 @@ function errorMessage(err) {
7122
7471
  return err instanceof Error ? err.message : "Unexpected error";
7123
7472
  }
7124
7473
  async function getMenuItemList(request, _reply) {
7125
- const tenantId = getTenantId15(request);
7474
+ const tenantId = getTenantId16(request);
7126
7475
  try {
7127
7476
  const registry = getMenuRegistry();
7128
7477
  const items = await registry.list({ tenantId, menuTarget: request.query.menuTarget });
@@ -7134,7 +7483,7 @@ async function getMenuItemList(request, _reply) {
7134
7483
  }
7135
7484
  }
7136
7485
  async function getMenuItem(request, reply) {
7137
- const tenantId = getTenantId15(request);
7486
+ const tenantId = getTenantId16(request);
7138
7487
  try {
7139
7488
  const registry = getMenuRegistry();
7140
7489
  const item = await registry.getById(request.params.id);
@@ -7151,7 +7500,7 @@ async function getMenuItem(request, reply) {
7151
7500
  }
7152
7501
  }
7153
7502
  async function createMenuItem(request, reply) {
7154
- const tenantId = getTenantId15(request);
7503
+ const tenantId = getTenantId16(request);
7155
7504
  try {
7156
7505
  const registry = getMenuRegistry();
7157
7506
  const item = await registry.create({ ...request.body, tenantId });
@@ -7166,7 +7515,7 @@ async function createMenuItem(request, reply) {
7166
7515
  }
7167
7516
  async function updateMenuItem(request, reply) {
7168
7517
  try {
7169
- const tenantId = getTenantId15(request);
7518
+ const tenantId = getTenantId16(request);
7170
7519
  const registry = getMenuRegistry();
7171
7520
  const existing = await registry.getById(request.params.id);
7172
7521
  if (!existing || existing.tenantId !== tenantId) {
@@ -7184,7 +7533,7 @@ async function updateMenuItem(request, reply) {
7184
7533
  }
7185
7534
  async function deleteMenuItem(request, reply) {
7186
7535
  try {
7187
- const tenantId = getTenantId15(request);
7536
+ const tenantId = getTenantId16(request);
7188
7537
  const registry = getMenuRegistry();
7189
7538
  const existing = await registry.getById(request.params.id);
7190
7539
  if (!existing || existing.tenantId !== tenantId) {
@@ -7623,6 +7972,31 @@ var registerLatticeRoutes = (app2, channelDeps) => {
7623
7972
  "/api/assistants/:assistant_id/threads/:thread_id/pending-messages/:message_id",
7624
7973
  removePendingMessageHandler
7625
7974
  );
7975
+ app2.get("/api/tenants/exportable-types", getExportableTypes);
7976
+ app2.post(
7977
+ "/api/tenants/:tenantId/export",
7978
+ exportConfig
7979
+ );
7980
+ app2.post(
7981
+ "/api/tenants/:tenantId/export/confirm",
7982
+ exportConfigConfirm
7983
+ );
7984
+ app2.post(
7985
+ "/api/tenants/:tenantId/export/entities",
7986
+ previewEntities
7987
+ );
7988
+ app2.get(
7989
+ "/api/tenants/:tenantId/export/:jobId/download",
7990
+ downloadExport
7991
+ );
7992
+ app2.post(
7993
+ "/api/tenants/:tenantId/import/preview",
7994
+ importPreview
7995
+ );
7996
+ app2.post(
7997
+ "/api/tenants/:tenantId/import/apply",
7998
+ importApply
7999
+ );
7626
8000
  };
7627
8001
 
7628
8002
  // src/routes/resource-routes.ts
@@ -7651,12 +8025,1320 @@ function registerResourceRoutes(app2, controller) {
7651
8025
  app2.delete("/api/resources/share/:token", controller.revokeShare.bind(controller));
7652
8026
  }
7653
8027
 
7654
- // src/router/MessageRouter.ts
7655
- import {
7656
- getStoreLattice as getStoreLattice15,
7657
- agentInstanceManager as agentInstanceManager6
7658
- } from "@axiom-lattice/core";
7659
- import { randomUUID as randomUUID7 } from "crypto";
8028
+ // src/export_registrations/index.ts
8029
+ import { ExportableEntityRegistry as ExportableEntityRegistry3 } from "@axiom-lattice/core";
8030
+
8031
+ // src/export_registrations/skill.registration.ts
8032
+ import { getStoreLattice as getStoreLattice15 } from "@axiom-lattice/core";
8033
+ function getStore2() {
8034
+ return getStoreLattice15("default", "skill").store;
8035
+ }
8036
+ var skillRegistration = {
8037
+ entityType: "skill",
8038
+ label: "Skill(\u6280\u80FD)",
8039
+ category: "core",
8040
+ dependsOn: [],
8041
+ cascadeParents: [],
8042
+ async listForExport(tenantId) {
8043
+ const store = getStore2();
8044
+ const skills = await store.getAllSkills(tenantId);
8045
+ return skills.map((s) => ({
8046
+ _exportId: "",
8047
+ data: {
8048
+ id: s.id,
8049
+ name: s.name,
8050
+ description: s.description,
8051
+ license: s.license,
8052
+ compatibility: s.compatibility,
8053
+ metadata: s.metadata,
8054
+ content: s.content,
8055
+ subSkills: s.subSkills
8056
+ }
8057
+ }));
8058
+ },
8059
+ async previewImport(tenantId, entities) {
8060
+ const store = getStore2();
8061
+ const existing = await store.getAllSkills(tenantId);
8062
+ const existingIds = new Set(existing.map((s) => s.id));
8063
+ const conflicts = [];
8064
+ const insertions = [];
8065
+ for (const entity of entities) {
8066
+ const id = entity.data.id;
8067
+ if (existingIds.has(id)) {
8068
+ conflicts.push({
8069
+ _exportId: entity._exportId,
8070
+ entityType: "skill",
8071
+ conflictType: "id_exists",
8072
+ existingId: id,
8073
+ existingName: entity.data.name || id
8074
+ });
8075
+ } else {
8076
+ insertions.push({
8077
+ _exportId: entity._exportId,
8078
+ entityType: "skill",
8079
+ name: entity.data.name || id
8080
+ });
8081
+ }
8082
+ }
8083
+ return { conflicts, insertions, errors: [] };
8084
+ },
8085
+ async applyImport(tenantId, entity, resolution) {
8086
+ const store = getStore2();
8087
+ const data = entity.data;
8088
+ const id = resolution.action === "rename" && resolution.newId ? resolution.newId : data.id;
8089
+ if (resolution.action === "overwrite") {
8090
+ try {
8091
+ await store.deleteSkill(tenantId, id);
8092
+ } catch {
8093
+ }
8094
+ }
8095
+ await store.createSkill(tenantId, id, {
8096
+ name: data.name,
8097
+ description: data.description,
8098
+ license: data.license,
8099
+ compatibility: data.compatibility,
8100
+ metadata: data.metadata,
8101
+ content: data.content,
8102
+ subSkills: data.subSkills
8103
+ });
8104
+ return { newId: id };
8105
+ }
8106
+ };
8107
+
8108
+ // src/export_registrations/agent.registration.ts
8109
+ import { getStoreLattice as getStoreLattice16 } from "@axiom-lattice/core";
8110
+ function getStore3() {
8111
+ return getStoreLattice16("default", "assistant").store;
8112
+ }
8113
+ var agentRegistration = {
8114
+ entityType: "agent",
8115
+ label: "Agent(\u667A\u80FD\u4F53)",
8116
+ category: "core",
8117
+ dependsOn: ["skill"],
8118
+ cascadeParents: [],
8119
+ async listForExport(tenantId) {
8120
+ const store = getStore3();
8121
+ const agents = await store.getAllAssistants(tenantId);
8122
+ return agents.map((a) => ({
8123
+ _exportId: "",
8124
+ data: {
8125
+ id: a.id,
8126
+ name: a.name,
8127
+ description: a.description,
8128
+ graphDefinition: a.graphDefinition
8129
+ }
8130
+ }));
8131
+ },
8132
+ async previewImport(tenantId, entities) {
8133
+ const store = getStore3();
8134
+ const existing = await store.getAllAssistants(tenantId);
8135
+ const existingIds = new Set(existing.map((a) => a.id));
8136
+ const conflicts = [];
8137
+ const insertions = [];
8138
+ for (const entity of entities) {
8139
+ const id = entity.data.id;
8140
+ if (existingIds.has(id)) {
8141
+ conflicts.push({
8142
+ _exportId: entity._exportId,
8143
+ entityType: "agent",
8144
+ conflictType: "id_exists",
8145
+ existingId: id,
8146
+ existingName: entity.data.name || id
8147
+ });
8148
+ } else {
8149
+ insertions.push({
8150
+ _exportId: entity._exportId,
8151
+ entityType: "agent",
8152
+ name: entity.data.name || id
8153
+ });
8154
+ }
8155
+ }
8156
+ return { conflicts, insertions, errors: [] };
8157
+ },
8158
+ async applyImport(tenantId, entity, resolution) {
8159
+ const store = getStore3();
8160
+ const data = entity.data;
8161
+ const id = resolution.action === "rename" && resolution.newId ? resolution.newId : data.id;
8162
+ if (resolution.action === "overwrite") {
8163
+ try {
8164
+ await store.deleteAssistant(tenantId, id);
8165
+ } catch {
8166
+ }
8167
+ }
8168
+ await store.createAssistant(tenantId, id, {
8169
+ name: data.name,
8170
+ description: data.description || "",
8171
+ graphDefinition: data.graphDefinition
8172
+ });
8173
+ return { newId: id };
8174
+ }
8175
+ };
8176
+
8177
+ // src/export_registrations/binding.registration.ts
8178
+ import { getStoreLattice as getStoreLattice17 } from "@axiom-lattice/core";
8179
+ function getStore4() {
8180
+ return getStoreLattice17("default", "channelBinding").store;
8181
+ }
8182
+ var bindingRegistration = {
8183
+ entityType: "binding",
8184
+ label: "Binding(\u6E20\u9053\u7ED1\u5B9A)",
8185
+ category: "core",
8186
+ dependsOn: ["agent", "channel_installation"],
8187
+ cascadeParents: [],
8188
+ referenceFields: { agentId: "agent", channelInstallationId: "channel_installation" },
8189
+ async listForExport(tenantId) {
8190
+ const store = getStore4();
8191
+ const bindings = await store.list({ tenantId, limit: 1e4, offset: 0 });
8192
+ return bindings.map((b) => ({
8193
+ _exportId: "",
8194
+ data: {
8195
+ channel: b.channel,
8196
+ channelInstallationId: b.channelInstallationId,
8197
+ senderId: b.senderId,
8198
+ agentId: b.agentId,
8199
+ threadId: b.threadId,
8200
+ workspaceId: b.workspaceId,
8201
+ projectId: b.projectId,
8202
+ threadMode: b.threadMode,
8203
+ senderDisplayName: b.senderDisplayName,
8204
+ senderMetadata: b.senderMetadata,
8205
+ enabled: b.enabled
8206
+ }
8207
+ }));
8208
+ },
8209
+ async previewImport(tenantId, entities) {
8210
+ const store = getStore4();
8211
+ const existing = await store.list({ tenantId, limit: 1e4, offset: 0 });
8212
+ const existingKeys = new Set(
8213
+ existing.map((b) => `${b.channel}:${b.channelInstallationId}:${b.senderId}`)
8214
+ );
8215
+ const conflicts = [];
8216
+ const insertions = [];
8217
+ for (const entity of entities) {
8218
+ const d = entity.data;
8219
+ const key = `${d.channel}:${d.channelInstallationId}:${d.senderId}`;
8220
+ if (existingKeys.has(key)) {
8221
+ conflicts.push({
8222
+ _exportId: entity._exportId,
8223
+ entityType: "binding",
8224
+ conflictType: "unique_constraint",
8225
+ existingName: `${d.channel}:${d.senderId}`,
8226
+ field: "channel+channelInstallationId+senderId"
8227
+ });
8228
+ } else {
8229
+ insertions.push({
8230
+ _exportId: entity._exportId,
8231
+ entityType: "binding",
8232
+ name: `${d.channel}:${d.senderId}`
8233
+ });
8234
+ }
8235
+ }
8236
+ return { conflicts, insertions, errors: [] };
8237
+ },
8238
+ async applyImport(tenantId, entity, resolution) {
8239
+ if (resolution.action === "skip") return {};
8240
+ const store = getStore4();
8241
+ const d = entity.data;
8242
+ if (resolution.action === "overwrite") {
8243
+ const existing = await store.list({ tenantId, limit: 1e4, offset: 0 });
8244
+ const match = existing.find(
8245
+ (b) => b.channel === d.channel && b.channelInstallationId === d.channelInstallationId && b.senderId === d.senderId
8246
+ );
8247
+ if (match) {
8248
+ await store.delete(match.id);
8249
+ }
8250
+ }
8251
+ await store.create({
8252
+ channel: d.channel,
8253
+ channelInstallationId: d.channelInstallationId,
8254
+ tenantId,
8255
+ senderId: d.senderId,
8256
+ agentId: d.agentId,
8257
+ threadMode: d.threadMode || "fixed",
8258
+ senderDisplayName: d.senderDisplayName,
8259
+ senderMetadata: d.senderMetadata,
8260
+ workspaceId: d.workspaceId,
8261
+ projectId: d.projectId
8262
+ });
8263
+ return { newId: void 0 };
8264
+ }
8265
+ };
8266
+
8267
+ // src/export_registrations/database-config.registration.ts
8268
+ import { getStoreLattice as getStoreLattice18 } from "@axiom-lattice/core";
8269
+ function getStore5() {
8270
+ return getStoreLattice18("default", "database").store;
8271
+ }
8272
+ var databaseConfigRegistration = {
8273
+ entityType: "database_config",
8274
+ label: "Database Config(\u6570\u636E\u5E93\u914D\u7F6E)",
8275
+ category: "core",
8276
+ dependsOn: [],
8277
+ cascadeParents: [],
8278
+ async listForExport(tenantId) {
8279
+ const store = getStore5();
8280
+ const configs = await store.getAllConfigs(tenantId);
8281
+ return configs.map((c) => ({
8282
+ _exportId: "",
8283
+ data: {
8284
+ id: c.id,
8285
+ key: c.key,
8286
+ name: c.name,
8287
+ description: c.description,
8288
+ config: c.config
8289
+ }
8290
+ }));
8291
+ },
8292
+ async previewImport(tenantId, entities) {
8293
+ const store = getStore5();
8294
+ const existing = await store.getAllConfigs(tenantId);
8295
+ const existingIds = new Set(existing.map((c) => c.id));
8296
+ const existingKeys = new Set(existing.map((c) => c.key));
8297
+ const conflicts = [];
8298
+ const insertions = [];
8299
+ for (const entity of entities) {
8300
+ const d = entity.data;
8301
+ const id = d.id;
8302
+ const key = d.key;
8303
+ if (existingIds.has(id)) {
8304
+ conflicts.push({
8305
+ _exportId: entity._exportId,
8306
+ entityType: "database_config",
8307
+ conflictType: "id_exists",
8308
+ existingId: id,
8309
+ existingName: d.name || key
8310
+ });
8311
+ } else if (key && existingKeys.has(key)) {
8312
+ conflicts.push({
8313
+ _exportId: entity._exportId,
8314
+ entityType: "database_config",
8315
+ conflictType: "unique_constraint",
8316
+ existingName: d.name || key,
8317
+ field: "key"
8318
+ });
8319
+ } else {
8320
+ insertions.push({
8321
+ _exportId: entity._exportId,
8322
+ entityType: "database_config",
8323
+ name: d.name || key
8324
+ });
8325
+ }
8326
+ }
8327
+ return { conflicts, insertions, errors: [] };
8328
+ },
8329
+ async applyImport(tenantId, entity, resolution) {
8330
+ const store = getStore5();
8331
+ const data = entity.data;
8332
+ const id = resolution.action === "rename" && resolution.newId ? resolution.newId : data.id;
8333
+ if (resolution.action === "overwrite") {
8334
+ try {
8335
+ await store.deleteConfig(tenantId, id);
8336
+ } catch {
8337
+ }
8338
+ }
8339
+ await store.createConfig(tenantId, id, {
8340
+ key: data.key,
8341
+ name: data.name,
8342
+ description: data.description,
8343
+ config: data.config
8344
+ });
8345
+ return { newId: id };
8346
+ }
8347
+ };
8348
+
8349
+ // src/export_registrations/metrics-config.registration.ts
8350
+ import { getStoreLattice as getStoreLattice19 } from "@axiom-lattice/core";
8351
+ function getStore6() {
8352
+ return getStoreLattice19("default", "metrics").store;
8353
+ }
8354
+ var metricsConfigRegistration = {
8355
+ entityType: "metrics_config",
8356
+ label: "Metrics Config(\u6307\u6807\u914D\u7F6E)",
8357
+ category: "core",
8358
+ dependsOn: [],
8359
+ cascadeParents: [],
8360
+ async listForExport(tenantId) {
8361
+ const store = getStore6();
8362
+ const configs = await store.getAllConfigs(tenantId);
8363
+ return configs.map((c) => ({
8364
+ _exportId: "",
8365
+ data: {
8366
+ id: c.id,
8367
+ key: c.key,
8368
+ name: c.name,
8369
+ description: c.description,
8370
+ config: c.config
8371
+ }
8372
+ }));
8373
+ },
8374
+ async previewImport(tenantId, entities) {
8375
+ const store = getStore6();
8376
+ const existing = await store.getAllConfigs(tenantId);
8377
+ const existingIds = new Set(existing.map((c) => c.id));
8378
+ const existingKeys = new Set(existing.map((c) => c.key));
8379
+ const conflicts = [];
8380
+ const insertions = [];
8381
+ for (const entity of entities) {
8382
+ const d = entity.data;
8383
+ const id = d.id;
8384
+ const key = d.key;
8385
+ if (existingIds.has(id)) {
8386
+ conflicts.push({
8387
+ _exportId: entity._exportId,
8388
+ entityType: "metrics_config",
8389
+ conflictType: "id_exists",
8390
+ existingId: id,
8391
+ existingName: d.name || key
8392
+ });
8393
+ } else if (key && existingKeys.has(key)) {
8394
+ conflicts.push({
8395
+ _exportId: entity._exportId,
8396
+ entityType: "metrics_config",
8397
+ conflictType: "unique_constraint",
8398
+ existingName: d.name || key,
8399
+ field: "key"
8400
+ });
8401
+ } else {
8402
+ insertions.push({
8403
+ _exportId: entity._exportId,
8404
+ entityType: "metrics_config",
8405
+ name: d.name || key
8406
+ });
8407
+ }
8408
+ }
8409
+ return { conflicts, insertions, errors: [] };
8410
+ },
8411
+ async applyImport(tenantId, entity, resolution) {
8412
+ const store = getStore6();
8413
+ const data = entity.data;
8414
+ const id = resolution.action === "rename" && resolution.newId ? resolution.newId : data.id;
8415
+ if (resolution.action === "overwrite") {
8416
+ try {
8417
+ await store.deleteConfig(tenantId, id);
8418
+ } catch {
8419
+ }
8420
+ }
8421
+ await store.createConfig(tenantId, id, {
8422
+ key: data.key,
8423
+ name: data.name,
8424
+ description: data.description,
8425
+ config: data.config
8426
+ });
8427
+ return { newId: id };
8428
+ }
8429
+ };
8430
+
8431
+ // src/export_registrations/mcp-config.registration.ts
8432
+ import { getStoreLattice as getStoreLattice20 } from "@axiom-lattice/core";
8433
+ function getStore7() {
8434
+ return getStoreLattice20("default", "mcp").store;
8435
+ }
8436
+ var mcpConfigRegistration = {
8437
+ entityType: "mcp_config",
8438
+ label: "MCP Config(MCP\u914D\u7F6E)",
8439
+ category: "core",
8440
+ dependsOn: [],
8441
+ cascadeParents: [],
8442
+ async listForExport(tenantId) {
8443
+ const store = getStore7();
8444
+ const configs = await store.getAllConfigs(tenantId);
8445
+ return configs.map((c) => ({
8446
+ _exportId: "",
8447
+ data: {
8448
+ id: c.id,
8449
+ key: c.key,
8450
+ name: c.name,
8451
+ description: c.description,
8452
+ config: c.config,
8453
+ selectedTools: c.selectedTools,
8454
+ status: c.status
8455
+ }
8456
+ }));
8457
+ },
8458
+ async previewImport(tenantId, entities) {
8459
+ const store = getStore7();
8460
+ const existing = await store.getAllConfigs(tenantId);
8461
+ const existingIds = new Set(existing.map((c) => c.id));
8462
+ const existingKeys = new Set(existing.map((c) => c.key));
8463
+ const conflicts = [];
8464
+ const insertions = [];
8465
+ for (const entity of entities) {
8466
+ const d = entity.data;
8467
+ const id = d.id;
8468
+ const key = d.key;
8469
+ if (existingIds.has(id)) {
8470
+ conflicts.push({
8471
+ _exportId: entity._exportId,
8472
+ entityType: "mcp_config",
8473
+ conflictType: "id_exists",
8474
+ existingId: id,
8475
+ existingName: d.name || key
8476
+ });
8477
+ } else if (key && existingKeys.has(key)) {
8478
+ conflicts.push({
8479
+ _exportId: entity._exportId,
8480
+ entityType: "mcp_config",
8481
+ conflictType: "unique_constraint",
8482
+ existingName: d.name || key,
8483
+ field: "key"
8484
+ });
8485
+ } else {
8486
+ insertions.push({
8487
+ _exportId: entity._exportId,
8488
+ entityType: "mcp_config",
8489
+ name: d.name || key
8490
+ });
8491
+ }
8492
+ }
8493
+ return { conflicts, insertions, errors: [] };
8494
+ },
8495
+ async applyImport(tenantId, entity, resolution) {
8496
+ const store = getStore7();
8497
+ const data = entity.data;
8498
+ const id = resolution.action === "rename" && resolution.newId ? resolution.newId : data.id;
8499
+ if (resolution.action === "overwrite") {
8500
+ try {
8501
+ await store.deleteConfig(tenantId, id);
8502
+ } catch {
8503
+ }
8504
+ }
8505
+ await store.createConfig(tenantId, id, {
8506
+ key: data.key,
8507
+ name: data.name,
8508
+ description: data.description,
8509
+ config: data.config,
8510
+ selectedTools: data.selectedTools
8511
+ });
8512
+ return { newId: id };
8513
+ }
8514
+ };
8515
+
8516
+ // src/export_registrations/connection.registration.ts
8517
+ import { getStoreLattice as getStoreLattice21 } from "@axiom-lattice/core";
8518
+ function getStore8() {
8519
+ return getStoreLattice21("default", "connection").store;
8520
+ }
8521
+ async function listAllConnections(tenantId) {
8522
+ const store = getStore8();
8523
+ if (typeof store.listByTenant !== "function") {
8524
+ throw new Error("ConnectionStore.listByTenant is not implemented. SQL bypass removed \u2014 upgrade your store adapter.");
8525
+ }
8526
+ return store.listByTenant(tenantId);
8527
+ }
8528
+ var connectionRegistration = {
8529
+ entityType: "connection",
8530
+ label: "Connection(\u8FDE\u63A5)",
8531
+ category: "core",
8532
+ dependsOn: [],
8533
+ cascadeParents: [],
8534
+ async listForExport(tenantId) {
8535
+ const connections2 = await listAllConnections(tenantId);
8536
+ return connections2.map((c) => ({
8537
+ _exportId: "",
8538
+ data: {
8539
+ id: c.id,
8540
+ type: c.type,
8541
+ key: c.key,
8542
+ name: c.name,
8543
+ description: c.description,
8544
+ config: c.config
8545
+ }
8546
+ }));
8547
+ },
8548
+ async previewImport(tenantId, entities) {
8549
+ const existing = await listAllConnections(tenantId);
8550
+ const existingCompositeKeys = new Set(
8551
+ existing.map((c) => `${c.type}:${c.key}`)
8552
+ );
8553
+ const conflicts = [];
8554
+ const insertions = [];
8555
+ for (const entity of entities) {
8556
+ const d = entity.data;
8557
+ const compositeKey = `${d.type}:${d.key}`;
8558
+ if (existingCompositeKeys.has(compositeKey)) {
8559
+ conflicts.push({
8560
+ _exportId: entity._exportId,
8561
+ entityType: "connection",
8562
+ conflictType: "unique_constraint",
8563
+ existingName: `${d.type}:${d.key}`,
8564
+ field: "type+key"
8565
+ });
8566
+ } else {
8567
+ insertions.push({
8568
+ _exportId: entity._exportId,
8569
+ entityType: "connection",
8570
+ name: `${d.type}:${d.key}`
8571
+ });
8572
+ }
8573
+ }
8574
+ return { conflicts, insertions, errors: [] };
8575
+ },
8576
+ async applyImport(tenantId, entity, resolution) {
8577
+ if (resolution.action === "skip") return {};
8578
+ const store = getStore8();
8579
+ const d = entity.data;
8580
+ const type = d.type;
8581
+ const key = d.key;
8582
+ if (resolution.action === "overwrite") {
8583
+ try {
8584
+ await store.delete(tenantId, type, key);
8585
+ } catch {
8586
+ }
8587
+ }
8588
+ await store.create({
8589
+ tenantId,
8590
+ type,
8591
+ key,
8592
+ name: d.name,
8593
+ description: d.description,
8594
+ config: d.config
8595
+ });
8596
+ return { newId: void 0 };
8597
+ }
8598
+ };
8599
+
8600
+ // src/export_registrations/collection.registration.ts
8601
+ import { getStoreLattice as getStoreLattice22 } from "@axiom-lattice/core";
8602
+ function getStore9() {
8603
+ return getStoreLattice22("default", "collection").store;
8604
+ }
8605
+ var collectionRegistration = {
8606
+ entityType: "collection",
8607
+ label: "Collection(\u77E5\u8BC6\u5E93)",
8608
+ category: "core",
8609
+ dependsOn: [],
8610
+ cascadeParents: [],
8611
+ async listForExport(tenantId) {
8612
+ const store = getStore9();
8613
+ const collections = await store.getAllCollections(tenantId);
8614
+ return collections.map((c) => ({
8615
+ _exportId: "",
8616
+ data: {
8617
+ id: c.id,
8618
+ name: c.name,
8619
+ label: c.label,
8620
+ embeddingKey: c.embeddingKey,
8621
+ schema: c.schema
8622
+ }
8623
+ }));
8624
+ },
8625
+ async previewImport(tenantId, entities) {
8626
+ const store = getStore9();
8627
+ const existing = await store.getAllCollections(tenantId);
8628
+ const existingNames = new Set(existing.map((c) => c.name));
8629
+ const conflicts = [];
8630
+ const insertions = [];
8631
+ for (const entity of entities) {
8632
+ const d = entity.data;
8633
+ const name = d.name;
8634
+ if (existingNames.has(name)) {
8635
+ conflicts.push({
8636
+ _exportId: entity._exportId,
8637
+ entityType: "collection",
8638
+ conflictType: "unique_constraint",
8639
+ existingName: name,
8640
+ field: "name"
8641
+ });
8642
+ } else {
8643
+ insertions.push({
8644
+ _exportId: entity._exportId,
8645
+ entityType: "collection",
8646
+ name
8647
+ });
8648
+ }
8649
+ }
8650
+ return { conflicts, insertions, errors: [] };
8651
+ },
8652
+ async applyImport(tenantId, entity, resolution) {
8653
+ if (resolution.action === "skip") return {};
8654
+ const store = getStore9();
8655
+ const d = entity.data;
8656
+ const name = d.name;
8657
+ if (resolution.action === "overwrite") {
8658
+ try {
8659
+ await store.deleteCollection(tenantId, name);
8660
+ } catch {
8661
+ }
8662
+ }
8663
+ await store.createCollection(tenantId, {
8664
+ name,
8665
+ label: d.label,
8666
+ embeddingKey: d.embeddingKey,
8667
+ schema: d.schema
8668
+ });
8669
+ return { newId: void 0 };
8670
+ }
8671
+ };
8672
+
8673
+ // src/export_registrations/channel-installation.registration.ts
8674
+ import { getStoreLattice as getStoreLattice23 } from "@axiom-lattice/core";
8675
+ function getStore10() {
8676
+ return getStoreLattice23("default", "channelInstallation").store;
8677
+ }
8678
+ var channelInstallationRegistration = {
8679
+ entityType: "channel_installation",
8680
+ label: "Channel Installation(\u6E20\u9053\u5B89\u88C5)",
8681
+ category: "core",
8682
+ dependsOn: ["agent"],
8683
+ cascadeParents: [],
8684
+ referenceFields: { fallbackAgentId: "agent" },
8685
+ async listForExport(tenantId) {
8686
+ const store = getStore10();
8687
+ const installations = await store.getInstallationsByTenant(tenantId);
8688
+ return installations.map((i) => ({
8689
+ _exportId: "",
8690
+ data: {
8691
+ id: i.id,
8692
+ channel: i.channel,
8693
+ name: i.name,
8694
+ config: i.config,
8695
+ enabled: i.enabled,
8696
+ fallbackAgentId: i.fallbackAgentId,
8697
+ rejectWhenNoBinding: i.rejectWhenNoBinding
8698
+ }
8699
+ }));
8700
+ },
8701
+ async previewImport(tenantId, entities) {
8702
+ const store = getStore10();
8703
+ const existing = await store.getInstallationsByTenant(tenantId);
8704
+ const existingIds = new Set(existing.map((i) => i.id));
8705
+ const conflicts = [];
8706
+ const insertions = [];
8707
+ for (const entity of entities) {
8708
+ const d = entity.data;
8709
+ const id = d.id;
8710
+ if (existingIds.has(id)) {
8711
+ conflicts.push({
8712
+ _exportId: entity._exportId,
8713
+ entityType: "channel_installation",
8714
+ conflictType: "id_exists",
8715
+ existingId: id,
8716
+ existingName: d.name || id
8717
+ });
8718
+ } else {
8719
+ insertions.push({
8720
+ _exportId: entity._exportId,
8721
+ entityType: "channel_installation",
8722
+ name: d.name || id
8723
+ });
8724
+ }
8725
+ }
8726
+ return { conflicts, insertions, errors: [] };
8727
+ },
8728
+ async applyImport(tenantId, entity, resolution) {
8729
+ const store = getStore10();
8730
+ const data = entity.data;
8731
+ const id = resolution.action === "rename" && resolution.newId ? resolution.newId : data.id;
8732
+ if (resolution.action === "overwrite") {
8733
+ try {
8734
+ await store.deleteInstallation(tenantId, id);
8735
+ } catch {
8736
+ }
8737
+ }
8738
+ await store.createInstallation(tenantId, id, {
8739
+ channel: data.channel,
8740
+ name: data.name,
8741
+ config: data.config,
8742
+ enabled: data.enabled,
8743
+ fallbackAgentId: data.fallbackAgentId,
8744
+ rejectWhenNoBinding: data.rejectWhenNoBinding
8745
+ });
8746
+ return { newId: id };
8747
+ }
8748
+ };
8749
+
8750
+ // src/export_registrations/menu.registration.ts
8751
+ import { getStoreLattice as getStoreLattice24 } from "@axiom-lattice/core";
8752
+ function getStore11() {
8753
+ return getStoreLattice24("default", "menu").store;
8754
+ }
8755
+ var menuRegistration = {
8756
+ entityType: "menu",
8757
+ label: "Menu(\u83DC\u5355)",
8758
+ category: "core",
8759
+ dependsOn: ["agent"],
8760
+ cascadeParents: [],
8761
+ async listForExport(tenantId) {
8762
+ const store = getStore11();
8763
+ const menus = await store.list({ tenantId });
8764
+ return menus.map((m) => ({
8765
+ _exportId: "",
8766
+ data: {
8767
+ id: m.id,
8768
+ menuTarget: m.menuTarget,
8769
+ group: m.group,
8770
+ name: m.name,
8771
+ icon: m.icon,
8772
+ sortOrder: m.sortOrder,
8773
+ contentType: m.contentType,
8774
+ contentConfig: m.contentConfig,
8775
+ enabled: m.enabled
8776
+ }
8777
+ }));
8778
+ },
8779
+ async previewImport(tenantId, entities) {
8780
+ const store = getStore11();
8781
+ const existing = await store.list({ tenantId });
8782
+ const existingIds = new Set(existing.map((m) => m.id));
8783
+ const conflicts = [];
8784
+ const insertions = [];
8785
+ for (const entity of entities) {
8786
+ const d = entity.data;
8787
+ const id = d.id;
8788
+ if (existingIds.has(id)) {
8789
+ conflicts.push({
8790
+ _exportId: entity._exportId,
8791
+ entityType: "menu",
8792
+ conflictType: "id_exists",
8793
+ existingId: id,
8794
+ existingName: d.name || id
8795
+ });
8796
+ } else {
8797
+ insertions.push({
8798
+ _exportId: entity._exportId,
8799
+ entityType: "menu",
8800
+ name: d.name || id
8801
+ });
8802
+ }
8803
+ }
8804
+ return { conflicts, insertions, errors: [] };
8805
+ },
8806
+ async applyImport(tenantId, entity, resolution) {
8807
+ const store = getStore11();
8808
+ const d = entity.data;
8809
+ const id = resolution.action === "rename" && resolution.newId ? resolution.newId : d.id;
8810
+ if (resolution.action === "overwrite") {
8811
+ try {
8812
+ await store.delete(id);
8813
+ } catch {
8814
+ }
8815
+ }
8816
+ await store.create({
8817
+ tenantId,
8818
+ menuTarget: d.menuTarget,
8819
+ group: d.group,
8820
+ name: d.name,
8821
+ icon: d.icon,
8822
+ sortOrder: d.sortOrder,
8823
+ contentType: d.contentType,
8824
+ contentConfig: d.contentConfig
8825
+ });
8826
+ return { newId: void 0 };
8827
+ }
8828
+ };
8829
+
8830
+ // src/export_registrations/task.registration.ts
8831
+ import { getStoreLattice as getStoreLattice25 } from "@axiom-lattice/core";
8832
+ function getStore12() {
8833
+ return getStoreLattice25("default", "task").store;
8834
+ }
8835
+ var taskRegistration = {
8836
+ entityType: "task",
8837
+ label: "Task(\u4EFB\u52A1)",
8838
+ category: "core",
8839
+ dependsOn: ["agent"],
8840
+ cascadeParents: [],
8841
+ referenceFields: { ownerId: "agent", parentId: "task" },
8842
+ async listForExport(tenantId) {
8843
+ const store = getStore12();
8844
+ const tasks = await store.list({ tenantId, limit: 1e4, offset: 0 });
8845
+ return tasks.map((t) => ({
8846
+ _exportId: "",
8847
+ data: {
8848
+ id: t.id,
8849
+ title: t.title,
8850
+ description: t.description,
8851
+ status: t.status,
8852
+ priority: t.priority,
8853
+ dueDate: t.dueDate,
8854
+ ownerType: t.ownerType,
8855
+ ownerId: t.ownerId,
8856
+ metadata: t.metadata,
8857
+ parentId: t.parentId,
8858
+ sourceId: t.sourceId,
8859
+ context: t.context
8860
+ }
8861
+ }));
8862
+ },
8863
+ async previewImport(tenantId, entities) {
8864
+ const store = getStore12();
8865
+ const existing = await store.list({ tenantId, limit: 1e4, offset: 0 });
8866
+ const existingIds = new Set(existing.map((t) => t.id));
8867
+ const conflicts = [];
8868
+ const insertions = [];
8869
+ for (const entity of entities) {
8870
+ const d = entity.data;
8871
+ const id = d.id;
8872
+ if (existingIds.has(id)) {
8873
+ conflicts.push({
8874
+ _exportId: entity._exportId,
8875
+ entityType: "task",
8876
+ conflictType: "id_exists",
8877
+ existingId: id,
8878
+ existingName: d.title || id
8879
+ });
8880
+ } else {
8881
+ insertions.push({
8882
+ _exportId: entity._exportId,
8883
+ entityType: "task",
8884
+ name: d.title || id
8885
+ });
8886
+ }
8887
+ }
8888
+ return { conflicts, insertions, errors: [] };
8889
+ },
8890
+ async applyImport(tenantId, entity, resolution) {
8891
+ const store = getStore12();
8892
+ const data = entity.data;
8893
+ const id = resolution.action === "rename" && resolution.newId ? resolution.newId : data.id;
8894
+ if (resolution.action === "overwrite") {
8895
+ try {
8896
+ await store.delete(tenantId, id);
8897
+ } catch {
8898
+ }
8899
+ }
8900
+ await store.create({
8901
+ tenantId,
8902
+ ownerType: data.ownerType || "user",
8903
+ ownerId: data.ownerId || "",
8904
+ title: data.title,
8905
+ description: data.description,
8906
+ status: data.status,
8907
+ priority: data.priority,
8908
+ dueDate: data.dueDate,
8909
+ metadata: data.metadata,
8910
+ parentId: data.parentId,
8911
+ sourceId: data.sourceId,
8912
+ context: data.context
8913
+ });
8914
+ return { newId: id };
8915
+ }
8916
+ };
8917
+
8918
+ // src/export_registrations/a2a-api-key.registration.ts
8919
+ import { getStoreLattice as getStoreLattice26 } from "@axiom-lattice/core";
8920
+ function getStore13() {
8921
+ return getStoreLattice26("default", "a2aApiKey").store;
8922
+ }
8923
+ var a2aApiKeyRegistration = {
8924
+ entityType: "a2a_api_key",
8925
+ label: "A2A API Key(API\u5BC6\u94A5)",
8926
+ category: "core",
8927
+ dependsOn: [],
8928
+ cascadeParents: [],
8929
+ async listForExport(tenantId) {
8930
+ const store = getStore13();
8931
+ const keys = await store.list({ tenantId, limit: 1e4, offset: 0 });
8932
+ return keys.map((k) => ({
8933
+ _exportId: "",
8934
+ data: {
8935
+ id: k.id,
8936
+ tenantId: k.tenantId,
8937
+ projectId: k.projectId,
8938
+ workspaceId: k.workspaceId,
8939
+ label: k.label,
8940
+ enabled: k.enabled
8941
+ }
8942
+ }));
8943
+ },
8944
+ async previewImport(tenantId, entities) {
8945
+ const store = getStore13();
8946
+ const existing = await store.list({ tenantId, limit: 1e4, offset: 0 });
8947
+ const existingIds = new Set(existing.map((k) => k.id));
8948
+ const conflicts = [];
8949
+ const insertions = [];
8950
+ for (const entity of entities) {
8951
+ const d = entity.data;
8952
+ const id = d.id;
8953
+ if (existingIds.has(id)) {
8954
+ conflicts.push({
8955
+ _exportId: entity._exportId,
8956
+ entityType: "a2a_api_key",
8957
+ conflictType: "id_exists",
8958
+ existingId: id,
8959
+ existingName: d.label || id
8960
+ });
8961
+ } else {
8962
+ insertions.push({
8963
+ _exportId: entity._exportId,
8964
+ entityType: "a2a_api_key",
8965
+ name: d.label || id
8966
+ });
8967
+ }
8968
+ }
8969
+ return { conflicts, insertions, errors: [] };
8970
+ },
8971
+ async applyImport(tenantId, entity, resolution) {
8972
+ if (resolution.action === "skip") return {};
8973
+ const store = getStore13();
8974
+ const d = entity.data;
8975
+ if (resolution.action === "overwrite") {
8976
+ try {
8977
+ await store.delete(d.id);
8978
+ } catch {
8979
+ }
8980
+ }
8981
+ await store.create({
8982
+ tenantId,
8983
+ projectId: d.projectId,
8984
+ workspaceId: d.workspaceId,
8985
+ label: d.label
8986
+ });
8987
+ return { newId: void 0 };
8988
+ }
8989
+ };
8990
+
8991
+ // src/export_registrations/eval.registration.ts
8992
+ import { getStoreLattice as getStoreLattice27 } from "@axiom-lattice/core";
8993
+ function getStore14() {
8994
+ return getStoreLattice27("default", "eval").store;
8995
+ }
8996
+ var evalRegistration = {
8997
+ entityType: "eval",
8998
+ label: "Eval(\u8BC4\u4F30)",
8999
+ category: "core",
9000
+ dependsOn: [],
9001
+ cascadeParents: [],
9002
+ referenceFields: { suiteId: "eval_suite", projectId: "eval_project", runId: "eval_run", caseId: "eval_case" },
9003
+ async listForExport(tenantId) {
9004
+ const store = getStore14();
9005
+ const projects = await store.getProjectsByTenant(tenantId);
9006
+ const entities = [];
9007
+ for (const project of projects) {
9008
+ entities.push({
9009
+ _exportId: "",
9010
+ data: {
9011
+ _subType: "eval_project",
9012
+ id: project.id,
9013
+ name: project.name,
9014
+ description: project.description,
9015
+ version: project.version,
9016
+ judgeModelConfig: project.judgeModelConfig,
9017
+ targetServerConfig: project.targetServerConfig,
9018
+ concurrency: project.concurrency,
9019
+ reportConfig: project.reportConfig
9020
+ }
9021
+ });
9022
+ const suites = await store.getSuitesByProject(tenantId, project.id);
9023
+ for (const suite of suites) {
9024
+ entities.push({
9025
+ _exportId: "",
9026
+ data: {
9027
+ _subType: "eval_suite",
9028
+ id: suite.id,
9029
+ projectId: suite.projectId,
9030
+ name: suite.name
9031
+ }
9032
+ });
9033
+ const cases = await store.getCasesBySuite(tenantId, suite.id);
9034
+ for (const c of cases) {
9035
+ entities.push({
9036
+ _exportId: "",
9037
+ data: {
9038
+ _subType: "eval_case",
9039
+ id: c.id,
9040
+ suiteId: c.suiteId,
9041
+ inputMessage: c.inputMessage,
9042
+ inputFiles: c.inputFiles,
9043
+ steps: c.steps,
9044
+ outputType: c.outputType,
9045
+ contentAssertion: c.contentAssertion,
9046
+ rubrics: c.rubrics
9047
+ }
9048
+ });
9049
+ }
9050
+ }
9051
+ const runs = await store.getRunsByTenant(tenantId, { projectId: project.id });
9052
+ for (const run of runs) {
9053
+ entities.push({
9054
+ _exportId: "",
9055
+ data: {
9056
+ _subType: "eval_run",
9057
+ id: run.id,
9058
+ projectId: run.projectId,
9059
+ status: run.status,
9060
+ concurrency: run.concurrency,
9061
+ totalCases: run.totalCases,
9062
+ passedCases: run.passedCases,
9063
+ failedCases: run.failedCases,
9064
+ avgScore: run.avgScore,
9065
+ error: run.error
9066
+ }
9067
+ });
9068
+ const results = await store.getResultsByRun(tenantId, run.id);
9069
+ for (const result of results) {
9070
+ entities.push({
9071
+ _exportId: "",
9072
+ data: {
9073
+ _subType: "eval_run_result",
9074
+ id: result.id,
9075
+ runId: result.runId,
9076
+ suiteName: result.suiteName,
9077
+ caseId: result.caseId,
9078
+ pass: result.pass,
9079
+ score: result.score,
9080
+ summary: result.summary,
9081
+ dimensionResults: result.dimensionResults,
9082
+ durationMs: result.durationMs,
9083
+ messages: result.messages,
9084
+ logs: result.logs,
9085
+ error: result.error
9086
+ }
9087
+ });
9088
+ }
9089
+ }
9090
+ }
9091
+ return entities;
9092
+ },
9093
+ async previewImport(tenantId, entities) {
9094
+ const store = getStore14();
9095
+ const existingProjects = await store.getProjectsByTenant(tenantId);
9096
+ const existingProjectIds = new Set(existingProjects.map((p) => p.id));
9097
+ const existingProjectNames = new Set(existingProjects.map((p) => p.name));
9098
+ const existingSuites = /* @__PURE__ */ new Map();
9099
+ const existingSuiteIds = /* @__PURE__ */ new Set();
9100
+ const existingCaseIds = /* @__PURE__ */ new Set();
9101
+ const existingRunIds = /* @__PURE__ */ new Set();
9102
+ const existingResultIds = /* @__PURE__ */ new Set();
9103
+ for (const project of existingProjects) {
9104
+ const suites = await store.getSuitesByProject(tenantId, project.id);
9105
+ existingSuites.set(project.id, new Set(suites.map((s) => `${s.projectId}:${s.name}`)));
9106
+ for (const s of suites) {
9107
+ existingSuiteIds.add(s.id);
9108
+ try {
9109
+ const cases = await store.getCasesBySuite(tenantId, s.id);
9110
+ for (const c of cases) existingCaseIds.add(c.id);
9111
+ } catch {
9112
+ }
9113
+ }
9114
+ }
9115
+ for (const project of existingProjects) {
9116
+ const runs = await store.getRunsByTenant(tenantId, { projectId: project.id });
9117
+ for (const run of runs) {
9118
+ existingRunIds.add(run.id);
9119
+ try {
9120
+ const results = await store.getResultsByRun(tenantId, run.id);
9121
+ for (const r of results) existingResultIds.add(r.id);
9122
+ } catch {
9123
+ }
9124
+ }
9125
+ }
9126
+ const conflicts = [];
9127
+ const insertions = [];
9128
+ for (const entity of entities) {
9129
+ const d = entity.data;
9130
+ const subType = d._subType;
9131
+ const id = d.id;
9132
+ switch (subType) {
9133
+ case "eval_project": {
9134
+ const name = d.name;
9135
+ if (existingProjectIds.has(id)) {
9136
+ conflicts.push({
9137
+ _exportId: entity._exportId,
9138
+ entityType: "eval_project",
9139
+ conflictType: "id_exists",
9140
+ existingId: id,
9141
+ existingName: name
9142
+ });
9143
+ } else if (name && existingProjectNames.has(name)) {
9144
+ conflicts.push({
9145
+ _exportId: entity._exportId,
9146
+ entityType: "eval_project",
9147
+ conflictType: "unique_constraint",
9148
+ existingName: name,
9149
+ field: "name"
9150
+ });
9151
+ } else {
9152
+ insertions.push({ _exportId: entity._exportId, entityType: "eval_project", name });
9153
+ }
9154
+ break;
9155
+ }
9156
+ case "eval_suite": {
9157
+ const projectId = d.projectId;
9158
+ const name = d.name;
9159
+ const suiteKey = `${projectId}:${name}`;
9160
+ const projectSuites = existingSuites.get(projectId);
9161
+ if (existingSuiteIds.has(id)) {
9162
+ conflicts.push({
9163
+ _exportId: entity._exportId,
9164
+ entityType: "eval_suite",
9165
+ conflictType: "id_exists",
9166
+ existingId: id,
9167
+ existingName: name
9168
+ });
9169
+ } else if (projectSuites?.has(suiteKey)) {
9170
+ conflicts.push({
9171
+ _exportId: entity._exportId,
9172
+ entityType: "eval_suite",
9173
+ conflictType: "unique_constraint",
9174
+ existingName: name,
9175
+ field: "projectId+name"
9176
+ });
9177
+ } else {
9178
+ insertions.push({ _exportId: entity._exportId, entityType: "eval_suite", name });
9179
+ }
9180
+ break;
9181
+ }
9182
+ case "eval_case": {
9183
+ if (existingCaseIds.has(id)) {
9184
+ conflicts.push({
9185
+ _exportId: entity._exportId,
9186
+ entityType: "eval_case",
9187
+ conflictType: "id_exists",
9188
+ existingId: id
9189
+ });
9190
+ } else {
9191
+ insertions.push({ _exportId: entity._exportId, entityType: "eval_case", name: id });
9192
+ }
9193
+ break;
9194
+ }
9195
+ case "eval_run": {
9196
+ if (existingRunIds.has(id)) {
9197
+ conflicts.push({
9198
+ _exportId: entity._exportId,
9199
+ entityType: "eval_run",
9200
+ conflictType: "id_exists",
9201
+ existingId: id
9202
+ });
9203
+ } else {
9204
+ insertions.push({ _exportId: entity._exportId, entityType: "eval_run", name: id });
9205
+ }
9206
+ break;
9207
+ }
9208
+ case "eval_run_result": {
9209
+ if (existingResultIds.has(id)) {
9210
+ conflicts.push({
9211
+ _exportId: entity._exportId,
9212
+ entityType: "eval_run_result",
9213
+ conflictType: "id_exists",
9214
+ existingId: id
9215
+ });
9216
+ } else {
9217
+ insertions.push({ _exportId: entity._exportId, entityType: "eval_run_result", name: id });
9218
+ }
9219
+ break;
9220
+ }
9221
+ }
9222
+ }
9223
+ return { conflicts, insertions, errors: [] };
9224
+ },
9225
+ async applyImport(tenantId, entity, resolution) {
9226
+ if (resolution.action === "skip") return {};
9227
+ const store = getStore14();
9228
+ const d = entity.data;
9229
+ const subType = d._subType;
9230
+ const id = resolution.action === "rename" && resolution.newId ? resolution.newId : d.id;
9231
+ switch (subType) {
9232
+ case "eval_project": {
9233
+ if (resolution.action === "overwrite") {
9234
+ try {
9235
+ await store.deleteProject(tenantId, id);
9236
+ } catch {
9237
+ }
9238
+ }
9239
+ await store.createProject(tenantId, id, {
9240
+ name: d.name,
9241
+ description: d.description,
9242
+ version: d.version,
9243
+ judgeModelConfig: d.judgeModelConfig,
9244
+ targetServerConfig: d.targetServerConfig,
9245
+ concurrency: d.concurrency,
9246
+ reportConfig: d.reportConfig
9247
+ });
9248
+ break;
9249
+ }
9250
+ case "eval_suite": {
9251
+ if (resolution.action === "overwrite") {
9252
+ try {
9253
+ await store.deleteSuite(tenantId, id);
9254
+ } catch {
9255
+ }
9256
+ }
9257
+ await store.createSuite(tenantId, d.projectId, id, {
9258
+ name: d.name
9259
+ });
9260
+ break;
9261
+ }
9262
+ case "eval_case": {
9263
+ if (resolution.action === "overwrite") {
9264
+ try {
9265
+ await store.deleteCase(tenantId, id);
9266
+ } catch {
9267
+ }
9268
+ }
9269
+ await store.createCase(tenantId, d.suiteId, id, {
9270
+ inputMessage: d.inputMessage,
9271
+ inputFiles: d.inputFiles,
9272
+ steps: d.steps,
9273
+ outputType: d.outputType,
9274
+ contentAssertion: d.contentAssertion,
9275
+ rubrics: d.rubrics
9276
+ });
9277
+ break;
9278
+ }
9279
+ case "eval_run": {
9280
+ if (resolution.action === "overwrite") {
9281
+ try {
9282
+ await store.deleteRun(tenantId, id);
9283
+ } catch {
9284
+ }
9285
+ }
9286
+ await store.createRun(tenantId, d.projectId, id, {
9287
+ totalCases: d.totalCases,
9288
+ concurrency: d.concurrency
9289
+ });
9290
+ break;
9291
+ }
9292
+ case "eval_run_result": {
9293
+ if (resolution.action === "overwrite") {
9294
+ try {
9295
+ await store.deleteRunResult(tenantId, entity.data.id);
9296
+ } catch {
9297
+ }
9298
+ }
9299
+ await store.createRunResult(tenantId, d.runId, id, {
9300
+ suiteName: d.suiteName,
9301
+ caseId: d.caseId,
9302
+ pass: d.pass,
9303
+ score: d.score,
9304
+ summary: d.summary,
9305
+ dimensionResults: d.dimensionResults,
9306
+ durationMs: d.durationMs,
9307
+ messages: d.messages,
9308
+ logs: d.logs,
9309
+ error: d.error
9310
+ });
9311
+ break;
9312
+ }
9313
+ }
9314
+ return { newId: id };
9315
+ }
9316
+ };
9317
+
9318
+ // src/export_registrations/index.ts
9319
+ function registerAllBuiltinEntities() {
9320
+ const registry = ExportableEntityRegistry3.getInstance();
9321
+ registry.register(skillRegistration);
9322
+ registry.register(agentRegistration);
9323
+ registry.register(bindingRegistration);
9324
+ registry.register(databaseConfigRegistration);
9325
+ registry.register(metricsConfigRegistration);
9326
+ registry.register(mcpConfigRegistration);
9327
+ registry.register(connectionRegistration);
9328
+ registry.register(collectionRegistration);
9329
+ registry.register(channelInstallationRegistration);
9330
+ registry.register(menuRegistration);
9331
+ registry.register(taskRegistration);
9332
+ registry.register(a2aApiKeyRegistration);
9333
+ registry.register(evalRegistration);
9334
+ }
9335
+
9336
+ // src/router/MessageRouter.ts
9337
+ import {
9338
+ getStoreLattice as getStoreLattice28,
9339
+ agentInstanceManager as agentInstanceManager6
9340
+ } from "@axiom-lattice/core";
9341
+ import { randomUUID as randomUUID8 } from "crypto";
7660
9342
  var BindingNotFoundError = class extends Error {
7661
9343
  constructor(message) {
7662
9344
  super(message);
@@ -7816,7 +9498,7 @@ var MessageRouter = class {
7816
9498
  channel: message.channel,
7817
9499
  adapterChannel: adapter.channel
7818
9500
  }, "Thread resolved by adapter strategy");
7819
- const threadStore = getStoreLattice15("default", "thread").store;
9501
+ const threadStore = getStoreLattice28("default", "thread").store;
7820
9502
  try {
7821
9503
  await threadStore.createThread(
7822
9504
  tenantId,
@@ -7853,8 +9535,8 @@ var MessageRouter = class {
7853
9535
  }
7854
9536
  }
7855
9537
  if (!threadId) {
7856
- const threadStore = getStoreLattice15("default", "thread").store;
7857
- const newThreadId = randomUUID7();
9538
+ const threadStore = getStoreLattice28("default", "thread").store;
9539
+ const newThreadId = randomUUID8();
7858
9540
  console.log({
7859
9541
  event: "dispatch:thread:create",
7860
9542
  agentId,
@@ -8459,7 +10141,7 @@ import {
8459
10141
  getLoggerLattice,
8460
10142
  loggerLatticeManager,
8461
10143
  sandboxLatticeManager as sandboxLatticeManager2,
8462
- getStoreLattice as getStoreLattice16,
10144
+ getStoreLattice as getStoreLattice29,
8463
10145
  agentInstanceManager as agentInstanceManager8,
8464
10146
  createSandboxProvider,
8465
10147
  TokenCache,
@@ -8612,7 +10294,7 @@ function getConfiguredSandboxProvider() {
8612
10294
  }
8613
10295
  async function restoreMcpConnections() {
8614
10296
  try {
8615
- const storeLattice = getStoreLattice16("default", "mcp");
10297
+ const storeLattice = getStoreLattice29("default", "mcp");
8616
10298
  const store = storeLattice.store;
8617
10299
  if (!store) {
8618
10300
  logger4.info("MCP store not configured, skipping connection restoration");
@@ -8664,9 +10346,9 @@ var start = async (config) => {
8664
10346
  const { wechatChannelAdapter } = await import("./WechatChannelAdapter-WSDKR4OA.mjs");
8665
10347
  adapterRegistry.register(wechatChannelAdapter);
8666
10348
  try {
8667
- const { getStoreLattice: getStore2 } = await import("@axiom-lattice/core");
8668
- const bindingStore = getStore2("default", "channelBinding").store;
8669
- const installationStore = getStore2("default", "channelInstallation").store;
10349
+ const { getStoreLattice: getStore15 } = await import("@axiom-lattice/core");
10350
+ const bindingStore = getStore15("default", "channelBinding").store;
10351
+ const installationStore = getStore15("default", "channelInstallation").store;
8670
10352
  setBindingRegistry(bindingStore);
8671
10353
  const router = new MessageRouter({
8672
10354
  middlewares: [
@@ -8680,7 +10362,7 @@ var start = async (config) => {
8680
10362
  });
8681
10363
  channelDeps = { router, installationStore };
8682
10364
  try {
8683
- const a2aKeyStore = getStore2("default", "a2aApiKey").store;
10365
+ const a2aKeyStore = getStore15("default", "a2aApiKey").store;
8684
10366
  const a2a = await import("./a2a-ERG5RMUW.mjs");
8685
10367
  a2a.setA2AKeyStore(a2aKeyStore);
8686
10368
  await a2a.refreshStoreKeyMap();
@@ -8694,11 +10376,12 @@ var start = async (config) => {
8694
10376
  }
8695
10377
  setEvalRunService(evalRunner);
8696
10378
  try {
8697
- const menuStore = getStoreLattice16("default", "menu").store;
10379
+ const menuStore = getStoreLattice29("default", "menu").store;
8698
10380
  setMenuRegistry(menuStore);
8699
10381
  logger4.info("Menu registry initialized");
8700
10382
  } catch {
8701
10383
  }
10384
+ registerAllBuiltinEntities();
8702
10385
  if (channelDeps?.router) {
8703
10386
  setChannelControllerDeps({ adapterRegistry, router: channelDeps.router });
8704
10387
  }
@@ -8709,7 +10392,7 @@ var start = async (config) => {
8709
10392
  }
8710
10393
  try {
8711
10394
  const { ResourceController } = await import("./resources-VA7LSDKN.mjs");
8712
- const sharedResourceStore = getStoreLattice16("default", "sharedResource").store;
10395
+ const sharedResourceStore = getStoreLattice29("default", "sharedResource").store;
8713
10396
  const cache = new TokenCache();
8714
10397
  const resourceController = new ResourceController({
8715
10398
  store: sharedResourceStore,