@cat-factory/node-server 0.6.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 (156) hide show
  1. package/LICENSE +21 -0
  2. package/dist/config.d.ts +3 -0
  3. package/dist/config.d.ts.map +1 -0
  4. package/dist/config.js +297 -0
  5. package/dist/config.js.map +1 -0
  6. package/dist/container.d.ts +88 -0
  7. package/dist/container.d.ts.map +1 -0
  8. package/dist/container.js +937 -0
  9. package/dist/container.js.map +1 -0
  10. package/dist/db/client.d.ts +13 -0
  11. package/dist/db/client.d.ts.map +1 -0
  12. package/dist/db/client.js +21 -0
  13. package/dist/db/client.js.map +1 -0
  14. package/dist/db/migrate.d.ts +12 -0
  15. package/dist/db/migrate.d.ts.map +1 -0
  16. package/dist/db/migrate.js +40 -0
  17. package/dist/db/migrate.js.map +1 -0
  18. package/dist/db/schema.d.ts +7858 -0
  19. package/dist/db/schema.d.ts.map +1 -0
  20. package/dist/db/schema.js +928 -0
  21. package/dist/db/schema.js.map +1 -0
  22. package/dist/environments.d.ts +11 -0
  23. package/dist/environments.d.ts.map +1 -0
  24. package/dist/environments.js +31 -0
  25. package/dist/environments.js.map +1 -0
  26. package/dist/execution/bootstrapRunner.d.ts +27 -0
  27. package/dist/execution/bootstrapRunner.d.ts.map +1 -0
  28. package/dist/execution/bootstrapRunner.js +79 -0
  29. package/dist/execution/bootstrapRunner.js.map +1 -0
  30. package/dist/execution/config.d.ts +37 -0
  31. package/dist/execution/config.d.ts.map +1 -0
  32. package/dist/execution/config.js +86 -0
  33. package/dist/execution/config.js.map +1 -0
  34. package/dist/execution/drive.d.ts +6 -0
  35. package/dist/execution/drive.d.ts.map +1 -0
  36. package/dist/execution/drive.js +13 -0
  37. package/dist/execution/drive.js.map +1 -0
  38. package/dist/execution/pgBossRunner.d.ts +82 -0
  39. package/dist/execution/pgBossRunner.d.ts.map +1 -0
  40. package/dist/execution/pgBossRunner.js +163 -0
  41. package/dist/execution/pgBossRunner.js.map +1 -0
  42. package/dist/gateways.d.ts +4 -0
  43. package/dist/gateways.d.ts.map +1 -0
  44. package/dist/gateways.js +91 -0
  45. package/dist/gateways.js.map +1 -0
  46. package/dist/index.d.ts +13 -0
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +22 -0
  49. package/dist/index.js.map +1 -0
  50. package/dist/main.d.ts +2 -0
  51. package/dist/main.d.ts.map +1 -0
  52. package/dist/main.js +9 -0
  53. package/dist/main.js.map +1 -0
  54. package/dist/modelProvider.d.ts +6 -0
  55. package/dist/modelProvider.d.ts.map +1 -0
  56. package/dist/modelProvider.js +72 -0
  57. package/dist/modelProvider.js.map +1 -0
  58. package/dist/realtime.d.ts +62 -0
  59. package/dist/realtime.d.ts.map +1 -0
  60. package/dist/realtime.js +171 -0
  61. package/dist/realtime.js.map +1 -0
  62. package/dist/recurring.d.ts +11 -0
  63. package/dist/recurring.d.ts.map +1 -0
  64. package/dist/recurring.js +33 -0
  65. package/dist/recurring.js.map +1 -0
  66. package/dist/repositories/bootstrap.d.ts +25 -0
  67. package/dist/repositories/bootstrap.d.ts.map +1 -0
  68. package/dist/repositories/bootstrap.js +280 -0
  69. package/dist/repositories/bootstrap.js.map +1 -0
  70. package/dist/repositories/containerExecution.d.ts +33 -0
  71. package/dist/repositories/containerExecution.d.ts.map +1 -0
  72. package/dist/repositories/containerExecution.js +199 -0
  73. package/dist/repositories/containerExecution.js.map +1 -0
  74. package/dist/repositories/documents.d.ts +31 -0
  75. package/dist/repositories/documents.d.ts.map +1 -0
  76. package/dist/repositories/documents.js +176 -0
  77. package/dist/repositories/documents.js.map +1 -0
  78. package/dist/repositories/drizzle.d.ts +105 -0
  79. package/dist/repositories/drizzle.d.ts.map +1 -0
  80. package/dist/repositories/drizzle.js +1872 -0
  81. package/dist/repositories/drizzle.js.map +1 -0
  82. package/dist/repositories/environments.d.ts +23 -0
  83. package/dist/repositories/environments.d.ts.map +1 -0
  84. package/dist/repositories/environments.js +162 -0
  85. package/dist/repositories/environments.js.map +1 -0
  86. package/dist/repositories/fragments.d.ts +23 -0
  87. package/dist/repositories/fragments.d.ts.map +1 -0
  88. package/dist/repositories/fragments.js +190 -0
  89. package/dist/repositories/fragments.js.map +1 -0
  90. package/dist/repositories/github.d.ts +53 -0
  91. package/dist/repositories/github.d.ts.map +1 -0
  92. package/dist/repositories/github.js +441 -0
  93. package/dist/repositories/github.js.map +1 -0
  94. package/dist/repositories/localModelEndpoint.d.ts +12 -0
  95. package/dist/repositories/localModelEndpoint.d.ts.map +1 -0
  96. package/dist/repositories/localModelEndpoint.js +75 -0
  97. package/dist/repositories/localModelEndpoint.js.map +1 -0
  98. package/dist/repositories/notifications.d.ts +11 -0
  99. package/dist/repositories/notifications.d.ts.map +1 -0
  100. package/dist/repositories/notifications.js +88 -0
  101. package/dist/repositories/notifications.js.map +1 -0
  102. package/dist/repositories/personalSubscription.d.ts +22 -0
  103. package/dist/repositories/personalSubscription.d.ts.map +1 -0
  104. package/dist/repositories/personalSubscription.js +159 -0
  105. package/dist/repositories/personalSubscription.js.map +1 -0
  106. package/dist/repositories/providerApiKey.d.ts +18 -0
  107. package/dist/repositories/providerApiKey.d.ts.map +1 -0
  108. package/dist/repositories/providerApiKey.js +111 -0
  109. package/dist/repositories/providerApiKey.js.map +1 -0
  110. package/dist/repositories/providerSubscription.d.ts +16 -0
  111. package/dist/repositories/providerSubscription.d.ts.map +1 -0
  112. package/dist/repositories/providerSubscription.js +88 -0
  113. package/dist/repositories/providerSubscription.js.map +1 -0
  114. package/dist/repositories/slack.d.ts +23 -0
  115. package/dist/repositories/slack.d.ts.map +1 -0
  116. package/dist/repositories/slack.js +150 -0
  117. package/dist/repositories/slack.js.map +1 -0
  118. package/dist/repositories/tasks.d.ts +24 -0
  119. package/dist/repositories/tasks.d.ts.map +1 -0
  120. package/dist/repositories/tasks.js +194 -0
  121. package/dist/repositories/tasks.js.map +1 -0
  122. package/dist/retention.d.ts +38 -0
  123. package/dist/retention.d.ts.map +1 -0
  124. package/dist/retention.js +53 -0
  125. package/dist/retention.js.map +1 -0
  126. package/dist/runtime.d.ts +10 -0
  127. package/dist/runtime.d.ts.map +1 -0
  128. package/dist/runtime.js +13 -0
  129. package/dist/runtime.js.map +1 -0
  130. package/dist/server.d.ts +41 -0
  131. package/dist/server.d.ts.map +1 -0
  132. package/dist/server.js +138 -0
  133. package/dist/server.js.map +1 -0
  134. package/dist/tasks/JiraProvider.d.ts +27 -0
  135. package/dist/tasks/JiraProvider.d.ts.map +1 -0
  136. package/dist/tasks/JiraProvider.js +79 -0
  137. package/dist/tasks/JiraProvider.js.map +1 -0
  138. package/drizzle/20260622175812_flashy_maginty/migration.sql +689 -0
  139. package/drizzle/20260622175812_flashy_maginty/snapshot.json +8318 -0
  140. package/drizzle/20260623172634_loud_wallop/migration.sql +11 -0
  141. package/drizzle/20260623172634_loud_wallop/snapshot.json +8439 -0
  142. package/drizzle/20260623174706_acoustic_zemo/migration.sql +16 -0
  143. package/drizzle/20260623174706_acoustic_zemo/snapshot.json +8506 -0
  144. package/drizzle/20260623184400_silent_cardiac/migration.sql +24 -0
  145. package/drizzle/20260623184400_silent_cardiac/snapshot.json +8639 -0
  146. package/drizzle/20260623205323_quick_arclight/migration.sql +1 -0
  147. package/drizzle/20260623205323_quick_arclight/snapshot.json +8963 -0
  148. package/drizzle/20260623221910_black_zombie/migration.sql +22 -0
  149. package/drizzle/20260623221910_black_zombie/snapshot.json +9189 -0
  150. package/drizzle/20260624131343_far_lily_hollister/migration.sql +3 -0
  151. package/drizzle/20260624131343_far_lily_hollister/snapshot.json +9228 -0
  152. package/drizzle/20260624135452_tiny_norman_osborn/migration.sql +11 -0
  153. package/drizzle/20260624135452_tiny_norman_osborn/snapshot.json +9126 -0
  154. package/drizzle/20260624140138_wandering_avengers/migration.sql +1 -0
  155. package/drizzle/20260624140138_wandering_avengers/snapshot.json +9045 -0
  156. package/package.json +62 -0
@@ -0,0 +1,199 @@
1
+ import { and, eq, isNull } from 'drizzle-orm';
2
+ import { githubInstallations, runnerPoolConnections, services, workspaces } from '../db/schema.js';
3
+ // Drizzle/Postgres adapters for the persistence the container-agent execution path
4
+ // needs on the Node facade: a workspace's self-hosted runner-pool binding, its
5
+ // GitHub App installation, and the projected repos the shared `buildResolveRepoTarget`
6
+ // reads to tell the harness which repo a run operates on. These mirror the Cloudflare
7
+ // D1 repositories (D1RunnerPoolConnectionRepository / D1GitHubInstallationRepository /
8
+ // D1RepoProjectionRepository) column-for-column so behaviour matches across stores.
9
+ /** Postgres-backed store of workspace → runner-pool bindings (mirror of D1 migration 0013). */
10
+ export class DrizzleRunnerPoolConnectionRepository {
11
+ db;
12
+ constructor(db) {
13
+ this.db = db;
14
+ }
15
+ async getByWorkspace(workspaceId) {
16
+ const rows = await this.db
17
+ .select()
18
+ .from(runnerPoolConnections)
19
+ .where(and(eq(runnerPoolConnections.workspace_id, workspaceId), isNull(runnerPoolConnections.deleted_at)))
20
+ .limit(1);
21
+ const row = rows[0];
22
+ if (!row)
23
+ return null;
24
+ return {
25
+ workspaceId: row.workspace_id,
26
+ providerId: row.provider_id,
27
+ label: row.label,
28
+ baseUrl: row.base_url,
29
+ manifestJson: row.manifest_json,
30
+ secretsCipher: row.secrets_cipher,
31
+ createdAt: row.created_at,
32
+ deletedAt: row.deleted_at,
33
+ };
34
+ }
35
+ async upsert(record) {
36
+ // A workspace has a single live pool: clear any prior binding (live or
37
+ // tombstoned) before inserting, so re-registering a different pool can't
38
+ // collide on the (workspace_id, provider_id) primary key.
39
+ await this.db
40
+ .delete(runnerPoolConnections)
41
+ .where(eq(runnerPoolConnections.workspace_id, record.workspaceId));
42
+ await this.db.insert(runnerPoolConnections).values({
43
+ workspace_id: record.workspaceId,
44
+ provider_id: record.providerId,
45
+ label: record.label,
46
+ base_url: record.baseUrl,
47
+ manifest_json: record.manifestJson,
48
+ secrets_cipher: record.secretsCipher,
49
+ created_at: record.createdAt,
50
+ deleted_at: null,
51
+ });
52
+ }
53
+ async softDelete(workspaceId, at) {
54
+ await this.db
55
+ .update(runnerPoolConnections)
56
+ .set({ deleted_at: at })
57
+ .where(and(eq(runnerPoolConnections.workspace_id, workspaceId), isNull(runnerPoolConnections.deleted_at)));
58
+ }
59
+ }
60
+ function rowToInstallation(row) {
61
+ return {
62
+ installationId: row.installation_id,
63
+ workspaceId: row.workspace_id,
64
+ accountId: row.account_id ?? null,
65
+ accountLogin: row.account_login,
66
+ targetType: row.target_type === 'Organization' ? 'Organization' : 'User',
67
+ appId: row.app_id ?? null,
68
+ cachedToken: row.cached_token,
69
+ tokenExpiresAt: row.token_expires_at,
70
+ createdAt: row.created_at,
71
+ deletedAt: row.deleted_at,
72
+ };
73
+ }
74
+ /** Postgres-backed store of workspace → GitHub App installation bindings (mirror of D1 migration 0004). */
75
+ export class DrizzleGitHubInstallationRepository {
76
+ db;
77
+ constructor(db) {
78
+ this.db = db;
79
+ }
80
+ async getByInstallationId(installationId) {
81
+ const rows = await this.db
82
+ .select()
83
+ .from(githubInstallations)
84
+ .where(eq(githubInstallations.installation_id, installationId))
85
+ .limit(1);
86
+ return rows[0] ? rowToInstallation(rows[0]) : null;
87
+ }
88
+ async getByWorkspace(workspaceId) {
89
+ // Prefer the workspace's own direct binding (the connector, or the
90
+ // auth-disabled path); else one shared via its account.
91
+ const direct = await this.db
92
+ .select()
93
+ .from(githubInstallations)
94
+ .where(and(eq(githubInstallations.workspace_id, workspaceId), isNull(githubInstallations.deleted_at)))
95
+ .limit(1);
96
+ if (direct[0])
97
+ return rowToInstallation(direct[0]);
98
+ const ws = await this.db
99
+ .select({ accountId: workspaces.account_id })
100
+ .from(workspaces)
101
+ .where(eq(workspaces.id, workspaceId))
102
+ .limit(1);
103
+ const accountId = ws[0]?.accountId;
104
+ if (!accountId)
105
+ return null;
106
+ const shared = await this.db
107
+ .select()
108
+ .from(githubInstallations)
109
+ .where(and(eq(githubInstallations.account_id, accountId), isNull(githubInstallations.deleted_at)))
110
+ .limit(1);
111
+ return shared[0] ? rowToInstallation(shared[0]) : null;
112
+ }
113
+ async listWorkspacesForInstallation(installationId) {
114
+ const rows = await this.db
115
+ .select()
116
+ .from(githubInstallations)
117
+ .where(and(eq(githubInstallations.installation_id, installationId), isNull(githubInstallations.deleted_at)))
118
+ .limit(1);
119
+ const install = rows[0];
120
+ if (!install)
121
+ return [];
122
+ const ids = new Set([install.workspace_id]);
123
+ if (install.account_id) {
124
+ const peers = await this.db
125
+ .select({ id: workspaces.id })
126
+ .from(workspaces)
127
+ .where(eq(workspaces.account_id, install.account_id));
128
+ for (const p of peers)
129
+ ids.add(p.id);
130
+ }
131
+ return [...ids];
132
+ }
133
+ async listActive() {
134
+ const rows = await this.db
135
+ .select()
136
+ .from(githubInstallations)
137
+ .where(isNull(githubInstallations.deleted_at));
138
+ return rows.map(rowToInstallation);
139
+ }
140
+ async upsert(installation) {
141
+ const values = {
142
+ installation_id: installation.installationId,
143
+ workspace_id: installation.workspaceId,
144
+ account_id: installation.accountId,
145
+ account_login: installation.accountLogin,
146
+ target_type: installation.targetType,
147
+ app_id: installation.appId,
148
+ cached_token: installation.cachedToken,
149
+ token_expires_at: installation.tokenExpiresAt,
150
+ created_at: installation.createdAt,
151
+ deleted_at: installation.deletedAt,
152
+ };
153
+ await this.db
154
+ .insert(githubInstallations)
155
+ .values(values)
156
+ .onConflictDoUpdate({ target: githubInstallations.installation_id, set: values });
157
+ }
158
+ async updateCachedToken(installationId, token, expiresAt) {
159
+ await this.db
160
+ .update(githubInstallations)
161
+ .set({ cached_token: token, token_expires_at: expiresAt })
162
+ .where(eq(githubInstallations.installation_id, installationId));
163
+ }
164
+ async softDelete(installationId, at) {
165
+ await this.db
166
+ .update(githubInstallations)
167
+ .set({ deleted_at: at })
168
+ .where(eq(githubInstallations.installation_id, installationId));
169
+ }
170
+ }
171
+ /**
172
+ * Minimal read adapter the shared `buildResolveRepoTarget` needs to resolve a frame's
173
+ * service (and, for a monorepo, its pinned subdirectory). Only `getByFrameBlock` is
174
+ * implemented — the full account-owned service store lives in `drizzle.ts`.
175
+ */
176
+ export class DrizzleServiceFrameRepository {
177
+ db;
178
+ constructor(db) {
179
+ this.db = db;
180
+ }
181
+ async getByFrameBlock(frameBlockId) {
182
+ const [row] = await this.db
183
+ .select()
184
+ .from(services)
185
+ .where(eq(services.frame_block_id, frameBlockId));
186
+ return row
187
+ ? {
188
+ id: row.id,
189
+ accountId: row.account_id,
190
+ frameBlockId: row.frame_block_id,
191
+ installationId: row.installation_id,
192
+ repoGithubId: row.repo_github_id,
193
+ directory: row.directory,
194
+ createdAt: row.created_at,
195
+ }
196
+ : null;
197
+ }
198
+ }
199
+ //# sourceMappingURL=containerExecution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"containerExecution.js","sourceRoot":"","sources":["../../src/repositories/containerExecution.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAE7C,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAElG,mFAAmF;AACnF,+EAA+E;AAC/E,uFAAuF;AACvF,sFAAsF;AACtF,uFAAuF;AACvF,oFAAoF;AAEpF,+FAA+F;AAC/F,MAAM,OAAO,qCAAqC;IACnB,EAAE;IAA/B,YAA6B,EAAa;kBAAb,EAAE;IAAc,CAAC;IAE9C,KAAK,CAAC,cAAc,CAAC,WAAmB;QACtC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,EAAE;aACvB,MAAM,EAAE;aACR,IAAI,CAAC,qBAAqB,CAAC;aAC3B,KAAK,CACJ,GAAG,CACD,EAAE,CAAC,qBAAqB,CAAC,YAAY,EAAE,WAAW,CAAC,EACnD,MAAM,CAAC,qBAAqB,CAAC,UAAU,CAAC,CACzC,CACF;aACA,KAAK,CAAC,CAAC,CAAC,CAAA;QACX,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,IAAI,CAAC,GAA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;aACd,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,CAAA;QACnD,OAAO,GAAG;YACR,CAAC,CAAC;gBACE,EAAE,EAAE,GAAG,CAAC,EAAE;gBACV,SAAS,EAAE,GAAG,CAAC,UAAU;gBACzB,YAAY,EAAE,GAAG,CAAC,cAAc;gBAChC,cAAc,EAAE,GAAG,CAAC,eAAe;gBACnC,YAAY,EAAE,GAAG,CAAC,cAAc;gBAChC,SAAS,EAAE,GAAG,CAAC,SAAS;gBACxB,SAAS,EAAE,GAAG,CAAC,UAAU;aAC1B;YACH,CAAC,CAAC,IAAI,CAAA;IACV,CAAC;CACF"}
@@ -0,0 +1,31 @@
1
+ import type { DocumentConnectionRecord, DocumentConnectionRepository, DocumentRecord, DocumentRepository, DocumentSourceKind, SecretCipher } from '@cat-factory/kernel';
2
+ import type { DrizzleDb } from '../db/client.js';
3
+ /**
4
+ * Workspace → document-source connections over Postgres. Source credentials (a
5
+ * third-party API token) are encrypted at rest with the same AES-256-GCM envelope
6
+ * cipher the environments/Slack integrations use — never stored plaintext. A legacy
7
+ * row whose `credentials` predates encryption (no `v1.` envelope) is read as
8
+ * plaintext JSON, then re-encrypted on the next write.
9
+ */
10
+ export declare class DrizzleDocumentConnectionRepository implements DocumentConnectionRepository {
11
+ private readonly db;
12
+ private readonly cipher;
13
+ constructor(db: DrizzleDb, cipher: SecretCipher);
14
+ private decodeCredentials;
15
+ private rowToRecord;
16
+ getByWorkspace(workspaceId: string, source: DocumentSourceKind): Promise<DocumentConnectionRecord | null>;
17
+ listByWorkspace(workspaceId: string): Promise<DocumentConnectionRecord[]>;
18
+ upsert(record: DocumentConnectionRecord): Promise<void>;
19
+ softDelete(workspaceId: string, source: DocumentSourceKind, at: number): Promise<void>;
20
+ }
21
+ /** Imported document projections over Postgres, across sources (migration 0012). */
22
+ export declare class DrizzleDocumentRepository implements DocumentRepository {
23
+ private readonly db;
24
+ constructor(db: DrizzleDb);
25
+ upsert(record: DocumentRecord): Promise<void>;
26
+ get(workspaceId: string, source: DocumentSourceKind, externalId: string): Promise<DocumentRecord | null>;
27
+ listByWorkspace(workspaceId: string): Promise<DocumentRecord[]>;
28
+ listByBlock(workspaceId: string, blockId: string): Promise<DocumentRecord[]>;
29
+ linkBlock(workspaceId: string, source: DocumentSourceKind, externalId: string, blockId: string | null): Promise<void>;
30
+ }
31
+ //# sourceMappingURL=documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../src/repositories/documents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,4BAA4B,EAC5B,cAAc,EACd,kBAAkB,EAClB,kBAAkB,EAClB,YAAY,EACb,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAoBhD;;;;;;GAMG;AACH,qBAAa,mCAAoC,YAAW,4BAA4B;IAEpF,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFzB,YACmB,EAAE,EAAE,SAAS,EACb,MAAM,EAAE,YAAY,EACnC;YAEU,iBAAiB;YAUjB,WAAW;IAWnB,cAAc,CAClB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,wBAAwB,GAAG,IAAI,CAAC,CAa1C;IAEK,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAY9E;IAEK,MAAM,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwB5D;IAEK,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAW3F;CACF;AAmBD,oFAAoF;AACpF,qBAAa,yBAA0B,YAAW,kBAAkB;IACtD,OAAO,CAAC,QAAQ,CAAC,EAAE;IAA/B,YAA6B,EAAE,EAAE,SAAS,EAAI;IAExC,MAAM,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BlD;IAEK,GAAG,CACP,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,EAC1B,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAchC;IAEK,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAOpE;IAEK,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAajF;IAEK,SAAS,CACb,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,kBAAkB,EAC1B,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,OAAO,CAAC,IAAI,CAAC,CAWf;CACF"}
@@ -0,0 +1,176 @@
1
+ import { and, desc, eq, isNull } from 'drizzle-orm';
2
+ import { documentConnections, documents } from '../db/schema.js';
3
+ // Drizzle/Postgres mirrors of the document-source D1 repositories (migration 0012).
4
+ // A `source` discriminator tags every row, so one pair of tables serves every
5
+ // provider. Behaviourally identical to the D1 repos so the cross-runtime conformance
6
+ // suite asserts the same document behaviour against both stores.
7
+ function parseCredentials(json) {
8
+ try {
9
+ const parsed = JSON.parse(json);
10
+ if (parsed && typeof parsed === 'object')
11
+ return parsed;
12
+ }
13
+ catch {
14
+ // A malformed bag is treated as empty; the import path then fails closed.
15
+ }
16
+ return {};
17
+ }
18
+ /**
19
+ * Workspace → document-source connections over Postgres. Source credentials (a
20
+ * third-party API token) are encrypted at rest with the same AES-256-GCM envelope
21
+ * cipher the environments/Slack integrations use — never stored plaintext. A legacy
22
+ * row whose `credentials` predates encryption (no `v1.` envelope) is read as
23
+ * plaintext JSON, then re-encrypted on the next write.
24
+ */
25
+ export class DrizzleDocumentConnectionRepository {
26
+ db;
27
+ cipher;
28
+ constructor(db, cipher) {
29
+ this.db = db;
30
+ this.cipher = cipher;
31
+ }
32
+ async decodeCredentials(stored) {
33
+ if (!stored.startsWith('v1.'))
34
+ return parseCredentials(stored);
35
+ try {
36
+ return parseCredentials(await this.cipher.decrypt(stored));
37
+ }
38
+ catch {
39
+ // Wrong key / corrupt envelope: fail closed with an empty bag.
40
+ return {};
41
+ }
42
+ }
43
+ async rowToRecord(row) {
44
+ return {
45
+ workspaceId: row.workspace_id,
46
+ source: row.source,
47
+ credentials: await this.decodeCredentials(row.credentials),
48
+ label: row.label,
49
+ createdAt: row.created_at,
50
+ deletedAt: row.deleted_at,
51
+ };
52
+ }
53
+ async getByWorkspace(workspaceId, source) {
54
+ const rows = await this.db
55
+ .select()
56
+ .from(documentConnections)
57
+ .where(and(eq(documentConnections.workspace_id, workspaceId), eq(documentConnections.source, source), isNull(documentConnections.deleted_at)))
58
+ .limit(1);
59
+ return rows[0] ? this.rowToRecord(rows[0]) : null;
60
+ }
61
+ async listByWorkspace(workspaceId) {
62
+ const rows = await this.db
63
+ .select()
64
+ .from(documentConnections)
65
+ .where(and(eq(documentConnections.workspace_id, workspaceId), isNull(documentConnections.deleted_at)))
66
+ .orderBy(desc(documentConnections.created_at));
67
+ return Promise.all(rows.map((row) => this.rowToRecord(row)));
68
+ }
69
+ async upsert(record) {
70
+ const credentials = await this.cipher.encrypt(JSON.stringify(record.credentials));
71
+ // A workspace has a single live connection per source: clear any prior binding
72
+ // (live or tombstoned) before inserting, so reconnecting can't collide on the
73
+ // (workspace_id, source) primary key. Delete + insert run in one transaction so a
74
+ // concurrent reader never sees the connection transiently absent.
75
+ await this.db.transaction(async (tx) => {
76
+ await tx
77
+ .delete(documentConnections)
78
+ .where(and(eq(documentConnections.workspace_id, record.workspaceId), eq(documentConnections.source, record.source)));
79
+ await tx.insert(documentConnections).values({
80
+ workspace_id: record.workspaceId,
81
+ source: record.source,
82
+ credentials,
83
+ label: record.label,
84
+ created_at: record.createdAt,
85
+ deleted_at: null,
86
+ });
87
+ });
88
+ }
89
+ async softDelete(workspaceId, source, at) {
90
+ await this.db
91
+ .update(documentConnections)
92
+ .set({ deleted_at: at })
93
+ .where(and(eq(documentConnections.workspace_id, workspaceId), eq(documentConnections.source, source), isNull(documentConnections.deleted_at)));
94
+ }
95
+ }
96
+ function rowToDocument(row) {
97
+ return {
98
+ workspaceId: row.workspace_id,
99
+ source: row.source,
100
+ externalId: row.external_id,
101
+ title: row.title,
102
+ url: row.url,
103
+ excerpt: row.excerpt,
104
+ body: row.body,
105
+ linkedBlockId: row.linked_block_id,
106
+ syncedAt: row.synced_at,
107
+ deletedAt: row.deleted_at,
108
+ };
109
+ }
110
+ /** Imported document projections over Postgres, across sources (migration 0012). */
111
+ export class DrizzleDocumentRepository {
112
+ db;
113
+ constructor(db) {
114
+ this.db = db;
115
+ }
116
+ async upsert(record) {
117
+ const values = {
118
+ workspace_id: record.workspaceId,
119
+ source: record.source,
120
+ external_id: record.externalId,
121
+ title: record.title,
122
+ url: record.url,
123
+ excerpt: record.excerpt,
124
+ body: record.body,
125
+ linked_block_id: record.linkedBlockId,
126
+ synced_at: record.syncedAt,
127
+ deleted_at: null,
128
+ };
129
+ await this.db
130
+ .insert(documents)
131
+ .values(values)
132
+ .onConflictDoUpdate({
133
+ target: [documents.workspace_id, documents.source, documents.external_id],
134
+ set: {
135
+ title: values.title,
136
+ url: values.url,
137
+ excerpt: values.excerpt,
138
+ body: values.body,
139
+ linked_block_id: values.linked_block_id,
140
+ synced_at: values.synced_at,
141
+ deleted_at: null,
142
+ },
143
+ });
144
+ }
145
+ async get(workspaceId, source, externalId) {
146
+ const rows = await this.db
147
+ .select()
148
+ .from(documents)
149
+ .where(and(eq(documents.workspace_id, workspaceId), eq(documents.source, source), eq(documents.external_id, externalId), isNull(documents.deleted_at)))
150
+ .limit(1);
151
+ return rows[0] ? rowToDocument(rows[0]) : null;
152
+ }
153
+ async listByWorkspace(workspaceId) {
154
+ const rows = await this.db
155
+ .select()
156
+ .from(documents)
157
+ .where(and(eq(documents.workspace_id, workspaceId), isNull(documents.deleted_at)))
158
+ .orderBy(desc(documents.synced_at));
159
+ return rows.map(rowToDocument);
160
+ }
161
+ async listByBlock(workspaceId, blockId) {
162
+ const rows = await this.db
163
+ .select()
164
+ .from(documents)
165
+ .where(and(eq(documents.workspace_id, workspaceId), eq(documents.linked_block_id, blockId), isNull(documents.deleted_at)))
166
+ .orderBy(desc(documents.synced_at));
167
+ return rows.map(rowToDocument);
168
+ }
169
+ async linkBlock(workspaceId, source, externalId, blockId) {
170
+ await this.db
171
+ .update(documents)
172
+ .set({ linked_block_id: blockId })
173
+ .where(and(eq(documents.workspace_id, workspaceId), eq(documents.source, source), eq(documents.external_id, externalId)));
174
+ }
175
+ }
176
+ //# sourceMappingURL=documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/repositories/documents.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAEhE,oFAAoF;AACpF,8EAA8E;AAC9E,qFAAqF;AACrF,iEAAiE;AAEjE,SAAS,gBAAgB,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QAC/B,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAgC,CAAA;IACnF,CAAC;IAAC,MAAM,CAAC;QACP,0EAA0E;IAC5E,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC;AAID;;;;;;GAMG;AACH,MAAM,OAAO,mCAAmC;IAE3B,EAAE;IACF,MAAM;IAFzB,YACmB,EAAa,EACb,MAAoB;kBADpB,EAAE;sBAC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SAAS,CAAC,WAAW,EAAE,UAAU,CAAC,CACtC,CACF,CAAA;IACL,CAAC;CACF"}
@@ -0,0 +1,105 @@
1
+ import type { AccountInvitationRepository, AccountRepository, EmailConnectionRepository, AgentRunRepository, BlockRepository, Clock, ExecutionRepository, MembershipRepository, MergePresetRepository, MergeThresholdPreset, ModelDefaultsRepository, ServiceFragmentDefaultsRepository, LlmCallMetricRepository, PipelineRepository, PipelineScheduleRepository, RepoBlueprintRecord, RepoBlueprintRepository, ConsensusSession, ConsensusSessionRepository, RequirementReview, RequirementReviewRepository, ClarityReview, ClarityReviewRepository, ServiceRepository, WorkspaceMountRepository, TokenUsageRepository, TrackerSettingsRepository, UserRepository, WorkspaceRepository } from '@cat-factory/kernel';
2
+ import type { DrizzleDb } from '../db/client.js';
3
+ /**
4
+ * Requirements reviews over Postgres (the Drizzle mirror of the Worker's
5
+ * `D1RequirementReviewRepository`, migration 0021). The reviewed items live as a JSON
6
+ * array in `items`; the service keeps at most one live review per block (it deletes
7
+ * the block's prior review before inserting a fresh one), so `getByBlock` returns the
8
+ * latest. Behaviourally identical to the D1 repo so the cross-runtime conformance
9
+ * suite asserts the same requirements-rework substitution against both stores.
10
+ */
11
+ export declare class DrizzleRequirementReviewRepository implements RequirementReviewRepository {
12
+ private readonly db;
13
+ constructor(db: DrizzleDb);
14
+ getByBlock(workspaceId: string, blockId: string): Promise<RequirementReview | null>;
15
+ get(workspaceId: string, id: string): Promise<RequirementReview | null>;
16
+ upsert(workspaceId: string, review: RequirementReview): Promise<void>;
17
+ deleteByBlock(workspaceId: string, blockId: string): Promise<void>;
18
+ }
19
+ /**
20
+ * Consensus session transcripts (`consensus_sessions`), the Drizzle/Postgres mirror of
21
+ * {@link D1ConsensusSessionRepository}. One row per (execution, step); the
22
+ * participants/rounds/dissent live as JSON columns, upserted as the process streams.
23
+ */
24
+ export declare class DrizzleConsensusSessionRepository implements ConsensusSessionRepository {
25
+ private readonly db;
26
+ constructor(db: DrizzleDb);
27
+ get(workspaceId: string, id: string): Promise<ConsensusSession | null>;
28
+ getByStep(workspaceId: string, executionId: string, stepIndex: number): Promise<ConsensusSession | null>;
29
+ getByBlock(workspaceId: string, blockId: string): Promise<ConsensusSession | null>;
30
+ upsert(workspaceId: string, session: ConsensusSession): Promise<void>;
31
+ }
32
+ /**
33
+ * Clarity (bug-report triage) reviews over Postgres — the Drizzle mirror of the Worker's
34
+ * `D1ClarityReviewRepository`. Behaviourally identical to the D1 repo so the cross-runtime
35
+ * conformance suite asserts the same clarified-brief substitution against both stores.
36
+ */
37
+ export declare class DrizzleClarityReviewRepository implements ClarityReviewRepository {
38
+ private readonly db;
39
+ constructor(db: DrizzleDb);
40
+ getByBlock(workspaceId: string, blockId: string): Promise<ClarityReview | null>;
41
+ get(workspaceId: string, id: string): Promise<ClarityReview | null>;
42
+ upsert(workspaceId: string, review: ClarityReview): Promise<void>;
43
+ deleteByBlock(workspaceId: string, blockId: string): Promise<void>;
44
+ }
45
+ /**
46
+ * Per-workspace merge threshold presets over Postgres (the Drizzle mirror of the
47
+ * Worker's `D1MergePresetRepository`, migration 0024). Enforces the single-default
48
+ * invariant: promoting a preset to default demotes every other in the workspace
49
+ * before the upsert. The default preset cannot be removed (the service keeps that
50
+ * rule too; the DELETE also guards `is_default = 0`). Behaviourally identical to the
51
+ * D1 repo so the cross-runtime conformance suite asserts the same preset resolution.
52
+ */
53
+ export declare class DrizzleMergePresetRepository implements MergePresetRepository {
54
+ private readonly db;
55
+ constructor(db: DrizzleDb);
56
+ get(workspaceId: string, id: string): Promise<MergeThresholdPreset | null>;
57
+ list(workspaceId: string): Promise<MergeThresholdPreset[]>;
58
+ getDefault(workspaceId: string): Promise<MergeThresholdPreset | null>;
59
+ upsert(workspaceId: string, preset: MergeThresholdPreset): Promise<void>;
60
+ remove(workspaceId: string, id: string): Promise<void>;
61
+ }
62
+ /**
63
+ * Repository blueprints over Postgres (the Drizzle mirror of the Worker's
64
+ * `D1RepoBlueprintRepository`, migration 0011). One row per (workspace, repo):
65
+ * `upsert` replaces the existing blueprint in place, keyed by the unique
66
+ * `(workspace_id, repo_owner, repo_name)` index, so the row is always the single
67
+ * current decomposition. The service → modules tree is persisted whole as JSON.
68
+ */
69
+ export declare class DrizzleRepoBlueprintRepository implements RepoBlueprintRepository {
70
+ private readonly db;
71
+ constructor(db: DrizzleDb);
72
+ upsert(record: RepoBlueprintRecord): Promise<void>;
73
+ get(workspaceId: string, id: string): Promise<RepoBlueprintRecord | null>;
74
+ getByRepo(workspaceId: string, repoOwner: string, repoName: string): Promise<RepoBlueprintRecord | null>;
75
+ listByWorkspace(workspaceId: string): Promise<RepoBlueprintRecord[]>;
76
+ delete(workspaceId: string, id: string): Promise<void>;
77
+ }
78
+ export interface CoreRepositories {
79
+ workspaceRepository: WorkspaceRepository;
80
+ accountRepository: AccountRepository;
81
+ membershipRepository: MembershipRepository;
82
+ userRepository: UserRepository;
83
+ invitationRepository: AccountInvitationRepository;
84
+ emailConnectionRepository: EmailConnectionRepository;
85
+ blockRepository: BlockRepository;
86
+ pipelineRepository: PipelineRepository;
87
+ executionRepository: ExecutionRepository;
88
+ tokenUsageRepository: TokenUsageRepository;
89
+ llmCallMetricRepository: LlmCallMetricRepository;
90
+ agentRunRepository: AgentRunRepository;
91
+ modelDefaultsRepository: ModelDefaultsRepository;
92
+ serviceFragmentDefaultsRepository: ServiceFragmentDefaultsRepository;
93
+ pipelineScheduleRepository: PipelineScheduleRepository;
94
+ trackerSettingsRepository: TrackerSettingsRepository;
95
+ serviceRepository: ServiceRepository;
96
+ workspaceMountRepository: WorkspaceMountRepository;
97
+ requirementReviewRepository: RequirementReviewRepository;
98
+ consensusSessionRepository: ConsensusSessionRepository;
99
+ clarityReviewRepository: ClarityReviewRepository;
100
+ mergePresetRepository: MergePresetRepository;
101
+ repoBlueprintRepository: RepoBlueprintRepository;
102
+ }
103
+ /** Build the Drizzle/Postgres-backed core repositories. */
104
+ export declare function createDrizzleRepositories(db: DrizzleDb, clock: Clock): CoreRepositories;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