@sealkeeper/schema 0.4.3 → 0.4.5

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 (54) hide show
  1. package/dist/agent-name.d.ts +1 -1
  2. package/dist/agent-name.js +4 -4
  3. package/dist/api.d.ts +744 -27
  4. package/dist/api.js +232 -43
  5. package/dist/badge.d.ts +1 -0
  6. package/dist/badge.js +7 -0
  7. package/dist/credential.d.ts +186 -1
  8. package/dist/credential.js +55 -8
  9. package/dist/db/agents.d.ts +70 -0
  10. package/dist/db/agents.js +18 -0
  11. package/dist/db/client.d.ts +398 -0
  12. package/dist/db/client.js +2 -0
  13. package/dist/db/events.js +7 -0
  14. package/dist/db/index.d.ts +17 -1
  15. package/dist/db/index.js +5 -1
  16. package/dist/db/migrate.js +5 -1
  17. package/dist/db/migrator.d.ts +3 -1
  18. package/dist/db/migrator.js +8 -2
  19. package/dist/db/operator-identities.d.ts +211 -0
  20. package/dist/db/operator-identities.js +49 -0
  21. package/dist/db/operator-level-grants.d.ts +109 -0
  22. package/dist/db/operator-level-grants.js +30 -0
  23. package/dist/db/operator-slugs.d.ts +92 -0
  24. package/dist/db/operator-slugs.js +25 -0
  25. package/dist/db/operators.d.ts +119 -0
  26. package/dist/db/operators.js +30 -2
  27. package/dist/db/standing.d.ts +36 -0
  28. package/dist/db/standing.js +5 -0
  29. package/dist/db/task-claim-failures.d.ts +143 -0
  30. package/dist/db/task-claim-failures.js +37 -0
  31. package/dist/db/task-outcomes.d.ts +19 -0
  32. package/dist/db/task-outcomes.js +8 -1
  33. package/dist/db/tasks.d.ts +79 -0
  34. package/dist/db/tasks.js +19 -1
  35. package/dist/envelope.d.ts +3 -0
  36. package/dist/envelope.js +16 -11
  37. package/dist/goal.d.ts +149 -0
  38. package/dist/goal.js +171 -0
  39. package/dist/index.d.ts +6 -0
  40. package/dist/index.js +6 -0
  41. package/dist/moderation.d.ts +28 -0
  42. package/dist/moderation.js +450 -0
  43. package/dist/operator-domains.d.ts +104 -0
  44. package/dist/operator-domains.js +85 -0
  45. package/dist/policy.d.ts +4 -0
  46. package/dist/policy.js +10 -0
  47. package/dist/runtime.d.ts +17 -0
  48. package/dist/runtime.js +61 -0
  49. package/dist/seal-conformance.js +32 -1
  50. package/dist/standing.d.ts +68 -0
  51. package/dist/standing.js +132 -6
  52. package/dist/tasks.d.ts +23 -1
  53. package/dist/tasks.js +29 -5
  54. package/package.json +1 -1
@@ -92,6 +92,91 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
92
92
  identity: undefined;
93
93
  generated: undefined;
94
94
  }, {}, {}>;
95
+ slug: import("drizzle-orm/pg-core").PgColumn<{
96
+ name: "slug";
97
+ tableName: "operators";
98
+ dataType: "string";
99
+ columnType: "PgText";
100
+ data: string;
101
+ driverParam: string;
102
+ notNull: true;
103
+ hasDefault: false;
104
+ isPrimaryKey: false;
105
+ isAutoincrement: false;
106
+ hasRuntimeDefault: false;
107
+ enumValues: [string, ...string[]];
108
+ baseColumn: never;
109
+ identity: undefined;
110
+ generated: undefined;
111
+ }, {}, {}>;
112
+ displayName: import("drizzle-orm/pg-core").PgColumn<{
113
+ name: "display_name";
114
+ tableName: "operators";
115
+ dataType: "string";
116
+ columnType: "PgText";
117
+ data: string;
118
+ driverParam: string;
119
+ notNull: true;
120
+ hasDefault: false;
121
+ isPrimaryKey: false;
122
+ isAutoincrement: false;
123
+ hasRuntimeDefault: false;
124
+ enumValues: [string, ...string[]];
125
+ baseColumn: never;
126
+ identity: undefined;
127
+ generated: undefined;
128
+ }, {}, {}>;
129
+ displayNameKey: import("drizzle-orm/pg-core").PgColumn<{
130
+ name: "display_name_key";
131
+ tableName: "operators";
132
+ dataType: "string";
133
+ columnType: "PgText";
134
+ data: string;
135
+ driverParam: string;
136
+ notNull: true;
137
+ hasDefault: false;
138
+ isPrimaryKey: false;
139
+ isAutoincrement: false;
140
+ hasRuntimeDefault: false;
141
+ enumValues: [string, ...string[]];
142
+ baseColumn: never;
143
+ identity: undefined;
144
+ generated: undefined;
145
+ }, {}, {}>;
146
+ slugChangedAt: import("drizzle-orm/pg-core").PgColumn<{
147
+ name: "slug_changed_at";
148
+ tableName: "operators";
149
+ dataType: "date";
150
+ columnType: "PgTimestamp";
151
+ data: Date;
152
+ driverParam: string;
153
+ notNull: false;
154
+ hasDefault: false;
155
+ isPrimaryKey: false;
156
+ isAutoincrement: false;
157
+ hasRuntimeDefault: false;
158
+ enumValues: undefined;
159
+ baseColumn: never;
160
+ identity: undefined;
161
+ generated: undefined;
162
+ }, {}, {}>;
163
+ slugNoticeDismissedAt: import("drizzle-orm/pg-core").PgColumn<{
164
+ name: "slug_notice_dismissed_at";
165
+ tableName: "operators";
166
+ dataType: "date";
167
+ columnType: "PgTimestamp";
168
+ data: Date;
169
+ driverParam: string;
170
+ notNull: false;
171
+ hasDefault: false;
172
+ isPrimaryKey: false;
173
+ isAutoincrement: false;
174
+ hasRuntimeDefault: false;
175
+ enumValues: undefined;
176
+ baseColumn: never;
177
+ identity: undefined;
178
+ generated: undefined;
179
+ }, {}, {}>;
95
180
  accountCreatedAt: import("drizzle-orm/pg-core").PgColumn<{
96
181
  name: "account_created_at";
97
182
  tableName: "operators";
@@ -109,6 +194,40 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
109
194
  identity: undefined;
110
195
  generated: undefined;
111
196
  }, {}, {}>;
197
+ termsVersion: import("drizzle-orm/pg-core").PgColumn<{
198
+ name: "terms_version";
199
+ tableName: "operators";
200
+ dataType: "string";
201
+ columnType: "PgText";
202
+ data: string;
203
+ driverParam: string;
204
+ notNull: false;
205
+ hasDefault: false;
206
+ isPrimaryKey: false;
207
+ isAutoincrement: false;
208
+ hasRuntimeDefault: false;
209
+ enumValues: [string, ...string[]];
210
+ baseColumn: never;
211
+ identity: undefined;
212
+ generated: undefined;
213
+ }, {}, {}>;
214
+ privacyVersion: import("drizzle-orm/pg-core").PgColumn<{
215
+ name: "privacy_version";
216
+ tableName: "operators";
217
+ dataType: "string";
218
+ columnType: "PgText";
219
+ data: string;
220
+ driverParam: string;
221
+ notNull: false;
222
+ hasDefault: false;
223
+ isPrimaryKey: false;
224
+ isAutoincrement: false;
225
+ hasRuntimeDefault: false;
226
+ enumValues: [string, ...string[]];
227
+ baseColumn: never;
228
+ identity: undefined;
229
+ generated: undefined;
230
+ }, {}, {}>;
112
231
  };
113
232
  dialect: 'pg';
114
233
  }>;
@@ -252,6 +371,42 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
252
371
  identity: undefined;
253
372
  generated: undefined;
254
373
  }, {}, {}>;
374
+ runtime: import("drizzle-orm/pg-core").PgColumn<{
375
+ name: "runtime";
376
+ tableName: "agents";
377
+ dataType: "string";
378
+ columnType: "PgText";
379
+ data: "claude-code" | "codex" | "cursor" | "gemini-cli" | "mastra" | "openclaw" | "other" | "unknown";
380
+ driverParam: string;
381
+ notNull: true;
382
+ hasDefault: true;
383
+ isPrimaryKey: false;
384
+ isAutoincrement: false;
385
+ hasRuntimeDefault: false;
386
+ enumValues: [string, ...string[]];
387
+ baseColumn: never;
388
+ identity: undefined;
389
+ generated: undefined;
390
+ }, {}, {
391
+ $type: "claude-code" | "codex" | "cursor" | "gemini-cli" | "mastra" | "openclaw" | "other" | "unknown";
392
+ }>;
393
+ runtimeIssuedAt: import("drizzle-orm/pg-core").PgColumn<{
394
+ name: "runtime_issued_at";
395
+ tableName: "agents";
396
+ dataType: "date";
397
+ columnType: "PgTimestamp";
398
+ data: Date;
399
+ driverParam: string;
400
+ notNull: false;
401
+ hasDefault: false;
402
+ isPrimaryKey: false;
403
+ isAutoincrement: false;
404
+ hasRuntimeDefault: false;
405
+ enumValues: undefined;
406
+ baseColumn: never;
407
+ identity: undefined;
408
+ generated: undefined;
409
+ }, {}, {}>;
255
410
  dirtySince: import("drizzle-orm/pg-core").PgColumn<{
256
411
  name: "dirty_since";
257
412
  tableName: "agents";
@@ -303,6 +458,40 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
303
458
  identity: undefined;
304
459
  generated: undefined;
305
460
  }, {}, {}>;
461
+ termsVersion: import("drizzle-orm/pg-core").PgColumn<{
462
+ name: "terms_version";
463
+ tableName: "agents";
464
+ dataType: "string";
465
+ columnType: "PgText";
466
+ data: string;
467
+ driverParam: string;
468
+ notNull: false;
469
+ hasDefault: false;
470
+ isPrimaryKey: false;
471
+ isAutoincrement: false;
472
+ hasRuntimeDefault: false;
473
+ enumValues: [string, ...string[]];
474
+ baseColumn: never;
475
+ identity: undefined;
476
+ generated: undefined;
477
+ }, {}, {}>;
478
+ privacyVersion: import("drizzle-orm/pg-core").PgColumn<{
479
+ name: "privacy_version";
480
+ tableName: "agents";
481
+ dataType: "string";
482
+ columnType: "PgText";
483
+ data: string;
484
+ driverParam: string;
485
+ notNull: false;
486
+ hasDefault: false;
487
+ isPrimaryKey: false;
488
+ isAutoincrement: false;
489
+ hasRuntimeDefault: false;
490
+ enumValues: [string, ...string[]];
491
+ baseColumn: never;
492
+ identity: undefined;
493
+ generated: undefined;
494
+ }, {}, {}>;
306
495
  };
307
496
  dialect: 'pg';
308
497
  }>;
@@ -606,6 +795,25 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
606
795
  identity: undefined;
607
796
  generated: undefined;
608
797
  }, {}, {}>;
798
+ origin: import("drizzle-orm/pg-core").PgColumn<{
799
+ name: "origin";
800
+ tableName: "tasks";
801
+ dataType: "string";
802
+ columnType: "PgText";
803
+ data: "manual" | "routine" | "template";
804
+ driverParam: string;
805
+ notNull: true;
806
+ hasDefault: true;
807
+ isPrimaryKey: false;
808
+ isAutoincrement: false;
809
+ hasRuntimeDefault: false;
810
+ enumValues: [string, ...string[]];
811
+ baseColumn: never;
812
+ identity: undefined;
813
+ generated: undefined;
814
+ }, {}, {
815
+ $type: "manual" | "routine" | "template";
816
+ }>;
609
817
  taskType: import("drizzle-orm/pg-core").PgColumn<{
610
818
  name: "task_type";
611
819
  tableName: "tasks";
@@ -748,6 +956,66 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
748
956
  text: string;
749
957
  };
750
958
  }>;
959
+ failedSubmits: import("drizzle-orm/pg-core").PgColumn<{
960
+ name: "failed_submits";
961
+ tableName: "tasks";
962
+ dataType: "number";
963
+ columnType: "PgInteger";
964
+ data: number;
965
+ driverParam: string | number;
966
+ notNull: true;
967
+ hasDefault: true;
968
+ isPrimaryKey: false;
969
+ isAutoincrement: false;
970
+ hasRuntimeDefault: false;
971
+ enumValues: undefined;
972
+ baseColumn: never;
973
+ identity: undefined;
974
+ generated: undefined;
975
+ }, {}, {}>;
976
+ barredAgentIds: import("drizzle-orm/pg-core").PgColumn<{
977
+ name: "barred_agent_ids";
978
+ tableName: "tasks";
979
+ dataType: "array";
980
+ columnType: "PgArray";
981
+ data: string[];
982
+ driverParam: string | string[];
983
+ notNull: true;
984
+ hasDefault: true;
985
+ isPrimaryKey: false;
986
+ isAutoincrement: false;
987
+ hasRuntimeDefault: false;
988
+ enumValues: [string, ...string[]];
989
+ baseColumn: import("drizzle-orm").Column<{
990
+ name: "barred_agent_ids";
991
+ tableName: "tasks";
992
+ dataType: "string";
993
+ columnType: "PgText";
994
+ data: string;
995
+ driverParam: string;
996
+ notNull: false;
997
+ hasDefault: false;
998
+ isPrimaryKey: false;
999
+ isAutoincrement: false;
1000
+ hasRuntimeDefault: false;
1001
+ enumValues: [string, ...string[]];
1002
+ baseColumn: never;
1003
+ identity: undefined;
1004
+ generated: undefined;
1005
+ }, {}, {}>;
1006
+ identity: undefined;
1007
+ generated: undefined;
1008
+ }, {}, {
1009
+ baseBuilder: import("drizzle-orm/pg-core").PgColumnBuilder<{
1010
+ name: "barred_agent_ids";
1011
+ dataType: 'string';
1012
+ columnType: 'PgText';
1013
+ data: string;
1014
+ enumValues: [string, ...string[]];
1015
+ driverParam: string;
1016
+ }, {}, {}, import("drizzle-orm").ColumnBuilderExtraConfig>;
1017
+ size: undefined;
1018
+ }>;
751
1019
  expiresAt: import("drizzle-orm/pg-core").PgColumn<{
752
1020
  name: "expires_at";
753
1021
  tableName: "tasks";
@@ -891,6 +1159,25 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
891
1159
  identity: undefined;
892
1160
  generated: undefined;
893
1161
  }, {}, {}>;
1162
+ origin: import("drizzle-orm/pg-core").PgColumn<{
1163
+ name: "origin";
1164
+ tableName: "task_outcomes";
1165
+ dataType: "string";
1166
+ columnType: "PgText";
1167
+ data: "manual" | "routine" | "template";
1168
+ driverParam: string;
1169
+ notNull: true;
1170
+ hasDefault: true;
1171
+ isPrimaryKey: false;
1172
+ isAutoincrement: false;
1173
+ hasRuntimeDefault: false;
1174
+ enumValues: [string, ...string[]];
1175
+ baseColumn: never;
1176
+ identity: undefined;
1177
+ generated: undefined;
1178
+ }, {}, {
1179
+ $type: "manual" | "routine" | "template";
1180
+ }>;
894
1181
  };
895
1182
  dialect: 'pg';
896
1183
  }>;
@@ -1467,6 +1754,25 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
1467
1754
  }, {}, {
1468
1755
  $type: import("./standing.js").StoredCounts;
1469
1756
  }>;
1757
+ levelInputs: import("drizzle-orm/pg-core").PgColumn<{
1758
+ name: "level_inputs";
1759
+ tableName: "standing";
1760
+ dataType: "json";
1761
+ columnType: "PgJsonb";
1762
+ data: import("./standing.js").StoredLevelInputs;
1763
+ driverParam: unknown;
1764
+ notNull: false;
1765
+ hasDefault: false;
1766
+ isPrimaryKey: false;
1767
+ isAutoincrement: false;
1768
+ hasRuntimeDefault: false;
1769
+ enumValues: undefined;
1770
+ baseColumn: never;
1771
+ identity: undefined;
1772
+ generated: undefined;
1773
+ }, {}, {
1774
+ $type: import("./standing.js").StoredLevelInputs;
1775
+ }>;
1470
1776
  historyDays: import("drizzle-orm/pg-core").PgColumn<{
1471
1777
  name: "history_days";
1472
1778
  tableName: "standing";
@@ -2066,6 +2372,98 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
2066
2372
  };
2067
2373
  dialect: 'pg';
2068
2374
  }>;
2375
+ operatorSlugs: import("drizzle-orm/pg-core").PgTableWithColumns<{
2376
+ name: "operator_slugs";
2377
+ schema: undefined;
2378
+ columns: {
2379
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
2380
+ name: "created_at";
2381
+ tableName: "operator_slugs";
2382
+ dataType: "date";
2383
+ columnType: "PgTimestamp";
2384
+ data: Date;
2385
+ driverParam: string;
2386
+ notNull: true;
2387
+ hasDefault: true;
2388
+ isPrimaryKey: false;
2389
+ isAutoincrement: false;
2390
+ hasRuntimeDefault: false;
2391
+ enumValues: undefined;
2392
+ baseColumn: never;
2393
+ identity: undefined;
2394
+ generated: undefined;
2395
+ }, {}, {}>;
2396
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
2397
+ name: "updated_at";
2398
+ tableName: "operator_slugs";
2399
+ dataType: "date";
2400
+ columnType: "PgTimestamp";
2401
+ data: Date;
2402
+ driverParam: string;
2403
+ notNull: true;
2404
+ hasDefault: true;
2405
+ isPrimaryKey: false;
2406
+ isAutoincrement: false;
2407
+ hasRuntimeDefault: false;
2408
+ enumValues: undefined;
2409
+ baseColumn: never;
2410
+ identity: undefined;
2411
+ generated: undefined;
2412
+ }, {}, {}>;
2413
+ id: import("drizzle-orm/pg-core").PgColumn<{
2414
+ name: "id";
2415
+ tableName: "operator_slugs";
2416
+ dataType: "number";
2417
+ columnType: "PgBigSerial53";
2418
+ data: number;
2419
+ driverParam: number;
2420
+ notNull: true;
2421
+ hasDefault: true;
2422
+ isPrimaryKey: true;
2423
+ isAutoincrement: false;
2424
+ hasRuntimeDefault: false;
2425
+ enumValues: undefined;
2426
+ baseColumn: never;
2427
+ identity: undefined;
2428
+ generated: undefined;
2429
+ }, {}, {}>;
2430
+ operatorId: import("drizzle-orm/pg-core").PgColumn<{
2431
+ name: "operator_id";
2432
+ tableName: "operator_slugs";
2433
+ dataType: "string";
2434
+ columnType: "PgUUID";
2435
+ data: string;
2436
+ driverParam: string;
2437
+ notNull: false;
2438
+ hasDefault: false;
2439
+ isPrimaryKey: false;
2440
+ isAutoincrement: false;
2441
+ hasRuntimeDefault: false;
2442
+ enumValues: undefined;
2443
+ baseColumn: never;
2444
+ identity: undefined;
2445
+ generated: undefined;
2446
+ }, {}, {}>;
2447
+ oldSlug: import("drizzle-orm/pg-core").PgColumn<{
2448
+ name: "old_slug";
2449
+ tableName: "operator_slugs";
2450
+ dataType: "string";
2451
+ columnType: "PgText";
2452
+ data: string;
2453
+ driverParam: string;
2454
+ notNull: true;
2455
+ hasDefault: false;
2456
+ isPrimaryKey: false;
2457
+ isAutoincrement: false;
2458
+ hasRuntimeDefault: false;
2459
+ enumValues: [string, ...string[]];
2460
+ baseColumn: never;
2461
+ identity: undefined;
2462
+ generated: undefined;
2463
+ }, {}, {}>;
2464
+ };
2465
+ dialect: 'pg';
2466
+ }>;
2069
2467
  }> & {
2070
2468
  $client: postgres.Sql<{}>;
2071
2469
  };
package/dist/db/client.js CHANGED
@@ -7,6 +7,7 @@ import { credentials } from './credentials.js';
7
7
  import { deletedOperators } from './deleted-operators.js';
8
8
  import { events } from './events.js';
9
9
  import { feedItems } from './feed-items.js';
10
+ import { operatorSlugs } from './operator-slugs.js';
10
11
  import { operators } from './operators.js';
11
12
  import { quotaCounters } from './quota-counters.js';
12
13
  import { ratings } from './ratings.js';
@@ -30,6 +31,7 @@ const schema = {
30
31
  agentRenames,
31
32
  agentMilestones,
32
33
  deletedOperators,
34
+ operatorSlugs,
33
35
  };
34
36
  export function createDb(url, options = {}) {
35
37
  const [conn, pgOptions] = pgArgs(url);
package/dist/db/events.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { sql } from 'drizzle-orm';
1
2
  import { bigint, index, jsonb, pgTable, text, timestamp, unique, uuid, } from 'drizzle-orm/pg-core';
2
3
  import { agents } from './agents.js';
3
4
  // Append only. No created_at or updated_at, received_at is the server timestamp.
@@ -31,4 +32,10 @@ export const events = pgTable('events', {
31
32
  // Range reads on the server clock across agents. The stats count of
32
33
  // the last 24 hours and the evidence counts over a window.
33
34
  index('events_received_at_agent_id_idx').on(t.receivedAt, t.agentId),
35
+ // The single agent answer reads the model from the agent's newest usage
36
+ // event, newest by the server's id. Partial, so an agent with many
37
+ // events and few usage events is still one short index walk.
38
+ index('events_agent_id_usage_idx')
39
+ .on(t.agentId, t.id.desc())
40
+ .where(sql `${t.type} = 'usage'`),
34
41
  ]);
@@ -4,11 +4,15 @@ import type { credentials } from './credentials.js';
4
4
  import type { deletedOperators } from './deleted-operators.js';
5
5
  import type { events } from './events.js';
6
6
  import type { feedItems } from './feed-items.js';
7
+ import type { operatorIdentities } from './operator-identities.js';
8
+ import type { operatorLevelGrants } from './operator-level-grants.js';
9
+ import type { operatorSlugs } from './operator-slugs.js';
7
10
  import type { operators } from './operators.js';
8
11
  import type { quotaCounters } from './quota-counters.js';
9
12
  import type { ratings } from './ratings.js';
10
13
  import type { scores } from './scores.js';
11
14
  import type { standing } from './standing.js';
15
+ import type { taskClaimFailures } from './task-claim-failures.js';
12
16
  import type { taskOutcomes } from './task-outcomes.js';
13
17
  import type { tasks } from './tasks.js';
14
18
  export { and, asc, desc, eq, gt, inArray, isNotNull, isNull, lt, lte, max, ne, notInArray, or, type SQL, sql, } from 'drizzle-orm';
@@ -23,11 +27,15 @@ export { deletedOperators } from './deleted-operators.js';
23
27
  export { events } from './events.js';
24
28
  export { feedItems } from './feed-items.js';
25
29
  export { migrationsFolder, runMigrations } from './migrator.js';
30
+ export { operatorIdentities } from './operator-identities.js';
31
+ export { operatorLevelGrants } from './operator-level-grants.js';
32
+ export { operatorSlugs } from './operator-slugs.js';
26
33
  export { operators } from './operators.js';
27
34
  export { quotaCounters } from './quota-counters.js';
28
35
  export { ratings } from './ratings.js';
29
36
  export { scores } from './scores.js';
30
- export { type StoredCounts, standing } from './standing.js';
37
+ export { type StoredCounts, type StoredLevelInputs, standing, } from './standing.js';
38
+ export { taskClaimFailures } from './task-claim-failures.js';
31
39
  export { taskOutcomes } from './task-outcomes.js';
32
40
  export { tasks } from './tasks.js';
33
41
  export { timestamps } from './timestamps.js';
@@ -40,6 +48,8 @@ export type Task = typeof tasks.$inferSelect;
40
48
  export type NewTask = typeof tasks.$inferInsert;
41
49
  export type TaskOutcome = typeof taskOutcomes.$inferSelect;
42
50
  export type NewTaskOutcome = typeof taskOutcomes.$inferInsert;
51
+ export type TaskClaimFailure = typeof taskClaimFailures.$inferSelect;
52
+ export type NewTaskClaimFailure = typeof taskClaimFailures.$inferInsert;
43
53
  export type Rating = typeof ratings.$inferSelect;
44
54
  export type NewRating = typeof ratings.$inferInsert;
45
55
  export type Credential = typeof credentials.$inferSelect;
@@ -56,5 +66,11 @@ export type FeedItem = typeof feedItems.$inferSelect;
56
66
  export type NewFeedItem = typeof feedItems.$inferInsert;
57
67
  export type AgentMilestone = typeof agentMilestones.$inferSelect;
58
68
  export type NewAgentMilestone = typeof agentMilestones.$inferInsert;
69
+ export type OperatorSlugRow = typeof operatorSlugs.$inferSelect;
70
+ export type NewOperatorSlugRow = typeof operatorSlugs.$inferInsert;
59
71
  export type DeletedOperator = typeof deletedOperators.$inferSelect;
60
72
  export type NewDeletedOperator = typeof deletedOperators.$inferInsert;
73
+ export type OperatorLevelGrant = typeof operatorLevelGrants.$inferSelect;
74
+ export type NewOperatorLevelGrant = typeof operatorLevelGrants.$inferInsert;
75
+ export type OperatorIdentity = typeof operatorIdentities.$inferSelect;
76
+ export type NewOperatorIdentity = typeof operatorIdentities.$inferInsert;
package/dist/db/index.js CHANGED
@@ -13,11 +13,15 @@ export { deletedOperators } from './deleted-operators.js';
13
13
  export { events } from './events.js';
14
14
  export { feedItems } from './feed-items.js';
15
15
  export { migrationsFolder, runMigrations } from './migrator.js';
16
+ export { operatorIdentities } from './operator-identities.js';
17
+ export { operatorLevelGrants } from './operator-level-grants.js';
18
+ export { operatorSlugs } from './operator-slugs.js';
16
19
  export { operators } from './operators.js';
17
20
  export { quotaCounters } from './quota-counters.js';
18
21
  export { ratings } from './ratings.js';
19
22
  export { scores } from './scores.js';
20
- export { standing } from './standing.js';
23
+ export { standing, } from './standing.js';
24
+ export { taskClaimFailures } from './task-claim-failures.js';
21
25
  export { taskOutcomes } from './task-outcomes.js';
22
26
  export { tasks } from './tasks.js';
23
27
  export { timestamps } from './timestamps.js';
@@ -10,7 +10,11 @@ if (!url) {
10
10
  process.exit(1);
11
11
  }
12
12
  try {
13
- await runMigrations(url);
13
+ // A notice is a migration telling the operator of the database something,
14
+ // such as 0025 listing the operators whose slug got a suffix.
15
+ await runMigrations(url, {
16
+ onNotice: (notice) => console.log(JSON.stringify({ msg: 'migration notice', notice })),
17
+ });
14
18
  console.log(JSON.stringify({ msg: 'migrations applied' }));
15
19
  }
16
20
  catch (err) {
@@ -1,2 +1,4 @@
1
1
  export declare const migrationsFolder: string;
2
- export declare function runMigrations(databaseUrl: string): Promise<void>;
2
+ export declare function runMigrations(databaseUrl: string, { onNotice }?: {
3
+ onNotice?: (message: string) => void;
4
+ }): Promise<void>;
@@ -8,9 +8,15 @@ import postgres from 'postgres';
8
8
  import { pgArgs } from './url.js';
9
9
  // Resolves to packages/schema/drizzle from both src/db and dist/db.
10
10
  export const migrationsFolder = fileURLToPath(new URL('../../drizzle', import.meta.url));
11
- export async function runMigrations(databaseUrl) {
11
+ // onNotice receives the text of each notice a migration raises, such as
12
+ // the operators 0025 gave a suffixed slug. Silent when left out.
13
+ export async function runMigrations(databaseUrl, { onNotice } = {}) {
12
14
  const [connUrl, options] = pgArgs(databaseUrl);
13
- const sql = postgres(connUrl, { ...options, max: 1, onnotice: () => { } });
15
+ const sql = postgres(connUrl, {
16
+ ...options,
17
+ max: 1,
18
+ onnotice: (notice) => onNotice?.(notice.message),
19
+ });
14
20
  try {
15
21
  await migrate(drizzle(sql), { migrationsFolder });
16
22
  }