@otto-code/protocol 0.5.1 → 0.5.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.
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ export declare const JUDGE_OUTCOMES: readonly ["pass", "fail"];
3
+ export type JudgeOutcome = (typeof JUDGE_OUTCOMES)[number];
4
+ export declare function isJudgeOutcome(value: string): value is JudgeOutcome;
5
+ /**
6
+ * Coerce a raw verdict string to a known outcome. Anything that isn't an exact
7
+ * known outcome is treated as `"fail"` — an unparseable verdict must not be read
8
+ * as a pass, so a gate never advances on a value it doesn't understand.
9
+ */
10
+ export declare function normalizeJudgeOutcome(value: string | undefined): JudgeOutcome;
11
+ export declare const JudgeCriterionSchema: z.ZodObject<{
12
+ name: z.ZodString;
13
+ met: z.ZodBoolean;
14
+ evidence: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$loose>;
16
+ export type JudgeCriterion = z.infer<typeof JudgeCriterionSchema>;
17
+ export declare const JudgeVerdictSchema: z.ZodObject<{
18
+ verdict: z.ZodString;
19
+ score: z.ZodOptional<z.ZodNumber>;
20
+ criteria: z.ZodOptional<z.ZodArray<z.ZodObject<{
21
+ name: z.ZodString;
22
+ met: z.ZodBoolean;
23
+ evidence: z.ZodOptional<z.ZodString>;
24
+ }, z.core.$loose>>>;
25
+ summary: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$loose>;
27
+ export type JudgeVerdict = z.infer<typeof JudgeVerdictSchema>;
28
+ /** True when the verdict's outcome normalizes to `"pass"`. */
29
+ export declare function judgeVerdictPassed(verdict: Pick<JudgeVerdict, "verdict">): boolean;
30
+ //# sourceMappingURL=judge-verdict.d.ts.map
@@ -0,0 +1,61 @@
1
+ import { z } from "zod";
2
+ // The structured verdict a `judger` returns when it evaluates work or a plan, so
3
+ // an orchestrator can branch mechanically instead of parsing prose. This is the
4
+ // canonical shape shared by the daemon and the app; the orchestration runtime
5
+ // (see projects/agent-orchestration) enforces it at the worker tool boundary and
6
+ // reads `verdict`/`score` directly to drive gates and the loop-until-N-good
7
+ // pattern. Absorbs upstream Paseo's `verify·spec` auditor output ("YES/NO per
8
+ // acceptance criterion, with evidence").
9
+ //
10
+ // Wire-forward-compat: kept a pure structural schema with plain leaves (no
11
+ // transforms), so it can later ride a protocol message without breaking older
12
+ // peers. The outcome rides as a plain string (like personality roles and effort
13
+ // levels) rather than a z.enum, so the vocabulary can grow — consumers normalize
14
+ // through `isJudgeOutcome` / `normalizeJudgeOutcome` instead of trusting the raw
15
+ // value.
16
+ // The pass/fail decision. Binary is enough for the signature loop-until-N-good
17
+ // pattern (keep passers, replace failers); a richer vocabulary can be added
18
+ // later without breaking peers because the field is a plain string on the wire.
19
+ export const JUDGE_OUTCOMES = ["pass", "fail"];
20
+ const OUTCOME_SET = new Set(JUDGE_OUTCOMES);
21
+ export function isJudgeOutcome(value) {
22
+ return OUTCOME_SET.has(value);
23
+ }
24
+ /**
25
+ * Coerce a raw verdict string to a known outcome. Anything that isn't an exact
26
+ * known outcome is treated as `"fail"` — an unparseable verdict must not be read
27
+ * as a pass, so a gate never advances on a value it doesn't understand.
28
+ */
29
+ export function normalizeJudgeOutcome(value) {
30
+ return value !== undefined && isJudgeOutcome(value) ? value : "fail";
31
+ }
32
+ // One acceptance criterion the judge checked, with the evidence that settles it
33
+ // (a file/line, a test name, an observed behavior). `met` is the machine-readable
34
+ // bit; `evidence` is the human-auditable why.
35
+ export const JudgeCriterionSchema = z
36
+ .object({
37
+ name: z.string().min(1),
38
+ met: z.boolean(),
39
+ evidence: z.string().optional(),
40
+ })
41
+ .passthrough();
42
+ export const JudgeVerdictSchema = z
43
+ .object({
44
+ // "pass" | "fail" as a plain string (forward-compat); read through
45
+ // normalizeJudgeOutcome, never trusted raw.
46
+ verdict: z.string().min(1),
47
+ // 0..1 quality/confidence score, used to rank passers when the conductor
48
+ // wants the best N of several candidates.
49
+ score: z.number().min(0).max(1).optional(),
50
+ // Per-criterion breakdown. Optional (absent = none reported) rather than
51
+ // defaulted, per the protocol rule against array defaults on wire schemas.
52
+ criteria: z.array(JudgeCriterionSchema).optional(),
53
+ // One-line human summary of the call.
54
+ summary: z.string().optional(),
55
+ })
56
+ .passthrough();
57
+ /** True when the verdict's outcome normalizes to `"pass"`. */
58
+ export function judgeVerdictPassed(verdict) {
59
+ return normalizeJudgeOutcome(verdict.verdict) === "pass";
60
+ }
61
+ //# sourceMappingURL=judge-verdict.js.map
@@ -39,14 +39,14 @@ export declare const LoopIterationRecordSchema: z.ZodObject<{
39
39
  verifierAgentId: z.ZodNullable<z.ZodString>;
40
40
  status: z.ZodEnum<{
41
41
  running: "running";
42
- succeeded: "succeeded";
43
42
  failed: "failed";
43
+ succeeded: "succeeded";
44
44
  stopped: "stopped";
45
45
  }>;
46
46
  workerOutcome: z.ZodNullable<z.ZodEnum<{
47
47
  failed: "failed";
48
- completed: "completed";
49
48
  canceled: "canceled";
49
+ completed: "completed";
50
50
  }>>;
51
51
  failureReason: z.ZodNullable<z.ZodString>;
52
52
  verifyChecks: z.ZodArray<z.ZodObject<{
@@ -87,8 +87,8 @@ export declare const LoopRecordSchema: z.ZodObject<{
87
87
  maxTimeMs: z.ZodNullable<z.ZodNumber>;
88
88
  status: z.ZodEnum<{
89
89
  running: "running";
90
- succeeded: "succeeded";
91
90
  failed: "failed";
91
+ succeeded: "succeeded";
92
92
  stopped: "stopped";
93
93
  }>;
94
94
  createdAt: z.ZodString;
@@ -104,14 +104,14 @@ export declare const LoopRecordSchema: z.ZodObject<{
104
104
  verifierAgentId: z.ZodNullable<z.ZodString>;
105
105
  status: z.ZodEnum<{
106
106
  running: "running";
107
- succeeded: "succeeded";
108
107
  failed: "failed";
108
+ succeeded: "succeeded";
109
109
  stopped: "stopped";
110
110
  }>;
111
111
  workerOutcome: z.ZodNullable<z.ZodEnum<{
112
112
  failed: "failed";
113
- completed: "completed";
114
113
  canceled: "canceled";
114
+ completed: "completed";
115
115
  }>>;
116
116
  failureReason: z.ZodNullable<z.ZodString>;
117
117
  verifyChecks: z.ZodArray<z.ZodObject<{
@@ -157,8 +157,8 @@ export declare const LoopListItemSchema: z.ZodObject<{
157
157
  name: z.ZodNullable<z.ZodString>;
158
158
  status: z.ZodEnum<{
159
159
  running: "running";
160
- succeeded: "succeeded";
161
160
  failed: "failed";
161
+ succeeded: "succeeded";
162
162
  stopped: "stopped";
163
163
  }>;
164
164
  cwd: z.ZodString;
@@ -232,8 +232,8 @@ export declare const LoopRunResponseSchema: z.ZodObject<{
232
232
  maxTimeMs: z.ZodNullable<z.ZodNumber>;
233
233
  status: z.ZodEnum<{
234
234
  running: "running";
235
- succeeded: "succeeded";
236
235
  failed: "failed";
236
+ succeeded: "succeeded";
237
237
  stopped: "stopped";
238
238
  }>;
239
239
  createdAt: z.ZodString;
@@ -249,14 +249,14 @@ export declare const LoopRunResponseSchema: z.ZodObject<{
249
249
  verifierAgentId: z.ZodNullable<z.ZodString>;
250
250
  status: z.ZodEnum<{
251
251
  running: "running";
252
- succeeded: "succeeded";
253
252
  failed: "failed";
253
+ succeeded: "succeeded";
254
254
  stopped: "stopped";
255
255
  }>;
256
256
  workerOutcome: z.ZodNullable<z.ZodEnum<{
257
257
  failed: "failed";
258
- completed: "completed";
259
258
  canceled: "canceled";
259
+ completed: "completed";
260
260
  }>>;
261
261
  failureReason: z.ZodNullable<z.ZodString>;
262
262
  verifyChecks: z.ZodArray<z.ZodObject<{
@@ -309,8 +309,8 @@ export declare const LoopListResponseSchema: z.ZodObject<{
309
309
  name: z.ZodNullable<z.ZodString>;
310
310
  status: z.ZodEnum<{
311
311
  running: "running";
312
- succeeded: "succeeded";
313
312
  failed: "failed";
313
+ succeeded: "succeeded";
314
314
  stopped: "stopped";
315
315
  }>;
316
316
  cwd: z.ZodString;
@@ -346,8 +346,8 @@ export declare const LoopInspectResponseSchema: z.ZodObject<{
346
346
  maxTimeMs: z.ZodNullable<z.ZodNumber>;
347
347
  status: z.ZodEnum<{
348
348
  running: "running";
349
- succeeded: "succeeded";
350
349
  failed: "failed";
350
+ succeeded: "succeeded";
351
351
  stopped: "stopped";
352
352
  }>;
353
353
  createdAt: z.ZodString;
@@ -363,14 +363,14 @@ export declare const LoopInspectResponseSchema: z.ZodObject<{
363
363
  verifierAgentId: z.ZodNullable<z.ZodString>;
364
364
  status: z.ZodEnum<{
365
365
  running: "running";
366
- succeeded: "succeeded";
367
366
  failed: "failed";
367
+ succeeded: "succeeded";
368
368
  stopped: "stopped";
369
369
  }>;
370
370
  workerOutcome: z.ZodNullable<z.ZodEnum<{
371
371
  failed: "failed";
372
- completed: "completed";
373
372
  canceled: "canceled";
373
+ completed: "completed";
374
374
  }>>;
375
375
  failureReason: z.ZodNullable<z.ZodString>;
376
376
  verifyChecks: z.ZodArray<z.ZodObject<{
@@ -439,8 +439,8 @@ export declare const LoopLogsResponseSchema: z.ZodObject<{
439
439
  maxTimeMs: z.ZodNullable<z.ZodNumber>;
440
440
  status: z.ZodEnum<{
441
441
  running: "running";
442
- succeeded: "succeeded";
443
442
  failed: "failed";
443
+ succeeded: "succeeded";
444
444
  stopped: "stopped";
445
445
  }>;
446
446
  createdAt: z.ZodString;
@@ -456,14 +456,14 @@ export declare const LoopLogsResponseSchema: z.ZodObject<{
456
456
  verifierAgentId: z.ZodNullable<z.ZodString>;
457
457
  status: z.ZodEnum<{
458
458
  running: "running";
459
- succeeded: "succeeded";
460
459
  failed: "failed";
460
+ succeeded: "succeeded";
461
461
  stopped: "stopped";
462
462
  }>;
463
463
  workerOutcome: z.ZodNullable<z.ZodEnum<{
464
464
  failed: "failed";
465
- completed: "completed";
466
465
  canceled: "canceled";
466
+ completed: "completed";
467
467
  }>>;
468
468
  failureReason: z.ZodNullable<z.ZodString>;
469
469
  verifyChecks: z.ZodArray<z.ZodObject<{
@@ -549,8 +549,8 @@ export declare const LoopStopResponseSchema: z.ZodObject<{
549
549
  maxTimeMs: z.ZodNullable<z.ZodNumber>;
550
550
  status: z.ZodEnum<{
551
551
  running: "running";
552
- succeeded: "succeeded";
553
552
  failed: "failed";
553
+ succeeded: "succeeded";
554
554
  stopped: "stopped";
555
555
  }>;
556
556
  createdAt: z.ZodString;
@@ -566,14 +566,14 @@ export declare const LoopStopResponseSchema: z.ZodObject<{
566
566
  verifierAgentId: z.ZodNullable<z.ZodString>;
567
567
  status: z.ZodEnum<{
568
568
  running: "running";
569
- succeeded: "succeeded";
570
569
  failed: "failed";
570
+ succeeded: "succeeded";
571
571
  stopped: "stopped";
572
572
  }>;
573
573
  workerOutcome: z.ZodNullable<z.ZodEnum<{
574
574
  failed: "failed";
575
- completed: "completed";
576
575
  canceled: "canceled";
576
+ completed: "completed";
577
577
  }>>;
578
578
  failureReason: z.ZodNullable<z.ZodString>;
579
579
  verifyChecks: z.ZodArray<z.ZodObject<{