@signetai/core 0.150.5 → 0.152.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/dist/index.js +103 -0
- package/dist/migrations/088-transcript-recovery-files.d.ts +3 -0
- package/dist/migrations/088-transcript-recovery-files.d.ts.map +1 -0
- package/dist/migrations/089-job-cancellations.d.ts +16 -0
- package/dist/migrations/089-job-cancellations.d.ts.map +1 -0
- package/dist/migrations/090-job-archive.d.ts +16 -0
- package/dist/migrations/090-job-archive.d.ts.map +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10544,6 +10544,85 @@ function up87(db) {
|
|
|
10544
10544
|
`);
|
|
10545
10545
|
}
|
|
10546
10546
|
|
|
10547
|
+
// src/migrations/088-transcript-recovery-files.ts
|
|
10548
|
+
function up88(db) {
|
|
10549
|
+
db.exec(`
|
|
10550
|
+
CREATE TABLE IF NOT EXISTS transcript_recovery_files (
|
|
10551
|
+
agent_id TEXT NOT NULL,
|
|
10552
|
+
source_path TEXT NOT NULL,
|
|
10553
|
+
harness TEXT NOT NULL,
|
|
10554
|
+
size_bytes INTEGER NOT NULL,
|
|
10555
|
+
mtime_ms INTEGER NOT NULL,
|
|
10556
|
+
content_sha256 TEXT NOT NULL,
|
|
10557
|
+
session_id TEXT NOT NULL,
|
|
10558
|
+
last_scanned_at TEXT NOT NULL,
|
|
10559
|
+
PRIMARY KEY (agent_id, source_path)
|
|
10560
|
+
);
|
|
10561
|
+
|
|
10562
|
+
CREATE INDEX IF NOT EXISTS idx_transcript_capture_jobs_agent_session_id
|
|
10563
|
+
ON transcript_capture_jobs(agent_id, session_id, status);
|
|
10564
|
+
`);
|
|
10565
|
+
}
|
|
10566
|
+
|
|
10567
|
+
// src/migrations/089-job-cancellations.ts
|
|
10568
|
+
function up89(db) {
|
|
10569
|
+
db.exec(`
|
|
10570
|
+
CREATE TABLE IF NOT EXISTS job_cancellations (
|
|
10571
|
+
id TEXT PRIMARY KEY,
|
|
10572
|
+
source_table TEXT NOT NULL,
|
|
10573
|
+
source_id TEXT NOT NULL,
|
|
10574
|
+
status_before TEXT NOT NULL,
|
|
10575
|
+
payload_json TEXT NOT NULL,
|
|
10576
|
+
reason TEXT,
|
|
10577
|
+
actor TEXT NOT NULL,
|
|
10578
|
+
actor_type TEXT NOT NULL,
|
|
10579
|
+
request_id TEXT,
|
|
10580
|
+
created_at TEXT NOT NULL
|
|
10581
|
+
)
|
|
10582
|
+
`);
|
|
10583
|
+
if (!indexExists(db, "job_cancellations", "idx_job_cancellations_source")) {
|
|
10584
|
+
db.exec(`CREATE INDEX IF NOT EXISTS idx_job_cancellations_source
|
|
10585
|
+
ON job_cancellations(source_table, source_id)`);
|
|
10586
|
+
}
|
|
10587
|
+
if (!indexExists(db, "job_cancellations", "idx_job_cancellations_created_at")) {
|
|
10588
|
+
db.exec(`CREATE INDEX IF NOT EXISTS idx_job_cancellations_created_at
|
|
10589
|
+
ON job_cancellations(created_at)`);
|
|
10590
|
+
}
|
|
10591
|
+
}
|
|
10592
|
+
function indexExists(db, table, indexName) {
|
|
10593
|
+
const rows = db.prepare(`PRAGMA index_list(${table})`).all();
|
|
10594
|
+
return rows.some((row) => row.name === indexName);
|
|
10595
|
+
}
|
|
10596
|
+
|
|
10597
|
+
// src/migrations/090-job-archive.ts
|
|
10598
|
+
function up90(db) {
|
|
10599
|
+
db.exec(`
|
|
10600
|
+
CREATE TABLE IF NOT EXISTS job_archive (
|
|
10601
|
+
id TEXT PRIMARY KEY,
|
|
10602
|
+
source_table TEXT NOT NULL,
|
|
10603
|
+
source_id TEXT NOT NULL,
|
|
10604
|
+
status TEXT NOT NULL,
|
|
10605
|
+
payload_json TEXT NOT NULL,
|
|
10606
|
+
archived_at TEXT NOT NULL,
|
|
10607
|
+
archived_by TEXT NOT NULL,
|
|
10608
|
+
reason TEXT,
|
|
10609
|
+
created_at TEXT NOT NULL
|
|
10610
|
+
)
|
|
10611
|
+
`);
|
|
10612
|
+
if (!indexExists2(db, "job_archive", "idx_job_archive_source")) {
|
|
10613
|
+
db.exec(`CREATE INDEX IF NOT EXISTS idx_job_archive_source
|
|
10614
|
+
ON job_archive(source_table, source_id)`);
|
|
10615
|
+
}
|
|
10616
|
+
if (!indexExists2(db, "job_archive", "idx_job_archive_archived_at")) {
|
|
10617
|
+
db.exec(`CREATE INDEX IF NOT EXISTS idx_job_archive_archived_at
|
|
10618
|
+
ON job_archive(archived_at)`);
|
|
10619
|
+
}
|
|
10620
|
+
}
|
|
10621
|
+
function indexExists2(db, table, indexName) {
|
|
10622
|
+
const rows = db.prepare(`PRAGMA index_list(${table})`).all();
|
|
10623
|
+
return rows.some((row) => row.name === indexName);
|
|
10624
|
+
}
|
|
10625
|
+
|
|
10547
10626
|
// src/migrations/index.ts
|
|
10548
10627
|
var MIGRATIONS = [
|
|
10549
10628
|
{
|
|
@@ -11256,6 +11335,30 @@ var MIGRATIONS = [
|
|
|
11256
11335
|
artifacts: {
|
|
11257
11336
|
columns: [{ table: "summary_jobs", column: "boundary_reason" }]
|
|
11258
11337
|
}
|
|
11338
|
+
},
|
|
11339
|
+
{
|
|
11340
|
+
version: 88,
|
|
11341
|
+
name: "transcript-recovery-files",
|
|
11342
|
+
up: up88,
|
|
11343
|
+
artifacts: {
|
|
11344
|
+
tables: ["transcript_recovery_files"]
|
|
11345
|
+
}
|
|
11346
|
+
},
|
|
11347
|
+
{
|
|
11348
|
+
version: 89,
|
|
11349
|
+
name: "job-cancellations",
|
|
11350
|
+
up: up89,
|
|
11351
|
+
artifacts: {
|
|
11352
|
+
tables: ["job_cancellations"]
|
|
11353
|
+
}
|
|
11354
|
+
},
|
|
11355
|
+
{
|
|
11356
|
+
version: 90,
|
|
11357
|
+
name: "job-archive",
|
|
11358
|
+
up: up90,
|
|
11359
|
+
artifacts: {
|
|
11360
|
+
tables: ["job_archive"]
|
|
11361
|
+
}
|
|
11259
11362
|
}
|
|
11260
11363
|
];
|
|
11261
11364
|
function checksum(m) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"088-transcript-recovery-files.d.ts","sourceRoot":"","sources":["../../src/migrations/088-transcript-recovery-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,EAAE,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CAiBxC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MigrationDb } from "./index";
|
|
2
|
+
/**
|
|
3
|
+
* Migration 089: Add `job_cancellations` audit table for issue #901.
|
|
4
|
+
*
|
|
5
|
+
* Operators cancel `memory_jobs` and `summary_jobs` rows via the
|
|
6
|
+
* `cancelObsoleteJobs` repair action. We never hard-delete the source
|
|
7
|
+
* row in cancel — we copy the full payload to `job_cancellations` and
|
|
8
|
+
* flip the source row's `status` to `cancelled`. This preserves
|
|
9
|
+
* provenance for support cases where operators need to explain a
|
|
10
|
+
* cancellation after the fact.
|
|
11
|
+
*
|
|
12
|
+
* Idempotent: `CREATE TABLE IF NOT EXISTS` + index check via
|
|
13
|
+
* `pragma_index_list`. Safe to re-run on a partial upgrade.
|
|
14
|
+
*/
|
|
15
|
+
export declare function up(db: MigrationDb): void;
|
|
16
|
+
//# sourceMappingURL=089-job-cancellations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"089-job-cancellations.d.ts","sourceRoot":"","sources":["../../src/migrations/089-job-cancellations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,wBAAgB,EAAE,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CA4BxC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { MigrationDb } from "./index";
|
|
2
|
+
/**
|
|
3
|
+
* Migration 090: Add `job_archive` provenance table for issue #901.
|
|
4
|
+
*
|
|
5
|
+
* `pruneTerminalJobs` removes rows that have already reached a
|
|
6
|
+
* terminal state (cancelled / completed / dead) and lived beyond the
|
|
7
|
+
* configured retention window. To preserve provenance — required by
|
|
8
|
+
* the issue's "preserving provenance" constraint — we copy the full
|
|
9
|
+
* source row to `job_archive` before deleting it. The archive table
|
|
10
|
+
* holds the original payload plus bookkeeping columns (`archived_at`,
|
|
11
|
+
* `archived_by`, `reason`, `source_table`).
|
|
12
|
+
*
|
|
13
|
+
* Idempotent: `CREATE TABLE IF NOT EXISTS`. Safe to re-run.
|
|
14
|
+
*/
|
|
15
|
+
export declare function up(db: MigrationDb): void;
|
|
16
|
+
//# sourceMappingURL=090-job-archive.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"090-job-archive.d.ts","sourceRoot":"","sources":["../../src/migrations/090-job-archive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,wBAAgB,EAAE,CAAC,EAAE,EAAE,WAAW,GAAG,IAAI,CA2BxC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA+FH,MAAM,WAAW,WAAW;IAC3B,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG;QACrB,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;QAC9B,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;QAC7D,GAAG,CA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