@intx/db 0.2.2 → 0.4.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 (207) hide show
  1. package/README.md +13 -2
  2. package/dist/approval-store.d.ts +59 -0
  3. package/dist/approval-store.js +92 -0
  4. package/dist/asset-resolution.d.ts +2 -2
  5. package/dist/backfill-principal-keys.d.ts +9 -0
  6. package/dist/backfill-principal-keys.js +51 -0
  7. package/dist/client.d.ts +37 -2
  8. package/dist/client.js +6 -0
  9. package/dist/config.d.ts +1 -0
  10. package/dist/config.js +2 -0
  11. package/dist/connection.js +12 -8
  12. package/dist/credential-resolution.d.ts +181 -20
  13. package/dist/credential-resolution.js +251 -3
  14. package/dist/grant-store.js +35 -13
  15. package/dist/index.d.ts +20 -5
  16. package/dist/index.js +19 -5
  17. package/dist/model-source-resolution.d.ts +54 -7
  18. package/dist/model-source-resolution.js +177 -22
  19. package/dist/parse-row.d.ts +245 -34
  20. package/dist/parse-row.js +117 -18
  21. package/dist/principal-key-store.d.ts +51 -0
  22. package/dist/principal-key-store.js +82 -0
  23. package/dist/principal-store.d.ts +44 -0
  24. package/dist/principal-store.js +67 -0
  25. package/dist/rekey-credential-secrets.d.ts +13 -0
  26. package/dist/rekey-credential-secrets.js +61 -0
  27. package/dist/schema/approvals.d.ts +245 -0
  28. package/dist/schema/approvals.js +57 -0
  29. package/dist/schema/catalog.d.ts +17 -0
  30. package/dist/schema/catalog.js +7 -1
  31. package/dist/schema/credentials.d.ts +1 -1
  32. package/dist/schema/git-tokens.js +1 -1
  33. package/dist/schema/grants.js +8 -2
  34. package/dist/schema/index.d.ts +10 -4
  35. package/dist/schema/index.js +10 -4
  36. package/dist/schema/messages.d.ts +5 -5
  37. package/dist/schema/messages.js +20 -9
  38. package/dist/schema/offerings.js +8 -2
  39. package/dist/schema/{workflow-deployments.d.ts → principal-keys.d.ts} +29 -32
  40. package/dist/schema/principal-keys.js +28 -0
  41. package/dist/schema/principals.d.ts +2 -2
  42. package/dist/schema/principals.js +7 -5
  43. package/dist/schema/providers.d.ts +17 -0
  44. package/dist/schema/providers.js +5 -0
  45. package/dist/schema/roles.js +6 -2
  46. package/dist/schema/session-assets.d.ts +1 -38
  47. package/dist/schema/session-assets.js +36 -19
  48. package/dist/schema/sessions.js +7 -2
  49. package/dist/schema/sidecar-allocation.d.ts +385 -0
  50. package/dist/schema/sidecar-allocation.js +53 -0
  51. package/dist/schema/sidecar.d.ts +2 -2
  52. package/dist/schema/sidecar.js +3 -1
  53. package/dist/schema/signal-correlations.d.ts +177 -0
  54. package/dist/schema/signal-correlations.js +31 -0
  55. package/dist/schema/tenants.js +13 -3
  56. package/dist/schema/wallets.d.ts +3 -3
  57. package/dist/schema/wallets.js +4 -2
  58. package/dist/schema/{agents.d.ts → workflow-definitions.d.ts} +79 -113
  59. package/dist/schema/workflow-definitions.js +97 -0
  60. package/dist/schema/workflow-probe.d.ts +358 -0
  61. package/dist/schema/workflow-probe.js +51 -0
  62. package/dist/schema/workflow-run-dispatch.d.ts +345 -0
  63. package/dist/schema/workflow-run-dispatch.js +63 -0
  64. package/dist/schema/{agent-assets.d.ts → workflow-run-execution.d.ts} +44 -27
  65. package/dist/schema/workflow-run-execution.js +48 -0
  66. package/dist/schema/workflow-run-launch-spec.d.ts +200 -0
  67. package/dist/schema/workflow-run-launch-spec.js +26 -0
  68. package/dist/schema/{instances.d.ts → workflow-run.d.ts} +61 -66
  69. package/dist/schema/workflow-run.js +110 -0
  70. package/dist/sender-key-resolver.d.ts +91 -0
  71. package/dist/sender-key-resolver.js +184 -0
  72. package/dist/sidecar-allocation-store.d.ts +206 -0
  73. package/dist/sidecar-allocation-store.js +714 -0
  74. package/dist/signal-correlation-store.d.ts +36 -0
  75. package/dist/signal-correlation-store.js +63 -0
  76. package/dist/signer-identity.d.ts +12 -0
  77. package/dist/signer-identity.js +15 -0
  78. package/dist/tenant-hierarchy.d.ts +4 -1
  79. package/dist/tenant-hierarchy.js +37 -5
  80. package/dist/workflow-definition-store.d.ts +55 -0
  81. package/dist/workflow-definition-store.js +93 -0
  82. package/dist/workflow-probe-store.d.ts +47 -0
  83. package/dist/workflow-probe-store.js +124 -0
  84. package/dist/workflow-run-dispatch-store.d.ts +83 -0
  85. package/dist/workflow-run-dispatch-store.js +308 -0
  86. package/dist/workflow-run-launch-spec-store.d.ts +13 -0
  87. package/dist/workflow-run-launch-spec-store.js +30 -0
  88. package/dist/workflow-run-store.d.ts +54 -0
  89. package/dist/workflow-run-store.js +85 -0
  90. package/migrations/0037_credential_use_backfill.sql +39 -0
  91. package/migrations/0038_chilly_blacklash.sql +37 -0
  92. package/migrations/0039_quick_carnage.sql +2 -0
  93. package/migrations/0040_reshape_approval_origin.sql +24 -0
  94. package/migrations/0041_make_approval_timeout_at_nullable.sql +1 -0
  95. package/migrations/0042_youthful_mantis.sql +2 -0
  96. package/migrations/0043_signal_correlation_deployment_fk.sql +1 -0
  97. package/migrations/0044_model_offering_quirks.sql +1 -0
  98. package/migrations/0045_create_workflow_run.sql +13 -0
  99. package/migrations/0046_approval_signal_correlation_run_fk.sql +2 -0
  100. package/migrations/0047_create_workflow_definition.sql +30 -0
  101. package/migrations/0048_workflow_definition_origin_agent_id.sql +2 -0
  102. package/migrations/0049_curly_omega_flight.sql +2 -0
  103. package/migrations/0050_late_crystal.sql +10 -0
  104. package/migrations/0051_funny_madelyne_pryor.sql +1 -0
  105. package/migrations/0052_drop_inference_turn_instance_fk.sql +1 -0
  106. package/migrations/0053_session_mail_session_id_index.sql +1 -0
  107. package/migrations/0054_rekey_instance_grants_to_workflow_run.sql +10 -0
  108. package/migrations/0055_backfill_anchor_workflow_runs.sql +69 -0
  109. package/migrations/0056_repoint_deployment_fks_to_anchor_run.sql +32 -0
  110. package/migrations/0057_drop_workflow_deployment_projection.sql +22 -0
  111. package/migrations/0058_repoint_offering_fk_to_definition.sql +41 -0
  112. package/migrations/0059_repoint_transaction_fk_to_run.sql +10 -0
  113. package/migrations/0060_drop_session_mail_instance_fk.sql +6 -0
  114. package/migrations/0061_drop_session_asset_instance_fk.sql +7 -0
  115. package/migrations/0062_drop_agent_asset_table.sql +11 -0
  116. package/migrations/0063_repoint_agent_role_fk_to_definition.sql +39 -0
  117. package/migrations/0064_repoint_agent_session_fk_to_definition.sql +47 -0
  118. package/migrations/0065_add_workflow_definition_model_requirements.sql +37 -0
  119. package/migrations/0066_rekey_agent_definition_principals_to_workflow.sql +27 -0
  120. package/migrations/0067_add_workflow_definition_kind.sql +10 -0
  121. package/migrations/0068_drop_agent_tables_and_origin_agent_id.sql +31 -0
  122. package/migrations/0069_drop_workflow_definition_kind.sql +10 -0
  123. package/migrations/0070_flashy_proteus.sql +13 -0
  124. package/migrations/0072_add_workflow_definition_credential_bindings.sql +1 -0
  125. package/migrations/0073_grant_target_exactly_one_check.sql +13 -0
  126. package/migrations/0074_add_provider_api_base_url.sql +1 -0
  127. package/migrations/0075_workflow_run_launch_spec.sql +17 -0
  128. package/migrations/0076_sidecar_allocation.sql +40 -0
  129. package/migrations/0077_workflow_run_dispatch.sql +29 -0
  130. package/migrations/0078_workflow_run_dispatch_kind.sql +2 -0
  131. package/migrations/0079_rename_workflow_run_deployment_id_to_anchor_run_id.sql +4 -0
  132. package/migrations/0080_rename_correlation_approval_deployment_id_to_anchor_run_id.sql +9 -0
  133. package/migrations/0081_workflow_definition_content_hash_and_approved_wire_hash.sql +4 -0
  134. package/migrations/0082_blue_black_queen.sql +1 -0
  135. package/migrations/0083_replace_launch_spec_snapshot_with_frozen_bundle.sql +3 -0
  136. package/migrations/0084_delete_orphaned_credential_grants.sql +22 -0
  137. package/migrations/0085_add_approval_run_idx.sql +1 -0
  138. package/migrations/0086_cool_human_cannonball.sql +1 -0
  139. package/migrations/0087_drop_sidecar_placement.sql +3 -0
  140. package/migrations/0088_thick_sprite.sql +32 -0
  141. package/migrations/0089_tense_selene.sql +13 -0
  142. package/migrations/0090_tenant_domain_lower_unique.sql +2 -0
  143. package/migrations/0091_workflow_run_dispatch_sender_address.sql +21 -0
  144. package/migrations/0092_sidecar_destroy_failed.sql +4 -0
  145. package/migrations/0093_sidecar_initialization.sql +2 -0
  146. package/migrations/meta/0037_snapshot.json +3237 -0
  147. package/migrations/meta/0038_snapshot.json +3470 -0
  148. package/migrations/meta/0039_snapshot.json +3470 -0
  149. package/migrations/meta/0040_snapshot.json +3489 -0
  150. package/migrations/meta/0041_snapshot.json +3489 -0
  151. package/migrations/meta/0042_snapshot.json +3489 -0
  152. package/migrations/meta/0043_snapshot.json +3498 -0
  153. package/migrations/meta/0044_snapshot.json +3504 -0
  154. package/migrations/meta/0045_snapshot.json +3589 -0
  155. package/migrations/meta/0046_snapshot.json +3607 -0
  156. package/migrations/meta/0047_snapshot.json +3832 -0
  157. package/migrations/meta/0048_snapshot.json +3853 -0
  158. package/migrations/meta/0049_snapshot.json +3854 -0
  159. package/migrations/meta/0050_snapshot.json +3924 -0
  160. package/migrations/meta/0051_snapshot.json +3940 -0
  161. package/migrations/meta/0052_snapshot.json +3931 -0
  162. package/migrations/meta/0053_snapshot.json +3952 -0
  163. package/migrations/meta/0054_snapshot.json +3952 -0
  164. package/migrations/meta/0055_snapshot.json +3952 -0
  165. package/migrations/meta/0056_snapshot.json +3952 -0
  166. package/migrations/meta/0057_snapshot.json +3839 -0
  167. package/migrations/meta/0058_snapshot.json +3839 -0
  168. package/migrations/meta/0059_snapshot.json +3839 -0
  169. package/migrations/meta/0060_snapshot.json +3830 -0
  170. package/migrations/meta/0061_snapshot.json +3821 -0
  171. package/migrations/meta/0062_snapshot.json +3723 -0
  172. package/migrations/meta/0063_snapshot.json +3723 -0
  173. package/migrations/meta/0064_snapshot.json +3723 -0
  174. package/migrations/meta/0065_snapshot.json +3729 -0
  175. package/migrations/meta/0066_snapshot.json +3729 -0
  176. package/migrations/meta/0067_snapshot.json +3736 -0
  177. package/migrations/meta/0068_snapshot.json +3347 -0
  178. package/migrations/meta/0069_snapshot.json +3340 -0
  179. package/migrations/meta/0070_snapshot.json +3444 -0
  180. package/migrations/meta/0072_snapshot.json +3450 -0
  181. package/migrations/meta/0073_snapshot.json +3455 -0
  182. package/migrations/meta/0074_snapshot.json +3461 -0
  183. package/migrations/meta/0075_snapshot.json +3567 -0
  184. package/migrations/meta/0076_snapshot.json +3851 -0
  185. package/migrations/meta/0077_snapshot.json +4067 -0
  186. package/migrations/meta/0078_snapshot.json +4078 -0
  187. package/migrations/meta/0079_snapshot.json +4078 -0
  188. package/migrations/meta/0080_snapshot.json +4078 -0
  189. package/migrations/meta/0081_snapshot.json +4096 -0
  190. package/migrations/meta/0082_snapshot.json +4102 -0
  191. package/migrations/meta/0083_snapshot.json +4096 -0
  192. package/migrations/meta/0084_snapshot.json +4096 -0
  193. package/migrations/meta/0085_snapshot.json +4111 -0
  194. package/migrations/meta/0086_snapshot.json +4117 -0
  195. package/migrations/meta/0087_snapshot.json +4100 -0
  196. package/migrations/meta/0088_snapshot.json +4286 -0
  197. package/migrations/meta/0089_snapshot.json +4376 -0
  198. package/migrations/meta/0090_snapshot.json +4387 -0
  199. package/migrations/meta/0091_snapshot.json +4397 -0
  200. package/migrations/meta/0092_snapshot.json +4397 -0
  201. package/migrations/meta/0093_snapshot.json +4407 -0
  202. package/migrations/meta/_journal.json +392 -0
  203. package/package.json +7 -3
  204. package/dist/schema/agent-assets.js +0 -15
  205. package/dist/schema/agents.js +0 -57
  206. package/dist/schema/instances.js +0 -39
  207. package/dist/schema/workflow-deployments.js +0 -37
@@ -0,0 +1,358 @@
1
+ import type { WorkflowProbeResultFrame } from "@intx/types/sidecar";
2
+ type WorkflowProbeResult = Omit<WorkflowProbeResultFrame, "type" | "requestId">;
3
+ export type WorkflowProbeStatus = "pending" | "provisioning" | "probing" | "releasing" | "succeeded" | "failed";
4
+ /**
5
+ * A workflow probe and the temporary provisioned capacity executing it.
6
+ *
7
+ * Deployment intent deliberately does not live here. The source and entry are
8
+ * the probe input; the result is the probe output. The provisioner binding is
9
+ * retained only so uncertain or abandoned capacity can be destroyed safely.
10
+ */
11
+ export declare const workflowProbe: import("drizzle-orm/pg-core").PgTableWithColumns<{
12
+ name: "workflow_probe";
13
+ schema: undefined;
14
+ columns: {
15
+ id: import("drizzle-orm/pg-core").PgColumn<{
16
+ name: "id";
17
+ tableName: "workflow_probe";
18
+ dataType: "string";
19
+ columnType: "PgText";
20
+ data: string;
21
+ driverParam: string;
22
+ notNull: true;
23
+ hasDefault: false;
24
+ isPrimaryKey: true;
25
+ isAutoincrement: false;
26
+ hasRuntimeDefault: false;
27
+ enumValues: [string, ...string[]];
28
+ baseColumn: never;
29
+ identity: undefined;
30
+ generated: undefined;
31
+ }, {}, {}>;
32
+ tenantId: import("drizzle-orm/pg-core").PgColumn<{
33
+ name: "tenant_id";
34
+ tableName: "workflow_probe";
35
+ dataType: "string";
36
+ columnType: "PgText";
37
+ data: string;
38
+ driverParam: string;
39
+ notNull: true;
40
+ hasDefault: false;
41
+ isPrimaryKey: false;
42
+ isAutoincrement: false;
43
+ hasRuntimeDefault: false;
44
+ enumValues: [string, ...string[]];
45
+ baseColumn: never;
46
+ identity: undefined;
47
+ generated: undefined;
48
+ }, {}, {}>;
49
+ definitionAssetId: import("drizzle-orm/pg-core").PgColumn<{
50
+ name: "definition_asset_id";
51
+ tableName: "workflow_probe";
52
+ dataType: "string";
53
+ columnType: "PgText";
54
+ data: string;
55
+ driverParam: string;
56
+ notNull: true;
57
+ hasDefault: false;
58
+ isPrimaryKey: false;
59
+ isAutoincrement: false;
60
+ hasRuntimeDefault: false;
61
+ enumValues: [string, ...string[]];
62
+ baseColumn: never;
63
+ identity: undefined;
64
+ generated: undefined;
65
+ }, {}, {}>;
66
+ source: import("drizzle-orm/pg-core").PgColumn<{
67
+ name: "source";
68
+ tableName: "workflow_probe";
69
+ dataType: "json";
70
+ columnType: "PgJsonb";
71
+ data: {
72
+ kind: "registry";
73
+ registry: string;
74
+ } | {
75
+ kind: "asset";
76
+ assetId: string;
77
+ package: {
78
+ format: "tarball";
79
+ } | {
80
+ format: "source";
81
+ commitSha: string;
82
+ packageName?: string;
83
+ };
84
+ };
85
+ driverParam: unknown;
86
+ notNull: true;
87
+ hasDefault: false;
88
+ isPrimaryKey: false;
89
+ isAutoincrement: false;
90
+ hasRuntimeDefault: false;
91
+ enumValues: undefined;
92
+ baseColumn: never;
93
+ identity: undefined;
94
+ generated: undefined;
95
+ }, {}, {
96
+ $type: {
97
+ kind: "registry";
98
+ registry: string;
99
+ } | {
100
+ kind: "asset";
101
+ assetId: string;
102
+ package: {
103
+ format: "tarball";
104
+ } | {
105
+ format: "source";
106
+ commitSha: string;
107
+ packageName?: string;
108
+ };
109
+ };
110
+ }>;
111
+ entry: import("drizzle-orm/pg-core").PgColumn<{
112
+ name: "entry";
113
+ tableName: "workflow_probe";
114
+ dataType: "string";
115
+ columnType: "PgText";
116
+ data: string;
117
+ driverParam: string;
118
+ notNull: true;
119
+ hasDefault: false;
120
+ isPrimaryKey: false;
121
+ isAutoincrement: false;
122
+ hasRuntimeDefault: false;
123
+ enumValues: [string, ...string[]];
124
+ baseColumn: never;
125
+ identity: undefined;
126
+ generated: undefined;
127
+ }, {}, {}>;
128
+ pin: import("drizzle-orm/pg-core").PgColumn<{
129
+ name: "pin";
130
+ tableName: "workflow_probe";
131
+ dataType: "string";
132
+ columnType: "PgText";
133
+ data: string;
134
+ driverParam: string;
135
+ notNull: false;
136
+ hasDefault: false;
137
+ isPrimaryKey: false;
138
+ isAutoincrement: false;
139
+ hasRuntimeDefault: false;
140
+ enumValues: [string, ...string[]];
141
+ baseColumn: never;
142
+ identity: undefined;
143
+ generated: undefined;
144
+ }, {}, {}>;
145
+ status: import("drizzle-orm/pg-core").PgColumn<{
146
+ name: "status";
147
+ tableName: "workflow_probe";
148
+ dataType: "string";
149
+ columnType: "PgText";
150
+ data: WorkflowProbeStatus;
151
+ driverParam: string;
152
+ notNull: true;
153
+ hasDefault: true;
154
+ isPrimaryKey: false;
155
+ isAutoincrement: false;
156
+ hasRuntimeDefault: false;
157
+ enumValues: [string, ...string[]];
158
+ baseColumn: never;
159
+ identity: undefined;
160
+ generated: undefined;
161
+ }, {}, {
162
+ $type: WorkflowProbeStatus;
163
+ }>;
164
+ provisionerId: import("drizzle-orm/pg-core").PgColumn<{
165
+ name: "provisioner_id";
166
+ tableName: "workflow_probe";
167
+ dataType: "string";
168
+ columnType: "PgText";
169
+ data: string;
170
+ driverParam: string;
171
+ notNull: true;
172
+ hasDefault: false;
173
+ isPrimaryKey: false;
174
+ isAutoincrement: false;
175
+ hasRuntimeDefault: false;
176
+ enumValues: [string, ...string[]];
177
+ baseColumn: never;
178
+ identity: undefined;
179
+ generated: undefined;
180
+ }, {}, {}>;
181
+ provisionerApiVersion: import("drizzle-orm/pg-core").PgColumn<{
182
+ name: "provisioner_api_version";
183
+ tableName: "workflow_probe";
184
+ dataType: "number";
185
+ columnType: "PgInteger";
186
+ data: 1;
187
+ driverParam: string | number;
188
+ notNull: true;
189
+ hasDefault: false;
190
+ isPrimaryKey: false;
191
+ isAutoincrement: false;
192
+ hasRuntimeDefault: false;
193
+ enumValues: undefined;
194
+ baseColumn: never;
195
+ identity: undefined;
196
+ generated: undefined;
197
+ }, {}, {
198
+ $type: 1;
199
+ }>;
200
+ provisionerBindingFingerprint: import("drizzle-orm/pg-core").PgColumn<{
201
+ name: "provisioner_binding_fingerprint";
202
+ tableName: "workflow_probe";
203
+ dataType: "string";
204
+ columnType: "PgText";
205
+ data: string;
206
+ driverParam: string;
207
+ notNull: true;
208
+ hasDefault: false;
209
+ isPrimaryKey: false;
210
+ isAutoincrement: false;
211
+ hasRuntimeDefault: false;
212
+ enumValues: [string, ...string[]];
213
+ baseColumn: never;
214
+ identity: undefined;
215
+ generated: undefined;
216
+ }, {}, {}>;
217
+ sidecarId: import("drizzle-orm/pg-core").PgColumn<{
218
+ name: "sidecar_id";
219
+ tableName: "workflow_probe";
220
+ dataType: "string";
221
+ columnType: "PgText";
222
+ data: string;
223
+ driverParam: string;
224
+ notNull: false;
225
+ hasDefault: false;
226
+ isPrimaryKey: false;
227
+ isAutoincrement: false;
228
+ hasRuntimeDefault: false;
229
+ enumValues: [string, ...string[]];
230
+ baseColumn: never;
231
+ identity: undefined;
232
+ generated: undefined;
233
+ }, {}, {}>;
234
+ generation: import("drizzle-orm/pg-core").PgColumn<{
235
+ name: "generation";
236
+ tableName: "workflow_probe";
237
+ dataType: "number";
238
+ columnType: "PgInteger";
239
+ data: number;
240
+ driverParam: string | number;
241
+ notNull: true;
242
+ hasDefault: true;
243
+ isPrimaryKey: false;
244
+ isAutoincrement: false;
245
+ hasRuntimeDefault: false;
246
+ enumValues: undefined;
247
+ baseColumn: never;
248
+ identity: undefined;
249
+ generated: undefined;
250
+ }, {}, {}>;
251
+ externalRef: import("drizzle-orm/pg-core").PgColumn<{
252
+ name: "external_ref";
253
+ tableName: "workflow_probe";
254
+ dataType: "string";
255
+ columnType: "PgText";
256
+ data: string;
257
+ driverParam: string;
258
+ notNull: false;
259
+ hasDefault: false;
260
+ isPrimaryKey: false;
261
+ isAutoincrement: false;
262
+ hasRuntimeDefault: false;
263
+ enumValues: [string, ...string[]];
264
+ baseColumn: never;
265
+ identity: undefined;
266
+ generated: undefined;
267
+ }, {}, {}>;
268
+ result: import("drizzle-orm/pg-core").PgColumn<{
269
+ name: "result";
270
+ tableName: "workflow_probe";
271
+ dataType: "json";
272
+ columnType: "PgJsonb";
273
+ data: WorkflowProbeResult;
274
+ driverParam: unknown;
275
+ notNull: false;
276
+ hasDefault: false;
277
+ isPrimaryKey: false;
278
+ isAutoincrement: false;
279
+ hasRuntimeDefault: false;
280
+ enumValues: undefined;
281
+ baseColumn: never;
282
+ identity: undefined;
283
+ generated: undefined;
284
+ }, {}, {
285
+ $type: WorkflowProbeResult;
286
+ }>;
287
+ failureCode: import("drizzle-orm/pg-core").PgColumn<{
288
+ name: "failure_code";
289
+ tableName: "workflow_probe";
290
+ dataType: "string";
291
+ columnType: "PgText";
292
+ data: string;
293
+ driverParam: string;
294
+ notNull: false;
295
+ hasDefault: false;
296
+ isPrimaryKey: false;
297
+ isAutoincrement: false;
298
+ hasRuntimeDefault: false;
299
+ enumValues: [string, ...string[]];
300
+ baseColumn: never;
301
+ identity: undefined;
302
+ generated: undefined;
303
+ }, {}, {}>;
304
+ failureMessage: import("drizzle-orm/pg-core").PgColumn<{
305
+ name: "failure_message";
306
+ tableName: "workflow_probe";
307
+ dataType: "string";
308
+ columnType: "PgText";
309
+ data: string;
310
+ driverParam: string;
311
+ notNull: false;
312
+ hasDefault: false;
313
+ isPrimaryKey: false;
314
+ isAutoincrement: false;
315
+ hasRuntimeDefault: false;
316
+ enumValues: [string, ...string[]];
317
+ baseColumn: never;
318
+ identity: undefined;
319
+ generated: undefined;
320
+ }, {}, {}>;
321
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
322
+ name: "created_at";
323
+ tableName: "workflow_probe";
324
+ dataType: "date";
325
+ columnType: "PgTimestamp";
326
+ data: Date;
327
+ driverParam: string;
328
+ notNull: true;
329
+ hasDefault: true;
330
+ isPrimaryKey: false;
331
+ isAutoincrement: false;
332
+ hasRuntimeDefault: false;
333
+ enumValues: undefined;
334
+ baseColumn: never;
335
+ identity: undefined;
336
+ generated: undefined;
337
+ }, {}, {}>;
338
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
339
+ name: "updated_at";
340
+ tableName: "workflow_probe";
341
+ dataType: "date";
342
+ columnType: "PgTimestamp";
343
+ data: Date;
344
+ driverParam: string;
345
+ notNull: true;
346
+ hasDefault: true;
347
+ isPrimaryKey: false;
348
+ isAutoincrement: false;
349
+ hasRuntimeDefault: false;
350
+ enumValues: undefined;
351
+ baseColumn: never;
352
+ identity: undefined;
353
+ generated: undefined;
354
+ }, {}, {}>;
355
+ };
356
+ dialect: "pg";
357
+ }>;
358
+ export {};
@@ -0,0 +1,51 @@
1
+ import { sql } from "drizzle-orm";
2
+ import { check, index, integer, jsonb, pgTable, text, timestamp, } from "drizzle-orm/pg-core";
3
+ import { asset } from "./assets.js";
4
+ import { sidecar } from "./sidecar.js";
5
+ import { tenant } from "./tenants.js";
6
+ /**
7
+ * A workflow probe and the temporary provisioned capacity executing it.
8
+ *
9
+ * Deployment intent deliberately does not live here. The source and entry are
10
+ * the probe input; the result is the probe output. The provisioner binding is
11
+ * retained only so uncertain or abandoned capacity can be destroyed safely.
12
+ */
13
+ export const workflowProbe = pgTable("workflow_probe", {
14
+ id: text("id").primaryKey(),
15
+ tenantId: text("tenant_id")
16
+ .notNull()
17
+ .references(() => tenant.id, { onDelete: "restrict" }),
18
+ definitionAssetId: text("definition_asset_id")
19
+ .notNull()
20
+ .references(() => asset.id, { onDelete: "restrict" }),
21
+ source: jsonb("source").$type().notNull(),
22
+ entry: text("entry").notNull(),
23
+ pin: text("pin"),
24
+ status: text("status")
25
+ .$type()
26
+ .notNull()
27
+ .default("pending"),
28
+ provisionerId: text("provisioner_id").notNull(),
29
+ provisionerApiVersion: integer("provisioner_api_version")
30
+ .$type()
31
+ .notNull(),
32
+ provisionerBindingFingerprint: text("provisioner_binding_fingerprint").notNull(),
33
+ sidecarId: text("sidecar_id").references(() => sidecar.id, {
34
+ onDelete: "restrict",
35
+ }),
36
+ generation: integer("generation").notNull().default(0),
37
+ externalRef: text("external_ref"),
38
+ result: jsonb("result").$type(),
39
+ failureCode: text("failure_code"),
40
+ failureMessage: text("failure_message"),
41
+ createdAt: timestamp("created_at").notNull().defaultNow(),
42
+ updatedAt: timestamp("updated_at").notNull().defaultNow(),
43
+ }, (t) => [
44
+ index("workflow_probe_active_idx")
45
+ .on(t.createdAt)
46
+ .where(sql `${t.status} in ('pending', 'provisioning', 'probing', 'releasing')`),
47
+ index("workflow_probe_sidecar_idx").on(t.sidecarId),
48
+ check("workflow_probe_status_check", sql `${t.status} in ('pending', 'provisioning', 'probing', 'releasing', 'succeeded', 'failed')`),
49
+ check("workflow_probe_succeeded_result_check", sql `${t.status} <> 'succeeded' or ${t.result} is not null`),
50
+ check("workflow_probe_generation_check", sql `${t.generation} >= 0`),
51
+ ]);