@clearideas/agent-runtime-store-sqlite 0.9.0 → 0.10.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/NOTICE +2 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.js +38 -3
- package/package.json +3 -3
package/NOTICE
CHANGED
|
@@ -3,6 +3,6 @@ Copyright 2026 Clear Ideas Incorporated
|
|
|
3
3
|
|
|
4
4
|
Clear Ideas is a trademark of Clear Ideas Incorporated.
|
|
5
5
|
|
|
6
|
-
The documentation site includes @clearideas/analytics 1.
|
|
6
|
+
The documentation site includes @clearideas/consent-analytics 0.1.0-rc.1, distributed
|
|
7
7
|
under the MIT License. Its license text is available at
|
|
8
|
-
docs/public/assets/analytics/LICENSE.clearideas-analytics.txt.
|
|
8
|
+
docs/public/assets/analytics/LICENSE.clearideas-consent-analytics.txt.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RunCheckpoint, RunError } from "@clearideas/agent-runtime-contracts";
|
|
2
|
-
import type { CompletedRunRecord, ResumeRunOptions, RunRecord, RunStore } from "@clearideas/agent-runtime-core";
|
|
2
|
+
import type { CompletedRunRecord, ResumeRunOptions, RunCheckpointSummary, RunRecord, RunStore } from "@clearideas/agent-runtime-core";
|
|
3
3
|
/**
|
|
4
4
|
* Durable single-file RunStore using Node's built-in SQLite binding. Every
|
|
5
5
|
* method is synchronous internally but exposed through the async RunStore port.
|
|
@@ -7,6 +7,10 @@ import type { CompletedRunRecord, ResumeRunOptions, RunRecord, RunStore } from "
|
|
|
7
7
|
export declare class SqliteRunStore implements RunStore {
|
|
8
8
|
#private;
|
|
9
9
|
constructor(filename: string);
|
|
10
|
+
listCheckpoints(runId: string, options?: {
|
|
11
|
+
boundaries?: boolean;
|
|
12
|
+
}): Promise<RunCheckpointSummary[]>;
|
|
13
|
+
loadCheckpoint(runId: string, sequence: number): Promise<RunCheckpoint | null>;
|
|
10
14
|
createRun(record: RunRecord): Promise<void>;
|
|
11
15
|
loadRun(runId: string): Promise<RunRecord | null>;
|
|
12
16
|
loadLatestCheckpoint(runId: string): Promise<RunCheckpoint | null>;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { chmodSync, mkdirSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { DatabaseSync } from "node:sqlite";
|
|
4
|
+
import { summarizeCheckpoint } from "@clearideas/agent-runtime-core";
|
|
4
5
|
const serialize = (value) => JSON.stringify(value);
|
|
5
6
|
const parse = (value) => JSON.parse(value);
|
|
6
7
|
/**
|
|
@@ -34,6 +35,7 @@ export class SqliteRunStore {
|
|
|
34
35
|
sequence INTEGER NOT NULL CHECK (sequence > 0),
|
|
35
36
|
checkpoint_id TEXT NOT NULL,
|
|
36
37
|
checkpoint_json TEXT NOT NULL,
|
|
38
|
+
summary_json TEXT,
|
|
37
39
|
PRIMARY KEY (run_id, sequence),
|
|
38
40
|
UNIQUE (run_id, checkpoint_id),
|
|
39
41
|
FOREIGN KEY (run_id) REFERENCES agent_runtime_runs(run_id) ON DELETE CASCADE
|
|
@@ -43,6 +45,38 @@ export class SqliteRunStore {
|
|
|
43
45
|
`);
|
|
44
46
|
if (filename !== ":memory:")
|
|
45
47
|
this.#database.exec("PRAGMA journal_mode = WAL;");
|
|
48
|
+
// Databases created by earlier releases lack the summary column.
|
|
49
|
+
const columns = this.#database
|
|
50
|
+
.prepare("PRAGMA table_info(agent_runtime_checkpoints)")
|
|
51
|
+
.all();
|
|
52
|
+
if (!columns.some((column) => column.name === "summary_json")) {
|
|
53
|
+
this.#database.exec("ALTER TABLE agent_runtime_checkpoints ADD COLUMN summary_json TEXT");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async listCheckpoints(runId, options = {}) {
|
|
57
|
+
const rows = this.#database
|
|
58
|
+
.prepare(`
|
|
59
|
+
SELECT summary_json AS summary, checkpoint_json AS json
|
|
60
|
+
FROM agent_runtime_checkpoints
|
|
61
|
+
WHERE run_id = ?
|
|
62
|
+
ORDER BY sequence ASC
|
|
63
|
+
`)
|
|
64
|
+
.all(runId);
|
|
65
|
+
return rows
|
|
66
|
+
.map((row) => row.summary
|
|
67
|
+
? parse(row.summary)
|
|
68
|
+
: summarizeCheckpoint(parse(row.json)))
|
|
69
|
+
.filter((summary) => !options.boundaries || summary.boundary);
|
|
70
|
+
}
|
|
71
|
+
async loadCheckpoint(runId, sequence) {
|
|
72
|
+
const row = this.#database
|
|
73
|
+
.prepare(`
|
|
74
|
+
SELECT checkpoint_json AS json
|
|
75
|
+
FROM agent_runtime_checkpoints
|
|
76
|
+
WHERE run_id = ? AND sequence = ?
|
|
77
|
+
`)
|
|
78
|
+
.get(runId, sequence);
|
|
79
|
+
return row ? parse(row.json) : null;
|
|
46
80
|
}
|
|
47
81
|
async createRun(record) {
|
|
48
82
|
try {
|
|
@@ -95,6 +129,7 @@ export class SqliteRunStore {
|
|
|
95
129
|
const attempt = (current.attempt ?? 1) + 1;
|
|
96
130
|
const resumed = {
|
|
97
131
|
...current,
|
|
132
|
+
...(options?.manifest ? { manifest: options.manifest } : {}),
|
|
98
133
|
status: "running",
|
|
99
134
|
attempt,
|
|
100
135
|
updatedAt: resumedAt,
|
|
@@ -165,10 +200,10 @@ export class SqliteRunStore {
|
|
|
165
200
|
this.#database
|
|
166
201
|
.prepare(`
|
|
167
202
|
INSERT INTO agent_runtime_checkpoints
|
|
168
|
-
(run_id, sequence, checkpoint_id, checkpoint_json)
|
|
169
|
-
VALUES (?, ?, ?, ?)
|
|
203
|
+
(run_id, sequence, checkpoint_id, checkpoint_json, summary_json)
|
|
204
|
+
VALUES (?, ?, ?, ?, ?)
|
|
170
205
|
`)
|
|
171
|
-
.run(checkpoint.runId, checkpoint.sequence, checkpoint.id, encoded);
|
|
206
|
+
.run(checkpoint.runId, checkpoint.sequence, checkpoint.id, encoded, serialize(summarizeCheckpoint(checkpoint)));
|
|
172
207
|
this.#database.exec("COMMIT");
|
|
173
208
|
}
|
|
174
209
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clearideas/agent-runtime-store-sqlite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.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.
|
|
40
|
-
"@clearideas/agent-runtime-core": "0.
|
|
39
|
+
"@clearideas/agent-runtime-contracts": "0.10.0",
|
|
40
|
+
"@clearideas/agent-runtime-core": "0.10.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^26.6.6",
|