@axiom-lattice/local-stores 5.1.1 → 5.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1944,6 +1944,9 @@ function mapRowToTenant(row) {
1944
1944
  }
1945
1945
 
1946
1946
  // src/stores/LocalUserTenantLinkStore.ts
1947
+ import {
1948
+ assertNotPlatformTenant
1949
+ } from "@axiom-lattice/protocols";
1947
1950
  var DDL8 = `
1948
1951
  CREATE TABLE IF NOT EXISTS lt_user_tenant_links (
1949
1952
  user_id TEXT NOT NULL,
@@ -1980,6 +1983,7 @@ var LocalUserTenantLinkStore = class {
1980
1983
  return row ? mapRowToLink(row) : null;
1981
1984
  }
1982
1985
  async createLink(data) {
1986
+ assertNotPlatformTenant(data.tenantId);
1983
1987
  const now = nowISO();
1984
1988
  const role2 = data.role || "member";
1985
1989
  const metadata = JSON.stringify(data.metadata || {});
@@ -2895,9 +2899,168 @@ var LocalPlatformSettingsStore = class {
2895
2899
  }
2896
2900
  };
2897
2901
 
2902
+ // src/stores/LocalPlatformAuditStore.ts
2903
+ import { randomUUID } from "crypto";
2904
+ var DDL16 = `
2905
+ CREATE TABLE IF NOT EXISTS lattice_platform_audit (
2906
+ id TEXT NOT NULL PRIMARY KEY,
2907
+ initiator_user_id TEXT,
2908
+ initiator_role TEXT,
2909
+ initiator_json TEXT NOT NULL,
2910
+ source TEXT NOT NULL,
2911
+ executor_json TEXT NOT NULL,
2912
+ tenant_id TEXT,
2913
+ action TEXT NOT NULL,
2914
+ status TEXT NOT NULL,
2915
+ summary_json TEXT NOT NULL,
2916
+ before_json TEXT,
2917
+ after_json TEXT,
2918
+ error_code TEXT,
2919
+ duration_ms INTEGER NOT NULL,
2920
+ created_at TEXT NOT NULL
2921
+ );
2922
+ CREATE INDEX IF NOT EXISTS idx_lattice_platform_audit_created
2923
+ ON lattice_platform_audit(created_at DESC, id DESC);
2924
+ CREATE INDEX IF NOT EXISTS idx_lattice_platform_audit_initiator
2925
+ ON lattice_platform_audit(initiator_user_id, created_at DESC);
2926
+ CREATE INDEX IF NOT EXISTS idx_lattice_platform_audit_tenant
2927
+ ON lattice_platform_audit(tenant_id, created_at DESC);
2928
+ `;
2929
+ function parseJson2(value) {
2930
+ return JSON.parse(value);
2931
+ }
2932
+ function normalizeBoundary(value) {
2933
+ if (value === void 0) return void 0;
2934
+ const trimmed = value.trim();
2935
+ if (trimmed === "") return void 0;
2936
+ const parsed = new Date(trimmed);
2937
+ if (Number.isNaN(parsed.getTime())) return void 0;
2938
+ return parsed.toISOString();
2939
+ }
2940
+ function normalizePagination(value, fallback) {
2941
+ if (value === void 0 || !Number.isFinite(value)) return fallback;
2942
+ return Math.max(0, Math.trunc(value));
2943
+ }
2944
+ function mapRow14(row) {
2945
+ return {
2946
+ id: row.id,
2947
+ initiator: parseJson2(row.initiator_json),
2948
+ source: row.source,
2949
+ executor: parseJson2(row.executor_json),
2950
+ ...row.tenant_id !== null ? { tenantId: row.tenant_id } : {},
2951
+ action: row.action,
2952
+ status: row.status,
2953
+ summary: parseJson2(row.summary_json),
2954
+ ...row.before_json !== null ? { before: parseJson2(row.before_json) } : {},
2955
+ ...row.after_json !== null ? { after: parseJson2(row.after_json) } : {},
2956
+ ...row.error_code !== null ? { errorCode: row.error_code } : {},
2957
+ durationMs: Number(row.duration_ms),
2958
+ createdAt: parseISO(row.created_at)
2959
+ };
2960
+ }
2961
+ var LocalPlatformAuditStore = class {
2962
+ constructor(db) {
2963
+ this.db = db;
2964
+ ensureTable(db, DDL16);
2965
+ }
2966
+ /** Appends a record, assigning a fresh id and creation timestamp. */
2967
+ async append(record2) {
2968
+ const id = randomUUID();
2969
+ const initiator = record2.initiator;
2970
+ const initiatorUserId = initiator.type === "human" ? initiator.userId : null;
2971
+ const initiatorRole = initiator.type === "human" ? initiator.role : null;
2972
+ const durationMs = Number.isFinite(record2.durationMs) ? Math.max(0, Math.round(record2.durationMs)) : 0;
2973
+ this.db.prepare(
2974
+ `INSERT INTO lattice_platform_audit
2975
+ (id, initiator_user_id, initiator_role, initiator_json, source,
2976
+ executor_json, tenant_id, action, status, summary_json, before_json,
2977
+ after_json, error_code, duration_ms, created_at)
2978
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
2979
+ ).run(
2980
+ id,
2981
+ initiatorUserId,
2982
+ initiatorRole,
2983
+ JSON.stringify(initiator),
2984
+ record2.source,
2985
+ JSON.stringify(record2.executor),
2986
+ record2.tenantId ?? null,
2987
+ record2.action,
2988
+ record2.status,
2989
+ JSON.stringify(record2.summary),
2990
+ record2.before === void 0 ? null : JSON.stringify(record2.before),
2991
+ record2.after === void 0 ? null : JSON.stringify(record2.after),
2992
+ record2.errorCode ?? null,
2993
+ durationMs,
2994
+ nowISO()
2995
+ );
2996
+ const stored = await this.get(id);
2997
+ if (!stored) throw new Error("Platform audit record was not persisted");
2998
+ return stored;
2999
+ }
3000
+ /** Returns a record by id, or null when it does not exist. */
3001
+ async get(id) {
3002
+ const row = this.db.prepare(`SELECT * FROM lattice_platform_audit WHERE id = ?`).get(id);
3003
+ return row ? mapRow14(row) : null;
3004
+ }
3005
+ /**
3006
+ * Returns matching records newest-first.
3007
+ *
3008
+ * `initiatorUserId` only matches human initiators. `from` is inclusive and
3009
+ * `to` is exclusive after both are normalized to instants; invalid or empty
3010
+ * boundaries are ignored. Records are ordered by `createdAt` descending,
3011
+ * then by `id` descending. Results are paginated with a default limit of 100;
3012
+ * non-finite `offset`/`limit` fall back to defaults, finite values are
3013
+ * truncated to integers, and negatives are clamped to 0.
3014
+ */
3015
+ async query(params) {
3016
+ const clauses = [];
3017
+ const values = [];
3018
+ if (params.initiatorUserId !== void 0) {
3019
+ clauses.push("initiator_user_id = ?");
3020
+ values.push(params.initiatorUserId);
3021
+ }
3022
+ if (params.source !== void 0) {
3023
+ clauses.push("source = ?");
3024
+ values.push(params.source);
3025
+ }
3026
+ if (params.tenantId !== void 0) {
3027
+ clauses.push("tenant_id = ?");
3028
+ values.push(params.tenantId);
3029
+ }
3030
+ if (params.action !== void 0) {
3031
+ clauses.push("action = ?");
3032
+ values.push(params.action);
3033
+ }
3034
+ if (params.status !== void 0) {
3035
+ clauses.push("status = ?");
3036
+ values.push(params.status);
3037
+ }
3038
+ const from = normalizeBoundary(params.from);
3039
+ if (from !== void 0) {
3040
+ clauses.push("created_at >= ?");
3041
+ values.push(from);
3042
+ }
3043
+ const to = normalizeBoundary(params.to);
3044
+ if (to !== void 0) {
3045
+ clauses.push("created_at < ?");
3046
+ values.push(to);
3047
+ }
3048
+ const limit = normalizePagination(params.limit, 100);
3049
+ const offset = normalizePagination(params.offset, 0);
3050
+ values.push(limit, offset);
3051
+ const where = clauses.length > 0 ? ` WHERE ${clauses.join(" AND ")}` : "";
3052
+ const rows2 = this.db.prepare(
3053
+ `SELECT * FROM lattice_platform_audit${where}
3054
+ ORDER BY created_at DESC, id DESC
3055
+ LIMIT ? OFFSET ?`
3056
+ ).all(...values);
3057
+ return rows2.map(mapRow14);
3058
+ }
3059
+ };
3060
+
2898
3061
  // src/stores/LocalDatabaseConfigStore.ts
2899
3062
  import { encrypt as encrypt3, decrypt } from "@axiom-lattice/core";
2900
- var DDL16 = `
3063
+ var DDL17 = `
2901
3064
  CREATE TABLE IF NOT EXISTS lt_database_configs (
2902
3065
  id TEXT NOT NULL,
2903
3066
  tenant_id TEXT NOT NULL,
@@ -2914,7 +3077,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS idx_lt_dbconfig_key ON lt_database_configs(ten
2914
3077
  var LocalDatabaseConfigStore = class {
2915
3078
  constructor(db) {
2916
3079
  this.db = db;
2917
- ensureTable(db, DDL16);
3080
+ ensureTable(db, DDL17);
2918
3081
  }
2919
3082
  async getAllConfigs(tenantId) {
2920
3083
  const rows2 = this.db.prepare(
@@ -3037,7 +3200,7 @@ function encryptPasswordInConfig(config) {
3037
3200
  // src/stores/LocalConnectionStore.ts
3038
3201
  import { v4 as uuid } from "uuid";
3039
3202
  import { encryptConfigFields, decryptConfigFields, encrypt as encrypt4, isEncryptedValue } from "@axiom-lattice/core";
3040
- var DDL17 = `
3203
+ var DDL18 = `
3041
3204
  CREATE TABLE IF NOT EXISTS connection_configs (
3042
3205
  id TEXT NOT NULL,
3043
3206
  tenant_id TEXT NOT NULL,
@@ -3068,7 +3231,7 @@ function parseSecretFields(raw) {
3068
3231
  var LocalConnectionStore = class {
3069
3232
  constructor(db) {
3070
3233
  this.db = db;
3071
- ensureTable(db, DDL17);
3234
+ ensureTable(db, DDL18);
3072
3235
  this.ensureColumn("connection_configs", "secret_fields", "secret_fields TEXT");
3073
3236
  this.reencryptLegacySecrets();
3074
3237
  }
@@ -3211,7 +3374,7 @@ var LocalConnectionStore = class {
3211
3374
 
3212
3375
  // src/stores/LocalMetricsServerConfigStore.ts
3213
3376
  import { encrypt as encrypt5, isEncryptedValue as isEncryptedValue2, safeDecrypt as safeDecrypt3 } from "@axiom-lattice/core";
3214
- var DDL18 = `
3377
+ var DDL19 = `
3215
3378
  CREATE TABLE IF NOT EXISTS lt_metrics_configs (
3216
3379
  id TEXT NOT NULL,
3217
3380
  tenant_id TEXT NOT NULL,
@@ -3228,7 +3391,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS idx_lt_metrics_key ON lt_metrics_configs(tenan
3228
3391
  var LocalMetricsServerConfigStore = class {
3229
3392
  constructor(db) {
3230
3393
  this.db = db;
3231
- ensureTable(db, DDL18);
3394
+ ensureTable(db, DDL19);
3232
3395
  }
3233
3396
  async getAllConfigs(tenantId) {
3234
3397
  const rows2 = this.db.prepare(
@@ -3351,7 +3514,7 @@ function decryptSecretsInConfig(config) {
3351
3514
 
3352
3515
  // src/stores/LocalMcpServerConfigStore.ts
3353
3516
  import { encrypt as encrypt6, safeDecrypt as safeDecrypt4 } from "@axiom-lattice/core";
3354
- var DDL19 = `
3517
+ var DDL20 = `
3355
3518
  CREATE TABLE IF NOT EXISTS lt_mcp_configs (
3356
3519
  id TEXT NOT NULL,
3357
3520
  tenant_id TEXT NOT NULL,
@@ -3367,11 +3530,29 @@ CREATE TABLE IF NOT EXISTS lt_mcp_configs (
3367
3530
  PRIMARY KEY (tenant_id, id)
3368
3531
  );
3369
3532
  CREATE UNIQUE INDEX IF NOT EXISTS idx_lt_mcp_key ON lt_mcp_configs(tenant_id, key);
3533
+
3534
+ CREATE TABLE IF NOT EXISTS lt_personal_mcp_configs (
3535
+ id TEXT NOT NULL,
3536
+ tenant_id TEXT NOT NULL,
3537
+ owner_assistant_id TEXT NOT NULL,
3538
+ key TEXT NOT NULL,
3539
+ name TEXT,
3540
+ description TEXT,
3541
+ config TEXT NOT NULL,
3542
+ selected_tools TEXT DEFAULT '[]',
3543
+ is_env_encrypted INTEGER NOT NULL DEFAULT 0,
3544
+ status TEXT NOT NULL DEFAULT 'disconnected',
3545
+ created_at TEXT NOT NULL,
3546
+ updated_at TEXT NOT NULL,
3547
+ PRIMARY KEY (tenant_id, owner_assistant_id, id)
3548
+ );
3549
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_lt_personal_mcp_key
3550
+ ON lt_personal_mcp_configs(tenant_id, owner_assistant_id, key);
3370
3551
  `;
3371
3552
  var LocalMcpServerConfigStore = class {
3372
3553
  constructor(db) {
3373
3554
  this.db = db;
3374
- ensureTable(db, DDL19);
3555
+ ensureTable(db, DDL20);
3375
3556
  }
3376
3557
  async getAllConfigs(tenantId) {
3377
3558
  const rows2 = this.db.prepare(
@@ -3493,6 +3674,147 @@ var LocalMcpServerConfigStore = class {
3493
3674
  ).get(tenantId, id);
3494
3675
  return row !== void 0;
3495
3676
  }
3677
+ async getAllConfigsForAssistant(tenantId, ownerAssistantId) {
3678
+ const rows2 = this.db.prepare(
3679
+ `SELECT * FROM lt_personal_mcp_configs
3680
+ WHERE tenant_id = ? AND owner_assistant_id = ?
3681
+ ORDER BY created_at DESC`
3682
+ ).all(tenantId, ownerAssistantId);
3683
+ return rows2.map(mapPersonalRowToEntry);
3684
+ }
3685
+ async getAllPersonalConfigsWithoutTenant() {
3686
+ const rows2 = this.db.prepare(
3687
+ `SELECT * FROM lt_personal_mcp_configs ORDER BY created_at DESC`
3688
+ ).all();
3689
+ return rows2.map(mapPersonalRowToEntry);
3690
+ }
3691
+ async getConfigByIdForAssistant(tenantId, ownerAssistantId, id) {
3692
+ const row = this.db.prepare(
3693
+ `SELECT * FROM lt_personal_mcp_configs
3694
+ WHERE tenant_id = ? AND owner_assistant_id = ? AND id = ?`
3695
+ ).get(tenantId, ownerAssistantId, id);
3696
+ return row ? mapPersonalRowToEntry(row) : null;
3697
+ }
3698
+ async getConfigByKeyForAssistant(tenantId, ownerAssistantId, key) {
3699
+ const row = this.db.prepare(
3700
+ `SELECT * FROM lt_personal_mcp_configs
3701
+ WHERE tenant_id = ? AND owner_assistant_id = ? AND key = ?`
3702
+ ).get(tenantId, ownerAssistantId, key);
3703
+ return row ? mapPersonalRowToEntry(row) : null;
3704
+ }
3705
+ async createConfigForAssistant(tenantId, ownerAssistantId, id, data) {
3706
+ const now = nowISO();
3707
+ const { config: configWithEncryptedEnv, isEnvEncrypted } = encryptEnvInConfig(data.config);
3708
+ this.db.prepare(
3709
+ `INSERT INTO lt_personal_mcp_configs (id, tenant_id, owner_assistant_id, key, name, description, config, selected_tools, is_env_encrypted, status, created_at, updated_at)
3710
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
3711
+ ON CONFLICT(tenant_id, owner_assistant_id, id) DO UPDATE SET
3712
+ key = excluded.key,
3713
+ name = excluded.name,
3714
+ description = excluded.description,
3715
+ config = excluded.config,
3716
+ selected_tools = excluded.selected_tools,
3717
+ is_env_encrypted = excluded.is_env_encrypted,
3718
+ status = excluded.status,
3719
+ updated_at = excluded.updated_at`
3720
+ ).run(
3721
+ id,
3722
+ tenantId,
3723
+ ownerAssistantId,
3724
+ data.key,
3725
+ data.name || null,
3726
+ data.description || null,
3727
+ JSON.stringify(configWithEncryptedEnv),
3728
+ JSON.stringify(data.selectedTools || []),
3729
+ isEnvEncrypted ? 1 : 0,
3730
+ "disconnected",
3731
+ now,
3732
+ now
3733
+ );
3734
+ return {
3735
+ id,
3736
+ tenantId,
3737
+ ownerAssistantId,
3738
+ key: data.key,
3739
+ config: data.config,
3740
+ name: data.name,
3741
+ description: data.description,
3742
+ selectedTools: data.selectedTools || [],
3743
+ isEnvEncrypted,
3744
+ status: "disconnected",
3745
+ createdAt: parseISO(now),
3746
+ updatedAt: parseISO(now)
3747
+ };
3748
+ }
3749
+ async updateConfigForAssistant(tenantId, ownerAssistantId, id, updates) {
3750
+ const existing = await this.getConfigByIdForAssistant(
3751
+ tenantId,
3752
+ ownerAssistantId,
3753
+ id
3754
+ );
3755
+ if (!existing) return null;
3756
+ const setClauses = [];
3757
+ const values = [];
3758
+ if (updates.key !== void 0) {
3759
+ setClauses.push("key = ?");
3760
+ values.push(updates.key);
3761
+ }
3762
+ if (updates.name !== void 0) {
3763
+ setClauses.push("name = ?");
3764
+ values.push(updates.name || null);
3765
+ }
3766
+ if (updates.description !== void 0) {
3767
+ setClauses.push("description = ?");
3768
+ values.push(updates.description || null);
3769
+ }
3770
+ if (updates.config !== void 0) {
3771
+ const { config: configWithEncryptedEnv, isEnvEncrypted } = encryptEnvInConfig(updates.config);
3772
+ setClauses.push("config = ?");
3773
+ values.push(JSON.stringify(configWithEncryptedEnv));
3774
+ setClauses.push("is_env_encrypted = ?");
3775
+ values.push(isEnvEncrypted ? 1 : 0);
3776
+ }
3777
+ if (updates.selectedTools !== void 0) {
3778
+ setClauses.push("selected_tools = ?");
3779
+ values.push(JSON.stringify(updates.selectedTools));
3780
+ }
3781
+ if (updates.status !== void 0) {
3782
+ setClauses.push("status = ?");
3783
+ values.push(updates.status);
3784
+ }
3785
+ if (setClauses.length === 0) return existing;
3786
+ const now = nowISO();
3787
+ setClauses.push("updated_at = ?");
3788
+ values.push(now);
3789
+ values.push(tenantId, ownerAssistantId, id);
3790
+ this.db.prepare(
3791
+ `UPDATE lt_personal_mcp_configs SET ${setClauses.join(", ")}
3792
+ WHERE tenant_id = ? AND owner_assistant_id = ? AND id = ?`
3793
+ ).run(...values);
3794
+ return this.getConfigByIdForAssistant(tenantId, ownerAssistantId, id);
3795
+ }
3796
+ async deleteConfigForAssistant(tenantId, ownerAssistantId, id) {
3797
+ const result = this.db.prepare(
3798
+ `DELETE FROM lt_personal_mcp_configs
3799
+ WHERE tenant_id = ? AND owner_assistant_id = ? AND id = ?`
3800
+ ).run(tenantId, ownerAssistantId, id);
3801
+ return result.changes > 0;
3802
+ }
3803
+ async deleteConfigsForAssistant(tenantId, ownerAssistantId) {
3804
+ const result = this.db.prepare(
3805
+ `DELETE FROM lt_personal_mcp_configs
3806
+ WHERE tenant_id = ? AND owner_assistant_id = ?`
3807
+ ).run(tenantId, ownerAssistantId);
3808
+ return result.changes;
3809
+ }
3810
+ async hasConfigForAssistant(tenantId, ownerAssistantId, id) {
3811
+ const row = this.db.prepare(
3812
+ `SELECT 1 FROM lt_personal_mcp_configs
3813
+ WHERE tenant_id = ? AND owner_assistant_id = ? AND id = ?
3814
+ LIMIT 1`
3815
+ ).get(tenantId, ownerAssistantId, id);
3816
+ return row !== void 0;
3817
+ }
3496
3818
  };
3497
3819
  function mapRowToEntry3(row) {
3498
3820
  const config = JSON.parse(row.config);
@@ -3524,6 +3846,12 @@ function mapRowToEntry3(row) {
3524
3846
  updatedAt: parseISO(row.updated_at)
3525
3847
  };
3526
3848
  }
3849
+ function mapPersonalRowToEntry(row) {
3850
+ return {
3851
+ ...mapRowToEntry3(row),
3852
+ ownerAssistantId: row.owner_assistant_id
3853
+ };
3854
+ }
3527
3855
  function encryptEnvInConfig(config) {
3528
3856
  const configCopy = { ...config };
3529
3857
  let isEnvEncrypted = false;
@@ -3548,7 +3876,7 @@ function encryptEnvInConfig(config) {
3548
3876
 
3549
3877
  // src/stores/LocalModelProviderStore.ts
3550
3878
  import { encrypt as encrypt7, safeDecrypt as safeDecrypt5 } from "@axiom-lattice/core";
3551
- var DDL20 = `
3879
+ var DDL21 = `
3552
3880
  CREATE TABLE IF NOT EXISTS lt_model_providers (
3553
3881
  id TEXT NOT NULL,
3554
3882
  tenant_id TEXT NOT NULL,
@@ -3593,7 +3921,7 @@ CREATE INDEX IF NOT EXISTS idx_lt_model_provider_models_tenant
3593
3921
  var LocalModelProviderStore = class {
3594
3922
  constructor(db) {
3595
3923
  this.db = db;
3596
- ensureTable(db, DDL20);
3924
+ ensureTable(db, DDL21);
3597
3925
  this.ensureColumn(
3598
3926
  "lt_model_providers",
3599
3927
  "api_style",
@@ -3872,8 +4200,8 @@ function mapRowToModel(row) {
3872
4200
  }
3873
4201
 
3874
4202
  // src/stores/LocalWorkflowTrackingStore.ts
3875
- import { randomUUID } from "crypto";
3876
- var DDL21 = `
4203
+ import { randomUUID as randomUUID2 } from "crypto";
4204
+ var DDL22 = `
3877
4205
  CREATE TABLE IF NOT EXISTS lt_workflow_runs (
3878
4206
  id TEXT PRIMARY KEY,
3879
4207
  tenant_id TEXT NOT NULL,
@@ -3920,7 +4248,7 @@ CREATE INDEX IF NOT EXISTS idx_lt_ws_type ON lt_workflow_steps(run_id, step_type
3920
4248
  var LocalWorkflowTrackingStore = class {
3921
4249
  constructor(db) {
3922
4250
  this.db = db;
3923
- ensureTable(db, DDL21);
4251
+ ensureTable(db, DDL22);
3924
4252
  this.ensureColumn("lt_workflow_steps", "thread_id", "thread_id TEXT");
3925
4253
  }
3926
4254
  /** Add a column if it does not exist (SQLite version compatible). */
@@ -3932,7 +4260,7 @@ var LocalWorkflowTrackingStore = class {
3932
4260
  }
3933
4261
  async createWorkflowRun(request) {
3934
4262
  const now = nowISO();
3935
- const id = `${request.threadId}_${Date.now()}_${randomUUID()}`;
4263
+ const id = `${request.threadId}_${Date.now()}_${randomUUID2()}`;
3936
4264
  this.db.prepare(
3937
4265
  `INSERT INTO lt_workflow_runs (id, tenant_id, assistant_id, thread_id, status, topology_edges, total_edges, completed_edges, metadata, started_at, created_at, updated_at)
3938
4266
  VALUES (?, ?, ?, ?, 'running', ?, ?, 0, ?, ?, ?, ?)`
@@ -4218,8 +4546,8 @@ function mapRowToStep(row) {
4218
4546
  }
4219
4547
 
4220
4548
  // src/stores/LocalEvalStore.ts
4221
- import { randomUUID as randomUUID2 } from "crypto";
4222
- var DDL22 = `
4549
+ import { randomUUID as randomUUID3 } from "crypto";
4550
+ var DDL23 = `
4223
4551
  CREATE TABLE IF NOT EXISTS lt_eval_projects (
4224
4552
  id TEXT NOT NULL,
4225
4553
  tenant_id TEXT NOT NULL,
@@ -4305,7 +4633,7 @@ CREATE TABLE IF NOT EXISTS lt_eval_run_results (
4305
4633
  PRIMARY KEY (run_id, id)
4306
4634
  );
4307
4635
  `;
4308
- function parseJson2(val, fallback) {
4636
+ function parseJson3(val, fallback) {
4309
4637
  if (val == null) return fallback;
4310
4638
  if (typeof val === "string") {
4311
4639
  try {
@@ -4330,7 +4658,7 @@ function parseOptionalJson(val) {
4330
4658
  var LocalEvalStore = class {
4331
4659
  constructor(db) {
4332
4660
  this.db = db;
4333
- ensureTable(db, DDL22);
4661
+ ensureTable(db, DDL23);
4334
4662
  this.ensureColumn("lt_eval_runs", "interrupted_cases", "interrupted_cases INTEGER NOT NULL DEFAULT 0");
4335
4663
  this.ensureColumn("lt_eval_run_results", "interrupted", "interrupted INTEGER NOT NULL DEFAULT 0");
4336
4664
  this.ensureColumn("lt_eval_cases", "interrupt_policy", "interrupt_policy TEXT");
@@ -4420,7 +4748,7 @@ var LocalEvalStore = class {
4420
4748
  return row ? this.mapRowToProject(row) : null;
4421
4749
  }
4422
4750
  async createProject(tenantId, id, data) {
4423
- const actualId = id || randomUUID2();
4751
+ const actualId = id || randomUUID3();
4424
4752
  this.db.prepare(
4425
4753
  `INSERT INTO lt_eval_projects (id, tenant_id, name, description, version, judge_model_config, target_server_config, concurrency, report_config, created_at, updated_at)
4426
4754
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
@@ -4528,7 +4856,7 @@ var LocalEvalStore = class {
4528
4856
  return row ? this.mapRowToSuite(row) : null;
4529
4857
  }
4530
4858
  async createSuite(tenantId, projectId, id, data) {
4531
- const actualId = id || randomUUID2();
4859
+ const actualId = id || randomUUID3();
4532
4860
  this.db.prepare(
4533
4861
  `INSERT INTO lt_eval_suites (id, tenant_id, project_id, name, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)`
4534
4862
  ).run(actualId, tenantId, projectId, data.name, nowISO(), nowISO());
@@ -4571,7 +4899,7 @@ var LocalEvalStore = class {
4571
4899
  return row ? this.mapRowToCase(row) : null;
4572
4900
  }
4573
4901
  async createCase(tenantId, suiteId, id, data) {
4574
- const actualId = id || randomUUID2();
4902
+ const actualId = id || randomUUID3();
4575
4903
  this.db.prepare(
4576
4904
  `INSERT INTO lt_eval_cases (id, tenant_id, suite_id, input_message, input_files, steps, output_type, content_assertion, rubrics, interrupt_policy, created_at, updated_at)
4577
4905
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
@@ -4661,7 +4989,7 @@ var LocalEvalStore = class {
4661
4989
  return row ? this.mapRowToRun(row) : null;
4662
4990
  }
4663
4991
  async createRun(tenantId, projectId, id, data) {
4664
- const actualId = id || randomUUID2();
4992
+ const actualId = id || randomUUID3();
4665
4993
  this.db.prepare(
4666
4994
  `INSERT INTO lt_eval_runs (id, project_id, tenant_id, status, concurrency, total_cases, passed_cases, failed_cases, avg_score, holdout, env_project_id, env_workspace_id, task_id, created_at)
4667
4995
  VALUES (?, ?, ?, 'running', ?, ?, 0, 0, 0, ?, ?, ?, ?, ?)`
@@ -4737,7 +5065,7 @@ var LocalEvalStore = class {
4737
5065
  return row ? this.mapRowToRunResult(row) : null;
4738
5066
  }
4739
5067
  async createRunResult(tenantId, runId, id, data) {
4740
- const actualId = id || randomUUID2();
5068
+ const actualId = id || randomUUID3();
4741
5069
  this.db.prepare(
4742
5070
  `INSERT INTO lt_eval_run_results (id, run_id, suite_name, case_id, pass, score, summary, dimension_results, duration_ms, messages, logs, error, interrupted, created_at)
4743
5071
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
@@ -4844,8 +5172,8 @@ var LocalEvalStore = class {
4844
5172
  name: row.name,
4845
5173
  description: row.description,
4846
5174
  version: row.version,
4847
- judgeModelConfig: parseJson2(row.judge_model_config, {}),
4848
- targetServerConfig: parseJson2(row.target_server_config, {}),
5175
+ judgeModelConfig: parseJson3(row.judge_model_config, {}),
5176
+ targetServerConfig: parseJson3(row.target_server_config, {}),
4849
5177
  concurrency: row.concurrency ?? 3,
4850
5178
  reportConfig: parseOptionalJson(row.report_config),
4851
5179
  createdAt: parseISO(row.created_at),
@@ -4870,7 +5198,7 @@ var LocalEvalStore = class {
4870
5198
  suiteId: row.suite_id,
4871
5199
  inputMessage: row.input_message,
4872
5200
  inputFiles: parseOptionalJson(row.input_files),
4873
- steps: parseJson2(row.steps, []),
5201
+ steps: parseJson3(row.steps, []),
4874
5202
  outputType: row.output_type || "message_content",
4875
5203
  contentAssertion: row.content_assertion || "",
4876
5204
  rubrics: parseOptionalJson(row.rubrics),
@@ -4926,7 +5254,7 @@ var LocalEvalStore = class {
4926
5254
  import {
4927
5255
  DuplicateChannelBindingSubjectError
4928
5256
  } from "@axiom-lattice/protocols";
4929
- import { randomUUID as randomUUID3 } from "crypto";
5257
+ import { randomUUID as randomUUID4 } from "crypto";
4930
5258
 
4931
5259
  // src/stores/room-channel-binding-index.ts
4932
5260
  import {
@@ -4971,7 +5299,7 @@ function mapConflict(row) {
4971
5299
  }
4972
5300
 
4973
5301
  // src/stores/LocalChannelBindingStore.ts
4974
- var DDL23 = `
5302
+ var DDL24 = `
4975
5303
  CREATE TABLE IF NOT EXISTS lt_channel_bindings (
4976
5304
  id TEXT PRIMARY KEY,
4977
5305
  channel TEXT NOT NULL,
@@ -4993,7 +5321,7 @@ CREATE TABLE IF NOT EXISTS lt_channel_bindings (
4993
5321
  var LocalChannelBindingStore = class {
4994
5322
  constructor(db) {
4995
5323
  this.db = db;
4996
- ensureTable(db, DDL23);
5324
+ ensureTable(db, DDL24);
4997
5325
  ensureChannelBindingSubjectIndex(db);
4998
5326
  }
4999
5327
  async findById(tenantId, id) {
@@ -5016,7 +5344,7 @@ var LocalChannelBindingStore = class {
5016
5344
  return row ? mapRowToBinding(row) : null;
5017
5345
  }
5018
5346
  async create(input) {
5019
- const id = randomUUID3();
5347
+ const id = randomUUID4();
5020
5348
  const now = nowISO();
5021
5349
  try {
5022
5350
  this.db.prepare(
@@ -5173,7 +5501,7 @@ function mapRowToBinding(row) {
5173
5501
  }
5174
5502
 
5175
5503
  // src/stores/LocalChannelInstallationStore.ts
5176
- var DDL24 = `
5504
+ var DDL25 = `
5177
5505
  CREATE TABLE IF NOT EXISTS lt_channel_installations (
5178
5506
  id TEXT PRIMARY KEY,
5179
5507
  tenant_id TEXT NOT NULL,
@@ -5191,13 +5519,13 @@ CREATE INDEX IF NOT EXISTS idx_lt_ci_tenant ON lt_channel_installations(tenant_i
5191
5519
  var LocalChannelInstallationStore = class {
5192
5520
  constructor(db) {
5193
5521
  this.db = db;
5194
- ensureTable(db, DDL24);
5522
+ ensureTable(db, DDL25);
5195
5523
  }
5196
5524
  async getInstallationById(installationId) {
5197
5525
  const row = this.db.prepare(
5198
5526
  `SELECT * FROM lt_channel_installations WHERE id = ?`
5199
5527
  ).get(installationId);
5200
- return row ? mapRow14(row) : null;
5528
+ return row ? mapRow15(row) : null;
5201
5529
  }
5202
5530
  async getInstallationsByTenant(tenantId, channel) {
5203
5531
  let rows2;
@@ -5210,7 +5538,7 @@ var LocalChannelInstallationStore = class {
5210
5538
  `SELECT * FROM lt_channel_installations WHERE tenant_id = ? ORDER BY created_at DESC`
5211
5539
  ).all(tenantId);
5212
5540
  }
5213
- return rows2.map(mapRow14);
5541
+ return rows2.map(mapRow15);
5214
5542
  }
5215
5543
  async getAllInstallations(channel) {
5216
5544
  let rows2;
@@ -5223,7 +5551,7 @@ var LocalChannelInstallationStore = class {
5223
5551
  `SELECT * FROM lt_channel_installations ORDER BY created_at DESC`
5224
5552
  ).all();
5225
5553
  }
5226
- return rows2.map(mapRow14);
5554
+ return rows2.map(mapRow15);
5227
5555
  }
5228
5556
  async createInstallation(tenantId, installationId, data) {
5229
5557
  const now = nowISO();
@@ -5299,7 +5627,7 @@ var LocalChannelInstallationStore = class {
5299
5627
  return result.changes > 0;
5300
5628
  }
5301
5629
  };
5302
- function mapRow14(row) {
5630
+ function mapRow15(row) {
5303
5631
  return {
5304
5632
  id: row.id,
5305
5633
  tenantId: row.tenant_id,
@@ -5316,8 +5644,8 @@ function mapRow14(row) {
5316
5644
 
5317
5645
  // src/stores/LocalA2AApiKeyStore.ts
5318
5646
  import { encrypt as encrypt8, decrypt as decrypt2, safeDecrypt as safeDecrypt6 } from "@axiom-lattice/core";
5319
- import { randomUUID as randomUUID4 } from "crypto";
5320
- var DDL25 = `
5647
+ import { randomUUID as randomUUID5 } from "crypto";
5648
+ var DDL26 = `
5321
5649
  CREATE TABLE IF NOT EXISTS lt_a2a_api_keys (
5322
5650
  id TEXT PRIMARY KEY,
5323
5651
  key_value TEXT NOT NULL,
@@ -5332,7 +5660,7 @@ CREATE TABLE IF NOT EXISTS lt_a2a_api_keys (
5332
5660
  );
5333
5661
  `;
5334
5662
  function generateApiKey() {
5335
- return `a2a_${randomUUID4().replace(/-/g, "")}`;
5663
+ return `a2a_${randomUUID5().replace(/-/g, "")}`;
5336
5664
  }
5337
5665
  function parseGrants(raw) {
5338
5666
  if (!raw) return void 0;
@@ -5355,7 +5683,7 @@ function parseAssistantIds(raw) {
5355
5683
  var LocalA2AApiKeyStore = class {
5356
5684
  constructor(db) {
5357
5685
  this.db = db;
5358
- ensureTable(db, DDL25);
5686
+ ensureTable(db, DDL26);
5359
5687
  this.ensureColumn("lt_a2a_api_keys", "assistant_ids", "assistant_ids TEXT");
5360
5688
  this.ensureColumn("lt_a2a_api_keys", "grants", "grants TEXT");
5361
5689
  this.repairManagementIds();
@@ -5376,7 +5704,7 @@ var LocalA2AApiKeyStore = class {
5376
5704
  if (!row.id || !uuidPattern.test(row.id)) {
5377
5705
  this.db.prepare(
5378
5706
  `UPDATE lt_a2a_api_keys SET id = ? WHERE rowid = ?`
5379
- ).run(randomUUID4(), row.rowid);
5707
+ ).run(randomUUID5(), row.rowid);
5380
5708
  }
5381
5709
  }
5382
5710
  }
@@ -5414,7 +5742,7 @@ var LocalA2AApiKeyStore = class {
5414
5742
  return rows2.map(mapRowToRecord);
5415
5743
  }
5416
5744
  async create(input) {
5417
- const id = randomUUID4();
5745
+ const id = randomUUID5();
5418
5746
  const key = generateApiKey();
5419
5747
  const now = nowISO();
5420
5748
  this.db.prepare(
@@ -5535,8 +5863,8 @@ function mapRowToRecord(row) {
5535
5863
  }
5536
5864
 
5537
5865
  // src/stores/LocalOpenAuditStore.ts
5538
- import { randomUUID as randomUUID5 } from "crypto";
5539
- var DDL26 = `
5866
+ import { randomUUID as randomUUID6 } from "crypto";
5867
+ var DDL27 = `
5540
5868
  CREATE TABLE IF NOT EXISTS lt_open_audit (
5541
5869
  id TEXT PRIMARY KEY,
5542
5870
  tenant_id TEXT NOT NULL,
@@ -5555,7 +5883,7 @@ CREATE TABLE IF NOT EXISTS lt_open_audit (
5555
5883
  var LocalOpenAuditStore = class {
5556
5884
  constructor(db) {
5557
5885
  this.db = db;
5558
- ensureTable(db, DDL26);
5886
+ ensureTable(db, DDL27);
5559
5887
  }
5560
5888
  async query(params) {
5561
5889
  const clauses = ["tenant_id = ?"];
@@ -5608,7 +5936,7 @@ var LocalOpenAuditStore = class {
5608
5936
  (id, tenant_id, credential_id, credential_kind, project_id, domain, action, args, status, error_code, duration_ms, created_at)
5609
5937
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
5610
5938
  ).run(
5611
- randomUUID5(),
5939
+ randomUUID6(),
5612
5940
  record2.tenantId,
5613
5941
  record2.credentialId,
5614
5942
  record2.credentialKind,
@@ -5629,8 +5957,8 @@ import {
5629
5957
  parseQueuedExecutionMode,
5630
5958
  parseTrustedRunContext
5631
5959
  } from "@axiom-lattice/protocols";
5632
- import { randomUUID as randomUUID6 } from "crypto";
5633
- var DDL27 = `
5960
+ import { randomUUID as randomUUID7 } from "crypto";
5961
+ var DDL28 = `
5634
5962
  CREATE TABLE IF NOT EXISTS lt_thread_message_queue (
5635
5963
  id TEXT PRIMARY KEY,
5636
5964
  thread_id TEXT NOT NULL,
@@ -5659,7 +5987,7 @@ var LocalThreadMessageQueueStore = class {
5659
5987
  constructor(db) {
5660
5988
  this.capacityTail = Promise.resolve();
5661
5989
  this.db = db;
5662
- ensureTable(db, DDL27);
5990
+ ensureTable(db, DDL28);
5663
5991
  const columns6 = db.prepare("PRAGMA table_info(lt_thread_message_queue)").all();
5664
5992
  const names = new Set(columns6.map(({ name }) => name));
5665
5993
  if (!names.has("trusted_run_context")) {
@@ -5682,7 +6010,7 @@ var LocalThreadMessageQueueStore = class {
5682
6010
  async addMessage(params) {
5683
6011
  const trusted = validateQueueTrust(params);
5684
6012
  const now = nowISO();
5685
- const id = params.id || randomUUID6();
6013
+ const id = params.id || randomUUID7();
5686
6014
  const seqRow = this.db.prepare(
5687
6015
  `SELECT COALESCE(MAX(sequence_order), 0) + 1 as next_seq FROM lt_thread_message_queue WHERE thread_id = ?`
5688
6016
  ).get(params.threadId);
@@ -5725,7 +6053,7 @@ var LocalThreadMessageQueueStore = class {
5725
6053
  projectId: params.projectId
5726
6054
  };
5727
6055
  const filter = scopeClause(scope);
5728
- const id = params.id || randomUUID6();
6056
+ const id = params.id || randomUUID7();
5729
6057
  const limit = maxSize === Infinity ? -1 : maxSize;
5730
6058
  const result = this.db.prepare(
5731
6059
  `INSERT INTO lt_thread_message_queue (id, thread_id, tenant_id, assistant_id, workspace_id, project_id, message_content, message_type, sequence_order, priority, command, custom_run_config, trusted_run_context, execution_mode, created_at)
@@ -5763,7 +6091,7 @@ var LocalThreadMessageQueueStore = class {
5763
6091
  async addMessageAtHead(params) {
5764
6092
  const trusted = validateQueueTrust(params);
5765
6093
  const now = nowISO();
5766
- const id = params.id || randomUUID6();
6094
+ const id = params.id || randomUUID7();
5767
6095
  const seqRow = this.db.prepare(
5768
6096
  `SELECT COALESCE(MAX(sequence_order), 0) + 1 as next_seq FROM lt_thread_message_queue WHERE thread_id = ?`
5769
6097
  ).get(params.threadId);
@@ -5919,7 +6247,7 @@ function rowToMessage(row) {
5919
6247
  }
5920
6248
 
5921
6249
  // src/stores/LocalSkillStore.ts
5922
- var DDL28 = `
6250
+ var DDL29 = `
5923
6251
  CREATE TABLE IF NOT EXISTS lt_skills (
5924
6252
  id TEXT NOT NULL,
5925
6253
  tenant_id TEXT NOT NULL,
@@ -5938,7 +6266,7 @@ CREATE TABLE IF NOT EXISTS lt_skills (
5938
6266
  var LocalSkillStore = class {
5939
6267
  constructor(db) {
5940
6268
  this.db = db;
5941
- ensureTable(db, DDL28);
6269
+ ensureTable(db, DDL29);
5942
6270
  }
5943
6271
  async getAllSkills(tenantId, _context) {
5944
6272
  const rows2 = this.db.prepare(
@@ -6088,7 +6416,7 @@ function mapRowToSkill(row) {
6088
6416
  }
6089
6417
 
6090
6418
  // src/stores/LocalScheduleStorage.ts
6091
- var DDL29 = `
6419
+ var DDL30 = `
6092
6420
  CREATE TABLE IF NOT EXISTS lt_scheduled_tasks (
6093
6421
  task_id TEXT PRIMARY KEY,
6094
6422
  task_type TEXT NOT NULL,
@@ -6121,7 +6449,7 @@ CREATE INDEX IF NOT EXISTS idx_lt_st_tenant ON lt_scheduled_tasks(tenant_id);
6121
6449
  var LocalScheduleStorage = class {
6122
6450
  constructor(db) {
6123
6451
  this.db = db;
6124
- ensureTable(db, DDL29);
6452
+ ensureTable(db, DDL30);
6125
6453
  }
6126
6454
  async save(task) {
6127
6455
  this.db.prepare(
@@ -6439,7 +6767,7 @@ function mapRowToTask(row) {
6439
6767
 
6440
6768
  // src/stores/LocalTaskStore.ts
6441
6769
  import { normalizeTaskMetadataScalar } from "@axiom-lattice/protocols";
6442
- import { randomUUID as randomUUID7 } from "crypto";
6770
+ import { randomUUID as randomUUID8 } from "crypto";
6443
6771
  var MAX_CANONICAL_TASK_TIME = "9999-12-31T23:59:59.999Z";
6444
6772
  var TASK_STATUSES = /* @__PURE__ */ new Set([
6445
6773
  "pending",
@@ -6455,7 +6783,7 @@ var NEXT_UPDATED_AT_SQL = `updated_at = CASE
6455
6783
  THEN strftime('%Y-%m-%dT%H:%M:%fZ', updated_at, '+0.001 seconds')
6456
6784
  ELSE ?
6457
6785
  END`;
6458
- var DDL30 = `
6786
+ var DDL31 = `
6459
6787
  CREATE TABLE IF NOT EXISTS lt_tasks (
6460
6788
  id TEXT NOT NULL,
6461
6789
  tenant_id TEXT NOT NULL,
@@ -6528,7 +6856,7 @@ function assertPage(limit, offset = 0) {
6528
6856
  var LocalTaskStore = class {
6529
6857
  constructor(db) {
6530
6858
  this.db = db;
6531
- ensureTable(db, DDL30);
6859
+ ensureTable(db, DDL31);
6532
6860
  this.ensureColumn("lt_tasks", "require_review", "require_review INTEGER DEFAULT 0");
6533
6861
  this.ensureColumn("lt_tasks", "dependencies", "dependencies TEXT");
6534
6862
  this.ensureColumn("lt_tasks", "result", "result TEXT");
@@ -6545,7 +6873,7 @@ var LocalTaskStore = class {
6545
6873
  }
6546
6874
  }
6547
6875
  async create(params) {
6548
- const id = params.id ?? randomUUID7();
6876
+ const id = params.id ?? randomUUID8();
6549
6877
  const now = nowISO();
6550
6878
  this.db.prepare(
6551
6879
  `INSERT INTO lt_tasks (id, tenant_id, owner_type, owner_id, title, description, status, priority, due_date, metadata, parent_id, source_id, context, require_review, dependencies, result, failure_reason, workspace_id, project_id, files, created_at, updated_at)
@@ -7212,7 +7540,7 @@ var PROJECT_LIFECYCLE_ACTIONS = /* @__PURE__ */ new Set([
7212
7540
  "cancelled",
7213
7541
  "reassigned"
7214
7542
  ]);
7215
- var DDL31 = `
7543
+ var DDL32 = `
7216
7544
  CREATE TABLE IF NOT EXISTS lt_task_work_items (
7217
7545
  id TEXT NOT NULL,
7218
7546
  tenant_id TEXT NOT NULL,
@@ -7286,7 +7614,7 @@ function assertLifecyclePage(query) {
7286
7614
  var LocalTaskWorkItemStore = class {
7287
7615
  constructor(db) {
7288
7616
  this.db = db;
7289
- ensureTable(db, DDL31);
7617
+ ensureTable(db, DDL32);
7290
7618
  this.ensureColumn("lt_task_work_items", "workspace_id", "workspace_id TEXT");
7291
7619
  this.ensureColumn("lt_task_work_items", "project_id", "project_id TEXT");
7292
7620
  this.ensureColumn("lt_task_work_items", "event_key", "event_key TEXT");
@@ -7482,8 +7810,8 @@ var LocalTaskWorkItemStore = class {
7482
7810
  };
7483
7811
 
7484
7812
  // src/stores/LocalCapabilityBundleStore.ts
7485
- import { randomUUID as randomUUID8 } from "crypto";
7486
- var DDL32 = `CREATE TABLE IF NOT EXISTS lt_capability_bundles (id TEXT NOT NULL, tenant_id TEXT NOT NULL, bundle_key TEXT NOT NULL, name TEXT NOT NULL, description TEXT, capabilities TEXT NOT NULL DEFAULT '[]', created_at TEXT NOT NULL, updated_at TEXT NOT NULL, PRIMARY KEY (tenant_id, id), UNIQUE (tenant_id, bundle_key)); CREATE INDEX IF NOT EXISTS idx_lt_capability_bundles_tenant ON lt_capability_bundles(tenant_id);`;
7813
+ import { randomUUID as randomUUID9 } from "crypto";
7814
+ var DDL33 = `CREATE TABLE IF NOT EXISTS lt_capability_bundles (id TEXT NOT NULL, tenant_id TEXT NOT NULL, bundle_key TEXT NOT NULL, name TEXT NOT NULL, description TEXT, capabilities TEXT NOT NULL DEFAULT '[]', created_at TEXT NOT NULL, updated_at TEXT NOT NULL, PRIMARY KEY (tenant_id, id), UNIQUE (tenant_id, bundle_key)); CREATE INDEX IF NOT EXISTS idx_lt_capability_bundles_tenant ON lt_capability_bundles(tenant_id);`;
7487
7815
  var duplicateMessage = "Capability bundle key already exists for tenant";
7488
7816
  function map(row) {
7489
7817
  return { id: row.id, tenantId: row.tenant_id, key: row.bundle_key, name: row.name, description: row.description ?? void 0, capabilities: JSON.parse(row.capabilities), createdAt: parseISO(row.created_at).toISOString(), updatedAt: parseISO(row.updated_at).toISOString() };
@@ -7504,7 +7832,7 @@ var LocalCapabilityBundleStore = class {
7504
7832
  */
7505
7833
  constructor(db) {
7506
7834
  this.db = db;
7507
- ensureTable(db, DDL32);
7835
+ ensureTable(db, DDL33);
7508
7836
  }
7509
7837
  async listByTenant(tenantId) {
7510
7838
  return this.db.prepare("SELECT * FROM lt_capability_bundles WHERE tenant_id = ? ORDER BY created_at").all(tenantId).map(map);
@@ -7521,7 +7849,7 @@ var LocalCapabilityBundleStore = class {
7521
7849
  }
7522
7850
  async create(tenantId, input) {
7523
7851
  const now = nextTimestamp();
7524
- const id = randomUUID8();
7852
+ const id = randomUUID9();
7525
7853
  try {
7526
7854
  this.db.prepare("INSERT INTO lt_capability_bundles (id, tenant_id, bundle_key, name, description, capabilities, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(id, tenantId, input.key, input.name, input.description ?? null, JSON.stringify(input.capabilities), now, now);
7527
7855
  } catch (error) {
@@ -7598,6 +7926,7 @@ async function createLocalStoreConfig(options = {}) {
7598
7926
  oidcIdentityClaim: new LocalOidcIdentityClaimStore(db),
7599
7927
  inviteLink: new LocalInviteLinkStore(db),
7600
7928
  platformSettings: new LocalPlatformSettingsStore(db),
7929
+ platformAudit: new LocalPlatformAuditStore(db),
7601
7930
  database: new LocalDatabaseConfigStore(db),
7602
7931
  connection: new LocalConnectionStore(db),
7603
7932
  metrics: new LocalMetricsServerConfigStore(db),
@@ -7675,6 +8004,7 @@ export {
7675
8004
  LocalOidcIdentityClaimStore,
7676
8005
  LocalOidcProviderConfigStore,
7677
8006
  LocalOpenAuditStore,
8007
+ LocalPlatformAuditStore,
7678
8008
  LocalPlatformInvitationStore,
7679
8009
  LocalPlatformMemberStore,
7680
8010
  LocalPlatformSettingsStore,