@sealkeeper/schema 0.4.6 → 0.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/api.d.ts +787 -35
- package/dist/api.js +357 -44
- package/dist/conformance.d.ts +4 -0
- package/dist/conformance.js +7 -0
- package/dist/credential.d.ts +196 -27
- package/dist/credential.js +128 -80
- package/dist/dimensions.d.ts +16 -3
- package/dist/dimensions.js +48 -2
- package/dist/events.d.ts +1 -0
- package/dist/events.js +13 -1
- package/dist/fingerprint-conformance.d.ts +17 -0
- package/dist/fingerprint-conformance.js +83 -0
- package/dist/fingerprint.d.ts +132 -0
- package/dist/fingerprint.js +166 -0
- package/dist/goal.d.ts +16 -1
- package/dist/goal.js +29 -6
- package/dist/handshake-conformance.d.ts +18 -0
- package/dist/handshake-conformance.js +276 -0
- package/dist/handshake.d.ts +66 -0
- package/dist/handshake.js +187 -0
- package/dist/hidden.d.ts +1 -0
- package/dist/hidden.js +5 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +4 -1
- package/dist/moderation.js +1 -4
- package/dist/policy.d.ts +1 -1
- package/dist/policy.js +1 -1
- package/dist/seal-conformance.js +148 -4
- package/dist/seal-verify.d.ts +21 -0
- package/dist/seal-verify.js +63 -0
- package/dist/standing.d.ts +61 -0
- package/dist/standing.js +132 -4
- package/dist/task-templates.d.ts +46 -0
- package/dist/task-templates.js +501 -0
- package/dist/tasks.d.ts +43 -0
- package/dist/tasks.js +103 -0
- package/dist/template-conformance.d.ts +10 -0
- package/dist/template-conformance.js +298 -0
- package/dist/top-dimensions.d.ts +3 -3
- package/dist/top-dimensions.js +12 -6
- package/package.json +4 -8
- package/dist/db/agent-milestones.d.ts +0 -75
- package/dist/db/agent-milestones.js +0 -16
- package/dist/db/agent-renames.d.ts +0 -126
- package/dist/db/agent-renames.js +0 -20
- package/dist/db/agents.d.ts +0 -351
- package/dist/db/agents.js +0 -99
- package/dist/db/client.d.ts +0 -2561
- package/dist/db/client.js +0 -61
- package/dist/db/credentials.d.ts +0 -143
- package/dist/db/credentials.js +0 -16
- package/dist/db/deleted-operators.d.ts +0 -75
- package/dist/db/deleted-operators.js +0 -13
- package/dist/db/events.d.ts +0 -160
- package/dist/db/events.js +0 -41
- package/dist/db/feed-items.d.ts +0 -109
- package/dist/db/feed-items.js +0 -21
- package/dist/db/index.d.ts +0 -76
- package/dist/db/index.js +0 -28
- package/dist/db/migrate.d.ts +0 -1
- package/dist/db/migrate.js +0 -34
- package/dist/db/migrator.d.ts +0 -6
- package/dist/db/migrator.js +0 -36
- package/dist/db/operator-identities.d.ts +0 -211
- package/dist/db/operator-identities.js +0 -49
- package/dist/db/operator-level-grants.d.ts +0 -109
- package/dist/db/operator-level-grants.js +0 -30
- package/dist/db/operator-slugs.d.ts +0 -92
- package/dist/db/operator-slugs.js +0 -25
- package/dist/db/operators.d.ts +0 -228
- package/dist/db/operators.js +0 -39
- package/dist/db/quota-counters.d.ts +0 -109
- package/dist/db/quota-counters.js +0 -17
- package/dist/db/ratings.d.ts +0 -160
- package/dist/db/ratings.js +0 -27
- package/dist/db/scores.d.ts +0 -160
- package/dist/db/scores.js +0 -15
- package/dist/db/standing.d.ts +0 -264
- package/dist/db/standing.js +0 -34
- package/dist/db/task-claim-failures.d.ts +0 -143
- package/dist/db/task-claim-failures.js +0 -37
- package/dist/db/task-outcomes.d.ts +0 -145
- package/dist/db/task-outcomes.js +0 -25
- package/dist/db/tasks.d.ts +0 -381
- package/dist/db/tasks.js +0 -106
- package/dist/db/timestamps.d.ts +0 -4
- package/dist/db/timestamps.js +0 -24
- package/dist/db/url.d.ts +0 -12
- package/dist/db/url.js +0 -25
package/dist/db/agents.d.ts
DELETED
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
export declare const agents: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
-
name: "agents";
|
|
3
|
-
schema: undefined;
|
|
4
|
-
columns: {
|
|
5
|
-
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
|
-
name: "created_at";
|
|
7
|
-
tableName: "agents";
|
|
8
|
-
dataType: "date";
|
|
9
|
-
columnType: "PgTimestamp";
|
|
10
|
-
data: Date;
|
|
11
|
-
driverParam: string;
|
|
12
|
-
notNull: true;
|
|
13
|
-
hasDefault: true;
|
|
14
|
-
isPrimaryKey: false;
|
|
15
|
-
isAutoincrement: false;
|
|
16
|
-
hasRuntimeDefault: false;
|
|
17
|
-
enumValues: undefined;
|
|
18
|
-
baseColumn: never;
|
|
19
|
-
identity: undefined;
|
|
20
|
-
generated: undefined;
|
|
21
|
-
}, {}, {}>;
|
|
22
|
-
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
23
|
-
name: "updated_at";
|
|
24
|
-
tableName: "agents";
|
|
25
|
-
dataType: "date";
|
|
26
|
-
columnType: "PgTimestamp";
|
|
27
|
-
data: Date;
|
|
28
|
-
driverParam: string;
|
|
29
|
-
notNull: true;
|
|
30
|
-
hasDefault: true;
|
|
31
|
-
isPrimaryKey: false;
|
|
32
|
-
isAutoincrement: false;
|
|
33
|
-
hasRuntimeDefault: false;
|
|
34
|
-
enumValues: undefined;
|
|
35
|
-
baseColumn: never;
|
|
36
|
-
identity: undefined;
|
|
37
|
-
generated: undefined;
|
|
38
|
-
}, {}, {}>;
|
|
39
|
-
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
40
|
-
name: "id";
|
|
41
|
-
tableName: "agents";
|
|
42
|
-
dataType: "string";
|
|
43
|
-
columnType: "PgText";
|
|
44
|
-
data: string;
|
|
45
|
-
driverParam: string;
|
|
46
|
-
notNull: true;
|
|
47
|
-
hasDefault: false;
|
|
48
|
-
isPrimaryKey: true;
|
|
49
|
-
isAutoincrement: false;
|
|
50
|
-
hasRuntimeDefault: false;
|
|
51
|
-
enumValues: [string, ...string[]];
|
|
52
|
-
baseColumn: never;
|
|
53
|
-
identity: undefined;
|
|
54
|
-
generated: undefined;
|
|
55
|
-
}, {}, {}>;
|
|
56
|
-
operatorId: import("drizzle-orm/pg-core").PgColumn<{
|
|
57
|
-
name: "operator_id";
|
|
58
|
-
tableName: "agents";
|
|
59
|
-
dataType: "string";
|
|
60
|
-
columnType: "PgUUID";
|
|
61
|
-
data: string;
|
|
62
|
-
driverParam: string;
|
|
63
|
-
notNull: true;
|
|
64
|
-
hasDefault: false;
|
|
65
|
-
isPrimaryKey: false;
|
|
66
|
-
isAutoincrement: false;
|
|
67
|
-
hasRuntimeDefault: false;
|
|
68
|
-
enumValues: undefined;
|
|
69
|
-
baseColumn: never;
|
|
70
|
-
identity: undefined;
|
|
71
|
-
generated: undefined;
|
|
72
|
-
}, {}, {}>;
|
|
73
|
-
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
74
|
-
name: "name";
|
|
75
|
-
tableName: "agents";
|
|
76
|
-
dataType: "string";
|
|
77
|
-
columnType: "PgText";
|
|
78
|
-
data: string;
|
|
79
|
-
driverParam: string;
|
|
80
|
-
notNull: true;
|
|
81
|
-
hasDefault: false;
|
|
82
|
-
isPrimaryKey: false;
|
|
83
|
-
isAutoincrement: false;
|
|
84
|
-
hasRuntimeDefault: false;
|
|
85
|
-
enumValues: [string, ...string[]];
|
|
86
|
-
baseColumn: never;
|
|
87
|
-
identity: undefined;
|
|
88
|
-
generated: undefined;
|
|
89
|
-
}, {}, {}>;
|
|
90
|
-
version: import("drizzle-orm/pg-core").PgColumn<{
|
|
91
|
-
name: "version";
|
|
92
|
-
tableName: "agents";
|
|
93
|
-
dataType: "string";
|
|
94
|
-
columnType: "PgText";
|
|
95
|
-
data: string;
|
|
96
|
-
driverParam: string;
|
|
97
|
-
notNull: true;
|
|
98
|
-
hasDefault: false;
|
|
99
|
-
isPrimaryKey: false;
|
|
100
|
-
isAutoincrement: false;
|
|
101
|
-
hasRuntimeDefault: false;
|
|
102
|
-
enumValues: [string, ...string[]];
|
|
103
|
-
baseColumn: never;
|
|
104
|
-
identity: undefined;
|
|
105
|
-
generated: undefined;
|
|
106
|
-
}, {}, {}>;
|
|
107
|
-
versionIssuedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
108
|
-
name: "version_issued_at";
|
|
109
|
-
tableName: "agents";
|
|
110
|
-
dataType: "date";
|
|
111
|
-
columnType: "PgTimestamp";
|
|
112
|
-
data: Date;
|
|
113
|
-
driverParam: string;
|
|
114
|
-
notNull: false;
|
|
115
|
-
hasDefault: false;
|
|
116
|
-
isPrimaryKey: false;
|
|
117
|
-
isAutoincrement: false;
|
|
118
|
-
hasRuntimeDefault: false;
|
|
119
|
-
enumValues: undefined;
|
|
120
|
-
baseColumn: never;
|
|
121
|
-
identity: undefined;
|
|
122
|
-
generated: undefined;
|
|
123
|
-
}, {}, {}>;
|
|
124
|
-
card: import("drizzle-orm/pg-core").PgColumn<{
|
|
125
|
-
name: "card";
|
|
126
|
-
tableName: "agents";
|
|
127
|
-
dataType: "json";
|
|
128
|
-
columnType: "PgJsonb";
|
|
129
|
-
data: unknown;
|
|
130
|
-
driverParam: unknown;
|
|
131
|
-
notNull: false;
|
|
132
|
-
hasDefault: false;
|
|
133
|
-
isPrimaryKey: false;
|
|
134
|
-
isAutoincrement: false;
|
|
135
|
-
hasRuntimeDefault: false;
|
|
136
|
-
enumValues: undefined;
|
|
137
|
-
baseColumn: never;
|
|
138
|
-
identity: undefined;
|
|
139
|
-
generated: undefined;
|
|
140
|
-
}, {}, {}>;
|
|
141
|
-
runtime: import("drizzle-orm/pg-core").PgColumn<{
|
|
142
|
-
name: "runtime";
|
|
143
|
-
tableName: "agents";
|
|
144
|
-
dataType: "string";
|
|
145
|
-
columnType: "PgText";
|
|
146
|
-
data: "claude-code" | "codex" | "cursor" | "gemini-cli" | "mastra" | "openclaw" | "other" | "unknown";
|
|
147
|
-
driverParam: string;
|
|
148
|
-
notNull: true;
|
|
149
|
-
hasDefault: true;
|
|
150
|
-
isPrimaryKey: false;
|
|
151
|
-
isAutoincrement: false;
|
|
152
|
-
hasRuntimeDefault: false;
|
|
153
|
-
enumValues: [string, ...string[]];
|
|
154
|
-
baseColumn: never;
|
|
155
|
-
identity: undefined;
|
|
156
|
-
generated: undefined;
|
|
157
|
-
}, {}, {
|
|
158
|
-
$type: "claude-code" | "codex" | "cursor" | "gemini-cli" | "mastra" | "openclaw" | "other" | "unknown";
|
|
159
|
-
}>;
|
|
160
|
-
runtimeIssuedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
161
|
-
name: "runtime_issued_at";
|
|
162
|
-
tableName: "agents";
|
|
163
|
-
dataType: "date";
|
|
164
|
-
columnType: "PgTimestamp";
|
|
165
|
-
data: Date;
|
|
166
|
-
driverParam: string;
|
|
167
|
-
notNull: false;
|
|
168
|
-
hasDefault: false;
|
|
169
|
-
isPrimaryKey: false;
|
|
170
|
-
isAutoincrement: false;
|
|
171
|
-
hasRuntimeDefault: false;
|
|
172
|
-
enumValues: undefined;
|
|
173
|
-
baseColumn: never;
|
|
174
|
-
identity: undefined;
|
|
175
|
-
generated: undefined;
|
|
176
|
-
}, {}, {}>;
|
|
177
|
-
dirtySince: import("drizzle-orm/pg-core").PgColumn<{
|
|
178
|
-
name: "dirty_since";
|
|
179
|
-
tableName: "agents";
|
|
180
|
-
dataType: "date";
|
|
181
|
-
columnType: "PgTimestamp";
|
|
182
|
-
data: Date;
|
|
183
|
-
driverParam: string;
|
|
184
|
-
notNull: false;
|
|
185
|
-
hasDefault: true;
|
|
186
|
-
isPrimaryKey: false;
|
|
187
|
-
isAutoincrement: false;
|
|
188
|
-
hasRuntimeDefault: false;
|
|
189
|
-
enumValues: undefined;
|
|
190
|
-
baseColumn: never;
|
|
191
|
-
identity: undefined;
|
|
192
|
-
generated: undefined;
|
|
193
|
-
}, {}, {}>;
|
|
194
|
-
dirtyGen: import("drizzle-orm/pg-core").PgColumn<{
|
|
195
|
-
name: "dirty_gen";
|
|
196
|
-
tableName: "agents";
|
|
197
|
-
dataType: "number";
|
|
198
|
-
columnType: "PgBigInt53";
|
|
199
|
-
data: number;
|
|
200
|
-
driverParam: string | number;
|
|
201
|
-
notNull: true;
|
|
202
|
-
hasDefault: true;
|
|
203
|
-
isPrimaryKey: false;
|
|
204
|
-
isAutoincrement: false;
|
|
205
|
-
hasRuntimeDefault: false;
|
|
206
|
-
enumValues: undefined;
|
|
207
|
-
baseColumn: never;
|
|
208
|
-
identity: undefined;
|
|
209
|
-
generated: undefined;
|
|
210
|
-
}, {}, {}>;
|
|
211
|
-
recomputeAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
212
|
-
name: "recompute_at";
|
|
213
|
-
tableName: "agents";
|
|
214
|
-
dataType: "date";
|
|
215
|
-
columnType: "PgTimestamp";
|
|
216
|
-
data: Date;
|
|
217
|
-
driverParam: string;
|
|
218
|
-
notNull: false;
|
|
219
|
-
hasDefault: false;
|
|
220
|
-
isPrimaryKey: false;
|
|
221
|
-
isAutoincrement: false;
|
|
222
|
-
hasRuntimeDefault: false;
|
|
223
|
-
enumValues: undefined;
|
|
224
|
-
baseColumn: never;
|
|
225
|
-
identity: undefined;
|
|
226
|
-
generated: undefined;
|
|
227
|
-
}, {}, {}>;
|
|
228
|
-
termsVersion: import("drizzle-orm/pg-core").PgColumn<{
|
|
229
|
-
name: "terms_version";
|
|
230
|
-
tableName: "agents";
|
|
231
|
-
dataType: "string";
|
|
232
|
-
columnType: "PgText";
|
|
233
|
-
data: string;
|
|
234
|
-
driverParam: string;
|
|
235
|
-
notNull: false;
|
|
236
|
-
hasDefault: false;
|
|
237
|
-
isPrimaryKey: false;
|
|
238
|
-
isAutoincrement: false;
|
|
239
|
-
hasRuntimeDefault: false;
|
|
240
|
-
enumValues: [string, ...string[]];
|
|
241
|
-
baseColumn: never;
|
|
242
|
-
identity: undefined;
|
|
243
|
-
generated: undefined;
|
|
244
|
-
}, {}, {}>;
|
|
245
|
-
privacyVersion: import("drizzle-orm/pg-core").PgColumn<{
|
|
246
|
-
name: "privacy_version";
|
|
247
|
-
tableName: "agents";
|
|
248
|
-
dataType: "string";
|
|
249
|
-
columnType: "PgText";
|
|
250
|
-
data: string;
|
|
251
|
-
driverParam: string;
|
|
252
|
-
notNull: false;
|
|
253
|
-
hasDefault: false;
|
|
254
|
-
isPrimaryKey: false;
|
|
255
|
-
isAutoincrement: false;
|
|
256
|
-
hasRuntimeDefault: false;
|
|
257
|
-
enumValues: [string, ...string[]];
|
|
258
|
-
baseColumn: never;
|
|
259
|
-
identity: undefined;
|
|
260
|
-
generated: undefined;
|
|
261
|
-
}, {}, {}>;
|
|
262
|
-
eventCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
263
|
-
name: "event_count";
|
|
264
|
-
tableName: "agents";
|
|
265
|
-
dataType: "number";
|
|
266
|
-
columnType: "PgBigInt53";
|
|
267
|
-
data: number;
|
|
268
|
-
driverParam: string | number;
|
|
269
|
-
notNull: true;
|
|
270
|
-
hasDefault: true;
|
|
271
|
-
isPrimaryKey: false;
|
|
272
|
-
isAutoincrement: false;
|
|
273
|
-
hasRuntimeDefault: false;
|
|
274
|
-
enumValues: undefined;
|
|
275
|
-
baseColumn: never;
|
|
276
|
-
identity: undefined;
|
|
277
|
-
generated: undefined;
|
|
278
|
-
}, {}, {}>;
|
|
279
|
-
sessionCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
280
|
-
name: "session_count";
|
|
281
|
-
tableName: "agents";
|
|
282
|
-
dataType: "number";
|
|
283
|
-
columnType: "PgBigInt53";
|
|
284
|
-
data: number;
|
|
285
|
-
driverParam: string | number;
|
|
286
|
-
notNull: true;
|
|
287
|
-
hasDefault: true;
|
|
288
|
-
isPrimaryKey: false;
|
|
289
|
-
isAutoincrement: false;
|
|
290
|
-
hasRuntimeDefault: false;
|
|
291
|
-
enumValues: undefined;
|
|
292
|
-
baseColumn: never;
|
|
293
|
-
identity: undefined;
|
|
294
|
-
generated: undefined;
|
|
295
|
-
}, {}, {}>;
|
|
296
|
-
toolCallCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
297
|
-
name: "tool_call_count";
|
|
298
|
-
tableName: "agents";
|
|
299
|
-
dataType: "number";
|
|
300
|
-
columnType: "PgBigInt53";
|
|
301
|
-
data: number;
|
|
302
|
-
driverParam: string | number;
|
|
303
|
-
notNull: true;
|
|
304
|
-
hasDefault: true;
|
|
305
|
-
isPrimaryKey: false;
|
|
306
|
-
isAutoincrement: false;
|
|
307
|
-
hasRuntimeDefault: false;
|
|
308
|
-
enumValues: undefined;
|
|
309
|
-
baseColumn: never;
|
|
310
|
-
identity: undefined;
|
|
311
|
-
generated: undefined;
|
|
312
|
-
}, {}, {}>;
|
|
313
|
-
incidentCount: import("drizzle-orm/pg-core").PgColumn<{
|
|
314
|
-
name: "incident_count";
|
|
315
|
-
tableName: "agents";
|
|
316
|
-
dataType: "number";
|
|
317
|
-
columnType: "PgBigInt53";
|
|
318
|
-
data: number;
|
|
319
|
-
driverParam: string | number;
|
|
320
|
-
notNull: true;
|
|
321
|
-
hasDefault: true;
|
|
322
|
-
isPrimaryKey: false;
|
|
323
|
-
isAutoincrement: false;
|
|
324
|
-
hasRuntimeDefault: false;
|
|
325
|
-
enumValues: undefined;
|
|
326
|
-
baseColumn: never;
|
|
327
|
-
identity: undefined;
|
|
328
|
-
generated: undefined;
|
|
329
|
-
}, {}, {}>;
|
|
330
|
-
lastSeenAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
331
|
-
name: "last_seen_at";
|
|
332
|
-
tableName: "agents";
|
|
333
|
-
dataType: "date";
|
|
334
|
-
columnType: "PgTimestamp";
|
|
335
|
-
data: Date;
|
|
336
|
-
driverParam: string;
|
|
337
|
-
notNull: false;
|
|
338
|
-
hasDefault: false;
|
|
339
|
-
isPrimaryKey: false;
|
|
340
|
-
isAutoincrement: false;
|
|
341
|
-
hasRuntimeDefault: false;
|
|
342
|
-
enumValues: undefined;
|
|
343
|
-
baseColumn: never;
|
|
344
|
-
identity: undefined;
|
|
345
|
-
generated: undefined;
|
|
346
|
-
}, {}, {}>;
|
|
347
|
-
};
|
|
348
|
-
dialect: 'pg';
|
|
349
|
-
}>;
|
|
350
|
-
export type Agent = typeof agents.$inferSelect;
|
|
351
|
-
export type NewAgent = typeof agents.$inferInsert;
|
package/dist/db/agents.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { sql } from 'drizzle-orm';
|
|
2
|
-
import { bigint, check, index, jsonb, pgTable, text, timestamp, uniqueIndex, uuid, } from 'drizzle-orm/pg-core';
|
|
3
|
-
import { RUNTIMES } from '../runtime.js';
|
|
4
|
-
import { operators } from './operators.js';
|
|
5
|
-
import { timestamps } from './timestamps.js';
|
|
6
|
-
// How a Drizzle table is declared.
|
|
7
|
-
//
|
|
8
|
-
// pgTable(sqlName, columns, extras) returns a table object. Queries use it,
|
|
9
|
-
// as in db.select().from(agents), and drizzle-kit diffs it to write
|
|
10
|
-
// migrations.
|
|
11
|
-
//
|
|
12
|
-
// columns maps a TypeScript property to a column builder. The first argument
|
|
13
|
-
// of each builder is the SQL column name, so the property is camelCase in
|
|
14
|
-
// code and snake_case in the database. Builders chain constraints such as
|
|
15
|
-
// .notNull(), .primaryKey() and .references(() => operators.id). The arrow in
|
|
16
|
-
// references() lets tables point at each other regardless of file order.
|
|
17
|
-
//
|
|
18
|
-
// ...timestamps spreads the shared created_at and updated_at columns in.
|
|
19
|
-
//
|
|
20
|
-
// extras receives the built columns and returns table level constraints and
|
|
21
|
-
// indexes. Here it is a check constraint written as raw SQL. The agent id is
|
|
22
|
-
// the ed25519 public key, 32 bytes, base64url without padding, so 43 chars.
|
|
23
|
-
export const agents = pgTable('agents', {
|
|
24
|
-
id: text('id').primaryKey(),
|
|
25
|
-
operatorId: uuid('operator_id')
|
|
26
|
-
.notNull()
|
|
27
|
-
.references(() => operators.id),
|
|
28
|
-
name: text('name').notNull(),
|
|
29
|
-
version: text('version').notNull(),
|
|
30
|
-
// The signed issuedAt of the last version change, null until the first.
|
|
31
|
-
// A change issued no later than this one is refused, so an old envelope
|
|
32
|
-
// sent again cannot move the version back.
|
|
33
|
-
versionIssuedAt: timestamp('version_issued_at', { withTimezone: true }),
|
|
34
|
-
card: jsonb('card'),
|
|
35
|
-
// What the agent runs in, one of RUNTIMES. Set by the signed
|
|
36
|
-
// registration payload and changed by the signed PATCH, unknown until
|
|
37
|
-
// then. Migration 0024 backfilled unknown for every agent, since events
|
|
38
|
-
// do not say which adapter sent them.
|
|
39
|
-
runtime: text('runtime').$type().notNull().default('unknown'),
|
|
40
|
-
// The signed issuedAt of the last runtime change, null until the first.
|
|
41
|
-
// Same rule as versionIssuedAt, so an old envelope sent again cannot
|
|
42
|
-
// move the runtime back.
|
|
43
|
-
runtimeIssuedAt: timestamp('runtime_issued_at', { withTimezone: true }),
|
|
44
|
-
// When the agent was first marked dirty since the scoring run last
|
|
45
|
-
// cleared it. Every write that can move the agent's standing marks it,
|
|
46
|
-
// in the same transaction as that write, but a mark sets this only when
|
|
47
|
-
// it is null, so an agent that keeps being marked keeps its place in the
|
|
48
|
-
// run's queue. defaultNow, so a new agent starts dirty and migration
|
|
49
|
-
// 0018 backfilled every existing agent. Not a row timestamp, the scoring
|
|
50
|
-
// run owns it.
|
|
51
|
-
dirtySince: timestamp('dirty_since', { withTimezone: true }).defaultNow(),
|
|
52
|
-
// Bumped by every mark. The run reads it when it selects the agent and
|
|
53
|
-
// clears dirty_since only where it is unchanged, so a mark that commits
|
|
54
|
-
// mid run survives (migration 0019).
|
|
55
|
-
dirtyGen: bigint('dirty_gen', { mode: 'number' }).notNull().default(0),
|
|
56
|
-
// The earliest future moment time alone can change this agent's
|
|
57
|
-
// standing, a dormancy rung or evidence leaving the window. Written by
|
|
58
|
-
// the scoring run only, null when nothing is due.
|
|
59
|
-
recomputeAt: timestamp('recompute_at', { withTimezone: true }),
|
|
60
|
-
// The POLICY_VERSIONS the operator accepted by registering this agent,
|
|
61
|
-
// stamped by the API at registration, never sent by the client
|
|
62
|
-
// (VOU-121). Null for agents registered before.
|
|
63
|
-
termsVersion: text('terms_version'),
|
|
64
|
-
privacyVersion: text('privacy_version'),
|
|
65
|
-
// Live counts of the agent's events, all time, and the newest
|
|
66
|
-
// received_at, for the agent answers (VOU-207). The database keeps them.
|
|
67
|
-
// The events_count_agent_events trigger (migration 0038) adds each
|
|
68
|
-
// insert statement's accepted rows, so a replay skipped by ON CONFLICT
|
|
69
|
-
// adds nothing, and the application never writes them. Reading them is
|
|
70
|
-
// one primary key read however many events the agent has sent. Events
|
|
71
|
-
// are append only and deleted only with their agent, so nothing ever
|
|
72
|
-
// takes one away. bigint, since an agent at the ingest cap sends
|
|
73
|
-
// millions a day.
|
|
74
|
-
eventCount: bigint('event_count', { mode: 'number' }).notNull().default(0),
|
|
75
|
-
sessionCount: bigint('session_count', { mode: 'number' })
|
|
76
|
-
.notNull()
|
|
77
|
-
.default(0),
|
|
78
|
-
toolCallCount: bigint('tool_call_count', { mode: 'number' })
|
|
79
|
-
.notNull()
|
|
80
|
-
.default(0),
|
|
81
|
-
incidentCount: bigint('incident_count', { mode: 'number' })
|
|
82
|
-
.notNull()
|
|
83
|
-
.default(0),
|
|
84
|
-
lastSeenAt: timestamp('last_seen_at', { withTimezone: true }),
|
|
85
|
-
...timestamps,
|
|
86
|
-
}, (t) => [
|
|
87
|
-
check('agents_id_length', sql `length(${t.id}) = 43`),
|
|
88
|
-
// Built from RUNTIMES, so a runtime added there shows up as a changed
|
|
89
|
-
// check in the next drizzle-kit generate.
|
|
90
|
-
check('agents_runtime', sql `${t.runtime} in (${sql.raw(RUNTIMES.map((r) => `'${r}'`).join(', '))})`),
|
|
91
|
-
// The handle login/name points at one agent. Names are lowercase, so a
|
|
92
|
-
// plain unique index is enough.
|
|
93
|
-
uniqueIndex('agents_operator_name_unique').on(t.operatorId, t.name),
|
|
94
|
-
// The scoring run selects agents that are dirty or due.
|
|
95
|
-
index('agents_recompute_at_idx').on(t.recomputeAt),
|
|
96
|
-
index('agents_dirty_since_idx')
|
|
97
|
-
.on(t.dirtySince)
|
|
98
|
-
.where(sql `${t.dirtySince} is not null`),
|
|
99
|
-
]);
|