@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.
- package/README.md +13 -2
- package/dist/approval-store.d.ts +59 -0
- package/dist/approval-store.js +92 -0
- package/dist/asset-resolution.d.ts +2 -2
- package/dist/backfill-principal-keys.d.ts +9 -0
- package/dist/backfill-principal-keys.js +51 -0
- package/dist/client.d.ts +37 -2
- package/dist/client.js +6 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +2 -0
- package/dist/connection.js +12 -8
- package/dist/credential-resolution.d.ts +181 -20
- package/dist/credential-resolution.js +251 -3
- package/dist/grant-store.js +35 -13
- package/dist/index.d.ts +20 -5
- package/dist/index.js +19 -5
- package/dist/model-source-resolution.d.ts +54 -7
- package/dist/model-source-resolution.js +177 -22
- package/dist/parse-row.d.ts +245 -34
- package/dist/parse-row.js +117 -18
- package/dist/principal-key-store.d.ts +51 -0
- package/dist/principal-key-store.js +82 -0
- package/dist/principal-store.d.ts +44 -0
- package/dist/principal-store.js +67 -0
- package/dist/rekey-credential-secrets.d.ts +13 -0
- package/dist/rekey-credential-secrets.js +61 -0
- package/dist/schema/approvals.d.ts +245 -0
- package/dist/schema/approvals.js +57 -0
- package/dist/schema/catalog.d.ts +17 -0
- package/dist/schema/catalog.js +7 -1
- package/dist/schema/credentials.d.ts +1 -1
- package/dist/schema/git-tokens.js +1 -1
- package/dist/schema/grants.js +8 -2
- package/dist/schema/index.d.ts +10 -4
- package/dist/schema/index.js +10 -4
- package/dist/schema/messages.d.ts +5 -5
- package/dist/schema/messages.js +20 -9
- package/dist/schema/offerings.js +8 -2
- package/dist/schema/{workflow-deployments.d.ts → principal-keys.d.ts} +29 -32
- package/dist/schema/principal-keys.js +28 -0
- package/dist/schema/principals.d.ts +2 -2
- package/dist/schema/principals.js +7 -5
- package/dist/schema/providers.d.ts +17 -0
- package/dist/schema/providers.js +5 -0
- package/dist/schema/roles.js +6 -2
- package/dist/schema/session-assets.d.ts +1 -38
- package/dist/schema/session-assets.js +36 -19
- package/dist/schema/sessions.js +7 -2
- package/dist/schema/sidecar-allocation.d.ts +385 -0
- package/dist/schema/sidecar-allocation.js +53 -0
- package/dist/schema/sidecar.d.ts +2 -2
- package/dist/schema/sidecar.js +3 -1
- package/dist/schema/signal-correlations.d.ts +177 -0
- package/dist/schema/signal-correlations.js +31 -0
- package/dist/schema/tenants.js +13 -3
- package/dist/schema/wallets.d.ts +3 -3
- package/dist/schema/wallets.js +4 -2
- package/dist/schema/{agents.d.ts → workflow-definitions.d.ts} +79 -113
- package/dist/schema/workflow-definitions.js +97 -0
- package/dist/schema/workflow-probe.d.ts +358 -0
- package/dist/schema/workflow-probe.js +51 -0
- package/dist/schema/workflow-run-dispatch.d.ts +345 -0
- package/dist/schema/workflow-run-dispatch.js +63 -0
- package/dist/schema/{agent-assets.d.ts → workflow-run-execution.d.ts} +44 -27
- package/dist/schema/workflow-run-execution.js +48 -0
- package/dist/schema/workflow-run-launch-spec.d.ts +200 -0
- package/dist/schema/workflow-run-launch-spec.js +26 -0
- package/dist/schema/{instances.d.ts → workflow-run.d.ts} +61 -66
- package/dist/schema/workflow-run.js +110 -0
- package/dist/sender-key-resolver.d.ts +91 -0
- package/dist/sender-key-resolver.js +184 -0
- package/dist/sidecar-allocation-store.d.ts +206 -0
- package/dist/sidecar-allocation-store.js +714 -0
- package/dist/signal-correlation-store.d.ts +36 -0
- package/dist/signal-correlation-store.js +63 -0
- package/dist/signer-identity.d.ts +12 -0
- package/dist/signer-identity.js +15 -0
- package/dist/tenant-hierarchy.d.ts +4 -1
- package/dist/tenant-hierarchy.js +37 -5
- package/dist/workflow-definition-store.d.ts +55 -0
- package/dist/workflow-definition-store.js +93 -0
- package/dist/workflow-probe-store.d.ts +47 -0
- package/dist/workflow-probe-store.js +124 -0
- package/dist/workflow-run-dispatch-store.d.ts +83 -0
- package/dist/workflow-run-dispatch-store.js +308 -0
- package/dist/workflow-run-launch-spec-store.d.ts +13 -0
- package/dist/workflow-run-launch-spec-store.js +30 -0
- package/dist/workflow-run-store.d.ts +54 -0
- package/dist/workflow-run-store.js +85 -0
- package/migrations/0037_credential_use_backfill.sql +39 -0
- package/migrations/0038_chilly_blacklash.sql +37 -0
- package/migrations/0039_quick_carnage.sql +2 -0
- package/migrations/0040_reshape_approval_origin.sql +24 -0
- package/migrations/0041_make_approval_timeout_at_nullable.sql +1 -0
- package/migrations/0042_youthful_mantis.sql +2 -0
- package/migrations/0043_signal_correlation_deployment_fk.sql +1 -0
- package/migrations/0044_model_offering_quirks.sql +1 -0
- package/migrations/0045_create_workflow_run.sql +13 -0
- package/migrations/0046_approval_signal_correlation_run_fk.sql +2 -0
- package/migrations/0047_create_workflow_definition.sql +30 -0
- package/migrations/0048_workflow_definition_origin_agent_id.sql +2 -0
- package/migrations/0049_curly_omega_flight.sql +2 -0
- package/migrations/0050_late_crystal.sql +10 -0
- package/migrations/0051_funny_madelyne_pryor.sql +1 -0
- package/migrations/0052_drop_inference_turn_instance_fk.sql +1 -0
- package/migrations/0053_session_mail_session_id_index.sql +1 -0
- package/migrations/0054_rekey_instance_grants_to_workflow_run.sql +10 -0
- package/migrations/0055_backfill_anchor_workflow_runs.sql +69 -0
- package/migrations/0056_repoint_deployment_fks_to_anchor_run.sql +32 -0
- package/migrations/0057_drop_workflow_deployment_projection.sql +22 -0
- package/migrations/0058_repoint_offering_fk_to_definition.sql +41 -0
- package/migrations/0059_repoint_transaction_fk_to_run.sql +10 -0
- package/migrations/0060_drop_session_mail_instance_fk.sql +6 -0
- package/migrations/0061_drop_session_asset_instance_fk.sql +7 -0
- package/migrations/0062_drop_agent_asset_table.sql +11 -0
- package/migrations/0063_repoint_agent_role_fk_to_definition.sql +39 -0
- package/migrations/0064_repoint_agent_session_fk_to_definition.sql +47 -0
- package/migrations/0065_add_workflow_definition_model_requirements.sql +37 -0
- package/migrations/0066_rekey_agent_definition_principals_to_workflow.sql +27 -0
- package/migrations/0067_add_workflow_definition_kind.sql +10 -0
- package/migrations/0068_drop_agent_tables_and_origin_agent_id.sql +31 -0
- package/migrations/0069_drop_workflow_definition_kind.sql +10 -0
- package/migrations/0070_flashy_proteus.sql +13 -0
- package/migrations/0072_add_workflow_definition_credential_bindings.sql +1 -0
- package/migrations/0073_grant_target_exactly_one_check.sql +13 -0
- package/migrations/0074_add_provider_api_base_url.sql +1 -0
- package/migrations/0075_workflow_run_launch_spec.sql +17 -0
- package/migrations/0076_sidecar_allocation.sql +40 -0
- package/migrations/0077_workflow_run_dispatch.sql +29 -0
- package/migrations/0078_workflow_run_dispatch_kind.sql +2 -0
- package/migrations/0079_rename_workflow_run_deployment_id_to_anchor_run_id.sql +4 -0
- package/migrations/0080_rename_correlation_approval_deployment_id_to_anchor_run_id.sql +9 -0
- package/migrations/0081_workflow_definition_content_hash_and_approved_wire_hash.sql +4 -0
- package/migrations/0082_blue_black_queen.sql +1 -0
- package/migrations/0083_replace_launch_spec_snapshot_with_frozen_bundle.sql +3 -0
- package/migrations/0084_delete_orphaned_credential_grants.sql +22 -0
- package/migrations/0085_add_approval_run_idx.sql +1 -0
- package/migrations/0086_cool_human_cannonball.sql +1 -0
- package/migrations/0087_drop_sidecar_placement.sql +3 -0
- package/migrations/0088_thick_sprite.sql +32 -0
- package/migrations/0089_tense_selene.sql +13 -0
- package/migrations/0090_tenant_domain_lower_unique.sql +2 -0
- package/migrations/0091_workflow_run_dispatch_sender_address.sql +21 -0
- package/migrations/0092_sidecar_destroy_failed.sql +4 -0
- package/migrations/0093_sidecar_initialization.sql +2 -0
- package/migrations/meta/0037_snapshot.json +3237 -0
- package/migrations/meta/0038_snapshot.json +3470 -0
- package/migrations/meta/0039_snapshot.json +3470 -0
- package/migrations/meta/0040_snapshot.json +3489 -0
- package/migrations/meta/0041_snapshot.json +3489 -0
- package/migrations/meta/0042_snapshot.json +3489 -0
- package/migrations/meta/0043_snapshot.json +3498 -0
- package/migrations/meta/0044_snapshot.json +3504 -0
- package/migrations/meta/0045_snapshot.json +3589 -0
- package/migrations/meta/0046_snapshot.json +3607 -0
- package/migrations/meta/0047_snapshot.json +3832 -0
- package/migrations/meta/0048_snapshot.json +3853 -0
- package/migrations/meta/0049_snapshot.json +3854 -0
- package/migrations/meta/0050_snapshot.json +3924 -0
- package/migrations/meta/0051_snapshot.json +3940 -0
- package/migrations/meta/0052_snapshot.json +3931 -0
- package/migrations/meta/0053_snapshot.json +3952 -0
- package/migrations/meta/0054_snapshot.json +3952 -0
- package/migrations/meta/0055_snapshot.json +3952 -0
- package/migrations/meta/0056_snapshot.json +3952 -0
- package/migrations/meta/0057_snapshot.json +3839 -0
- package/migrations/meta/0058_snapshot.json +3839 -0
- package/migrations/meta/0059_snapshot.json +3839 -0
- package/migrations/meta/0060_snapshot.json +3830 -0
- package/migrations/meta/0061_snapshot.json +3821 -0
- package/migrations/meta/0062_snapshot.json +3723 -0
- package/migrations/meta/0063_snapshot.json +3723 -0
- package/migrations/meta/0064_snapshot.json +3723 -0
- package/migrations/meta/0065_snapshot.json +3729 -0
- package/migrations/meta/0066_snapshot.json +3729 -0
- package/migrations/meta/0067_snapshot.json +3736 -0
- package/migrations/meta/0068_snapshot.json +3347 -0
- package/migrations/meta/0069_snapshot.json +3340 -0
- package/migrations/meta/0070_snapshot.json +3444 -0
- package/migrations/meta/0072_snapshot.json +3450 -0
- package/migrations/meta/0073_snapshot.json +3455 -0
- package/migrations/meta/0074_snapshot.json +3461 -0
- package/migrations/meta/0075_snapshot.json +3567 -0
- package/migrations/meta/0076_snapshot.json +3851 -0
- package/migrations/meta/0077_snapshot.json +4067 -0
- package/migrations/meta/0078_snapshot.json +4078 -0
- package/migrations/meta/0079_snapshot.json +4078 -0
- package/migrations/meta/0080_snapshot.json +4078 -0
- package/migrations/meta/0081_snapshot.json +4096 -0
- package/migrations/meta/0082_snapshot.json +4102 -0
- package/migrations/meta/0083_snapshot.json +4096 -0
- package/migrations/meta/0084_snapshot.json +4096 -0
- package/migrations/meta/0085_snapshot.json +4111 -0
- package/migrations/meta/0086_snapshot.json +4117 -0
- package/migrations/meta/0087_snapshot.json +4100 -0
- package/migrations/meta/0088_snapshot.json +4286 -0
- package/migrations/meta/0089_snapshot.json +4376 -0
- package/migrations/meta/0090_snapshot.json +4387 -0
- package/migrations/meta/0091_snapshot.json +4397 -0
- package/migrations/meta/0092_snapshot.json +4397 -0
- package/migrations/meta/0093_snapshot.json +4407 -0
- package/migrations/meta/_journal.json +392 -0
- package/package.json +7 -3
- package/dist/schema/agent-assets.js +0 -15
- package/dist/schema/agents.js +0 -57
- package/dist/schema/instances.js +0 -39
- package/dist/schema/workflow-deployments.js +0 -37
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
export declare const workflowRunDispatchStatuses: readonly ["pending", "acknowledged", "settled", "failed"];
|
|
2
|
+
export type WorkflowRunDispatchStatus = (typeof workflowRunDispatchStatuses)[number];
|
|
3
|
+
export declare const workflowRunDispatchKinds: readonly ["mail", "signal"];
|
|
4
|
+
export type WorkflowRunDispatchKind = (typeof workflowRunDispatchKinds)[number];
|
|
5
|
+
/**
|
|
6
|
+
* Hub-owned delivery state for one inbound workflow message. The raw payload
|
|
7
|
+
* remains durable until the workflow-run Git claim-check reaches `consumed`;
|
|
8
|
+
* a sidecar-local enqueue acknowledgement alone does not settle the row.
|
|
9
|
+
*/
|
|
10
|
+
export declare const workflowRunDispatch: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
11
|
+
name: "workflow_run_dispatch";
|
|
12
|
+
schema: undefined;
|
|
13
|
+
columns: {
|
|
14
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
15
|
+
name: "id";
|
|
16
|
+
tableName: "workflow_run_dispatch";
|
|
17
|
+
dataType: "string";
|
|
18
|
+
columnType: "PgText";
|
|
19
|
+
data: string;
|
|
20
|
+
driverParam: string;
|
|
21
|
+
notNull: true;
|
|
22
|
+
hasDefault: false;
|
|
23
|
+
isPrimaryKey: true;
|
|
24
|
+
isAutoincrement: false;
|
|
25
|
+
hasRuntimeDefault: false;
|
|
26
|
+
enumValues: [string, ...string[]];
|
|
27
|
+
baseColumn: never;
|
|
28
|
+
identity: undefined;
|
|
29
|
+
generated: undefined;
|
|
30
|
+
}, {}, {}>;
|
|
31
|
+
anchorRunId: import("drizzle-orm/pg-core").PgColumn<{
|
|
32
|
+
name: "anchor_run_id";
|
|
33
|
+
tableName: "workflow_run_dispatch";
|
|
34
|
+
dataType: "string";
|
|
35
|
+
columnType: "PgText";
|
|
36
|
+
data: string;
|
|
37
|
+
driverParam: string;
|
|
38
|
+
notNull: true;
|
|
39
|
+
hasDefault: false;
|
|
40
|
+
isPrimaryKey: false;
|
|
41
|
+
isAutoincrement: false;
|
|
42
|
+
hasRuntimeDefault: false;
|
|
43
|
+
enumValues: [string, ...string[]];
|
|
44
|
+
baseColumn: never;
|
|
45
|
+
identity: undefined;
|
|
46
|
+
generated: undefined;
|
|
47
|
+
}, {}, {}>;
|
|
48
|
+
messageId: import("drizzle-orm/pg-core").PgColumn<{
|
|
49
|
+
name: "message_id";
|
|
50
|
+
tableName: "workflow_run_dispatch";
|
|
51
|
+
dataType: "string";
|
|
52
|
+
columnType: "PgText";
|
|
53
|
+
data: string;
|
|
54
|
+
driverParam: string;
|
|
55
|
+
notNull: true;
|
|
56
|
+
hasDefault: false;
|
|
57
|
+
isPrimaryKey: false;
|
|
58
|
+
isAutoincrement: false;
|
|
59
|
+
hasRuntimeDefault: false;
|
|
60
|
+
enumValues: [string, ...string[]];
|
|
61
|
+
baseColumn: never;
|
|
62
|
+
identity: undefined;
|
|
63
|
+
generated: undefined;
|
|
64
|
+
}, {}, {}>;
|
|
65
|
+
kind: import("drizzle-orm/pg-core").PgColumn<{
|
|
66
|
+
name: "kind";
|
|
67
|
+
tableName: "workflow_run_dispatch";
|
|
68
|
+
dataType: "string";
|
|
69
|
+
columnType: "PgText";
|
|
70
|
+
data: "signal" | "mail";
|
|
71
|
+
driverParam: string;
|
|
72
|
+
notNull: true;
|
|
73
|
+
hasDefault: true;
|
|
74
|
+
isPrimaryKey: false;
|
|
75
|
+
isAutoincrement: false;
|
|
76
|
+
hasRuntimeDefault: false;
|
|
77
|
+
enumValues: [string, ...string[]];
|
|
78
|
+
baseColumn: never;
|
|
79
|
+
identity: undefined;
|
|
80
|
+
generated: undefined;
|
|
81
|
+
}, {}, {
|
|
82
|
+
$type: "signal" | "mail";
|
|
83
|
+
}>;
|
|
84
|
+
senderAddress: import("drizzle-orm/pg-core").PgColumn<{
|
|
85
|
+
name: "sender_address";
|
|
86
|
+
tableName: "workflow_run_dispatch";
|
|
87
|
+
dataType: "string";
|
|
88
|
+
columnType: "PgText";
|
|
89
|
+
data: string;
|
|
90
|
+
driverParam: string;
|
|
91
|
+
notNull: false;
|
|
92
|
+
hasDefault: false;
|
|
93
|
+
isPrimaryKey: false;
|
|
94
|
+
isAutoincrement: false;
|
|
95
|
+
hasRuntimeDefault: false;
|
|
96
|
+
enumValues: [string, ...string[]];
|
|
97
|
+
baseColumn: never;
|
|
98
|
+
identity: undefined;
|
|
99
|
+
generated: undefined;
|
|
100
|
+
}, {}, {}>;
|
|
101
|
+
rawMessage: import("drizzle-orm/pg-core").PgColumn<{
|
|
102
|
+
name: "raw_message";
|
|
103
|
+
tableName: "workflow_run_dispatch";
|
|
104
|
+
dataType: "custom";
|
|
105
|
+
columnType: "PgCustomColumn";
|
|
106
|
+
data: Uint8Array<ArrayBufferLike>;
|
|
107
|
+
driverParam: Uint8Array<ArrayBufferLike>;
|
|
108
|
+
notNull: true;
|
|
109
|
+
hasDefault: false;
|
|
110
|
+
isPrimaryKey: false;
|
|
111
|
+
isAutoincrement: false;
|
|
112
|
+
hasRuntimeDefault: false;
|
|
113
|
+
enumValues: undefined;
|
|
114
|
+
baseColumn: never;
|
|
115
|
+
identity: undefined;
|
|
116
|
+
generated: undefined;
|
|
117
|
+
}, {}, {
|
|
118
|
+
pgColumnBuilderBrand: "PgCustomColumnBuilderBrand";
|
|
119
|
+
}>;
|
|
120
|
+
stepGrants: import("drizzle-orm/pg-core").PgColumn<{
|
|
121
|
+
name: "step_grants";
|
|
122
|
+
tableName: "workflow_run_dispatch";
|
|
123
|
+
dataType: "json";
|
|
124
|
+
columnType: "PgJsonb";
|
|
125
|
+
data: unknown;
|
|
126
|
+
driverParam: unknown;
|
|
127
|
+
notNull: true;
|
|
128
|
+
hasDefault: false;
|
|
129
|
+
isPrimaryKey: false;
|
|
130
|
+
isAutoincrement: false;
|
|
131
|
+
hasRuntimeDefault: false;
|
|
132
|
+
enumValues: undefined;
|
|
133
|
+
baseColumn: never;
|
|
134
|
+
identity: undefined;
|
|
135
|
+
generated: undefined;
|
|
136
|
+
}, {}, {}>;
|
|
137
|
+
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
138
|
+
name: "status";
|
|
139
|
+
tableName: "workflow_run_dispatch";
|
|
140
|
+
dataType: "string";
|
|
141
|
+
columnType: "PgText";
|
|
142
|
+
data: "failed" | "pending" | "acknowledged" | "settled";
|
|
143
|
+
driverParam: string;
|
|
144
|
+
notNull: true;
|
|
145
|
+
hasDefault: true;
|
|
146
|
+
isPrimaryKey: false;
|
|
147
|
+
isAutoincrement: false;
|
|
148
|
+
hasRuntimeDefault: false;
|
|
149
|
+
enumValues: [string, ...string[]];
|
|
150
|
+
baseColumn: never;
|
|
151
|
+
identity: undefined;
|
|
152
|
+
generated: undefined;
|
|
153
|
+
}, {}, {
|
|
154
|
+
$type: "failed" | "pending" | "acknowledged" | "settled";
|
|
155
|
+
}>;
|
|
156
|
+
acknowledgedGeneration: import("drizzle-orm/pg-core").PgColumn<{
|
|
157
|
+
name: "acknowledged_generation";
|
|
158
|
+
tableName: "workflow_run_dispatch";
|
|
159
|
+
dataType: "number";
|
|
160
|
+
columnType: "PgInteger";
|
|
161
|
+
data: number;
|
|
162
|
+
driverParam: string | number;
|
|
163
|
+
notNull: false;
|
|
164
|
+
hasDefault: false;
|
|
165
|
+
isPrimaryKey: false;
|
|
166
|
+
isAutoincrement: false;
|
|
167
|
+
hasRuntimeDefault: false;
|
|
168
|
+
enumValues: undefined;
|
|
169
|
+
baseColumn: never;
|
|
170
|
+
identity: undefined;
|
|
171
|
+
generated: undefined;
|
|
172
|
+
}, {}, {}>;
|
|
173
|
+
attemptCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
174
|
+
name: "attempt_count";
|
|
175
|
+
tableName: "workflow_run_dispatch";
|
|
176
|
+
dataType: "number";
|
|
177
|
+
columnType: "PgInteger";
|
|
178
|
+
data: number;
|
|
179
|
+
driverParam: string | number;
|
|
180
|
+
notNull: true;
|
|
181
|
+
hasDefault: true;
|
|
182
|
+
isPrimaryKey: false;
|
|
183
|
+
isAutoincrement: false;
|
|
184
|
+
hasRuntimeDefault: false;
|
|
185
|
+
enumValues: undefined;
|
|
186
|
+
baseColumn: never;
|
|
187
|
+
identity: undefined;
|
|
188
|
+
generated: undefined;
|
|
189
|
+
}, {}, {}>;
|
|
190
|
+
nextAttemptAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
191
|
+
name: "next_attempt_at";
|
|
192
|
+
tableName: "workflow_run_dispatch";
|
|
193
|
+
dataType: "date";
|
|
194
|
+
columnType: "PgTimestamp";
|
|
195
|
+
data: Date;
|
|
196
|
+
driverParam: string;
|
|
197
|
+
notNull: false;
|
|
198
|
+
hasDefault: true;
|
|
199
|
+
isPrimaryKey: false;
|
|
200
|
+
isAutoincrement: false;
|
|
201
|
+
hasRuntimeDefault: false;
|
|
202
|
+
enumValues: undefined;
|
|
203
|
+
baseColumn: never;
|
|
204
|
+
identity: undefined;
|
|
205
|
+
generated: undefined;
|
|
206
|
+
}, {}, {}>;
|
|
207
|
+
deliveryLeaseId: import("drizzle-orm/pg-core").PgColumn<{
|
|
208
|
+
name: "delivery_lease_id";
|
|
209
|
+
tableName: "workflow_run_dispatch";
|
|
210
|
+
dataType: "string";
|
|
211
|
+
columnType: "PgText";
|
|
212
|
+
data: string;
|
|
213
|
+
driverParam: string;
|
|
214
|
+
notNull: false;
|
|
215
|
+
hasDefault: false;
|
|
216
|
+
isPrimaryKey: false;
|
|
217
|
+
isAutoincrement: false;
|
|
218
|
+
hasRuntimeDefault: false;
|
|
219
|
+
enumValues: [string, ...string[]];
|
|
220
|
+
baseColumn: never;
|
|
221
|
+
identity: undefined;
|
|
222
|
+
generated: undefined;
|
|
223
|
+
}, {}, {}>;
|
|
224
|
+
deliveryLeaseExpiresAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
225
|
+
name: "delivery_lease_expires_at";
|
|
226
|
+
tableName: "workflow_run_dispatch";
|
|
227
|
+
dataType: "date";
|
|
228
|
+
columnType: "PgTimestamp";
|
|
229
|
+
data: Date;
|
|
230
|
+
driverParam: string;
|
|
231
|
+
notNull: false;
|
|
232
|
+
hasDefault: false;
|
|
233
|
+
isPrimaryKey: false;
|
|
234
|
+
isAutoincrement: false;
|
|
235
|
+
hasRuntimeDefault: false;
|
|
236
|
+
enumValues: undefined;
|
|
237
|
+
baseColumn: never;
|
|
238
|
+
identity: undefined;
|
|
239
|
+
generated: undefined;
|
|
240
|
+
}, {}, {}>;
|
|
241
|
+
failureCode: import("drizzle-orm/pg-core").PgColumn<{
|
|
242
|
+
name: "failure_code";
|
|
243
|
+
tableName: "workflow_run_dispatch";
|
|
244
|
+
dataType: "string";
|
|
245
|
+
columnType: "PgText";
|
|
246
|
+
data: string;
|
|
247
|
+
driverParam: string;
|
|
248
|
+
notNull: false;
|
|
249
|
+
hasDefault: false;
|
|
250
|
+
isPrimaryKey: false;
|
|
251
|
+
isAutoincrement: false;
|
|
252
|
+
hasRuntimeDefault: false;
|
|
253
|
+
enumValues: [string, ...string[]];
|
|
254
|
+
baseColumn: never;
|
|
255
|
+
identity: undefined;
|
|
256
|
+
generated: undefined;
|
|
257
|
+
}, {}, {}>;
|
|
258
|
+
failureMessage: import("drizzle-orm/pg-core").PgColumn<{
|
|
259
|
+
name: "failure_message";
|
|
260
|
+
tableName: "workflow_run_dispatch";
|
|
261
|
+
dataType: "string";
|
|
262
|
+
columnType: "PgText";
|
|
263
|
+
data: string;
|
|
264
|
+
driverParam: string;
|
|
265
|
+
notNull: false;
|
|
266
|
+
hasDefault: false;
|
|
267
|
+
isPrimaryKey: false;
|
|
268
|
+
isAutoincrement: false;
|
|
269
|
+
hasRuntimeDefault: false;
|
|
270
|
+
enumValues: [string, ...string[]];
|
|
271
|
+
baseColumn: never;
|
|
272
|
+
identity: undefined;
|
|
273
|
+
generated: undefined;
|
|
274
|
+
}, {}, {}>;
|
|
275
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
276
|
+
name: "created_at";
|
|
277
|
+
tableName: "workflow_run_dispatch";
|
|
278
|
+
dataType: "date";
|
|
279
|
+
columnType: "PgTimestamp";
|
|
280
|
+
data: Date;
|
|
281
|
+
driverParam: string;
|
|
282
|
+
notNull: true;
|
|
283
|
+
hasDefault: true;
|
|
284
|
+
isPrimaryKey: false;
|
|
285
|
+
isAutoincrement: false;
|
|
286
|
+
hasRuntimeDefault: false;
|
|
287
|
+
enumValues: undefined;
|
|
288
|
+
baseColumn: never;
|
|
289
|
+
identity: undefined;
|
|
290
|
+
generated: undefined;
|
|
291
|
+
}, {}, {}>;
|
|
292
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
293
|
+
name: "updated_at";
|
|
294
|
+
tableName: "workflow_run_dispatch";
|
|
295
|
+
dataType: "date";
|
|
296
|
+
columnType: "PgTimestamp";
|
|
297
|
+
data: Date;
|
|
298
|
+
driverParam: string;
|
|
299
|
+
notNull: true;
|
|
300
|
+
hasDefault: true;
|
|
301
|
+
isPrimaryKey: false;
|
|
302
|
+
isAutoincrement: false;
|
|
303
|
+
hasRuntimeDefault: false;
|
|
304
|
+
enumValues: undefined;
|
|
305
|
+
baseColumn: never;
|
|
306
|
+
identity: undefined;
|
|
307
|
+
generated: undefined;
|
|
308
|
+
}, {}, {}>;
|
|
309
|
+
acknowledgedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
310
|
+
name: "acknowledged_at";
|
|
311
|
+
tableName: "workflow_run_dispatch";
|
|
312
|
+
dataType: "date";
|
|
313
|
+
columnType: "PgTimestamp";
|
|
314
|
+
data: Date;
|
|
315
|
+
driverParam: string;
|
|
316
|
+
notNull: false;
|
|
317
|
+
hasDefault: false;
|
|
318
|
+
isPrimaryKey: false;
|
|
319
|
+
isAutoincrement: false;
|
|
320
|
+
hasRuntimeDefault: false;
|
|
321
|
+
enumValues: undefined;
|
|
322
|
+
baseColumn: never;
|
|
323
|
+
identity: undefined;
|
|
324
|
+
generated: undefined;
|
|
325
|
+
}, {}, {}>;
|
|
326
|
+
settledAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
327
|
+
name: "settled_at";
|
|
328
|
+
tableName: "workflow_run_dispatch";
|
|
329
|
+
dataType: "date";
|
|
330
|
+
columnType: "PgTimestamp";
|
|
331
|
+
data: Date;
|
|
332
|
+
driverParam: string;
|
|
333
|
+
notNull: false;
|
|
334
|
+
hasDefault: false;
|
|
335
|
+
isPrimaryKey: false;
|
|
336
|
+
isAutoincrement: false;
|
|
337
|
+
hasRuntimeDefault: false;
|
|
338
|
+
enumValues: undefined;
|
|
339
|
+
baseColumn: never;
|
|
340
|
+
identity: undefined;
|
|
341
|
+
generated: undefined;
|
|
342
|
+
}, {}, {}>;
|
|
343
|
+
};
|
|
344
|
+
dialect: "pg";
|
|
345
|
+
}>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { sql } from "drizzle-orm";
|
|
2
|
+
import { check, index, integer, jsonb, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
|
|
3
|
+
import { bytea } from "./column-types.js";
|
|
4
|
+
import { workflowRun } from "./workflow-run.js";
|
|
5
|
+
export const workflowRunDispatchStatuses = [
|
|
6
|
+
"pending",
|
|
7
|
+
"acknowledged",
|
|
8
|
+
"settled",
|
|
9
|
+
"failed",
|
|
10
|
+
];
|
|
11
|
+
export const workflowRunDispatchKinds = ["mail", "signal"];
|
|
12
|
+
/**
|
|
13
|
+
* Hub-owned delivery state for one inbound workflow message. The raw payload
|
|
14
|
+
* remains durable until the workflow-run Git claim-check reaches `consumed`;
|
|
15
|
+
* a sidecar-local enqueue acknowledgement alone does not settle the row.
|
|
16
|
+
*/
|
|
17
|
+
export const workflowRunDispatch = pgTable("workflow_run_dispatch", {
|
|
18
|
+
id: text("id").primaryKey(),
|
|
19
|
+
anchorRunId: text("anchor_run_id")
|
|
20
|
+
.notNull()
|
|
21
|
+
.references(() => workflowRun.id, { onDelete: "cascade" }),
|
|
22
|
+
messageId: text("message_id").notNull(),
|
|
23
|
+
kind: text("kind")
|
|
24
|
+
.$type()
|
|
25
|
+
.notNull()
|
|
26
|
+
.default("mail"),
|
|
27
|
+
senderAddress: text("sender_address"),
|
|
28
|
+
rawMessage: bytea("raw_message").notNull(),
|
|
29
|
+
stepGrants: jsonb("step_grants").notNull(),
|
|
30
|
+
status: text("status")
|
|
31
|
+
.$type()
|
|
32
|
+
.notNull()
|
|
33
|
+
.default("pending"),
|
|
34
|
+
acknowledgedGeneration: integer("acknowledged_generation"),
|
|
35
|
+
attemptCount: integer("attempt_count").notNull().default(0),
|
|
36
|
+
nextAttemptAt: timestamp("next_attempt_at").defaultNow(),
|
|
37
|
+
deliveryLeaseId: text("delivery_lease_id"),
|
|
38
|
+
deliveryLeaseExpiresAt: timestamp("delivery_lease_expires_at"),
|
|
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
|
+
acknowledgedAt: timestamp("acknowledged_at"),
|
|
44
|
+
settledAt: timestamp("settled_at"),
|
|
45
|
+
}, (t) => [
|
|
46
|
+
uniqueIndex("workflow_run_dispatch_anchor_message_idx").on(t.anchorRunId, t.messageId),
|
|
47
|
+
index("workflow_run_dispatch_delivery_idx")
|
|
48
|
+
.on(t.nextAttemptAt, t.createdAt)
|
|
49
|
+
.where(sql `${t.status} = 'pending'`),
|
|
50
|
+
index("workflow_run_dispatch_anchor_status_idx").on(t.anchorRunId, t.status),
|
|
51
|
+
check("workflow_run_dispatch_status_check", sql `${t.status} in ('pending', 'acknowledged', 'settled', 'failed')`),
|
|
52
|
+
check("workflow_run_dispatch_kind_check", sql `${t.kind} in ('mail', 'signal')`),
|
|
53
|
+
check("workflow_run_dispatch_attempt_count_check", sql `${t.attemptCount} >= 0`),
|
|
54
|
+
check("workflow_run_dispatch_acknowledged_generation_check", sql `${t.acknowledgedGeneration} is null or ${t.acknowledgedGeneration} >= 0`),
|
|
55
|
+
check("workflow_run_dispatch_acknowledged_state_check", sql `${t.status} <> 'acknowledged' or ${t.acknowledgedGeneration} is not null`),
|
|
56
|
+
check("workflow_run_dispatch_pending_schedule_check", sql `${t.status} <> 'pending' or ${t.nextAttemptAt} is not null`),
|
|
57
|
+
// A deliverable mail dispatch must carry the hub-verified sender that
|
|
58
|
+
// its inbound frame is stamped with; signals have no sender. Terminal
|
|
59
|
+
// (settled/failed) mail rows are exempt because they are never
|
|
60
|
+
// re-dispatched and so never reconstruct a frame -- this is what lets a
|
|
61
|
+
// migration fail legacy in-flight mail in place rather than delete it.
|
|
62
|
+
check("workflow_run_dispatch_mail_sender_check", sql `${t.kind} <> 'mail' or ${t.status} in ('settled', 'failed') or ${t.senderAddress} is not null`),
|
|
63
|
+
]);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
name: "
|
|
1
|
+
export declare const workflowRunExecution: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
+
name: "workflow_run_execution";
|
|
3
3
|
schema: undefined;
|
|
4
4
|
columns: {
|
|
5
5
|
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
6
|
name: "id";
|
|
7
|
-
tableName: "
|
|
7
|
+
tableName: "workflow_run_execution";
|
|
8
8
|
dataType: "string";
|
|
9
9
|
columnType: "PgText";
|
|
10
10
|
data: string;
|
|
@@ -19,9 +19,9 @@ export declare const agentAsset: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
19
19
|
identity: undefined;
|
|
20
20
|
generated: undefined;
|
|
21
21
|
}, {}, {}>;
|
|
22
|
-
|
|
23
|
-
name: "
|
|
24
|
-
tableName: "
|
|
22
|
+
runId: import("drizzle-orm/pg-core").PgColumn<{
|
|
23
|
+
name: "run_id";
|
|
24
|
+
tableName: "workflow_run_execution";
|
|
25
25
|
dataType: "string";
|
|
26
26
|
columnType: "PgText";
|
|
27
27
|
data: string;
|
|
@@ -36,9 +36,9 @@ export declare const agentAsset: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
36
36
|
identity: undefined;
|
|
37
37
|
generated: undefined;
|
|
38
38
|
}, {}, {}>;
|
|
39
|
-
|
|
40
|
-
name: "
|
|
41
|
-
tableName: "
|
|
39
|
+
messageId: import("drizzle-orm/pg-core").PgColumn<{
|
|
40
|
+
name: "message_id";
|
|
41
|
+
tableName: "workflow_run_execution";
|
|
42
42
|
dataType: "string";
|
|
43
43
|
columnType: "PgText";
|
|
44
44
|
data: string;
|
|
@@ -53,49 +53,49 @@ export declare const agentAsset: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
53
53
|
identity: undefined;
|
|
54
54
|
generated: undefined;
|
|
55
55
|
}, {}, {}>;
|
|
56
|
-
|
|
57
|
-
name: "
|
|
58
|
-
tableName: "
|
|
56
|
+
status: import("drizzle-orm/pg-core").PgColumn<{
|
|
57
|
+
name: "status";
|
|
58
|
+
tableName: "workflow_run_execution";
|
|
59
59
|
dataType: "string";
|
|
60
60
|
columnType: "PgText";
|
|
61
|
-
data:
|
|
61
|
+
data: "failed" | "running" | "completed";
|
|
62
62
|
driverParam: string;
|
|
63
63
|
notNull: true;
|
|
64
|
-
hasDefault:
|
|
64
|
+
hasDefault: true;
|
|
65
65
|
isPrimaryKey: false;
|
|
66
66
|
isAutoincrement: false;
|
|
67
67
|
hasRuntimeDefault: false;
|
|
68
|
-
enumValues: [
|
|
68
|
+
enumValues: ["running", "completed", "failed"];
|
|
69
69
|
baseColumn: never;
|
|
70
70
|
identity: undefined;
|
|
71
71
|
generated: undefined;
|
|
72
72
|
}, {}, {}>;
|
|
73
|
-
|
|
74
|
-
name: "
|
|
75
|
-
tableName: "
|
|
76
|
-
dataType: "
|
|
77
|
-
columnType: "
|
|
78
|
-
data:
|
|
73
|
+
startedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
74
|
+
name: "started_at";
|
|
75
|
+
tableName: "workflow_run_execution";
|
|
76
|
+
dataType: "date";
|
|
77
|
+
columnType: "PgTimestamp";
|
|
78
|
+
data: Date;
|
|
79
79
|
driverParam: string;
|
|
80
80
|
notNull: true;
|
|
81
81
|
hasDefault: true;
|
|
82
82
|
isPrimaryKey: false;
|
|
83
83
|
isAutoincrement: false;
|
|
84
84
|
hasRuntimeDefault: false;
|
|
85
|
-
enumValues:
|
|
85
|
+
enumValues: undefined;
|
|
86
86
|
baseColumn: never;
|
|
87
87
|
identity: undefined;
|
|
88
88
|
generated: undefined;
|
|
89
89
|
}, {}, {}>;
|
|
90
|
-
|
|
91
|
-
name: "
|
|
92
|
-
tableName: "
|
|
90
|
+
endedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
91
|
+
name: "ended_at";
|
|
92
|
+
tableName: "workflow_run_execution";
|
|
93
93
|
dataType: "date";
|
|
94
94
|
columnType: "PgTimestamp";
|
|
95
95
|
data: Date;
|
|
96
96
|
driverParam: string;
|
|
97
|
-
notNull:
|
|
98
|
-
hasDefault:
|
|
97
|
+
notNull: false;
|
|
98
|
+
hasDefault: false;
|
|
99
99
|
isPrimaryKey: false;
|
|
100
100
|
isAutoincrement: false;
|
|
101
101
|
hasRuntimeDefault: false;
|
|
@@ -104,6 +104,23 @@ export declare const agentAsset: import("drizzle-orm/pg-core").PgTableWithColumn
|
|
|
104
104
|
identity: undefined;
|
|
105
105
|
generated: undefined;
|
|
106
106
|
}, {}, {}>;
|
|
107
|
+
failureReason: import("drizzle-orm/pg-core").PgColumn<{
|
|
108
|
+
name: "failure_reason";
|
|
109
|
+
tableName: "workflow_run_execution";
|
|
110
|
+
dataType: "string";
|
|
111
|
+
columnType: "PgText";
|
|
112
|
+
data: string;
|
|
113
|
+
driverParam: string;
|
|
114
|
+
notNull: false;
|
|
115
|
+
hasDefault: false;
|
|
116
|
+
isPrimaryKey: false;
|
|
117
|
+
isAutoincrement: false;
|
|
118
|
+
hasRuntimeDefault: false;
|
|
119
|
+
enumValues: [string, ...string[]];
|
|
120
|
+
baseColumn: never;
|
|
121
|
+
identity: undefined;
|
|
122
|
+
generated: undefined;
|
|
123
|
+
}, {}, {}>;
|
|
107
124
|
};
|
|
108
125
|
dialect: "pg";
|
|
109
126
|
}>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { index, pgTable, text, timestamp, uniqueIndex, } from "drizzle-orm/pg-core";
|
|
2
|
+
import { workflowRun } from "./workflow-run.js";
|
|
3
|
+
// workflow_run_execution is the per-TURN record of a run. A long-lived run
|
|
4
|
+
// (`workflow_run`, the run aggregate) resumes in place across many messages;
|
|
5
|
+
// each inbound message drives exactly one execution -- one turn. The
|
|
6
|
+
// single-shot running->terminal guard is per turn and belongs here, not on the
|
|
7
|
+
// run aggregate: a redelivered terminal re-settles the SAME execution rather
|
|
8
|
+
// than re-terminating the whole run, and a new message opens a NEW execution
|
|
9
|
+
// against the same run.
|
|
10
|
+
//
|
|
11
|
+
// `id` is the executionId, derived deterministically from the driving message
|
|
12
|
+
// (see `deriveExecutionId`), so a redelivery of the same bytes resolves to the
|
|
13
|
+
// same execution rather than a fresh one. The table is the hub-side projection
|
|
14
|
+
// of the run's turn-boundary events (`TurnStarted`/`TurnCompleted`/`TurnFailed`)
|
|
15
|
+
// that the read surface exposes so per-turn outcomes are visible.
|
|
16
|
+
export const workflowRunExecution = pgTable("workflow_run_execution", {
|
|
17
|
+
id: text("id").primaryKey(),
|
|
18
|
+
// The run this execution is a turn of. `cascade` matches `workflow_run`'s
|
|
19
|
+
// own deletes so a removed run takes its executions with it.
|
|
20
|
+
runId: text("run_id")
|
|
21
|
+
.notNull()
|
|
22
|
+
.references(() => workflowRun.id, { onDelete: "cascade" }),
|
|
23
|
+
// The inbound message that drove this turn; the executionId is derived from
|
|
24
|
+
// it, but the raw messageId is retained for correlation and read-surface
|
|
25
|
+
// display.
|
|
26
|
+
messageId: text("message_id").notNull(),
|
|
27
|
+
// A turn is born "running" and settles to "completed" or "failed" when its
|
|
28
|
+
// terminal turn event lands. Unlike the run aggregate, a turn is never
|
|
29
|
+
// "cancelled" on its own -- cancellation is a run-level disposition.
|
|
30
|
+
status: text("status", {
|
|
31
|
+
enum: ["running", "completed", "failed"],
|
|
32
|
+
})
|
|
33
|
+
.notNull()
|
|
34
|
+
.default("running"),
|
|
35
|
+
startedAt: timestamp("started_at").notNull().defaultNow(),
|
|
36
|
+
// Nullable: a turn has no end time until it reaches a terminal state.
|
|
37
|
+
endedAt: timestamp("ended_at"),
|
|
38
|
+
// Populated only on a `failed` turn (e.g. a malformed inbound mail that
|
|
39
|
+
// could not resume the run); null otherwise.
|
|
40
|
+
failureReason: text("failure_reason"),
|
|
41
|
+
}, (t) => [
|
|
42
|
+
// The read surface lists a run's executions in turn order; the leftmost
|
|
43
|
+
// `runId` column serves that lookup. Unique on `(runId, id)` as the
|
|
44
|
+
// race backstop the design mandates against a concurrent double-insert of
|
|
45
|
+
// the same turn.
|
|
46
|
+
uniqueIndex("workflow_run_execution_run_id_id_idx").on(t.runId, t.id),
|
|
47
|
+
index("workflow_run_execution_status_idx").on(t.status),
|
|
48
|
+
]);
|