@relayfx/sdk 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/ai.js +1 -1
  2. package/dist/http-server.js +1 -1
  3. package/dist/{index-mtvz1bjn.js → index-3w6txjtg.js} +63 -426
  4. package/dist/{index-2vsf6dks.js → index-cs3be24t.js} +1 -1
  5. package/dist/{index-e02krw55.js → index-p43mg4kt.js} +5882 -5127
  6. package/dist/{index-8fpd6kvj.js → index-x32kbvxv.js} +1004 -970
  7. package/dist/index.js +487 -22
  8. package/dist/migrations/20260719120000_rename_entity_to_resident/migration.sql +9 -0
  9. package/dist/migrations/mysql/0012_rename_entity_to_resident.sql +5 -0
  10. package/dist/migrations/pg/20260719120000_rename_entity_to_resident/migration.sql +9 -0
  11. package/dist/migrations/sqlite/0012_rename_entity_to_resident.sql +7 -0
  12. package/dist/mysql.js +18 -5
  13. package/dist/postgres.js +569 -550
  14. package/dist/sqlite.js +16 -5
  15. package/dist/types/relay/client-baton-agent.d.ts +30 -0
  16. package/dist/types/relay/client-child-runs.d.ts +35 -0
  17. package/dist/types/relay/client-error-mapping.d.ts +5 -0
  18. package/dist/types/relay/client-event-sequence.d.ts +3 -0
  19. package/dist/types/relay/client-execution-payloads.d.ts +12 -0
  20. package/dist/types/relay/client-public-agents.d.ts +15 -0
  21. package/dist/types/relay/client-public-child-runs.d.ts +9 -0
  22. package/dist/types/relay/client-public-envelope-ready.d.ts +6 -0
  23. package/dist/types/relay/client-public-executions.d.ts +247 -0
  24. package/dist/types/relay/client-public-messaging.d.ts +18 -0
  25. package/dist/types/relay/client-public-residents.d.ts +14 -0
  26. package/dist/types/relay/client-public-schedules.d.ts +6 -0
  27. package/dist/types/relay/client-public-tools.d.ts +12 -0
  28. package/dist/types/relay/client-public-workflows.d.ts +10 -0
  29. package/dist/types/relay/client-public.d.ts +133 -313
  30. package/dist/types/relay/client-runtime-wake.d.ts +10 -0
  31. package/dist/types/relay/client-tool-outcome.d.ts +16 -0
  32. package/dist/types/relay/client-view-mappers.d.ts +16 -0
  33. package/dist/types/relay/client-wait-signal.d.ts +5 -0
  34. package/dist/types/relay/client.d.ts +118 -1
  35. package/dist/types/relay/command.d.ts +6 -6
  36. package/dist/types/relay/http-server.d.ts +55 -37
  37. package/dist/types/relay/index.d.ts +3 -4
  38. package/dist/types/relay/internal-client.d.ts +5 -5
  39. package/dist/types/relay/mysql-migrations.d.ts +1 -1
  40. package/dist/types/relay/operation.d.ts +44 -41
  41. package/dist/types/relay/sqlite-migrations.d.ts +6 -1
  42. package/dist/types/runtime/address/address-resolution-service.d.ts +3 -0
  43. package/dist/types/runtime/agent/agent-loop-events.d.ts +24 -0
  44. package/dist/types/runtime/agent/relay-tool-executor.d.ts +2 -2
  45. package/dist/types/runtime/agent/sequence-allocator.d.ts +1 -0
  46. package/dist/types/runtime/execution/event-log-memory.d.ts +7 -0
  47. package/dist/types/runtime/execution/event-log-repository.d.ts +8 -0
  48. package/dist/types/runtime/execution/event-log-service.d.ts +3 -1
  49. package/dist/types/runtime/index.d.ts +2 -2
  50. package/dist/types/runtime/resident/resident-instance-service.d.ts +76 -0
  51. package/dist/types/runtime/resident/resident-registry-service.d.ts +35 -0
  52. package/dist/types/runtime/runner/runner-runtime-service.d.ts +14 -14
  53. package/dist/types/runtime/tool/tool-runtime-contract.d.ts +4 -1
  54. package/dist/types/runtime/workflow/execution-workflow-state.d.ts +43 -0
  55. package/dist/types/runtime/workflow/execution-workflow.d.ts +6 -0
  56. package/dist/types/schema/agent-schema.d.ts +24 -0
  57. package/dist/types/schema/execution-schema.d.ts +5 -2
  58. package/dist/types/schema/ids-schema.d.ts +6 -6
  59. package/dist/types/schema/index.d.ts +1 -1
  60. package/dist/types/schema/{entity-schema.d.ts → resident-schema.d.ts} +6 -6
  61. package/dist/types/store-sql/envelope/envelope-ready-records.d.ts +51 -0
  62. package/dist/types/store-sql/envelope/envelope-records.d.ts +43 -0
  63. package/dist/types/store-sql/envelope/envelope-repository.d.ts +1 -2
  64. package/dist/types/store-sql/envelope/wait-records.d.ts +64 -0
  65. package/dist/types/store-sql/execution/execution-event-repository-memory.d.ts +8 -0
  66. package/dist/types/store-sql/execution/execution-event-repository-sql.d.ts +13 -0
  67. package/dist/types/store-sql/execution/execution-event-repository.d.ts +13 -5
  68. package/dist/types/store-sql/index.d.ts +1 -1
  69. package/dist/types/store-sql/portable.d.ts +1 -1
  70. package/dist/types/store-sql/resident/resident-repository.d.ts +36 -0
  71. package/dist/types/store-sql/schema/address-book-schema.d.ts +131 -0
  72. package/dist/types/store-sql/schema/agent-schema.d.ts +954 -0
  73. package/dist/types/store-sql/schema/communication-schema.d.ts +743 -0
  74. package/dist/types/store-sql/schema/envelope-schema.d.ts +701 -0
  75. package/dist/types/store-sql/schema/execution-schema.d.ts +1119 -0
  76. package/dist/types/store-sql/schema/idempotency-schema.d.ts +161 -0
  77. package/dist/types/store-sql/schema/presence-schema.d.ts +116 -0
  78. package/dist/types/store-sql/schema/relay-schema.d.ts +13 -6684
  79. package/dist/types/store-sql/schema/resident-schema.d.ts +294 -0
  80. package/dist/types/store-sql/schema/schedule-schema.d.ts +282 -0
  81. package/dist/types/store-sql/schema/schema-columns.d.ts +1 -0
  82. package/dist/types/store-sql/schema/session-schema.d.ts +228 -0
  83. package/dist/types/store-sql/schema/tool-schema.d.ts +627 -0
  84. package/dist/types/store-sql/schema/workflow-schema.d.ts +996 -0
  85. package/dist/types/store-sql/schema/workspace-schema.d.ts +338 -0
  86. package/dist/types/store-sql/session/session-entry-records.d.ts +52 -0
  87. package/dist/types/store-sql/session/session-records.d.ts +51 -0
  88. package/dist/types/store-sql/session/session-repository.d.ts +2 -3
  89. package/dist/types/store-sql/tool/tool-attempt-records.d.ts +52 -0
  90. package/dist/types/store-sql/tool/tool-call-records.d.ts +121 -0
  91. package/dist/types/store-sql/tool/tool-call-repository.d.ts +1 -2
  92. package/dist/types/store-sql/tool/tool-work-operations.d.ts +11 -0
  93. package/package.json +3 -3
  94. package/dist/types/runtime/entity/entity-instance-service.d.ts +0 -76
  95. package/dist/types/runtime/entity/entity-registry-service.d.ts +0 -35
  96. package/dist/types/store-sql/entity/entity-repository.d.ts +0 -36
@@ -0,0 +1,338 @@
1
+ import { type Workspace } from "../../schema/index";
2
+ export declare const relayWorkspaceLeases: import("drizzle-orm/pg-core").PgTableWithColumns<{
3
+ name: "relay_workspace_leases";
4
+ schema: undefined;
5
+ columns: {
6
+ tenantId: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string & import("effect/Brand").Brand<"Relay.TenantId">>>>, {
7
+ name: string;
8
+ tableName: "relay_workspace_leases";
9
+ dataType: "string";
10
+ data: string & import("effect/Brand").Brand<"Relay.TenantId">;
11
+ driverParam: string;
12
+ notNull: true;
13
+ hasDefault: true;
14
+ isPrimaryKey: false;
15
+ isAutoincrement: false;
16
+ hasRuntimeDefault: false;
17
+ enumValues: undefined;
18
+ identity: undefined;
19
+ generated: undefined;
20
+ }>;
21
+ id: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string & import("effect/Brand").Brand<"Relay.WorkspaceLeaseId">>>, {
22
+ name: string;
23
+ tableName: "relay_workspace_leases";
24
+ dataType: "string";
25
+ data: string & import("effect/Brand").Brand<"Relay.WorkspaceLeaseId">;
26
+ driverParam: string;
27
+ notNull: true;
28
+ hasDefault: false;
29
+ isPrimaryKey: false;
30
+ isAutoincrement: false;
31
+ hasRuntimeDefault: false;
32
+ enumValues: undefined;
33
+ identity: undefined;
34
+ generated: undefined;
35
+ }>;
36
+ executionId: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string & import("effect/Brand").Brand<"Relay.ExecutionId">>>, {
37
+ name: string;
38
+ tableName: "relay_workspace_leases";
39
+ dataType: "string";
40
+ data: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
41
+ driverParam: string;
42
+ notNull: true;
43
+ hasDefault: false;
44
+ isPrimaryKey: false;
45
+ isAutoincrement: false;
46
+ hasRuntimeDefault: false;
47
+ enumValues: undefined;
48
+ identity: undefined;
49
+ generated: undefined;
50
+ }>;
51
+ providerKey: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string>>, {
52
+ name: string;
53
+ tableName: "relay_workspace_leases";
54
+ dataType: "string";
55
+ data: string;
56
+ driverParam: string;
57
+ notNull: true;
58
+ hasDefault: false;
59
+ isPrimaryKey: false;
60
+ isAutoincrement: false;
61
+ hasRuntimeDefault: false;
62
+ enumValues: undefined;
63
+ identity: undefined;
64
+ generated: undefined;
65
+ }>;
66
+ sandboxRef: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string & import("effect/Brand").Brand<"Relay.WorkspaceRef">>, {
67
+ name: string;
68
+ tableName: "relay_workspace_leases";
69
+ dataType: "string";
70
+ data: string & import("effect/Brand").Brand<"Relay.WorkspaceRef">;
71
+ driverParam: string;
72
+ notNull: false;
73
+ hasDefault: false;
74
+ isPrimaryKey: false;
75
+ isAutoincrement: false;
76
+ hasRuntimeDefault: false;
77
+ enumValues: undefined;
78
+ identity: undefined;
79
+ generated: undefined;
80
+ }>;
81
+ latestSnapshotRef: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string & import("effect/Brand").Brand<"Relay.SnapshotRef">>, {
82
+ name: string;
83
+ tableName: "relay_workspace_leases";
84
+ dataType: "string";
85
+ data: string & import("effect/Brand").Brand<"Relay.SnapshotRef">;
86
+ driverParam: string;
87
+ notNull: false;
88
+ hasDefault: false;
89
+ isPrimaryKey: false;
90
+ isAutoincrement: false;
91
+ hasRuntimeDefault: false;
92
+ enumValues: undefined;
93
+ identity: undefined;
94
+ generated: undefined;
95
+ }>;
96
+ status: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, "archived" | "failed" | "planned" | "released" | "running" | "snapshotted" | "suspended">>, {
97
+ name: string;
98
+ tableName: "relay_workspace_leases";
99
+ dataType: "string";
100
+ data: "archived" | "failed" | "planned" | "released" | "running" | "snapshotted" | "suspended";
101
+ driverParam: string;
102
+ notNull: true;
103
+ hasDefault: false;
104
+ isPrimaryKey: false;
105
+ isAutoincrement: false;
106
+ hasRuntimeDefault: false;
107
+ enumValues: undefined;
108
+ identity: undefined;
109
+ generated: undefined;
110
+ }>;
111
+ resumeStrategy: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, "reattach" | "restore_snapshot">>, {
112
+ name: string;
113
+ tableName: "relay_workspace_leases";
114
+ dataType: "string";
115
+ data: "reattach" | "restore_snapshot";
116
+ driverParam: string;
117
+ notNull: true;
118
+ hasDefault: false;
119
+ isPrimaryKey: false;
120
+ isAutoincrement: false;
121
+ hasRuntimeDefault: false;
122
+ enumValues: undefined;
123
+ identity: undefined;
124
+ generated: undefined;
125
+ }>;
126
+ region: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, {
127
+ name: string;
128
+ tableName: "relay_workspace_leases";
129
+ dataType: "string";
130
+ data: string;
131
+ driverParam: string;
132
+ notNull: false;
133
+ hasDefault: false;
134
+ isPrimaryKey: false;
135
+ isAutoincrement: false;
136
+ hasRuntimeDefault: false;
137
+ enumValues: undefined;
138
+ identity: undefined;
139
+ generated: undefined;
140
+ }>;
141
+ requestJson: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, Workspace.WorkspaceRequest | null>, {
142
+ name: string;
143
+ tableName: "relay_workspace_leases";
144
+ dataType: "object json";
145
+ data: Workspace.WorkspaceRequest | null;
146
+ driverParam: unknown;
147
+ notNull: false;
148
+ hasDefault: false;
149
+ isPrimaryKey: false;
150
+ isAutoincrement: false;
151
+ hasRuntimeDefault: false;
152
+ enumValues: undefined;
153
+ identity: undefined;
154
+ generated: undefined;
155
+ }>;
156
+ metadataJson: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, {
157
+ readonly [x: string]: import("effect/Schema").Json;
158
+ }>>>, {
159
+ name: string;
160
+ tableName: "relay_workspace_leases";
161
+ dataType: "object json";
162
+ data: {
163
+ readonly [x: string]: import("effect/Schema").Json;
164
+ };
165
+ driverParam: unknown;
166
+ notNull: true;
167
+ hasDefault: true;
168
+ isPrimaryKey: false;
169
+ isAutoincrement: false;
170
+ hasRuntimeDefault: false;
171
+ enumValues: undefined;
172
+ identity: undefined;
173
+ generated: undefined;
174
+ }>;
175
+ createdAt: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTimestampBuilder>>, {
176
+ name: string;
177
+ tableName: "relay_workspace_leases";
178
+ dataType: "object date";
179
+ data: Date;
180
+ driverParam: string;
181
+ notNull: true;
182
+ hasDefault: true;
183
+ isPrimaryKey: false;
184
+ isAutoincrement: false;
185
+ hasRuntimeDefault: false;
186
+ enumValues: undefined;
187
+ identity: undefined;
188
+ generated: undefined;
189
+ }>;
190
+ updatedAt: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_leases", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTimestampBuilder>>, {
191
+ name: string;
192
+ tableName: "relay_workspace_leases";
193
+ dataType: "object date";
194
+ data: Date;
195
+ driverParam: string;
196
+ notNull: true;
197
+ hasDefault: true;
198
+ isPrimaryKey: false;
199
+ isAutoincrement: false;
200
+ hasRuntimeDefault: false;
201
+ enumValues: undefined;
202
+ identity: undefined;
203
+ generated: undefined;
204
+ }>;
205
+ };
206
+ dialect: 'pg';
207
+ }>;
208
+ export declare const relayWorkspaceSnapshots: import("drizzle-orm/pg-core").PgTableWithColumns<{
209
+ name: "relay_workspace_snapshots";
210
+ schema: undefined;
211
+ columns: {
212
+ tenantId: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_snapshots", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string & import("effect/Brand").Brand<"Relay.TenantId">>>>, {
213
+ name: string;
214
+ tableName: "relay_workspace_snapshots";
215
+ dataType: "string";
216
+ data: string & import("effect/Brand").Brand<"Relay.TenantId">;
217
+ driverParam: string;
218
+ notNull: true;
219
+ hasDefault: true;
220
+ isPrimaryKey: false;
221
+ isAutoincrement: false;
222
+ hasRuntimeDefault: false;
223
+ enumValues: undefined;
224
+ identity: undefined;
225
+ generated: undefined;
226
+ }>;
227
+ id: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_snapshots", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string & import("effect/Brand").Brand<"Relay.WorkspaceSnapshotId">>>, {
228
+ name: string;
229
+ tableName: "relay_workspace_snapshots";
230
+ dataType: "string";
231
+ data: string & import("effect/Brand").Brand<"Relay.WorkspaceSnapshotId">;
232
+ driverParam: string;
233
+ notNull: true;
234
+ hasDefault: false;
235
+ isPrimaryKey: false;
236
+ isAutoincrement: false;
237
+ hasRuntimeDefault: false;
238
+ enumValues: undefined;
239
+ identity: undefined;
240
+ generated: undefined;
241
+ }>;
242
+ leaseId: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_snapshots", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string & import("effect/Brand").Brand<"Relay.WorkspaceLeaseId">>>, {
243
+ name: string;
244
+ tableName: "relay_workspace_snapshots";
245
+ dataType: "string";
246
+ data: string & import("effect/Brand").Brand<"Relay.WorkspaceLeaseId">;
247
+ driverParam: string;
248
+ notNull: true;
249
+ hasDefault: false;
250
+ isPrimaryKey: false;
251
+ isAutoincrement: false;
252
+ hasRuntimeDefault: false;
253
+ enumValues: undefined;
254
+ identity: undefined;
255
+ generated: undefined;
256
+ }>;
257
+ executionId: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_snapshots", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string & import("effect/Brand").Brand<"Relay.ExecutionId">>>, {
258
+ name: string;
259
+ tableName: "relay_workspace_snapshots";
260
+ dataType: "string";
261
+ data: string & import("effect/Brand").Brand<"Relay.ExecutionId">;
262
+ driverParam: string;
263
+ notNull: true;
264
+ hasDefault: false;
265
+ isPrimaryKey: false;
266
+ isAutoincrement: false;
267
+ hasRuntimeDefault: false;
268
+ enumValues: undefined;
269
+ identity: undefined;
270
+ generated: undefined;
271
+ }>;
272
+ reason: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_snapshots", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, "before_child_fork" | "before_wait" | "manual" | "on_complete" | "on_failure">>, {
273
+ name: string;
274
+ tableName: "relay_workspace_snapshots";
275
+ dataType: "string";
276
+ data: "before_child_fork" | "before_wait" | "manual" | "on_complete" | "on_failure";
277
+ driverParam: string;
278
+ notNull: true;
279
+ hasDefault: false;
280
+ isPrimaryKey: false;
281
+ isAutoincrement: false;
282
+ hasRuntimeDefault: false;
283
+ enumValues: undefined;
284
+ identity: undefined;
285
+ generated: undefined;
286
+ }>;
287
+ snapshotRef: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_snapshots", import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgTextBuilder<[string, ...string[]]>, string & import("effect/Brand").Brand<"Relay.SnapshotRef">>>, {
288
+ name: string;
289
+ tableName: "relay_workspace_snapshots";
290
+ dataType: "string";
291
+ data: string & import("effect/Brand").Brand<"Relay.SnapshotRef">;
292
+ driverParam: string;
293
+ notNull: true;
294
+ hasDefault: false;
295
+ isPrimaryKey: false;
296
+ isAutoincrement: false;
297
+ hasRuntimeDefault: false;
298
+ enumValues: undefined;
299
+ identity: undefined;
300
+ generated: undefined;
301
+ }>;
302
+ metadataJson: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_snapshots", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").Set$Type<import("drizzle-orm/pg-core").PgJsonbBuilder, {
303
+ readonly [x: string]: import("effect/Schema").Json;
304
+ }>>>, {
305
+ name: string;
306
+ tableName: "relay_workspace_snapshots";
307
+ dataType: "object json";
308
+ data: {
309
+ readonly [x: string]: import("effect/Schema").Json;
310
+ };
311
+ driverParam: unknown;
312
+ notNull: true;
313
+ hasDefault: true;
314
+ isPrimaryKey: false;
315
+ isAutoincrement: false;
316
+ hasRuntimeDefault: false;
317
+ enumValues: undefined;
318
+ identity: undefined;
319
+ generated: undefined;
320
+ }>;
321
+ createdAt: import("drizzle-orm/pg-core").PgBuildColumn<"relay_workspace_snapshots", import("drizzle-orm/pg-core").SetHasDefault<import("drizzle-orm/pg-core").SetNotNull<import("drizzle-orm/pg-core").PgTimestampBuilder>>, {
322
+ name: string;
323
+ tableName: "relay_workspace_snapshots";
324
+ dataType: "object date";
325
+ data: Date;
326
+ driverParam: string;
327
+ notNull: true;
328
+ hasDefault: true;
329
+ isPrimaryKey: false;
330
+ isAutoincrement: false;
331
+ hasRuntimeDefault: false;
332
+ enumValues: undefined;
333
+ identity: undefined;
334
+ generated: undefined;
335
+ }>;
336
+ };
337
+ dialect: 'pg';
338
+ }>;
@@ -0,0 +1,52 @@
1
+ import { Ids, Shared } from "../../schema/index";
2
+ import { Effect, Schema } from "effect";
3
+ import { Prompt } from "effect/unstable/ai";
4
+ import type { AppendEntryInput, AppendSessionEntryInput, SessionConflict, SessionEntryRecord, SessionRepositoryError } from "./session-repository";
5
+ export declare const sessionEntryRow: Schema.Struct<{
6
+ readonly id: Schema.String;
7
+ readonly session_id: Schema.String;
8
+ readonly parent_id: Schema.Union<readonly [Schema.String, Schema.Null, Schema.Undefined]>;
9
+ readonly tag: Schema.String;
10
+ readonly payload_json: Schema.Unknown;
11
+ readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
12
+ }>;
13
+ declare const appendToRecord: (input: AppendEntryInput) => SessionEntryRecord;
14
+ interface SessionEntryRecordErrors {
15
+ readonly SessionRepositoryError: Schema.Schema<SessionRepositoryError> & {
16
+ readonly make: (input: {
17
+ readonly message: string;
18
+ }) => SessionRepositoryError;
19
+ };
20
+ readonly SessionConflict: {
21
+ readonly make: (input: {
22
+ readonly reason: SessionConflict["reason"];
23
+ readonly message: string;
24
+ }) => SessionConflict;
25
+ };
26
+ }
27
+ export declare const makeSessionEntryRecords: (errors: SessionEntryRecordErrors) => {
28
+ payloadFromInput: (input: AppendSessionEntryInput) => unknown;
29
+ toEntryRecord: (row: typeof sessionEntryRow.Type) => Effect.Effect<SessionEntryRecord, SessionRepositoryError>;
30
+ sameEntry: (left: SessionEntryRecord, right: SessionEntryRecord) => boolean;
31
+ appendToRecord: typeof appendToRecord;
32
+ missingEntry: (id: Ids.SessionEntryId) => SessionRepositoryError;
33
+ conflictingEntry: (id: Ids.SessionEntryId) => SessionRepositoryError;
34
+ conflict: (reason: SessionConflict["reason"], message: string) => SessionConflict;
35
+ cloneEntry: (record: SessionEntryRecord) => SessionEntryRecord;
36
+ cloneCheckpoint: (record: Extract<SessionEntryRecord, {
37
+ readonly _tag: "Compaction";
38
+ readonly version: 2;
39
+ }>) => {
40
+ projectedHistory: Prompt.Prompt;
41
+ id: Ids.SessionEntryId;
42
+ sessionId: Ids.SessionId;
43
+ parentId: Ids.SessionEntryId | null;
44
+ _tag: "Compaction";
45
+ version: 2;
46
+ summary?: string;
47
+ metadata?: Shared.Metadata;
48
+ createdAt: number;
49
+ };
50
+ validateCompaction: (currentPath: ReadonlyArray<SessionEntryRecord>, input: AppendEntryInput) => Effect.Effect<void, SessionRepositoryError>;
51
+ };
52
+ export {};
@@ -0,0 +1,51 @@
1
+ import { Ids, Shared } from "../../schema/index";
2
+ import { Effect, Schema } from "effect";
3
+ import { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ import { sessionEntryRow } from "./session-entry-records";
5
+ import type { DuplicateSession, Interface, ListSessionsInput, SessionConflict, SessionCursor, SessionRecord, SessionRepositoryError } from "./session-repository";
6
+ export declare const sessionRow: Schema.Struct<{
7
+ readonly id: Schema.String;
8
+ readonly root_address_id: Schema.String;
9
+ readonly leaf_entry_id: Schema.Union<readonly [Schema.String, Schema.Null, Schema.Undefined]>;
10
+ readonly metadata_json: Schema.Unknown;
11
+ readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
12
+ readonly updated_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
13
+ }>;
14
+ export declare const metadata: (input: Shared.Metadata | undefined) => {
15
+ readonly [x: string]: Schema.Json;
16
+ };
17
+ export declare const listLimit: (input: ListSessionsInput) => number;
18
+ declare const nextCursorOf: (records: ReadonlyArray<SessionRecord>, fetched: number, limit: number) => SessionCursor | undefined;
19
+ declare const compareDesc: (left: SessionRecord, right: SessionRecord) => number;
20
+ declare const afterCursor: (record: SessionRecord, cursor: SessionCursor | undefined) => boolean;
21
+ export declare const sessionRecordPaging: {
22
+ nextCursorOf: typeof nextCursorOf;
23
+ compareDesc: typeof compareDesc;
24
+ afterCursor: typeof afterCursor;
25
+ };
26
+ interface SessionRecordErrors {
27
+ readonly SessionRepositoryError: Schema.Schema<SessionRepositoryError> & {
28
+ readonly make: (input: {
29
+ readonly message: string;
30
+ }) => SessionRepositoryError;
31
+ };
32
+ readonly DuplicateSession: {
33
+ readonly make: (input: {
34
+ readonly id: Ids.SessionId;
35
+ }) => DuplicateSession;
36
+ };
37
+ readonly SessionConflict: {
38
+ readonly make: (input: {
39
+ readonly reason: SessionConflict["reason"];
40
+ readonly message: string;
41
+ }) => SessionConflict;
42
+ };
43
+ }
44
+ export declare const makeSessionRecordSupport: (errors: SessionRecordErrors) => {
45
+ missingSession: (id: Ids.SessionId) => SessionRepositoryError;
46
+ rootMismatch: (id: Ids.SessionId) => SessionRepositoryError;
47
+ cloneSession: (record: SessionRecord) => SessionRecord;
48
+ currentLeaf: (session: SessionRecord) => Ids.SessionEntryId | null;
49
+ };
50
+ export declare const makeSessionRepository: (errors: SessionRecordErrors) => Effect.Effect<Interface, never, SqlClient>;
51
+ export { sessionEntryRow };
@@ -1,7 +1,6 @@
1
1
  import { Ids, Shared } from "../../schema/index";
2
2
  import { Context, Effect, Layer, Schema } from "effect";
3
3
  import { Prompt } from "effect/unstable/ai";
4
- import { SqlClient } from "effect/unstable/sql/SqlClient";
5
4
  declare const SessionRepositoryError_base: Schema.Class<SessionRepositoryError, Schema.TaggedStruct<"SessionRepositoryError", {
6
5
  readonly message: Schema.String;
7
6
  }>, import("effect/Cause").YieldableError>;
@@ -256,8 +255,8 @@ export declare const SessionEntryRow: Schema.Struct<{
256
255
  readonly payload_json: Schema.Unknown;
257
256
  readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
258
257
  }>;
259
- export declare const layer: Layer.Layer<Service, never, SqlClient>;
260
- export declare const layerFromTenant: Layer.Layer<Service, never, SqlClient>;
258
+ export declare const layer: Layer.Layer<Service, never, import("effect/unstable/sql/SqlClient").SqlClient>;
259
+ export declare const layerFromTenant: Layer.Layer<Service, never, import("effect/unstable/sql/SqlClient").SqlClient>;
261
260
  export declare const memoryLayer: Layer.Layer<Service, never, never>;
262
261
  export declare const testLayer: (implementation: Interface) => Layer.Layer<Service, never, never>;
263
262
  export declare const create: (input: CreateSessionInput) => Effect.Effect<SessionRecord, DuplicateSession | SessionRepositoryError, Service>;
@@ -0,0 +1,52 @@
1
+ import { Effect, Schema } from "effect";
2
+ import type { SqlClient } from "effect/unstable/sql/SqlClient";
3
+ import type { ToolAttemptRecord, ToolCallRepositoryError } from "./tool-call-repository";
4
+ export declare const toolAttemptRow: Schema.Struct<{
5
+ readonly id: Schema.String;
6
+ readonly tool_call_id: Schema.String;
7
+ readonly attempt_number: Schema.Union<readonly [Schema.Finite, Schema.String, Schema.BigInt]>;
8
+ readonly state: Schema.String;
9
+ readonly worker_id: Schema.NullishOr<Schema.String>;
10
+ readonly claim_expires_at: Schema.NullishOr<Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>>;
11
+ readonly error: Schema.NullishOr<Schema.String>;
12
+ readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
13
+ readonly completed_at: Schema.NullishOr<Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>>;
14
+ }>;
15
+ export declare const toolAttemptId: (attemptNumber: number) => string & import("effect/Brand").Brand<"Relay.ToolAttemptId">;
16
+ interface MakeToolAttemptRecordOperationsInput {
17
+ readonly sql: SqlClient;
18
+ readonly ts: (millis: number) => Date | number;
19
+ readonly toRepositoryError: (error: unknown) => ToolCallRepositoryError;
20
+ readonly ToolCallRepositoryError: {
21
+ readonly make: (input: {
22
+ readonly message: string;
23
+ }) => ToolCallRepositoryError;
24
+ };
25
+ }
26
+ export declare const makeToolAttemptRecordOperations: ({ sql, ts, toRepositoryError, ToolCallRepositoryError, }: MakeToolAttemptRecordOperationsInput) => {
27
+ attemptColumns: import("effect/unstable/sql/Statement").Fragment;
28
+ readAttempts: (tenantId: string & import("effect/Brand").Brand<"Relay.TenantId">, executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">, callId: string & import("effect/Brand").Brand<"Relay.ToolCallId">) => Effect.Effect<ToolAttemptRecord[], ToolCallRepositoryError, never>;
29
+ nextAttemptNumber: (tenantId: string & import("effect/Brand").Brand<"Relay.TenantId">, executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">, callId: string & import("effect/Brand").Brand<"Relay.ToolCallId">) => Effect.Effect<number, ToolCallRepositoryError, never>;
30
+ insertAttemptNumber: (tenantId: string & import("effect/Brand").Brand<"Relay.TenantId">, executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">, callId: string & import("effect/Brand").Brand<"Relay.ToolCallId">, attemptNumber: number, createdAt: number, workerId?: string | undefined, claimExpiresAt?: number | undefined) => Effect.Effect<{
31
+ id: string & import("effect/Brand").Brand<"Relay.ToolAttemptId">;
32
+ callId: string & import("effect/Brand").Brand<"Relay.ToolCallId">;
33
+ attemptNumber: number;
34
+ state: "running";
35
+ workerId?: string;
36
+ claimExpiresAt?: number;
37
+ createdAt: number;
38
+ }, ToolCallRepositoryError, never>;
39
+ insertAttempt: (tenantId: string & import("effect/Brand").Brand<"Relay.TenantId">, executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">, callId: string & import("effect/Brand").Brand<"Relay.ToolCallId">, createdAt: number, workerId?: string | undefined, claimExpiresAt?: number | undefined) => Effect.Effect<{
40
+ id: string & import("effect/Brand").Brand<"Relay.ToolAttemptId">;
41
+ callId: string & import("effect/Brand").Brand<"Relay.ToolCallId">;
42
+ attemptNumber: number;
43
+ state: "running";
44
+ workerId?: string;
45
+ claimExpiresAt?: number;
46
+ createdAt: number;
47
+ }, ToolCallRepositoryError, never>;
48
+ loadAttempt: (tenantId: string & import("effect/Brand").Brand<"Relay.TenantId">, executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">, callId: string & import("effect/Brand").Brand<"Relay.ToolCallId">, attemptId: string & import("effect/Brand").Brand<"Relay.ToolAttemptId">) => Effect.Effect<ToolAttemptRecord | undefined, ToolCallRepositoryError, never>;
49
+ completeAttempt: (tenantId: string & import("effect/Brand").Brand<"Relay.TenantId">, executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">, callId: string & import("effect/Brand").Brand<"Relay.ToolCallId">, attemptId: string & import("effect/Brand").Brand<"Relay.ToolAttemptId">, state: "abandoned" | "completed" | "expired" | "failed" | "released", completedAt: number, error?: string | undefined) => Effect.Effect<ToolAttemptRecord, ToolCallRepositoryError, never>;
50
+ };
51
+ export type ToolAttemptRecordOperations = ReturnType<typeof makeToolAttemptRecordOperations>;
52
+ export {};
@@ -0,0 +1,121 @@
1
+ import { Ids, Shared, Tool } from "../../schema/index";
2
+ import { Effect, Schema } from "effect";
3
+ import { SqlClient } from "effect/unstable/sql/SqlClient";
4
+ import { toolAttemptRow } from "./tool-attempt-records";
5
+ import type { DuplicateToolCall, DuplicateToolResult, Interface, RecordCallInput, RecordResultInput, ToolCallConflict, ToolCallNotFound, ToolCallRecord, ToolCallRepositoryError, ToolCallTransitionRejected, ToolClaimRejected, ToolOutcomeConflict } from "./tool-call-repository";
6
+ export declare const toolCallRow: Schema.Struct<{
7
+ readonly id: Schema.String;
8
+ readonly execution_id: Schema.String;
9
+ readonly name: Schema.String;
10
+ readonly input_json: Schema.Unknown;
11
+ readonly definition_json: Schema.NullishOr<Schema.Unknown>;
12
+ readonly placement_kind: Schema.String;
13
+ readonly placement_key: Schema.NullishOr<Schema.String>;
14
+ readonly state: Schema.String;
15
+ readonly wait_id: Schema.NullishOr<Schema.String>;
16
+ readonly idempotency_key: Schema.String;
17
+ readonly available_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
18
+ readonly active_attempt_id: Schema.NullishOr<Schema.String>;
19
+ readonly claim_owner: Schema.NullishOr<Schema.String>;
20
+ readonly claimed_at: Schema.NullishOr<Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>>;
21
+ readonly claim_expires_at: Schema.NullishOr<Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>>;
22
+ readonly external_outcome_json: Schema.NullishOr<Schema.Unknown>;
23
+ readonly external_outcome_at: Schema.NullishOr<Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>>;
24
+ readonly metadata_json: Schema.Unknown;
25
+ readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
26
+ readonly updated_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
27
+ }>;
28
+ export declare const toolResultRow: Schema.Struct<{
29
+ readonly tool_call_id: Schema.String;
30
+ readonly output_json: Schema.Unknown;
31
+ readonly error: Schema.NullishOr<Schema.String>;
32
+ readonly metadata_json: Schema.Unknown;
33
+ readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
34
+ }>;
35
+ export declare const metadata: (input: Shared.Metadata | undefined) => {
36
+ readonly [x: string]: Schema.Json;
37
+ };
38
+ export declare const normalizeCall: (call: Tool.Call) => Tool.Call;
39
+ declare const sameCallIdentity: (left: Tool.Call, right: Tool.Call) => boolean;
40
+ export declare const toolCallRecordIdentity: {
41
+ sameCallIdentity: typeof sameCallIdentity;
42
+ };
43
+ export interface ToolRecordErrors {
44
+ readonly ToolCallRepositoryError: {
45
+ readonly make: (input: {
46
+ readonly message: string;
47
+ }) => ToolCallRepositoryError;
48
+ };
49
+ readonly ToolCallNotFound: {
50
+ readonly make: (input: {
51
+ readonly id: Ids.ToolCallId;
52
+ }) => ToolCallNotFound;
53
+ };
54
+ readonly DuplicateToolCall: {
55
+ readonly make: (input: {
56
+ readonly id: Ids.ToolCallId;
57
+ }) => DuplicateToolCall;
58
+ };
59
+ readonly DuplicateToolResult: {
60
+ readonly make: (input: {
61
+ readonly call_id: Ids.ToolCallId;
62
+ }) => DuplicateToolResult;
63
+ };
64
+ readonly ToolCallConflict: {
65
+ readonly make: (input: {
66
+ readonly id: Ids.ToolCallId;
67
+ }) => ToolCallConflict;
68
+ };
69
+ readonly ToolCallTransitionRejected: {
70
+ readonly make: (input: {
71
+ readonly id: Ids.ToolCallId;
72
+ readonly message: string;
73
+ }) => ToolCallTransitionRejected;
74
+ };
75
+ readonly ToolOutcomeConflict: {
76
+ readonly make: (input: {
77
+ readonly id: Ids.ToolCallId;
78
+ }) => ToolOutcomeConflict;
79
+ };
80
+ readonly ToolClaimRejected: {
81
+ readonly make: (input: {
82
+ readonly message: string;
83
+ }) => ToolClaimRejected;
84
+ };
85
+ }
86
+ interface MakeToolCallRecordSupportInput {
87
+ readonly sql: SqlClient;
88
+ readonly errors: ToolRecordErrors;
89
+ readonly toolCallIdempotencyKey: (tenantId: Ids.TenantId, executionId: Ids.ExecutionId, callId: Ids.ToolCallId) => string;
90
+ }
91
+ export declare const makeToolCallRecordSupport: ({ sql, errors, toolCallIdempotencyKey }: MakeToolCallRecordSupportInput) => {
92
+ sql: SqlClient;
93
+ ts: (millis: number) => number | Date;
94
+ repositoryTransaction: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, ToolCallRepositoryError | Exclude<E, {
95
+ readonly _tag: "SqlError";
96
+ }>, R>;
97
+ callColumns: import("effect/unstable/sql/Statement").Fragment;
98
+ selectCallByKey: (tenantId: Ids.TenantId, executionId: Ids.ExecutionId, id: Ids.ToolCallId) => import("effect/unstable/sql/Statement").Statement<import("effect/unstable/sql/SqlConnection").Row>;
99
+ selectResultByKey: (tenantId: Ids.TenantId, executionId: Ids.ExecutionId, callId: Ids.ToolCallId) => import("effect/unstable/sql/Statement").Statement<import("effect/unstable/sql/SqlConnection").Row>;
100
+ insertCallIgnore: ((tenantId: Ids.TenantId, input: RecordCallInput, definition?: Tool.Definition, placement?: Tool.Placement) => import("effect/unstable/sql/Statement").Statement<import("effect/unstable/sql/SqlConnection").Row>) | ((tenantId: Ids.TenantId, input: RecordCallInput, definition?: Tool.Definition, placement?: Tool.Placement) => import("effect/unstable/sql/Statement").Statement<import("effect/unstable/sql/SqlConnection").Row>);
101
+ insertCall: ((tenantId: Ids.TenantId, input: RecordCallInput, definition?: Tool.Definition, placement?: Tool.Placement) => Effect.Effect<readonly import("effect/unstable/sql/SqlConnection").Row[], import("effect/unstable/sql/SqlError").SqlError, never>) | ((tenantId: Ids.TenantId, input: RecordCallInput, definition?: Tool.Definition, placement?: Tool.Placement) => import("effect/unstable/sql/Statement").Statement<import("effect/unstable/sql/SqlConnection").Row>);
102
+ insertResultStatement: (tenantId: Ids.TenantId, input: RecordResultInput) => import("effect/unstable/sql/Statement").Statement<import("effect/unstable/sql/SqlConnection").Row>;
103
+ lockedCallRows: ((tenantId: Ids.TenantId, executionId: Ids.ExecutionId, id: Ids.ToolCallId) => import("effect/unstable/sql/Statement").Statement<import("effect/unstable/sql/SqlConnection").Row>) | ((tenantId: Ids.TenantId, executionId: Ids.ExecutionId, callId: Ids.ToolCallId) => import("effect/unstable/sql/Statement").Statement<import("effect/unstable/sql/SqlConnection").Row>) | ((tenantId: Ids.TenantId, executionId: Ids.ExecutionId, callId: Ids.ToolCallId) => import("effect/unstable/sql/Statement").Statement<import("effect/unstable/sql/SqlConnection").Row>);
104
+ decodeResultRow: (row: unknown) => Effect.Effect<Schema.Struct.ReadonlySide<{
105
+ readonly tool_call_id: Schema.String;
106
+ readonly output_json: Schema.Unknown;
107
+ readonly error: Schema.NullishOr<Schema.String>;
108
+ readonly metadata_json: Schema.Unknown;
109
+ readonly created_at: Schema.Union<readonly [Schema.Date, Schema.String, Schema.Finite]>;
110
+ }, "Type">, ToolCallRepositoryError, never>;
111
+ decodeCall: (row: unknown) => Effect.Effect<ToolCallRecord, ToolCallRepositoryError, never>;
112
+ readLockedCall: (tenantId: string & import("effect/Brand").Brand<"Relay.TenantId">, executionId: string & import("effect/Brand").Brand<"Relay.ExecutionId">, callId: string & import("effect/Brand").Brand<"Relay.ToolCallId">) => Effect.Effect<ToolCallRecord, ToolCallNotFound | ToolCallRepositoryError, never>;
113
+ toRepositoryError: (error: unknown) => ToolCallRepositoryError;
114
+ };
115
+ export type ToolCallRecordSupport = ReturnType<typeof makeToolCallRecordSupport>;
116
+ interface MakeToolCallRepositoryInput {
117
+ readonly errors: ToolRecordErrors;
118
+ readonly toolCallIdempotencyKey: (tenantId: Ids.TenantId, executionId: Ids.ExecutionId, callId: Ids.ToolCallId) => string;
119
+ }
120
+ export declare const makeToolCallRepository: ({ errors, toolCallIdempotencyKey, }: MakeToolCallRepositoryInput) => Effect.Effect<Interface, never, SqlClient>;
121
+ export { toolAttemptRow };