@sealkeeper/schema 0.4.4 → 0.4.6
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/agent-name.d.ts +1 -1
- package/dist/agent-name.js +4 -4
- package/dist/api.d.ts +625 -33
- package/dist/api.js +262 -57
- package/dist/badge.d.ts +1 -0
- package/dist/badge.js +7 -0
- package/dist/client-address.d.ts +6 -0
- package/dist/client-address.js +81 -0
- package/dist/db/agents.d.ts +155 -0
- package/dist/db/agents.js +38 -0
- package/dist/db/client.d.ts +431 -0
- package/dist/db/client.js +24 -1
- package/dist/db/events.js +7 -0
- package/dist/db/index.d.ts +16 -0
- package/dist/db/index.js +4 -0
- package/dist/db/migrate.js +5 -1
- package/dist/db/migrator.d.ts +5 -1
- package/dist/db/migrator.js +18 -2
- package/dist/db/operator-identities.d.ts +211 -0
- package/dist/db/operator-identities.js +49 -0
- package/dist/db/operator-level-grants.d.ts +109 -0
- package/dist/db/operator-level-grants.js +30 -0
- package/dist/db/operator-slugs.d.ts +92 -0
- package/dist/db/operator-slugs.js +25 -0
- package/dist/db/operators.d.ts +119 -0
- package/dist/db/operators.js +30 -2
- package/dist/db/standing.d.ts +1 -0
- package/dist/db/standing.js +2 -0
- package/dist/db/task-claim-failures.d.ts +143 -0
- package/dist/db/task-claim-failures.js +37 -0
- package/dist/db/tasks.d.ts +60 -0
- package/dist/db/tasks.js +19 -1
- package/dist/envelope.d.ts +3 -0
- package/dist/envelope.js +16 -11
- package/dist/goal.d.ts +62 -1
- package/dist/goal.js +70 -11
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/json-shape.d.ts +9 -0
- package/dist/json-shape.js +70 -0
- package/dist/moderation.d.ts +29 -0
- package/dist/moderation.js +547 -0
- package/dist/operator-domains.d.ts +104 -0
- package/dist/operator-domains.js +85 -0
- package/dist/policy.d.ts +4 -0
- package/dist/policy.js +10 -0
- package/dist/runtime.d.ts +17 -0
- package/dist/runtime.js +61 -0
- package/dist/seal-conformance.js +2 -0
- package/dist/standing.d.ts +27 -8
- package/dist/standing.js +59 -22
- package/dist/tasks.d.ts +25 -1
- package/dist/tasks.js +43 -9
- package/package.json +1 -1
package/dist/db/client.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import type { Logger } from 'drizzle-orm/logger';
|
|
1
2
|
import postgres from 'postgres';
|
|
2
3
|
export type DbOptions = {
|
|
3
4
|
max?: number;
|
|
5
|
+
statementTimeoutMs?: number;
|
|
6
|
+
lockTimeoutMs?: number;
|
|
7
|
+
idleInTxTimeoutMs?: number;
|
|
8
|
+
logger?: Logger;
|
|
4
9
|
};
|
|
5
10
|
export declare function createDb(url: string, options?: DbOptions): import("drizzle-orm/postgres-js").PostgresJsDatabase<{
|
|
6
11
|
operators: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
@@ -92,6 +97,91 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
|
|
|
92
97
|
identity: undefined;
|
|
93
98
|
generated: undefined;
|
|
94
99
|
}, {}, {}>;
|
|
100
|
+
slug: import("drizzle-orm/pg-core").PgColumn<{
|
|
101
|
+
name: "slug";
|
|
102
|
+
tableName: "operators";
|
|
103
|
+
dataType: "string";
|
|
104
|
+
columnType: "PgText";
|
|
105
|
+
data: string;
|
|
106
|
+
driverParam: string;
|
|
107
|
+
notNull: true;
|
|
108
|
+
hasDefault: false;
|
|
109
|
+
isPrimaryKey: false;
|
|
110
|
+
isAutoincrement: false;
|
|
111
|
+
hasRuntimeDefault: false;
|
|
112
|
+
enumValues: [string, ...string[]];
|
|
113
|
+
baseColumn: never;
|
|
114
|
+
identity: undefined;
|
|
115
|
+
generated: undefined;
|
|
116
|
+
}, {}, {}>;
|
|
117
|
+
displayName: import("drizzle-orm/pg-core").PgColumn<{
|
|
118
|
+
name: "display_name";
|
|
119
|
+
tableName: "operators";
|
|
120
|
+
dataType: "string";
|
|
121
|
+
columnType: "PgText";
|
|
122
|
+
data: string;
|
|
123
|
+
driverParam: string;
|
|
124
|
+
notNull: true;
|
|
125
|
+
hasDefault: false;
|
|
126
|
+
isPrimaryKey: false;
|
|
127
|
+
isAutoincrement: false;
|
|
128
|
+
hasRuntimeDefault: false;
|
|
129
|
+
enumValues: [string, ...string[]];
|
|
130
|
+
baseColumn: never;
|
|
131
|
+
identity: undefined;
|
|
132
|
+
generated: undefined;
|
|
133
|
+
}, {}, {}>;
|
|
134
|
+
displayNameKey: import("drizzle-orm/pg-core").PgColumn<{
|
|
135
|
+
name: "display_name_key";
|
|
136
|
+
tableName: "operators";
|
|
137
|
+
dataType: "string";
|
|
138
|
+
columnType: "PgText";
|
|
139
|
+
data: string;
|
|
140
|
+
driverParam: string;
|
|
141
|
+
notNull: true;
|
|
142
|
+
hasDefault: false;
|
|
143
|
+
isPrimaryKey: false;
|
|
144
|
+
isAutoincrement: false;
|
|
145
|
+
hasRuntimeDefault: false;
|
|
146
|
+
enumValues: [string, ...string[]];
|
|
147
|
+
baseColumn: never;
|
|
148
|
+
identity: undefined;
|
|
149
|
+
generated: undefined;
|
|
150
|
+
}, {}, {}>;
|
|
151
|
+
slugChangedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
152
|
+
name: "slug_changed_at";
|
|
153
|
+
tableName: "operators";
|
|
154
|
+
dataType: "date";
|
|
155
|
+
columnType: "PgTimestamp";
|
|
156
|
+
data: Date;
|
|
157
|
+
driverParam: string;
|
|
158
|
+
notNull: false;
|
|
159
|
+
hasDefault: false;
|
|
160
|
+
isPrimaryKey: false;
|
|
161
|
+
isAutoincrement: false;
|
|
162
|
+
hasRuntimeDefault: false;
|
|
163
|
+
enumValues: undefined;
|
|
164
|
+
baseColumn: never;
|
|
165
|
+
identity: undefined;
|
|
166
|
+
generated: undefined;
|
|
167
|
+
}, {}, {}>;
|
|
168
|
+
slugNoticeDismissedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
169
|
+
name: "slug_notice_dismissed_at";
|
|
170
|
+
tableName: "operators";
|
|
171
|
+
dataType: "date";
|
|
172
|
+
columnType: "PgTimestamp";
|
|
173
|
+
data: Date;
|
|
174
|
+
driverParam: string;
|
|
175
|
+
notNull: false;
|
|
176
|
+
hasDefault: false;
|
|
177
|
+
isPrimaryKey: false;
|
|
178
|
+
isAutoincrement: false;
|
|
179
|
+
hasRuntimeDefault: false;
|
|
180
|
+
enumValues: undefined;
|
|
181
|
+
baseColumn: never;
|
|
182
|
+
identity: undefined;
|
|
183
|
+
generated: undefined;
|
|
184
|
+
}, {}, {}>;
|
|
95
185
|
accountCreatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
96
186
|
name: "account_created_at";
|
|
97
187
|
tableName: "operators";
|
|
@@ -109,6 +199,40 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
|
|
|
109
199
|
identity: undefined;
|
|
110
200
|
generated: undefined;
|
|
111
201
|
}, {}, {}>;
|
|
202
|
+
termsVersion: import("drizzle-orm/pg-core").PgColumn<{
|
|
203
|
+
name: "terms_version";
|
|
204
|
+
tableName: "operators";
|
|
205
|
+
dataType: "string";
|
|
206
|
+
columnType: "PgText";
|
|
207
|
+
data: string;
|
|
208
|
+
driverParam: string;
|
|
209
|
+
notNull: false;
|
|
210
|
+
hasDefault: false;
|
|
211
|
+
isPrimaryKey: false;
|
|
212
|
+
isAutoincrement: false;
|
|
213
|
+
hasRuntimeDefault: false;
|
|
214
|
+
enumValues: [string, ...string[]];
|
|
215
|
+
baseColumn: never;
|
|
216
|
+
identity: undefined;
|
|
217
|
+
generated: undefined;
|
|
218
|
+
}, {}, {}>;
|
|
219
|
+
privacyVersion: import("drizzle-orm/pg-core").PgColumn<{
|
|
220
|
+
name: "privacy_version";
|
|
221
|
+
tableName: "operators";
|
|
222
|
+
dataType: "string";
|
|
223
|
+
columnType: "PgText";
|
|
224
|
+
data: string;
|
|
225
|
+
driverParam: string;
|
|
226
|
+
notNull: false;
|
|
227
|
+
hasDefault: false;
|
|
228
|
+
isPrimaryKey: false;
|
|
229
|
+
isAutoincrement: false;
|
|
230
|
+
hasRuntimeDefault: false;
|
|
231
|
+
enumValues: [string, ...string[]];
|
|
232
|
+
baseColumn: never;
|
|
233
|
+
identity: undefined;
|
|
234
|
+
generated: undefined;
|
|
235
|
+
}, {}, {}>;
|
|
112
236
|
};
|
|
113
237
|
dialect: 'pg';
|
|
114
238
|
}>;
|
|
@@ -252,6 +376,42 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
|
|
|
252
376
|
identity: undefined;
|
|
253
377
|
generated: undefined;
|
|
254
378
|
}, {}, {}>;
|
|
379
|
+
runtime: import("drizzle-orm/pg-core").PgColumn<{
|
|
380
|
+
name: "runtime";
|
|
381
|
+
tableName: "agents";
|
|
382
|
+
dataType: "string";
|
|
383
|
+
columnType: "PgText";
|
|
384
|
+
data: "claude-code" | "codex" | "cursor" | "gemini-cli" | "mastra" | "openclaw" | "other" | "unknown";
|
|
385
|
+
driverParam: string;
|
|
386
|
+
notNull: true;
|
|
387
|
+
hasDefault: true;
|
|
388
|
+
isPrimaryKey: false;
|
|
389
|
+
isAutoincrement: false;
|
|
390
|
+
hasRuntimeDefault: false;
|
|
391
|
+
enumValues: [string, ...string[]];
|
|
392
|
+
baseColumn: never;
|
|
393
|
+
identity: undefined;
|
|
394
|
+
generated: undefined;
|
|
395
|
+
}, {}, {
|
|
396
|
+
$type: "claude-code" | "codex" | "cursor" | "gemini-cli" | "mastra" | "openclaw" | "other" | "unknown";
|
|
397
|
+
}>;
|
|
398
|
+
runtimeIssuedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
399
|
+
name: "runtime_issued_at";
|
|
400
|
+
tableName: "agents";
|
|
401
|
+
dataType: "date";
|
|
402
|
+
columnType: "PgTimestamp";
|
|
403
|
+
data: Date;
|
|
404
|
+
driverParam: string;
|
|
405
|
+
notNull: false;
|
|
406
|
+
hasDefault: false;
|
|
407
|
+
isPrimaryKey: false;
|
|
408
|
+
isAutoincrement: false;
|
|
409
|
+
hasRuntimeDefault: false;
|
|
410
|
+
enumValues: undefined;
|
|
411
|
+
baseColumn: never;
|
|
412
|
+
identity: undefined;
|
|
413
|
+
generated: undefined;
|
|
414
|
+
}, {}, {}>;
|
|
255
415
|
dirtySince: import("drizzle-orm/pg-core").PgColumn<{
|
|
256
416
|
name: "dirty_since";
|
|
257
417
|
tableName: "agents";
|
|
@@ -303,6 +463,125 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
|
|
|
303
463
|
identity: undefined;
|
|
304
464
|
generated: undefined;
|
|
305
465
|
}, {}, {}>;
|
|
466
|
+
termsVersion: import("drizzle-orm/pg-core").PgColumn<{
|
|
467
|
+
name: "terms_version";
|
|
468
|
+
tableName: "agents";
|
|
469
|
+
dataType: "string";
|
|
470
|
+
columnType: "PgText";
|
|
471
|
+
data: string;
|
|
472
|
+
driverParam: string;
|
|
473
|
+
notNull: false;
|
|
474
|
+
hasDefault: false;
|
|
475
|
+
isPrimaryKey: false;
|
|
476
|
+
isAutoincrement: false;
|
|
477
|
+
hasRuntimeDefault: false;
|
|
478
|
+
enumValues: [string, ...string[]];
|
|
479
|
+
baseColumn: never;
|
|
480
|
+
identity: undefined;
|
|
481
|
+
generated: undefined;
|
|
482
|
+
}, {}, {}>;
|
|
483
|
+
privacyVersion: import("drizzle-orm/pg-core").PgColumn<{
|
|
484
|
+
name: "privacy_version";
|
|
485
|
+
tableName: "agents";
|
|
486
|
+
dataType: "string";
|
|
487
|
+
columnType: "PgText";
|
|
488
|
+
data: string;
|
|
489
|
+
driverParam: string;
|
|
490
|
+
notNull: false;
|
|
491
|
+
hasDefault: false;
|
|
492
|
+
isPrimaryKey: false;
|
|
493
|
+
isAutoincrement: false;
|
|
494
|
+
hasRuntimeDefault: false;
|
|
495
|
+
enumValues: [string, ...string[]];
|
|
496
|
+
baseColumn: never;
|
|
497
|
+
identity: undefined;
|
|
498
|
+
generated: undefined;
|
|
499
|
+
}, {}, {}>;
|
|
500
|
+
eventCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
501
|
+
name: "event_count";
|
|
502
|
+
tableName: "agents";
|
|
503
|
+
dataType: "number";
|
|
504
|
+
columnType: "PgBigInt53";
|
|
505
|
+
data: number;
|
|
506
|
+
driverParam: string | number;
|
|
507
|
+
notNull: true;
|
|
508
|
+
hasDefault: true;
|
|
509
|
+
isPrimaryKey: false;
|
|
510
|
+
isAutoincrement: false;
|
|
511
|
+
hasRuntimeDefault: false;
|
|
512
|
+
enumValues: undefined;
|
|
513
|
+
baseColumn: never;
|
|
514
|
+
identity: undefined;
|
|
515
|
+
generated: undefined;
|
|
516
|
+
}, {}, {}>;
|
|
517
|
+
sessionCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
518
|
+
name: "session_count";
|
|
519
|
+
tableName: "agents";
|
|
520
|
+
dataType: "number";
|
|
521
|
+
columnType: "PgBigInt53";
|
|
522
|
+
data: number;
|
|
523
|
+
driverParam: string | number;
|
|
524
|
+
notNull: true;
|
|
525
|
+
hasDefault: true;
|
|
526
|
+
isPrimaryKey: false;
|
|
527
|
+
isAutoincrement: false;
|
|
528
|
+
hasRuntimeDefault: false;
|
|
529
|
+
enumValues: undefined;
|
|
530
|
+
baseColumn: never;
|
|
531
|
+
identity: undefined;
|
|
532
|
+
generated: undefined;
|
|
533
|
+
}, {}, {}>;
|
|
534
|
+
toolCallCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
535
|
+
name: "tool_call_count";
|
|
536
|
+
tableName: "agents";
|
|
537
|
+
dataType: "number";
|
|
538
|
+
columnType: "PgBigInt53";
|
|
539
|
+
data: number;
|
|
540
|
+
driverParam: string | number;
|
|
541
|
+
notNull: true;
|
|
542
|
+
hasDefault: true;
|
|
543
|
+
isPrimaryKey: false;
|
|
544
|
+
isAutoincrement: false;
|
|
545
|
+
hasRuntimeDefault: false;
|
|
546
|
+
enumValues: undefined;
|
|
547
|
+
baseColumn: never;
|
|
548
|
+
identity: undefined;
|
|
549
|
+
generated: undefined;
|
|
550
|
+
}, {}, {}>;
|
|
551
|
+
incidentCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
552
|
+
name: "incident_count";
|
|
553
|
+
tableName: "agents";
|
|
554
|
+
dataType: "number";
|
|
555
|
+
columnType: "PgBigInt53";
|
|
556
|
+
data: number;
|
|
557
|
+
driverParam: string | number;
|
|
558
|
+
notNull: true;
|
|
559
|
+
hasDefault: true;
|
|
560
|
+
isPrimaryKey: false;
|
|
561
|
+
isAutoincrement: false;
|
|
562
|
+
hasRuntimeDefault: false;
|
|
563
|
+
enumValues: undefined;
|
|
564
|
+
baseColumn: never;
|
|
565
|
+
identity: undefined;
|
|
566
|
+
generated: undefined;
|
|
567
|
+
}, {}, {}>;
|
|
568
|
+
lastSeenAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
569
|
+
name: "last_seen_at";
|
|
570
|
+
tableName: "agents";
|
|
571
|
+
dataType: "date";
|
|
572
|
+
columnType: "PgTimestamp";
|
|
573
|
+
data: Date;
|
|
574
|
+
driverParam: string;
|
|
575
|
+
notNull: false;
|
|
576
|
+
hasDefault: false;
|
|
577
|
+
isPrimaryKey: false;
|
|
578
|
+
isAutoincrement: false;
|
|
579
|
+
hasRuntimeDefault: false;
|
|
580
|
+
enumValues: undefined;
|
|
581
|
+
baseColumn: never;
|
|
582
|
+
identity: undefined;
|
|
583
|
+
generated: undefined;
|
|
584
|
+
}, {}, {}>;
|
|
306
585
|
};
|
|
307
586
|
dialect: 'pg';
|
|
308
587
|
}>;
|
|
@@ -767,6 +1046,66 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
|
|
|
767
1046
|
text: string;
|
|
768
1047
|
};
|
|
769
1048
|
}>;
|
|
1049
|
+
failedSubmits: import("drizzle-orm/pg-core").PgColumn<{
|
|
1050
|
+
name: "failed_submits";
|
|
1051
|
+
tableName: "tasks";
|
|
1052
|
+
dataType: "number";
|
|
1053
|
+
columnType: "PgInteger";
|
|
1054
|
+
data: number;
|
|
1055
|
+
driverParam: string | number;
|
|
1056
|
+
notNull: true;
|
|
1057
|
+
hasDefault: true;
|
|
1058
|
+
isPrimaryKey: false;
|
|
1059
|
+
isAutoincrement: false;
|
|
1060
|
+
hasRuntimeDefault: false;
|
|
1061
|
+
enumValues: undefined;
|
|
1062
|
+
baseColumn: never;
|
|
1063
|
+
identity: undefined;
|
|
1064
|
+
generated: undefined;
|
|
1065
|
+
}, {}, {}>;
|
|
1066
|
+
barredAgentIds: import("drizzle-orm/pg-core").PgColumn<{
|
|
1067
|
+
name: "barred_agent_ids";
|
|
1068
|
+
tableName: "tasks";
|
|
1069
|
+
dataType: "array";
|
|
1070
|
+
columnType: "PgArray";
|
|
1071
|
+
data: string[];
|
|
1072
|
+
driverParam: string | string[];
|
|
1073
|
+
notNull: true;
|
|
1074
|
+
hasDefault: true;
|
|
1075
|
+
isPrimaryKey: false;
|
|
1076
|
+
isAutoincrement: false;
|
|
1077
|
+
hasRuntimeDefault: false;
|
|
1078
|
+
enumValues: [string, ...string[]];
|
|
1079
|
+
baseColumn: import("drizzle-orm").Column<{
|
|
1080
|
+
name: "barred_agent_ids";
|
|
1081
|
+
tableName: "tasks";
|
|
1082
|
+
dataType: "string";
|
|
1083
|
+
columnType: "PgText";
|
|
1084
|
+
data: string;
|
|
1085
|
+
driverParam: string;
|
|
1086
|
+
notNull: false;
|
|
1087
|
+
hasDefault: false;
|
|
1088
|
+
isPrimaryKey: false;
|
|
1089
|
+
isAutoincrement: false;
|
|
1090
|
+
hasRuntimeDefault: false;
|
|
1091
|
+
enumValues: [string, ...string[]];
|
|
1092
|
+
baseColumn: never;
|
|
1093
|
+
identity: undefined;
|
|
1094
|
+
generated: undefined;
|
|
1095
|
+
}, {}, {}>;
|
|
1096
|
+
identity: undefined;
|
|
1097
|
+
generated: undefined;
|
|
1098
|
+
}, {}, {
|
|
1099
|
+
baseBuilder: import("drizzle-orm/pg-core").PgColumnBuilder<{
|
|
1100
|
+
name: "barred_agent_ids";
|
|
1101
|
+
dataType: 'string';
|
|
1102
|
+
columnType: 'PgText';
|
|
1103
|
+
data: string;
|
|
1104
|
+
enumValues: [string, ...string[]];
|
|
1105
|
+
driverParam: string;
|
|
1106
|
+
}, {}, {}, import("drizzle-orm").ColumnBuilderExtraConfig>;
|
|
1107
|
+
size: undefined;
|
|
1108
|
+
}>;
|
|
770
1109
|
expiresAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
771
1110
|
name: "expires_at";
|
|
772
1111
|
tableName: "tasks";
|
|
@@ -2123,6 +2462,98 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
|
|
|
2123
2462
|
};
|
|
2124
2463
|
dialect: 'pg';
|
|
2125
2464
|
}>;
|
|
2465
|
+
operatorSlugs: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2466
|
+
name: "operator_slugs";
|
|
2467
|
+
schema: undefined;
|
|
2468
|
+
columns: {
|
|
2469
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
2470
|
+
name: "created_at";
|
|
2471
|
+
tableName: "operator_slugs";
|
|
2472
|
+
dataType: "date";
|
|
2473
|
+
columnType: "PgTimestamp";
|
|
2474
|
+
data: Date;
|
|
2475
|
+
driverParam: string;
|
|
2476
|
+
notNull: true;
|
|
2477
|
+
hasDefault: true;
|
|
2478
|
+
isPrimaryKey: false;
|
|
2479
|
+
isAutoincrement: false;
|
|
2480
|
+
hasRuntimeDefault: false;
|
|
2481
|
+
enumValues: undefined;
|
|
2482
|
+
baseColumn: never;
|
|
2483
|
+
identity: undefined;
|
|
2484
|
+
generated: undefined;
|
|
2485
|
+
}, {}, {}>;
|
|
2486
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
2487
|
+
name: "updated_at";
|
|
2488
|
+
tableName: "operator_slugs";
|
|
2489
|
+
dataType: "date";
|
|
2490
|
+
columnType: "PgTimestamp";
|
|
2491
|
+
data: Date;
|
|
2492
|
+
driverParam: string;
|
|
2493
|
+
notNull: true;
|
|
2494
|
+
hasDefault: true;
|
|
2495
|
+
isPrimaryKey: false;
|
|
2496
|
+
isAutoincrement: false;
|
|
2497
|
+
hasRuntimeDefault: false;
|
|
2498
|
+
enumValues: undefined;
|
|
2499
|
+
baseColumn: never;
|
|
2500
|
+
identity: undefined;
|
|
2501
|
+
generated: undefined;
|
|
2502
|
+
}, {}, {}>;
|
|
2503
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
2504
|
+
name: "id";
|
|
2505
|
+
tableName: "operator_slugs";
|
|
2506
|
+
dataType: "number";
|
|
2507
|
+
columnType: "PgBigSerial53";
|
|
2508
|
+
data: number;
|
|
2509
|
+
driverParam: number;
|
|
2510
|
+
notNull: true;
|
|
2511
|
+
hasDefault: true;
|
|
2512
|
+
isPrimaryKey: true;
|
|
2513
|
+
isAutoincrement: false;
|
|
2514
|
+
hasRuntimeDefault: false;
|
|
2515
|
+
enumValues: undefined;
|
|
2516
|
+
baseColumn: never;
|
|
2517
|
+
identity: undefined;
|
|
2518
|
+
generated: undefined;
|
|
2519
|
+
}, {}, {}>;
|
|
2520
|
+
operatorId: import("drizzle-orm/pg-core").PgColumn<{
|
|
2521
|
+
name: "operator_id";
|
|
2522
|
+
tableName: "operator_slugs";
|
|
2523
|
+
dataType: "string";
|
|
2524
|
+
columnType: "PgUUID";
|
|
2525
|
+
data: string;
|
|
2526
|
+
driverParam: string;
|
|
2527
|
+
notNull: false;
|
|
2528
|
+
hasDefault: false;
|
|
2529
|
+
isPrimaryKey: false;
|
|
2530
|
+
isAutoincrement: false;
|
|
2531
|
+
hasRuntimeDefault: false;
|
|
2532
|
+
enumValues: undefined;
|
|
2533
|
+
baseColumn: never;
|
|
2534
|
+
identity: undefined;
|
|
2535
|
+
generated: undefined;
|
|
2536
|
+
}, {}, {}>;
|
|
2537
|
+
oldSlug: import("drizzle-orm/pg-core").PgColumn<{
|
|
2538
|
+
name: "old_slug";
|
|
2539
|
+
tableName: "operator_slugs";
|
|
2540
|
+
dataType: "string";
|
|
2541
|
+
columnType: "PgText";
|
|
2542
|
+
data: string;
|
|
2543
|
+
driverParam: string;
|
|
2544
|
+
notNull: true;
|
|
2545
|
+
hasDefault: false;
|
|
2546
|
+
isPrimaryKey: false;
|
|
2547
|
+
isAutoincrement: false;
|
|
2548
|
+
hasRuntimeDefault: false;
|
|
2549
|
+
enumValues: [string, ...string[]];
|
|
2550
|
+
baseColumn: never;
|
|
2551
|
+
identity: undefined;
|
|
2552
|
+
generated: undefined;
|
|
2553
|
+
}, {}, {}>;
|
|
2554
|
+
};
|
|
2555
|
+
dialect: 'pg';
|
|
2556
|
+
}>;
|
|
2126
2557
|
}> & {
|
|
2127
2558
|
$client: postgres.Sql<{}>;
|
|
2128
2559
|
};
|
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,9 +31,31 @@ 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);
|
|
36
38
|
const max = options.max === undefined ? {} : { max: options.max };
|
|
37
|
-
|
|
39
|
+
const connection = timeoutParameters(options);
|
|
40
|
+
const logger = options.logger === undefined ? {} : { logger: options.logger };
|
|
41
|
+
return drizzle(postgres(conn, {
|
|
42
|
+
...pgOptions,
|
|
43
|
+
...max,
|
|
44
|
+
...(Object.keys(connection).length > 0 ? { connection } : {}),
|
|
45
|
+
}), { schema, ...logger });
|
|
46
|
+
}
|
|
47
|
+
// The postgres.js connection parameters for the timeouts that are set. A
|
|
48
|
+
// bare number is read by Postgres as milliseconds.
|
|
49
|
+
function timeoutParameters(options) {
|
|
50
|
+
const params = {};
|
|
51
|
+
if (options.statementTimeoutMs !== undefined) {
|
|
52
|
+
params.statement_timeout = options.statementTimeoutMs;
|
|
53
|
+
}
|
|
54
|
+
if (options.lockTimeoutMs !== undefined) {
|
|
55
|
+
params.lock_timeout = options.lockTimeoutMs;
|
|
56
|
+
}
|
|
57
|
+
if (options.idleInTxTimeoutMs !== undefined) {
|
|
58
|
+
params.idle_in_transaction_session_timeout = options.idleInTxTimeoutMs;
|
|
59
|
+
}
|
|
60
|
+
return params;
|
|
38
61
|
}
|
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
|
]);
|
package/dist/db/index.d.ts
CHANGED
|
@@ -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
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
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';
|
package/dist/db/migrate.js
CHANGED
|
@@ -10,7 +10,11 @@ if (!url) {
|
|
|
10
10
|
process.exit(1);
|
|
11
11
|
}
|
|
12
12
|
try {
|
|
13
|
-
|
|
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) {
|
package/dist/db/migrator.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export declare const migrationsFolder: string;
|
|
2
|
-
export declare
|
|
2
|
+
export declare const MIGRATION_LOCK_TIMEOUT_MS = 5000;
|
|
3
|
+
export declare const MIGRATION_STATEMENT_TIMEOUT_MS = 120000;
|
|
4
|
+
export declare function runMigrations(databaseUrl: string, { onNotice }?: {
|
|
5
|
+
onNotice?: (message: string) => void;
|
|
6
|
+
}): Promise<void>;
|
package/dist/db/migrator.js
CHANGED
|
@@ -8,9 +8,25 @@ 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
|
-
|
|
11
|
+
// A migration that waits on a lock, such as an ALTER TABLE queued behind the
|
|
12
|
+
// scoring run's transaction, fails after MIGRATION_LOCK_TIMEOUT_MS instead of
|
|
13
|
+
// waiting with no bound and blocking every query queued behind it. One
|
|
14
|
+
// statement may run for MIGRATION_STATEMENT_TIMEOUT_MS (VOU-205).
|
|
15
|
+
export const MIGRATION_LOCK_TIMEOUT_MS = 5_000;
|
|
16
|
+
export const MIGRATION_STATEMENT_TIMEOUT_MS = 120_000;
|
|
17
|
+
// onNotice receives the text of each notice a migration raises, such as
|
|
18
|
+
// the operators 0025 gave a suffixed slug. Silent when left out.
|
|
19
|
+
export async function runMigrations(databaseUrl, { onNotice } = {}) {
|
|
12
20
|
const [connUrl, options] = pgArgs(databaseUrl);
|
|
13
|
-
const sql = postgres(connUrl, {
|
|
21
|
+
const sql = postgres(connUrl, {
|
|
22
|
+
...options,
|
|
23
|
+
max: 1,
|
|
24
|
+
connection: {
|
|
25
|
+
lock_timeout: MIGRATION_LOCK_TIMEOUT_MS,
|
|
26
|
+
statement_timeout: MIGRATION_STATEMENT_TIMEOUT_MS,
|
|
27
|
+
},
|
|
28
|
+
onnotice: (notice) => onNotice?.(notice.message),
|
|
29
|
+
});
|
|
14
30
|
try {
|
|
15
31
|
await migrate(drizzle(sql), { migrationsFolder });
|
|
16
32
|
}
|