@cat-factory/worker 0.219.0 → 0.221.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 (32) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +17 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/infrastructure/container-assembly.d.ts.map +1 -1
  6. package/dist/infrastructure/container-assembly.js +5 -0
  7. package/dist/infrastructure/container-assembly.js.map +1 -1
  8. package/dist/infrastructure/container.d.ts.map +1 -1
  9. package/dist/infrastructure/container.js +2 -0
  10. package/dist/infrastructure/container.js.map +1 -1
  11. package/dist/infrastructure/env.d.ts +5 -0
  12. package/dist/infrastructure/env.d.ts.map +1 -1
  13. package/dist/infrastructure/env.js.map +1 -1
  14. package/dist/infrastructure/events/DurableObjectEventPublisher.d.ts +2 -1
  15. package/dist/infrastructure/events/DurableObjectEventPublisher.d.ts.map +1 -1
  16. package/dist/infrastructure/events/DurableObjectEventPublisher.js +3 -0
  17. package/dist/infrastructure/events/DurableObjectEventPublisher.js.map +1 -1
  18. package/dist/infrastructure/repositories/D1GuidedReviewRepository.d.ts +48 -0
  19. package/dist/infrastructure/repositories/D1GuidedReviewRepository.d.ts.map +1 -0
  20. package/dist/infrastructure/repositories/D1GuidedReviewRepository.js +360 -0
  21. package/dist/infrastructure/repositories/D1GuidedReviewRepository.js.map +1 -0
  22. package/dist/infrastructure/workflows/GuidedReviewWorkflow.d.ts +14 -0
  23. package/dist/infrastructure/workflows/GuidedReviewWorkflow.d.ts.map +1 -0
  24. package/dist/infrastructure/workflows/GuidedReviewWorkflow.js +25 -0
  25. package/dist/infrastructure/workflows/GuidedReviewWorkflow.js.map +1 -0
  26. package/dist/infrastructure/workflows/WorkflowsGuidedReviewRunner.d.ts +14 -0
  27. package/dist/infrastructure/workflows/WorkflowsGuidedReviewRunner.d.ts.map +1 -0
  28. package/dist/infrastructure/workflows/WorkflowsGuidedReviewRunner.js +21 -0
  29. package/dist/infrastructure/workflows/WorkflowsGuidedReviewRunner.js.map +1 -0
  30. package/migrations/0104_guided_review.sql +96 -0
  31. package/migrations/0105_guided_review_owner_kind.sql +10 -0
  32. package/package.json +19 -19
@@ -0,0 +1,96 @@
1
+ -- Guided PR review (docs/initiatives/guided-pr-review.md): a per-user exploration session over one
2
+ -- pull request. One row per thread, message and draft, so concurrent threads write disjoint rows.
3
+ CREATE TABLE guided_review_sessions (
4
+ workspace_id TEXT NOT NULL,
5
+ id TEXT NOT NULL,
6
+ provider TEXT NOT NULL,
7
+ repo_id TEXT NOT NULL,
8
+ owner TEXT NOT NULL,
9
+ repo TEXT NOT NULL,
10
+ pr_number INTEGER NOT NULL,
11
+ pr_title TEXT NOT NULL,
12
+ reviewed_head_sha TEXT NOT NULL,
13
+ base_ref TEXT NOT NULL,
14
+ created_by TEXT NOT NULL,
15
+ overview_status TEXT NOT NULL,
16
+ overview_generation INTEGER NOT NULL,
17
+ overview_content TEXT,
18
+ overview_failure TEXT,
19
+ overview_model TEXT,
20
+ overview_claimed_at INTEGER,
21
+ overview_driver TEXT NOT NULL,
22
+ created_at INTEGER NOT NULL,
23
+ updated_at INTEGER NOT NULL,
24
+ PRIMARY KEY (workspace_id, id)
25
+ );
26
+ -- One session per creator per PR: two concurrent opens converge on the row that won.
27
+ CREATE UNIQUE INDEX idx_guided_review_sessions_pr
28
+ ON guided_review_sessions (workspace_id, repo_id, pr_number, created_by);
29
+ CREATE INDEX idx_guided_review_sessions_stale
30
+ ON guided_review_sessions (overview_driver, overview_status, updated_at);
31
+
32
+ CREATE TABLE guided_review_threads (
33
+ workspace_id TEXT NOT NULL,
34
+ id TEXT NOT NULL,
35
+ session_id TEXT NOT NULL,
36
+ title TEXT NOT NULL,
37
+ created_by TEXT NOT NULL,
38
+ created_at INTEGER NOT NULL,
39
+ updated_at INTEGER NOT NULL,
40
+ PRIMARY KEY (workspace_id, id)
41
+ );
42
+ CREATE INDEX idx_guided_review_threads_session
43
+ ON guided_review_threads (workspace_id, session_id);
44
+
45
+ CREATE TABLE guided_review_messages (
46
+ workspace_id TEXT NOT NULL,
47
+ id TEXT NOT NULL,
48
+ thread_id TEXT NOT NULL,
49
+ session_id TEXT NOT NULL,
50
+ seq INTEGER NOT NULL,
51
+ role TEXT NOT NULL,
52
+ kind TEXT NOT NULL,
53
+ depth TEXT NOT NULL,
54
+ content TEXT NOT NULL,
55
+ status TEXT NOT NULL,
56
+ citations TEXT NOT NULL DEFAULT '[]',
57
+ failure TEXT,
58
+ draft_report TEXT,
59
+ model TEXT,
60
+ claimed_at INTEGER,
61
+ driver TEXT NOT NULL,
62
+ created_at INTEGER NOT NULL,
63
+ updated_at INTEGER NOT NULL,
64
+ PRIMARY KEY (workspace_id, id)
65
+ );
66
+ CREATE UNIQUE INDEX idx_guided_review_messages_seq
67
+ ON guided_review_messages (workspace_id, thread_id, seq);
68
+ -- A thread waits on at most one answer at a time; a second question is refused as thread_busy.
69
+ CREATE UNIQUE INDEX idx_guided_review_messages_live
70
+ ON guided_review_messages (workspace_id, thread_id)
71
+ WHERE role = 'assistant' AND status IN ('pending', 'running');
72
+ CREATE INDEX idx_guided_review_messages_stale
73
+ ON guided_review_messages (driver, status, updated_at);
74
+
75
+ CREATE TABLE guided_review_comment_drafts (
76
+ workspace_id TEXT NOT NULL,
77
+ id TEXT NOT NULL,
78
+ session_id TEXT NOT NULL,
79
+ thread_id TEXT NOT NULL,
80
+ message_id TEXT NOT NULL,
81
+ path TEXT NOT NULL,
82
+ line INTEGER NOT NULL,
83
+ start_line INTEGER,
84
+ side TEXT NOT NULL,
85
+ body TEXT NOT NULL,
86
+ rationale TEXT NOT NULL,
87
+ status TEXT NOT NULL,
88
+ post_error TEXT,
89
+ posted_url TEXT,
90
+ rev INTEGER NOT NULL,
91
+ created_at INTEGER NOT NULL,
92
+ updated_at INTEGER NOT NULL,
93
+ PRIMARY KEY (workspace_id, id)
94
+ );
95
+ CREATE INDEX idx_guided_review_comment_drafts_session
96
+ ON guided_review_comment_drafts (workspace_id, session_id);
@@ -0,0 +1,10 @@
1
+ -- Guided PR review: what kind of identity owns a session, and the order the public list pages in.
2
+ --
3
+ -- `created_by` holds a user id for a person and the key id for a public-API key bound to nobody.
4
+ -- The kind says which, so background work resolves a person's credentials only for a person and
5
+ -- the workspace's own for a key. Existing rows were all opened from the app, so they are `user`.
6
+ ALTER TABLE guided_review_sessions ADD COLUMN created_by_kind TEXT NOT NULL DEFAULT 'user';
7
+
8
+ -- The public list is a keyset page over (created_at, id), newest first.
9
+ CREATE INDEX idx_guided_review_sessions_created
10
+ ON guided_review_sessions (workspace_id, created_at, id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/worker",
3
- "version": "0.219.0",
3
+ "version": "0.221.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",
@@ -36,23 +36,23 @@
36
36
  "@ai-sdk/anthropic": "^4.0.67",
37
37
  "@ai-sdk/openai": "^4.0.79",
38
38
  "@ai-sdk/openai-compatible": "^3.0.58",
39
- "@cat-factory/agents": "0.168.3",
40
- "@cat-factory/binary-generators": "0.3.57",
41
- "@cat-factory/caching": "0.20.91",
42
- "@cat-factory/consensus": "0.19.4",
43
- "@cat-factory/contracts": "0.357.0",
44
- "@cat-factory/eks": "0.1.396",
45
- "@cat-factory/gates": "0.11.57",
46
- "@cat-factory/gitlab": "0.23.20",
47
- "@cat-factory/integrations": "0.174.6",
48
- "@cat-factory/kernel": "0.352.0",
49
- "@cat-factory/observability-langfuse": "0.11.57",
50
- "@cat-factory/observability-otel": "0.23.50",
51
- "@cat-factory/orchestration": "0.315.0",
52
- "@cat-factory/prompt-fragments": "1.1.53",
53
- "@cat-factory/provider-cloudflare": "0.7.550",
54
- "@cat-factory/server": "0.327.0",
55
- "@cat-factory/spend": "0.23.2",
39
+ "@cat-factory/agents": "0.169.0",
40
+ "@cat-factory/binary-generators": "0.3.59",
41
+ "@cat-factory/caching": "0.20.93",
42
+ "@cat-factory/consensus": "0.19.6",
43
+ "@cat-factory/contracts": "0.359.0",
44
+ "@cat-factory/eks": "0.1.398",
45
+ "@cat-factory/gates": "0.11.59",
46
+ "@cat-factory/gitlab": "0.23.22",
47
+ "@cat-factory/integrations": "0.174.8",
48
+ "@cat-factory/kernel": "0.354.0",
49
+ "@cat-factory/observability-langfuse": "0.11.59",
50
+ "@cat-factory/observability-otel": "0.23.52",
51
+ "@cat-factory/orchestration": "0.317.0",
52
+ "@cat-factory/prompt-fragments": "1.1.55",
53
+ "@cat-factory/provider-cloudflare": "0.7.552",
54
+ "@cat-factory/server": "0.329.0",
55
+ "@cat-factory/spend": "0.23.4",
56
56
  "@cloudflare/containers": "^0.3.7",
57
57
  "@hono/valibot-validator": "^0.6.1",
58
58
  "ai": "^7.0.120",
@@ -62,7 +62,7 @@
62
62
  "workers-ai-provider": "^4.0.0"
63
63
  },
64
64
  "devDependencies": {
65
- "@cat-factory/conformance": "0.60.0",
65
+ "@cat-factory/conformance": "0.62.0",
66
66
  "@cloudflare/vitest-pool-workers": "^0.22.0",
67
67
  "@cloudflare/workers-types": "5.20260815.1",
68
68
  "typescript": "7.0.2",