@cat-factory/contracts 0.284.0 → 0.286.0

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.
Files changed (87) hide show
  1. package/dist/agent-presentation.d.ts +32 -2
  2. package/dist/agent-presentation.d.ts.map +1 -1
  3. package/dist/agent-presentation.js +15 -0
  4. package/dist/agent-presentation.js.map +1 -1
  5. package/dist/binary-candidates.d.ts +261 -0
  6. package/dist/binary-candidates.d.ts.map +1 -0
  7. package/dist/binary-candidates.js +202 -0
  8. package/dist/binary-candidates.js.map +1 -0
  9. package/dist/binary-capabilities.d.ts +393 -0
  10. package/dist/binary-capabilities.d.ts.map +1 -0
  11. package/dist/binary-capabilities.js +465 -0
  12. package/dist/binary-capabilities.js.map +1 -0
  13. package/dist/binary-generators.d.ts +27 -0
  14. package/dist/binary-generators.d.ts.map +1 -1
  15. package/dist/binary-generators.js +28 -0
  16. package/dist/binary-generators.js.map +1 -1
  17. package/dist/binary-modalities.d.ts +18 -0
  18. package/dist/binary-modalities.d.ts.map +1 -1
  19. package/dist/binary-modalities.js +28 -0
  20. package/dist/binary-modalities.js.map +1 -1
  21. package/dist/binary-outputs.d.ts +69 -0
  22. package/dist/binary-outputs.d.ts.map +1 -1
  23. package/dist/binary-outputs.js +46 -0
  24. package/dist/binary-outputs.js.map +1 -1
  25. package/dist/build-ladder.d.ts +37 -0
  26. package/dist/build-ladder.d.ts.map +1 -0
  27. package/dist/build-ladder.js +46 -0
  28. package/dist/build-ladder.js.map +1 -0
  29. package/dist/entities.d.ts +49 -0
  30. package/dist/entities.d.ts.map +1 -1
  31. package/dist/entities.js +26 -0
  32. package/dist/entities.js.map +1 -1
  33. package/dist/execution.d.ts +136 -6
  34. package/dist/execution.d.ts.map +1 -1
  35. package/dist/execution.js +30 -3
  36. package/dist/execution.js.map +1 -1
  37. package/dist/index.d.ts +5 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +5 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/platform-agent-kinds.d.ts +19 -0
  42. package/dist/platform-agent-kinds.d.ts.map +1 -0
  43. package/dist/platform-agent-kinds.js +30 -0
  44. package/dist/platform-agent-kinds.js.map +1 -0
  45. package/dist/requests.d.ts +27 -0
  46. package/dist/requests.d.ts.map +1 -1
  47. package/dist/requests.js +10 -0
  48. package/dist/requests.js.map +1 -1
  49. package/dist/result-views.d.ts +1 -1
  50. package/dist/result-views.d.ts.map +1 -1
  51. package/dist/result-views.js +1 -0
  52. package/dist/result-views.js.map +1 -1
  53. package/dist/routes/agent-runs.d.ts +84 -0
  54. package/dist/routes/agent-runs.d.ts.map +1 -1
  55. package/dist/routes/binaryCandidates.d.ts +139 -0
  56. package/dist/routes/binaryCandidates.d.ts.map +1 -0
  57. package/dist/routes/binaryCandidates.js +31 -0
  58. package/dist/routes/binaryCandidates.js.map +1 -0
  59. package/dist/routes/bug-hunt.d.ts +84 -0
  60. package/dist/routes/bug-hunt.d.ts.map +1 -1
  61. package/dist/routes/execution.d.ts +1523 -0
  62. package/dist/routes/execution.d.ts.map +1 -1
  63. package/dist/routes/execution.js +13 -1
  64. package/dist/routes/execution.js.map +1 -1
  65. package/dist/routes/human-review.d.ts +42 -0
  66. package/dist/routes/human-review.d.ts.map +1 -1
  67. package/dist/routes/human-test.d.ts +210 -0
  68. package/dist/routes/human-test.d.ts.map +1 -1
  69. package/dist/routes/index.d.ts +1 -0
  70. package/dist/routes/index.d.ts.map +1 -1
  71. package/dist/routes/index.js +1 -0
  72. package/dist/routes/index.js.map +1 -1
  73. package/dist/routes/pipelines.d.ts +70 -0
  74. package/dist/routes/pipelines.d.ts.map +1 -1
  75. package/dist/routes/visual-confirm.d.ts +126 -0
  76. package/dist/routes/visual-confirm.d.ts.map +1 -1
  77. package/dist/routes/workspaces.d.ts +108 -2
  78. package/dist/routes/workspaces.d.ts.map +1 -1
  79. package/dist/snapshot.d.ts +72 -9
  80. package/dist/snapshot.d.ts.map +1 -1
  81. package/dist/snapshot.js +18 -8
  82. package/dist/snapshot.js.map +1 -1
  83. package/dist/step-conditions.d.ts +98 -0
  84. package/dist/step-conditions.d.ts.map +1 -0
  85. package/dist/step-conditions.js +109 -0
  86. package/dist/step-conditions.js.map +1 -0
  87. package/package.json +1 -1
@@ -0,0 +1,98 @@
1
+ import * as v from 'valibot';
2
+ /** The block `type` a service frame carries when it owns a rendered UI. */
3
+ export declare const FRONTEND_BLOCK_TYPE = "frontend";
4
+ /**
5
+ * Which half of a run's service scope a step needs:
6
+ *
7
+ * - `frontend` — run only when the change touches a service declared as a frontend.
8
+ * - `backend` — run only when it touches a service that is NOT a frontend.
9
+ *
10
+ * A full-stack task (a frontend service plus an involved backend service, or vice versa) is in
11
+ * BOTH scopes, so a pipeline carrying both testers runs both on it.
12
+ */
13
+ export declare const stepServiceScopeSchema: v.PicklistSchema<["frontend", "backend"], undefined>;
14
+ export type StepServiceScope = v.InferOutput<typeof stepServiceScopeSchema>;
15
+ /**
16
+ * A step's run condition: what has to be true of the run for this step to apply at all.
17
+ * Today the only axis is {@link stepServiceScopeSchema}; it is an OBJECT rather than a bare
18
+ * picklist so the next axis is a field beside it rather than a second per-step knob.
19
+ *
20
+ * Absent ⇒ unconditional, which is every step that does not declare one.
21
+ */
22
+ export declare const stepRunConditionSchema: v.ObjectSchema<{
23
+ readonly serviceScope: v.PicklistSchema<["frontend", "backend"], undefined>;
24
+ }, undefined>;
25
+ export type StepRunCondition = v.InferOutput<typeof stepRunConditionSchema>;
26
+ /**
27
+ * The service scope of a run: whether the services it may change include a frontend, a
28
+ * non-frontend, or both.
29
+ *
30
+ * BOTH FALSE is a real and distinct state — the run's services could not be resolved (a task
31
+ * outside any service frame) — and it is deliberately not spelled as an "unknown" flag, because
32
+ * every resolved frame contributes exactly one of the two: a scope with neither can only be an
33
+ * empty one. {@link stepConditionSatisfied} reads that state as "nothing to judge" and runs the
34
+ * step, the same fail-safe-to-thoroughness direction `onMissingEstimate: 'run'` takes.
35
+ *
36
+ * A MIXED scope (both halves true) is what this reduction exists to express, but no board state
37
+ * produces one today, and that is a property of the CONNECTION model rather than of this file: a
38
+ * run's frames are its own service frame plus the task's involved services, involved services must
39
+ * be connection neighbours, and only a `service`-type frame may declare a connection or be named as
40
+ * one (`serviceConnectionsError`, and the narrowing that drops the field on every other frame type).
41
+ * So a frontend frame has no neighbours in either direction, a frontend task can name no involved
42
+ * service, and every involved service is a non-frontend. Both halves stay because the reduction is
43
+ * the honest statement of "what does this run change" and it is the connection model, not this
44
+ * function, that would have to change to widen it. Do NOT re-derive the mixed case in a test by
45
+ * hand-building a board with a service connected to a frontend: that board cannot be saved.
46
+ */
47
+ export interface RunServiceScope {
48
+ /** Some service in scope is declared `type: 'frontend'` — there is a UI to exercise. */
49
+ frontend: boolean;
50
+ /** Some service in scope is NOT a frontend — there is an API/service behind it. */
51
+ backend: boolean;
52
+ }
53
+ /**
54
+ * Reduce the service frames a run may change — its own service plus the task's involved
55
+ * services — into the {@link RunServiceScope} the step conditions read.
56
+ *
57
+ * Takes the FRAMES rather than the block, because "what does this run change" is the ancestry
58
+ * walk plus the involved-service resolution, and both already happen in the engine. Frames are
59
+ * deduped by the caller; passing the same frame twice changes nothing here.
60
+ */
61
+ export declare function resolveRunServiceScope(frames: readonly {
62
+ type?: string | null;
63
+ }[]): RunServiceScope;
64
+ /**
65
+ * Why a run step finished as `skipped` rather than running — the three axes that can skip one,
66
+ * as a member the SPA maps to translated copy rather than prose the backend composed:
67
+ *
68
+ * - `gated` — the step's estimate gate was not met (the task scored below its thresholds).
69
+ * - `condition` — the step's {@link stepRunConditionSchema} did not match the run's service
70
+ * scope. The step still carries the condition, so a reader wanting the specific
71
+ * sentence ("no frontend in scope") reads `serviceScope` off it; this says only
72
+ * which axis fired, so the two can never disagree about the scope.
73
+ * - `producer_skipped` — a COMPANION whose producer was itself skipped, so there is nothing for
74
+ * it to grade. Distinct from `gated` because the fix is different: the reader
75
+ * has to look at the producer, not at this step's own thresholds.
76
+ * - `run_complete` — an earlier step ENDED the run (a `bug-intake` fire that found nothing to
77
+ * adopt), so everything after it was closed out untouched. Nothing about THIS
78
+ * step decided it, which is why it cannot borrow any of the three above.
79
+ *
80
+ * PERSISTED and CLOSED, so retiring a member does not remove it from stored runs: read it with
81
+ * {@link isStepSkipReason} and render an unrecognised value as "skipped" rather than crashing or
82
+ * guessing onto a current member.
83
+ */
84
+ export declare const stepSkipReasonSchema: v.PicklistSchema<["gated", "condition", "producer_skipped", "run_complete"], undefined>;
85
+ export type StepSkipReason = v.InferOutput<typeof stepSkipReasonSchema>;
86
+ /**
87
+ * Narrow a persisted `skipReason` to a member this build still knows, DERIVED from the picklist's
88
+ * own options so adding a member cannot leave this behind. A stored run may name a member since
89
+ * retired, and a browser may hold a bundle older than the member it reads.
90
+ */
91
+ export declare function isStepSkipReason(value: unknown): value is StepSkipReason;
92
+ /**
93
+ * Whether a step carrying `condition` applies to a run of `scope`. An absent condition is
94
+ * unconditional; an unresolvable scope (see {@link RunServiceScope}) runs the step rather than
95
+ * silently dropping it.
96
+ */
97
+ export declare function stepConditionSatisfied(condition: StepRunCondition | null | undefined, scope: RunServiceScope): boolean;
98
+ //# sourceMappingURL=step-conditions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-conditions.d.ts","sourceRoot":"","sources":["../src/step-conditions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAuB5B,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,aAAa,CAAA;AAE7C;;;;;;;;GAQG;AACH,eAAO,MAAM,sBAAsB,sDAAsC,CAAA;AACzE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE3E;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB;;aAEjC,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE3E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,eAAe;IAC9B,wFAAwF;IACxF,QAAQ,EAAE,OAAO,CAAA;IACjB,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAA;CACjB;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS;IAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EAAE,GAC1C,eAAe,CAQjB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,oBAAoB,yFAK/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEvE;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAIxE;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,gBAAgB,GAAG,IAAI,GAAG,SAAS,EAC9C,KAAK,EAAE,eAAe,GACrB,OAAO,CAIT"}
@@ -0,0 +1,109 @@
1
+ import * as v from 'valibot';
2
+ // ---------------------------------------------------------------------------
3
+ // Per-step RUN CONDITIONS — the second axis on which a pipeline step can be
4
+ // conditional, beside the task-estimate gating in `stepGatingSchema`.
5
+ //
6
+ // The two answer different questions and neither can express the other. Estimate
7
+ // gating asks "is this task big enough to be worth the step", a judgement about
8
+ // SIZE that only exists once a `task-estimator` has run. A run condition asks
9
+ // "does this step apply to the kind of change this run makes at all", a fact about
10
+ // the SERVICES the run touches that is knowable before the first dispatch and can
11
+ // never be recovered from a score: a UI test on a task that changes no frontend is
12
+ // not a cheap test, it is a test of nothing.
13
+ //
14
+ // The first case is the tester pair. A pipeline that wants both `tester-ui` and
15
+ // `tester-api` should run the browser pass only where there is a UI in scope and
16
+ // the API pass only where there is a service behind it — which is what lets ONE
17
+ // build preset carry both testers and be right on a frontend task and on a backend
18
+ // task, instead of the two near-identical presets it used to take. (A task in BOTH
19
+ // scopes at once is what {@link RunServiceScope} would express; see the note there
20
+ // for why no board state produces one yet.)
21
+ // ---------------------------------------------------------------------------
22
+ /** The block `type` a service frame carries when it owns a rendered UI. */
23
+ export const FRONTEND_BLOCK_TYPE = 'frontend';
24
+ /**
25
+ * Which half of a run's service scope a step needs:
26
+ *
27
+ * - `frontend` — run only when the change touches a service declared as a frontend.
28
+ * - `backend` — run only when it touches a service that is NOT a frontend.
29
+ *
30
+ * A full-stack task (a frontend service plus an involved backend service, or vice versa) is in
31
+ * BOTH scopes, so a pipeline carrying both testers runs both on it.
32
+ */
33
+ export const stepServiceScopeSchema = v.picklist(['frontend', 'backend']);
34
+ /**
35
+ * A step's run condition: what has to be true of the run for this step to apply at all.
36
+ * Today the only axis is {@link stepServiceScopeSchema}; it is an OBJECT rather than a bare
37
+ * picklist so the next axis is a field beside it rather than a second per-step knob.
38
+ *
39
+ * Absent ⇒ unconditional, which is every step that does not declare one.
40
+ */
41
+ export const stepRunConditionSchema = v.object({
42
+ serviceScope: stepServiceScopeSchema,
43
+ });
44
+ /**
45
+ * Reduce the service frames a run may change — its own service plus the task's involved
46
+ * services — into the {@link RunServiceScope} the step conditions read.
47
+ *
48
+ * Takes the FRAMES rather than the block, because "what does this run change" is the ancestry
49
+ * walk plus the involved-service resolution, and both already happen in the engine. Frames are
50
+ * deduped by the caller; passing the same frame twice changes nothing here.
51
+ */
52
+ export function resolveRunServiceScope(frames) {
53
+ let frontend = false;
54
+ let backend = false;
55
+ for (const frame of frames) {
56
+ if (frame.type === FRONTEND_BLOCK_TYPE)
57
+ frontend = true;
58
+ else
59
+ backend = true;
60
+ }
61
+ return { frontend, backend };
62
+ }
63
+ /**
64
+ * Why a run step finished as `skipped` rather than running — the three axes that can skip one,
65
+ * as a member the SPA maps to translated copy rather than prose the backend composed:
66
+ *
67
+ * - `gated` — the step's estimate gate was not met (the task scored below its thresholds).
68
+ * - `condition` — the step's {@link stepRunConditionSchema} did not match the run's service
69
+ * scope. The step still carries the condition, so a reader wanting the specific
70
+ * sentence ("no frontend in scope") reads `serviceScope` off it; this says only
71
+ * which axis fired, so the two can never disagree about the scope.
72
+ * - `producer_skipped` — a COMPANION whose producer was itself skipped, so there is nothing for
73
+ * it to grade. Distinct from `gated` because the fix is different: the reader
74
+ * has to look at the producer, not at this step's own thresholds.
75
+ * - `run_complete` — an earlier step ENDED the run (a `bug-intake` fire that found nothing to
76
+ * adopt), so everything after it was closed out untouched. Nothing about THIS
77
+ * step decided it, which is why it cannot borrow any of the three above.
78
+ *
79
+ * PERSISTED and CLOSED, so retiring a member does not remove it from stored runs: read it with
80
+ * {@link isStepSkipReason} and render an unrecognised value as "skipped" rather than crashing or
81
+ * guessing onto a current member.
82
+ */
83
+ export const stepSkipReasonSchema = v.picklist([
84
+ 'gated',
85
+ 'condition',
86
+ 'producer_skipped',
87
+ 'run_complete',
88
+ ]);
89
+ /**
90
+ * Narrow a persisted `skipReason` to a member this build still knows, DERIVED from the picklist's
91
+ * own options so adding a member cannot leave this behind. A stored run may name a member since
92
+ * retired, and a browser may hold a bundle older than the member it reads.
93
+ */
94
+ export function isStepSkipReason(value) {
95
+ return (typeof value === 'string' && stepSkipReasonSchema.options.includes(value));
96
+ }
97
+ /**
98
+ * Whether a step carrying `condition` applies to a run of `scope`. An absent condition is
99
+ * unconditional; an unresolvable scope (see {@link RunServiceScope}) runs the step rather than
100
+ * silently dropping it.
101
+ */
102
+ export function stepConditionSatisfied(condition, scope) {
103
+ if (!condition)
104
+ return true;
105
+ if (!scope.frontend && !scope.backend)
106
+ return true;
107
+ return condition.serviceScope === 'frontend' ? scope.frontend : scope.backend;
108
+ }
109
+ //# sourceMappingURL=step-conditions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"step-conditions.js","sourceRoot":"","sources":["../src/step-conditions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,8EAA8E;AAC9E,4EAA4E;AAC5E,sEAAsE;AACtE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CAAC,CACjG,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,SAA8C,EAC9C,KAAsB;IAEtB,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAA;IAC3B,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAClD,OAAO,SAAS,CAAC,YAAY,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAA;AAC/E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/contracts",
3
- "version": "0.284.0",
3
+ "version": "0.286.0",
4
4
  "description": "Valibot wire contract shared between the Agent Architecture Board frontend and backend.",
5
5
  "repository": {
6
6
  "type": "git",