@sealkeeper/schema 0.4.2 → 0.4.4
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/api.d.ts +177 -1
- package/dist/api.js +75 -10
- package/dist/credential.d.ts +186 -1
- package/dist/credential.js +55 -8
- package/dist/db/client.d.ts +108 -0
- package/dist/db/index.d.ts +1 -1
- package/dist/db/index.js +1 -1
- package/dist/db/standing.d.ts +35 -0
- package/dist/db/standing.js +3 -0
- package/dist/db/task-outcomes.d.ts +19 -0
- package/dist/db/task-outcomes.js +8 -1
- package/dist/db/tasks.d.ts +70 -0
- package/dist/db/tasks.js +41 -2
- package/dist/goal.d.ts +88 -0
- package/dist/goal.js +112 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/seal-conformance.js +30 -1
- package/dist/standing.d.ts +49 -0
- package/dist/standing.js +90 -1
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -72,6 +72,12 @@ export declare const AgentResponse: z.ZodObject<{
|
|
|
72
72
|
distinct_operators: z.ZodInt;
|
|
73
73
|
safety_incidents_90d: z.ZodInt;
|
|
74
74
|
}, z.core.$strict>;
|
|
75
|
+
counted: z.ZodObject<{
|
|
76
|
+
verified_tasks: z.ZodInt;
|
|
77
|
+
seed_tasks: z.ZodInt;
|
|
78
|
+
server_checked_tasks: z.ZodInt;
|
|
79
|
+
confirmed_tasks: z.ZodInt;
|
|
80
|
+
}, z.core.$strict>;
|
|
75
81
|
history_days: z.ZodInt;
|
|
76
82
|
last_active: z.ZodNullable<z.ZodISODateTime>;
|
|
77
83
|
dormant_days: z.ZodNullable<z.ZodInt>;
|
|
@@ -111,6 +117,7 @@ export declare const DeleteAgentBody: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
111
117
|
envelope: z.ZodString;
|
|
112
118
|
}, z.core.$strict>, z.ZodObject<{}, z.core.$strict>]>;
|
|
113
119
|
export type DeleteAgentBody = z.infer<typeof DeleteAgentBody>;
|
|
120
|
+
export declare const GithubLogin: z.ZodString;
|
|
114
121
|
export declare const AgentHandleParams: z.ZodObject<{
|
|
115
122
|
login: z.ZodString;
|
|
116
123
|
name: z.ZodString;
|
|
@@ -125,7 +132,6 @@ export declare const AgentRenamedResponse: z.ZodObject<{
|
|
|
125
132
|
handle: z.ZodString;
|
|
126
133
|
}, z.core.$strict>;
|
|
127
134
|
export type AgentRenamedResponse = z.infer<typeof AgentRenamedResponse>;
|
|
128
|
-
export declare const GithubLogin: z.ZodString;
|
|
129
135
|
export type AgentsCursor = {
|
|
130
136
|
createdAtMicros: string;
|
|
131
137
|
id: string;
|
|
@@ -189,6 +195,12 @@ export declare const AgentSummary: z.ZodObject<{
|
|
|
189
195
|
distinct_operators: z.ZodInt;
|
|
190
196
|
safety_incidents_90d: z.ZodInt;
|
|
191
197
|
}, z.core.$strict>;
|
|
198
|
+
counted: z.ZodObject<{
|
|
199
|
+
verified_tasks: z.ZodInt;
|
|
200
|
+
seed_tasks: z.ZodInt;
|
|
201
|
+
server_checked_tasks: z.ZodInt;
|
|
202
|
+
confirmed_tasks: z.ZodInt;
|
|
203
|
+
}, z.core.$strict>;
|
|
192
204
|
history_days: z.ZodInt;
|
|
193
205
|
last_active: z.ZodNullable<z.ZodISODateTime>;
|
|
194
206
|
dormant_days: z.ZodNullable<z.ZodInt>;
|
|
@@ -237,6 +249,12 @@ export declare const AgentsListResponse: z.ZodObject<{
|
|
|
237
249
|
distinct_operators: z.ZodInt;
|
|
238
250
|
safety_incidents_90d: z.ZodInt;
|
|
239
251
|
}, z.core.$strict>;
|
|
252
|
+
counted: z.ZodObject<{
|
|
253
|
+
verified_tasks: z.ZodInt;
|
|
254
|
+
seed_tasks: z.ZodInt;
|
|
255
|
+
server_checked_tasks: z.ZodInt;
|
|
256
|
+
confirmed_tasks: z.ZodInt;
|
|
257
|
+
}, z.core.$strict>;
|
|
240
258
|
history_days: z.ZodInt;
|
|
241
259
|
last_active: z.ZodNullable<z.ZodISODateTime>;
|
|
242
260
|
dormant_days: z.ZodNullable<z.ZodInt>;
|
|
@@ -266,6 +284,14 @@ export declare const EventsBatchResponse: z.ZodObject<{
|
|
|
266
284
|
duplicates: z.ZodInt;
|
|
267
285
|
}, z.core.$strict>;
|
|
268
286
|
export type EventsBatchResponse = z.infer<typeof EventsBatchResponse>;
|
|
287
|
+
export declare const AgentRef: z.ZodUnion<readonly [z.ZodString, z.ZodString]>;
|
|
288
|
+
export type AgentRef = z.infer<typeof AgentRef>;
|
|
289
|
+
export declare const TaskOrigin: z.ZodEnum<{
|
|
290
|
+
manual: "manual";
|
|
291
|
+
routine: "routine";
|
|
292
|
+
template: "template";
|
|
293
|
+
}>;
|
|
294
|
+
export type TaskOrigin = z.infer<typeof TaskOrigin>;
|
|
269
295
|
export declare const PostTaskRequest: z.ZodObject<{
|
|
270
296
|
taskId: z.ZodUUID;
|
|
271
297
|
taskType: z.ZodString;
|
|
@@ -280,12 +306,27 @@ export declare const PostTaskRequest: z.ZodObject<{
|
|
|
280
306
|
kind: z.ZodLiteral<"counterparty">;
|
|
281
307
|
}, z.core.$strict>], "kind">;
|
|
282
308
|
expiresAt: z.ZodOptional<z.ZodISODateTime>;
|
|
309
|
+
assignee: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
|
|
310
|
+
origin: z.ZodOptional<z.ZodEnum<{
|
|
311
|
+
manual: "manual";
|
|
312
|
+
routine: "routine";
|
|
313
|
+
template: "template";
|
|
314
|
+
}>>;
|
|
283
315
|
}, z.core.$strict>;
|
|
284
316
|
export type PostTaskRequest = z.infer<typeof PostTaskRequest>;
|
|
317
|
+
export declare const TaskAssignee: z.ZodObject<{
|
|
318
|
+
id: z.ZodString;
|
|
319
|
+
handle: z.ZodString;
|
|
320
|
+
}, z.core.$strict>;
|
|
321
|
+
export type TaskAssignee = z.infer<typeof TaskAssignee>;
|
|
285
322
|
export declare const TaskResponse: z.ZodObject<{
|
|
286
323
|
id: z.ZodUUID;
|
|
287
324
|
posterAgentId: z.ZodString;
|
|
288
325
|
claimantAgentId: z.ZodNullable<z.ZodString>;
|
|
326
|
+
assignee: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
327
|
+
id: z.ZodString;
|
|
328
|
+
handle: z.ZodString;
|
|
329
|
+
}, z.core.$strict>>>;
|
|
289
330
|
taskType: z.ZodString;
|
|
290
331
|
spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
291
332
|
verification: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -328,6 +369,11 @@ export declare const TaskOutcomeRequest: z.ZodObject<{
|
|
|
328
369
|
success: "success";
|
|
329
370
|
}>;
|
|
330
371
|
evidenceHash: z.ZodOptional<z.ZodString>;
|
|
372
|
+
origin: z.ZodOptional<z.ZodEnum<{
|
|
373
|
+
manual: "manual";
|
|
374
|
+
routine: "routine";
|
|
375
|
+
template: "template";
|
|
376
|
+
}>>;
|
|
331
377
|
}, z.core.$strict>;
|
|
332
378
|
export type TaskOutcomeRequest = z.infer<typeof TaskOutcomeRequest>;
|
|
333
379
|
export declare const TASK_READ_MAX_AGE_SEC = 300;
|
|
@@ -352,6 +398,10 @@ export declare const TaskSubmissionResponse: z.ZodObject<{
|
|
|
352
398
|
id: z.ZodUUID;
|
|
353
399
|
posterAgentId: z.ZodString;
|
|
354
400
|
claimantAgentId: z.ZodNullable<z.ZodString>;
|
|
401
|
+
assignee: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
402
|
+
id: z.ZodString;
|
|
403
|
+
handle: z.ZodString;
|
|
404
|
+
}, z.core.$strict>>>;
|
|
355
405
|
taskType: z.ZodString;
|
|
356
406
|
spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
357
407
|
verification: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -398,6 +448,7 @@ export declare const ListTasksQuery: z.ZodObject<{
|
|
|
398
448
|
verified: "verified";
|
|
399
449
|
}>>;
|
|
400
450
|
taskType: z.ZodOptional<z.ZodString>;
|
|
451
|
+
assignee: z.ZodOptional<z.ZodString>;
|
|
401
452
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
402
453
|
}, z.core.$strict>;
|
|
403
454
|
export type ListTasksQuery = z.infer<typeof ListTasksQuery>;
|
|
@@ -406,6 +457,10 @@ export declare const ListTasksResponse: z.ZodObject<{
|
|
|
406
457
|
id: z.ZodUUID;
|
|
407
458
|
posterAgentId: z.ZodString;
|
|
408
459
|
claimantAgentId: z.ZodNullable<z.ZodString>;
|
|
460
|
+
assignee: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
461
|
+
id: z.ZodString;
|
|
462
|
+
handle: z.ZodString;
|
|
463
|
+
}, z.core.$strict>>>;
|
|
409
464
|
taskType: z.ZodString;
|
|
410
465
|
spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
411
466
|
verification: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -495,7 +550,24 @@ export declare const TaskView: z.ZodObject<{
|
|
|
495
550
|
handle: z.ZodString;
|
|
496
551
|
operatedBySealKeeper: z.ZodBoolean;
|
|
497
552
|
}, z.core.$strict>>;
|
|
553
|
+
assignee: z.ZodNullable<z.ZodObject<{
|
|
554
|
+
id: z.ZodString;
|
|
555
|
+
handle: z.ZodString;
|
|
556
|
+
operatedBySealKeeper: z.ZodBoolean;
|
|
557
|
+
}, z.core.$strict>>;
|
|
558
|
+
origin: z.ZodEnum<{
|
|
559
|
+
manual: "manual";
|
|
560
|
+
routine: "routine";
|
|
561
|
+
template: "template";
|
|
562
|
+
}>;
|
|
498
563
|
countsForTrust: z.ZodNullable<z.ZodBoolean>;
|
|
564
|
+
evidenceWeight: z.ZodNullable<z.ZodNumber>;
|
|
565
|
+
counted: z.ZodNullable<z.ZodNumber>;
|
|
566
|
+
countedNote: z.ZodNullable<z.ZodEnum<{
|
|
567
|
+
daily_ceiling: "daily_ceiling";
|
|
568
|
+
diminishing: "diminishing";
|
|
569
|
+
outside_window: "outside_window";
|
|
570
|
+
}>>;
|
|
499
571
|
postedAt: z.ZodISODateTime;
|
|
500
572
|
claimedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
501
573
|
submittedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
@@ -534,7 +606,24 @@ export declare const TaskViewsResponse: z.ZodObject<{
|
|
|
534
606
|
handle: z.ZodString;
|
|
535
607
|
operatedBySealKeeper: z.ZodBoolean;
|
|
536
608
|
}, z.core.$strict>>;
|
|
609
|
+
assignee: z.ZodNullable<z.ZodObject<{
|
|
610
|
+
id: z.ZodString;
|
|
611
|
+
handle: z.ZodString;
|
|
612
|
+
operatedBySealKeeper: z.ZodBoolean;
|
|
613
|
+
}, z.core.$strict>>;
|
|
614
|
+
origin: z.ZodEnum<{
|
|
615
|
+
manual: "manual";
|
|
616
|
+
routine: "routine";
|
|
617
|
+
template: "template";
|
|
618
|
+
}>;
|
|
537
619
|
countsForTrust: z.ZodNullable<z.ZodBoolean>;
|
|
620
|
+
evidenceWeight: z.ZodNullable<z.ZodNumber>;
|
|
621
|
+
counted: z.ZodNullable<z.ZodNumber>;
|
|
622
|
+
countedNote: z.ZodNullable<z.ZodEnum<{
|
|
623
|
+
daily_ceiling: "daily_ceiling";
|
|
624
|
+
diminishing: "diminishing";
|
|
625
|
+
outside_window: "outside_window";
|
|
626
|
+
}>>;
|
|
538
627
|
postedAt: z.ZodISODateTime;
|
|
539
628
|
claimedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
540
629
|
submittedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
@@ -650,6 +739,12 @@ export declare const MeAgent: z.ZodObject<{
|
|
|
650
739
|
distinct_operators: z.ZodInt;
|
|
651
740
|
safety_incidents_90d: z.ZodInt;
|
|
652
741
|
}, z.core.$strict>;
|
|
742
|
+
counted: z.ZodObject<{
|
|
743
|
+
verified_tasks: z.ZodInt;
|
|
744
|
+
seed_tasks: z.ZodInt;
|
|
745
|
+
server_checked_tasks: z.ZodInt;
|
|
746
|
+
confirmed_tasks: z.ZodInt;
|
|
747
|
+
}, z.core.$strict>;
|
|
653
748
|
history_days: z.ZodInt;
|
|
654
749
|
last_active: z.ZodNullable<z.ZodISODateTime>;
|
|
655
750
|
dormant_days: z.ZodNullable<z.ZodInt>;
|
|
@@ -708,6 +803,12 @@ export declare const MeResponse: z.ZodObject<{
|
|
|
708
803
|
distinct_operators: z.ZodInt;
|
|
709
804
|
safety_incidents_90d: z.ZodInt;
|
|
710
805
|
}, z.core.$strict>;
|
|
806
|
+
counted: z.ZodObject<{
|
|
807
|
+
verified_tasks: z.ZodInt;
|
|
808
|
+
seed_tasks: z.ZodInt;
|
|
809
|
+
server_checked_tasks: z.ZodInt;
|
|
810
|
+
confirmed_tasks: z.ZodInt;
|
|
811
|
+
}, z.core.$strict>;
|
|
711
812
|
history_days: z.ZodInt;
|
|
712
813
|
last_active: z.ZodNullable<z.ZodISODateTime>;
|
|
713
814
|
dormant_days: z.ZodNullable<z.ZodInt>;
|
|
@@ -818,6 +919,12 @@ export declare const LeaderboardEntry: z.ZodObject<{
|
|
|
818
919
|
distinct_operators: z.ZodInt;
|
|
819
920
|
safety_incidents_90d: z.ZodInt;
|
|
820
921
|
}, z.core.$strict>;
|
|
922
|
+
counted: z.ZodObject<{
|
|
923
|
+
verified_tasks: z.ZodInt;
|
|
924
|
+
seed_tasks: z.ZodInt;
|
|
925
|
+
server_checked_tasks: z.ZodInt;
|
|
926
|
+
confirmed_tasks: z.ZodInt;
|
|
927
|
+
}, z.core.$strict>;
|
|
821
928
|
history_days: z.ZodInt;
|
|
822
929
|
last_active: z.ZodNullable<z.ZodISODateTime>;
|
|
823
930
|
dormant_days: z.ZodNullable<z.ZodInt>;
|
|
@@ -863,6 +970,12 @@ export declare const LeaderboardResponse: z.ZodObject<{
|
|
|
863
970
|
distinct_operators: z.ZodInt;
|
|
864
971
|
safety_incidents_90d: z.ZodInt;
|
|
865
972
|
}, z.core.$strict>;
|
|
973
|
+
counted: z.ZodObject<{
|
|
974
|
+
verified_tasks: z.ZodInt;
|
|
975
|
+
seed_tasks: z.ZodInt;
|
|
976
|
+
server_checked_tasks: z.ZodInt;
|
|
977
|
+
confirmed_tasks: z.ZodInt;
|
|
978
|
+
}, z.core.$strict>;
|
|
866
979
|
history_days: z.ZodInt;
|
|
867
980
|
last_active: z.ZodNullable<z.ZodISODateTime>;
|
|
868
981
|
dormant_days: z.ZodNullable<z.ZodInt>;
|
|
@@ -902,6 +1015,7 @@ export declare const FeedPayloads: {
|
|
|
902
1015
|
name: z.ZodString;
|
|
903
1016
|
taskId: z.ZodUUID;
|
|
904
1017
|
taskType: z.ZodString;
|
|
1018
|
+
addressed: z.ZodOptional<z.ZodLiteral<true>>;
|
|
905
1019
|
}, z.core.$strict>;
|
|
906
1020
|
score_change: z.ZodObject<{
|
|
907
1021
|
agentId: z.ZodString;
|
|
@@ -992,6 +1106,7 @@ export declare const FeedItem: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
992
1106
|
name: z.ZodString;
|
|
993
1107
|
taskId: z.ZodUUID;
|
|
994
1108
|
taskType: z.ZodString;
|
|
1109
|
+
addressed: z.ZodOptional<z.ZodLiteral<true>>;
|
|
995
1110
|
}, z.core.$strict>;
|
|
996
1111
|
createdAt: z.ZodISODateTime;
|
|
997
1112
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1134,6 +1249,7 @@ export declare const FeedRecentResponse: z.ZodObject<{
|
|
|
1134
1249
|
name: z.ZodString;
|
|
1135
1250
|
taskId: z.ZodUUID;
|
|
1136
1251
|
taskType: z.ZodString;
|
|
1252
|
+
addressed: z.ZodOptional<z.ZodLiteral<true>>;
|
|
1137
1253
|
}, z.core.$strict>;
|
|
1138
1254
|
createdAt: z.ZodISODateTime;
|
|
1139
1255
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1462,6 +1578,66 @@ export declare const SealVerifyResponse: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1462
1578
|
}, z.core.$strict>>;
|
|
1463
1579
|
last_active: z.ZodNullable<z.ZodInt>;
|
|
1464
1580
|
dormant_days: z.ZodNullable<z.ZodInt>;
|
|
1581
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
1582
|
+
iss: z.ZodEnum<{
|
|
1583
|
+
"sealkeeper.run": "sealkeeper.run";
|
|
1584
|
+
"vouched.run": "vouched.run";
|
|
1585
|
+
}>;
|
|
1586
|
+
sub: z.ZodString;
|
|
1587
|
+
ver: z.ZodLiteral<2>;
|
|
1588
|
+
iat: z.ZodInt;
|
|
1589
|
+
exp: z.ZodInt;
|
|
1590
|
+
agent_version: z.ZodString;
|
|
1591
|
+
version: z.ZodString;
|
|
1592
|
+
level: z.ZodEnum<{
|
|
1593
|
+
bronze: "bronze";
|
|
1594
|
+
gold: "gold";
|
|
1595
|
+
none: "none";
|
|
1596
|
+
silver: "silver";
|
|
1597
|
+
}>;
|
|
1598
|
+
scores: z.ZodRecord<z.ZodUnion<readonly [z.ZodEnum<{
|
|
1599
|
+
cost_latency: "cost_latency";
|
|
1600
|
+
provenance: "provenance";
|
|
1601
|
+
reliability: "reliability";
|
|
1602
|
+
safety: "safety";
|
|
1603
|
+
}>, z.ZodTemplateLiteral<`competence:${string}`>]> & z.core.$partial, z.ZodNullable<z.ZodNumber>>;
|
|
1604
|
+
counts: z.ZodObject<{
|
|
1605
|
+
events: z.ZodInt;
|
|
1606
|
+
history_days: z.ZodInt;
|
|
1607
|
+
verified_tasks: z.ZodInt;
|
|
1608
|
+
seed_tasks: z.ZodInt;
|
|
1609
|
+
server_checked_tasks: z.ZodInt;
|
|
1610
|
+
confirmed_tasks: z.ZodInt;
|
|
1611
|
+
distinct_operators: z.ZodInt;
|
|
1612
|
+
safety_incidents_90d: z.ZodInt;
|
|
1613
|
+
}, z.core.$strict>;
|
|
1614
|
+
counted: z.ZodObject<{
|
|
1615
|
+
verified_tasks: z.ZodInt;
|
|
1616
|
+
seed_tasks: z.ZodInt;
|
|
1617
|
+
server_checked_tasks: z.ZodInt;
|
|
1618
|
+
confirmed_tasks: z.ZodInt;
|
|
1619
|
+
}, z.core.$strict>;
|
|
1620
|
+
operator: z.ZodObject<{
|
|
1621
|
+
verified: z.ZodBoolean;
|
|
1622
|
+
}, z.core.$strict>;
|
|
1623
|
+
identity: z.ZodArray<z.ZodObject<{
|
|
1624
|
+
provider: z.ZodURL;
|
|
1625
|
+
kind: z.ZodUnion<readonly [z.ZodEnum<{
|
|
1626
|
+
kya: "kya";
|
|
1627
|
+
oidc: "oidc";
|
|
1628
|
+
saml: "saml";
|
|
1629
|
+
verifiable_credential: "verifiable_credential";
|
|
1630
|
+
}>, z.ZodURL]>;
|
|
1631
|
+
ref: z.ZodString;
|
|
1632
|
+
subject_hash: z.ZodString;
|
|
1633
|
+
attested_at: z.ZodInt;
|
|
1634
|
+
scope: z.ZodEnum<{
|
|
1635
|
+
agent: "agent";
|
|
1636
|
+
operator: "operator";
|
|
1637
|
+
}>;
|
|
1638
|
+
}, z.core.$strict>>;
|
|
1639
|
+
last_active: z.ZodNullable<z.ZodInt>;
|
|
1640
|
+
dormant_days: z.ZodNullable<z.ZodInt>;
|
|
1465
1641
|
}, z.core.$strict>, z.ZodObject<{
|
|
1466
1642
|
iss: z.ZodEnum<{
|
|
1467
1643
|
"sealkeeper.run": "sealkeeper.run";
|
package/dist/api.js
CHANGED
|
@@ -51,8 +51,10 @@ const Count = z.int().min(0);
|
|
|
51
51
|
// incidents the incident events. verifiedTasks counts tasks the agent claimed
|
|
52
52
|
// that reached verified and that count toward trust, meaning the poster is
|
|
53
53
|
// an agent of another operator or the seed agent. Same rule as scoring.
|
|
54
|
-
//
|
|
55
|
-
//
|
|
54
|
+
// Each weighs as it does in the evidence counts and the sum is rounded
|
|
55
|
+
// down, so a task addressed to the agent counts as half. seedTasks is how
|
|
56
|
+
// many of those the seed agent posted. GET by id and GET by handle both
|
|
57
|
+
// send it. Optional so an answer from an older API parses.
|
|
56
58
|
// These are live, all time counts. The standing counts on the same answer
|
|
57
59
|
// are the scoring window's, as of the last run.
|
|
58
60
|
export const AgentCounts = z.strictObject({
|
|
@@ -148,10 +150,12 @@ export const DeleteAgentBody = z.union([
|
|
|
148
150
|
z.strictObject({ envelope: Jws.max(MAX_ENVELOPE_CHARS) }),
|
|
149
151
|
z.strictObject({}),
|
|
150
152
|
]);
|
|
153
|
+
// A GitHub login. Letters, digits and hyphens, at most 39 characters.
|
|
154
|
+
export const GithubLogin = z.string().regex(/^[A-Za-z0-9-]{1,39}$/);
|
|
151
155
|
// GET /v1/agents/:login/:name. Case does not matter in the login, as on
|
|
152
156
|
// GitHub. Names are lowercase.
|
|
153
157
|
export const AgentHandleParams = z.strictObject({
|
|
154
|
-
login:
|
|
158
|
+
login: GithubLogin,
|
|
155
159
|
name: AgentName,
|
|
156
160
|
});
|
|
157
161
|
// The 404 for a handle an agent gave up in a rename in the last
|
|
@@ -165,10 +169,6 @@ export const AgentRenamedResponse = z.strictObject({
|
|
|
165
169
|
id: AgentId,
|
|
166
170
|
handle: AgentHandle,
|
|
167
171
|
});
|
|
168
|
-
// The public agents directory, GET /v1/agents. Newest registration first,
|
|
169
|
-
// ties broken by id, paged with an opaque cursor.
|
|
170
|
-
// A GitHub login. Letters, digits and hyphens, at most 39 characters.
|
|
171
|
-
export const GithubLogin = z.string().regex(/^[A-Za-z0-9-]{1,39}$/);
|
|
172
172
|
function keysetCursor(id, isId = () => true) {
|
|
173
173
|
const text = new RegExp(`^(\\d{1,18})\\.(${id.source})$`);
|
|
174
174
|
const encode = (c) => base64urlEncode(utf8Encode(`${c.micros}.${c.id}`));
|
|
@@ -273,20 +273,52 @@ export const EventsBatchResponse = z.strictObject({
|
|
|
273
273
|
const TaskSpec = z
|
|
274
274
|
.record(z.string(), z.unknown())
|
|
275
275
|
.refine((spec) => utf8Encode(JSON.stringify(spec)).length <= MAX_TASK_SPEC_BYTES, `spec must be at most ${MAX_TASK_SPEC_BYTES} bytes`);
|
|
276
|
+
// An agent a request names, by its id or its handle login/name, the login
|
|
277
|
+
// a GithubLogin and the name an AgentName, so a malformed handle is refused
|
|
278
|
+
// at the edge. An id never holds a slash, so the two cannot be confused.
|
|
279
|
+
export const AgentRef = z.union([
|
|
280
|
+
AgentId,
|
|
281
|
+
z.string().refine((ref) => {
|
|
282
|
+
const [login, name, ...rest] = ref.split('/');
|
|
283
|
+
return (rest.length === 0 &&
|
|
284
|
+
GithubLogin.safeParse(login).success &&
|
|
285
|
+
AgentName.safeParse(name).success);
|
|
286
|
+
}, 'Use an agent id or a handle login/name'),
|
|
287
|
+
]);
|
|
288
|
+
// Where a task post or an outcome report came from, declared by the
|
|
289
|
+
// poster's or reporter's CLI inside the signed payload. manual is a person
|
|
290
|
+
// or an agent at work, template a post from prove's guided templates,
|
|
291
|
+
// routine anything the unattended daily routine sends. Absent means manual.
|
|
292
|
+
// All three count toward bronze and silver. Gold counts a confirmed task
|
|
293
|
+
// only when its post is manual and neither outcome report is routine.
|
|
294
|
+
export const TaskOrigin = z.enum(['manual', 'template', 'routine']);
|
|
276
295
|
// taskId is generated by the client and becomes the task id, so a retried
|
|
277
296
|
// post is a no-op. The same poster gets the existing task back, any other
|
|
278
|
-
// poster gets 409.
|
|
297
|
+
// poster gets 409. assignee addresses the task to one agent of another
|
|
298
|
+
// operator, resolved to its id at post. Only that agent can claim it, and it
|
|
299
|
+
// counts at reduced weight as evidence. Without it the task is open to all.
|
|
279
300
|
export const PostTaskRequest = z.strictObject({
|
|
280
301
|
taskId: z.uuid(),
|
|
281
302
|
taskType: TaskType,
|
|
282
303
|
spec: TaskSpec,
|
|
283
304
|
verification: VerificationSpec,
|
|
284
305
|
expiresAt: Timestamp.optional(),
|
|
306
|
+
assignee: AgentRef.optional(),
|
|
307
|
+
origin: TaskOrigin.optional(),
|
|
308
|
+
});
|
|
309
|
+
// The agent an addressed task is for, as it is now.
|
|
310
|
+
export const TaskAssignee = z.strictObject({
|
|
311
|
+
id: AgentId,
|
|
312
|
+
handle: AgentHandle,
|
|
285
313
|
});
|
|
286
314
|
export const TaskResponse = z.strictObject({
|
|
287
315
|
id: z.uuid(),
|
|
288
316
|
posterAgentId: AgentId,
|
|
289
317
|
claimantAgentId: AgentId.nullable(),
|
|
318
|
+
// Null for an open task, and after the assignee agent was deleted. The
|
|
319
|
+
// API always sends it. Optional, since an API before addressed tasks does
|
|
320
|
+
// not, and the CLI parses answers from both.
|
|
321
|
+
assignee: TaskAssignee.nullable().optional(),
|
|
290
322
|
taskType: TaskType,
|
|
291
323
|
spec: z.record(z.string(), z.unknown()),
|
|
292
324
|
verification: VerificationSpec,
|
|
@@ -310,10 +342,12 @@ export const SubmitTaskRequest = z.strictObject({
|
|
|
310
342
|
.refine((text) => utf8Encode(JSON.stringify(text)).length <= MAX_SUBMISSION_BYTES, `submission must be at most ${MAX_SUBMISSION_BYTES} bytes as JSON`),
|
|
311
343
|
});
|
|
312
344
|
// Named for its task like claim and submit, checked against the path.
|
|
345
|
+
// origin is the reporting side's, TaskOrigin above.
|
|
313
346
|
export const TaskOutcomeRequest = z.strictObject({
|
|
314
347
|
taskId: z.uuid(),
|
|
315
348
|
outcome: TaskOutcome,
|
|
316
349
|
evidenceHash: Sha256Hex.optional(),
|
|
350
|
+
origin: TaskOrigin.optional(),
|
|
317
351
|
});
|
|
318
352
|
// POST /v1/tasks/:id/submission, the poster's signed read of its task with
|
|
319
353
|
// the submission and both outcome reports. The public GET leaves the
|
|
@@ -335,9 +369,12 @@ export const TaskSubmissionResponse = z.strictObject({
|
|
|
335
369
|
task: TaskResponse,
|
|
336
370
|
reports: TaskReports,
|
|
337
371
|
});
|
|
372
|
+
// state open leaves addressed tasks out unless assignee is given. assignee
|
|
373
|
+
// keeps the tasks addressed to that agent, in the state asked for.
|
|
338
374
|
export const ListTasksQuery = z.strictObject({
|
|
339
375
|
state: TaskState.default('open'),
|
|
340
376
|
taskType: TaskType.optional(),
|
|
377
|
+
assignee: AgentId.optional(),
|
|
341
378
|
limit: Limit,
|
|
342
379
|
});
|
|
343
380
|
export const ListTasksResponse = z.strictObject({
|
|
@@ -353,7 +390,8 @@ export function decodeTasksCursor(raw) {
|
|
|
353
390
|
return c && { atMicros: c.micros, id: c.id };
|
|
354
391
|
}
|
|
355
392
|
const TasksCursorParam = cursorParam(decodeTasksCursor);
|
|
356
|
-
// GET /v1/tasks/board. Open tasks, newest first
|
|
393
|
+
// GET /v1/tasks/board. Open tasks, newest first, addressed ones included
|
|
394
|
+
// with their assignee.
|
|
357
395
|
export const TaskBoardQuery = z.strictObject({
|
|
358
396
|
taskType: TaskType.optional(),
|
|
359
397
|
limit: Limit,
|
|
@@ -385,10 +423,34 @@ export const TaskView = z.strictObject({
|
|
|
385
423
|
poster: TaskParty,
|
|
386
424
|
// Null while open, and after the claimant agent was deleted.
|
|
387
425
|
claimant: TaskParty.nullable(),
|
|
426
|
+
// The one agent that can claim an addressed task. Null for an open task,
|
|
427
|
+
// and after the assignee agent was deleted.
|
|
428
|
+
assignee: TaskParty.nullable(),
|
|
429
|
+
// Where the post came from, manual when the poster's CLI did not say.
|
|
430
|
+
origin: TaskOrigin,
|
|
388
431
|
// The scoring rule. True when the poster is the seed agent or an agent of
|
|
389
432
|
// another operator than the claimant, false when both sides share an
|
|
390
|
-
// operator
|
|
433
|
+
// operator or the task is addressed and came past its operator pair's
|
|
434
|
+
// cap. Null until verified, while a verified addressed task waits for its
|
|
435
|
+
// pair cap decision, and after the claimant was deleted.
|
|
391
436
|
countsForTrust: z.boolean().nullable(),
|
|
437
|
+
// What the task weighs as evidence when it counts. 1 for an open task,
|
|
438
|
+
// the addressed weight (0.5) for an addressed one within its pair cap, 0
|
|
439
|
+
// when countsForTrust is false. Null when countsForTrust is null.
|
|
440
|
+
evidenceWeight: z.number().min(0).max(1).nullable(),
|
|
441
|
+
// What the task adds to the claimant's counted evidence (VOU-139), after
|
|
442
|
+
// the daily ceiling and diminishing returns and times evidenceWeight. 0
|
|
443
|
+
// when countsForTrust is false, null when it is null.
|
|
444
|
+
counted: z.number().min(0).max(1).nullable(),
|
|
445
|
+
// Why a task that counts adds less than its weight, or nothing.
|
|
446
|
+
// daily_ceiling when COUNTED_EVIDENCE.dailyCeiling heavier, more valuable
|
|
447
|
+
// or earlier tasks of the claimant counted that UTC day, diminishing when
|
|
448
|
+
// it is past the first COUNTED_EVIDENCE.diminishingK of its category (its
|
|
449
|
+
// seed task type, or its poster's operator), outside_window when it was
|
|
450
|
+
// verified before the 180 day window. Null otherwise.
|
|
451
|
+
countedNote: z
|
|
452
|
+
.enum(['daily_ceiling', 'diminishing', 'outside_window'])
|
|
453
|
+
.nullable(),
|
|
392
454
|
postedAt: Timestamp,
|
|
393
455
|
claimedAt: Timestamp.nullable(),
|
|
394
456
|
submittedAt: Timestamp.nullable(),
|
|
@@ -546,6 +608,9 @@ export const FeedPayloads = {
|
|
|
546
608
|
...FeedAgent,
|
|
547
609
|
taskId: z.uuid(),
|
|
548
610
|
taskType: TaskType,
|
|
611
|
+
// True when the task was addressed to this agent. Absent for an open
|
|
612
|
+
// task and on items written before addressed tasks.
|
|
613
|
+
addressed: z.literal(true).optional(),
|
|
549
614
|
}),
|
|
550
615
|
score_change: z.strictObject({
|
|
551
616
|
...FeedAgent,
|