@cat-factory/contracts 0.6.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 (166) hide show
  1. package/LICENSE +21 -0
  2. package/dist/accounts.d.ts +103 -0
  3. package/dist/accounts.d.ts.map +1 -0
  4. package/dist/accounts.js +102 -0
  5. package/dist/accounts.js.map +1 -0
  6. package/dist/agent-config.d.ts +77 -0
  7. package/dist/agent-config.d.ts.map +1 -0
  8. package/dist/agent-config.js +78 -0
  9. package/dist/agent-config.js.map +1 -0
  10. package/dist/api-keys.d.ts +44 -0
  11. package/dist/api-keys.d.ts.map +1 -0
  12. package/dist/api-keys.js +49 -0
  13. package/dist/api-keys.js.map +1 -0
  14. package/dist/auth.d.ts +24 -0
  15. package/dist/auth.d.ts.map +1 -0
  16. package/dist/auth.js +15 -0
  17. package/dist/auth.js.map +1 -0
  18. package/dist/board-scan.d.ts +89 -0
  19. package/dist/board-scan.d.ts.map +1 -0
  20. package/dist/board-scan.js +122 -0
  21. package/dist/board-scan.js.map +1 -0
  22. package/dist/bootstrap.d.ts +168 -0
  23. package/dist/bootstrap.d.ts.map +1 -0
  24. package/dist/bootstrap.js +148 -0
  25. package/dist/bootstrap.js.map +1 -0
  26. package/dist/clarity.d.ts +75 -0
  27. package/dist/clarity.d.ts.map +1 -0
  28. package/dist/clarity.js +66 -0
  29. package/dist/clarity.js.map +1 -0
  30. package/dist/companion.d.ts +32 -0
  31. package/dist/companion.d.ts.map +1 -0
  32. package/dist/companion.js +43 -0
  33. package/dist/companion.js.map +1 -0
  34. package/dist/consensus.d.ts +195 -0
  35. package/dist/consensus.d.ts.map +1 -0
  36. package/dist/consensus.js +164 -0
  37. package/dist/consensus.js.map +1 -0
  38. package/dist/documents.d.ts +197 -0
  39. package/dist/documents.d.ts.map +1 -0
  40. package/dist/documents.js +161 -0
  41. package/dist/documents.js.map +1 -0
  42. package/dist/entities.d.ts +1691 -0
  43. package/dist/entities.d.ts.map +1 -0
  44. package/dist/entities.js +853 -0
  45. package/dist/entities.js.map +1 -0
  46. package/dist/environments.d.ts +426 -0
  47. package/dist/environments.d.ts.map +1 -0
  48. package/dist/environments.js +190 -0
  49. package/dist/environments.js.map +1 -0
  50. package/dist/events.d.ts +98 -0
  51. package/dist/events.d.ts.map +1 -0
  52. package/dist/events.js +2 -0
  53. package/dist/events.js.map +1 -0
  54. package/dist/fragment-library.d.ts +123 -0
  55. package/dist/fragment-library.d.ts.map +1 -0
  56. package/dist/fragment-library.js +88 -0
  57. package/dist/fragment-library.js.map +1 -0
  58. package/dist/github.d.ts +215 -0
  59. package/dist/github.d.ts.map +1 -0
  60. package/dist/github.js +204 -0
  61. package/dist/github.js.map +1 -0
  62. package/dist/index.d.ts +41 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.js +41 -0
  65. package/dist/index.js.map +1 -0
  66. package/dist/iteration-cap.d.ts +17 -0
  67. package/dist/iteration-cap.d.ts.map +1 -0
  68. package/dist/iteration-cap.js +25 -0
  69. package/dist/iteration-cap.js.map +1 -0
  70. package/dist/localModels.d.ts +54 -0
  71. package/dist/localModels.d.ts.map +1 -0
  72. package/dist/localModels.js +79 -0
  73. package/dist/localModels.js.map +1 -0
  74. package/dist/merge.d.ts +106 -0
  75. package/dist/merge.d.ts.map +1 -0
  76. package/dist/merge.js +129 -0
  77. package/dist/merge.js.map +1 -0
  78. package/dist/model-defaults.d.ts +23 -0
  79. package/dist/model-defaults.d.ts.map +1 -0
  80. package/dist/model-defaults.js +34 -0
  81. package/dist/model-defaults.js.map +1 -0
  82. package/dist/notifications.d.ts +136 -0
  83. package/dist/notifications.d.ts.map +1 -0
  84. package/dist/notifications.js +125 -0
  85. package/dist/notifications.js.map +1 -0
  86. package/dist/observability.d.ts +271 -0
  87. package/dist/observability.d.ts.map +1 -0
  88. package/dist/observability.js +152 -0
  89. package/dist/observability.js.map +1 -0
  90. package/dist/personal-subscriptions.d.ts +66 -0
  91. package/dist/personal-subscriptions.d.ts.map +1 -0
  92. package/dist/personal-subscriptions.js +70 -0
  93. package/dist/personal-subscriptions.js.map +1 -0
  94. package/dist/primitives.d.ts +57 -0
  95. package/dist/primitives.d.ts.map +1 -0
  96. package/dist/primitives.js +66 -0
  97. package/dist/primitives.js.map +1 -0
  98. package/dist/provisioning.d.ts +46 -0
  99. package/dist/provisioning.d.ts.map +1 -0
  100. package/dist/provisioning.js +107 -0
  101. package/dist/provisioning.js.map +1 -0
  102. package/dist/recurring.d.ts +117 -0
  103. package/dist/recurring.d.ts.map +1 -0
  104. package/dist/recurring.js +99 -0
  105. package/dist/recurring.js.map +1 -0
  106. package/dist/release.d.ts +60 -0
  107. package/dist/release.d.ts.map +1 -0
  108. package/dist/release.js +75 -0
  109. package/dist/release.js.map +1 -0
  110. package/dist/requests.d.ts +451 -0
  111. package/dist/requests.d.ts.map +1 -0
  112. package/dist/requests.js +231 -0
  113. package/dist/requests.js.map +1 -0
  114. package/dist/requirements.d.ts +127 -0
  115. package/dist/requirements.d.ts.map +1 -0
  116. package/dist/requirements.js +137 -0
  117. package/dist/requirements.js.map +1 -0
  118. package/dist/runners.d.ts +387 -0
  119. package/dist/runners.d.ts.map +1 -0
  120. package/dist/runners.js +117 -0
  121. package/dist/runners.js.map +1 -0
  122. package/dist/sandbox.d.ts +300 -0
  123. package/dist/sandbox.d.ts.map +1 -0
  124. package/dist/sandbox.js +243 -0
  125. package/dist/sandbox.js.map +1 -0
  126. package/dist/service-fragment-defaults.d.ts +16 -0
  127. package/dist/service-fragment-defaults.d.ts.map +1 -0
  128. package/dist/service-fragment-defaults.js +23 -0
  129. package/dist/service-fragment-defaults.js.map +1 -0
  130. package/dist/services.d.ts +81 -0
  131. package/dist/services.d.ts.map +1 -0
  132. package/dist/services.js +77 -0
  133. package/dist/services.js.map +1 -0
  134. package/dist/slack.d.ts +104 -0
  135. package/dist/slack.d.ts.map +1 -0
  136. package/dist/slack.js +98 -0
  137. package/dist/slack.js.map +1 -0
  138. package/dist/snapshot.d.ts +522 -0
  139. package/dist/snapshot.d.ts.map +1 -0
  140. package/dist/snapshot.js +104 -0
  141. package/dist/snapshot.js.map +1 -0
  142. package/dist/spec.d.ts +174 -0
  143. package/dist/spec.d.ts.map +1 -0
  144. package/dist/spec.js +173 -0
  145. package/dist/spec.js.map +1 -0
  146. package/dist/tasks.d.ts +150 -0
  147. package/dist/tasks.d.ts.map +1 -0
  148. package/dist/tasks.js +146 -0
  149. package/dist/tasks.js.map +1 -0
  150. package/dist/testing.d.ts +67 -0
  151. package/dist/testing.d.ts.map +1 -0
  152. package/dist/testing.js +64 -0
  153. package/dist/testing.js.map +1 -0
  154. package/dist/tracker.d.ts +18 -0
  155. package/dist/tracker.d.ts.map +1 -0
  156. package/dist/tracker.js +24 -0
  157. package/dist/tracker.js.map +1 -0
  158. package/dist/vendor-credentials.d.ts +37 -0
  159. package/dist/vendor-credentials.d.ts.map +1 -0
  160. package/dist/vendor-credentials.js +40 -0
  161. package/dist/vendor-credentials.js.map +1 -0
  162. package/dist/workspace-settings.d.ts +36 -0
  163. package/dist/workspace-settings.d.ts.map +1 -0
  164. package/dist/workspace-settings.js +41 -0
  165. package/dist/workspace-settings.js.map +1 -0
  166. package/package.json +31 -0
@@ -0,0 +1,300 @@
1
+ import * as v from 'valibot';
2
+ /** Whether a prompt version is a read-only shipped baseline or a stored, editable candidate. */
3
+ export declare const sandboxPromptOriginSchema: v.PicklistSchema<["baseline", "candidate"], undefined>;
4
+ export type SandboxPromptOrigin = v.InferOutput<typeof sandboxPromptOriginSchema>;
5
+ /**
6
+ * One version of a system prompt under test. A `candidate` is a stored, immutable
7
+ * row in a lineage: cloning a baseline creates version 1, and each save appends a
8
+ * new version with `version = parent.version + 1` sharing the lineage's first id as
9
+ * its root. `baseline` rows are never persisted — the management API synthesizes
10
+ * them from the live shipped prompts so they always reflect current source.
11
+ */
12
+ export declare const sandboxPromptVersionSchema: v.ObjectSchema<{
13
+ readonly id: v.StringSchema<undefined>;
14
+ /** The lineage this version belongs to (the id of its v1); groups versions in the UI. */
15
+ readonly lineageId: v.StringSchema<undefined>;
16
+ /** The agent kind this prompt drives (`coder`, `reviewer`, `requirements-review`, …). */
17
+ readonly agentKind: v.StringSchema<undefined>;
18
+ /** Human label for the lineage (defaults to the agent kind on first clone). */
19
+ readonly name: v.StringSchema<undefined>;
20
+ readonly origin: v.PicklistSchema<["baseline", "candidate"], undefined>;
21
+ /** The system prompt text this version supplies (overrides the shipped role prompt). */
22
+ readonly systemText: v.StringSchema<undefined>;
23
+ /** The shipped baseline id this lineage derives from (e.g. a `PROMPT_VERSIONS` id), if any. */
24
+ readonly basePromptId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
25
+ /** Monotonic version within the lineage; baselines are always 0. */
26
+ readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
27
+ /** The version this one was saved from (clone source / previous edit); null for v1. */
28
+ readonly parentId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
29
+ /** Freeform labels for grouping/filtering candidate versions. */
30
+ readonly labels: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 40, undefined>]>, undefined>;
31
+ readonly createdAt: v.NumberSchema<undefined>;
32
+ readonly createdBy: v.NullableSchema<v.StringSchema<undefined>, undefined>;
33
+ /** Soft-archive marker; archived versions are hidden from the default listing. */
34
+ readonly archivedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
35
+ }, undefined>;
36
+ export type SandboxPromptVersion = v.InferOutput<typeof sandboxPromptVersionSchema>;
37
+ /**
38
+ * The kind of starting point a fixture supplies. Inline kinds carry their whole
39
+ * input in `payload`; repo kinds point at a seed commit in the fixture repo and the
40
+ * agent works on an ephemeral branch off it.
41
+ */
42
+ export declare const sandboxFixtureKindSchema: v.PicklistSchema<["requirements", "architecture", "code-review", "repo-feature", "repo-bug"], undefined>;
43
+ export type SandboxFixtureKind = v.InferOutput<typeof sandboxFixtureKindSchema>;
44
+ /** A pinned starting point in the dedicated fixture repo for a container-agent fixture. */
45
+ export declare const sandboxRepoRefSchema: v.ObjectSchema<{
46
+ readonly owner: v.StringSchema<undefined>;
47
+ readonly name: v.StringSchema<undefined>;
48
+ /** A tag/branch/commit naming the reproducible seed; resolved to a SHA at dispatch. */
49
+ readonly seedRef: v.StringSchema<undefined>;
50
+ }, undefined>;
51
+ export type SandboxRepoRef = v.InferOutput<typeof sandboxRepoRefSchema>;
52
+ /** Fixture kinds whose starting point is a repo seed (vs. an inline payload). */
53
+ export declare const SANDBOX_REPO_FIXTURE_KINDS: readonly ['repo-feature', 'repo-bug'];
54
+ /**
55
+ * The optional objective check a fixture declares, used alongside the LLM judge.
56
+ * `tests` runs a hidden command against the agent's produced branch (pass/fail);
57
+ * `findings` matches the candidate output against a set of planted expected findings.
58
+ */
59
+ export declare const sandboxFixtureObjectiveSchema: v.VariantSchema<"kind", [v.ObjectSchema<{
60
+ readonly kind: v.LiteralSchema<"tests", undefined>;
61
+ /** Shell command run against the produced branch; exit 0 = pass. */
62
+ readonly testCmd: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
63
+ }, undefined>, v.ObjectSchema<{
64
+ readonly kind: v.LiteralSchema<"findings", undefined>;
65
+ /** The genuine issues a good output should surface (matched for precision/recall). */
66
+ readonly expectedFindings: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>, undefined>;
67
+ }, undefined>], undefined>;
68
+ export type SandboxFixtureObjective = v.InferOutput<typeof sandboxFixtureObjectiveSchema>;
69
+ export declare const sandboxFixtureSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
70
+ readonly id: v.StringSchema<undefined>;
71
+ readonly kind: v.PicklistSchema<["requirements", "architecture", "code-review", "repo-feature", "repo-bug"], undefined>;
72
+ readonly name: v.StringSchema<undefined>;
73
+ /** Inline input for prompt-only fixtures (the synthesized agent run context); null for repo fixtures. */
74
+ readonly payload: v.NullableSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
75
+ /** Seed for container fixtures; null for inline fixtures. */
76
+ readonly repoRef: v.NullableSchema<v.ObjectSchema<{
77
+ readonly owner: v.StringSchema<undefined>;
78
+ readonly name: v.StringSchema<undefined>;
79
+ /** A tag/branch/commit naming the reproducible seed; resolved to a SHA at dispatch. */
80
+ readonly seedRef: v.StringSchema<undefined>;
81
+ }, undefined>, undefined>;
82
+ /** Optional objective check; null when only the LLM judge grades this fixture. */
83
+ readonly objective: v.NullableSchema<v.VariantSchema<"kind", [v.ObjectSchema<{
84
+ readonly kind: v.LiteralSchema<"tests", undefined>;
85
+ /** Shell command run against the produced branch; exit 0 = pass. */
86
+ readonly testCmd: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
87
+ }, undefined>, v.ObjectSchema<{
88
+ readonly kind: v.LiteralSchema<"findings", undefined>;
89
+ /** The genuine issues a good output should surface (matched for precision/recall). */
90
+ readonly expectedFindings: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>, undefined>;
91
+ }, undefined>], undefined>, undefined>;
92
+ /** `builtin` fixtures are seeded from code; `custom` are workspace-authored. */
93
+ readonly origin: v.PicklistSchema<["builtin", "custom"], undefined>;
94
+ readonly createdAt: v.NumberSchema<undefined>;
95
+ }, undefined>, v.CheckAction<{
96
+ id: string;
97
+ kind: "architecture" | "code-review" | "repo-bug" | "repo-feature" | "requirements";
98
+ name: string;
99
+ payload: {
100
+ [x: string]: unknown;
101
+ } | null;
102
+ repoRef: {
103
+ owner: string;
104
+ name: string;
105
+ seedRef: string;
106
+ } | null;
107
+ objective: {
108
+ kind: "tests";
109
+ testCmd: string;
110
+ } | {
111
+ kind: "findings";
112
+ expectedFindings: string[];
113
+ } | null;
114
+ origin: "builtin" | "custom";
115
+ createdAt: number;
116
+ }, "Repo fixtures (repo-feature/repo-bug) require a repoRef and no payload; inline fixtures require a payload and no repoRef">]>;
117
+ export type SandboxFixture = v.InferOutput<typeof sandboxFixtureSchema>;
118
+ export declare const sandboxExperimentStatusSchema: v.PicklistSchema<["draft", "running", "done", "failed"], undefined>;
119
+ export type SandboxExperimentStatus = v.InferOutput<typeof sandboxExperimentStatusSchema>;
120
+ /** The grid an experiment expands: every (prompt version × model × fixture) is one cell. */
121
+ export declare const sandboxMatrixSchema: v.ObjectSchema<{
122
+ readonly promptVersionIds: v.ArraySchema<v.StringSchema<undefined>, undefined>;
123
+ /** Model catalog ids (e.g. `anthropic:claude-opus-4-8`). */
124
+ readonly models: v.ArraySchema<v.StringSchema<undefined>, undefined>;
125
+ readonly fixtureIds: v.ArraySchema<v.StringSchema<undefined>, undefined>;
126
+ }, undefined>;
127
+ export type SandboxMatrix = v.InferOutput<typeof sandboxMatrixSchema>;
128
+ export declare const sandboxExperimentSchema: v.ObjectSchema<{
129
+ readonly id: v.StringSchema<undefined>;
130
+ readonly name: v.StringSchema<undefined>;
131
+ /** The single agent kind every cell of this experiment exercises. */
132
+ readonly agentKind: v.StringSchema<undefined>;
133
+ /** Model catalog id of the judge (defaults to the latest Claude). */
134
+ readonly judgeModel: v.StringSchema<undefined>;
135
+ /** How many times each cell is run, to expose model nondeterminism (variance). */
136
+ readonly repeats: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>]>;
137
+ readonly status: v.PicklistSchema<["draft", "running", "done", "failed"], undefined>;
138
+ readonly matrix: v.ObjectSchema<{
139
+ readonly promptVersionIds: v.ArraySchema<v.StringSchema<undefined>, undefined>;
140
+ /** Model catalog ids (e.g. `anthropic:claude-opus-4-8`). */
141
+ readonly models: v.ArraySchema<v.StringSchema<undefined>, undefined>;
142
+ readonly fixtureIds: v.ArraySchema<v.StringSchema<undefined>, undefined>;
143
+ }, undefined>;
144
+ /** Optional hard token budget for the whole experiment; null = uncapped. */
145
+ readonly budgetTokens: v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
146
+ readonly createdAt: v.NumberSchema<undefined>;
147
+ readonly createdBy: v.NullableSchema<v.StringSchema<undefined>, undefined>;
148
+ }, undefined>;
149
+ export type SandboxExperiment = v.InferOutput<typeof sandboxExperimentSchema>;
150
+ export declare const sandboxRunStatusSchema: v.PicklistSchema<["queued", "running", "done", "failed"], undefined>;
151
+ export type SandboxRunStatus = v.InferOutput<typeof sandboxRunStatusSchema>;
152
+ export declare const sandboxTokenUsageSchema: v.ObjectSchema<{
153
+ readonly inputTokens: v.NumberSchema<undefined>;
154
+ readonly outputTokens: v.NumberSchema<undefined>;
155
+ }, undefined>;
156
+ export type SandboxTokenUsage = v.InferOutput<typeof sandboxTokenUsageSchema>;
157
+ export declare const sandboxRunSchema: v.ObjectSchema<{
158
+ readonly id: v.StringSchema<undefined>;
159
+ readonly experimentId: v.StringSchema<undefined>;
160
+ readonly promptVersionId: v.StringSchema<undefined>;
161
+ /** The exact model catalog id this cell ran (frozen from the matrix). */
162
+ readonly model: v.StringSchema<undefined>;
163
+ readonly fixtureId: v.StringSchema<undefined>;
164
+ /** 0-based repeat index within the cell. */
165
+ readonly repeatIndex: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
166
+ readonly status: v.PicklistSchema<["queued", "running", "done", "failed"], undefined>;
167
+ /** The agent's captured output (prose, JSON, or a rendered diff). */
168
+ readonly outputText: v.NullableSchema<v.StringSchema<undefined>, undefined>;
169
+ readonly usage: v.NullableSchema<v.ObjectSchema<{
170
+ readonly inputTokens: v.NumberSchema<undefined>;
171
+ readonly outputTokens: v.NumberSchema<undefined>;
172
+ }, undefined>, undefined>;
173
+ readonly latencyMs: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
174
+ /** Ephemeral work branch for container cells; null for inline cells. */
175
+ readonly branch: v.NullableSchema<v.StringSchema<undefined>, undefined>;
176
+ readonly prUrl: v.NullableSchema<v.StringSchema<undefined>, undefined>;
177
+ /** Captured diff for container cells (truncated by the harness). */
178
+ readonly diff: v.NullableSchema<v.StringSchema<undefined>, undefined>;
179
+ readonly error: v.NullableSchema<v.StringSchema<undefined>, undefined>;
180
+ /** Resolved fixture seed commit, pinned at dispatch for reproducibility. */
181
+ readonly seedSha: v.NullableSchema<v.StringSchema<undefined>, undefined>;
182
+ /** Frozen `name@vN` label of the prompt version this cell ran. */
183
+ readonly promptLabel: v.StringSchema<undefined>;
184
+ readonly startedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
185
+ readonly finishedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
186
+ }, undefined>;
187
+ export type SandboxRun = v.InferOutput<typeof sandboxRunSchema>;
188
+ /** One rubric dimension's judged score (1–5) with the judge's rationale. */
189
+ export declare const sandboxGradeDimensionSchema: v.ObjectSchema<{
190
+ readonly key: v.StringSchema<undefined>;
191
+ readonly score: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 5, undefined>]>;
192
+ readonly rationale: v.StringSchema<undefined>;
193
+ }, undefined>;
194
+ export type SandboxGradeDimension = v.InferOutput<typeof sandboxGradeDimensionSchema>;
195
+ /** The objective check's outcome, recorded alongside (never blended into) the rubric grade. */
196
+ export declare const sandboxObjectiveResultSchema: v.ObjectSchema<{
197
+ readonly kind: v.PicklistSchema<["tests", "findings"], undefined>;
198
+ readonly pass: v.BooleanSchema<undefined>;
199
+ readonly detail: v.StringSchema<undefined>;
200
+ }, undefined>;
201
+ export type SandboxObjectiveResult = v.InferOutput<typeof sandboxObjectiveResultSchema>;
202
+ export declare const sandboxGradeSchema: v.ObjectSchema<{
203
+ readonly id: v.StringSchema<undefined>;
204
+ readonly runId: v.StringSchema<undefined>;
205
+ /** Model catalog id of the judge that produced this grade. */
206
+ readonly judgeModel: v.StringSchema<undefined>;
207
+ readonly scores: v.ArraySchema<v.ObjectSchema<{
208
+ readonly key: v.StringSchema<undefined>;
209
+ readonly score: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 5, undefined>]>;
210
+ readonly rationale: v.StringSchema<undefined>;
211
+ }, undefined>, undefined>;
212
+ /** Weighted mean of the dimension scores using the task rubric weights. */
213
+ readonly weightedTotal: v.NumberSchema<undefined>;
214
+ /** Objective signal when the fixture declared one; null otherwise. */
215
+ readonly objective: v.NullableSchema<v.ObjectSchema<{
216
+ readonly kind: v.PicklistSchema<["tests", "findings"], undefined>;
217
+ readonly pass: v.BooleanSchema<undefined>;
218
+ readonly detail: v.StringSchema<undefined>;
219
+ }, undefined>, undefined>;
220
+ readonly createdAt: v.NumberSchema<undefined>;
221
+ }, undefined>;
222
+ export type SandboxGrade = v.InferOutput<typeof sandboxGradeSchema>;
223
+ /** Clone a shipped baseline (or another version) into a fresh candidate lineage at v1. */
224
+ export declare const cloneSandboxPromptSchema: v.ObjectSchema<{
225
+ readonly agentKind: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
226
+ /** The shipped baseline id to seed the text from (e.g. a `PROMPT_VERSIONS` id). */
227
+ readonly basePromptId: v.NullableSchema<v.StringSchema<undefined>, undefined>;
228
+ /** Lineage name; defaults to the agent kind when omitted. */
229
+ readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
230
+ readonly labels: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 40, undefined>]>, undefined>, readonly []>;
231
+ }, undefined>;
232
+ export type CloneSandboxPromptInput = v.InferOutput<typeof cloneSandboxPromptSchema>;
233
+ /** Save a new version onto an existing lineage (append-only edit). */
234
+ export declare const saveSandboxVersionSchema: v.ObjectSchema<{
235
+ /** The version id this edit is based on (its lineage + version+1 are derived). */
236
+ readonly parentId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
237
+ readonly systemText: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
238
+ readonly labels: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 40, undefined>]>, undefined>, readonly []>;
239
+ }, undefined>;
240
+ export type SaveSandboxVersionInput = v.InferOutput<typeof saveSandboxVersionSchema>;
241
+ /** Replace the labels on a candidate version. */
242
+ export declare const setSandboxLabelsSchema: v.ObjectSchema<{
243
+ readonly labels: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 40, undefined>]>, undefined>;
244
+ }, undefined>;
245
+ export type SetSandboxLabelsInput = v.InferOutput<typeof setSandboxLabelsSchema>;
246
+ export declare const createSandboxFixtureSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
247
+ readonly kind: v.PicklistSchema<["requirements", "architecture", "code-review", "repo-feature", "repo-bug"], undefined>;
248
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
249
+ readonly payload: v.OptionalSchema<v.NullableSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>, null>;
250
+ readonly repoRef: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
251
+ readonly owner: v.StringSchema<undefined>;
252
+ readonly name: v.StringSchema<undefined>;
253
+ /** A tag/branch/commit naming the reproducible seed; resolved to a SHA at dispatch. */
254
+ readonly seedRef: v.StringSchema<undefined>;
255
+ }, undefined>, undefined>, null>;
256
+ readonly objective: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"kind", [v.ObjectSchema<{
257
+ readonly kind: v.LiteralSchema<"tests", undefined>;
258
+ /** Shell command run against the produced branch; exit 0 = pass. */
259
+ readonly testCmd: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
260
+ }, undefined>, v.ObjectSchema<{
261
+ readonly kind: v.LiteralSchema<"findings", undefined>;
262
+ /** The genuine issues a good output should surface (matched for precision/recall). */
263
+ readonly expectedFindings: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>, undefined>;
264
+ }, undefined>], undefined>, undefined>, null>;
265
+ }, undefined>, v.CheckAction<{
266
+ kind: "architecture" | "code-review" | "repo-bug" | "repo-feature" | "requirements";
267
+ name: string;
268
+ payload: {
269
+ [x: string]: unknown;
270
+ } | null;
271
+ repoRef: {
272
+ owner: string;
273
+ name: string;
274
+ seedRef: string;
275
+ } | null;
276
+ objective: {
277
+ kind: "tests";
278
+ testCmd: string;
279
+ } | {
280
+ kind: "findings";
281
+ expectedFindings: string[];
282
+ } | null;
283
+ }, "Repo fixtures (repo-feature/repo-bug) require a repoRef and no payload; inline fixtures require a payload and no repoRef">]>;
284
+ export type CreateSandboxFixtureInput = v.InferOutput<typeof createSandboxFixtureSchema>;
285
+ /** Create an experiment (status `draft`); launching it expands the matrix into runs. */
286
+ export declare const createSandboxExperimentSchema: v.ObjectSchema<{
287
+ readonly name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
288
+ readonly agentKind: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
289
+ readonly matrix: v.ObjectSchema<{
290
+ readonly promptVersionIds: v.ArraySchema<v.StringSchema<undefined>, undefined>;
291
+ /** Model catalog ids (e.g. `anthropic:claude-opus-4-8`). */
292
+ readonly models: v.ArraySchema<v.StringSchema<undefined>, undefined>;
293
+ readonly fixtureIds: v.ArraySchema<v.StringSchema<undefined>, undefined>;
294
+ }, undefined>;
295
+ readonly judgeModel: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>, undefined>;
296
+ readonly repeats: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 20, undefined>]>, 1>;
297
+ readonly budgetTokens: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, null>;
298
+ }, undefined>;
299
+ export type CreateSandboxExperimentInput = v.InferOutput<typeof createSandboxExperimentSchema>;
300
+ //# sourceMappingURL=sandbox.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.d.ts","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAoB5B,gGAAgG;AAChG,eAAO,MAAM,yBAAyB,wDAAwC,CAAA;AAC9E,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAIjF;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B;;IAErC,yFAAyF;;IAEzF,yFAAyF;;IAEzF,+EAA+E;;;IAG/E,wFAAwF;;IAExF,+FAA+F;;IAE/F,oEAAoE;;IAEpE,uFAAuF;;IAEvF,iEAAiE;;;;IAIjE,kFAAk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6DAA6D;;;aAG7D,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEpF,sEAAsE;AACtE,eAAO,MAAM,wBAAwB;IACnC,kFAAkF;;;;aAIlF,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEpF,iDAAiD;AACjD,eAAO,MAAM,sBAAsB;;aAEjC,CAAA;AACF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAUhF,eAAO,MAAM,0BAA0B;;;;;;;QAnNrC,uFAAuF;;;;;QAqCrF,oEAAoE;;;;QAKpE,sFAAsF;;;;;;;;;;;;;;;;;;;;;gIA+KzF,CAAA;AACD,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAExF,wFAAwF;AACxF,eAAO,MAAM,6BAA6B;;;;;QA9IxC,4DAA4D;;;;;;;aAqJ5D,CAAA;AACF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,6BAA6B,CAAC,CAAA"}
@@ -0,0 +1,243 @@
1
+ import * as v from 'valibot';
2
+ // ---------------------------------------------------------------------------
3
+ // Sandbox wire contracts. The Sandbox is a parallel, opt-in surface for the
4
+ // organized testing of prompts and models: clone any shipped agent system prompt
5
+ // into a versioned, labelled *candidate*, then run an experiment matrix (prompt
6
+ // versions × models × fixtures) for one agent kind and grade every cell with a
7
+ // judge model (default Claude) plus, where a fixture supports it, an objective
8
+ // signal (a hidden test suite / a set of expected findings).
9
+ //
10
+ // The two questions it answers: "which model is best for this task?" (one prompt,
11
+ // many models) and "does a better prompt help?" (one model, many prompt versions).
12
+ //
13
+ // Models are referenced the same way the rest of the product references them — by
14
+ // model *catalog id* string (the `ModelOption.id` from `GET /models`, e.g.
15
+ // `anthropic:claude-opus-4-8`) — not a structured ModelRef; the run resolves the id
16
+ // at dispatch like any other step. Baselines are NOT persisted as rows; they are
17
+ // read live from `@cat-factory/agents`. Only candidate versions are stored.
18
+ // ---------------------------------------------------------------------------
19
+ /** Whether a prompt version is a read-only shipped baseline or a stored, editable candidate. */
20
+ export const sandboxPromptOriginSchema = v.picklist(['baseline', 'candidate']);
21
+ const labelSchema = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(40));
22
+ /**
23
+ * One version of a system prompt under test. A `candidate` is a stored, immutable
24
+ * row in a lineage: cloning a baseline creates version 1, and each save appends a
25
+ * new version with `version = parent.version + 1` sharing the lineage's first id as
26
+ * its root. `baseline` rows are never persisted — the management API synthesizes
27
+ * them from the live shipped prompts so they always reflect current source.
28
+ */
29
+ export const sandboxPromptVersionSchema = v.object({
30
+ id: v.string(),
31
+ /** The lineage this version belongs to (the id of its v1); groups versions in the UI. */
32
+ lineageId: v.string(),
33
+ /** The agent kind this prompt drives (`coder`, `reviewer`, `requirements-review`, …). */
34
+ agentKind: v.string(),
35
+ /** Human label for the lineage (defaults to the agent kind on first clone). */
36
+ name: v.string(),
37
+ origin: sandboxPromptOriginSchema,
38
+ /** The system prompt text this version supplies (overrides the shipped role prompt). */
39
+ systemText: v.string(),
40
+ /** The shipped baseline id this lineage derives from (e.g. a `PROMPT_VERSIONS` id), if any. */
41
+ basePromptId: v.nullable(v.string()),
42
+ /** Monotonic version within the lineage; baselines are always 0. */
43
+ version: v.pipe(v.number(), v.integer(), v.minValue(0)),
44
+ /** The version this one was saved from (clone source / previous edit); null for v1. */
45
+ parentId: v.nullable(v.string()),
46
+ /** Freeform labels for grouping/filtering candidate versions. */
47
+ labels: v.array(labelSchema),
48
+ createdAt: v.number(),
49
+ createdBy: v.nullable(v.string()),
50
+ /** Soft-archive marker; archived versions are hidden from the default listing. */
51
+ archivedAt: v.nullable(v.number()),
52
+ });
53
+ // ---- Fixtures -------------------------------------------------------------
54
+ /**
55
+ * The kind of starting point a fixture supplies. Inline kinds carry their whole
56
+ * input in `payload`; repo kinds point at a seed commit in the fixture repo and the
57
+ * agent works on an ephemeral branch off it.
58
+ */
59
+ export const sandboxFixtureKindSchema = v.picklist([
60
+ 'requirements',
61
+ 'architecture',
62
+ 'code-review',
63
+ 'repo-feature',
64
+ 'repo-bug',
65
+ ]);
66
+ /** A pinned starting point in the dedicated fixture repo for a container-agent fixture. */
67
+ export const sandboxRepoRefSchema = v.object({
68
+ owner: v.string(),
69
+ name: v.string(),
70
+ /** A tag/branch/commit naming the reproducible seed; resolved to a SHA at dispatch. */
71
+ seedRef: v.string(),
72
+ });
73
+ /** Fixture kinds whose starting point is a repo seed (vs. an inline payload). */
74
+ export const SANDBOX_REPO_FIXTURE_KINDS = ['repo-feature', 'repo-bug'];
75
+ /**
76
+ * A fixture's shape must match its kind: repo kinds (`repo-feature`/`repo-bug`) carry a
77
+ * `repoRef` and no inline `payload`; inline kinds carry a `payload` and no `repoRef`.
78
+ * Enforced as a cross-field check so a contradictory fixture (e.g. a `repo-feature` with
79
+ * a null `repoRef`, or an inline fixture with a null `payload`) can never be stored and
80
+ * then crash the run driver when it resolves the seed/context at dispatch.
81
+ */
82
+ const fixtureShapeMatchesKind = (input) => {
83
+ const isRepo = SANDBOX_REPO_FIXTURE_KINDS.includes(input.kind);
84
+ return isRepo
85
+ ? input.repoRef !== null && input.payload === null
86
+ : input.payload !== null && input.repoRef === null;
87
+ };
88
+ const FIXTURE_SHAPE_MESSAGE = 'Repo fixtures (repo-feature/repo-bug) require a repoRef and no payload; inline fixtures require a payload and no repoRef';
89
+ /**
90
+ * The optional objective check a fixture declares, used alongside the LLM judge.
91
+ * `tests` runs a hidden command against the agent's produced branch (pass/fail);
92
+ * `findings` matches the candidate output against a set of planted expected findings.
93
+ */
94
+ export const sandboxFixtureObjectiveSchema = v.variant('kind', [
95
+ v.object({
96
+ kind: v.literal('tests'),
97
+ /** Shell command run against the produced branch; exit 0 = pass. */
98
+ testCmd: v.pipe(v.string(), v.trim(), v.minLength(1)),
99
+ }),
100
+ v.object({
101
+ kind: v.literal('findings'),
102
+ /** The genuine issues a good output should surface (matched for precision/recall). */
103
+ expectedFindings: v.array(v.pipe(v.string(), v.trim(), v.minLength(1))),
104
+ }),
105
+ ]);
106
+ const sandboxFixtureObjectSchema = v.object({
107
+ id: v.string(),
108
+ kind: sandboxFixtureKindSchema,
109
+ name: v.string(),
110
+ /** Inline input for prompt-only fixtures (the synthesized agent run context); null for repo fixtures. */
111
+ payload: v.nullable(v.record(v.string(), v.unknown())),
112
+ /** Seed for container fixtures; null for inline fixtures. */
113
+ repoRef: v.nullable(sandboxRepoRefSchema),
114
+ /** Optional objective check; null when only the LLM judge grades this fixture. */
115
+ objective: v.nullable(sandboxFixtureObjectiveSchema),
116
+ /** `builtin` fixtures are seeded from code; `custom` are workspace-authored. */
117
+ origin: v.picklist(['builtin', 'custom']),
118
+ createdAt: v.number(),
119
+ });
120
+ export const sandboxFixtureSchema = v.pipe(sandboxFixtureObjectSchema, v.check((f) => fixtureShapeMatchesKind(f), FIXTURE_SHAPE_MESSAGE));
121
+ // ---- Experiments ----------------------------------------------------------
122
+ export const sandboxExperimentStatusSchema = v.picklist(['draft', 'running', 'done', 'failed']);
123
+ /** The grid an experiment expands: every (prompt version × model × fixture) is one cell. */
124
+ export const sandboxMatrixSchema = v.object({
125
+ promptVersionIds: v.array(v.string()),
126
+ /** Model catalog ids (e.g. `anthropic:claude-opus-4-8`). */
127
+ models: v.array(v.string()),
128
+ fixtureIds: v.array(v.string()),
129
+ });
130
+ export const sandboxExperimentSchema = v.object({
131
+ id: v.string(),
132
+ name: v.string(),
133
+ /** The single agent kind every cell of this experiment exercises. */
134
+ agentKind: v.string(),
135
+ /** Model catalog id of the judge (defaults to the latest Claude). */
136
+ judgeModel: v.string(),
137
+ /** How many times each cell is run, to expose model nondeterminism (variance). */
138
+ repeats: v.pipe(v.number(), v.integer(), v.minValue(1)),
139
+ status: sandboxExperimentStatusSchema,
140
+ matrix: sandboxMatrixSchema,
141
+ /** Optional hard token budget for the whole experiment; null = uncapped. */
142
+ budgetTokens: v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0))),
143
+ createdAt: v.number(),
144
+ createdBy: v.nullable(v.string()),
145
+ });
146
+ // ---- Runs (cells) ---------------------------------------------------------
147
+ export const sandboxRunStatusSchema = v.picklist(['queued', 'running', 'done', 'failed']);
148
+ export const sandboxTokenUsageSchema = v.object({
149
+ inputTokens: v.number(),
150
+ outputTokens: v.number(),
151
+ });
152
+ export const sandboxRunSchema = v.object({
153
+ id: v.string(),
154
+ experimentId: v.string(),
155
+ promptVersionId: v.string(),
156
+ /** The exact model catalog id this cell ran (frozen from the matrix). */
157
+ model: v.string(),
158
+ fixtureId: v.string(),
159
+ /** 0-based repeat index within the cell. */
160
+ repeatIndex: v.pipe(v.number(), v.integer(), v.minValue(0)),
161
+ status: sandboxRunStatusSchema,
162
+ /** The agent's captured output (prose, JSON, or a rendered diff). */
163
+ outputText: v.nullable(v.string()),
164
+ usage: v.nullable(sandboxTokenUsageSchema),
165
+ latencyMs: v.nullable(v.number()),
166
+ /** Ephemeral work branch for container cells; null for inline cells. */
167
+ branch: v.nullable(v.string()),
168
+ prUrl: v.nullable(v.string()),
169
+ /** Captured diff for container cells (truncated by the harness). */
170
+ diff: v.nullable(v.string()),
171
+ error: v.nullable(v.string()),
172
+ /** Resolved fixture seed commit, pinned at dispatch for reproducibility. */
173
+ seedSha: v.nullable(v.string()),
174
+ /** Frozen `name@vN` label of the prompt version this cell ran. */
175
+ promptLabel: v.string(),
176
+ startedAt: v.nullable(v.number()),
177
+ finishedAt: v.nullable(v.number()),
178
+ });
179
+ // ---- Grades ---------------------------------------------------------------
180
+ /** One rubric dimension's judged score (1–5) with the judge's rationale. */
181
+ export const sandboxGradeDimensionSchema = v.object({
182
+ key: v.string(),
183
+ score: v.pipe(v.number(), v.minValue(1), v.maxValue(5)),
184
+ rationale: v.string(),
185
+ });
186
+ /** The objective check's outcome, recorded alongside (never blended into) the rubric grade. */
187
+ export const sandboxObjectiveResultSchema = v.object({
188
+ kind: v.picklist(['tests', 'findings']),
189
+ pass: v.boolean(),
190
+ detail: v.string(),
191
+ });
192
+ export const sandboxGradeSchema = v.object({
193
+ id: v.string(),
194
+ runId: v.string(),
195
+ /** Model catalog id of the judge that produced this grade. */
196
+ judgeModel: v.string(),
197
+ scores: v.array(sandboxGradeDimensionSchema),
198
+ /** Weighted mean of the dimension scores using the task rubric weights. */
199
+ weightedTotal: v.number(),
200
+ /** Objective signal when the fixture declared one; null otherwise. */
201
+ objective: v.nullable(sandboxObjectiveResultSchema),
202
+ createdAt: v.number(),
203
+ });
204
+ // ---- Request bodies -------------------------------------------------------
205
+ /** Clone a shipped baseline (or another version) into a fresh candidate lineage at v1. */
206
+ export const cloneSandboxPromptSchema = v.object({
207
+ agentKind: v.pipe(v.string(), v.trim(), v.minLength(1)),
208
+ /** The shipped baseline id to seed the text from (e.g. a `PROMPT_VERSIONS` id). */
209
+ basePromptId: v.nullable(v.string()),
210
+ /** Lineage name; defaults to the agent kind when omitted. */
211
+ name: v.optional(v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(80))),
212
+ labels: v.optional(v.array(labelSchema), []),
213
+ });
214
+ /** Save a new version onto an existing lineage (append-only edit). */
215
+ export const saveSandboxVersionSchema = v.object({
216
+ /** The version id this edit is based on (its lineage + version+1 are derived). */
217
+ parentId: v.pipe(v.string(), v.minLength(1)),
218
+ systemText: v.pipe(v.string(), v.minLength(1)),
219
+ labels: v.optional(v.array(labelSchema), []),
220
+ });
221
+ /** Replace the labels on a candidate version. */
222
+ export const setSandboxLabelsSchema = v.object({
223
+ labels: v.array(labelSchema),
224
+ });
225
+ /** Create a custom fixture in a workspace. */
226
+ const createSandboxFixtureObjectSchema = v.object({
227
+ kind: sandboxFixtureKindSchema,
228
+ name: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(80)),
229
+ payload: v.optional(v.nullable(v.record(v.string(), v.unknown())), null),
230
+ repoRef: v.optional(v.nullable(sandboxRepoRefSchema), null),
231
+ objective: v.optional(v.nullable(sandboxFixtureObjectiveSchema), null),
232
+ });
233
+ export const createSandboxFixtureSchema = v.pipe(createSandboxFixtureObjectSchema, v.check((f) => fixtureShapeMatchesKind(f), FIXTURE_SHAPE_MESSAGE));
234
+ /** Create an experiment (status `draft`); launching it expands the matrix into runs. */
235
+ export const createSandboxExperimentSchema = v.object({
236
+ name: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(80)),
237
+ agentKind: v.pipe(v.string(), v.trim(), v.minLength(1)),
238
+ matrix: sandboxMatrixSchema,
239
+ judgeModel: v.optional(v.pipe(v.string(), v.trim(), v.minLength(1))),
240
+ repeats: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(20)), 1),
241
+ budgetTokens: v.optional(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0))), null),
242
+ });
243
+ //# sourceMappingURL=sandbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,8EAA8E;AAC9E,4EAA4E;AAC5E,iFAAiF;AACjF,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,6DAA6D;AAC7D,EAAE;AACF,kFAAkF;AAClF,mFAAmF;AACnF,EAAE;AACF,kFAAkF;AAClF,2EAA2E;AAC3E,oFAAoF;AACpF,iFAAiF;AACjF,4EAA4E;AAC5E,8EAA8E;AAE9E,gGAAgG;AAChG,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAA;AAG9E,MAAM,WAAW,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS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,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,EAAE,mBAAmB;IAC3B,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACpE,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACtF,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;CAC3F,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ import * as v from 'valibot';
2
+ /** A workspace's default service-fragment selection: the ids new services inherit. */
3
+ export declare const serviceFragmentDefaultsSchema: v.ObjectSchema<{
4
+ readonly fragmentIds: v.ArraySchema<v.StringSchema<undefined>, undefined>;
5
+ }, undefined>;
6
+ export type ServiceFragmentDefaults = v.InferOutput<typeof serviceFragmentDefaultsSchema>;
7
+ /**
8
+ * Replace a workspace's default service-fragment selection wholesale. Ids are trimmed
9
+ * and must be non-empty; they are not validated against the catalog here (an
10
+ * unresolvable id is simply skipped when bodies are resolved at run time).
11
+ */
12
+ export declare const setServiceFragmentDefaultsSchema: v.ObjectSchema<{
13
+ readonly fragmentIds: v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>, undefined>;
14
+ }, undefined>;
15
+ export type SetServiceFragmentDefaultsInput = v.InferOutput<typeof setServiceFragmentDefaultsSchema>;
16
+ //# sourceMappingURL=service-fragment-defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-fragment-defaults.d.ts","sourceRoot":"","sources":["../src/service-fragment-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAW5B,sFAAsF;AACtF,eAAO,MAAM,6BAA6B;;aAExC,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,6BAA6B,CAAC,CAAA;AAIzF;;;;GAIG;AACH,eAAO,MAAM,gCAAgC;;aAE3C,CAAA;AACF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,gCAAgC,CAAC,CAAA"}
@@ -0,0 +1,23 @@
1
+ import * as v from 'valibot';
2
+ // ---------------------------------------------------------------------------
3
+ // Per-workspace default set of best-practice prompt fragments for NEW services.
4
+ // When a service (frame block) is created in the workspace, its
5
+ // `serviceFragmentIds` are seeded from this list. Changing the default does not
6
+ // retroactively change existing services — each service owns its selection from
7
+ // then on. The ids reference the universal fragment pool (built-in catalog plus
8
+ // any deployment-registered fragments, served by GET /prompt-fragments).
9
+ // ---------------------------------------------------------------------------
10
+ /** A workspace's default service-fragment selection: the ids new services inherit. */
11
+ export const serviceFragmentDefaultsSchema = v.object({
12
+ fragmentIds: v.array(v.string()),
13
+ });
14
+ // ---- Request bodies -------------------------------------------------------
15
+ /**
16
+ * Replace a workspace's default service-fragment selection wholesale. Ids are trimmed
17
+ * and must be non-empty; they are not validated against the catalog here (an
18
+ * unresolvable id is simply skipped when bodies are resolved at run time).
19
+ */
20
+ export const setServiceFragmentDefaultsSchema = v.object({
21
+ fragmentIds: v.array(v.pipe(v.string(), v.trim(), v.minLength(1))),
22
+ });
23
+ //# sourceMappingURL=service-fragment-defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service-fragment-defaults.js","sourceRoot":"","sources":["../src/service-fragment-defaults.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,8EAA8E;AAC9E,gFAAgF;AAChF,gEAAgE;AAChE,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAChF,yEAAyE;AACzE,8EAA8E;AAE9E,sFAAsF;AACtF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CACjC,CAAC,CAAA;AAGF,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;CACnE,CAAC,CAAA"}