@axiom-lattice/local-stores 5.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +172 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +46 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/LocalAssistantStore.test.ts +235 -0
- package/src/__tests__/LocalDatabaseConfigStore.test.ts +194 -0
- package/src/__tests__/LocalEvalStore.crud.test.ts +355 -0
- package/src/__tests__/LocalMetricsServerConfigStore.test.ts +276 -0
- package/src/__tests__/LocalModelProviderStore.test.ts +203 -0
- package/src/__tests__/LocalScheduleStorage.crud.test.ts +304 -0
- package/src/__tests__/LocalSkillStore.test.ts +284 -0
- package/src/__tests__/LocalWorkflowTrackingStore.test.ts +510 -0
- package/src/stores/LocalMetricsServerConfigStore.ts +35 -3
- package/src/stores/LocalScheduleStorage.ts +6 -1
- package/src/stores/LocalWorkflowTrackingStore.ts +13 -3
package/dist/index.mjs
CHANGED
|
@@ -2355,6 +2355,7 @@ var LocalConnectionStore = class {
|
|
|
2355
2355
|
};
|
|
2356
2356
|
|
|
2357
2357
|
// src/stores/LocalMetricsServerConfigStore.ts
|
|
2358
|
+
import { encrypt as encrypt3, isEncryptedValue as isEncryptedValue2, safeDecrypt } from "@axiom-lattice/core";
|
|
2358
2359
|
var DDL11 = `
|
|
2359
2360
|
CREATE TABLE IF NOT EXISTS lt_metrics_configs (
|
|
2360
2361
|
id TEXT NOT NULL,
|
|
@@ -2409,7 +2410,7 @@ var LocalMetricsServerConfigStore = class {
|
|
|
2409
2410
|
description = excluded.description,
|
|
2410
2411
|
config = excluded.config,
|
|
2411
2412
|
updated_at = excluded.updated_at`
|
|
2412
|
-
).run(id, tenantId, data.key, data.name || null, data.description || null, JSON.stringify(data.config), now, now);
|
|
2413
|
+
).run(id, tenantId, data.key, data.name || null, data.description || null, JSON.stringify(encryptSecretsInConfig(data.config)), now, now);
|
|
2413
2414
|
return {
|
|
2414
2415
|
id,
|
|
2415
2416
|
tenantId,
|
|
@@ -2440,7 +2441,7 @@ var LocalMetricsServerConfigStore = class {
|
|
|
2440
2441
|
}
|
|
2441
2442
|
if (updates.config !== void 0) {
|
|
2442
2443
|
setClauses.push("config = ?");
|
|
2443
|
-
values.push(JSON.stringify(updates.config));
|
|
2444
|
+
values.push(JSON.stringify(encryptSecretsInConfig(updates.config)));
|
|
2444
2445
|
}
|
|
2445
2446
|
if (setClauses.length === 0) return existing;
|
|
2446
2447
|
const now = nowISO();
|
|
@@ -2470,16 +2471,31 @@ function mapRowToEntry2(row) {
|
|
|
2470
2471
|
id: row.id,
|
|
2471
2472
|
tenantId: row.tenant_id,
|
|
2472
2473
|
key: row.key,
|
|
2473
|
-
config: JSON.parse(row.config),
|
|
2474
|
+
config: decryptSecretsInConfig(JSON.parse(row.config)),
|
|
2474
2475
|
name: row.name || void 0,
|
|
2475
2476
|
description: row.description || void 0,
|
|
2476
2477
|
createdAt: parseISO(row.created_at),
|
|
2477
2478
|
updatedAt: parseISO(row.updated_at)
|
|
2478
2479
|
};
|
|
2479
2480
|
}
|
|
2481
|
+
function encryptSecretsInConfig(config) {
|
|
2482
|
+
const configCopy = { ...config };
|
|
2483
|
+
if (configCopy.apiKey) configCopy.apiKey = encrypt3(configCopy.apiKey);
|
|
2484
|
+
if (configCopy.password) configCopy.password = encrypt3(configCopy.password);
|
|
2485
|
+
return configCopy;
|
|
2486
|
+
}
|
|
2487
|
+
function decryptSecretsInConfig(config) {
|
|
2488
|
+
if (config.apiKey && isEncryptedValue2(config.apiKey)) {
|
|
2489
|
+
config.apiKey = safeDecrypt(config.apiKey);
|
|
2490
|
+
}
|
|
2491
|
+
if (config.password && isEncryptedValue2(config.password)) {
|
|
2492
|
+
config.password = safeDecrypt(config.password);
|
|
2493
|
+
}
|
|
2494
|
+
return config;
|
|
2495
|
+
}
|
|
2480
2496
|
|
|
2481
2497
|
// src/stores/LocalMcpServerConfigStore.ts
|
|
2482
|
-
import { encrypt as
|
|
2498
|
+
import { encrypt as encrypt4, safeDecrypt as safeDecrypt2 } from "@axiom-lattice/core";
|
|
2483
2499
|
var DDL12 = `
|
|
2484
2500
|
CREATE TABLE IF NOT EXISTS lt_mcp_configs (
|
|
2485
2501
|
id TEXT NOT NULL,
|
|
@@ -2628,14 +2644,14 @@ function mapRowToEntry3(row) {
|
|
|
2628
2644
|
if (config.env && row.is_env_encrypted) {
|
|
2629
2645
|
const decryptedEnv = {};
|
|
2630
2646
|
for (const [key, value] of Object.entries(config.env)) {
|
|
2631
|
-
decryptedEnv[key] =
|
|
2647
|
+
decryptedEnv[key] = safeDecrypt2(value);
|
|
2632
2648
|
}
|
|
2633
2649
|
config.env = decryptedEnv;
|
|
2634
2650
|
}
|
|
2635
2651
|
if (config.headers && row.is_env_encrypted) {
|
|
2636
2652
|
const decryptedHeaders = {};
|
|
2637
2653
|
for (const [key, value] of Object.entries(config.headers)) {
|
|
2638
|
-
decryptedHeaders[key] =
|
|
2654
|
+
decryptedHeaders[key] = safeDecrypt2(value);
|
|
2639
2655
|
}
|
|
2640
2656
|
config.headers = decryptedHeaders;
|
|
2641
2657
|
}
|
|
@@ -2659,7 +2675,7 @@ function encryptEnvInConfig(config) {
|
|
|
2659
2675
|
if (configCopy.env && Object.keys(configCopy.env).length > 0) {
|
|
2660
2676
|
const encryptedEnv = {};
|
|
2661
2677
|
for (const [key, value] of Object.entries(configCopy.env)) {
|
|
2662
|
-
encryptedEnv[key] =
|
|
2678
|
+
encryptedEnv[key] = encrypt4(value);
|
|
2663
2679
|
}
|
|
2664
2680
|
configCopy.env = encryptedEnv;
|
|
2665
2681
|
isEnvEncrypted = true;
|
|
@@ -2667,7 +2683,7 @@ function encryptEnvInConfig(config) {
|
|
|
2667
2683
|
if (configCopy.headers && Object.keys(configCopy.headers).length > 0) {
|
|
2668
2684
|
const encryptedHeaders = {};
|
|
2669
2685
|
for (const [key, value] of Object.entries(configCopy.headers)) {
|
|
2670
|
-
encryptedHeaders[key] =
|
|
2686
|
+
encryptedHeaders[key] = encrypt4(value);
|
|
2671
2687
|
}
|
|
2672
2688
|
configCopy.headers = encryptedHeaders;
|
|
2673
2689
|
isEnvEncrypted = true;
|
|
@@ -2676,7 +2692,7 @@ function encryptEnvInConfig(config) {
|
|
|
2676
2692
|
}
|
|
2677
2693
|
|
|
2678
2694
|
// src/stores/LocalModelProviderStore.ts
|
|
2679
|
-
import { encrypt as
|
|
2695
|
+
import { encrypt as encrypt5, safeDecrypt as safeDecrypt3 } from "@axiom-lattice/core";
|
|
2680
2696
|
var DDL13 = `
|
|
2681
2697
|
CREATE TABLE IF NOT EXISTS lt_model_providers (
|
|
2682
2698
|
id TEXT NOT NULL,
|
|
@@ -2792,7 +2808,7 @@ var LocalModelProviderStore = class {
|
|
|
2792
2808
|
// Phase 1 pins the LLM provider (ADR-138 decision 7b)
|
|
2793
2809
|
"openai",
|
|
2794
2810
|
data.baseURL,
|
|
2795
|
-
data.apiKey ?
|
|
2811
|
+
data.apiKey ? encrypt5(data.apiKey) : null,
|
|
2796
2812
|
data.apiKey ? data.apiKey.slice(-4) : null,
|
|
2797
2813
|
data.enabled === false ? 0 : 1,
|
|
2798
2814
|
now,
|
|
@@ -2827,7 +2843,7 @@ var LocalModelProviderStore = class {
|
|
|
2827
2843
|
set("api_key_enc", null);
|
|
2828
2844
|
set("api_key_hint", null);
|
|
2829
2845
|
} else if (updates.apiKey) {
|
|
2830
|
-
set("api_key_enc",
|
|
2846
|
+
set("api_key_enc", encrypt5(updates.apiKey));
|
|
2831
2847
|
set("api_key_hint", updates.apiKey.slice(-4));
|
|
2832
2848
|
}
|
|
2833
2849
|
if (fields.length === 0) {
|
|
@@ -2962,7 +2978,7 @@ var LocalModelProviderStore = class {
|
|
|
2962
2978
|
function mapRowToEntry4(row) {
|
|
2963
2979
|
let apiKey;
|
|
2964
2980
|
if (row.api_key_enc) {
|
|
2965
|
-
apiKey =
|
|
2981
|
+
apiKey = safeDecrypt3(row.api_key_enc);
|
|
2966
2982
|
}
|
|
2967
2983
|
return {
|
|
2968
2984
|
id: row.id,
|
|
@@ -3001,6 +3017,7 @@ function mapRowToModel(row) {
|
|
|
3001
3017
|
}
|
|
3002
3018
|
|
|
3003
3019
|
// src/stores/LocalWorkflowTrackingStore.ts
|
|
3020
|
+
import { randomUUID } from "crypto";
|
|
3004
3021
|
var DDL14 = `
|
|
3005
3022
|
CREATE TABLE IF NOT EXISTS lt_workflow_runs (
|
|
3006
3023
|
id TEXT PRIMARY KEY,
|
|
@@ -3044,17 +3061,23 @@ CREATE TABLE IF NOT EXISTS lt_workflow_steps (
|
|
|
3044
3061
|
PRIMARY KEY (run_id, id)
|
|
3045
3062
|
);
|
|
3046
3063
|
CREATE INDEX IF NOT EXISTS idx_lt_ws_type ON lt_workflow_steps(run_id, step_type);
|
|
3047
|
-
-- Backfill for existing databases that don't have the column
|
|
3048
|
-
ALTER TABLE lt_workflow_steps ADD COLUMN IF NOT EXISTS thread_id TEXT;
|
|
3049
3064
|
`;
|
|
3050
3065
|
var LocalWorkflowTrackingStore = class {
|
|
3051
3066
|
constructor(db) {
|
|
3052
3067
|
this.db = db;
|
|
3053
3068
|
ensureTable(db, DDL14);
|
|
3069
|
+
this.ensureColumn("lt_workflow_steps", "thread_id", "thread_id TEXT");
|
|
3070
|
+
}
|
|
3071
|
+
/** Add a column if it does not exist (SQLite version compatible). */
|
|
3072
|
+
ensureColumn(table, column, ddl2) {
|
|
3073
|
+
const cols = this.db.prepare(`PRAGMA table_info(${table})`).all();
|
|
3074
|
+
if (!cols.some((c) => c.name === column)) {
|
|
3075
|
+
this.db.exec(`ALTER TABLE ${table} ADD COLUMN ${ddl2}`);
|
|
3076
|
+
}
|
|
3054
3077
|
}
|
|
3055
3078
|
async createWorkflowRun(request) {
|
|
3056
3079
|
const now = nowISO();
|
|
3057
|
-
const id = `${request.threadId}_${Date.now()}`;
|
|
3080
|
+
const id = `${request.threadId}_${Date.now()}_${randomUUID()}`;
|
|
3058
3081
|
this.db.prepare(
|
|
3059
3082
|
`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)
|
|
3060
3083
|
VALUES (?, ?, ?, ?, 'running', ?, ?, 0, ?, ?, ?, ?)`
|
|
@@ -3340,7 +3363,7 @@ function mapRowToStep(row) {
|
|
|
3340
3363
|
}
|
|
3341
3364
|
|
|
3342
3365
|
// src/stores/LocalEvalStore.ts
|
|
3343
|
-
import { randomUUID } from "crypto";
|
|
3366
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
3344
3367
|
var DDL15 = `
|
|
3345
3368
|
CREATE TABLE IF NOT EXISTS lt_eval_projects (
|
|
3346
3369
|
id TEXT NOT NULL,
|
|
@@ -3542,7 +3565,7 @@ var LocalEvalStore = class {
|
|
|
3542
3565
|
return row ? this.mapRowToProject(row) : null;
|
|
3543
3566
|
}
|
|
3544
3567
|
async createProject(tenantId, id, data) {
|
|
3545
|
-
const actualId = id ||
|
|
3568
|
+
const actualId = id || randomUUID2();
|
|
3546
3569
|
this.db.prepare(
|
|
3547
3570
|
`INSERT INTO lt_eval_projects (id, tenant_id, name, description, version, judge_model_config, target_server_config, concurrency, report_config, created_at, updated_at)
|
|
3548
3571
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
@@ -3650,7 +3673,7 @@ var LocalEvalStore = class {
|
|
|
3650
3673
|
return row ? this.mapRowToSuite(row) : null;
|
|
3651
3674
|
}
|
|
3652
3675
|
async createSuite(tenantId, projectId, id, data) {
|
|
3653
|
-
const actualId = id ||
|
|
3676
|
+
const actualId = id || randomUUID2();
|
|
3654
3677
|
this.db.prepare(
|
|
3655
3678
|
`INSERT INTO lt_eval_suites (id, tenant_id, project_id, name, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)`
|
|
3656
3679
|
).run(actualId, tenantId, projectId, data.name, nowISO(), nowISO());
|
|
@@ -3693,7 +3716,7 @@ var LocalEvalStore = class {
|
|
|
3693
3716
|
return row ? this.mapRowToCase(row) : null;
|
|
3694
3717
|
}
|
|
3695
3718
|
async createCase(tenantId, suiteId, id, data) {
|
|
3696
|
-
const actualId = id ||
|
|
3719
|
+
const actualId = id || randomUUID2();
|
|
3697
3720
|
this.db.prepare(
|
|
3698
3721
|
`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)
|
|
3699
3722
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
@@ -3783,7 +3806,7 @@ var LocalEvalStore = class {
|
|
|
3783
3806
|
return row ? this.mapRowToRun(row) : null;
|
|
3784
3807
|
}
|
|
3785
3808
|
async createRun(tenantId, projectId, id, data) {
|
|
3786
|
-
const actualId = id ||
|
|
3809
|
+
const actualId = id || randomUUID2();
|
|
3787
3810
|
this.db.prepare(
|
|
3788
3811
|
`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)
|
|
3789
3812
|
VALUES (?, ?, ?, 'running', ?, ?, 0, 0, 0, ?, ?, ?, ?, ?)`
|
|
@@ -3859,7 +3882,7 @@ var LocalEvalStore = class {
|
|
|
3859
3882
|
return row ? this.mapRowToRunResult(row) : null;
|
|
3860
3883
|
}
|
|
3861
3884
|
async createRunResult(tenantId, runId, id, data) {
|
|
3862
|
-
const actualId = id ||
|
|
3885
|
+
const actualId = id || randomUUID2();
|
|
3863
3886
|
this.db.prepare(
|
|
3864
3887
|
`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)
|
|
3865
3888
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
@@ -4048,7 +4071,7 @@ var LocalEvalStore = class {
|
|
|
4048
4071
|
import {
|
|
4049
4072
|
DuplicateChannelBindingSubjectError
|
|
4050
4073
|
} from "@axiom-lattice/protocols";
|
|
4051
|
-
import { randomUUID as
|
|
4074
|
+
import { randomUUID as randomUUID3 } from "crypto";
|
|
4052
4075
|
|
|
4053
4076
|
// src/stores/room-channel-binding-index.ts
|
|
4054
4077
|
import {
|
|
@@ -4138,7 +4161,7 @@ var LocalChannelBindingStore = class {
|
|
|
4138
4161
|
return row ? mapRowToBinding(row) : null;
|
|
4139
4162
|
}
|
|
4140
4163
|
async create(input) {
|
|
4141
|
-
const id =
|
|
4164
|
+
const id = randomUUID3();
|
|
4142
4165
|
const now = nowISO();
|
|
4143
4166
|
try {
|
|
4144
4167
|
this.db.prepare(
|
|
@@ -4437,8 +4460,8 @@ function mapRow7(row) {
|
|
|
4437
4460
|
}
|
|
4438
4461
|
|
|
4439
4462
|
// src/stores/LocalA2AApiKeyStore.ts
|
|
4440
|
-
import { encrypt as
|
|
4441
|
-
import { randomUUID as
|
|
4463
|
+
import { encrypt as encrypt6, decrypt as decrypt2, safeDecrypt as safeDecrypt4 } from "@axiom-lattice/core";
|
|
4464
|
+
import { randomUUID as randomUUID4 } from "crypto";
|
|
4442
4465
|
var DDL18 = `
|
|
4443
4466
|
CREATE TABLE IF NOT EXISTS lt_a2a_api_keys (
|
|
4444
4467
|
id TEXT PRIMARY KEY,
|
|
@@ -4454,7 +4477,7 @@ CREATE TABLE IF NOT EXISTS lt_a2a_api_keys (
|
|
|
4454
4477
|
);
|
|
4455
4478
|
`;
|
|
4456
4479
|
function generateApiKey() {
|
|
4457
|
-
return `a2a_${
|
|
4480
|
+
return `a2a_${randomUUID4().replace(/-/g, "")}`;
|
|
4458
4481
|
}
|
|
4459
4482
|
function parseGrants(raw) {
|
|
4460
4483
|
if (!raw) return void 0;
|
|
@@ -4498,7 +4521,7 @@ var LocalA2AApiKeyStore = class {
|
|
|
4498
4521
|
if (!row.id || !uuidPattern.test(row.id)) {
|
|
4499
4522
|
this.db.prepare(
|
|
4500
4523
|
`UPDATE lt_a2a_api_keys SET id = ? WHERE rowid = ?`
|
|
4501
|
-
).run(
|
|
4524
|
+
).run(randomUUID4(), row.rowid);
|
|
4502
4525
|
}
|
|
4503
4526
|
}
|
|
4504
4527
|
}
|
|
@@ -4536,13 +4559,13 @@ var LocalA2AApiKeyStore = class {
|
|
|
4536
4559
|
return rows2.map(mapRowToRecord);
|
|
4537
4560
|
}
|
|
4538
4561
|
async create(input) {
|
|
4539
|
-
const id =
|
|
4562
|
+
const id = randomUUID4();
|
|
4540
4563
|
const key = generateApiKey();
|
|
4541
4564
|
const now = nowISO();
|
|
4542
4565
|
this.db.prepare(
|
|
4543
4566
|
`INSERT INTO lt_a2a_api_keys (id, key_value, tenant_id, project_id, assistant_ids, grants, label, created_at, updated_at)
|
|
4544
4567
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
4545
|
-
).run(id,
|
|
4568
|
+
).run(id, encrypt6(key), input.tenantId, input.projectId, input.assistantIds ? JSON.stringify(input.assistantIds) : null, input.grants ? JSON.stringify(input.grants) : null, input.label || null, now, now);
|
|
4546
4569
|
const record2 = {
|
|
4547
4570
|
id,
|
|
4548
4571
|
key,
|
|
@@ -4611,7 +4634,7 @@ var LocalA2AApiKeyStore = class {
|
|
|
4611
4634
|
const now = nowISO();
|
|
4612
4635
|
this.db.prepare(
|
|
4613
4636
|
`UPDATE lt_a2a_api_keys SET key_value = ?, updated_at = ? WHERE id = ?`
|
|
4614
|
-
).run(
|
|
4637
|
+
).run(encrypt6(key), now, id);
|
|
4615
4638
|
const row = this.db.prepare(`SELECT * FROM lt_a2a_api_keys WHERE id = ?`).get(id);
|
|
4616
4639
|
if (!row) throw new Error(`A2A API key not found: ${id}`);
|
|
4617
4640
|
const record2 = mapRowToRecord(row);
|
|
@@ -4644,7 +4667,7 @@ var LocalA2AApiKeyStore = class {
|
|
|
4644
4667
|
function mapRowToRecord(row) {
|
|
4645
4668
|
return {
|
|
4646
4669
|
id: row.id,
|
|
4647
|
-
key:
|
|
4670
|
+
key: safeDecrypt4(row.key_value),
|
|
4648
4671
|
tenantId: row.tenant_id,
|
|
4649
4672
|
projectId: row.project_id,
|
|
4650
4673
|
assistantIds: parseAssistantIds(row.assistant_ids),
|
|
@@ -4657,7 +4680,7 @@ function mapRowToRecord(row) {
|
|
|
4657
4680
|
}
|
|
4658
4681
|
|
|
4659
4682
|
// src/stores/LocalOpenAuditStore.ts
|
|
4660
|
-
import { randomUUID as
|
|
4683
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
4661
4684
|
var DDL19 = `
|
|
4662
4685
|
CREATE TABLE IF NOT EXISTS lt_open_audit (
|
|
4663
4686
|
id TEXT PRIMARY KEY,
|
|
@@ -4730,7 +4753,7 @@ var LocalOpenAuditStore = class {
|
|
|
4730
4753
|
(id, tenant_id, credential_id, credential_kind, project_id, domain, action, args, status, error_code, duration_ms, created_at)
|
|
4731
4754
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
|
|
4732
4755
|
).run(
|
|
4733
|
-
|
|
4756
|
+
randomUUID5(),
|
|
4734
4757
|
record2.tenantId,
|
|
4735
4758
|
record2.credentialId,
|
|
4736
4759
|
record2.credentialKind,
|
|
@@ -4751,7 +4774,7 @@ import {
|
|
|
4751
4774
|
parseQueuedExecutionMode,
|
|
4752
4775
|
parseTrustedRunContext
|
|
4753
4776
|
} from "@axiom-lattice/protocols";
|
|
4754
|
-
import { randomUUID as
|
|
4777
|
+
import { randomUUID as randomUUID6 } from "crypto";
|
|
4755
4778
|
var DDL20 = `
|
|
4756
4779
|
CREATE TABLE IF NOT EXISTS lt_thread_message_queue (
|
|
4757
4780
|
id TEXT PRIMARY KEY,
|
|
@@ -4804,7 +4827,7 @@ var LocalThreadMessageQueueStore = class {
|
|
|
4804
4827
|
async addMessage(params) {
|
|
4805
4828
|
const trusted = validateQueueTrust(params);
|
|
4806
4829
|
const now = nowISO();
|
|
4807
|
-
const id = params.id ||
|
|
4830
|
+
const id = params.id || randomUUID6();
|
|
4808
4831
|
const seqRow = this.db.prepare(
|
|
4809
4832
|
`SELECT COALESCE(MAX(sequence_order), 0) + 1 as next_seq FROM lt_thread_message_queue WHERE thread_id = ?`
|
|
4810
4833
|
).get(params.threadId);
|
|
@@ -4847,7 +4870,7 @@ var LocalThreadMessageQueueStore = class {
|
|
|
4847
4870
|
projectId: params.projectId
|
|
4848
4871
|
};
|
|
4849
4872
|
const filter = scopeClause(scope);
|
|
4850
|
-
const id = params.id ||
|
|
4873
|
+
const id = params.id || randomUUID6();
|
|
4851
4874
|
const limit = maxSize === Infinity ? -1 : maxSize;
|
|
4852
4875
|
const result = this.db.prepare(
|
|
4853
4876
|
`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)
|
|
@@ -4885,7 +4908,7 @@ var LocalThreadMessageQueueStore = class {
|
|
|
4885
4908
|
async addMessageAtHead(params) {
|
|
4886
4909
|
const trusted = validateQueueTrust(params);
|
|
4887
4910
|
const now = nowISO();
|
|
4888
|
-
const id = params.id ||
|
|
4911
|
+
const id = params.id || randomUUID6();
|
|
4889
4912
|
const seqRow = this.db.prepare(
|
|
4890
4913
|
`SELECT COALESCE(MAX(sequence_order), 0) + 1 as next_seq FROM lt_thread_message_queue WHERE thread_id = ?`
|
|
4891
4914
|
).get(params.threadId);
|
|
@@ -5481,6 +5504,8 @@ var LocalScheduleStorage = class {
|
|
|
5481
5504
|
if (filters?.limit !== void 0) {
|
|
5482
5505
|
query += ` LIMIT ?`;
|
|
5483
5506
|
values.push(filters.limit);
|
|
5507
|
+
} else if (filters?.offset !== void 0) {
|
|
5508
|
+
query += ` LIMIT -1`;
|
|
5484
5509
|
}
|
|
5485
5510
|
if (filters?.offset !== void 0) {
|
|
5486
5511
|
query += ` OFFSET ?`;
|
|
@@ -5559,7 +5584,7 @@ function mapRowToTask(row) {
|
|
|
5559
5584
|
|
|
5560
5585
|
// src/stores/LocalTaskStore.ts
|
|
5561
5586
|
import { normalizeTaskMetadataScalar } from "@axiom-lattice/protocols";
|
|
5562
|
-
import { randomUUID as
|
|
5587
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
5563
5588
|
var MAX_CANONICAL_TASK_TIME = "9999-12-31T23:59:59.999Z";
|
|
5564
5589
|
var TASK_STATUSES = /* @__PURE__ */ new Set([
|
|
5565
5590
|
"pending",
|
|
@@ -5665,7 +5690,7 @@ var LocalTaskStore = class {
|
|
|
5665
5690
|
}
|
|
5666
5691
|
}
|
|
5667
5692
|
async create(params) {
|
|
5668
|
-
const id = params.id ??
|
|
5693
|
+
const id = params.id ?? randomUUID7();
|
|
5669
5694
|
const now = nowISO();
|
|
5670
5695
|
this.db.prepare(
|
|
5671
5696
|
`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)
|
|
@@ -6602,7 +6627,7 @@ var LocalTaskWorkItemStore = class {
|
|
|
6602
6627
|
};
|
|
6603
6628
|
|
|
6604
6629
|
// src/stores/LocalCapabilityBundleStore.ts
|
|
6605
|
-
import { randomUUID as
|
|
6630
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
6606
6631
|
var DDL25 = `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);`;
|
|
6607
6632
|
var duplicateMessage = "Capability bundle key already exists for tenant";
|
|
6608
6633
|
function map(row) {
|
|
@@ -6641,7 +6666,7 @@ var LocalCapabilityBundleStore = class {
|
|
|
6641
6666
|
}
|
|
6642
6667
|
async create(tenantId, input) {
|
|
6643
6668
|
const now = nextTimestamp();
|
|
6644
|
-
const id =
|
|
6669
|
+
const id = randomUUID8();
|
|
6645
6670
|
try {
|
|
6646
6671
|
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);
|
|
6647
6672
|
} catch (error) {
|