@axiom-lattice/local-stores 2.0.4 → 2.0.6

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @axiom-lattice/local-stores@2.0.4 build /home/runner/work/agentic/agentic/packages/local-stores
2
+ > @axiom-lattice/local-stores@2.0.6 build /home/runner/work/agentic/agentic/packages/local-stores
3
3
  > tsup src/index.ts --format cjs,esm --dts --sourcemap
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,13 +8,13 @@
8
8
  CLI Target: es2020
9
9
  CJS Build start
10
10
  ESM Build start
11
- ESM dist/index.mjs 127.70 KB
12
- ESM dist/index.mjs.map 242.36 KB
13
- ESM ⚡️ Build success in 396ms
14
- CJS dist/index.js 131.17 KB
15
- CJS dist/index.js.map 245.21 KB
16
- CJS ⚡️ Build success in 427ms
11
+ CJS dist/index.js 134.50 KB
12
+ CJS dist/index.js.map 250.49 KB
13
+ CJS ⚡️ Build success in 366ms
14
+ ESM dist/index.mjs 131.04 KB
15
+ ESM dist/index.mjs.map 247.63 KB
16
+ ESM ⚡️ Build success in 367ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 15469ms
19
- DTS dist/index.d.ts 29.13 KB
20
- DTS dist/index.d.mts 29.13 KB
18
+ DTS ⚡️ Build success in 11434ms
19
+ DTS dist/index.d.ts 29.26 KB
20
+ DTS dist/index.d.mts 29.26 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @axiom-lattice/local-stores
2
2
 
3
+ ## 2.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [404ce6c]
8
+ - @axiom-lattice/core@3.0.6
9
+
10
+ ## 2.0.5
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [c8cd0ae]
15
+ - @axiom-lattice/core@3.0.5
16
+
3
17
  ## 2.0.4
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -389,6 +389,8 @@ declare class LocalWorkflowTrackingStore implements WorkflowTrackingStore {
389
389
  declare class LocalEvalStore implements EvalStore {
390
390
  private db;
391
391
  constructor(db: DatabaseWrapper);
392
+ /** Add a column if it does not exist (SQLite version compatible). */
393
+ private ensureColumn;
392
394
  getProjectsByTenant(tenantId: string): Promise<EvalProject[]>;
393
395
  getProjectById(tenantId: string, id: string): Promise<EvalProject | null>;
394
396
  createProject(tenantId: string, id: string, data: CreateEvalProjectRequest): Promise<EvalProject>;
@@ -414,6 +416,7 @@ declare class LocalEvalStore implements EvalStore {
414
416
  status?: EvalRun["status"];
415
417
  passedCases?: number;
416
418
  failedCases?: number;
419
+ interruptedCases?: number;
417
420
  avgScore?: number;
418
421
  error?: string;
419
422
  completedAt?: Date;
package/dist/index.d.ts CHANGED
@@ -389,6 +389,8 @@ declare class LocalWorkflowTrackingStore implements WorkflowTrackingStore {
389
389
  declare class LocalEvalStore implements EvalStore {
390
390
  private db;
391
391
  constructor(db: DatabaseWrapper);
392
+ /** Add a column if it does not exist (SQLite version compatible). */
393
+ private ensureColumn;
392
394
  getProjectsByTenant(tenantId: string): Promise<EvalProject[]>;
393
395
  getProjectById(tenantId: string, id: string): Promise<EvalProject | null>;
394
396
  createProject(tenantId: string, id: string, data: CreateEvalProjectRequest): Promise<EvalProject>;
@@ -414,6 +416,7 @@ declare class LocalEvalStore implements EvalStore {
414
416
  status?: EvalRun["status"];
415
417
  passedCases?: number;
416
418
  failedCases?: number;
419
+ interruptedCases?: number;
417
420
  avgScore?: number;
418
421
  error?: string;
419
422
  completedAt?: Date;
package/dist/index.js CHANGED
@@ -1988,6 +1988,7 @@ CREATE TABLE IF NOT EXISTS lt_eval_cases (
1988
1988
  output_type TEXT NOT NULL DEFAULT 'message_content',
1989
1989
  content_assertion TEXT NOT NULL DEFAULT '',
1990
1990
  rubrics TEXT,
1991
+ interrupt_policy TEXT,
1991
1992
  created_at TEXT NOT NULL,
1992
1993
  updated_at TEXT NOT NULL,
1993
1994
  PRIMARY KEY (tenant_id, id)
@@ -2003,6 +2004,7 @@ CREATE TABLE IF NOT EXISTS lt_eval_runs (
2003
2004
  total_cases INTEGER NOT NULL DEFAULT 0,
2004
2005
  passed_cases INTEGER NOT NULL DEFAULT 0,
2005
2006
  failed_cases INTEGER NOT NULL DEFAULT 0,
2007
+ interrupted_cases INTEGER NOT NULL DEFAULT 0,
2006
2008
  avg_score REAL NOT NULL DEFAULT 0,
2007
2009
  error TEXT,
2008
2010
  holdout INTEGER NOT NULL DEFAULT 0,
@@ -2028,6 +2030,7 @@ CREATE TABLE IF NOT EXISTS lt_eval_run_results (
2028
2030
  messages TEXT DEFAULT '[]',
2029
2031
  logs TEXT DEFAULT '[]',
2030
2032
  error TEXT,
2033
+ interrupted INTEGER NOT NULL DEFAULT 0,
2031
2034
  created_at TEXT NOT NULL,
2032
2035
  PRIMARY KEY (run_id, id)
2033
2036
  );
@@ -2058,6 +2061,76 @@ var LocalEvalStore = class {
2058
2061
  constructor(db) {
2059
2062
  this.db = db;
2060
2063
  ensureTable(db, DDL13);
2064
+ this.ensureColumn("lt_eval_runs", "interrupted_cases", "interrupted_cases INTEGER NOT NULL DEFAULT 0");
2065
+ this.ensureColumn("lt_eval_run_results", "interrupted", "interrupted INTEGER NOT NULL DEFAULT 0");
2066
+ this.ensureColumn("lt_eval_cases", "interrupt_policy", "interrupt_policy TEXT");
2067
+ this.db.exec(`
2068
+ UPDATE lt_eval_suites
2069
+ SET project_id = (
2070
+ SELECT p2.id FROM lt_eval_projects p2
2071
+ WHERE p2.tenant_id = (
2072
+ SELECT p.tenant_id FROM lt_eval_projects p WHERE p.id = lt_eval_suites.project_id
2073
+ )
2074
+ AND p2.name = (
2075
+ SELECT p.name FROM lt_eval_projects p WHERE p.id = lt_eval_suites.project_id
2076
+ )
2077
+ ORDER BY p2.created_at DESC, p2.rowid DESC
2078
+ LIMIT 1
2079
+ )
2080
+ WHERE project_id IN (
2081
+ SELECT p3.id FROM lt_eval_projects p3
2082
+ WHERE p3.id <> (
2083
+ SELECT p2.id FROM lt_eval_projects p2
2084
+ WHERE p2.tenant_id = p3.tenant_id AND p2.name = p3.name
2085
+ ORDER BY p2.created_at DESC, p2.rowid DESC
2086
+ LIMIT 1
2087
+ )
2088
+ )
2089
+ `);
2090
+ this.db.exec(`
2091
+ UPDATE lt_eval_runs
2092
+ SET project_id = (
2093
+ SELECT p2.id FROM lt_eval_projects p2
2094
+ WHERE p2.tenant_id = (
2095
+ SELECT p.tenant_id FROM lt_eval_projects p WHERE p.id = lt_eval_runs.project_id
2096
+ )
2097
+ AND p2.name = (
2098
+ SELECT p.name FROM lt_eval_projects p WHERE p.id = lt_eval_runs.project_id
2099
+ )
2100
+ ORDER BY p2.created_at DESC, p2.rowid DESC
2101
+ LIMIT 1
2102
+ )
2103
+ WHERE project_id IN (
2104
+ SELECT p3.id FROM lt_eval_projects p3
2105
+ WHERE p3.id <> (
2106
+ SELECT p2.id FROM lt_eval_projects p2
2107
+ WHERE p2.tenant_id = p3.tenant_id AND p2.name = p3.name
2108
+ ORDER BY p2.created_at DESC, p2.rowid DESC
2109
+ LIMIT 1
2110
+ )
2111
+ )
2112
+ `);
2113
+ this.db.exec(`
2114
+ DELETE FROM lt_eval_projects
2115
+ WHERE id <> (
2116
+ SELECT p2.id FROM lt_eval_projects p2
2117
+ WHERE p2.tenant_id = lt_eval_projects.tenant_id
2118
+ AND p2.name = lt_eval_projects.name
2119
+ ORDER BY p2.created_at DESC, p2.rowid DESC
2120
+ LIMIT 1
2121
+ )
2122
+ `);
2123
+ this.db.exec(`
2124
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_lt_eval_projects_tenant_name
2125
+ ON lt_eval_projects(tenant_id, name)
2126
+ `);
2127
+ }
2128
+ /** Add a column if it does not exist (SQLite version compatible). */
2129
+ ensureColumn(table, column, ddl) {
2130
+ const cols = this.db.prepare(`PRAGMA table_info(${table})`).all();
2131
+ if (!cols.some((c) => c.name === column)) {
2132
+ this.db.exec(`ALTER TABLE ${table} ADD COLUMN ${ddl}`);
2133
+ }
2061
2134
  }
2062
2135
  // -------------------------------------------------------------------------
2063
2136
  // Projects
@@ -2202,8 +2275,8 @@ var LocalEvalStore = class {
2202
2275
  async createCase(tenantId, suiteId, id, data) {
2203
2276
  const actualId = id || (0, import_crypto.randomUUID)();
2204
2277
  this.db.prepare(
2205
- `INSERT INTO lt_eval_cases (id, tenant_id, suite_id, input_message, input_files, steps, output_type, content_assertion, rubrics, created_at, updated_at)
2206
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
2278
+ `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)
2279
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
2207
2280
  ).run(
2208
2281
  actualId,
2209
2282
  tenantId,
@@ -2214,6 +2287,7 @@ var LocalEvalStore = class {
2214
2287
  data.outputType || "message_content",
2215
2288
  data.contentAssertion || "",
2216
2289
  data.rubrics ? JSON.stringify(data.rubrics) : null,
2290
+ data.interruptPolicy ? JSON.stringify(data.interruptPolicy) : null,
2217
2291
  nowISO(),
2218
2292
  nowISO()
2219
2293
  );
@@ -2248,6 +2322,10 @@ var LocalEvalStore = class {
2248
2322
  set.push("rubrics = ?");
2249
2323
  vals.push(JSON.stringify(updates.rubrics));
2250
2324
  }
2325
+ if (updates.interruptPolicy !== void 0) {
2326
+ set.push("interrupt_policy = ?");
2327
+ vals.push(updates.interruptPolicy ? JSON.stringify(updates.interruptPolicy) : null);
2328
+ }
2251
2329
  set.push("updated_at = ?");
2252
2330
  vals.push(nowISO());
2253
2331
  vals.push(tenantId, id);
@@ -2309,6 +2387,10 @@ var LocalEvalStore = class {
2309
2387
  set.push("failed_cases = ?");
2310
2388
  vals.push(updates.failedCases);
2311
2389
  }
2390
+ if (updates.interruptedCases !== void 0) {
2391
+ set.push("interrupted_cases = ?");
2392
+ vals.push(updates.interruptedCases);
2393
+ }
2312
2394
  if (updates.avgScore !== void 0) {
2313
2395
  set.push("avg_score = ?");
2314
2396
  vals.push(updates.avgScore);
@@ -2353,8 +2435,8 @@ var LocalEvalStore = class {
2353
2435
  async createRunResult(tenantId, runId, id, data) {
2354
2436
  const actualId = id || (0, import_crypto.randomUUID)();
2355
2437
  this.db.prepare(
2356
- `INSERT INTO lt_eval_run_results (id, run_id, suite_name, case_id, pass, score, summary, dimension_results, duration_ms, messages, logs, error, created_at)
2357
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
2438
+ `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)
2439
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`
2358
2440
  ).run(
2359
2441
  actualId,
2360
2442
  runId,
@@ -2368,6 +2450,7 @@ var LocalEvalStore = class {
2368
2450
  JSON.stringify(data.messages || []),
2369
2451
  JSON.stringify(data.logs || []),
2370
2452
  data.error || null,
2453
+ data.interrupted ? 1 : 0,
2371
2454
  nowISO()
2372
2455
  );
2373
2456
  return await this.getRunResultById(tenantId, actualId);
@@ -2416,6 +2499,10 @@ var LocalEvalStore = class {
2416
2499
  set.push("error = ?");
2417
2500
  vals.push(updates.error || null);
2418
2501
  }
2502
+ if (updates.interrupted !== void 0) {
2503
+ set.push("interrupted = ?");
2504
+ vals.push(updates.interrupted ? 1 : 0);
2505
+ }
2419
2506
  if (set.length === 0) return this.getRunResultById(tenantId, id);
2420
2507
  vals.push(id, tenantId);
2421
2508
  this.db.prepare(
@@ -2483,6 +2570,7 @@ var LocalEvalStore = class {
2483
2570
  outputType: row.output_type || "message_content",
2484
2571
  contentAssertion: row.content_assertion || "",
2485
2572
  rubrics: parseOptionalJson(row.rubrics),
2573
+ interruptPolicy: parseOptionalJson(row.interrupt_policy),
2486
2574
  createdAt: parseISO(row.created_at),
2487
2575
  updatedAt: parseISO(row.updated_at)
2488
2576
  };
@@ -2497,6 +2585,7 @@ var LocalEvalStore = class {
2497
2585
  totalCases: row.total_cases ?? 0,
2498
2586
  passedCases: row.passed_cases ?? 0,
2499
2587
  failedCases: row.failed_cases ?? 0,
2588
+ interruptedCases: row.interrupted_cases ?? 0,
2500
2589
  avgScore: row.avg_score ?? 0,
2501
2590
  error: row.error,
2502
2591
  holdout: row.holdout ? Boolean(row.holdout) : void 0,
@@ -2521,6 +2610,7 @@ var LocalEvalStore = class {
2521
2610
  messages: parseOptionalJson(row.messages),
2522
2611
  logs: parseOptionalJson(row.logs),
2523
2612
  error: row.error,
2613
+ interrupted: row.interrupted === 1,
2524
2614
  createdAt: parseISO(row.created_at)
2525
2615
  };
2526
2616
  }