@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
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
export declare const taskOutcomes: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
-
name: "task_outcomes";
|
|
3
|
-
schema: undefined;
|
|
4
|
-
columns: {
|
|
5
|
-
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
|
-
name: "created_at";
|
|
7
|
-
tableName: "task_outcomes";
|
|
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: "task_outcomes";
|
|
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: "task_outcomes";
|
|
42
|
-
dataType: "string";
|
|
43
|
-
columnType: "PgUUID";
|
|
44
|
-
data: string;
|
|
45
|
-
driverParam: string;
|
|
46
|
-
notNull: true;
|
|
47
|
-
hasDefault: false;
|
|
48
|
-
isPrimaryKey: true;
|
|
49
|
-
isAutoincrement: false;
|
|
50
|
-
hasRuntimeDefault: false;
|
|
51
|
-
enumValues: undefined;
|
|
52
|
-
baseColumn: never;
|
|
53
|
-
identity: undefined;
|
|
54
|
-
generated: undefined;
|
|
55
|
-
}, {}, {}>;
|
|
56
|
-
taskId: import("drizzle-orm/pg-core").PgColumn<{
|
|
57
|
-
name: "task_id";
|
|
58
|
-
tableName: "task_outcomes";
|
|
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
|
-
reportingAgentId: import("drizzle-orm/pg-core").PgColumn<{
|
|
74
|
-
name: "reporting_agent_id";
|
|
75
|
-
tableName: "task_outcomes";
|
|
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
|
-
outcome: import("drizzle-orm/pg-core").PgColumn<{
|
|
91
|
-
name: "outcome";
|
|
92
|
-
tableName: "task_outcomes";
|
|
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
|
-
evidence: import("drizzle-orm/pg-core").PgColumn<{
|
|
108
|
-
name: "evidence";
|
|
109
|
-
tableName: "task_outcomes";
|
|
110
|
-
dataType: "json";
|
|
111
|
-
columnType: "PgJsonb";
|
|
112
|
-
data: unknown;
|
|
113
|
-
driverParam: unknown;
|
|
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
|
-
origin: import("drizzle-orm/pg-core").PgColumn<{
|
|
125
|
-
name: "origin";
|
|
126
|
-
tableName: "task_outcomes";
|
|
127
|
-
dataType: "string";
|
|
128
|
-
columnType: "PgText";
|
|
129
|
-
data: "manual" | "routine" | "template";
|
|
130
|
-
driverParam: string;
|
|
131
|
-
notNull: true;
|
|
132
|
-
hasDefault: true;
|
|
133
|
-
isPrimaryKey: false;
|
|
134
|
-
isAutoincrement: false;
|
|
135
|
-
hasRuntimeDefault: false;
|
|
136
|
-
enumValues: [string, ...string[]];
|
|
137
|
-
baseColumn: never;
|
|
138
|
-
identity: undefined;
|
|
139
|
-
generated: undefined;
|
|
140
|
-
}, {}, {
|
|
141
|
-
$type: "manual" | "routine" | "template";
|
|
142
|
-
}>;
|
|
143
|
-
};
|
|
144
|
-
dialect: 'pg';
|
|
145
|
-
}>;
|
package/dist/db/task-outcomes.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { sql } from 'drizzle-orm';
|
|
2
|
-
import { check, jsonb, pgTable, text, unique, uuid } from 'drizzle-orm/pg-core';
|
|
3
|
-
import { agents } from './agents.js';
|
|
4
|
-
import { tasks } from './tasks.js';
|
|
5
|
-
import { timestamps } from './timestamps.js';
|
|
6
|
-
export const taskOutcomes = pgTable('task_outcomes', {
|
|
7
|
-
id: uuid('id').primaryKey(),
|
|
8
|
-
taskId: uuid('task_id')
|
|
9
|
-
.notNull()
|
|
10
|
-
.references(() => tasks.id),
|
|
11
|
-
reportingAgentId: text('reporting_agent_id')
|
|
12
|
-
.notNull()
|
|
13
|
-
.references(() => agents.id),
|
|
14
|
-
outcome: text('outcome').notNull(),
|
|
15
|
-
evidence: jsonb('evidence'),
|
|
16
|
-
// Where this report came from, TaskOrigin in ../api.ts, from the signed
|
|
17
|
-
// outcome payload. manual when the payload has none. A new report
|
|
18
|
-
// replaces it with the rest. Gold leaves out a confirmed task either of
|
|
19
|
-
// whose reports is routine.
|
|
20
|
-
origin: text('origin').$type().notNull().default('manual'),
|
|
21
|
-
...timestamps,
|
|
22
|
-
}, (t) => [
|
|
23
|
-
check('task_outcomes_origin', sql `${t.origin} in ('manual', 'template', 'routine')`),
|
|
24
|
-
unique('task_outcomes_task_id_reporting_agent_id_unique').on(t.taskId, t.reportingAgentId),
|
|
25
|
-
]);
|
package/dist/db/tasks.d.ts
DELETED
|
@@ -1,381 +0,0 @@
|
|
|
1
|
-
export declare const tasks: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
2
|
-
name: "tasks";
|
|
3
|
-
schema: undefined;
|
|
4
|
-
columns: {
|
|
5
|
-
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
6
|
-
name: "created_at";
|
|
7
|
-
tableName: "tasks";
|
|
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: "tasks";
|
|
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: "tasks";
|
|
42
|
-
dataType: "string";
|
|
43
|
-
columnType: "PgUUID";
|
|
44
|
-
data: string;
|
|
45
|
-
driverParam: string;
|
|
46
|
-
notNull: true;
|
|
47
|
-
hasDefault: false;
|
|
48
|
-
isPrimaryKey: true;
|
|
49
|
-
isAutoincrement: false;
|
|
50
|
-
hasRuntimeDefault: false;
|
|
51
|
-
enumValues: undefined;
|
|
52
|
-
baseColumn: never;
|
|
53
|
-
identity: undefined;
|
|
54
|
-
generated: undefined;
|
|
55
|
-
}, {}, {}>;
|
|
56
|
-
posterAgentId: import("drizzle-orm/pg-core").PgColumn<{
|
|
57
|
-
name: "poster_agent_id";
|
|
58
|
-
tableName: "tasks";
|
|
59
|
-
dataType: "string";
|
|
60
|
-
columnType: "PgText";
|
|
61
|
-
data: string;
|
|
62
|
-
driverParam: string;
|
|
63
|
-
notNull: true;
|
|
64
|
-
hasDefault: false;
|
|
65
|
-
isPrimaryKey: false;
|
|
66
|
-
isAutoincrement: false;
|
|
67
|
-
hasRuntimeDefault: false;
|
|
68
|
-
enumValues: [string, ...string[]];
|
|
69
|
-
baseColumn: never;
|
|
70
|
-
identity: undefined;
|
|
71
|
-
generated: undefined;
|
|
72
|
-
}, {}, {}>;
|
|
73
|
-
claimantAgentId: import("drizzle-orm/pg-core").PgColumn<{
|
|
74
|
-
name: "claimant_agent_id";
|
|
75
|
-
tableName: "tasks";
|
|
76
|
-
dataType: "string";
|
|
77
|
-
columnType: "PgText";
|
|
78
|
-
data: string;
|
|
79
|
-
driverParam: string;
|
|
80
|
-
notNull: false;
|
|
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
|
-
assigneeAgentId: import("drizzle-orm/pg-core").PgColumn<{
|
|
91
|
-
name: "assignee_agent_id";
|
|
92
|
-
tableName: "tasks";
|
|
93
|
-
dataType: "string";
|
|
94
|
-
columnType: "PgText";
|
|
95
|
-
data: string;
|
|
96
|
-
driverParam: string;
|
|
97
|
-
notNull: false;
|
|
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
|
-
pairSettledAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
108
|
-
name: "pair_settled_at";
|
|
109
|
-
tableName: "tasks";
|
|
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
|
-
overPairCap: import("drizzle-orm/pg-core").PgColumn<{
|
|
125
|
-
name: "over_pair_cap";
|
|
126
|
-
tableName: "tasks";
|
|
127
|
-
dataType: "boolean";
|
|
128
|
-
columnType: "PgBoolean";
|
|
129
|
-
data: boolean;
|
|
130
|
-
driverParam: boolean;
|
|
131
|
-
notNull: true;
|
|
132
|
-
hasDefault: true;
|
|
133
|
-
isPrimaryKey: false;
|
|
134
|
-
isAutoincrement: false;
|
|
135
|
-
hasRuntimeDefault: false;
|
|
136
|
-
enumValues: undefined;
|
|
137
|
-
baseColumn: never;
|
|
138
|
-
identity: undefined;
|
|
139
|
-
generated: undefined;
|
|
140
|
-
}, {}, {}>;
|
|
141
|
-
origin: import("drizzle-orm/pg-core").PgColumn<{
|
|
142
|
-
name: "origin";
|
|
143
|
-
tableName: "tasks";
|
|
144
|
-
dataType: "string";
|
|
145
|
-
columnType: "PgText";
|
|
146
|
-
data: "manual" | "routine" | "template";
|
|
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: "manual" | "routine" | "template";
|
|
159
|
-
}>;
|
|
160
|
-
taskType: import("drizzle-orm/pg-core").PgColumn<{
|
|
161
|
-
name: "task_type";
|
|
162
|
-
tableName: "tasks";
|
|
163
|
-
dataType: "string";
|
|
164
|
-
columnType: "PgText";
|
|
165
|
-
data: string;
|
|
166
|
-
driverParam: string;
|
|
167
|
-
notNull: true;
|
|
168
|
-
hasDefault: false;
|
|
169
|
-
isPrimaryKey: false;
|
|
170
|
-
isAutoincrement: false;
|
|
171
|
-
hasRuntimeDefault: false;
|
|
172
|
-
enumValues: [string, ...string[]];
|
|
173
|
-
baseColumn: never;
|
|
174
|
-
identity: undefined;
|
|
175
|
-
generated: undefined;
|
|
176
|
-
}, {}, {}>;
|
|
177
|
-
spec: import("drizzle-orm/pg-core").PgColumn<{
|
|
178
|
-
name: "spec";
|
|
179
|
-
tableName: "tasks";
|
|
180
|
-
dataType: "json";
|
|
181
|
-
columnType: "PgJsonb";
|
|
182
|
-
data: unknown;
|
|
183
|
-
driverParam: unknown;
|
|
184
|
-
notNull: true;
|
|
185
|
-
hasDefault: false;
|
|
186
|
-
isPrimaryKey: false;
|
|
187
|
-
isAutoincrement: false;
|
|
188
|
-
hasRuntimeDefault: false;
|
|
189
|
-
enumValues: undefined;
|
|
190
|
-
baseColumn: never;
|
|
191
|
-
identity: undefined;
|
|
192
|
-
generated: undefined;
|
|
193
|
-
}, {}, {}>;
|
|
194
|
-
verification: import("drizzle-orm/pg-core").PgColumn<{
|
|
195
|
-
name: "verification";
|
|
196
|
-
tableName: "tasks";
|
|
197
|
-
dataType: "json";
|
|
198
|
-
columnType: "PgJsonb";
|
|
199
|
-
data: unknown;
|
|
200
|
-
driverParam: unknown;
|
|
201
|
-
notNull: true;
|
|
202
|
-
hasDefault: false;
|
|
203
|
-
isPrimaryKey: false;
|
|
204
|
-
isAutoincrement: false;
|
|
205
|
-
hasRuntimeDefault: false;
|
|
206
|
-
enumValues: undefined;
|
|
207
|
-
baseColumn: never;
|
|
208
|
-
identity: undefined;
|
|
209
|
-
generated: undefined;
|
|
210
|
-
}, {}, {}>;
|
|
211
|
-
postedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
212
|
-
name: "posted_at";
|
|
213
|
-
tableName: "tasks";
|
|
214
|
-
dataType: "date";
|
|
215
|
-
columnType: "PgTimestamp";
|
|
216
|
-
data: Date;
|
|
217
|
-
driverParam: string;
|
|
218
|
-
notNull: true;
|
|
219
|
-
hasDefault: true;
|
|
220
|
-
isPrimaryKey: false;
|
|
221
|
-
isAutoincrement: false;
|
|
222
|
-
hasRuntimeDefault: false;
|
|
223
|
-
enumValues: undefined;
|
|
224
|
-
baseColumn: never;
|
|
225
|
-
identity: undefined;
|
|
226
|
-
generated: undefined;
|
|
227
|
-
}, {}, {}>;
|
|
228
|
-
claimedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
229
|
-
name: "claimed_at";
|
|
230
|
-
tableName: "tasks";
|
|
231
|
-
dataType: "date";
|
|
232
|
-
columnType: "PgTimestamp";
|
|
233
|
-
data: Date;
|
|
234
|
-
driverParam: string;
|
|
235
|
-
notNull: false;
|
|
236
|
-
hasDefault: false;
|
|
237
|
-
isPrimaryKey: false;
|
|
238
|
-
isAutoincrement: false;
|
|
239
|
-
hasRuntimeDefault: false;
|
|
240
|
-
enumValues: undefined;
|
|
241
|
-
baseColumn: never;
|
|
242
|
-
identity: undefined;
|
|
243
|
-
generated: undefined;
|
|
244
|
-
}, {}, {}>;
|
|
245
|
-
submittedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
246
|
-
name: "submitted_at";
|
|
247
|
-
tableName: "tasks";
|
|
248
|
-
dataType: "date";
|
|
249
|
-
columnType: "PgTimestamp";
|
|
250
|
-
data: Date;
|
|
251
|
-
driverParam: string;
|
|
252
|
-
notNull: false;
|
|
253
|
-
hasDefault: false;
|
|
254
|
-
isPrimaryKey: false;
|
|
255
|
-
isAutoincrement: false;
|
|
256
|
-
hasRuntimeDefault: false;
|
|
257
|
-
enumValues: undefined;
|
|
258
|
-
baseColumn: never;
|
|
259
|
-
identity: undefined;
|
|
260
|
-
generated: undefined;
|
|
261
|
-
}, {}, {}>;
|
|
262
|
-
verifiedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
263
|
-
name: "verified_at";
|
|
264
|
-
tableName: "tasks";
|
|
265
|
-
dataType: "date";
|
|
266
|
-
columnType: "PgTimestamp";
|
|
267
|
-
data: Date;
|
|
268
|
-
driverParam: string;
|
|
269
|
-
notNull: false;
|
|
270
|
-
hasDefault: false;
|
|
271
|
-
isPrimaryKey: false;
|
|
272
|
-
isAutoincrement: false;
|
|
273
|
-
hasRuntimeDefault: false;
|
|
274
|
-
enumValues: undefined;
|
|
275
|
-
baseColumn: never;
|
|
276
|
-
identity: undefined;
|
|
277
|
-
generated: undefined;
|
|
278
|
-
}, {}, {}>;
|
|
279
|
-
submission: import("drizzle-orm/pg-core").PgColumn<{
|
|
280
|
-
name: "submission";
|
|
281
|
-
tableName: "tasks";
|
|
282
|
-
dataType: "json";
|
|
283
|
-
columnType: "PgJsonb";
|
|
284
|
-
data: {
|
|
285
|
-
text: string;
|
|
286
|
-
};
|
|
287
|
-
driverParam: unknown;
|
|
288
|
-
notNull: false;
|
|
289
|
-
hasDefault: false;
|
|
290
|
-
isPrimaryKey: false;
|
|
291
|
-
isAutoincrement: false;
|
|
292
|
-
hasRuntimeDefault: false;
|
|
293
|
-
enumValues: undefined;
|
|
294
|
-
baseColumn: never;
|
|
295
|
-
identity: undefined;
|
|
296
|
-
generated: undefined;
|
|
297
|
-
}, {}, {
|
|
298
|
-
$type: {
|
|
299
|
-
text: string;
|
|
300
|
-
};
|
|
301
|
-
}>;
|
|
302
|
-
failedSubmits: import("drizzle-orm/pg-core").PgColumn<{
|
|
303
|
-
name: "failed_submits";
|
|
304
|
-
tableName: "tasks";
|
|
305
|
-
dataType: "number";
|
|
306
|
-
columnType: "PgInteger";
|
|
307
|
-
data: number;
|
|
308
|
-
driverParam: string | number;
|
|
309
|
-
notNull: true;
|
|
310
|
-
hasDefault: true;
|
|
311
|
-
isPrimaryKey: false;
|
|
312
|
-
isAutoincrement: false;
|
|
313
|
-
hasRuntimeDefault: false;
|
|
314
|
-
enumValues: undefined;
|
|
315
|
-
baseColumn: never;
|
|
316
|
-
identity: undefined;
|
|
317
|
-
generated: undefined;
|
|
318
|
-
}, {}, {}>;
|
|
319
|
-
barredAgentIds: import("drizzle-orm/pg-core").PgColumn<{
|
|
320
|
-
name: "barred_agent_ids";
|
|
321
|
-
tableName: "tasks";
|
|
322
|
-
dataType: "array";
|
|
323
|
-
columnType: "PgArray";
|
|
324
|
-
data: string[];
|
|
325
|
-
driverParam: string | string[];
|
|
326
|
-
notNull: true;
|
|
327
|
-
hasDefault: true;
|
|
328
|
-
isPrimaryKey: false;
|
|
329
|
-
isAutoincrement: false;
|
|
330
|
-
hasRuntimeDefault: false;
|
|
331
|
-
enumValues: [string, ...string[]];
|
|
332
|
-
baseColumn: import("drizzle-orm").Column<{
|
|
333
|
-
name: "barred_agent_ids";
|
|
334
|
-
tableName: "tasks";
|
|
335
|
-
dataType: "string";
|
|
336
|
-
columnType: "PgText";
|
|
337
|
-
data: string;
|
|
338
|
-
driverParam: string;
|
|
339
|
-
notNull: false;
|
|
340
|
-
hasDefault: false;
|
|
341
|
-
isPrimaryKey: false;
|
|
342
|
-
isAutoincrement: false;
|
|
343
|
-
hasRuntimeDefault: false;
|
|
344
|
-
enumValues: [string, ...string[]];
|
|
345
|
-
baseColumn: never;
|
|
346
|
-
identity: undefined;
|
|
347
|
-
generated: undefined;
|
|
348
|
-
}, {}, {}>;
|
|
349
|
-
identity: undefined;
|
|
350
|
-
generated: undefined;
|
|
351
|
-
}, {}, {
|
|
352
|
-
baseBuilder: import("drizzle-orm/pg-core").PgColumnBuilder<{
|
|
353
|
-
name: "barred_agent_ids";
|
|
354
|
-
dataType: 'string';
|
|
355
|
-
columnType: 'PgText';
|
|
356
|
-
data: string;
|
|
357
|
-
enumValues: [string, ...string[]];
|
|
358
|
-
driverParam: string;
|
|
359
|
-
}, {}, {}, import("drizzle-orm").ColumnBuilderExtraConfig>;
|
|
360
|
-
size: undefined;
|
|
361
|
-
}>;
|
|
362
|
-
expiresAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
363
|
-
name: "expires_at";
|
|
364
|
-
tableName: "tasks";
|
|
365
|
-
dataType: "date";
|
|
366
|
-
columnType: "PgTimestamp";
|
|
367
|
-
data: Date;
|
|
368
|
-
driverParam: string;
|
|
369
|
-
notNull: true;
|
|
370
|
-
hasDefault: false;
|
|
371
|
-
isPrimaryKey: false;
|
|
372
|
-
isAutoincrement: false;
|
|
373
|
-
hasRuntimeDefault: false;
|
|
374
|
-
enumValues: undefined;
|
|
375
|
-
baseColumn: never;
|
|
376
|
-
identity: undefined;
|
|
377
|
-
generated: undefined;
|
|
378
|
-
}, {}, {}>;
|
|
379
|
-
};
|
|
380
|
-
dialect: 'pg';
|
|
381
|
-
}>;
|
package/dist/db/tasks.js
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { sql } from 'drizzle-orm';
|
|
2
|
-
import { boolean, check, index, integer, jsonb, pgTable, text, timestamp, uuid, } from 'drizzle-orm/pg-core';
|
|
3
|
-
import { agents } from './agents.js';
|
|
4
|
-
import { timestamps } from './timestamps.js';
|
|
5
|
-
export const tasks = pgTable('tasks', {
|
|
6
|
-
id: uuid('id').primaryKey(),
|
|
7
|
-
posterAgentId: text('poster_agent_id')
|
|
8
|
-
.notNull()
|
|
9
|
-
.references(() => agents.id),
|
|
10
|
-
claimantAgentId: text('claimant_agent_id').references(() => agents.id),
|
|
11
|
-
// The one agent an addressed task is for, null for an open task. Only it
|
|
12
|
-
// can claim the task, and the open pool leaves it out. Set at post and
|
|
13
|
-
// never changed, except that deleting the assignee agent deletes its
|
|
14
|
-
// unverified addressed tasks and nulls this on its verified ones, whose
|
|
15
|
-
// claimant it was (deleteAgents in apps/api/src/account.ts).
|
|
16
|
-
assigneeAgentId: text('assignee_agent_id').references(() => agents.id),
|
|
17
|
-
// When a claimed addressed task settled for its operator pair's cap,
|
|
18
|
-
// verified_at when it verified, expires_at when it expired unverified.
|
|
19
|
-
// Null for an open task and until it settles. Set once, with
|
|
20
|
-
// over_pair_cap, by apps/api/src/pair-cap.ts.
|
|
21
|
-
pairSettledAt: timestamp('pair_settled_at', { withTimezone: true }),
|
|
22
|
-
// True for a settled addressed task that came past its operator pair's
|
|
23
|
-
// cap, so it weighs nothing as evidence, success or failure. False for
|
|
24
|
-
// every other task.
|
|
25
|
-
overPairCap: boolean('over_pair_cap').notNull().default(false),
|
|
26
|
-
// Where the post came from, TaskOrigin in ../api.ts, from the signed
|
|
27
|
-
// post payload. manual when the payload has none, and for every task
|
|
28
|
-
// posted before origin existed. Gold counts a confirmed task only when
|
|
29
|
-
// this is manual (apps/api/src/scoring/evidence.ts).
|
|
30
|
-
origin: text('origin').$type().notNull().default('manual'),
|
|
31
|
-
taskType: text('task_type').notNull(),
|
|
32
|
-
spec: jsonb('spec').notNull(),
|
|
33
|
-
verification: jsonb('verification').notNull(),
|
|
34
|
-
postedAt: timestamp('posted_at', { withTimezone: true })
|
|
35
|
-
.notNull()
|
|
36
|
-
.defaultNow(),
|
|
37
|
-
claimedAt: timestamp('claimed_at', { withTimezone: true }),
|
|
38
|
-
submittedAt: timestamp('submitted_at', { withTimezone: true }),
|
|
39
|
-
verifiedAt: timestamp('verified_at', { withTimezone: true }),
|
|
40
|
-
// What the claimant submitted, null until submit. Only the poster and the
|
|
41
|
-
// claimant may read it. Wrapped in an object because a bare jsonb string
|
|
42
|
-
// does not survive a read. postgres-js parses jsonb and Drizzle then
|
|
43
|
-
// JSON.parses any string it gets back, so "123" would return as 123.
|
|
44
|
-
submission: jsonb('submission').$type(),
|
|
45
|
-
// Failed submits on the current claim of a hash or schema task. The
|
|
46
|
-
// submit route counts them up, and at the cap (TASK_MAX_FAILED_SUBMITS
|
|
47
|
-
// in apps/api/src/routes/tasks.ts) it releases the claim and sets this
|
|
48
|
-
// back to 0 for the next claimant.
|
|
49
|
-
failedSubmits: integer('failed_submits').notNull().default(0),
|
|
50
|
-
// Agents whose claim was released at the failed submit cap. None of them
|
|
51
|
-
// can claim this task again, so guessing at a public hash costs a claim
|
|
52
|
-
// each three tries. Deleting an agent takes its id out.
|
|
53
|
-
barredAgentIds: text('barred_agent_ids')
|
|
54
|
-
.array()
|
|
55
|
-
.notNull()
|
|
56
|
-
.default(sql `'{}'::text[]`),
|
|
57
|
-
expiresAt: timestamp('expires_at', { withTimezone: true }).notNull(),
|
|
58
|
-
...timestamps,
|
|
59
|
-
},
|
|
60
|
-
/*
|
|
61
|
-
* Secondary indexes, one per hot read. A partial index, shown once, keeps
|
|
62
|
-
* only the rows its where clause matches, so the open and claimed lists
|
|
63
|
-
* stay small however many tasks have settled. The where clauses match the
|
|
64
|
-
* state derivation in apps/api/src/routes/tasks.ts (stateWhere).
|
|
65
|
-
*/
|
|
66
|
-
(t) => [
|
|
67
|
-
check('tasks_origin', sql `${t.origin} in ('manual', 'template', 'routine')`),
|
|
68
|
-
// The open task cap per poster, and a deletion's tasks by poster.
|
|
69
|
-
index('tasks_poster_agent_id_idx').on(t.posterAgentId),
|
|
70
|
-
// The claim cap per claimant, activity counts, scoring and evidence.
|
|
71
|
-
index('tasks_claimant_agent_id_idx').on(t.claimantAgentId),
|
|
72
|
-
// GET /v1/tasks?poster= and seed=, which is the seed agent's poster id,
|
|
73
|
-
// oldest first and paged on (posted_at, id) (VOU-208).
|
|
74
|
-
index('tasks_poster_posted_at_idx').on(t.posterAgentId, t.postedAt, t.id),
|
|
75
|
-
// GET /v1/tasks?claimant=, a CLI's own claims and submissions, oldest
|
|
76
|
-
// first and paged on (posted_at, id) (VOU-208).
|
|
77
|
-
index('tasks_claimant_posted_at_idx').on(t.claimantAgentId, t.postedAt, t.id),
|
|
78
|
-
// GET /v1/tasks?state=open and the board, oldest or newest first. The
|
|
79
|
-
// open pool filters out addressed tasks on top of it.
|
|
80
|
-
index('tasks_open_posted_at_idx')
|
|
81
|
-
.on(t.postedAt, t.id)
|
|
82
|
-
.where(sql `${t.claimedAt} is null and ${t.verifiedAt} is null`),
|
|
83
|
-
// Open tasks addressed to one agent, oldest first. GET /v1/tasks?assignee=
|
|
84
|
-
// and the per assignee caps.
|
|
85
|
-
index('tasks_open_assignee_posted_at_idx')
|
|
86
|
-
.on(t.assigneeAgentId, t.postedAt, t.id)
|
|
87
|
-
.where(sql `${t.assigneeAgentId} is not null and ${t.claimedAt} is null and ${t.verifiedAt} is null`),
|
|
88
|
-
// Addressed tasks by assignee and settle time. The pair cap counts an
|
|
89
|
-
// assignee's settled tasks over the last days, and a deletion finds the
|
|
90
|
-
// tasks addressed to it.
|
|
91
|
-
index('tasks_assignee_settled_at_idx')
|
|
92
|
-
.on(t.assigneeAgentId, t.pairSettledAt)
|
|
93
|
-
.where(sql `${t.assigneeAgentId} is not null`),
|
|
94
|
-
// Claimed addressed tasks not yet settled for the pair cap, by settle
|
|
95
|
-
// time. The pair cap walks and the scoring run's pass read it. Small,
|
|
96
|
-
// since a task leaves it once it is decided.
|
|
97
|
-
index('tasks_addressed_pending_idx')
|
|
98
|
-
.on(sql `least(${t.verifiedAt}, ${t.expiresAt})`)
|
|
99
|
-
.where(sql `${t.assigneeAgentId} is not null and ${t.claimedAt} is not null and ${t.pairSettledAt} is null`),
|
|
100
|
-
// GET /v1/tasks?state=claimed, oldest first.
|
|
101
|
-
index('tasks_claimed_posted_at_idx')
|
|
102
|
-
.on(t.postedAt, t.id)
|
|
103
|
-
.where(sql `${t.claimedAt} is not null and ${t.submittedAt} is null and ${t.verifiedAt} is null`),
|
|
104
|
-
// Evidence counts over the window and the verified task count in stats.
|
|
105
|
-
index('tasks_verified_at_idx').on(t.verifiedAt),
|
|
106
|
-
]);
|
package/dist/db/timestamps.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const timestamps: {
|
|
2
|
-
createdAt: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTimestampBuilderInitial<"created_at">>>;
|
|
3
|
-
updatedAt: import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTimestampBuilderInitial<"updated_at">>>;
|
|
4
|
-
};
|
package/dist/db/timestamps.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { timestamp } from 'drizzle-orm/pg-core';
|
|
2
|
-
// Shared columns for every table except events.
|
|
3
|
-
//
|
|
4
|
-
// A column builder like timestamp('created_at', ...) describes a column but
|
|
5
|
-
// is not bound to a table yet. pgTable binds it when the table is declared,
|
|
6
|
-
// so one plain object of builders can be spread into many tables.
|
|
7
|
-
//
|
|
8
|
-
// export const agents = pgTable('agents', {
|
|
9
|
-
// id: text('id').primaryKey(),
|
|
10
|
-
// ...timestamps,
|
|
11
|
-
// });
|
|
12
|
-
//
|
|
13
|
-
// Both columns are set by the database. defaultNow() fills them on insert and
|
|
14
|
-
// the set_updated_at() trigger in the second migration bumps updated_at on
|
|
15
|
-
// every update. We do not use Drizzle's $onUpdate, because that only runs
|
|
16
|
-
// when the update goes through Drizzle.
|
|
17
|
-
export const timestamps = {
|
|
18
|
-
createdAt: timestamp('created_at', { withTimezone: true })
|
|
19
|
-
.notNull()
|
|
20
|
-
.defaultNow(),
|
|
21
|
-
updatedAt: timestamp('updated_at', { withTimezone: true })
|
|
22
|
-
.notNull()
|
|
23
|
-
.defaultNow(),
|
|
24
|
-
};
|