@awebai/oats 0.62.0 → 0.63.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/bin/oats.mjs +1 -1
- package/docs/desktop-cli-api.md +30 -2
- package/docs/execution-targets.md +40 -1
- package/docs/official-catalog.md +1 -1
- package/docs/packages.md +5 -5
- package/docs/release-lane.md +13 -0
- package/docs/release-notes/v0.63.0.md +135 -0
- package/docs/souls-and-instances.md +6 -1
- package/docs/upgrading.md +5 -3
- package/docs/workspaces.md +1 -1
- package/lib/core.mjs +71 -21
- package/lib/tree-copy.mjs +188 -7
- package/package-catalog.json +1 -1
- package/package.json +1 -1
- package/packages/client/cli-locator.mjs +2 -2
- package/packages/record/bin/capture.mjs +59 -17
- package/packages/record/bin/setup.mjs +2 -1
- package/packages/record/docs/capture-service.md +89 -5
- package/packages/record/lib/capture-command-operation.mjs +2 -2
- package/packages/record/lib/capture-command-output.mjs +3 -2
- package/packages/record/lib/capture-command.mjs +20 -3
- package/packages/record/lib/capture-hook-runner.mjs +1 -1
- package/packages/record/lib/capture-index-reset.mjs +1 -0
- package/packages/record/lib/capture-lock.mjs +67 -33
- package/packages/record/lib/capture-pass.mjs +22 -8
- package/packages/record/lib/capture-run.mjs +1 -1
- package/packages/record/lib/capture-service-runner.mjs +1 -1
- package/packages/record/lib/capture-supervisor.mjs +24 -5
- package/packages/record/lib/capture-work-session.mjs +7 -4
- package/packages/record/lib/capture-worker.mjs +20 -4
- package/packages/record/lib/derived-state.mjs +30 -2
- package/packages/record/lib/index-db.mjs +118 -49
- package/packages/record/lib/store.mjs +13 -6
- package/skills/oats-getting-started/SKILL.md +1 -1
|
@@ -14,6 +14,9 @@
|
|
|
14
14
|
import { closeSync, existsSync, mkdirSync, openSync, readSync, rmSync, unlinkSync } from "node:fs";
|
|
15
15
|
import { join } from "node:path";
|
|
16
16
|
import { keysetRows } from "./sqlite-rows.mjs";
|
|
17
|
+
import { captureContext } from "./capture-context.mjs";
|
|
18
|
+
import { DerivedState, fileVersion, sameVersion } from "./derived-state.mjs";
|
|
19
|
+
import { validJournalCheckpoint } from "./store.mjs";
|
|
17
20
|
import { INDEX_SCHEMA_VERSION as SCHEMA_VERSION, TEXT_SCHEMA, resetIndexTables } from "./index-reset.mjs";
|
|
18
21
|
import { createRequire } from "node:module";
|
|
19
22
|
const require = createRequire(import.meta.url);
|
|
@@ -138,12 +141,22 @@ export class RecordIndex {
|
|
|
138
141
|
}
|
|
139
142
|
this.db.exec(SCHEMA);
|
|
140
143
|
this.db.exec(`PRAGMA user_version = ${SCHEMA_VERSION}`);
|
|
144
|
+
this.statements = new Map();
|
|
141
145
|
}
|
|
142
146
|
|
|
143
147
|
close() {
|
|
148
|
+
this.statements.clear();
|
|
144
149
|
this.db.close();
|
|
145
150
|
}
|
|
146
151
|
|
|
152
|
+
// One prepared statement per SQL text for this connection. Only for
|
|
153
|
+
// statements run to completion (run/get/all), never left iterating.
|
|
154
|
+
statement(sql) {
|
|
155
|
+
let prepared = this.statements.get(sql);
|
|
156
|
+
if (!prepared) { prepared = this.db.prepare(sql); this.statements.set(sql, prepared); }
|
|
157
|
+
return prepared;
|
|
158
|
+
}
|
|
159
|
+
|
|
147
160
|
recordOwner() {
|
|
148
161
|
if (this.store.owner) return this.store.owner;
|
|
149
162
|
const row = this.db.prepare("SELECT value FROM meta WHERE key = 'owner'").get();
|
|
@@ -153,35 +166,88 @@ export class RecordIndex {
|
|
|
153
166
|
// Old releases keep writing index_state's count. A separate cursor table
|
|
154
167
|
// leaves that schema/writer compatible; differing counts invalidate our
|
|
155
168
|
// cursor rather than trusting a byte position left behind by a downgrade.
|
|
169
|
+
//
|
|
170
|
+
// One capture.db connection serves the whole pass. A census without locks
|
|
171
|
+
// proves a stream current only when its complete validation checkpoint
|
|
172
|
+
// names the journal's exact current version and the search cursor agrees
|
|
173
|
+
// with it in bytes, count (both tables) and epoch; such a stream needs no
|
|
174
|
+
// lock and no validation. Every other stream is a candidate and is
|
|
175
|
+
// re-read under its stream lock. The census is not an atomic snapshot of
|
|
176
|
+
// concurrent writers: a change after a stream is observed is indexed by a
|
|
177
|
+
// later pass, as with any sequential pass.
|
|
156
178
|
update() {
|
|
157
|
-
|
|
158
|
-
|
|
179
|
+
const context = captureContext(this.store);
|
|
180
|
+
const state = context ? context.state : new DerivedState(this.store.root);
|
|
181
|
+
try {
|
|
182
|
+
// Skip evidence is read from this connection: it must still be the file.
|
|
183
|
+
if (!context) state.assertFile();
|
|
184
|
+
const current = this.#reconcile(state, !context);
|
|
185
|
+
this.#catchUp(state, !context, current);
|
|
186
|
+
if (!context) state.assertFile();
|
|
187
|
+
} finally { if (!context) state.close(); }
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Indexed streams whose evidence is incomplete are validated under their
|
|
191
|
+
// locks first: if any proves the union stale (missing or replaced journal,
|
|
192
|
+
// new epoch, invalid cursor, legacy count disagreement), the whole union
|
|
193
|
+
// resets before any stream catches up, and no stream is current against
|
|
194
|
+
// the new, empty generation. → the streams proven current, each with the
|
|
195
|
+
// search-cursor row its proof used.
|
|
196
|
+
#reconcile(state, owned) {
|
|
197
|
+
const current = new Map();
|
|
198
|
+
const rows = keysetRows(this.db, `SELECT s.stream, s.indexed_count, b.bytes,
|
|
159
199
|
b.indexed_count AS byte_count, b.epoch FROM index_state s
|
|
160
|
-
LEFT JOIN index_bytes b ON s.stream = b.stream`, "stream")
|
|
161
|
-
|
|
200
|
+
LEFT JOIN index_bytes b ON s.stream = b.stream`, "stream");
|
|
201
|
+
for (const row of rows) {
|
|
202
|
+
const path = this.store.journalPath(row.stream);
|
|
203
|
+
// Inside a capture work group every stream still goes through the
|
|
204
|
+
// group's membership check: only a pass owning its connection skips.
|
|
205
|
+
if (owned && proven(row, state.get("journal", row.stream), fileVersion(path))) { current.set(row.stream, row); continue; }
|
|
206
|
+
const checkpoint = this.store.withStreamLock(row.stream, () => {
|
|
207
|
+
if (owned) state.assertFile();
|
|
208
|
+
return this.store.validateJournal(row.stream, state);
|
|
209
|
+
});
|
|
162
210
|
let boundary = true;
|
|
163
211
|
if (Number.isSafeInteger(row.bytes) && row.bytes > 0 && row.bytes < checkpoint.bytes) {
|
|
164
|
-
const fd = openSync(
|
|
212
|
+
const fd = openSync(path, "r"), byte = Buffer.alloc(1);
|
|
165
213
|
try { boundary = readSync(fd, byte, 0, 1, row.bytes - 1) === 1 && byte[0] === 10; }
|
|
166
214
|
finally { closeSync(fd); }
|
|
167
215
|
}
|
|
168
216
|
if (!Number.isSafeInteger(row.bytes) || row.bytes < 0 || !boundary || row.indexed_count !== row.byte_count ||
|
|
169
217
|
row.epoch !== checkpoint.epoch || row.bytes > checkpoint.bytes || row.byte_count > checkpoint.count) {
|
|
170
|
-
|
|
171
|
-
|
|
218
|
+
// Deleting a stream or changing its history can change tombstone authority
|
|
219
|
+
// and cross-stream dedupe. Rebuild the derived union, not only its FTS rows.
|
|
220
|
+
this.reset();
|
|
221
|
+
return new Map();
|
|
172
222
|
}
|
|
173
223
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
224
|
+
return current;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Index the new bytes of every live stream not proven current, each under
|
|
228
|
+
// its stream lock, in bounded transactions that commit rows and cursors
|
|
229
|
+
// together. No transaction is open while the next stream lock is taken.
|
|
230
|
+
// A proof holds only for the cursor it read: another index connection may
|
|
231
|
+
// have reset the union or moved the cursor since, so the cursor is read
|
|
232
|
+
// again when the stream's turn comes and a changed one makes it a candidate.
|
|
233
|
+
#catchUp(state, owned, current) {
|
|
177
234
|
const owner = this.store.owner;
|
|
178
235
|
if (owner) this.db.prepare("INSERT INTO meta (key, value) VALUES ('owner', ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value").run(owner);
|
|
179
236
|
const effectiveOwner = this.recordOwner();
|
|
180
|
-
const getState = this.
|
|
181
|
-
const setCount = this.
|
|
182
|
-
const setBytes = this.
|
|
237
|
+
const getState = this.statement("SELECT * FROM index_bytes WHERE stream = ?");
|
|
238
|
+
const setCount = this.statement("INSERT INTO index_state VALUES (?, ?) ON CONFLICT(stream) DO UPDATE SET indexed_count=excluded.indexed_count");
|
|
239
|
+
const setBytes = this.statement("INSERT INTO index_bytes VALUES (?, ?, ?, ?) ON CONFLICT(stream) DO UPDATE SET bytes=excluded.bytes, indexed_count=excluded.indexed_count, epoch=excluded.epoch");
|
|
240
|
+
const cursor = this.statement(`SELECT s.indexed_count, b.bytes, b.indexed_count AS byte_count, b.epoch FROM index_state s
|
|
241
|
+
LEFT JOIN index_bytes b ON s.stream = b.stream WHERE s.stream = ?`);
|
|
183
242
|
for (const streamId of this.store.iterateStreams()) {
|
|
184
|
-
|
|
243
|
+
const proof = current.get(streamId);
|
|
244
|
+
if (proof) {
|
|
245
|
+
const now = cursor.get(streamId);
|
|
246
|
+
if (now?.indexed_count === proof.indexed_count && now.bytes === proof.bytes &&
|
|
247
|
+
now.byte_count === proof.byte_count && now.epoch === proof.epoch) continue;
|
|
248
|
+
}
|
|
249
|
+
this.store.withStreamLock(streamId, () => {
|
|
250
|
+
if (owned) state.assertFile();
|
|
185
251
|
const checkpoint = this.store.validateJournal(streamId, state);
|
|
186
252
|
const row = getState.get(streamId);
|
|
187
253
|
const previous = row?.stream != null ? row : null;
|
|
@@ -208,12 +274,13 @@ export class RecordIndex {
|
|
|
208
274
|
} catch (err) { this.db.exec("ROLLBACK"); throw err; }
|
|
209
275
|
}
|
|
210
276
|
} finally { iterator.return(); }
|
|
211
|
-
})
|
|
277
|
+
});
|
|
212
278
|
}
|
|
213
279
|
}
|
|
214
280
|
|
|
215
281
|
// Full rebuild = reset + update from zero. Same code path as update().
|
|
216
282
|
reset() {
|
|
283
|
+
this.statements.clear();
|
|
217
284
|
this.db.exec("BEGIN");
|
|
218
285
|
try {
|
|
219
286
|
resetIndexTables(this.db);
|
|
@@ -231,20 +298,20 @@ export class RecordIndex {
|
|
|
231
298
|
// streams: first seen wins.
|
|
232
299
|
addTurn(turn, streamId, owner) {
|
|
233
300
|
if (typeof turn.id !== "string") return;
|
|
234
|
-
const existing = this.
|
|
301
|
+
const existing = this.statement("SELECT stream FROM turns WHERE id = ?").get(turn.id);
|
|
235
302
|
if (existing) {
|
|
236
303
|
// Duplicate id across streams. Keep attribution deterministic and in
|
|
237
304
|
// agreement with RecordStore.readAll(): alphabetically first stream,
|
|
238
305
|
// regardless of indexing order.
|
|
239
306
|
if (streamId < existing.stream) {
|
|
240
|
-
this.
|
|
307
|
+
this.statement("UPDATE turns SET stream = ? WHERE id = ?").run(streamId, turn.id);
|
|
241
308
|
}
|
|
242
309
|
return;
|
|
243
310
|
}
|
|
244
311
|
|
|
245
312
|
const fromName = String(turn.from ?? "");
|
|
246
313
|
// Hidden if a valid tombstone already arrived for this id.
|
|
247
|
-
const hidden = this.
|
|
314
|
+
const hidden = this.statement("SELECT 1 AS found FROM tombstones WHERE ref = ? AND (from_name = ? OR from_name = ?) LIMIT 1")
|
|
248
315
|
.get(turn.id, fromName, owner ?? fromName)?.found === 1 ? 1 : 0;
|
|
249
316
|
|
|
250
317
|
// Sessions are one turn per native event (no snapshots, nothing to
|
|
@@ -252,11 +319,10 @@ export class RecordIndex {
|
|
|
252
319
|
const events = 0;
|
|
253
320
|
const superseded = 0;
|
|
254
321
|
|
|
255
|
-
this.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
)
|
|
322
|
+
this.statement(
|
|
323
|
+
`INSERT INTO turns (id, ts, from_name, to_name, thread, kind, source, fidelity, stream, events, hidden, superseded)
|
|
324
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
325
|
+
)
|
|
260
326
|
.run(
|
|
261
327
|
turn.id,
|
|
262
328
|
String(turn.ts ?? ""),
|
|
@@ -275,24 +341,22 @@ export class RecordIndex {
|
|
|
275
341
|
if (turn.kind === "tombstone") {
|
|
276
342
|
for (const link of turn.links ?? []) {
|
|
277
343
|
if (link.rel !== "tombstones" || typeof link.ref !== "string") continue;
|
|
278
|
-
this.
|
|
279
|
-
.prepare("INSERT OR IGNORE INTO tombstones (ref, from_name) VALUES (?, ?)")
|
|
344
|
+
this.statement("INSERT OR IGNORE INTO tombstones (ref, from_name) VALUES (?, ?)")
|
|
280
345
|
.run(link.ref, fromName);
|
|
281
346
|
// Apply to a target that arrived first.
|
|
282
|
-
const target = this.
|
|
283
|
-
.prepare("SELECT id, from_name FROM turns WHERE id = ? AND hidden = 0")
|
|
347
|
+
const target = this.statement("SELECT id, from_name FROM turns WHERE id = ? AND hidden = 0")
|
|
284
348
|
.get(link.ref);
|
|
285
349
|
if (target && (target.from_name === fromName || (owner && fromName === owner))) {
|
|
286
|
-
this.
|
|
287
|
-
this.
|
|
288
|
-
this.
|
|
289
|
-
this.
|
|
350
|
+
this.statement("UPDATE turns SET hidden = 1 WHERE id = ?").run(target.id);
|
|
351
|
+
this.statement("DELETE FROM turn_text WHERE turn_id = ?").run(target.id);
|
|
352
|
+
this.statement("DELETE FROM segments WHERE note_id = ?").run(target.id);
|
|
353
|
+
this.statement("DELETE FROM spawns WHERE note_id = ?").run(target.id);
|
|
290
354
|
}
|
|
291
355
|
}
|
|
292
356
|
}
|
|
293
357
|
|
|
294
358
|
if (!hidden && !superseded) {
|
|
295
|
-
const insText = this.
|
|
359
|
+
const insText = this.statement(
|
|
296
360
|
"INSERT INTO turn_text (turn_id, loc, role, text) VALUES (?, ?, ?, ?)",
|
|
297
361
|
);
|
|
298
362
|
for (const doc of this.extractText(turn)) {
|
|
@@ -323,26 +387,23 @@ export class RecordIndex {
|
|
|
323
387
|
}
|
|
324
388
|
}
|
|
325
389
|
if (tag) {
|
|
326
|
-
this.
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
)
|
|
390
|
+
this.statement(
|
|
391
|
+
"INSERT OR IGNORE INTO tags (tag_id, target_ref, about, acts, case_slug, note) VALUES (?, ?, ?, ?, ?, ?)",
|
|
392
|
+
)
|
|
330
393
|
.run(turn.id, tag.target, JSON.stringify(tag.about), JSON.stringify(tag.acts), tag.caseSlug, tag.note);
|
|
331
394
|
}
|
|
332
395
|
const outfit = outfitParsed;
|
|
333
396
|
if (outfit) {
|
|
334
|
-
this.
|
|
335
|
-
.prepare("INSERT OR IGNORE INTO outfits (outfit_id, task, status, members) VALUES (?, ?, ?, ?)")
|
|
397
|
+
this.statement("INSERT OR IGNORE INTO outfits (outfit_id, task, status, members) VALUES (?, ?, ?, ?)")
|
|
336
398
|
.run(turn.id, outfit.task, outfit.status, JSON.stringify(outfit.members));
|
|
337
399
|
}
|
|
338
400
|
if (segParsed && !hidden) {
|
|
339
401
|
const locN = (r) => Number(/line:(\d+)/.exec(r ?? "")?.[1] ?? null);
|
|
340
402
|
const tsMs = Date.parse(String(turn.ts ?? ""));
|
|
341
|
-
this.
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
)
|
|
403
|
+
this.statement(
|
|
404
|
+
`INSERT OR IGNORE INTO segments (note_id, thread, start_n, end_n, type, outcome, about, established, lesson, ts, ts_ms)
|
|
405
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
406
|
+
)
|
|
346
407
|
.run(
|
|
347
408
|
turn.id,
|
|
348
409
|
segParsed.thread,
|
|
@@ -357,15 +418,13 @@ export class RecordIndex {
|
|
|
357
418
|
Number.isFinite(tsMs) ? tsMs : 0,
|
|
358
419
|
);
|
|
359
420
|
// Full established+lesson searchable under role "segment".
|
|
360
|
-
this.
|
|
361
|
-
.prepare("INSERT INTO turn_text (turn_id, loc, role, text) VALUES (?, ?, ?, ?)")
|
|
421
|
+
this.statement("INSERT INTO turn_text (turn_id, loc, role, text) VALUES (?, ?, ?, ?)")
|
|
362
422
|
.run(turn.id, "", "segment", segParsed.established + (segParsed.lesson ? "\n" + segParsed.lesson : ""));
|
|
363
423
|
}
|
|
364
424
|
if (spawnParsed && !hidden) {
|
|
365
|
-
this.
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
)
|
|
425
|
+
this.statement(
|
|
426
|
+
"INSERT OR IGNORE INTO spawns (note_id, agent_thread, outfit_id, task, harness, grant_ref, ts) VALUES (?, ?, ?, ?, ?, ?, ?)",
|
|
427
|
+
)
|
|
369
428
|
.run(turn.id, spawnParsed.agent, spawnParsed.outfit, spawnParsed.task, spawnParsed.harness, spawnParsed.grant, String(turn.ts ?? ""));
|
|
370
429
|
}
|
|
371
430
|
}
|
|
@@ -538,6 +597,16 @@ export function extractTurnText(turn) {
|
|
|
538
597
|
// per-format extractors live in formats.mjs.
|
|
539
598
|
export const extractSessionText = extractCcText;
|
|
540
599
|
|
|
600
|
+
// A stream whose search cursor is complete against a complete validation of
|
|
601
|
+
// the journal's exact current version. Anything missing, malformed, partial
|
|
602
|
+
// or disagreeing is unproven, never a reason to skip.
|
|
603
|
+
function proven(row, checkpoint, version) {
|
|
604
|
+
return version !== null && validJournalCheckpoint(checkpoint, version.size) && checkpoint.complete && !checkpoint.resetting &&
|
|
605
|
+
sameVersion(checkpoint.version, version) && row.epoch === checkpoint.epoch &&
|
|
606
|
+
Number.isSafeInteger(row.bytes) && row.bytes === checkpoint.bytes &&
|
|
607
|
+
row.byte_count === row.indexed_count && row.byte_count === checkpoint.count;
|
|
608
|
+
}
|
|
609
|
+
|
|
541
610
|
export function dropIndex(store) {
|
|
542
611
|
rmSync(join(store.root, "index"), { recursive: true, force: true });
|
|
543
612
|
}
|
|
@@ -316,6 +316,16 @@ function describeHolder(held) {
|
|
|
316
316
|
return `held by pid ${held.token.pid} on ${held.token.host} since ${held.token.acquiredAt}`;
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
+
/** A journal validation checkpoint whose fields can describe a journal of
|
|
320
|
+
* `size` bytes. Shape only: whether it is complete and still names the
|
|
321
|
+
* current file version is the caller's question. */
|
|
322
|
+
export function validJournalCheckpoint(checkpoint, size) {
|
|
323
|
+
return Boolean(checkpoint) && Number.isSafeInteger(checkpoint.bytes) && checkpoint.bytes >= 0 && checkpoint.bytes <= size &&
|
|
324
|
+
Number.isSafeInteger(checkpoint.count) && checkpoint.count >= 0 && checkpoint.count <= checkpoint.bytes &&
|
|
325
|
+
typeof checkpoint.epoch === "string" && typeof checkpoint.complete === "boolean" &&
|
|
326
|
+
(checkpoint.resetting === undefined || typeof checkpoint.resetting === "boolean") && !(checkpoint.resetting && checkpoint.complete);
|
|
327
|
+
}
|
|
328
|
+
|
|
319
329
|
export class RecordStore {
|
|
320
330
|
constructor(root, { owner, lockTimeoutMs = 10000, lockStaleMs = 30000 } = {}) {
|
|
321
331
|
if (!root) throw new StoreError("record root is required");
|
|
@@ -466,10 +476,7 @@ export class RecordStore {
|
|
|
466
476
|
validateJournal(streamId, state, { maxRecords = Infinity, maxBytes = Infinity, stopped = () => false, work } = {}) {
|
|
467
477
|
const path = this.journalPath(streamId), version = fileVersion(path);
|
|
468
478
|
let checkpoint = state.get("journal", streamId);
|
|
469
|
-
if (checkpoint &&
|
|
470
|
-
!Number.isSafeInteger(checkpoint.count) || checkpoint.count < 0 || checkpoint.count > checkpoint.bytes ||
|
|
471
|
-
typeof checkpoint.epoch !== "string" || typeof checkpoint.complete !== "boolean" ||
|
|
472
|
-
(checkpoint.resetting !== undefined && typeof checkpoint.resetting !== "boolean") || checkpoint.resetting && checkpoint.complete)) checkpoint = null;
|
|
479
|
+
if (checkpoint && !validJournalCheckpoint(checkpoint, version?.size ?? 0)) checkpoint = null;
|
|
473
480
|
if (checkpoint && sameVersion(checkpoint.version, version) && checkpoint.complete) return checkpoint;
|
|
474
481
|
if (!checkpoint || !sameVersion(checkpoint.version, version)) {
|
|
475
482
|
checkpoint = { version, epoch: randomBytes(16).toString("hex"), bytes: 0, count: 0, complete: false, resetting: true };
|
|
@@ -482,14 +489,14 @@ export class RecordStore {
|
|
|
482
489
|
if (recordsUsed >= maxRecords || stopped()) return checkpoint;
|
|
483
490
|
state.transaction(() => {
|
|
484
491
|
const limit = Math.min(2000, maxRecords - recordsUsed);
|
|
485
|
-
const removed = Number(state.
|
|
492
|
+
const removed = Number(state.statement(`DELETE FROM journal_ids WHERE rowid IN
|
|
486
493
|
(SELECT rowid FROM journal_ids WHERE stream = ? LIMIT ?)`).run(streamId, limit).changes);
|
|
487
494
|
recordsUsed += removed;
|
|
488
495
|
if (work) work.deletedIds = (work.deletedIds ?? 0) + removed;
|
|
489
496
|
if (removed < limit) { delete checkpoint.resetting; state.set("journal", streamId, checkpoint); }
|
|
490
497
|
});
|
|
491
498
|
}
|
|
492
|
-
const addId = state.
|
|
499
|
+
const addId = state.statement("INSERT OR IGNORE INTO journal_ids VALUES (?, ?)");
|
|
493
500
|
const iterator = this.iterateJournal(streamId, { start: checkpoint.bytes, end: version?.size ?? 0,
|
|
494
501
|
check: () => { stopped(); } });
|
|
495
502
|
let done = false;
|
|
@@ -60,7 +60,7 @@ members:
|
|
|
60
60
|
- git:github.com/acme/agents # the host is a member too
|
|
61
61
|
- git:github.com/acme/platform
|
|
62
62
|
packages:
|
|
63
|
-
oats.framework: v1.13.
|
|
63
|
+
oats.framework: v1.13.2 # bare versions resolve through the official catalog
|
|
64
64
|
oats.okf: v5.2.1
|
|
65
65
|
defaults:
|
|
66
66
|
capabilities: { oats.core: { from: package } }
|