@cat-factory/contracts 0.29.0 → 0.30.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.
package/dist/events.d.ts CHANGED
@@ -5,6 +5,7 @@ import type { LlmCallActivity } from './observability.js';
5
5
  import type { RequirementReview } from './requirements.js';
6
6
  import type { ConsensusSession } from './consensus.js';
7
7
  import type { ClarityReview } from './clarity.js';
8
+ import type { KaizenGrading } from './kaizen.js';
8
9
  export type WorkspaceEvent =
9
10
  /**
10
11
  * A run advanced. Carries the updated instance and its server-rolled block, so
@@ -94,5 +95,15 @@ export type WorkspaceEvent =
94
95
  type: 'clarity';
95
96
  review: ClarityReview;
96
97
  at: number;
98
+ }
99
+ /**
100
+ * A Kaizen grading was scheduled, started, completed or failed. Carries the updated
101
+ * grading so an open run window reflects the scheduled→running→complete status live and
102
+ * the Kaizen screen folds in new history. Never surfaced on the board — run-details only.
103
+ */
104
+ | {
105
+ type: 'kaizen';
106
+ grading: KaizenGrading;
107
+ at: number;
97
108
  };
98
109
  //# sourceMappingURL=events.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAOjD,MAAM,MAAM,cAAc;AACxB;;;;GAIG;AACD;IAAE,IAAI,EAA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EAAE,MAAM,CAAA;CAAE;AAC9D;;;;GAIG;GACD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE;AACxD;;;;GAIG;GACD;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAA"}
package/dist/index.d.ts CHANGED
@@ -47,4 +47,5 @@ export * from './localModels.js';
47
47
  export * from './openrouter.js';
48
48
  export * from './sandbox.js';
49
49
  export * from './workspace-settings.js';
50
+ export * from './kaizen.js';
50
51
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,mBA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ACzB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,yBAAyB,CAAA;AACvC,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,oBAAoB,CAAA;AAClC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,oBAAoB,CAAA;AAClC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA;AAC5B,cAAc,yBAAyB,CAAA;AACvC,cAAc,eAAe,CAAA;AAC7B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA;AAChC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,yBAAyB,CAAA;AACvC,cAAc,aAAa,CAAA"}
package/dist/index.js CHANGED
@@ -47,4 +47,5 @@ export * from './localModels.js';
47
47
  export * from './openrouter.js';
48
48
  export * from './sandbox.js';
49
49
  export * from './workspace-settings.js';
50
+ export * from './kaizen.js';
50
51
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,uBAAuB,CAAA;AACrC,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,aAAa,CAAA;AAC3B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc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+ * - `scheduled`: queued at run completion, awaiting the background sweep.
5
+ * - `running`: the sweep picked it up and the grader LLM is analysing.
6
+ * - `complete`: the grade + recommendations are recorded.
7
+ * - `failed`: the grader call errored (telemetry missing, model unwired, parse
8
+ * failure); recorded with an `error` and never retried automatically.
9
+ */
10
+ export declare const kaizenGradingStatusSchema: v.PicklistSchema<["scheduled", "running", "complete", "failed"], undefined>;
11
+ export type KaizenGradingStatus = v.InferOutput<typeof kaizenGradingStatusSchema>;
12
+ /** A single Kaizen grading of one completed agent step. */
13
+ export declare const kaizenGradingSchema: v.ObjectSchema<{
14
+ readonly id: v.StringSchema<undefined>;
15
+ /** The run (execution) the graded step belongs to. */
16
+ readonly executionId: v.StringSchema<undefined>;
17
+ /** The board block the run targets — for linking back from the Kaizen screen. */
18
+ readonly blockId: v.StringSchema<undefined>;
19
+ /** Index of the graded step within the run's pipeline. */
20
+ readonly stepIndex: v.NumberSchema<undefined>;
21
+ /** The graded step's agent kind (e.g. `coder`, `architect`). */
22
+ readonly agentKind: v.StringSchema<undefined>;
23
+ /** The resolved model id the step ran on (e.g. `claude-opus-4-...`). */
24
+ readonly model: v.StringSchema<undefined>;
25
+ /** The graded step's prompt version (from the agents prompt-version registry). */
26
+ readonly promptVersion: v.NumberSchema<undefined>;
27
+ /** `agentKind|model|promptVersion` — the verified-combo key. */
28
+ readonly comboKey: v.StringSchema<undefined>;
29
+ readonly status: v.PicklistSchema<["scheduled", "running", "complete", "failed"], undefined>;
30
+ /** 1..5 once `complete` (5 = smooth/guided/efficient); null while pending/failed. */
31
+ readonly grade: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
32
+ /** The grader's prose summary of how the interaction went. Empty while pending. */
33
+ readonly summary: v.StringSchema<undefined>;
34
+ /** Actionable improvement recommendations. Empty array ⇒ nothing to improve. */
35
+ readonly recommendations: v.ArraySchema<v.StringSchema<undefined>, undefined>;
36
+ /** `provider:model` that produced the grade, for transparency; null in tests. */
37
+ readonly graderModel: v.NullableSchema<v.StringSchema<undefined>, undefined>;
38
+ /** Error message when `failed`, else null. */
39
+ readonly error: v.NullableSchema<v.StringSchema<undefined>, undefined>;
40
+ readonly createdAt: v.NumberSchema<undefined>;
41
+ readonly updatedAt: v.NumberSchema<undefined>;
42
+ }, undefined>;
43
+ export type KaizenGrading = v.InferOutput<typeof kaizenGradingSchema>;
44
+ /**
45
+ * A `(promptVersion, agentKind, model)` combo's verification progress. The combo
46
+ * earns a high grade each time a grading returns grade 4 or 5 with no recommendations;
47
+ * `consecutiveHighGrades` resets to 0 on anything lower. At VERIFICATION_STREAK it
48
+ * flips `verified` true and the engine stops scheduling gradings for it.
49
+ */
50
+ export declare const kaizenVerifiedComboSchema: v.ObjectSchema<{
51
+ /** `agentKind|model|promptVersion`. */
52
+ readonly comboKey: v.StringSchema<undefined>;
53
+ readonly agentKind: v.StringSchema<undefined>;
54
+ readonly model: v.StringSchema<undefined>;
55
+ readonly promptVersion: v.NumberSchema<undefined>;
56
+ /** Count of sequential high grades with no recommendations. */
57
+ readonly consecutiveHighGrades: v.NumberSchema<undefined>;
58
+ readonly verified: v.BooleanSchema<undefined>;
59
+ /** When the combo crossed the streak threshold, else null. */
60
+ readonly verifiedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
61
+ readonly updatedAt: v.NumberSchema<undefined>;
62
+ }, undefined>;
63
+ export type KaizenVerifiedCombo = v.InferOutput<typeof kaizenVerifiedComboSchema>;
64
+ /** The Kaizen screen payload: recent grading history + the verified-combo library. */
65
+ export declare const kaizenOverviewSchema: v.ObjectSchema<{
66
+ readonly gradings: v.ArraySchema<v.ObjectSchema<{
67
+ readonly id: v.StringSchema<undefined>;
68
+ /** The run (execution) the graded step belongs to. */
69
+ readonly executionId: v.StringSchema<undefined>;
70
+ /** The board block the run targets — for linking back from the Kaizen screen. */
71
+ readonly blockId: v.StringSchema<undefined>;
72
+ /** Index of the graded step within the run's pipeline. */
73
+ readonly stepIndex: v.NumberSchema<undefined>;
74
+ /** The graded step's agent kind (e.g. `coder`, `architect`). */
75
+ readonly agentKind: v.StringSchema<undefined>;
76
+ /** The resolved model id the step ran on (e.g. `claude-opus-4-...`). */
77
+ readonly model: v.StringSchema<undefined>;
78
+ /** The graded step's prompt version (from the agents prompt-version registry). */
79
+ readonly promptVersion: v.NumberSchema<undefined>;
80
+ /** `agentKind|model|promptVersion` — the verified-combo key. */
81
+ readonly comboKey: v.StringSchema<undefined>;
82
+ readonly status: v.PicklistSchema<["scheduled", "running", "complete", "failed"], undefined>;
83
+ /** 1..5 once `complete` (5 = smooth/guided/efficient); null while pending/failed. */
84
+ readonly grade: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
85
+ /** The grader's prose summary of how the interaction went. Empty while pending. */
86
+ readonly summary: v.StringSchema<undefined>;
87
+ /** Actionable improvement recommendations. Empty array ⇒ nothing to improve. */
88
+ readonly recommendations: v.ArraySchema<v.StringSchema<undefined>, undefined>;
89
+ /** `provider:model` that produced the grade, for transparency; null in tests. */
90
+ readonly graderModel: v.NullableSchema<v.StringSchema<undefined>, undefined>;
91
+ /** Error message when `failed`, else null. */
92
+ readonly error: v.NullableSchema<v.StringSchema<undefined>, undefined>;
93
+ readonly createdAt: v.NumberSchema<undefined>;
94
+ readonly updatedAt: v.NumberSchema<undefined>;
95
+ }, undefined>, undefined>;
96
+ readonly verified: v.ArraySchema<v.ObjectSchema<{
97
+ /** `agentKind|model|promptVersion`. */
98
+ readonly comboKey: v.StringSchema<undefined>;
99
+ readonly agentKind: v.StringSchema<undefined>;
100
+ readonly model: v.StringSchema<undefined>;
101
+ readonly promptVersion: v.NumberSchema<undefined>;
102
+ /** Count of sequential high grades with no recommendations. */
103
+ readonly consecutiveHighGrades: v.NumberSchema<undefined>;
104
+ readonly verified: v.BooleanSchema<undefined>;
105
+ /** When the combo crossed the streak threshold, else null. */
106
+ readonly verifiedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
107
+ readonly updatedAt: v.NumberSchema<undefined>;
108
+ }, undefined>, undefined>;
109
+ }, undefined>;
110
+ export type KaizenOverview = v.InferOutput<typeof kaizenOverviewSchema>;
111
+ /** The gradings recorded for a single run, for the run-window status surface. */
112
+ export declare const kaizenRunGradingsSchema: v.ObjectSchema<{
113
+ readonly gradings: v.ArraySchema<v.ObjectSchema<{
114
+ readonly id: v.StringSchema<undefined>;
115
+ /** The run (execution) the graded step belongs to. */
116
+ readonly executionId: v.StringSchema<undefined>;
117
+ /** The board block the run targets — for linking back from the Kaizen screen. */
118
+ readonly blockId: v.StringSchema<undefined>;
119
+ /** Index of the graded step within the run's pipeline. */
120
+ readonly stepIndex: v.NumberSchema<undefined>;
121
+ /** The graded step's agent kind (e.g. `coder`, `architect`). */
122
+ readonly agentKind: v.StringSchema<undefined>;
123
+ /** The resolved model id the step ran on (e.g. `claude-opus-4-...`). */
124
+ readonly model: v.StringSchema<undefined>;
125
+ /** The graded step's prompt version (from the agents prompt-version registry). */
126
+ readonly promptVersion: v.NumberSchema<undefined>;
127
+ /** `agentKind|model|promptVersion` — the verified-combo key. */
128
+ readonly comboKey: v.StringSchema<undefined>;
129
+ readonly status: v.PicklistSchema<["scheduled", "running", "complete", "failed"], undefined>;
130
+ /** 1..5 once `complete` (5 = smooth/guided/efficient); null while pending/failed. */
131
+ readonly grade: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
132
+ /** The grader's prose summary of how the interaction went. Empty while pending. */
133
+ readonly summary: v.StringSchema<undefined>;
134
+ /** Actionable improvement recommendations. Empty array ⇒ nothing to improve. */
135
+ readonly recommendations: v.ArraySchema<v.StringSchema<undefined>, undefined>;
136
+ /** `provider:model` that produced the grade, for transparency; null in tests. */
137
+ readonly graderModel: v.NullableSchema<v.StringSchema<undefined>, undefined>;
138
+ /** Error message when `failed`, else null. */
139
+ readonly error: v.NullableSchema<v.StringSchema<undefined>, undefined>;
140
+ readonly createdAt: v.NumberSchema<undefined>;
141
+ readonly updatedAt: v.NumberSchema<undefined>;
142
+ }, undefined>, undefined>;
143
+ }, undefined>;
144
+ export type KaizenRunGradings = v.InferOutput<typeof kaizenRunGradingsSchema>;
145
+ //# sourceMappingURL=kaizen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kaizen.d.ts","sourceRoot":"","sources":["../src/kaizen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAiB5B;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,6EAA6D,CAAA;AACnG,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAEjF,2DAA2D;AAC3D,eAAO,MAAM,mBAAmB;;IAE9B,sDAAsD;;IAEtD,iFAAiF;;IAEjF,0DAA0D;;IAE1D,gEAAgE;;IAEhE,wEAAwE;;IAExE,kFAAkF;;IAElF,gEAAgE;;;IAGhE,qFAAqF;;IAErF,mFAAmF;;IAEnF,gFAAgF;;IAEhF,iFAAiF;;IAEjF,8CAA8C;;;;aAI9C,CAAA;AACF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAErE;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;IACpC,uCAAuC;;;;;IAKvC,+DAA+D;;;IAG/D,8DAA8D;;;aAG9D,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAEjF,sFAAsF;AACtF,eAAO,MAAM,oBAAoB;;;QApD/B,sDAAsD;;QAEtD,iFAAiF;;QAEjF,0DAA0D;;QAE1D,gEAAgE;;QAEhE,wEAAwE;;QAExE,kFAAkF;;QAElF,gEAAgE;;;QAGhE,qFAAqF;;QAErF,mFAAmF;;QAEnF,gFAAgF;;QAEhF,iFAAiF;;QAEjF,8CAA8C;;;;;;QAc9C,uCAAuC;;;;;QAKvC,+DAA+D;;;QAG/D,8DAA8D;;;;aAU9D,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEvE,iFAAiF;AACjF,eAAO,MAAM,uBAAuB;;;QA3DlC,sDAAsD;;QAEtD,iFAAiF;;QAEjF,0DAA0D;;QAE1D,gEAAgE;;QAEhE,wEAAwE;;QAExE,kFAAkF;;QAElF,gEAAgE;;;QAGhE,qFAAqF;;QAErF,mFAAmF;;QAEnF,gFAAgF;;QAEhF,iFAAiF;;QAEjF,8CAA8C;;;;;aAsC9C,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
package/dist/kaizen.js ADDED
@@ -0,0 +1,84 @@
1
+ import * as v from 'valibot';
2
+ // ---------------------------------------------------------------------------
3
+ // Kaizen wire contracts. The Kaizen agent is a continuous-improvement reviewer
4
+ // that runs AFTER an agent step finishes (it is never a pipeline-builder step).
5
+ // It reads the context + prompt the step was given and the per-call interaction
6
+ // telemetry, then judges whether the interaction was smooth / guided / efficient
7
+ // or confused / chaotic, returning a 1..5 grade plus improvement recommendations.
8
+ //
9
+ // A grading targets one completed step, identified by its `(promptVersion,
10
+ // agentKind, model)` combo. When a combo earns a high grade (4 or 5) with no
11
+ // recommendations VERIFICATION_STREAK (5) times in a row it is marked VERIFIED
12
+ // and is no longer graded. Both the grading history and the verified combos are
13
+ // persisted (D1 ⇄ Drizzle parity) and surfaced on the Kaizen screen; per-run
14
+ // grading status is surfaced inside the run window (never on the board).
15
+ // ---------------------------------------------------------------------------
16
+ /**
17
+ * Lifecycle of a single grading:
18
+ * - `scheduled`: queued at run completion, awaiting the background sweep.
19
+ * - `running`: the sweep picked it up and the grader LLM is analysing.
20
+ * - `complete`: the grade + recommendations are recorded.
21
+ * - `failed`: the grader call errored (telemetry missing, model unwired, parse
22
+ * failure); recorded with an `error` and never retried automatically.
23
+ */
24
+ export const kaizenGradingStatusSchema = v.picklist(['scheduled', 'running', 'complete', 'failed']);
25
+ /** A single Kaizen grading of one completed agent step. */
26
+ export const kaizenGradingSchema = v.object({
27
+ id: v.string(),
28
+ /** The run (execution) the graded step belongs to. */
29
+ executionId: v.string(),
30
+ /** The board block the run targets — for linking back from the Kaizen screen. */
31
+ blockId: v.string(),
32
+ /** Index of the graded step within the run's pipeline. */
33
+ stepIndex: v.number(),
34
+ /** The graded step's agent kind (e.g. `coder`, `architect`). */
35
+ agentKind: v.string(),
36
+ /** The resolved model id the step ran on (e.g. `claude-opus-4-...`). */
37
+ model: v.string(),
38
+ /** The graded step's prompt version (from the agents prompt-version registry). */
39
+ promptVersion: v.number(),
40
+ /** `agentKind|model|promptVersion` — the verified-combo key. */
41
+ comboKey: v.string(),
42
+ status: kaizenGradingStatusSchema,
43
+ /** 1..5 once `complete` (5 = smooth/guided/efficient); null while pending/failed. */
44
+ grade: v.nullable(v.number()),
45
+ /** The grader's prose summary of how the interaction went. Empty while pending. */
46
+ summary: v.string(),
47
+ /** Actionable improvement recommendations. Empty array ⇒ nothing to improve. */
48
+ recommendations: v.array(v.string()),
49
+ /** `provider:model` that produced the grade, for transparency; null in tests. */
50
+ graderModel: v.nullable(v.string()),
51
+ /** Error message when `failed`, else null. */
52
+ error: v.nullable(v.string()),
53
+ createdAt: v.number(),
54
+ updatedAt: v.number(),
55
+ });
56
+ /**
57
+ * A `(promptVersion, agentKind, model)` combo's verification progress. The combo
58
+ * earns a high grade each time a grading returns grade 4 or 5 with no recommendations;
59
+ * `consecutiveHighGrades` resets to 0 on anything lower. At VERIFICATION_STREAK it
60
+ * flips `verified` true and the engine stops scheduling gradings for it.
61
+ */
62
+ export const kaizenVerifiedComboSchema = v.object({
63
+ /** `agentKind|model|promptVersion`. */
64
+ comboKey: v.string(),
65
+ agentKind: v.string(),
66
+ model: v.string(),
67
+ promptVersion: v.number(),
68
+ /** Count of sequential high grades with no recommendations. */
69
+ consecutiveHighGrades: v.number(),
70
+ verified: v.boolean(),
71
+ /** When the combo crossed the streak threshold, else null. */
72
+ verifiedAt: v.nullable(v.number()),
73
+ updatedAt: v.number(),
74
+ });
75
+ /** The Kaizen screen payload: recent grading history + the verified-combo library. */
76
+ export const kaizenOverviewSchema = v.object({
77
+ gradings: v.array(kaizenGradingSchema),
78
+ verified: v.array(kaizenVerifiedComboSchema),
79
+ });
80
+ /** The gradings recorded for a single run, for the run-window status surface. */
81
+ export const kaizenRunGradingsSchema = v.object({
82
+ gradings: v.array(kaizenGradingSchema),
83
+ });
84
+ //# sourceMappingURL=kaizen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kaizen.js","sourceRoot":"","sources":["../src/kaizen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,8EAA8E;AAC9E,+EAA+E;AAC/E,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,kFAAkF;AAClF,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,+EAA+E;AAC/E,gFAAgF;AAChF,6EAA6E;AAC7E,yEAAyE;AACzE,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAA;AAGnG,2DAA2D;AAC3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,sDAAsD;IACtD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,iFAAiF;IACjF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,0DAA0D;IAC1D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,gEAAgE;IAChE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,wEAAwE;IACxE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,kFAAkF;IAClF,aAAa,EAAE,CA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AAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,yBAAyB,CAAC;CAC7C,CAAC,CAAA;AAGF,iFAAiF;AACjF,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;CACvC,CAAC,CAAA"}
@@ -579,6 +579,7 @@ export declare const workspaceSnapshotSchema: v.ObjectSchema<{
579
579
  readonly taskLimitShared: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
580
580
  readonly taskLimitPerType: v.NullableSchema<v.RecordSchema<v.PicklistSchema<["feature", "bug", "document", "spike"], undefined>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>, undefined>;
581
581
  readonly storeAgentContext: v.BooleanSchema<undefined>;
582
+ readonly kaizenEnabled: v.BooleanSchema<undefined>;
582
583
  readonly spendCurrency: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.ToUpperCaseAction, v.LengthAction<string, 3, undefined>, v.RegexAction<string, "currency must be a 3-letter ISO 4217 code">]>, undefined>;
583
584
  readonly spendMonthlyLimit: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
584
585
  }, undefined>, undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../src/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAyB5B,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKlC;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;IAEH;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;;;;;;;;IAEH;;;;;;OAMG;;;;;;;;;;;;;IAEH;;;;;OAKG;;;;;;;;;IAEH;;;;;;;;OAQG;;;;;IAOH;;;OAGG;;;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;IAEH;;;OAGG;;;;;;;;IAEH;;;;;OAKG;;;;;;;;;;;;;;;;;;;;;;;;IAGH;;;;OAIG;;;;;;;;;;;IAEH;;;;;;OAMG;;;;;;;;;;;;;aAEH,CAAA;AACF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,uBAAuB,CAAC,CAAA"}
@@ -32,6 +32,12 @@ export declare const workspaceSettingsSchema: v.ObjectSchema<{
32
32
  * suppressed when the deployment disables prompt recording (`LLM_RECORD_PROMPTS`).
33
33
  */
34
34
  readonly storeAgentContext: v.BooleanSchema<undefined>;
35
+ /**
36
+ * Whether the Kaizen agent grades agent steps after each run completes and
37
+ * recommends prompt/model improvements. On by default. When off, no gradings are
38
+ * scheduled (existing history + verified combos are retained, just not extended).
39
+ */
40
+ readonly kaizenEnabled: v.BooleanSchema<undefined>;
35
41
  /** Spend budget currency (ISO 4217). Null ⇒ the built-in default (`EUR`). */
36
42
  readonly spendCurrency: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.ToUpperCaseAction, v.LengthAction<string, 3, undefined>, v.RegexAction<string, "currency must be a 3-letter ISO 4217 code">]>, undefined>;
37
43
  /**
@@ -55,6 +61,7 @@ export declare const updateWorkspaceSettingsSchema: v.ObjectSchema<{
55
61
  readonly taskLimitShared: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>, undefined>;
56
62
  readonly taskLimitPerType: v.OptionalSchema<v.NullableSchema<v.RecordSchema<v.PicklistSchema<["feature", "bug", "document", "spike"], undefined>, v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>, undefined>, undefined>;
57
63
  readonly storeAgentContext: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
64
+ readonly kaizenEnabled: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
58
65
  readonly spendCurrency: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.ToUpperCaseAction, v.LengthAction<string, 3, undefined>, v.RegexAction<string, "currency must be a 3-letter ISO 4217 code">]>, undefined>, undefined>;
59
66
  readonly spendMonthlyLimit: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
60
67
  }, undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-settings.d.ts","sourceRoot":"","sources":["../src/workspace-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAW5B;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,4DAA4C,CAAA;AAC5E,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAIrE,6FAA6F;AAC7F,eAAO,MAAM,sBAAsB,gRAA8C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;aAWxC,CAAA;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,6BAA6B,CAAC,CAAA"}
@@ -49,6 +49,12 @@ export const workspaceSettingsSchema = v.object({
49
49
  * suppressed when the deployment disables prompt recording (`LLM_RECORD_PROMPTS`).
50
50
  */
51
51
  storeAgentContext: v.boolean(),
52
+ /**
53
+ * Whether the Kaizen agent grades agent steps after each run completes and
54
+ * recommends prompt/model improvements. On by default. When off, no gradings are
55
+ * scheduled (existing history + verified combos are retained, just not extended).
56
+ */
57
+ kaizenEnabled: v.boolean(),
52
58
  /** Spend budget currency (ISO 4217). Null ⇒ the built-in default (`EUR`). */
53
59
  spendCurrency: v.nullable(spendCurrencySchema),
54
60
  /**
@@ -71,6 +77,7 @@ export const updateWorkspaceSettingsSchema = v.object({
71
77
  taskLimitShared: v.optional(v.nullable(limitSchema)),
72
78
  taskLimitPerType: v.optional(v.nullable(taskLimitPerTypeSchema)),
73
79
  storeAgentContext: v.optional(v.boolean()),
80
+ kaizenEnabled: v.optional(v.boolean()),
74
81
  spendCurrency: v.optional(v.nullable(spendCurrencySchema)),
75
82
  spendMonthlyLimit: v.optional(v.nullable(v.pipe(v.number(), v.minValue(0)))),
76
83
  });
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-settings.js","sourceRoot":"","sources":["../src/workspace-settings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AAEtD,8EAA8E;AAC9E,iFAAiF;AACjF,8EAA8E;AAC9E,kFAAkF;AAClF,oFAAoF;AACpF,gFAAgF;AAChF,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAA;AAG5E,MAAM,WAAW,GAAG,CAAC,CAA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C,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IACtC,aAAa,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IAC1D,iBAAiB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC7E,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cat-factory/contracts",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "description": "Valibot wire contract shared between the Agent Architecture Board frontend and backend.",
5
5
  "repository": {
6
6
  "type": "git",