@clearideas/agent-runtime-store-sqlite 0.7.1 → 0.9.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/README.md CHANGED
@@ -4,4 +4,4 @@ A durable single-file `RunStore` using Node's built-in SQLite API. Checkpoints a
4
4
  terminal states are immutable, resume attempts are reserved under `BEGIN IMMEDIATE`, and stale
5
5
  attempt mutations are rejected.
6
6
 
7
- Requires Node.js 24 or newer.
7
+ Requires Node.js 22.20.0 or newer.
package/dist/index.d.ts CHANGED
@@ -17,5 +17,6 @@ export declare class SqliteRunStore implements RunStore {
17
17
  failRun(runId: string, error: RunError, failedAt: string, expectedAttempt: number): Promise<void>;
18
18
  interruptRun(runId: string, error: RunError, interruptedAt: string, expectedAttempt: number): Promise<void>;
19
19
  cancelRun(runId: string, cancelledAt: string, expectedAttempt: number): Promise<void>;
20
+ deleteRun(runId: string): Promise<boolean>;
20
21
  close(): void;
21
22
  }
package/dist/index.js CHANGED
@@ -359,6 +359,31 @@ export class SqliteRunStore {
359
359
  throw error;
360
360
  }
361
361
  }
362
+ async deleteRun(runId) {
363
+ this.#database.exec("BEGIN IMMEDIATE");
364
+ try {
365
+ const row = this.#database
366
+ .prepare("SELECT record_json AS json FROM agent_runtime_runs WHERE run_id = ?")
367
+ .get(runId);
368
+ if (!row) {
369
+ this.#database.exec("COMMIT");
370
+ return false;
371
+ }
372
+ if (parse(row.json).status === "running") {
373
+ throw new Error(`Cannot delete running run ${runId}`);
374
+ }
375
+ // Checkpoints are removed by the foreign key's ON DELETE CASCADE.
376
+ this.#database
377
+ .prepare("DELETE FROM agent_runtime_runs WHERE run_id = ?")
378
+ .run(runId);
379
+ this.#database.exec("COMMIT");
380
+ return true;
381
+ }
382
+ catch (error) {
383
+ this.#database.exec("ROLLBACK");
384
+ throw error;
385
+ }
386
+ }
362
387
  close() {
363
388
  this.#database.close();
364
389
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clearideas/agent-runtime-store-sqlite",
3
- "version": "0.7.1",
3
+ "version": "0.9.0",
4
4
  "description": "Durable SQLite run and checkpoint storage for Clear Ideas Agent Runtime.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Clear Ideas Incorporated",
@@ -36,8 +36,8 @@
36
36
  "postpack": "node ../../scripts/cleanup-package-license.mjs"
37
37
  },
38
38
  "dependencies": {
39
- "@clearideas/agent-runtime-contracts": "0.7.1",
40
- "@clearideas/agent-runtime-core": "0.7.1"
39
+ "@clearideas/agent-runtime-contracts": "0.9.0",
40
+ "@clearideas/agent-runtime-core": "0.9.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^26.6.6",
@@ -45,7 +45,7 @@
45
45
  "vitest": "^5.1.0"
46
46
  },
47
47
  "engines": {
48
- "node": ">=24"
48
+ "node": ">=22.20.0"
49
49
  },
50
50
  "homepage": "https://github.com/clearideas/agent-runtime#readme",
51
51
  "bugs": {