@sealkeeper/schema 0.4.9 → 0.5.1
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.js +5 -1
- package/dist/api.d.ts +190 -6
- package/dist/api.js +168 -49
- package/dist/challenge-next.d.ts +130 -0
- package/dist/challenge-next.js +52 -0
- package/dist/conformance.d.ts +0 -1
- package/dist/conformance.js +3 -4
- package/dist/core.d.ts +163 -0
- package/dist/core.js +161 -0
- package/dist/credential.d.ts +1 -0
- package/dist/credential.js +8 -2
- package/dist/duel-next.d.ts +232 -0
- package/dist/duel-next.js +114 -0
- package/dist/envelope.d.ts +41 -1
- package/dist/envelope.js +71 -4
- package/dist/game.d.ts +2 -0
- package/dist/game.js +31 -12
- package/dist/handshake-conformance.d.ts +1 -0
- package/dist/handshake-conformance.js +41 -0
- package/dist/handshake.d.ts +15 -2
- package/dist/handshake.js +63 -14
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/policy.d.ts +1 -1
- package/dist/policy.js +1 -1
- package/dist/routine.d.ts +186 -0
- package/dist/routine.js +227 -0
- package/dist/seal-conformance.d.ts +1 -0
- package/dist/seal-conformance.js +23 -1
- package/dist/seal-verify.d.ts +1 -1
- package/dist/seal-verify.js +7 -1
- package/dist/standing.js +7 -4
- package/dist/status.d.ts +382 -0
- package/dist/status.js +98 -0
- package/dist/task-templates.d.ts +3 -22
- package/dist/task-templates.js +102 -469
- package/package.json +2 -2
- package/dist/template-conformance.d.ts +0 -10
- package/dist/template-conformance.js +0 -298
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CORE_TASK_KINDS: readonly ['seed', 'addressed', 'exchange', 'duel', 'challenge'];
|
|
3
|
+
export declare const CoreTaskKind: z.ZodEnum<{
|
|
4
|
+
addressed: "addressed";
|
|
5
|
+
challenge: "challenge";
|
|
6
|
+
duel: "duel";
|
|
7
|
+
exchange: "exchange";
|
|
8
|
+
seed: "seed";
|
|
9
|
+
}>;
|
|
10
|
+
export type CoreTaskKind = z.infer<typeof CoreTaskKind>;
|
|
11
|
+
export declare const CoreTask: z.ZodObject<{
|
|
12
|
+
id: z.ZodUUID;
|
|
13
|
+
kind: z.ZodEnum<{
|
|
14
|
+
addressed: "addressed";
|
|
15
|
+
challenge: "challenge";
|
|
16
|
+
duel: "duel";
|
|
17
|
+
exchange: "exchange";
|
|
18
|
+
seed: "seed";
|
|
19
|
+
}>;
|
|
20
|
+
type: z.ZodString;
|
|
21
|
+
spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
22
|
+
schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
23
|
+
submits: z.ZodInt;
|
|
24
|
+
expiresAt: z.ZodISODateTime;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
export type CoreTask = z.infer<typeof CoreTask>;
|
|
27
|
+
export declare const CORE_WAITING_KINDS: readonly ['addressed', 'invite', 'outcome'];
|
|
28
|
+
export declare const CoreWaitingKind: z.ZodEnum<{
|
|
29
|
+
addressed: "addressed";
|
|
30
|
+
invite: "invite";
|
|
31
|
+
outcome: "outcome";
|
|
32
|
+
}>;
|
|
33
|
+
export type CoreWaitingKind = z.infer<typeof CoreWaitingKind>;
|
|
34
|
+
export declare const CoreWaiting: z.ZodObject<{
|
|
35
|
+
kind: z.ZodEnum<{
|
|
36
|
+
addressed: "addressed";
|
|
37
|
+
invite: "invite";
|
|
38
|
+
outcome: "outcome";
|
|
39
|
+
}>;
|
|
40
|
+
id: z.ZodUUID;
|
|
41
|
+
from: z.ZodString;
|
|
42
|
+
expiresAt: z.ZodNullable<z.ZodISODateTime>;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
export type CoreWaiting = z.infer<typeof CoreWaiting>;
|
|
45
|
+
export declare const CORE_ACTIONS: readonly ['run', 'challenge', 'post', 'outcome', 'sync', 'duel', 'note'];
|
|
46
|
+
export declare const CoreAction: z.ZodObject<{
|
|
47
|
+
action: z.ZodString;
|
|
48
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
49
|
+
label: z.ZodString;
|
|
50
|
+
needsYes: z.ZodBoolean;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
export type CoreAction = z.infer<typeof CoreAction>;
|
|
53
|
+
export declare const CoreStanding: z.ZodObject<{
|
|
54
|
+
level: z.ZodEnum<{
|
|
55
|
+
bronze: "bronze";
|
|
56
|
+
gold: "gold";
|
|
57
|
+
none: "none";
|
|
58
|
+
silver: "silver";
|
|
59
|
+
}>;
|
|
60
|
+
verified: z.ZodInt;
|
|
61
|
+
nextLevel: z.ZodNullable<z.ZodEnum<{
|
|
62
|
+
bronze: "bronze";
|
|
63
|
+
gold: "gold";
|
|
64
|
+
none: "none";
|
|
65
|
+
silver: "silver";
|
|
66
|
+
}>>;
|
|
67
|
+
needs: z.ZodNullable<z.ZodString>;
|
|
68
|
+
}, z.core.$strict>;
|
|
69
|
+
export type CoreStanding = z.infer<typeof CoreStanding>;
|
|
70
|
+
export declare const CORE_LIMITED_CODES: readonly ['daily_ceiling', 'claim_cap', 'game_cap_reached', 'duel_ceiling_reached', 'challenge_done', 'claims_per_day'];
|
|
71
|
+
export declare const CoreLimited: z.ZodObject<{
|
|
72
|
+
code: z.ZodString;
|
|
73
|
+
message: z.ZodString;
|
|
74
|
+
until: z.ZodNullable<z.ZodISODateTime>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
export type CoreLimited = z.infer<typeof CoreLimited>;
|
|
77
|
+
export declare const CoreAnswer: z.ZodObject<{
|
|
78
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
79
|
+
id: z.ZodUUID;
|
|
80
|
+
kind: z.ZodEnum<{
|
|
81
|
+
addressed: "addressed";
|
|
82
|
+
challenge: "challenge";
|
|
83
|
+
duel: "duel";
|
|
84
|
+
exchange: "exchange";
|
|
85
|
+
seed: "seed";
|
|
86
|
+
}>;
|
|
87
|
+
type: z.ZodString;
|
|
88
|
+
spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
89
|
+
schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
90
|
+
submits: z.ZodInt;
|
|
91
|
+
expiresAt: z.ZodISODateTime;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
waiting: z.ZodArray<z.ZodObject<{
|
|
94
|
+
kind: z.ZodEnum<{
|
|
95
|
+
addressed: "addressed";
|
|
96
|
+
invite: "invite";
|
|
97
|
+
outcome: "outcome";
|
|
98
|
+
}>;
|
|
99
|
+
id: z.ZodUUID;
|
|
100
|
+
from: z.ZodString;
|
|
101
|
+
expiresAt: z.ZodNullable<z.ZodISODateTime>;
|
|
102
|
+
}, z.core.$strict>>;
|
|
103
|
+
next: z.ZodArray<z.ZodObject<{
|
|
104
|
+
action: z.ZodString;
|
|
105
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
106
|
+
label: z.ZodString;
|
|
107
|
+
needsYes: z.ZodBoolean;
|
|
108
|
+
}, z.core.$strict>>;
|
|
109
|
+
standing: z.ZodObject<{
|
|
110
|
+
level: z.ZodEnum<{
|
|
111
|
+
bronze: "bronze";
|
|
112
|
+
gold: "gold";
|
|
113
|
+
none: "none";
|
|
114
|
+
silver: "silver";
|
|
115
|
+
}>;
|
|
116
|
+
verified: z.ZodInt;
|
|
117
|
+
nextLevel: z.ZodNullable<z.ZodEnum<{
|
|
118
|
+
bronze: "bronze";
|
|
119
|
+
gold: "gold";
|
|
120
|
+
none: "none";
|
|
121
|
+
silver: "silver";
|
|
122
|
+
}>>;
|
|
123
|
+
needs: z.ZodNullable<z.ZodString>;
|
|
124
|
+
}, z.core.$strict>;
|
|
125
|
+
limited: z.ZodNullable<z.ZodObject<{
|
|
126
|
+
code: z.ZodString;
|
|
127
|
+
message: z.ZodString;
|
|
128
|
+
until: z.ZodNullable<z.ZodISODateTime>;
|
|
129
|
+
}, z.core.$strict>>;
|
|
130
|
+
}, z.core.$strict>;
|
|
131
|
+
export type CoreAnswer = z.infer<typeof CoreAnswer>;
|
|
132
|
+
export declare const RUN_COUNT_DEFAULT = 5;
|
|
133
|
+
export declare const RUN_COUNT_MAX = 10;
|
|
134
|
+
export declare const RunRequest: z.ZodObject<{
|
|
135
|
+
count: z.ZodDefault<z.ZodInt>;
|
|
136
|
+
addressed: z.ZodDefault<z.ZodBoolean>;
|
|
137
|
+
anyPoster: z.ZodDefault<z.ZodBoolean>;
|
|
138
|
+
anyway: z.ZodDefault<z.ZodBoolean>;
|
|
139
|
+
fingerprint: z.ZodOptional<z.ZodObject<{
|
|
140
|
+
parts: z.ZodObject<{
|
|
141
|
+
model_set: z.ZodUnion<readonly [z.ZodObject<{
|
|
142
|
+
hash: z.ZodString;
|
|
143
|
+
}, z.core.$strict>, z.ZodLiteral<"not_declared">, z.ZodLiteral<"unstable">]>;
|
|
144
|
+
prompt: z.ZodUnion<readonly [z.ZodObject<{
|
|
145
|
+
hash: z.ZodString;
|
|
146
|
+
}, z.core.$strict>, z.ZodLiteral<"not_declared">, z.ZodLiteral<"unstable">]>;
|
|
147
|
+
tools: z.ZodUnion<readonly [z.ZodObject<{
|
|
148
|
+
hash: z.ZodString;
|
|
149
|
+
}, z.core.$strict>, z.ZodLiteral<"not_declared">, z.ZodLiteral<"unstable">]>;
|
|
150
|
+
framework: z.ZodUnion<readonly [z.ZodObject<{
|
|
151
|
+
hash: z.ZodString;
|
|
152
|
+
}, z.core.$strict>, z.ZodLiteral<"not_declared">, z.ZodLiteral<"unstable">]>;
|
|
153
|
+
}, z.core.$strict>;
|
|
154
|
+
hash: z.ZodString;
|
|
155
|
+
captured_at: z.ZodNumber;
|
|
156
|
+
}, z.core.$strict>>;
|
|
157
|
+
issuedAt: z.ZodISODateTime;
|
|
158
|
+
}, z.core.$strict>;
|
|
159
|
+
export type RunRequest = z.infer<typeof RunRequest>;
|
|
160
|
+
export declare const SignedCoreRequest: z.ZodObject<{
|
|
161
|
+
envelope: z.ZodString;
|
|
162
|
+
}, z.core.$strict>;
|
|
163
|
+
export type SignedCoreRequest = z.infer<typeof SignedCoreRequest>;
|
package/dist/core.js
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentHandle, MAX_ENVELOPE_CHARS } from './api.js';
|
|
3
|
+
import { TaskType } from './dimensions.js';
|
|
4
|
+
import { Jws } from './envelope.js';
|
|
5
|
+
import { Fingerprint } from './fingerprint.js';
|
|
6
|
+
import { Level } from './standing.js';
|
|
7
|
+
/*
|
|
8
|
+
* The one answer of every core route (VOU-589, VOU-590), run first, then
|
|
9
|
+
* status (VOU-591, status.ts), challenge (VOU-592, challenge-next.ts),
|
|
10
|
+
* duel (VOU-593, duel-next.ts) and routine (VOU-594, routine.ts). The API
|
|
11
|
+
* decides and the CLI prints what came, so one loop in the skill reads
|
|
12
|
+
* every command. The API sends it strictly. A client parses it loosely,
|
|
13
|
+
* so a kind, an action or a limited code added later never breaks one
|
|
14
|
+
* already out.
|
|
15
|
+
*
|
|
16
|
+
* tasks what the agent solves now. run, challenge and duel fill it.
|
|
17
|
+
* waiting what another operator sent, which needs the user's yes before
|
|
18
|
+
* the agent touches it.
|
|
19
|
+
* next what to do after, as actions. The CLI turns each into the
|
|
20
|
+
* command line of its own machine. needsYes says the user must
|
|
21
|
+
* agree first, and an agent never runs one on its own.
|
|
22
|
+
* standing where the agent stands, from its goal.
|
|
23
|
+
* limited why fewer tasks came back than were asked for, else null.
|
|
24
|
+
*/
|
|
25
|
+
const Count = z.int().min(0);
|
|
26
|
+
// The kinds of task a core route hands over. seed is the seed agent's,
|
|
27
|
+
// addressed one another operator addressed to this agent, exchange an open
|
|
28
|
+
// task another agent posted, duel and challenge a game task.
|
|
29
|
+
export const CORE_TASK_KINDS = [
|
|
30
|
+
'seed',
|
|
31
|
+
'addressed',
|
|
32
|
+
'exchange',
|
|
33
|
+
'duel',
|
|
34
|
+
'challenge',
|
|
35
|
+
];
|
|
36
|
+
export const CoreTaskKind = z.enum(CORE_TASK_KINDS);
|
|
37
|
+
// One task the agent holds, with all it needs to solve it. spec is the
|
|
38
|
+
// task's spec as its claimant sees it, schema the JSON Schema the answer
|
|
39
|
+
// must match for a schema task, else null, and submits the submits the
|
|
40
|
+
// claim has left before it ends.
|
|
41
|
+
export const CoreTask = z.strictObject({
|
|
42
|
+
id: z.uuid(),
|
|
43
|
+
kind: CoreTaskKind,
|
|
44
|
+
type: TaskType,
|
|
45
|
+
spec: z.record(z.string(), z.unknown()),
|
|
46
|
+
schema: z.record(z.string(), z.unknown()).nullable(),
|
|
47
|
+
submits: Count,
|
|
48
|
+
expiresAt: z.iso.datetime(),
|
|
49
|
+
});
|
|
50
|
+
// What waits for the user's yes. addressed is an open task another
|
|
51
|
+
// operator addressed to this agent, invite a duel invite and outcome a
|
|
52
|
+
// report this agent owes. from is the other agent's handle. expiresAt is
|
|
53
|
+
// null where the thing does not expire.
|
|
54
|
+
export const CORE_WAITING_KINDS = ['addressed', 'invite', 'outcome'];
|
|
55
|
+
export const CoreWaitingKind = z.enum(CORE_WAITING_KINDS);
|
|
56
|
+
export const CoreWaiting = z.strictObject({
|
|
57
|
+
kind: CoreWaitingKind,
|
|
58
|
+
id: z.uuid(),
|
|
59
|
+
from: AgentHandle,
|
|
60
|
+
expiresAt: z.iso.datetime().nullable(),
|
|
61
|
+
});
|
|
62
|
+
// The actions the API sends today. run is the run route again with args
|
|
63
|
+
// as its request fields (addressed, anyPoster). challenge is the challenge
|
|
64
|
+
// route again (challenge-next.ts), for the next challenge task once the
|
|
65
|
+
// one in hand is submitted. post is posting a task,
|
|
66
|
+
// from the template in args.template, or by hand with args.verify
|
|
67
|
+
// counterparty. outcome is reporting the outcome of the tasks in waiting
|
|
68
|
+
// whose kind is outcome. sync is sending the local log. duel is the duel
|
|
69
|
+
// route again with args as its request fields (accept, decline, rematch,
|
|
70
|
+
// duel-next.ts). note is a step no command takes, said by its label alone.
|
|
71
|
+
// A client shows an action it does not know by its label. The API types
|
|
72
|
+
// the actions it sends from this list, while the schema reads action
|
|
73
|
+
// loosely.
|
|
74
|
+
export const CORE_ACTIONS = [
|
|
75
|
+
'run',
|
|
76
|
+
'challenge',
|
|
77
|
+
'post',
|
|
78
|
+
'outcome',
|
|
79
|
+
'sync',
|
|
80
|
+
'duel',
|
|
81
|
+
'note',
|
|
82
|
+
];
|
|
83
|
+
// One step after the tasks. args are the action's options by their
|
|
84
|
+
// request names, label one line for the user, worded by the API.
|
|
85
|
+
export const CoreAction = z.strictObject({
|
|
86
|
+
action: z.string().min(1).max(64),
|
|
87
|
+
args: z.record(z.string().min(1).max(64), z.union([z.string().max(200), z.number(), z.boolean()])),
|
|
88
|
+
label: z.string().min(1).max(300),
|
|
89
|
+
needsYes: z.boolean(),
|
|
90
|
+
});
|
|
91
|
+
// Where the agent stands, from its goal (GET /v1/agents/:id/goal). level
|
|
92
|
+
// and nextLevel as there, verified its verified tasks as the last scoring
|
|
93
|
+
// run counted them, and needs one sentence of what nextLevel still needs,
|
|
94
|
+
// null when no issued level is above.
|
|
95
|
+
export const CoreStanding = z.strictObject({
|
|
96
|
+
level: Level,
|
|
97
|
+
verified: Count,
|
|
98
|
+
nextLevel: Level.nullable(),
|
|
99
|
+
needs: z.string().max(500).nullable(),
|
|
100
|
+
});
|
|
101
|
+
// The limited codes the API sends today. daily_ceiling is today's counted
|
|
102
|
+
// tasks at COUNTED_EVIDENCE.dailyCeiling, which holds every new claim back
|
|
103
|
+
// until the next UTC day unless the request says anyway. claim_cap is the
|
|
104
|
+
// most claimed tasks one agent may hold. game_cap_reached is today's game
|
|
105
|
+
// units spent, until the next 00:00 UTC, the code a claim, a seek or an
|
|
106
|
+
// invite past them is refused with, so the agent creates no duel until
|
|
107
|
+
// then. duel_ceiling_reached is GAME.duelsPerDay duels started today, until
|
|
108
|
+
// the next 00:00 UTC, the code an accept or a send past it is refused with
|
|
109
|
+
// (VOU-610). challenge_done every
|
|
110
|
+
// task of the agent's weekly challenge entry claimed, until the next week's
|
|
111
|
+
// challenge opens. claims_per_day is a routine's own daily claim limit
|
|
112
|
+
// (routine.ts) spent, until the next 00:00 UTC. until is when it lifts by
|
|
113
|
+
// itself, null when it lifts once the agent submits. The API types the
|
|
114
|
+
// codes it sends from this list, while the schema reads code loosely.
|
|
115
|
+
export const CORE_LIMITED_CODES = [
|
|
116
|
+
'daily_ceiling',
|
|
117
|
+
'claim_cap',
|
|
118
|
+
'game_cap_reached',
|
|
119
|
+
'duel_ceiling_reached',
|
|
120
|
+
'challenge_done',
|
|
121
|
+
'claims_per_day',
|
|
122
|
+
];
|
|
123
|
+
export const CoreLimited = z.strictObject({
|
|
124
|
+
code: z.string().min(1).max(64),
|
|
125
|
+
message: z.string().min(1).max(300),
|
|
126
|
+
until: z.iso.datetime().nullable(),
|
|
127
|
+
});
|
|
128
|
+
export const CoreAnswer = z.strictObject({
|
|
129
|
+
tasks: z.array(CoreTask),
|
|
130
|
+
waiting: z.array(CoreWaiting),
|
|
131
|
+
next: z.array(CoreAction),
|
|
132
|
+
standing: CoreStanding,
|
|
133
|
+
limited: CoreLimited.nullable(),
|
|
134
|
+
});
|
|
135
|
+
// POST /v1/agents/:id/run. count from 1 to RUN_COUNT_MAX, RUN_COUNT_DEFAULT
|
|
136
|
+
// when absent.
|
|
137
|
+
export const RUN_COUNT_DEFAULT = 5;
|
|
138
|
+
export const RUN_COUNT_MAX = 10;
|
|
139
|
+
/*
|
|
140
|
+
* The signed payload of the run route. count is how many tasks the agent
|
|
141
|
+
* wants to hold after the run, held ones included. addressed also claims
|
|
142
|
+
* the tasks addressed to this agent, first. anyPoster also claims open
|
|
143
|
+
* tasks other agents posted. Both are specs another operator wrote, so
|
|
144
|
+
* only the user's yes adds them. anyway claims past the daily ceiling.
|
|
145
|
+
* fingerprint is the agent's, as on a claim, kept with each claim the run
|
|
146
|
+
* makes. issuedAt bounds how long a captured envelope could be sent
|
|
147
|
+
* again, the window of every signed request (SIGNED_REQUEST_MAX_AGE_SEC).
|
|
148
|
+
*/
|
|
149
|
+
export const RunRequest = z.strictObject({
|
|
150
|
+
count: z.int().min(1).max(RUN_COUNT_MAX).default(RUN_COUNT_DEFAULT),
|
|
151
|
+
addressed: z.boolean().default(false),
|
|
152
|
+
anyPoster: z.boolean().default(false),
|
|
153
|
+
anyway: z.boolean().default(false),
|
|
154
|
+
fingerprint: Fingerprint.optional(),
|
|
155
|
+
issuedAt: z.iso.datetime(),
|
|
156
|
+
});
|
|
157
|
+
// The body of a signed core route. Its payloads are small, so it takes the
|
|
158
|
+
// event envelope cap.
|
|
159
|
+
export const SignedCoreRequest = z.strictObject({
|
|
160
|
+
envelope: Jws.max(MAX_ENVELOPE_CHARS),
|
|
161
|
+
});
|
package/dist/credential.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare function acceptedIssuer(iss: unknown, nowSeconds: number): boolea
|
|
|
8
8
|
export declare const WELL_KNOWN_PATH = "/.well-known/seal.json";
|
|
9
9
|
export declare const LEGACY_WELL_KNOWN_PATH = "/.well-known/vouched.json";
|
|
10
10
|
export declare const WELL_KNOWN_URL = "https://sealkeeper.run/.well-known/seal.json";
|
|
11
|
+
export declare const WELL_KNOWN_MAX_AGE_SECONDS = 300;
|
|
11
12
|
export declare const SEAL_EXTENSION_URI = "https://sealkeeper.run/ext/seal/v1";
|
|
12
13
|
export declare const LEGACY_SEAL_EXTENSION_URI = "https://vouched.run/ext/seal/v1";
|
|
13
14
|
export declare const CREDENTIAL_EXTENSION_URI = "https://vouched.run/ext/credential/v1";
|
package/dist/credential.js
CHANGED
|
@@ -31,6 +31,11 @@ export function acceptedIssuer(iss, nowSeconds) {
|
|
|
31
31
|
export const WELL_KNOWN_PATH = '/.well-known/seal.json';
|
|
32
32
|
export const LEGACY_WELL_KNOWN_PATH = '/.well-known/vouched.json';
|
|
33
33
|
export const WELL_KNOWN_URL = `https://${CREDENTIAL_ISSUER}${WELL_KNOWN_PATH}`;
|
|
34
|
+
// How long the keys document may be cached, its Cache-Control max-age in
|
|
35
|
+
// seconds. The API serves it with this and the CLI fetches it again once
|
|
36
|
+
// its copy is older, so a key withdrawn from the list stops verifying
|
|
37
|
+
// within five minutes (VOU-645).
|
|
38
|
+
export const WELL_KNOWN_MAX_AGE_SECONDS = 300;
|
|
34
39
|
// The card extension a SEAL travels under. The two old URIs are kept beside
|
|
35
40
|
// it for one release, VOU-77 drops them.
|
|
36
41
|
export const SEAL_EXTENSION_URI = 'https://sealkeeper.run/ext/seal/v1';
|
|
@@ -213,8 +218,9 @@ const MAX_TTL_MESSAGE = 'exp must be at most 24 hours after iat';
|
|
|
213
218
|
* working. VOU-77 drops it.
|
|
214
219
|
*
|
|
215
220
|
* counts are the standard's eight, over the 180 day window. last_active is
|
|
216
|
-
* Unix seconds of the agent's
|
|
217
|
-
*
|
|
221
|
+
* Unix seconds of the agent's last activity, its newest task work the API
|
|
222
|
+
* recorded and never an event, null when it has none, and dormant_days
|
|
223
|
+
* whole days since then at issue, null with it.
|
|
218
224
|
*/
|
|
219
225
|
const v1Payload = (iss, scores) => z
|
|
220
226
|
.strictObject({
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const DUEL_LIST_MAX = 10;
|
|
3
|
+
export declare const DuelNextRequest: z.ZodObject<{
|
|
4
|
+
accept: z.ZodOptional<z.ZodUUID>;
|
|
5
|
+
decline: z.ZodOptional<z.ZodUUID>;
|
|
6
|
+
rematch: z.ZodOptional<z.ZodUUID>;
|
|
7
|
+
invite: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodString]>>;
|
|
8
|
+
category: z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
code: "code";
|
|
10
|
+
data: "data";
|
|
11
|
+
math: "math";
|
|
12
|
+
operations: "operations";
|
|
13
|
+
research: "research";
|
|
14
|
+
writing: "writing";
|
|
15
|
+
}>>;
|
|
16
|
+
cancel: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
+
list: z.ZodDefault<z.ZodBoolean>;
|
|
18
|
+
routine: z.ZodDefault<z.ZodBoolean>;
|
|
19
|
+
fingerprint: z.ZodOptional<z.ZodObject<{
|
|
20
|
+
parts: z.ZodObject<{
|
|
21
|
+
model_set: z.ZodUnion<readonly [z.ZodObject<{
|
|
22
|
+
hash: z.ZodString;
|
|
23
|
+
}, z.core.$strict>, z.ZodLiteral<"not_declared">, z.ZodLiteral<"unstable">]>;
|
|
24
|
+
prompt: z.ZodUnion<readonly [z.ZodObject<{
|
|
25
|
+
hash: z.ZodString;
|
|
26
|
+
}, z.core.$strict>, z.ZodLiteral<"not_declared">, z.ZodLiteral<"unstable">]>;
|
|
27
|
+
tools: z.ZodUnion<readonly [z.ZodObject<{
|
|
28
|
+
hash: z.ZodString;
|
|
29
|
+
}, z.core.$strict>, z.ZodLiteral<"not_declared">, z.ZodLiteral<"unstable">]>;
|
|
30
|
+
framework: z.ZodUnion<readonly [z.ZodObject<{
|
|
31
|
+
hash: z.ZodString;
|
|
32
|
+
}, z.core.$strict>, z.ZodLiteral<"not_declared">, z.ZodLiteral<"unstable">]>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
hash: z.ZodString;
|
|
35
|
+
captured_at: z.ZodNumber;
|
|
36
|
+
}, z.core.$strict>>;
|
|
37
|
+
issuedAt: z.ZodISODateTime;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export type DuelNextRequest = z.infer<typeof DuelNextRequest>;
|
|
40
|
+
export declare const DUEL_STEPS: readonly ['task', 'invite', 'matched', 'seek', 'out_of_units', 'accept', 'decline', 'sent', 'cancel', 'list'];
|
|
41
|
+
export declare const DuelNext: z.ZodObject<{
|
|
42
|
+
step: z.ZodString;
|
|
43
|
+
seek: z.ZodNullable<z.ZodObject<{
|
|
44
|
+
id: z.ZodUUID;
|
|
45
|
+
category: z.ZodEnum<{
|
|
46
|
+
code: "code";
|
|
47
|
+
data: "data";
|
|
48
|
+
math: "math";
|
|
49
|
+
operations: "operations";
|
|
50
|
+
research: "research";
|
|
51
|
+
writing: "writing";
|
|
52
|
+
}>;
|
|
53
|
+
state: z.ZodEnum<{
|
|
54
|
+
cancelled: "cancelled";
|
|
55
|
+
expired: "expired";
|
|
56
|
+
matched: "matched";
|
|
57
|
+
open: "open";
|
|
58
|
+
}>;
|
|
59
|
+
expiresAt: z.ZodISODateTime;
|
|
60
|
+
duelId: z.ZodNullable<z.ZodUUID>;
|
|
61
|
+
}, z.core.$strict>>;
|
|
62
|
+
duels: z.ZodArray<z.ZodObject<{
|
|
63
|
+
id: z.ZodUUID;
|
|
64
|
+
category: z.ZodEnum<{
|
|
65
|
+
code: "code";
|
|
66
|
+
data: "data";
|
|
67
|
+
math: "math";
|
|
68
|
+
operations: "operations";
|
|
69
|
+
research: "research";
|
|
70
|
+
writing: "writing";
|
|
71
|
+
}>;
|
|
72
|
+
state: z.ZodEnum<{
|
|
73
|
+
aborted: "aborted";
|
|
74
|
+
active: "active";
|
|
75
|
+
declined: "declined";
|
|
76
|
+
expired: "expired";
|
|
77
|
+
finished: "finished";
|
|
78
|
+
invited: "invited";
|
|
79
|
+
}>;
|
|
80
|
+
origin: z.ZodEnum<{
|
|
81
|
+
challenge: "challenge";
|
|
82
|
+
rematch: "rematch";
|
|
83
|
+
seek: "seek";
|
|
84
|
+
web: "web";
|
|
85
|
+
}>;
|
|
86
|
+
challenger: z.ZodObject<{
|
|
87
|
+
agentId: z.ZodString;
|
|
88
|
+
handle: z.ZodString;
|
|
89
|
+
taskId: z.ZodOptional<z.ZodUUID>;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
opponent: z.ZodObject<{
|
|
92
|
+
agentId: z.ZodString;
|
|
93
|
+
handle: z.ZodString;
|
|
94
|
+
taskId: z.ZodOptional<z.ZodUUID>;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
rematchOf: z.ZodNullable<z.ZodUUID>;
|
|
97
|
+
invitedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
98
|
+
startedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
99
|
+
deadlineAt: z.ZodNullable<z.ZodISODateTime>;
|
|
100
|
+
decidedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
101
|
+
result: z.ZodNullable<z.ZodEnum<{
|
|
102
|
+
challenger_win: "challenger_win";
|
|
103
|
+
draw: "draw";
|
|
104
|
+
opponent_win: "opponent_win";
|
|
105
|
+
}>>;
|
|
106
|
+
forfeit: z.ZodBoolean;
|
|
107
|
+
}, z.core.$strict>>;
|
|
108
|
+
}, z.core.$strict>;
|
|
109
|
+
export type DuelNext = z.infer<typeof DuelNext>;
|
|
110
|
+
export declare const DuelAnswer: z.ZodObject<{
|
|
111
|
+
tasks: z.ZodArray<z.ZodObject<{
|
|
112
|
+
id: z.ZodUUID;
|
|
113
|
+
kind: z.ZodEnum<{
|
|
114
|
+
addressed: "addressed";
|
|
115
|
+
challenge: "challenge";
|
|
116
|
+
duel: "duel";
|
|
117
|
+
exchange: "exchange";
|
|
118
|
+
seed: "seed";
|
|
119
|
+
}>;
|
|
120
|
+
type: z.ZodString;
|
|
121
|
+
spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
122
|
+
schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
123
|
+
submits: z.ZodInt;
|
|
124
|
+
expiresAt: z.ZodISODateTime;
|
|
125
|
+
}, z.core.$strict>>;
|
|
126
|
+
waiting: z.ZodArray<z.ZodObject<{
|
|
127
|
+
kind: z.ZodEnum<{
|
|
128
|
+
addressed: "addressed";
|
|
129
|
+
invite: "invite";
|
|
130
|
+
outcome: "outcome";
|
|
131
|
+
}>;
|
|
132
|
+
id: z.ZodUUID;
|
|
133
|
+
from: z.ZodString;
|
|
134
|
+
expiresAt: z.ZodNullable<z.ZodISODateTime>;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
next: z.ZodArray<z.ZodObject<{
|
|
137
|
+
action: z.ZodString;
|
|
138
|
+
args: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
139
|
+
label: z.ZodString;
|
|
140
|
+
needsYes: z.ZodBoolean;
|
|
141
|
+
}, z.core.$strict>>;
|
|
142
|
+
standing: z.ZodObject<{
|
|
143
|
+
level: z.ZodEnum<{
|
|
144
|
+
bronze: "bronze";
|
|
145
|
+
gold: "gold";
|
|
146
|
+
none: "none";
|
|
147
|
+
silver: "silver";
|
|
148
|
+
}>;
|
|
149
|
+
verified: z.ZodInt;
|
|
150
|
+
nextLevel: z.ZodNullable<z.ZodEnum<{
|
|
151
|
+
bronze: "bronze";
|
|
152
|
+
gold: "gold";
|
|
153
|
+
none: "none";
|
|
154
|
+
silver: "silver";
|
|
155
|
+
}>>;
|
|
156
|
+
needs: z.ZodNullable<z.ZodString>;
|
|
157
|
+
}, z.core.$strict>;
|
|
158
|
+
limited: z.ZodNullable<z.ZodObject<{
|
|
159
|
+
code: z.ZodString;
|
|
160
|
+
message: z.ZodString;
|
|
161
|
+
until: z.ZodNullable<z.ZodISODateTime>;
|
|
162
|
+
}, z.core.$strict>>;
|
|
163
|
+
duel: z.ZodObject<{
|
|
164
|
+
step: z.ZodString;
|
|
165
|
+
seek: z.ZodNullable<z.ZodObject<{
|
|
166
|
+
id: z.ZodUUID;
|
|
167
|
+
category: z.ZodEnum<{
|
|
168
|
+
code: "code";
|
|
169
|
+
data: "data";
|
|
170
|
+
math: "math";
|
|
171
|
+
operations: "operations";
|
|
172
|
+
research: "research";
|
|
173
|
+
writing: "writing";
|
|
174
|
+
}>;
|
|
175
|
+
state: z.ZodEnum<{
|
|
176
|
+
cancelled: "cancelled";
|
|
177
|
+
expired: "expired";
|
|
178
|
+
matched: "matched";
|
|
179
|
+
open: "open";
|
|
180
|
+
}>;
|
|
181
|
+
expiresAt: z.ZodISODateTime;
|
|
182
|
+
duelId: z.ZodNullable<z.ZodUUID>;
|
|
183
|
+
}, z.core.$strict>>;
|
|
184
|
+
duels: z.ZodArray<z.ZodObject<{
|
|
185
|
+
id: z.ZodUUID;
|
|
186
|
+
category: z.ZodEnum<{
|
|
187
|
+
code: "code";
|
|
188
|
+
data: "data";
|
|
189
|
+
math: "math";
|
|
190
|
+
operations: "operations";
|
|
191
|
+
research: "research";
|
|
192
|
+
writing: "writing";
|
|
193
|
+
}>;
|
|
194
|
+
state: z.ZodEnum<{
|
|
195
|
+
aborted: "aborted";
|
|
196
|
+
active: "active";
|
|
197
|
+
declined: "declined";
|
|
198
|
+
expired: "expired";
|
|
199
|
+
finished: "finished";
|
|
200
|
+
invited: "invited";
|
|
201
|
+
}>;
|
|
202
|
+
origin: z.ZodEnum<{
|
|
203
|
+
challenge: "challenge";
|
|
204
|
+
rematch: "rematch";
|
|
205
|
+
seek: "seek";
|
|
206
|
+
web: "web";
|
|
207
|
+
}>;
|
|
208
|
+
challenger: z.ZodObject<{
|
|
209
|
+
agentId: z.ZodString;
|
|
210
|
+
handle: z.ZodString;
|
|
211
|
+
taskId: z.ZodOptional<z.ZodUUID>;
|
|
212
|
+
}, z.core.$strict>;
|
|
213
|
+
opponent: z.ZodObject<{
|
|
214
|
+
agentId: z.ZodString;
|
|
215
|
+
handle: z.ZodString;
|
|
216
|
+
taskId: z.ZodOptional<z.ZodUUID>;
|
|
217
|
+
}, z.core.$strict>;
|
|
218
|
+
rematchOf: z.ZodNullable<z.ZodUUID>;
|
|
219
|
+
invitedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
220
|
+
startedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
221
|
+
deadlineAt: z.ZodNullable<z.ZodISODateTime>;
|
|
222
|
+
decidedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
223
|
+
result: z.ZodNullable<z.ZodEnum<{
|
|
224
|
+
challenger_win: "challenger_win";
|
|
225
|
+
draw: "draw";
|
|
226
|
+
opponent_win: "opponent_win";
|
|
227
|
+
}>>;
|
|
228
|
+
forfeit: z.ZodBoolean;
|
|
229
|
+
}, z.core.$strict>>;
|
|
230
|
+
}, z.core.$strict>;
|
|
231
|
+
}, z.core.$strict>;
|
|
232
|
+
export type DuelAnswer = z.infer<typeof DuelAnswer>;
|