@signetai/connector-base 0.197.6 → 0.197.8

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.
Files changed (2) hide show
  1. package/dist/index.js +57 -0
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -11212,6 +11212,58 @@ function up128(db) {
11212
11212
  AND error IS NOT NULL;
11213
11213
  `);
11214
11214
  }
11215
+ function tableExists3(db, table) {
11216
+ return db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) != null;
11217
+ }
11218
+ function up129(db) {
11219
+ if (!tableExists3(db, "memory_jobs"))
11220
+ return;
11221
+ if (!tableExists3(db, "job_cancellations")) {
11222
+ throw new Error("job_cancellations table missing; cannot retire structural jobs without an audit trail");
11223
+ }
11224
+ db.prepare(`
11225
+ INSERT INTO job_cancellations (
11226
+ id, source_table, source_id, status_before, payload_json,
11227
+ reason, actor, actor_type, request_id, created_at
11228
+ )
11229
+ SELECT
11230
+ 'retire-structural-jobs-129:' || id,
11231
+ 'memory_jobs',
11232
+ id,
11233
+ status,
11234
+ json_object(
11235
+ 'id', id,
11236
+ 'memory_id', memory_id,
11237
+ 'document_id', document_id,
11238
+ 'job_type', job_type,
11239
+ 'status', status,
11240
+ 'payload', payload,
11241
+ 'result', result,
11242
+ 'attempts', attempts,
11243
+ 'max_attempts', max_attempts,
11244
+ 'leased_at', leased_at,
11245
+ 'completed_at', completed_at,
11246
+ 'failed_at', failed_at,
11247
+ 'error', error,
11248
+ 'created_at', created_at,
11249
+ 'updated_at', updated_at
11250
+ ),
11251
+ 'retired structural queue after Dreaming cutover',
11252
+ 'migration:129',
11253
+ 'system',
11254
+ NULL,
11255
+ strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
11256
+ FROM memory_jobs
11257
+ WHERE job_type IN ('structural_classify', 'structural_dependency')
11258
+ AND status IN ('pending', 'leased');
11259
+ `).run();
11260
+ db.exec(`
11261
+ UPDATE memory_jobs
11262
+ SET status = 'cancelled', updated_at = strftime('%Y-%m-%dT%H:%M:%fZ', 'now')
11263
+ WHERE job_type IN ('structural_classify', 'structural_dependency')
11264
+ AND status IN ('pending', 'leased');
11265
+ `);
11266
+ }
11215
11267
  var MIGRATIONS = [
11216
11268
  {
11217
11269
  version: 1,
@@ -12243,6 +12295,11 @@ var MIGRATIONS = [
12243
12295
  version: 128,
12244
12296
  name: "bounded-queue-diagnostics",
12245
12297
  up: up128
12298
+ },
12299
+ {
12300
+ version: 129,
12301
+ name: "retire-structural-jobs",
12302
+ up: up129
12246
12303
  }
12247
12304
  ];
12248
12305
  var LATEST_SCHEMA_VERSION = MIGRATIONS[MIGRATIONS.length - 1]?.version ?? 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signetai/connector-base",
3
- "version": "0.197.6",
3
+ "version": "0.197.8",
4
4
  "description": "Base class for Signet harness connectors",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -26,7 +26,7 @@
26
26
  "typecheck": "tsc --noEmit"
27
27
  },
28
28
  "dependencies": {
29
- "@signetai/core": "0.197.6",
29
+ "@signetai/core": "0.197.8",
30
30
  "json5": "^2.2.3",
31
31
  "jsonc-parser": "3.3.1"
32
32
  },