@cat-factory/worker 0.104.2 → 0.106.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.
Files changed (31) hide show
  1. package/dist/infrastructure/container-assembly.js +2 -1
  2. package/dist/infrastructure/container-assembly.js.map +1 -1
  3. package/dist/infrastructure/container-trace-sinks.d.ts +22 -0
  4. package/dist/infrastructure/container-trace-sinks.d.ts.map +1 -0
  5. package/dist/infrastructure/container-trace-sinks.js +55 -0
  6. package/dist/infrastructure/container-trace-sinks.js.map +1 -0
  7. package/dist/infrastructure/container-tracker-deps.d.ts +16 -0
  8. package/dist/infrastructure/container-tracker-deps.d.ts.map +1 -0
  9. package/dist/infrastructure/container-tracker-deps.js +135 -0
  10. package/dist/infrastructure/container-tracker-deps.js.map +1 -0
  11. package/dist/infrastructure/container.d.ts +2 -12
  12. package/dist/infrastructure/container.d.ts.map +1 -1
  13. package/dist/infrastructure/container.js +5 -152
  14. package/dist/infrastructure/container.js.map +1 -1
  15. package/dist/infrastructure/repositories/D1MergeTrackRecordRepository.d.ts +27 -0
  16. package/dist/infrastructure/repositories/D1MergeTrackRecordRepository.d.ts.map +1 -0
  17. package/dist/infrastructure/repositories/D1MergeTrackRecordRepository.js +154 -0
  18. package/dist/infrastructure/repositories/D1MergeTrackRecordRepository.js.map +1 -0
  19. package/dist/infrastructure/repositories/D1ReviewQuestionPostRepository.d.ts +26 -0
  20. package/dist/infrastructure/repositories/D1ReviewQuestionPostRepository.d.ts.map +1 -0
  21. package/dist/infrastructure/repositories/D1ReviewQuestionPostRepository.js +61 -0
  22. package/dist/infrastructure/repositories/D1ReviewQuestionPostRepository.js.map +1 -0
  23. package/dist/infrastructure/repositories/D1RiskPolicyRepository.d.ts.map +1 -1
  24. package/dist/infrastructure/repositories/D1RiskPolicyRepository.js +7 -3
  25. package/dist/infrastructure/repositories/D1RiskPolicyRepository.js.map +1 -1
  26. package/dist/infrastructure/repositories/D1TrackerSettingsRepository.d.ts.map +1 -1
  27. package/dist/infrastructure/repositories/D1TrackerSettingsRepository.js +6 -3
  28. package/dist/infrastructure/repositories/D1TrackerSettingsRepository.js.map +1 -1
  29. package/migrations/0061_merge_track_records.sql +61 -0
  30. package/migrations/0062_review_question_writeback.sql +30 -0
  31. package/package.json +18 -18
@@ -1 +1 @@
1
- {"version":3,"file":"D1TrackerSettingsRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1TrackerSettingsRepository.ts"],"names":[],"mappings":"AAYA,qFAAqF;AACrF,MAAM,OAAO,2BAA2B;IACrB,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAmB;QAC3B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,OAAO,CAAC,uDAAuD,CAAC;aAChE,IAAI,CAAC,WAAW,CAAC;aACjB,KAAK,EAAc,CAAA;QACtB,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAA;QACrB,OAAO;YACL,OAAO,EAAG,GAAG,CAAC,OAAsC,IAAI,IAAI;YAC5D,cAAc,EAAE,GAAG,CAAC,gBAAgB;YACpC,YAAY,EAAE,GAAG,CAAC,cAAc;YAChC,wBAAwB,EAAE,GAAG,CAAC,4BAA4B,KAAK,CAAC;YAChE,uBAAuB,EAAE,GAAG,CAAC,0BAA0B,KAAK,CAAC;YAC7D,SAAS,EAAE,GAAG,CAAC,UAAU;SAC1B,CAAA;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAmB,EAAE,QAAyB;QACtD,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN;;;;;;;;;;4CAUoC,CACrC;aACA,IAAI,CACH,WAAW,EACX,QAAQ,CAAC,OAAO,EAChB,QAAQ,CAAC,cAAc,EACvB,QAAQ,CAAC,YAAY,EACrB,QAAQ,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACzC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACxC,QAAQ,CAAC,SAAS,CACnB;aACA,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
1
+ {"version":3,"file":"D1TrackerSettingsRepository.js","sourceRoot":"","sources":["../../../src/infrastructure/repositories/D1TrackerSettingsRepository.ts"],"names":[],"mappings":"AAaA,qFAAqF;AACrF,MAAM,OAAO,2BAA2B;IACrB,EAAE,CAAY;IAE/B,YAAY,EAAE,EAAE,EAAsB;QACpC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACd,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAmB;QAC3B,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,EAAE;aACtB,OAAO,CAAC,uDAAuD,CAAC;aAChE,IAAI,CAAC,WAAW,CAAC;aACjB,KAAK,EAAc,CAAA;QACtB,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAA;QACrB,OAAO;YACL,OAAO,EAAG,GAAG,CAAC,OAAsC,IAAI,IAAI;YAC5D,cAAc,EAAE,GAAG,CAAC,gBAAgB;YACpC,YAAY,EAAE,GAAG,CAAC,cAAc;YAChC,wBAAwB,EAAE,GAAG,CAAC,4BAA4B,KAAK,CAAC;YAChE,uBAAuB,EAAE,GAAG,CAAC,0BAA0B,KAAK,CAAC;YAC7D,wBAAwB,EAAE,GAAG,CAAC,2BAA2B,KAAK,CAAC;YAC/D,SAAS,EAAE,GAAG,CAAC,UAAU;SAC1B,CAAA;IACH,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,WAAmB,EAAE,QAAyB;QACtD,MAAM,IAAI,CAAC,EAAE;aACV,OAAO,CACN;;;;;;;;;;;;4CAYoC,CACrC;aACA,IAAI,CACH,WAAW,EACX,QAAQ,CAAC,OAAO,EAChB,QAAQ,CAAC,cAAc,EACvB,QAAQ,CAAC,YAAY,EACrB,QAAQ,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACzC,QAAQ,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACxC,QAAQ,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACzC,QAAQ,CAAC,SAAS,CACnB;aACA,GAAG,EAAE,CAAA;IACV,CAAC;CACF"}
@@ -0,0 +1,61 @@
1
+ -- Merge TRACK RECORD: one row per merge decision, carrying the run's deterministic change
2
+ -- class, the merger's scores at the decision, what happened, and the reviewer-effort tag a
3
+ -- human left. Per-class rollups over this table are what justify widening a preset's per-class
4
+ -- auto-merge rule. Mirrored on Node by the Drizzle `mergeTrackRecords` pgTable.
5
+ -- See docs/initiatives/merge-track-record.md.
6
+ --
7
+ -- Row identity is DETERMINISTIC (`mtr_<executionId>`) and inserts are first-write-wins
8
+ -- (`ON CONFLICT(...) DO NOTHING` at the repository), so the durable driver re-resolving a merger
9
+ -- step whose merge already landed can neither duplicate a row nor clobber an effort tag.
10
+ --
11
+ -- Provider-neutral by construction: the repo identity is `repo_id` + `provider` (the VcsRepoRef /
12
+ -- VcsProvider vocabulary), never a GitHub-shaped numeric installation/repo id.
13
+ CREATE TABLE merge_track_records (
14
+ workspace_id TEXT NOT NULL,
15
+ id TEXT NOT NULL,
16
+ block_id TEXT NOT NULL,
17
+ -- The run whose merger step wrote the record. Nullable at the column level; every record
18
+ -- written today is born inside a run (an external merge SETTLES one, it never mints one).
19
+ execution_id TEXT,
20
+ -- docs | test | dependency | config | source | schema | unknown (highest-rank class present).
21
+ change_class TEXT NOT NULL,
22
+ changed_file_count INTEGER,
23
+ -- The merger's 0..1 axes; null when it produced no parseable assessment (or never ran).
24
+ complexity REAL,
25
+ risk REAL,
26
+ impact REAL,
27
+ risk_policy_id TEXT,
28
+ risk_policy_name TEXT,
29
+ -- pending_review | auto_merged | human_merged | external_merged | rejected.
30
+ decision TEXT NOT NULL,
31
+ -- none | minor | major. NULL until somebody tags it — tagging is a nudge, never a gate.
32
+ review_effort TEXT,
33
+ pr_number INTEGER,
34
+ pr_url TEXT,
35
+ repo_id TEXT,
36
+ provider TEXT,
37
+ created_at INTEGER NOT NULL,
38
+ resolved_at INTEGER,
39
+ tagged_at INTEGER,
40
+ PRIMARY KEY (workspace_id, id)
41
+ );
42
+
43
+ -- The per-class rollup aggregate (`GROUP BY change_class` with conditional SUMs) reads a whole
44
+ -- workspace, so lead with (workspace_id, change_class).
45
+ CREATE INDEX idx_merge_track_records_class
46
+ ON merge_track_records (workspace_id, change_class);
47
+ -- Settling a decision / tagging effort resolves by run.
48
+ CREATE INDEX idx_merge_track_records_execution
49
+ ON merge_track_records (workspace_id, execution_id);
50
+ -- The block-scoped merge controls read the block's most recent record.
51
+ CREATE INDEX idx_merge_track_records_block
52
+ ON merge_track_records (workspace_id, block_id, created_at);
53
+ -- External-merge attribution looks a record up by the PR the webhook named.
54
+ CREATE INDEX idx_merge_track_records_pr
55
+ ON merge_track_records (workspace_id, repo_id, pr_number);
56
+
57
+ -- Per-change-class auto-merge rules on the merge preset, stored as a JSON partial map from
58
+ -- change class to `thresholds` | `always` | `never`. NOT NULL with a `{}` default, so an existing
59
+ -- row resolves to "use the score ceilings" for every class — the historical behaviour. Mirrored
60
+ -- on Node by the `class_rules` text column on the Drizzle `merge_threshold_presets` table.
61
+ ALTER TABLE merge_threshold_presets ADD COLUMN class_rules TEXT NOT NULL DEFAULT '{}';
@@ -0,0 +1,30 @@
1
+ -- Headless clarification loop, slice 2a: questions out to the linked tracker issue.
2
+ -- See docs/initiatives/headless-clarification-loop.md.
3
+ --
4
+ -- When a run started through the public API parks its requirements review on open findings,
5
+ -- the engine echoes those findings — each with its stable id — onto the block's linked tracker
6
+ -- issue(s), so the caller can answer from where the work was requested. Opt-in per workspace
7
+ -- (`writeback_questions_on_park`) with the usual per-task override on the block.
8
+ ALTER TABLE tracker_settings ADD COLUMN writeback_questions_on_park INTEGER NOT NULL DEFAULT 0;
9
+ ALTER TABLE blocks ADD COLUMN tracker_questions_on_park TEXT;
10
+
11
+ -- Idempotency marker: one row per (workspace, review, iteration, linked issue). The post is
12
+ -- driven from the DURABLE driver, whose steps replay, so without this every replay of a parked
13
+ -- gate step would re-post the same findings onto the issue a human is reading. The row is
14
+ -- CLAIMED before the comment is attempted (an insert-or-conditionally-update), so a crash
15
+ -- between the post and the marker write cannot double-post either.
16
+ --
17
+ -- A `failed` row is deliberately re-claimable — a tracker outage should be retried on the next
18
+ -- replay — while `posted` is terminal for that iteration. `error` keeps the last failure so an
19
+ -- operator can see WHY an issue never received its questions.
20
+ CREATE TABLE review_question_posts (
21
+ workspace_id TEXT NOT NULL,
22
+ review_id TEXT NOT NULL,
23
+ iteration INTEGER NOT NULL,
24
+ issue_ref TEXT NOT NULL,
25
+ status TEXT NOT NULL,
26
+ attempts INTEGER NOT NULL DEFAULT 0,
27
+ error TEXT,
28
+ updated_at INTEGER NOT NULL,
29
+ PRIMARY KEY (workspace_id, review_id, iteration, issue_ref)
30
+ );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/worker",
3
- "version": "0.104.2",
3
+ "version": "0.106.0",
4
4
  "description": "Reusable Cloudflare Worker library (Hono + D1) exposing the Agent Architecture Board core: the `createApp()` Hono factory, the default fetch/scheduled/queue handler, and the Durable Object + Workflow classes. Deployments (see deploy/backend) supply the wrangler.toml + config and re-export these.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,22 +42,22 @@
42
42
  "pino": "^10.3.1",
43
43
  "valibot": "^1.4.2",
44
44
  "workers-ai-provider": "^4.0.0",
45
- "@cat-factory/agents": "0.69.8",
46
- "@cat-factory/caching": "0.10.41",
47
- "@cat-factory/consensus": "0.11.37",
48
- "@cat-factory/contracts": "0.165.0",
49
- "@cat-factory/eks": "0.1.136",
50
- "@cat-factory/gates": "0.7.28",
51
- "@cat-factory/gitlab": "0.13.4",
52
- "@cat-factory/integrations": "0.98.0",
53
- "@cat-factory/kernel": "0.159.1",
54
- "@cat-factory/observability-langfuse": "0.7.259",
55
- "@cat-factory/observability-otel": "0.2.42",
56
- "@cat-factory/orchestration": "0.140.1",
57
- "@cat-factory/prompt-fragments": "0.14.13",
58
- "@cat-factory/provider-cloudflare": "0.7.287",
59
- "@cat-factory/server": "0.150.0",
60
- "@cat-factory/spend": "0.12.85"
45
+ "@cat-factory/agents": "0.69.10",
46
+ "@cat-factory/caching": "0.10.43",
47
+ "@cat-factory/consensus": "0.11.39",
48
+ "@cat-factory/contracts": "0.167.0",
49
+ "@cat-factory/eks": "0.1.138",
50
+ "@cat-factory/gates": "0.7.30",
51
+ "@cat-factory/gitlab": "0.13.6",
52
+ "@cat-factory/kernel": "0.161.0",
53
+ "@cat-factory/integrations": "0.100.0",
54
+ "@cat-factory/observability-langfuse": "0.7.261",
55
+ "@cat-factory/observability-otel": "0.2.44",
56
+ "@cat-factory/orchestration": "0.142.0",
57
+ "@cat-factory/prompt-fragments": "0.14.15",
58
+ "@cat-factory/provider-cloudflare": "0.7.289",
59
+ "@cat-factory/server": "0.152.0",
60
+ "@cat-factory/spend": "0.12.87"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@cloudflare/vitest-pool-workers": "^0.18.7",
@@ -65,7 +65,7 @@
65
65
  "typescript": "7.0.2",
66
66
  "vitest": "^4.1.10",
67
67
  "wrangler": "^4.113.0",
68
- "@cat-factory/conformance": "0.11.73"
68
+ "@cat-factory/conformance": "0.11.75"
69
69
  },
70
70
  "scripts": {
71
71
  "build": "tsc -b tsconfig.build.json",