@relayfx/sdk 0.3.7 → 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/dist/ai.js +1 -1
- package/dist/http-server.js +1 -1
- package/dist/{index-pw46cfne.js → index-3w6txjtg.js} +59 -426
- package/dist/{index-h8rx4xya.js → index-cs3be24t.js} +1 -1
- package/dist/{index-8awt651b.js → index-p43mg4kt.js} +5774 -5275
- package/dist/{index-t5bbk8cp.js → index-x32kbvxv.js} +935 -954
- package/dist/index.js +487 -22
- package/dist/migrations/20260719120000_rename_entity_to_resident/migration.sql +9 -0
- package/dist/migrations/mysql/0012_rename_entity_to_resident.sql +5 -0
- package/dist/migrations/pg/20260719120000_rename_entity_to_resident/migration.sql +9 -0
- package/dist/migrations/sqlite/0012_rename_entity_to_resident.sql +7 -0
- package/dist/mysql.js +18 -5
- package/dist/postgres.js +569 -550
- package/dist/sqlite.js +16 -5
- package/dist/types/relay/client-baton-agent.d.ts +30 -0
- package/dist/types/relay/client-child-runs.d.ts +35 -0
- package/dist/types/relay/client-error-mapping.d.ts +5 -0
- package/dist/types/relay/client-event-sequence.d.ts +3 -0
- package/dist/types/relay/client-execution-payloads.d.ts +12 -0
- package/dist/types/relay/client-public-agents.d.ts +15 -0
- package/dist/types/relay/client-public-child-runs.d.ts +9 -0
- package/dist/types/relay/client-public-envelope-ready.d.ts +6 -0
- package/dist/types/relay/client-public-executions.d.ts +247 -0
- package/dist/types/relay/client-public-messaging.d.ts +18 -0
- package/dist/types/relay/client-public-residents.d.ts +14 -0
- package/dist/types/relay/client-public-schedules.d.ts +6 -0
- package/dist/types/relay/client-public-tools.d.ts +12 -0
- package/dist/types/relay/client-public-workflows.d.ts +10 -0
- package/dist/types/relay/client-public.d.ts +133 -313
- package/dist/types/relay/client-runtime-wake.d.ts +10 -0
- package/dist/types/relay/client-tool-outcome.d.ts +16 -0
- package/dist/types/relay/client-view-mappers.d.ts +16 -0
- package/dist/types/relay/client-wait-signal.d.ts +5 -0
- package/dist/types/relay/client.d.ts +118 -1
- package/dist/types/relay/command.d.ts +6 -6
- package/dist/types/relay/http-server.d.ts +55 -37
- package/dist/types/relay/index.d.ts +3 -4
- package/dist/types/relay/internal-client.d.ts +5 -5
- package/dist/types/relay/mysql-migrations.d.ts +1 -1
- package/dist/types/relay/operation.d.ts +41 -41
- package/dist/types/relay/sqlite-migrations.d.ts +6 -1
- package/dist/types/runtime/agent/agent-loop-events.d.ts +24 -0
- package/dist/types/runtime/execution/event-log-memory.d.ts +7 -0
- package/dist/types/runtime/execution/event-log-repository.d.ts +8 -0
- package/dist/types/runtime/index.d.ts +2 -2
- package/dist/types/runtime/resident/resident-instance-service.d.ts +76 -0
- package/dist/types/runtime/resident/resident-registry-service.d.ts +35 -0
- package/dist/types/runtime/runner/runner-runtime-service.d.ts +14 -14
- package/dist/types/runtime/workflow/execution-workflow-state.d.ts +43 -0
- package/dist/types/schema/execution-schema.d.ts +2 -2
- package/dist/types/schema/ids-schema.d.ts +6 -6
- package/dist/types/schema/index.d.ts +1 -1
- package/dist/types/schema/{entity-schema.d.ts → resident-schema.d.ts} +6 -6
- package/dist/types/store-sql/envelope/envelope-ready-records.d.ts +51 -0
- package/dist/types/store-sql/envelope/envelope-records.d.ts +43 -0
- package/dist/types/store-sql/envelope/envelope-repository.d.ts +1 -2
- package/dist/types/store-sql/envelope/wait-records.d.ts +64 -0
- package/dist/types/store-sql/execution/execution-event-repository-memory.d.ts +8 -0
- package/dist/types/store-sql/execution/execution-event-repository-sql.d.ts +13 -0
- package/dist/types/store-sql/execution/execution-event-repository.d.ts +3 -4
- package/dist/types/store-sql/index.d.ts +1 -1
- package/dist/types/store-sql/portable.d.ts +1 -1
- package/dist/types/store-sql/resident/resident-repository.d.ts +36 -0
- package/dist/types/store-sql/schema/address-book-schema.d.ts +131 -0
- package/dist/types/store-sql/schema/agent-schema.d.ts +954 -0
- package/dist/types/store-sql/schema/communication-schema.d.ts +743 -0
- package/dist/types/store-sql/schema/envelope-schema.d.ts +701 -0
- package/dist/types/store-sql/schema/execution-schema.d.ts +1119 -0
- package/dist/types/store-sql/schema/idempotency-schema.d.ts +161 -0
- package/dist/types/store-sql/schema/presence-schema.d.ts +116 -0
- package/dist/types/store-sql/schema/relay-schema.d.ts +13 -6684
- package/dist/types/store-sql/schema/resident-schema.d.ts +294 -0
- package/dist/types/store-sql/schema/schedule-schema.d.ts +282 -0
- package/dist/types/store-sql/schema/schema-columns.d.ts +1 -0
- package/dist/types/store-sql/schema/session-schema.d.ts +228 -0
- package/dist/types/store-sql/schema/tool-schema.d.ts +627 -0
- package/dist/types/store-sql/schema/workflow-schema.d.ts +996 -0
- package/dist/types/store-sql/schema/workspace-schema.d.ts +338 -0
- package/dist/types/store-sql/session/session-entry-records.d.ts +52 -0
- package/dist/types/store-sql/session/session-records.d.ts +51 -0
- package/dist/types/store-sql/session/session-repository.d.ts +2 -3
- package/dist/types/store-sql/tool/tool-attempt-records.d.ts +52 -0
- package/dist/types/store-sql/tool/tool-call-records.d.ts +121 -0
- package/dist/types/store-sql/tool/tool-call-repository.d.ts +1 -2
- package/dist/types/store-sql/tool/tool-work-operations.d.ts +11 -0
- package/package.json +3 -3
- package/dist/types/runtime/entity/entity-instance-service.d.ts +0 -76
- package/dist/types/runtime/entity/entity-registry-service.d.ts +0 -35
- package/dist/types/store-sql/entity/entity-repository.d.ts +0 -36
package/dist/postgres.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
database,
|
|
4
4
|
normalizeMigrationCause
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-cs3be24t.js";
|
|
6
6
|
import {
|
|
7
7
|
Dialect,
|
|
8
8
|
RuntimeMigrationError,
|
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
fromDbTimestamp,
|
|
15
15
|
fromNullableDbTimestamp,
|
|
16
16
|
timestampParam
|
|
17
|
-
} from "./index-
|
|
18
|
-
import"./index-
|
|
17
|
+
} from "./index-p43mg4kt.js";
|
|
18
|
+
import"./index-x32kbvxv.js";
|
|
19
19
|
import {
|
|
20
20
|
exports_ids_schema
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-3w6txjtg.js";
|
|
22
22
|
import {
|
|
23
23
|
__export
|
|
24
24
|
} from "./index-nb39b5ae.js";
|
|
@@ -80,26 +80,19 @@ var check = Effect.fn("Database.check")(function* () {
|
|
|
80
80
|
const db = yield* Service;
|
|
81
81
|
yield* db.execute(sql`select 1 as ok`).pipe(Effect.asVoid);
|
|
82
82
|
});
|
|
83
|
-
// ../store-sql/src/schema/
|
|
84
|
-
import {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
integer,
|
|
89
|
-
jsonb,
|
|
90
|
-
pgTable,
|
|
91
|
-
primaryKey,
|
|
92
|
-
text,
|
|
93
|
-
timestamp,
|
|
94
|
-
uniqueIndex
|
|
95
|
-
} from "drizzle-orm/pg-core";
|
|
96
|
-
import { sql as sql2 } from "drizzle-orm";
|
|
83
|
+
// ../store-sql/src/schema/workflow-schema.ts
|
|
84
|
+
import { boolean, integer, jsonb, pgTable, primaryKey, text as text2, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
|
|
85
|
+
|
|
86
|
+
// ../store-sql/src/schema/schema-columns.ts
|
|
87
|
+
import { text } from "drizzle-orm/pg-core";
|
|
97
88
|
var tenantId = () => text("tenant_id").$type().notNull().default(exports_ids_schema.SystemTenantId);
|
|
89
|
+
|
|
90
|
+
// ../store-sql/src/schema/workflow-schema.ts
|
|
98
91
|
var relayWorkflowDefinitionRevisions = pgTable("relay_workflow_definition_revisions", {
|
|
99
92
|
tenantId: tenantId(),
|
|
100
|
-
workflowDefinitionId:
|
|
93
|
+
workflowDefinitionId: text2("workflow_definition_id").$type().notNull(),
|
|
101
94
|
revision: integer("revision").$type().notNull(),
|
|
102
|
-
digest:
|
|
95
|
+
digest: text2("digest").$type().notNull(),
|
|
103
96
|
definitionJson: jsonb("definition_json").$type().notNull(),
|
|
104
97
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
105
98
|
}, (table) => [
|
|
@@ -108,626 +101,651 @@ var relayWorkflowDefinitionRevisions = pgTable("relay_workflow_definition_revisi
|
|
|
108
101
|
]);
|
|
109
102
|
var relayWorkflowRuns = pgTable("relay_workflow_runs", {
|
|
110
103
|
tenantId: tenantId(),
|
|
111
|
-
executionId:
|
|
112
|
-
workflowDefinitionId:
|
|
104
|
+
executionId: text2("execution_id").$type().notNull(),
|
|
105
|
+
workflowDefinitionId: text2("workflow_definition_id").$type().notNull(),
|
|
113
106
|
workflowDefinitionRevision: integer("workflow_definition_revision").$type().notNull(),
|
|
114
|
-
workflowDefinitionDigest:
|
|
115
|
-
status:
|
|
107
|
+
workflowDefinitionDigest: text2("workflow_definition_digest").$type().notNull(),
|
|
108
|
+
status: text2("status").$type().notNull(),
|
|
116
109
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
117
110
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
118
111
|
}, (table) => [primaryKey({ columns: [table.tenantId, table.executionId] })]);
|
|
119
112
|
var relayWorkflowOperationStates = pgTable("relay_workflow_operation_states", {
|
|
120
113
|
tenantId: tenantId(),
|
|
121
|
-
executionId:
|
|
122
|
-
operationId:
|
|
123
|
-
status:
|
|
124
|
-
fanOutId:
|
|
114
|
+
executionId: text2("execution_id").$type().notNull(),
|
|
115
|
+
operationId: text2("operation_id").$type().notNull(),
|
|
116
|
+
status: text2("status").notNull(),
|
|
117
|
+
fanOutId: text2("fan_out_id"),
|
|
125
118
|
decision: boolean("decision"),
|
|
126
119
|
outputJson: jsonb("output_json"),
|
|
127
120
|
attempt: integer("attempt"),
|
|
128
121
|
backoffUntil: timestamp("backoff_until", { withTimezone: true }),
|
|
129
|
-
compensationOperationId:
|
|
122
|
+
compensationOperationId: text2("compensation_operation_id"),
|
|
130
123
|
startedAt: timestamp("started_at", { withTimezone: true }),
|
|
131
124
|
completedAt: timestamp("completed_at", { withTimezone: true }),
|
|
132
125
|
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
133
126
|
}, (table) => [primaryKey({ columns: [table.tenantId, table.executionId, table.operationId] })]);
|
|
134
127
|
var relayWorkflowLifecycleEvents = pgTable("relay_workflow_lifecycle_events", {
|
|
135
128
|
tenantId: tenantId(),
|
|
136
|
-
executionId:
|
|
129
|
+
executionId: text2("execution_id").$type().notNull(),
|
|
137
130
|
sequence: integer("sequence").notNull(),
|
|
138
|
-
eventType:
|
|
139
|
-
operationId:
|
|
131
|
+
eventType: text2("event_type").notNull(),
|
|
132
|
+
operationId: text2("operation_id"),
|
|
140
133
|
dataJson: jsonb("data_json"),
|
|
141
134
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
142
135
|
}, (table) => [primaryKey({ columns: [table.tenantId, table.executionId, table.sequence] })]);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
])
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
tenantId:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
136
|
+
// ../store-sql/src/schema/resident-schema.ts
|
|
137
|
+
import { index, integer as integer2, jsonb as jsonb2, pgTable as pgTable2, primaryKey as primaryKey2, text as text3, timestamp as timestamp2 } from "drizzle-orm/pg-core";
|
|
138
|
+
var relayResidentKinds = pgTable2("relay_resident_kinds", {
|
|
139
|
+
tenantId: tenantId(),
|
|
140
|
+
kind: text3("kind").$type().notNull(),
|
|
141
|
+
agentId: text3("agent_id").$type().notNull(),
|
|
142
|
+
inboxPolicyJson: jsonb2("inbox_policy_json").$type(),
|
|
143
|
+
stateEnabled: integer2("state_enabled").$type(),
|
|
144
|
+
continueAsNewAfterTurns: integer2("continue_as_new_after_turns"),
|
|
145
|
+
metadataJson: jsonb2("metadata_json").$type().notNull().default({}),
|
|
146
|
+
createdAt: timestamp2("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
147
|
+
updatedAt: timestamp2("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
148
|
+
}, (table) => [primaryKey2({ columns: [table.tenantId, table.kind], name: "pk_relay_resident_kinds" })]);
|
|
149
|
+
var relayResidentInstances = pgTable2("relay_resident_instances", {
|
|
150
|
+
tenantId: tenantId(),
|
|
151
|
+
kind: text3("kind").$type().notNull(),
|
|
152
|
+
key: text3("key").$type().notNull(),
|
|
153
|
+
addressId: text3("address_id").$type().notNull(),
|
|
154
|
+
executionId: text3("execution_id").$type().notNull(),
|
|
155
|
+
generation: integer2("generation").notNull(),
|
|
156
|
+
status: text3("status").$type().notNull(),
|
|
157
|
+
createdAt: timestamp2("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
158
|
+
destroyedAt: timestamp2("destroyed_at", { withTimezone: true })
|
|
159
|
+
}, (table) => [
|
|
160
|
+
primaryKey2({ columns: [table.tenantId, table.kind, table.key], name: "pk_relay_resident_instances" }),
|
|
161
|
+
index("idx_relay_resident_instances_kind_status").on(table.tenantId, table.kind, table.status)
|
|
162
|
+
]);
|
|
163
|
+
// ../store-sql/src/schema/address-book-schema.ts
|
|
164
|
+
import { jsonb as jsonb3, pgTable as pgTable3, primaryKey as primaryKey3, text as text4, timestamp as timestamp3, uniqueIndex as uniqueIndex2 } from "drizzle-orm/pg-core";
|
|
165
|
+
var relayAddressBookEntries = pgTable3("relay_address_book_entries", {
|
|
166
|
+
tenantId: tenantId(),
|
|
167
|
+
id: text4("id").$type().notNull(),
|
|
168
|
+
addressId: text4("address_id").$type().notNull(),
|
|
169
|
+
routeKind: text4("route_kind").notNull(),
|
|
170
|
+
routeKey: text4("route_key").notNull(),
|
|
171
|
+
metadataJson: jsonb3("metadata_json").$type().notNull().default({}),
|
|
172
|
+
createdAt: timestamp3("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
173
|
+
updatedAt: timestamp3("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
174
|
+
}, (table) => [
|
|
175
|
+
primaryKey3({ columns: [table.tenantId, table.id], name: "pk_relay_address_book_entries" }),
|
|
176
|
+
uniqueIndex2("uq_relay_address_book_address").on(table.tenantId, table.addressId)
|
|
177
|
+
]);
|
|
178
|
+
// ../store-sql/src/schema/agent-schema.ts
|
|
179
|
+
import { doublePrecision, index as index2, integer as integer3, jsonb as jsonb4, pgTable as pgTable4, primaryKey as primaryKey4, text as text5, timestamp as timestamp4 } from "drizzle-orm/pg-core";
|
|
180
|
+
var relayAgentDefinitions = pgTable4("relay_agent_definitions", {
|
|
181
|
+
tenantId: tenantId(),
|
|
182
|
+
id: text5("id").$type().notNull(),
|
|
183
|
+
name: text5("name").notNull(),
|
|
184
|
+
currentRevision: integer3("current_revision").$type().notNull(),
|
|
185
|
+
definitionJson: jsonb4("definition_json").$type().notNull(),
|
|
186
|
+
toolInputSchemaDigestsJson: jsonb4("tool_input_schema_digests_json").$type().notNull().default({}),
|
|
187
|
+
createdAt: timestamp4("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
188
|
+
updatedAt: timestamp4("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
189
|
+
}, (table) => [
|
|
190
|
+
primaryKey4({ columns: [table.tenantId, table.id], name: "pk_relay_agent_definitions" }),
|
|
191
|
+
index2("idx_relay_agent_definitions_name").on(table.tenantId, table.name)
|
|
192
|
+
]);
|
|
193
|
+
var relayAgentDefinitionRevisions = pgTable4("relay_agent_revisions", {
|
|
194
|
+
tenantId: tenantId(),
|
|
195
|
+
agentId: text5("agent_id").$type().notNull(),
|
|
196
|
+
revision: integer3("revision").$type().notNull(),
|
|
197
|
+
name: text5("name").notNull(),
|
|
198
|
+
definitionJson: jsonb4("definition_json").$type().notNull(),
|
|
199
|
+
toolInputSchemaDigestsJson: jsonb4("tool_input_schema_digests_json").$type().notNull().default({}),
|
|
200
|
+
createdAt: timestamp4("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
201
|
+
}, (table) => [
|
|
202
|
+
primaryKey4({
|
|
204
203
|
columns: [table.tenantId, table.agentId, table.revision],
|
|
205
204
|
name: "pk_relay_agent_revisions"
|
|
206
205
|
}),
|
|
207
|
-
|
|
206
|
+
index2("idx_relay_agent_revisions_definition").on(table.tenantId, table.agentId, table.revision)
|
|
208
207
|
]);
|
|
209
|
-
var relaySkillDefinitions =
|
|
208
|
+
var relaySkillDefinitions = pgTable4("relay_skill_definitions", {
|
|
210
209
|
tenantId: tenantId(),
|
|
211
|
-
id:
|
|
212
|
-
name:
|
|
213
|
-
currentRevision:
|
|
214
|
-
definitionJson:
|
|
215
|
-
createdAt:
|
|
216
|
-
updatedAt:
|
|
210
|
+
id: text5("id").$type().notNull(),
|
|
211
|
+
name: text5("name").notNull(),
|
|
212
|
+
currentRevision: integer3("current_revision").$type().notNull(),
|
|
213
|
+
definitionJson: jsonb4("definition_json").$type().notNull(),
|
|
214
|
+
createdAt: timestamp4("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
215
|
+
updatedAt: timestamp4("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
217
216
|
}, (table) => [
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
primaryKey4({ columns: [table.tenantId, table.id], name: "pk_relay_skill_definitions" }),
|
|
218
|
+
index2("idx_relay_skill_definitions_name").on(table.tenantId, table.name)
|
|
220
219
|
]);
|
|
221
|
-
var relaySkillDefinitionRevisions =
|
|
220
|
+
var relaySkillDefinitionRevisions = pgTable4("relay_skill_definition_revisions", {
|
|
222
221
|
tenantId: tenantId(),
|
|
223
|
-
skillDefinitionId:
|
|
224
|
-
revision:
|
|
225
|
-
name:
|
|
226
|
-
definitionJson:
|
|
227
|
-
createdAt:
|
|
222
|
+
skillDefinitionId: text5("skill_definition_id").notNull().$type(),
|
|
223
|
+
revision: integer3("revision").notNull().$type(),
|
|
224
|
+
name: text5("name").notNull(),
|
|
225
|
+
definitionJson: jsonb4("definition_json").$type().notNull(),
|
|
226
|
+
createdAt: timestamp4("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
228
227
|
}, (table) => [
|
|
229
|
-
|
|
228
|
+
primaryKey4({
|
|
230
229
|
columns: [table.tenantId, table.skillDefinitionId, table.revision],
|
|
231
230
|
name: "pk_relay_skill_definition_revisions"
|
|
232
231
|
}),
|
|
233
|
-
|
|
232
|
+
index2("idx_relay_skill_definition_revisions_definition").on(table.tenantId, table.skillDefinitionId, table.revision)
|
|
234
233
|
]);
|
|
235
|
-
var relayExecutionSkillPins =
|
|
234
|
+
var relayExecutionSkillPins = pgTable4("relay_execution_skill_pins", {
|
|
236
235
|
tenantId: tenantId(),
|
|
237
|
-
executionId:
|
|
238
|
-
skillDefinitionId:
|
|
239
|
-
skillDefinitionRevision:
|
|
240
|
-
skillDefinitionSnapshotJson:
|
|
241
|
-
createdAt:
|
|
236
|
+
executionId: text5("execution_id").notNull().$type(),
|
|
237
|
+
skillDefinitionId: text5("skill_definition_id").notNull().$type(),
|
|
238
|
+
skillDefinitionRevision: integer3("skill_definition_revision").notNull().$type(),
|
|
239
|
+
skillDefinitionSnapshotJson: jsonb4("skill_definition_snapshot_json").$type().notNull(),
|
|
240
|
+
createdAt: timestamp4("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
242
241
|
}, (table) => [
|
|
243
|
-
|
|
242
|
+
primaryKey4({
|
|
244
243
|
columns: [table.tenantId, table.executionId, table.skillDefinitionId],
|
|
245
244
|
name: "pk_relay_execution_skill_pins"
|
|
246
245
|
}),
|
|
247
|
-
|
|
246
|
+
index2("idx_relay_execution_skill_pins_execution").on(table.tenantId, table.executionId)
|
|
248
247
|
]);
|
|
249
|
-
var relayAgentChats =
|
|
248
|
+
var relayAgentChats = pgTable4("relay_agent_chats", {
|
|
250
249
|
tenantId: tenantId(),
|
|
251
|
-
executionId:
|
|
252
|
-
exportJson:
|
|
253
|
-
updatedAt:
|
|
254
|
-
}, (table) => [
|
|
255
|
-
var
|
|
256
|
-
tenantId: tenantId(),
|
|
257
|
-
executionId: text("execution_id").$type().notNull(),
|
|
258
|
-
key: text("state_key").notNull(),
|
|
259
|
-
valueJson: jsonb("value_json").$type().notNull(),
|
|
260
|
-
version: integer("version").notNull(),
|
|
261
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull(),
|
|
262
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull()
|
|
263
|
-
}, (table) => [
|
|
264
|
-
primaryKey({ columns: [table.tenantId, table.executionId, table.key], name: "pk_relay_execution_state" })
|
|
265
|
-
]);
|
|
266
|
-
var relayExecutionStateOps = pgTable("relay_execution_state_ops", {
|
|
250
|
+
executionId: text5("execution_id").$type().notNull(),
|
|
251
|
+
exportJson: jsonb4("export_json").notNull(),
|
|
252
|
+
updatedAt: timestamp4("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
253
|
+
}, (table) => [primaryKey4({ columns: [table.tenantId, table.executionId], name: "pk_relay_agent_chats" })]);
|
|
254
|
+
var relayAgentCompactions = pgTable4("relay_agent_compactions", {
|
|
267
255
|
tenantId: tenantId(),
|
|
268
|
-
executionId:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
resultValueJson: jsonb("result_value_json").$type(),
|
|
275
|
-
resultCreatedAt: timestamp("result_created_at", { withTimezone: true }),
|
|
276
|
-
resultUpdatedAt: timestamp("result_updated_at", { withTimezone: true }),
|
|
277
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull()
|
|
256
|
+
executionId: text5("execution_id").notNull().$type(),
|
|
257
|
+
checkpointId: text5("checkpoint_id").notNull(),
|
|
258
|
+
summary: text5("summary").notNull(),
|
|
259
|
+
firstKeptEntryId: text5("first_kept_entry_id").$type().notNull(),
|
|
260
|
+
turn: integer3("turn").notNull(),
|
|
261
|
+
createdAt: timestamp4("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
278
262
|
}, (table) => [
|
|
279
|
-
|
|
280
|
-
columns: [table.tenantId, table.executionId, table.idempotencyKey],
|
|
281
|
-
name: "pk_relay_execution_state_ops"
|
|
282
|
-
}),
|
|
283
|
-
index("idx_relay_execution_state_ops_version").on(table.tenantId, table.executionId, table.key, table.version)
|
|
284
|
-
]);
|
|
285
|
-
var relayAgentCompactions = pgTable("relay_agent_compactions", {
|
|
286
|
-
tenantId: tenantId(),
|
|
287
|
-
executionId: text("execution_id").notNull().$type(),
|
|
288
|
-
checkpointId: text("checkpoint_id").notNull(),
|
|
289
|
-
summary: text("summary").notNull(),
|
|
290
|
-
firstKeptEntryId: text("first_kept_entry_id").$type().notNull(),
|
|
291
|
-
turn: integer("turn").notNull(),
|
|
292
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
293
|
-
}, (table) => [
|
|
294
|
-
primaryKey({
|
|
263
|
+
primaryKey4({
|
|
295
264
|
columns: [table.tenantId, table.executionId, table.checkpointId],
|
|
296
265
|
name: "pk_relay_agent_compactions"
|
|
297
266
|
}),
|
|
298
|
-
|
|
267
|
+
index2("idx_relay_agent_compactions_execution_turn").on(table.tenantId, table.executionId, table.turn)
|
|
299
268
|
]);
|
|
300
|
-
var relayMemoryRecords =
|
|
269
|
+
var relayMemoryRecords = pgTable4("relay_memory_records", {
|
|
301
270
|
tenantId: tenantId(),
|
|
302
|
-
id:
|
|
303
|
-
agent:
|
|
304
|
-
subject:
|
|
271
|
+
id: text5("id").notNull(),
|
|
272
|
+
agent: text5("agent").notNull(),
|
|
273
|
+
subject: text5("subject").$type().notNull(),
|
|
305
274
|
embedding: doublePrecision("embedding").array().notNull(),
|
|
306
|
-
partsJson:
|
|
307
|
-
metadataJson:
|
|
308
|
-
createdAt:
|
|
275
|
+
partsJson: jsonb4("parts_json").$type().notNull(),
|
|
276
|
+
metadataJson: jsonb4("metadata_json").$type().notNull().default({}),
|
|
277
|
+
createdAt: timestamp4("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
309
278
|
}, (table) => [
|
|
310
|
-
|
|
311
|
-
|
|
279
|
+
primaryKey4({ columns: [table.tenantId, table.id], name: "pk_relay_memory_records" }),
|
|
280
|
+
index2("idx_relay_memory_records_agent_subject").on(table.tenantId, table.agent, table.subject)
|
|
312
281
|
]);
|
|
313
|
-
var relayPermissionRules =
|
|
282
|
+
var relayPermissionRules = pgTable4("relay_permission_rules", {
|
|
314
283
|
tenantId: tenantId(),
|
|
315
|
-
agent:
|
|
316
|
-
scope:
|
|
317
|
-
pattern:
|
|
318
|
-
ruleJson:
|
|
319
|
-
createdAt:
|
|
284
|
+
agent: text5("agent").notNull(),
|
|
285
|
+
scope: text5("scope").notNull(),
|
|
286
|
+
pattern: text5("pattern").notNull(),
|
|
287
|
+
ruleJson: jsonb4("rule_json").$type().notNull(),
|
|
288
|
+
createdAt: timestamp4("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
320
289
|
}, (table) => [
|
|
321
|
-
|
|
290
|
+
primaryKey4({
|
|
322
291
|
columns: [table.tenantId, table.agent, table.scope, table.pattern],
|
|
323
292
|
name: "pk_relay_permission_rules"
|
|
324
293
|
}),
|
|
325
|
-
|
|
326
|
-
]);
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
createdAt:
|
|
336
|
-
|
|
337
|
-
|
|
294
|
+
index2("idx_relay_permission_rules_agent_scope").on(table.tenantId, table.agent, table.scope)
|
|
295
|
+
]);
|
|
296
|
+
// ../store-sql/src/schema/execution-schema.ts
|
|
297
|
+
import { boolean as boolean2, index as index3, integer as integer4, jsonb as jsonb5, pgTable as pgTable5, primaryKey as primaryKey5, text as text6, timestamp as timestamp5, uniqueIndex as uniqueIndex3 } from "drizzle-orm/pg-core";
|
|
298
|
+
var relayExecutionState = pgTable5("relay_execution_state", {
|
|
299
|
+
tenantId: tenantId(),
|
|
300
|
+
executionId: text6("execution_id").$type().notNull(),
|
|
301
|
+
key: text6("state_key").notNull(),
|
|
302
|
+
valueJson: jsonb5("value_json").$type().notNull(),
|
|
303
|
+
version: integer4("version").notNull(),
|
|
304
|
+
createdAt: timestamp5("created_at", { withTimezone: true }).notNull(),
|
|
305
|
+
updatedAt: timestamp5("updated_at", { withTimezone: true }).notNull()
|
|
306
|
+
}, (table) => [
|
|
307
|
+
primaryKey5({ columns: [table.tenantId, table.executionId, table.key], name: "pk_relay_execution_state" })
|
|
308
|
+
]);
|
|
309
|
+
var relayExecutionStateOps = pgTable5("relay_execution_state_ops", {
|
|
310
|
+
tenantId: tenantId(),
|
|
311
|
+
executionId: text6("execution_id").$type().notNull(),
|
|
312
|
+
idempotencyKey: text6("idempotency_key").notNull(),
|
|
313
|
+
key: text6("state_key").notNull(),
|
|
314
|
+
version: integer4("version").notNull(),
|
|
315
|
+
op: text6("op").notNull(),
|
|
316
|
+
resultPresent: boolean2("result_present").notNull(),
|
|
317
|
+
resultValueJson: jsonb5("result_value_json").$type(),
|
|
318
|
+
resultCreatedAt: timestamp5("result_created_at", { withTimezone: true }),
|
|
319
|
+
resultUpdatedAt: timestamp5("result_updated_at", { withTimezone: true }),
|
|
320
|
+
createdAt: timestamp5("created_at", { withTimezone: true }).notNull()
|
|
321
|
+
}, (table) => [
|
|
322
|
+
primaryKey5({
|
|
323
|
+
columns: [table.tenantId, table.executionId, table.idempotencyKey],
|
|
324
|
+
name: "pk_relay_execution_state_ops"
|
|
325
|
+
}),
|
|
326
|
+
index3("idx_relay_execution_state_ops_version").on(table.tenantId, table.executionId, table.key, table.version)
|
|
327
|
+
]);
|
|
328
|
+
var relayExecutionContextEpochs = pgTable5("relay_execution_context_epochs", {
|
|
329
|
+
tenantId: tenantId(),
|
|
330
|
+
executionId: text6("execution_id").$type().notNull(),
|
|
331
|
+
baseline: text6("baseline").notNull(),
|
|
332
|
+
dynamicSourceIdsJson: jsonb5("dynamic_source_ids_json").$type().notNull().default([]),
|
|
333
|
+
openedAt: timestamp5("opened_at", { withTimezone: true }).notNull().defaultNow()
|
|
334
|
+
}, (table) => [primaryKey5({ columns: [table.tenantId, table.executionId], name: "pk_relay_execution_context_epochs" })]);
|
|
335
|
+
var relayExecutions = pgTable5("relay_executions", {
|
|
336
|
+
tenantId: tenantId(),
|
|
337
|
+
id: text6("id").$type().notNull(),
|
|
338
|
+
rootAddressId: text6("root_address_id").$type().notNull(),
|
|
339
|
+
sessionId: text6("session_id").$type(),
|
|
340
|
+
status: text6("status").$type().notNull(),
|
|
341
|
+
agentId: text6("agent_id").$type(),
|
|
342
|
+
agentRevision: integer4("agent_revision").$type(),
|
|
343
|
+
agentSnapshotJson: jsonb5("agent_snapshot_json").$type(),
|
|
344
|
+
agentToolInputSchemaDigestsJson: jsonb5("agent_tool_input_schema_digests_json").$type().notNull().default({}),
|
|
345
|
+
metadataJson: jsonb5("metadata_json").$type().notNull().default({}),
|
|
346
|
+
createdAt: timestamp5("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
347
|
+
updatedAt: timestamp5("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
348
|
+
}, (table) => [
|
|
349
|
+
primaryKey5({ columns: [table.tenantId, table.id], name: "pk_relay_executions" }),
|
|
350
|
+
index3("idx_relay_executions_root_status").on(table.tenantId, table.rootAddressId, table.status),
|
|
351
|
+
index3("idx_relay_executions_session_updated_id").on(table.tenantId, table.sessionId, table.updatedAt, table.id),
|
|
352
|
+
index3("idx_relay_executions_updated_id").on(table.tenantId, table.updatedAt, table.id),
|
|
353
|
+
index3("idx_relay_executions_root_status_updated_id").on(table.tenantId, table.rootAddressId, table.status, table.updatedAt, table.id)
|
|
354
|
+
]);
|
|
355
|
+
var relayChildExecutions = pgTable5("relay_child_executions", {
|
|
356
|
+
tenantId: tenantId(),
|
|
357
|
+
id: text6("id").$type().notNull(),
|
|
358
|
+
executionId: text6("execution_id").$type().notNull(),
|
|
359
|
+
addressId: text6("address_id").$type().notNull(),
|
|
360
|
+
status: text6("status").$type().notNull(),
|
|
361
|
+
metadataJson: jsonb5("metadata_json").$type().notNull().default({}),
|
|
362
|
+
createdAt: timestamp5("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
363
|
+
updatedAt: timestamp5("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
364
|
+
}, (table) => [
|
|
365
|
+
primaryKey5({ columns: [table.tenantId, table.id], name: "pk_relay_child_executions" }),
|
|
366
|
+
index3("idx_relay_child_executions_parent").on(table.tenantId, table.executionId)
|
|
367
|
+
]);
|
|
368
|
+
var relayChildFanOuts = pgTable5("relay_child_fan_outs", {
|
|
369
|
+
tenantId: tenantId(),
|
|
370
|
+
id: text6("id").$type().notNull(),
|
|
371
|
+
parentExecutionId: text6("parent_execution_id").$type().notNull(),
|
|
372
|
+
definitionJson: jsonb5("definition_json").$type().notNull(),
|
|
373
|
+
state: text6("state").$type().notNull().default("joining"),
|
|
374
|
+
satisfiedAt: timestamp5("satisfied_at", { withTimezone: true }),
|
|
375
|
+
failedAt: timestamp5("failed_at", { withTimezone: true }),
|
|
376
|
+
cancelledAt: timestamp5("cancelled_at", { withTimezone: true }),
|
|
377
|
+
createdAt: timestamp5("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
378
|
+
}, (table) => [
|
|
379
|
+
primaryKey5({ columns: [table.tenantId, table.id], name: "pk_relay_child_fan_outs" }),
|
|
380
|
+
index3("idx_relay_child_fan_outs_parent").on(table.tenantId, table.parentExecutionId)
|
|
381
|
+
]);
|
|
382
|
+
var relayChildFanOutMembers = pgTable5("relay_child_fan_out_members", {
|
|
383
|
+
tenantId: tenantId(),
|
|
384
|
+
fanOutId: text6("fan_out_id").$type().notNull(),
|
|
385
|
+
childExecutionId: text6("child_execution_id").$type().notNull(),
|
|
386
|
+
ordinal: integer4("ordinal").notNull(),
|
|
387
|
+
state: text6("state").$type().notNull().default("queued"),
|
|
388
|
+
outputJson: jsonb5("output_json").$type(),
|
|
389
|
+
error: text6("error"),
|
|
390
|
+
completedAt: timestamp5("completed_at", { withTimezone: true })
|
|
391
|
+
}, (table) => [
|
|
392
|
+
primaryKey5({
|
|
393
|
+
columns: [table.tenantId, table.fanOutId, table.childExecutionId],
|
|
394
|
+
name: "pk_relay_child_fan_out_members"
|
|
395
|
+
}),
|
|
396
|
+
uniqueIndex3("uq_relay_child_fan_out_member_ordinal").on(table.tenantId, table.fanOutId, table.ordinal)
|
|
397
|
+
]);
|
|
398
|
+
var relayExecutionEvents = pgTable5("relay_execution_events", {
|
|
399
|
+
tenantId: tenantId(),
|
|
400
|
+
id: text6("id").$type().notNull(),
|
|
401
|
+
executionId: text6("execution_id").$type().notNull(),
|
|
402
|
+
childExecutionId: text6("child_execution_id").$type(),
|
|
403
|
+
type: text6("type").notNull(),
|
|
404
|
+
sequence: integer4("sequence").notNull(),
|
|
405
|
+
cursor: text6("cursor").notNull(),
|
|
406
|
+
contentJson: jsonb5("content_json").$type(),
|
|
407
|
+
dataJson: jsonb5("data_json").$type().notNull().default({}),
|
|
408
|
+
createdAt: timestamp5("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
409
|
+
}, (table) => [
|
|
410
|
+
primaryKey5({ columns: [table.tenantId, table.id], name: "pk_relay_execution_events" }),
|
|
411
|
+
index3("idx_relay_execution_events_execution").on(table.tenantId, table.executionId, table.createdAt),
|
|
412
|
+
uniqueIndex3("uq_relay_execution_events_sequence").on(table.tenantId, table.executionId, table.sequence),
|
|
413
|
+
uniqueIndex3("uq_relay_execution_events_cursor").on(table.tenantId, table.cursor)
|
|
414
|
+
]);
|
|
415
|
+
// ../store-sql/src/schema/communication-schema.ts
|
|
416
|
+
import { index as index4, integer as integer5, jsonb as jsonb6, pgTable as pgTable6, primaryKey as primaryKey6, text as text7, timestamp as timestamp6, uniqueIndex as uniqueIndex4 } from "drizzle-orm/pg-core";
|
|
417
|
+
var relaySteeringMessages = pgTable6("relay_steering_messages", {
|
|
418
|
+
tenantId: tenantId(),
|
|
419
|
+
executionId: text7("execution_id").notNull(),
|
|
420
|
+
kind: text7("kind").notNull(),
|
|
421
|
+
sequence: integer5("sequence").notNull(),
|
|
422
|
+
contentJson: jsonb6("content_json").$type().notNull(),
|
|
423
|
+
drainId: text7("drain_id"),
|
|
424
|
+
consumedAt: timestamp6("consumed_at", { withTimezone: true }),
|
|
425
|
+
createdAt: timestamp6("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
426
|
+
}, (table) => [
|
|
427
|
+
primaryKey6({
|
|
338
428
|
columns: [table.tenantId, table.executionId, table.kind, table.sequence],
|
|
339
429
|
name: "pk_relay_steering_messages"
|
|
340
430
|
}),
|
|
341
|
-
|
|
342
|
-
|
|
431
|
+
index4("idx_relay_steering_messages_unconsumed").on(table.tenantId, table.executionId, table.kind, table.consumedAt, table.sequence),
|
|
432
|
+
index4("idx_relay_steering_messages_drain").on(table.tenantId, table.executionId, table.kind, table.drainId, table.sequence)
|
|
343
433
|
]);
|
|
344
|
-
var relaySteeringDrains =
|
|
434
|
+
var relaySteeringDrains = pgTable6("relay_steering_drains", {
|
|
345
435
|
tenantId: tenantId(),
|
|
346
|
-
executionId:
|
|
347
|
-
kind:
|
|
348
|
-
drainId:
|
|
349
|
-
messageSequencesJson:
|
|
350
|
-
createdAt:
|
|
436
|
+
executionId: text7("execution_id").notNull(),
|
|
437
|
+
kind: text7("kind").notNull(),
|
|
438
|
+
drainId: text7("drain_id").notNull(),
|
|
439
|
+
messageSequencesJson: jsonb6("message_sequences_json").$type().notNull().default([]),
|
|
440
|
+
createdAt: timestamp6("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
351
441
|
}, (table) => [
|
|
352
|
-
|
|
442
|
+
primaryKey6({
|
|
353
443
|
columns: [table.tenantId, table.executionId, table.kind, table.drainId],
|
|
354
444
|
name: "pk_relay_steering_drains"
|
|
355
445
|
})
|
|
356
446
|
]);
|
|
357
|
-
var relayInboxMessages =
|
|
447
|
+
var relayInboxMessages = pgTable6("relay_inbox_messages", {
|
|
358
448
|
tenantId: tenantId(),
|
|
359
|
-
executionId:
|
|
360
|
-
sequence:
|
|
361
|
-
fromAddressId:
|
|
362
|
-
envelopeId:
|
|
363
|
-
contentJson:
|
|
364
|
-
replyWaitId:
|
|
365
|
-
correlationKey:
|
|
366
|
-
idempotencyKey:
|
|
367
|
-
drainId:
|
|
368
|
-
consumedAt:
|
|
369
|
-
metadataJson:
|
|
370
|
-
createdAt:
|
|
449
|
+
executionId: text7("execution_id").$type().notNull(),
|
|
450
|
+
sequence: integer5("sequence").notNull(),
|
|
451
|
+
fromAddressId: text7("from_address_id").$type().notNull(),
|
|
452
|
+
envelopeId: text7("envelope_id").$type(),
|
|
453
|
+
contentJson: jsonb6("content_json").$type().notNull(),
|
|
454
|
+
replyWaitId: text7("reply_wait_id").$type(),
|
|
455
|
+
correlationKey: text7("correlation_key"),
|
|
456
|
+
idempotencyKey: text7("idempotency_key"),
|
|
457
|
+
drainId: text7("drain_id"),
|
|
458
|
+
consumedAt: timestamp6("consumed_at", { withTimezone: true }),
|
|
459
|
+
metadataJson: jsonb6("metadata_json").$type(),
|
|
460
|
+
createdAt: timestamp6("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
371
461
|
}, (table) => [
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
462
|
+
primaryKey6({ columns: [table.tenantId, table.executionId, table.sequence], name: "pk_relay_inbox_messages" }),
|
|
463
|
+
uniqueIndex4("uq_relay_inbox_messages_idempotency").on(table.tenantId, table.executionId, table.idempotencyKey),
|
|
464
|
+
index4("idx_relay_inbox_messages_unconsumed").on(table.tenantId, table.executionId, table.consumedAt, table.sequence),
|
|
465
|
+
index4("idx_relay_inbox_messages_drain").on(table.tenantId, table.executionId, table.drainId, table.sequence)
|
|
376
466
|
]);
|
|
377
|
-
var relayInboxDrains =
|
|
467
|
+
var relayInboxDrains = pgTable6("relay_inbox_drains", {
|
|
378
468
|
tenantId: tenantId(),
|
|
379
|
-
executionId:
|
|
380
|
-
drainId:
|
|
381
|
-
messageSequencesJson:
|
|
382
|
-
createdAt:
|
|
469
|
+
executionId: text7("execution_id").$type().notNull(),
|
|
470
|
+
drainId: text7("drain_id").notNull(),
|
|
471
|
+
messageSequencesJson: jsonb6("message_sequences_json").$type().notNull().default([]),
|
|
472
|
+
createdAt: timestamp6("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
383
473
|
}, (table) => [
|
|
384
|
-
|
|
474
|
+
primaryKey6({ columns: [table.tenantId, table.executionId, table.drainId], name: "pk_relay_inbox_drains" })
|
|
385
475
|
]);
|
|
386
|
-
var relayTopicSubscriptions =
|
|
476
|
+
var relayTopicSubscriptions = pgTable6("relay_topic_subscriptions", {
|
|
387
477
|
tenantId: tenantId(),
|
|
388
|
-
topicAddressId:
|
|
389
|
-
subscriberExecutionId:
|
|
390
|
-
metadataJson:
|
|
391
|
-
createdAt:
|
|
478
|
+
topicAddressId: text7("topic_address_id").$type().notNull(),
|
|
479
|
+
subscriberExecutionId: text7("subscriber_execution_id").$type().notNull(),
|
|
480
|
+
metadataJson: jsonb6("metadata_json").$type(),
|
|
481
|
+
createdAt: timestamp6("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
392
482
|
}, (table) => [
|
|
393
|
-
|
|
483
|
+
primaryKey6({
|
|
394
484
|
columns: [table.tenantId, table.topicAddressId, table.subscriberExecutionId],
|
|
395
485
|
name: "pk_relay_topic_subscriptions"
|
|
396
486
|
}),
|
|
397
|
-
|
|
398
|
-
]);
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
createdAt:
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
tenantId
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
621
|
-
}, (table) => [
|
|
622
|
-
primaryKey({ columns: [table.tenantId, table.id], name: "pk_relay_execution_events" }),
|
|
623
|
-
index("idx_relay_execution_events_execution").on(table.tenantId, table.executionId, table.createdAt),
|
|
624
|
-
uniqueIndex("uq_relay_execution_events_sequence").on(table.tenantId, table.executionId, table.sequence),
|
|
625
|
-
uniqueIndex("uq_relay_execution_events_cursor").on(table.tenantId, table.cursor)
|
|
626
|
-
]);
|
|
627
|
-
var relayPresence = pgTable("relay_presence", {
|
|
628
|
-
tenantId: tenantId(),
|
|
629
|
-
id: text("id").notNull(),
|
|
630
|
-
scopeKind: text("scope_kind").$type().notNull(),
|
|
631
|
-
scopeId: text("scope_id").notNull(),
|
|
632
|
-
metadataJson: jsonb("metadata_json").$type().notNull().default({}),
|
|
633
|
-
connectedAt: timestamp("connected_at", { withTimezone: true }).notNull().defaultNow(),
|
|
634
|
-
expiresAt: timestamp("expires_at", { withTimezone: true }).notNull()
|
|
635
|
-
}, (table) => [
|
|
636
|
-
primaryKey({ columns: [table.tenantId, table.id, table.scopeKind, table.scopeId], name: "pk_relay_presence" }),
|
|
637
|
-
index("idx_relay_presence_scope_expires").on(table.tenantId, table.scopeKind, table.scopeId, table.expiresAt)
|
|
638
|
-
]);
|
|
639
|
-
var relayToolCalls = pgTable("relay_tool_calls", {
|
|
640
|
-
tenantId: tenantId(),
|
|
641
|
-
id: text("id").$type().notNull(),
|
|
642
|
-
executionId: text("execution_id").$type().notNull(),
|
|
643
|
-
name: text("name").notNull(),
|
|
644
|
-
inputJson: jsonb("input_json").notNull(),
|
|
645
|
-
definitionJson: jsonb("definition_json").$type(),
|
|
646
|
-
placementKind: text("placement_kind").$type().notNull().default("local"),
|
|
647
|
-
placementKey: text("placement_key"),
|
|
648
|
-
state: text("state").$type().notNull().default("requested"),
|
|
649
|
-
waitId: text("wait_id").$type(),
|
|
650
|
-
idempotencyKey: text("idempotency_key").notNull(),
|
|
651
|
-
availableAt: timestamp("available_at", { withTimezone: true }).notNull().defaultNow(),
|
|
652
|
-
activeAttemptId: text("active_attempt_id").$type(),
|
|
653
|
-
claimOwner: text("claim_owner"),
|
|
654
|
-
claimedAt: timestamp("claimed_at", { withTimezone: true }),
|
|
655
|
-
claimExpiresAt: timestamp("claim_expires_at", { withTimezone: true }),
|
|
656
|
-
externalOutcomeJson: jsonb("external_outcome_json").$type(),
|
|
657
|
-
externalOutcomeAt: timestamp("external_outcome_at", { withTimezone: true }),
|
|
658
|
-
metadataJson: jsonb("metadata_json").$type().notNull().default({}),
|
|
659
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
660
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
661
|
-
}, (table) => [
|
|
662
|
-
primaryKey({ columns: [table.tenantId, table.executionId, table.id], name: "pk_relay_tool_calls" }),
|
|
663
|
-
index("idx_relay_tool_calls_execution").on(table.tenantId, table.executionId, table.createdAt),
|
|
664
|
-
index("idx_relay_tool_calls_remote_claim").on(table.tenantId, table.placementKind, table.placementKey, table.state, table.availableAt, table.createdAt, table.id),
|
|
665
|
-
index("idx_relay_tool_calls_stale_claim").on(table.tenantId, table.state, table.claimExpiresAt),
|
|
666
|
-
index("idx_relay_tool_calls_client_pending").on(table.tenantId, table.placementKind, table.state, table.createdAt, table.id)
|
|
667
|
-
]);
|
|
668
|
-
var relayToolAttempts = pgTable("relay_tool_attempts", {
|
|
669
|
-
tenantId: tenantId(),
|
|
670
|
-
executionId: text("execution_id").$type().notNull(),
|
|
671
|
-
id: text("id").$type().notNull(),
|
|
672
|
-
toolCallId: text("tool_call_id").$type().notNull(),
|
|
673
|
-
attemptNumber: integer("attempt_number").notNull(),
|
|
674
|
-
state: text("state").$type().notNull(),
|
|
675
|
-
workerId: text("worker_id"),
|
|
676
|
-
claimExpiresAt: timestamp("claim_expires_at", { withTimezone: true }),
|
|
677
|
-
error: text("error"),
|
|
678
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
679
|
-
completedAt: timestamp("completed_at", { withTimezone: true })
|
|
680
|
-
}, (table) => [
|
|
681
|
-
primaryKey({
|
|
487
|
+
index4("idx_relay_topic_subscriptions_subscriber").on(table.tenantId, table.subscriberExecutionId)
|
|
488
|
+
]);
|
|
489
|
+
// ../store-sql/src/schema/session-schema.ts
|
|
490
|
+
import { index as index5, jsonb as jsonb7, pgTable as pgTable7, primaryKey as primaryKey7, text as text8, timestamp as timestamp7 } from "drizzle-orm/pg-core";
|
|
491
|
+
var relaySessions = pgTable7("relay_sessions", {
|
|
492
|
+
tenantId: tenantId(),
|
|
493
|
+
id: text8("id").$type().notNull(),
|
|
494
|
+
rootAddressId: text8("root_address_id").$type().notNull(),
|
|
495
|
+
leafEntryId: text8("leaf_entry_id").$type(),
|
|
496
|
+
metadataJson: jsonb7("metadata_json").$type().notNull().default({}),
|
|
497
|
+
createdAt: timestamp7("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
498
|
+
updatedAt: timestamp7("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
499
|
+
}, (table) => [
|
|
500
|
+
primaryKey7({ columns: [table.tenantId, table.id], name: "pk_relay_sessions" }),
|
|
501
|
+
index5("idx_relay_sessions_updated_id").on(table.tenantId, table.updatedAt, table.id),
|
|
502
|
+
index5("idx_relay_sessions_root_updated_id").on(table.tenantId, table.rootAddressId, table.updatedAt, table.id)
|
|
503
|
+
]);
|
|
504
|
+
var relaySessionEntries = pgTable7("relay_session_entries", {
|
|
505
|
+
tenantId: tenantId(),
|
|
506
|
+
id: text8("id").$type().notNull(),
|
|
507
|
+
sessionId: text8("session_id").$type().notNull(),
|
|
508
|
+
parentId: text8("parent_id").$type(),
|
|
509
|
+
tag: text8("tag").notNull(),
|
|
510
|
+
payloadJson: jsonb7("payload_json").notNull(),
|
|
511
|
+
createdAt: timestamp7("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
512
|
+
}, (table) => [
|
|
513
|
+
primaryKey7({ columns: [table.tenantId, table.id], name: "pk_relay_session_entries" }),
|
|
514
|
+
index5("idx_relay_session_entries_session_created").on(table.tenantId, table.sessionId, table.createdAt, table.id),
|
|
515
|
+
index5("idx_relay_session_entries_session_parent").on(table.tenantId, table.sessionId, table.parentId)
|
|
516
|
+
]);
|
|
517
|
+
// ../store-sql/src/schema/envelope-schema.ts
|
|
518
|
+
import { index as index6, integer as integer6, jsonb as jsonb8, pgTable as pgTable8, primaryKey as primaryKey8, text as text9, timestamp as timestamp8, uniqueIndex as uniqueIndex5 } from "drizzle-orm/pg-core";
|
|
519
|
+
var relayEnvelopes = pgTable8("relay_envelopes", {
|
|
520
|
+
tenantId: tenantId(),
|
|
521
|
+
id: text9("id").$type().notNull(),
|
|
522
|
+
executionId: text9("execution_id").$type().notNull(),
|
|
523
|
+
fromAddressId: text9("from_address_id").$type().notNull(),
|
|
524
|
+
toAddressId: text9("to_address_id").$type().notNull(),
|
|
525
|
+
contentJson: jsonb8("content_json").$type().notNull(),
|
|
526
|
+
waitJson: jsonb8("wait_json").$type(),
|
|
527
|
+
correlationKey: text9("correlation_key"),
|
|
528
|
+
metadataJson: jsonb8("metadata_json").$type().notNull().default({}),
|
|
529
|
+
createdAt: timestamp8("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
530
|
+
}, (table) => [
|
|
531
|
+
primaryKey8({ columns: [table.tenantId, table.id], name: "pk_relay_envelopes" }),
|
|
532
|
+
index6("idx_relay_envelopes_execution").on(table.tenantId, table.executionId, table.createdAt),
|
|
533
|
+
index6("idx_relay_envelopes_to_address").on(table.tenantId, table.toAddressId, table.createdAt)
|
|
534
|
+
]);
|
|
535
|
+
var relayWaits = pgTable8("relay_waits", {
|
|
536
|
+
tenantId: tenantId(),
|
|
537
|
+
id: text9("id").$type().notNull(),
|
|
538
|
+
executionId: text9("execution_id").$type().notNull(),
|
|
539
|
+
envelopeId: text9("envelope_id").$type(),
|
|
540
|
+
mode: text9("mode").$type().notNull(),
|
|
541
|
+
correlationKey: text9("correlation_key"),
|
|
542
|
+
state: text9("state").notNull().default("open"),
|
|
543
|
+
metadataJson: jsonb8("metadata_json").$type().notNull().default({}),
|
|
544
|
+
createdAt: timestamp8("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
545
|
+
resolvedAt: timestamp8("resolved_at", { withTimezone: true })
|
|
546
|
+
}, (table) => [
|
|
547
|
+
primaryKey8({ columns: [table.tenantId, table.id], name: "pk_relay_waits" }),
|
|
548
|
+
index6("idx_relay_waits_execution_state").on(table.tenantId, table.executionId, table.state)
|
|
549
|
+
]);
|
|
550
|
+
var relayEnvelopeReady = pgTable8("relay_envelope_ready", {
|
|
551
|
+
tenantId: tenantId(),
|
|
552
|
+
id: text9("id").$type().notNull(),
|
|
553
|
+
envelopeId: text9("envelope_id").$type().notNull(),
|
|
554
|
+
routeType: text9("route_type").notNull(),
|
|
555
|
+
routeKey: text9("route_key").notNull(),
|
|
556
|
+
state: text9("state").notNull().default("ready"),
|
|
557
|
+
availableAt: timestamp8("available_at", { withTimezone: true }).notNull().defaultNow(),
|
|
558
|
+
attempt: integer6("attempt").notNull().default(0),
|
|
559
|
+
claimOwner: text9("claim_owner"),
|
|
560
|
+
claimExpiresAt: timestamp8("claim_expires_at", { withTimezone: true }),
|
|
561
|
+
lastError: text9("last_error"),
|
|
562
|
+
idempotencyKey: text9("idempotency_key"),
|
|
563
|
+
metadataJson: jsonb8("metadata_json").$type().notNull().default({}),
|
|
564
|
+
createdAt: timestamp8("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
565
|
+
updatedAt: timestamp8("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
566
|
+
claimedAt: timestamp8("claimed_at", { withTimezone: true }),
|
|
567
|
+
acknowledgedAt: timestamp8("acknowledged_at", { withTimezone: true })
|
|
568
|
+
}, (table) => [
|
|
569
|
+
primaryKey8({ columns: [table.tenantId, table.id], name: "pk_relay_envelope_ready" }),
|
|
570
|
+
index6("idx_relay_envelope_ready_state_available").on(table.tenantId, table.state, table.availableAt),
|
|
571
|
+
index6("idx_relay_envelope_ready_claim_expires").on(table.tenantId, table.claimExpiresAt),
|
|
572
|
+
uniqueIndex5("uq_relay_envelope_ready_idempotency").on(table.tenantId, table.idempotencyKey)
|
|
573
|
+
]);
|
|
574
|
+
var relayRouteAttempts = pgTable8("relay_route_attempts", {
|
|
575
|
+
tenantId: tenantId(),
|
|
576
|
+
id: text9("id").notNull(),
|
|
577
|
+
envelopeReadyId: text9("envelope_ready_id").$type().notNull(),
|
|
578
|
+
routeKey: text9("route_key").notNull(),
|
|
579
|
+
state: text9("state").notNull(),
|
|
580
|
+
detail: text9("detail"),
|
|
581
|
+
createdAt: timestamp8("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
582
|
+
}, (table) => [
|
|
583
|
+
primaryKey8({ columns: [table.tenantId, table.id], name: "pk_relay_route_attempts" }),
|
|
584
|
+
index6("idx_relay_route_attempts_ready").on(table.tenantId, table.envelopeReadyId, table.createdAt)
|
|
585
|
+
]);
|
|
586
|
+
// ../store-sql/src/schema/workspace-schema.ts
|
|
587
|
+
import { index as index7, jsonb as jsonb9, pgTable as pgTable9, primaryKey as primaryKey9, text as text10, timestamp as timestamp9, uniqueIndex as uniqueIndex6 } from "drizzle-orm/pg-core";
|
|
588
|
+
import { sql as sql2 } from "drizzle-orm";
|
|
589
|
+
var relayWorkspaceLeases = pgTable9("relay_workspace_leases", {
|
|
590
|
+
tenantId: tenantId(),
|
|
591
|
+
id: text10("id").$type().notNull(),
|
|
592
|
+
executionId: text10("execution_id").$type().notNull(),
|
|
593
|
+
providerKey: text10("provider_key").$type().notNull(),
|
|
594
|
+
sandboxRef: text10("sandbox_ref").$type(),
|
|
595
|
+
latestSnapshotRef: text10("latest_snapshot_ref").$type(),
|
|
596
|
+
status: text10("status").$type().notNull(),
|
|
597
|
+
resumeStrategy: text10("resume_strategy").$type().notNull(),
|
|
598
|
+
region: text10("region"),
|
|
599
|
+
requestJson: jsonb9("request_json").$type(),
|
|
600
|
+
metadataJson: jsonb9("metadata_json").$type().notNull().default({}),
|
|
601
|
+
createdAt: timestamp9("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
602
|
+
updatedAt: timestamp9("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
603
|
+
}, (table) => [
|
|
604
|
+
primaryKey9({ columns: [table.tenantId, table.id], name: "pk_relay_workspace_leases" }),
|
|
605
|
+
uniqueIndex6("uq_relay_workspace_leases_active_execution").on(table.tenantId, table.executionId).where(sql2`${table.status} not in ('released', 'failed')`),
|
|
606
|
+
index7("idx_relay_workspace_leases_execution").on(table.tenantId, table.executionId),
|
|
607
|
+
index7("idx_relay_workspace_leases_status_updated").on(table.tenantId, table.status, table.updatedAt)
|
|
608
|
+
]);
|
|
609
|
+
var relayWorkspaceSnapshots = pgTable9("relay_workspace_snapshots", {
|
|
610
|
+
tenantId: tenantId(),
|
|
611
|
+
id: text10("id").$type().notNull(),
|
|
612
|
+
leaseId: text10("lease_id").$type().notNull(),
|
|
613
|
+
executionId: text10("execution_id").$type().notNull(),
|
|
614
|
+
reason: text10("reason").$type().notNull(),
|
|
615
|
+
snapshotRef: text10("snapshot_ref").$type().notNull(),
|
|
616
|
+
metadataJson: jsonb9("metadata_json").$type().notNull().default({}),
|
|
617
|
+
createdAt: timestamp9("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
618
|
+
}, (table) => [
|
|
619
|
+
primaryKey9({ columns: [table.tenantId, table.id], name: "pk_relay_workspace_snapshots" }),
|
|
620
|
+
index7("idx_relay_workspace_snapshots_lease").on(table.tenantId, table.leaseId, table.createdAt),
|
|
621
|
+
index7("idx_relay_workspace_snapshots_execution").on(table.tenantId, table.executionId, table.createdAt)
|
|
622
|
+
]);
|
|
623
|
+
// ../store-sql/src/schema/schedule-schema.ts
|
|
624
|
+
import { index as index8, integer as integer7, jsonb as jsonb10, pgTable as pgTable10, primaryKey as primaryKey10, text as text11, timestamp as timestamp10, uniqueIndex as uniqueIndex7 } from "drizzle-orm/pg-core";
|
|
625
|
+
var relaySchedules = pgTable10("relay_schedules", {
|
|
626
|
+
tenantId: tenantId(),
|
|
627
|
+
id: text11("id").$type().notNull(),
|
|
628
|
+
kind: text11("kind").notNull(),
|
|
629
|
+
targetKind: text11("target_kind").notNull(),
|
|
630
|
+
addressId: text11("address_id").$type(),
|
|
631
|
+
waitId: text11("wait_id").$type(),
|
|
632
|
+
cronExpr: text11("cron_expr"),
|
|
633
|
+
inputJson: jsonb10("input_json").$type(),
|
|
634
|
+
state: text11("state").notNull().default("active"),
|
|
635
|
+
nextRunAt: timestamp10("next_run_at", { withTimezone: true }).notNull(),
|
|
636
|
+
attempt: integer7("attempt").notNull().default(0),
|
|
637
|
+
claimOwner: text11("claim_owner"),
|
|
638
|
+
claimExpiresAt: timestamp10("claim_expires_at", { withTimezone: true }),
|
|
639
|
+
lastError: text11("last_error"),
|
|
640
|
+
idempotencyKey: text11("idempotency_key"),
|
|
641
|
+
metadataJson: jsonb10("metadata_json").$type().notNull().default({}),
|
|
642
|
+
createdAt: timestamp10("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
643
|
+
updatedAt: timestamp10("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
644
|
+
}, (table) => [
|
|
645
|
+
primaryKey10({ columns: [table.tenantId, table.id], name: "pk_relay_schedules" }),
|
|
646
|
+
index8("idx_relay_schedules_state_next_run").on(table.tenantId, table.state, table.nextRunAt),
|
|
647
|
+
index8("idx_relay_schedules_claim_expires").on(table.tenantId, table.claimExpiresAt),
|
|
648
|
+
index8("idx_relay_schedules_wait").on(table.tenantId, table.waitId),
|
|
649
|
+
uniqueIndex7("uq_relay_schedules_idempotency").on(table.tenantId, table.idempotencyKey)
|
|
650
|
+
]);
|
|
651
|
+
// ../store-sql/src/schema/presence-schema.ts
|
|
652
|
+
import { index as index9, jsonb as jsonb11, pgTable as pgTable11, primaryKey as primaryKey11, text as text12, timestamp as timestamp11 } from "drizzle-orm/pg-core";
|
|
653
|
+
var relayPresence = pgTable11("relay_presence", {
|
|
654
|
+
tenantId: tenantId(),
|
|
655
|
+
id: text12("id").notNull(),
|
|
656
|
+
scopeKind: text12("scope_kind").$type().notNull(),
|
|
657
|
+
scopeId: text12("scope_id").notNull(),
|
|
658
|
+
metadataJson: jsonb11("metadata_json").$type().notNull().default({}),
|
|
659
|
+
connectedAt: timestamp11("connected_at", { withTimezone: true }).notNull().defaultNow(),
|
|
660
|
+
expiresAt: timestamp11("expires_at", { withTimezone: true }).notNull()
|
|
661
|
+
}, (table) => [
|
|
662
|
+
primaryKey11({ columns: [table.tenantId, table.id, table.scopeKind, table.scopeId], name: "pk_relay_presence" }),
|
|
663
|
+
index9("idx_relay_presence_scope_expires").on(table.tenantId, table.scopeKind, table.scopeId, table.expiresAt)
|
|
664
|
+
]);
|
|
665
|
+
// ../store-sql/src/schema/tool-schema.ts
|
|
666
|
+
import { index as index10, integer as integer8, jsonb as jsonb12, pgTable as pgTable12, primaryKey as primaryKey12, text as text13, timestamp as timestamp12, uniqueIndex as uniqueIndex8 } from "drizzle-orm/pg-core";
|
|
667
|
+
var relayToolCalls = pgTable12("relay_tool_calls", {
|
|
668
|
+
tenantId: tenantId(),
|
|
669
|
+
id: text13("id").$type().notNull(),
|
|
670
|
+
executionId: text13("execution_id").$type().notNull(),
|
|
671
|
+
name: text13("name").notNull(),
|
|
672
|
+
inputJson: jsonb12("input_json").notNull(),
|
|
673
|
+
definitionJson: jsonb12("definition_json").$type(),
|
|
674
|
+
placementKind: text13("placement_kind").$type().notNull().default("local"),
|
|
675
|
+
placementKey: text13("placement_key"),
|
|
676
|
+
state: text13("state").$type().notNull().default("requested"),
|
|
677
|
+
waitId: text13("wait_id").$type(),
|
|
678
|
+
idempotencyKey: text13("idempotency_key").notNull(),
|
|
679
|
+
availableAt: timestamp12("available_at", { withTimezone: true }).notNull().defaultNow(),
|
|
680
|
+
activeAttemptId: text13("active_attempt_id").$type(),
|
|
681
|
+
claimOwner: text13("claim_owner"),
|
|
682
|
+
claimedAt: timestamp12("claimed_at", { withTimezone: true }),
|
|
683
|
+
claimExpiresAt: timestamp12("claim_expires_at", { withTimezone: true }),
|
|
684
|
+
externalOutcomeJson: jsonb12("external_outcome_json").$type(),
|
|
685
|
+
externalOutcomeAt: timestamp12("external_outcome_at", { withTimezone: true }),
|
|
686
|
+
metadataJson: jsonb12("metadata_json").$type().notNull().default({}),
|
|
687
|
+
createdAt: timestamp12("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
688
|
+
updatedAt: timestamp12("updated_at", { withTimezone: true }).notNull().defaultNow()
|
|
689
|
+
}, (table) => [
|
|
690
|
+
primaryKey12({ columns: [table.tenantId, table.executionId, table.id], name: "pk_relay_tool_calls" }),
|
|
691
|
+
index10("idx_relay_tool_calls_execution").on(table.tenantId, table.executionId, table.createdAt),
|
|
692
|
+
index10("idx_relay_tool_calls_remote_claim").on(table.tenantId, table.placementKind, table.placementKey, table.state, table.availableAt, table.createdAt, table.id),
|
|
693
|
+
index10("idx_relay_tool_calls_stale_claim").on(table.tenantId, table.state, table.claimExpiresAt),
|
|
694
|
+
index10("idx_relay_tool_calls_client_pending").on(table.tenantId, table.placementKind, table.state, table.createdAt, table.id)
|
|
695
|
+
]);
|
|
696
|
+
var relayToolAttempts = pgTable12("relay_tool_attempts", {
|
|
697
|
+
tenantId: tenantId(),
|
|
698
|
+
executionId: text13("execution_id").$type().notNull(),
|
|
699
|
+
id: text13("id").$type().notNull(),
|
|
700
|
+
toolCallId: text13("tool_call_id").$type().notNull(),
|
|
701
|
+
attemptNumber: integer8("attempt_number").notNull(),
|
|
702
|
+
state: text13("state").$type().notNull(),
|
|
703
|
+
workerId: text13("worker_id"),
|
|
704
|
+
claimExpiresAt: timestamp12("claim_expires_at", { withTimezone: true }),
|
|
705
|
+
error: text13("error"),
|
|
706
|
+
createdAt: timestamp12("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
707
|
+
completedAt: timestamp12("completed_at", { withTimezone: true })
|
|
708
|
+
}, (table) => [
|
|
709
|
+
primaryKey12({
|
|
682
710
|
columns: [table.tenantId, table.executionId, table.toolCallId, table.id],
|
|
683
711
|
name: "pk_relay_tool_attempts"
|
|
684
712
|
}),
|
|
685
|
-
|
|
686
|
-
|
|
713
|
+
uniqueIndex8("uq_relay_tool_attempts_number").on(table.tenantId, table.executionId, table.toolCallId, table.attemptNumber),
|
|
714
|
+
index10("idx_relay_tool_attempts_call").on(table.tenantId, table.executionId, table.toolCallId, table.attemptNumber)
|
|
687
715
|
]);
|
|
688
|
-
var relayToolResults =
|
|
716
|
+
var relayToolResults = pgTable12("relay_tool_results", {
|
|
689
717
|
tenantId: tenantId(),
|
|
690
|
-
executionId:
|
|
691
|
-
toolCallId:
|
|
692
|
-
outputJson:
|
|
693
|
-
error:
|
|
694
|
-
metadataJson:
|
|
695
|
-
createdAt:
|
|
718
|
+
executionId: text13("execution_id").$type().notNull(),
|
|
719
|
+
toolCallId: text13("tool_call_id").$type().notNull(),
|
|
720
|
+
outputJson: jsonb12("output_json").notNull(),
|
|
721
|
+
error: text13("error"),
|
|
722
|
+
metadataJson: jsonb12("metadata_json").$type().notNull().default({}),
|
|
723
|
+
createdAt: timestamp12("created_at", { withTimezone: true }).notNull().defaultNow()
|
|
696
724
|
}, (table) => [
|
|
697
|
-
|
|
725
|
+
primaryKey12({
|
|
698
726
|
columns: [table.tenantId, table.executionId, table.toolCallId],
|
|
699
727
|
name: "pk_relay_tool_results"
|
|
700
728
|
})
|
|
701
729
|
]);
|
|
702
|
-
|
|
730
|
+
// ../store-sql/src/schema/idempotency-schema.ts
|
|
731
|
+
import { jsonb as jsonb13, pgTable as pgTable13, primaryKey as primaryKey13, text as text14, timestamp as timestamp13, uniqueIndex as uniqueIndex9 } from "drizzle-orm/pg-core";
|
|
732
|
+
var relayIdempotencyKeys = pgTable13("relay_idempotency_keys", {
|
|
703
733
|
tenantId: tenantId(),
|
|
704
|
-
id:
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
]);
|
|
714
|
-
var relayIdempotencyKeys = pgTable("relay_idempotency_keys", {
|
|
715
|
-
tenantId: tenantId(),
|
|
716
|
-
id: text("id").notNull(),
|
|
717
|
-
scope: text("scope").notNull(),
|
|
718
|
-
operation: text("operation").notNull(),
|
|
719
|
-
key: text("key").notNull(),
|
|
720
|
-
resultJson: jsonb("result_json").$type(),
|
|
721
|
-
metadataJson: jsonb("metadata_json").$type().notNull().default({}),
|
|
722
|
-
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
723
|
-
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
724
|
-
expiresAt: timestamp("expires_at", { withTimezone: true })
|
|
734
|
+
id: text14("id").notNull(),
|
|
735
|
+
scope: text14("scope").notNull(),
|
|
736
|
+
operation: text14("operation").notNull(),
|
|
737
|
+
key: text14("key").notNull(),
|
|
738
|
+
resultJson: jsonb13("result_json").$type(),
|
|
739
|
+
metadataJson: jsonb13("metadata_json").$type().notNull().default({}),
|
|
740
|
+
createdAt: timestamp13("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
741
|
+
updatedAt: timestamp13("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
742
|
+
expiresAt: timestamp13("expires_at", { withTimezone: true })
|
|
725
743
|
}, (table) => [
|
|
726
|
-
|
|
727
|
-
|
|
744
|
+
primaryKey13({ columns: [table.tenantId, table.id], name: "pk_relay_idempotency_keys" }),
|
|
745
|
+
uniqueIndex9("uq_relay_idempotency_scope_operation_key").on(table.tenantId, table.scope, table.operation, table.key)
|
|
728
746
|
]);
|
|
729
747
|
// src/postgres.ts
|
|
730
|
-
var schemaHead = "
|
|
748
|
+
var schemaHead = "20260719120000_rename_entity_to_resident";
|
|
731
749
|
var migrationNames = [
|
|
732
750
|
"20260701002839_sour_cerebro",
|
|
733
751
|
"20260701041134_acoustic_hulk",
|
|
@@ -754,6 +772,7 @@ var migrationNames = [
|
|
|
754
772
|
"20260712180000_child_fan_out",
|
|
755
773
|
"20260712190000_workflow_definitions",
|
|
756
774
|
"20260712200000_workflow_runtime",
|
|
775
|
+
"20260718140000_execution_scoped_tool_calls",
|
|
757
776
|
schemaHead
|
|
758
777
|
];
|
|
759
778
|
var migrationsFolderUrl = import.meta.url.endsWith("/src/postgres.ts") ? new URL("../../../migrations/pg", import.meta.url) : new URL("./migrations/pg", import.meta.url);
|