@cat-factory/contracts 0.99.0 → 0.101.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.
@@ -0,0 +1,228 @@
1
+ import * as v from 'valibot';
2
+ import { initiativeExecutionPolicySchema, initiativePresetInputsSchema, } from './initiative.js';
3
+ // ---------------------------------------------------------------------------
4
+ // Initiative-preset wire contracts.
5
+ //
6
+ // An initiative PRESET is more than a pipeline: it bundles (a) its own FORM the user
7
+ // fills at create time — rendered generically by the SPA from this backend-supplied
8
+ // descriptor, zero frontend changes per preset — (b) a planning-pipeline binding
9
+ // (skip the interviewer when the form IS the interview), (c) execution-policy /
10
+ // fragment / human-review defaults, and (d) code hooks (a repo-detection prefill
11
+ // probe, a plan post-processor) that live on the KERNEL registration, not here (this
12
+ // file is the serialisable, SPA-facing subset). See
13
+ // `docs/initiatives/initiative-presets-and-docs-refresh.md` and the kernel
14
+ // `initiative-preset-registry.ts`.
15
+ //
16
+ // The field descriptor extends the `ProviderConfigField` family with the two shapes a
17
+ // preset form needs that a flat provider form did not: `checkbox-group` (a multi-select
18
+ // whose value is `string[]`) and `path` (a repo-relative directory), plus single-condition
19
+ // `showWhen` visibility (a per-doc-type subfolder shown only when that type is checked).
20
+ // Descriptor labels are backend-supplied English (the `describeConfig` convention); only
21
+ // the surrounding chrome is i18n.
22
+ // ---------------------------------------------------------------------------
23
+ /**
24
+ * How a preset field is rendered/collected. The first six mirror {@link ProviderConfigField}'s
25
+ * types exactly; `checkbox-group` (a multi-select, value `string[]`) and `path` (a repo-relative
26
+ * directory, {@link isSafeRepoDirPath}-validated) are the two additions the preset form needs.
27
+ */
28
+ export const initiativePresetFieldTypeSchema = v.picklist([
29
+ 'text',
30
+ 'password',
31
+ 'select',
32
+ 'number',
33
+ 'checkbox',
34
+ 'textarea',
35
+ 'checkbox-group',
36
+ 'path',
37
+ ]);
38
+ /**
39
+ * Single-condition visibility for a field: it renders only when the referenced field's value
40
+ * matches. `equals` compares a scalar value; `includes` tests membership in a `checkbox-group`
41
+ * value (the per-doc-type subfolder case — "show `diagramsDir` only when `docTypes` includes
42
+ * `diagrams`"). Deliberately ONE condition — resist growing this into a recursive schema
43
+ * renderer (that is the descriptor-forms initiative's separate line item).
44
+ */
45
+ export const initiativePresetShowWhenSchema = v.object({
46
+ /** The `key` of the field whose value gates this one's visibility. */
47
+ key: v.pipe(v.string(), v.minLength(1)),
48
+ /**
49
+ * Show when the referenced scalar value equals this. A union so `equals` can gate a
50
+ * `checkbox` (boolean) or `number` field, not only a `select`/`text` string — the
51
+ * comparison is strict, so the type must match the referenced field's value.
52
+ */
53
+ equals: v.optional(v.union([v.string(), v.boolean(), v.number()])),
54
+ /** Show when the referenced `checkbox-group` value includes this. */
55
+ includes: v.optional(v.string()),
56
+ });
57
+ /** One value a preset needs, rendered as a single form field. */
58
+ export const initiativePresetFieldSchema = v.object({
59
+ /** Stable key the value is stored/sent under (e.g. `docTypes`, `docsRoot`). */
60
+ key: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),
61
+ /** Human label for the form field (backend-supplied English). */
62
+ label: v.pipe(v.string(), v.minLength(1), v.maxLength(120)),
63
+ /** Optional helper text shown under the field. */
64
+ help: v.optional(v.string()),
65
+ /** Optional input placeholder. */
66
+ placeholder: v.optional(v.string()),
67
+ /** Whether the value is required (absent ⇒ optional). A hidden (`showWhen`) field is never required. */
68
+ required: v.optional(v.boolean()),
69
+ /** Field type; absent is treated as `text`. */
70
+ type: v.optional(initiativePresetFieldTypeSchema),
71
+ /** Choices for a `select` / `checkbox-group` field. */
72
+ options: v.optional(v.array(v.object({ value: v.string(), label: v.string() }))),
73
+ /** The scalar default (`text`/`select`/`path`/`number`/`checkbox`); the form falls back to it when blank. */
74
+ default: v.optional(v.string()),
75
+ /** The multi-select default for a `checkbox-group` field. */
76
+ defaultValues: v.optional(v.array(v.string())),
77
+ /** Single-condition visibility; absent ⇒ always shown. */
78
+ showWhen: v.optional(initiativePresetShowWhenSchema),
79
+ });
80
+ /** Display metadata for a preset in the create-initiative picker. */
81
+ export const initiativePresetPresentationSchema = v.object({
82
+ /** Human label, e.g. `Documentation refresh`. */
83
+ label: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(80)),
84
+ /** Icon id (e.g. an `i-lucide-*` name). */
85
+ icon: v.pipe(v.string(), v.minLength(1), v.maxLength(120)),
86
+ /** Accent colour (CSS hex/keyword). */
87
+ color: v.pipe(v.string(), v.minLength(1), v.maxLength(40)),
88
+ /** One-line description shown in the picker. */
89
+ description: v.pipe(v.string(), v.maxLength(500)),
90
+ });
91
+ /**
92
+ * The serialisable, SPA-facing description of a preset: everything the create-initiative
93
+ * modal needs to render the picker + form and start planning, attached to the workspace
94
+ * snapshot (the `customAgentKinds` precedent). The code hooks (`detect`/`seedPlan`/
95
+ * `promptAdditions`) live on the kernel registration, NOT here.
96
+ */
97
+ export const initiativePresetDescriptorSchema = v.object({
98
+ /** Stable preset id (e.g. `preset_generic`, `preset_docs_refresh`). */
99
+ id: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(80)),
100
+ presentation: initiativePresetPresentationSchema,
101
+ /** The form fields the user fills at create time (empty for the generic preset). */
102
+ fields: v.array(initiativePresetFieldSchema),
103
+ /** The planning pipeline the SPA starts (e.g. `pl_initiative`, `pl_initiative_docs`). */
104
+ planningPipelineId: v.pipe(v.string(), v.minLength(1)),
105
+ /** `full` runs the interviewer; `skip` treats the form AS the interview (seeded qa). */
106
+ interview: v.picklist(['full', 'skip']),
107
+ /** Default for the human-review opt-in (mapped to the gate-override seam at start). */
108
+ humanReviewDefault: v.boolean(),
109
+ /** Best-practice prompt fragments applied by default (configurable via a form field). */
110
+ defaultFragmentIds: v.optional(v.array(v.string()), []),
111
+ /** Partial execution-policy overrides folded in at plan ingest. */
112
+ policyDefaults: v.optional(v.partial(initiativeExecutionPolicySchema)),
113
+ /**
114
+ * Whether this preset supports a repo-detection PREFILL probe (a `detect` hook is wired on
115
+ * the registration). Computed server-side when the snapshot is built (the `supportsTest`
116
+ * convention) so the SPA knows to call `POST …/initiative-presets/:id/probe`. Never blocks
117
+ * create — an unwired probe / GitHub simply falls back to the descriptor defaults.
118
+ */
119
+ probe: v.optional(v.boolean()),
120
+ });
121
+ /** Strictly parse a preset descriptor. Throws on shape violations. */
122
+ export function parseInitiativePresetDescriptor(value) {
123
+ return v.parse(initiativePresetDescriptorSchema, value);
124
+ }
125
+ // ---------------------------------------------------------------------------
126
+ // Path safety + input validation (pure — shared by the create-flow validation).
127
+ // ---------------------------------------------------------------------------
128
+ /**
129
+ * Whether `path` is a SAFE repo-relative DIRECTORY (the `path`-field analogue of
130
+ * {@link isSafeDocPath}, minus the `.md` requirement). A preset `path` value is used verbatim
131
+ * as an in-repo placement dir the writers commit under, so it must not escape the repo: no `..`
132
+ * traversal, no absolute path (`/…` or a Windows drive), no backslash / NUL. An empty string is
133
+ * NOT a valid path (callers treat "unset" separately). A trailing slash is tolerated.
134
+ */
135
+ export function isSafeRepoDirPath(path) {
136
+ const p = path.trim();
137
+ if (!p || p.length > 300)
138
+ return false;
139
+ if (p.startsWith('/') || /^[a-zA-Z]:/.test(p))
140
+ return false;
141
+ if (p.includes('\\') || p.includes('\0'))
142
+ return false;
143
+ return !p.split('/').some((segment) => segment === '..');
144
+ }
145
+ /** Whether a field is visible given the current input values (its `showWhen` condition). */
146
+ export function isPresetFieldVisible(field, inputs) {
147
+ const cond = field.showWhen;
148
+ if (!cond)
149
+ return true;
150
+ const value = inputs[cond.key];
151
+ if (cond.equals !== undefined)
152
+ return value === cond.equals;
153
+ if (cond.includes !== undefined)
154
+ return Array.isArray(value) && value.includes(cond.includes);
155
+ // A `showWhen` with neither predicate is a malformed condition — treat as always visible.
156
+ return true;
157
+ }
158
+ /** Whether a filled value matches the field's declared type (structural, pre-semantic check). */
159
+ function valueMatchesFieldType(field, value) {
160
+ switch (field.type) {
161
+ case 'checkbox-group':
162
+ return Array.isArray(value);
163
+ case 'checkbox':
164
+ return typeof value === 'boolean';
165
+ case 'number':
166
+ return typeof value === 'number';
167
+ default:
168
+ // text / password / select / textarea / path (and the untyped default) are strings.
169
+ return typeof value === 'string';
170
+ }
171
+ }
172
+ /**
173
+ * Validate a filled preset form against its descriptor, returning a list of human-readable
174
+ * problems (EMPTY ⇒ valid). Pure + total (never throws), so the create controller can map a
175
+ * non-empty result to a single ValidationError. Enforces: no unknown keys, correct value type
176
+ * per field, required VISIBLE fields present (a required `checkbox` must be CHECKED — an
177
+ * unchecked `false` counts as unset), `select`/`checkbox-group` values drawn from the declared
178
+ * options, and `path` values that stay inside the repo ({@link isSafeRepoDirPath}). Hidden
179
+ * fields (failing `showWhen`) are not required and their stale values are ignored.
180
+ */
181
+ export function validateInitiativePresetInputs(descriptor, inputs) {
182
+ const problems = [];
183
+ const byKey = new Map(descriptor.fields.map((f) => [f.key, f]));
184
+ for (const key of Object.keys(inputs)) {
185
+ if (!byKey.has(key))
186
+ problems.push(`Unknown field "${key}".`);
187
+ }
188
+ for (const field of descriptor.fields) {
189
+ const visible = isPresetFieldVisible(field, inputs);
190
+ const value = inputs[field.key];
191
+ // A checkbox is "present" only when checked: a required checkbox means "must be checked",
192
+ // so an unchecked (`false`) box counts as unset and fails the required check below.
193
+ const present = value !== undefined &&
194
+ !(typeof value === 'string' && value.trim() === '') &&
195
+ !(Array.isArray(value) && value.length === 0) &&
196
+ value !== false;
197
+ if (!visible)
198
+ continue;
199
+ if (!present) {
200
+ if (field.required)
201
+ problems.push(`Field "${field.key}" is required.`);
202
+ continue;
203
+ }
204
+ if (!valueMatchesFieldType(field, value)) {
205
+ problems.push(`Field "${field.key}" has the wrong type for a ${field.type ?? 'text'} field.`);
206
+ continue;
207
+ }
208
+ const optionValues = new Set((field.options ?? []).map((o) => o.value));
209
+ if (field.type === 'select' && optionValues.size > 0 && !optionValues.has(value)) {
210
+ problems.push(`Field "${field.key}" has a value outside its options.`);
211
+ }
212
+ if (field.type === 'checkbox-group' && optionValues.size > 0) {
213
+ for (const entry of value) {
214
+ if (!optionValues.has(entry))
215
+ problems.push(`Field "${field.key}" has an option "${entry}" outside its choices.`);
216
+ }
217
+ }
218
+ if (field.type === 'path' && !isSafeRepoDirPath(value)) {
219
+ problems.push(`Field "${field.key}" must be a relative path inside the repo (no "..", absolute, or backslash segments).`);
220
+ }
221
+ }
222
+ return problems;
223
+ }
224
+ /** Strictly parse a bounded preset-inputs record. Throws on shape violations. */
225
+ export function parseInitiativePresetInputs(value) {
226
+ return v.parse(initiativePresetInputsSchema, value);
227
+ }
228
+ //# sourceMappingURL=initiative-preset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initiative-preset.js","sourceRoot":"","sources":["../src/initiative-preset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAC5B,OAAO,EACL,+BAA+B,EAC/B,4BAA4B,GAG7B,MAAM,iBAAiB,CAAA;AAExB,8EAA8E;AAC9E,oCAAoC;AACpC,EAAE;AACF,qFAAqF;AACrF,oFAAoF;AACpF,iFAAiF;AACjF,gFAAgF;AAChF,iFAAiF;AACjF,qFAAqF;AACrF,oDAAoD;AACpD,2EAA2E;AAC3E,mCAAmC;AACnC,EAAE;AACF,sFAAsF;AACtF,wFAAwF;AACxF,2FAA2F;AAC3F,yFAAyF;AACzF,yFAAyF;AACzF,kCAAkC;AAClC,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,CAAC,QAAQ,CAAC;IACxD,MAAM;IACN,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,UAAU;IACV,UAAU;IACV,gBAAgB;IAChB,MAAM;CACP,CAAC,CAAA;AAGF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IACrD,sEAAsE;IACtE,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC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AAC,KAAc;IACxD,OAAO,CAAC,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAA;AACrD,CAAC"}
@@ -4,6 +4,16 @@ export declare const INITIATIVE_TITLE_MAX = 200;
4
4
  export declare const INITIATIVE_PROSE_MAX = 8000;
5
5
  export declare const INITIATIVE_SHORT_MAX = 2000;
6
6
  export declare const INITIATIVE_MAX_CONCURRENT = 20;
7
+ /** Bound on a single string / string-array element value in {@link initiativePresetInputsSchema}. */
8
+ export declare const INITIATIVE_PRESET_INPUT_MAX = 2000;
9
+ /** Bound on the number of elements in a `checkbox-group`/multi-value input. */
10
+ export declare const INITIATIVE_PRESET_INPUT_ARRAY_MAX = 50;
11
+ /** One filled preset-form value: a scalar (`text`/`select`/`path`/…), a multi-select, a toggle, or a number. */
12
+ export declare const initiativePresetInputValueSchema: v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, v.MaxLengthAction<string[], 50, undefined>]>, v.BooleanSchema<undefined>, v.NumberSchema<undefined>], undefined>;
13
+ export type InitiativePresetInputValue = v.InferOutput<typeof initiativePresetInputValueSchema>;
14
+ /** The user's filled preset form — a bounded map from field `key` to its value. */
15
+ export declare const initiativePresetInputsSchema: v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, v.MaxLengthAction<string[], 50, undefined>]>, v.BooleanSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
16
+ export type InitiativePresetInputs = v.InferOutput<typeof initiativePresetInputsSchema>;
7
17
  /** Lifecycle of a single tracker item (one unit of work → one spawned task). */
8
18
  export declare const initiativeItemStatusSchema: v.PicklistSchema<["pending", "in_progress", "pr_open", "done", "blocked", "skipped"], undefined>;
9
19
  export type InitiativeItemStatus = v.InferOutput<typeof initiativeItemStatusSchema>;
@@ -70,6 +80,43 @@ export declare const initiativePhaseSchema: v.ObjectSchema<{
70
80
  readonly maxConcurrent: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 20, undefined>]>, undefined>;
71
81
  }, undefined>;
72
82
  export type InitiativePhase = v.InferOutput<typeof initiativePhaseSchema>;
83
+ /**
84
+ * Preset-authored decoration for a spawned task, folded onto the task block by the
85
+ * execution loop's `buildTaskBlock` (slice 5) so an item comes out as a first-class typed
86
+ * task rather than a bare description block. Every field is optional and additive:
87
+ * - `taskTypeFields` — the per-type block fields (a doc task's `targetPath`/`docKind`, …).
88
+ * - `fragmentIds` — best-practice prompt fragments to stamp on the block.
89
+ * - `agentConfig` — per-agent-kind config values for the spawned pipeline.
90
+ * - `gates` — a per-run gate override (parallel to the pipeline's steps, one
91
+ * boolean each), threaded through the slice-2 gate-override seam.
92
+ * Emitted by the planner (via the draft item) and/or enforced by a preset's `seedPlan`.
93
+ */
94
+ export declare const initiativeItemSpawnSchema: v.ObjectSchema<{
95
+ readonly taskTypeFields: v.OptionalSchema<v.ObjectSchema<{
96
+ readonly severity: v.OptionalSchema<v.PicklistSchema<["low", "medium", "high", "critical"], undefined>, undefined>;
97
+ readonly stepsToReproduce: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
98
+ readonly timeboxHours: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
99
+ readonly docKind: v.OptionalSchema<v.PicklistSchema<readonly ["prd", "rfc", "adr", "design", "technical", "api", "runbook", "research", "reference", "other"], undefined>, undefined>;
100
+ readonly audience: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 300, undefined>]>, undefined>;
101
+ readonly targetPath: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 300, undefined>, v.CheckAction<string, "targetPath must be a relative path inside the repo, ending in .md, with no \"..\", absolute, or backslash segments.">]>, undefined>;
102
+ readonly outlineHints: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
103
+ readonly targetUsers: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
104
+ readonly successMetrics: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
105
+ readonly alternativesConsidered: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
106
+ readonly rolloutConcerns: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
107
+ readonly decisionDrivers: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
108
+ readonly consideredOptions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
109
+ readonly whenToUse: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
110
+ readonly escalationPath: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
111
+ readonly researchQuestion: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
112
+ readonly optionsToCompare: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
113
+ readonly apiSurface: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
114
+ }, undefined>, undefined>;
115
+ readonly fragmentIds: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
116
+ readonly agentConfig: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 400, undefined>]>, undefined>, undefined>;
117
+ readonly gates: v.OptionalSchema<v.ArraySchema<v.BooleanSchema<undefined>, undefined>, undefined>;
118
+ }, undefined>;
119
+ export type InitiativeItemSpawn = v.InferOutput<typeof initiativeItemSpawnSchema>;
73
120
  /** One unit of work in the tracker — spawned just-in-time as a task block. */
74
121
  export declare const initiativeItemSchema: v.ObjectSchema<{
75
122
  readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
@@ -99,6 +146,32 @@ export declare const initiativeItemSchema: v.ObjectSchema<{
99
146
  }, undefined>, undefined>;
100
147
  /** Loop/human annotation — e.g. the failure detail that blocked the item. */
101
148
  readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
149
+ /** Preset-authored spawn decoration stamped onto the spawned task block (slice 5). */
150
+ readonly spawn: v.OptionalSchema<v.ObjectSchema<{
151
+ readonly taskTypeFields: v.OptionalSchema<v.ObjectSchema<{
152
+ readonly severity: v.OptionalSchema<v.PicklistSchema<["low", "medium", "high", "critical"], undefined>, undefined>;
153
+ readonly stepsToReproduce: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
154
+ readonly timeboxHours: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
155
+ readonly docKind: v.OptionalSchema<v.PicklistSchema<readonly ["prd", "rfc", "adr", "design", "technical", "api", "runbook", "research", "reference", "other"], undefined>, undefined>;
156
+ readonly audience: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 300, undefined>]>, undefined>;
157
+ readonly targetPath: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 300, undefined>, v.CheckAction<string, "targetPath must be a relative path inside the repo, ending in .md, with no \"..\", absolute, or backslash segments.">]>, undefined>;
158
+ readonly outlineHints: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
159
+ readonly targetUsers: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
160
+ readonly successMetrics: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
161
+ readonly alternativesConsidered: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
162
+ readonly rolloutConcerns: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
163
+ readonly decisionDrivers: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
164
+ readonly consideredOptions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
165
+ readonly whenToUse: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
166
+ readonly escalationPath: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
167
+ readonly researchQuestion: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
168
+ readonly optionsToCompare: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
169
+ readonly apiSurface: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
170
+ }, undefined>, undefined>;
171
+ readonly fragmentIds: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
172
+ readonly agentConfig: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 400, undefined>]>, undefined>, undefined>;
173
+ readonly gates: v.OptionalSchema<v.ArraySchema<v.BooleanSchema<undefined>, undefined>, undefined>;
174
+ }, undefined>, undefined>;
102
175
  }, undefined>;
103
176
  export type InitiativeItem = v.InferOutput<typeof initiativeItemSchema>;
104
177
  /** A decision recorded on the tracker (made during planning or mid-flight). */
@@ -173,6 +246,16 @@ export declare const initiativeSchema: v.ObjectSchema<{
173
246
  /** Stable slug naming the in-repo tracker folder (`docs/initiatives/<slug>/`). */
174
247
  readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
175
248
  readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
249
+ /**
250
+ * The initiative-preset this initiative was created from (see `initiative-preset.ts`).
251
+ * Absent ⇒ a preset-less initiative created by an old client / the public API — its
252
+ * behaviour is byte-for-byte today's (the generic pipeline, human review on). The SPA
253
+ * picker seeds `preset_generic` for new initiatives, but a preset only ever ADDS context;
254
+ * nothing in the planning/loop path branches on its presence.
255
+ */
256
+ readonly presetId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
257
+ /** The user's filled preset form, FROZEN at create (the `agentConfig` freeze precedent). */
258
+ readonly presetInputs: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, v.UnionSchema<[v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, v.MaxLengthAction<string[], 50, undefined>]>, v.BooleanSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>, undefined>;
176
259
  /** The agreed goal statement (from planning). */
177
260
  readonly goal: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 8000, undefined>]>, "">;
178
261
  readonly constraints: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, readonly []>;
@@ -227,6 +310,32 @@ export declare const initiativeSchema: v.ObjectSchema<{
227
310
  }, undefined>, undefined>;
228
311
  /** Loop/human annotation — e.g. the failure detail that blocked the item. */
229
312
  readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
313
+ /** Preset-authored spawn decoration stamped onto the spawned task block (slice 5). */
314
+ readonly spawn: v.OptionalSchema<v.ObjectSchema<{
315
+ readonly taskTypeFields: v.OptionalSchema<v.ObjectSchema<{
316
+ readonly severity: v.OptionalSchema<v.PicklistSchema<["low", "medium", "high", "critical"], undefined>, undefined>;
317
+ readonly stepsToReproduce: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
318
+ readonly timeboxHours: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
319
+ readonly docKind: v.OptionalSchema<v.PicklistSchema<readonly ["prd", "rfc", "adr", "design", "technical", "api", "runbook", "research", "reference", "other"], undefined>, undefined>;
320
+ readonly audience: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 300, undefined>]>, undefined>;
321
+ readonly targetPath: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 300, undefined>, v.CheckAction<string, "targetPath must be a relative path inside the repo, ending in .md, with no \"..\", absolute, or backslash segments.">]>, undefined>;
322
+ readonly outlineHints: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
323
+ readonly targetUsers: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
324
+ readonly successMetrics: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
325
+ readonly alternativesConsidered: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
326
+ readonly rolloutConcerns: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
327
+ readonly decisionDrivers: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
328
+ readonly consideredOptions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
329
+ readonly whenToUse: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
330
+ readonly escalationPath: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
331
+ readonly researchQuestion: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
332
+ readonly optionsToCompare: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
333
+ readonly apiSurface: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
334
+ }, undefined>, undefined>;
335
+ readonly fragmentIds: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
336
+ readonly agentConfig: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 400, undefined>]>, undefined>, undefined>;
337
+ readonly gates: v.OptionalSchema<v.ArraySchema<v.BooleanSchema<undefined>, undefined>, undefined>;
338
+ }, undefined>, undefined>;
230
339
  }, undefined>, undefined>, readonly []>;
231
340
  readonly policy: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
232
341
  /** Max concurrently-running spawned tasks across the whole initiative. */
@@ -306,6 +415,32 @@ export declare const initiativeDraftItemSchema: v.ObjectSchema<{
306
415
  readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
307
416
  }, undefined>, undefined>;
308
417
  readonly pipelineId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
418
+ /** Preset-authored spawn decoration (a `seedPlan` may enforce/override it at ingest). */
419
+ readonly spawn: v.OptionalSchema<v.ObjectSchema<{
420
+ readonly taskTypeFields: v.OptionalSchema<v.ObjectSchema<{
421
+ readonly severity: v.OptionalSchema<v.PicklistSchema<["low", "medium", "high", "critical"], undefined>, undefined>;
422
+ readonly stepsToReproduce: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
423
+ readonly timeboxHours: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
424
+ readonly docKind: v.OptionalSchema<v.PicklistSchema<readonly ["prd", "rfc", "adr", "design", "technical", "api", "runbook", "research", "reference", "other"], undefined>, undefined>;
425
+ readonly audience: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 300, undefined>]>, undefined>;
426
+ readonly targetPath: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 300, undefined>, v.CheckAction<string, "targetPath must be a relative path inside the repo, ending in .md, with no \"..\", absolute, or backslash segments.">]>, undefined>;
427
+ readonly outlineHints: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
428
+ readonly targetUsers: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
429
+ readonly successMetrics: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
430
+ readonly alternativesConsidered: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
431
+ readonly rolloutConcerns: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
432
+ readonly decisionDrivers: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
433
+ readonly consideredOptions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
434
+ readonly whenToUse: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
435
+ readonly escalationPath: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
436
+ readonly researchQuestion: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
437
+ readonly optionsToCompare: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
438
+ readonly apiSurface: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
439
+ }, undefined>, undefined>;
440
+ readonly fragmentIds: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
441
+ readonly agentConfig: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 400, undefined>]>, undefined>, undefined>;
442
+ readonly gates: v.OptionalSchema<v.ArraySchema<v.BooleanSchema<undefined>, undefined>, undefined>;
443
+ }, undefined>, undefined>;
309
444
  }, undefined>;
310
445
  export type InitiativeDraftItem = v.InferOutput<typeof initiativeDraftItemSchema>;
311
446
  /**
@@ -338,6 +473,32 @@ export declare const initiativePlanDraftSchema: v.ObjectSchema<{
338
473
  readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
339
474
  }, undefined>, undefined>;
340
475
  readonly pipelineId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
476
+ /** Preset-authored spawn decoration (a `seedPlan` may enforce/override it at ingest). */
477
+ readonly spawn: v.OptionalSchema<v.ObjectSchema<{
478
+ readonly taskTypeFields: v.OptionalSchema<v.ObjectSchema<{
479
+ readonly severity: v.OptionalSchema<v.PicklistSchema<["low", "medium", "high", "critical"], undefined>, undefined>;
480
+ readonly stepsToReproduce: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
481
+ readonly timeboxHours: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, undefined>;
482
+ readonly docKind: v.OptionalSchema<v.PicklistSchema<readonly ["prd", "rfc", "adr", "design", "technical", "api", "runbook", "research", "reference", "other"], undefined>, undefined>;
483
+ readonly audience: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 300, undefined>]>, undefined>;
484
+ readonly targetPath: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 300, undefined>, v.CheckAction<string, "targetPath must be a relative path inside the repo, ending in .md, with no \"..\", absolute, or backslash segments.">]>, undefined>;
485
+ readonly outlineHints: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 4000, undefined>]>, undefined>;
486
+ readonly targetUsers: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
487
+ readonly successMetrics: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
488
+ readonly alternativesConsidered: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
489
+ readonly rolloutConcerns: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
490
+ readonly decisionDrivers: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
491
+ readonly consideredOptions: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
492
+ readonly whenToUse: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
493
+ readonly escalationPath: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
494
+ readonly researchQuestion: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
495
+ readonly optionsToCompare: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
496
+ readonly apiSurface: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
497
+ }, undefined>, undefined>;
498
+ readonly fragmentIds: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>;
499
+ readonly agentConfig: v.OptionalSchema<v.RecordSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>, v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 400, undefined>]>, undefined>, undefined>;
500
+ readonly gates: v.OptionalSchema<v.ArraySchema<v.BooleanSchema<undefined>, undefined>, undefined>;
501
+ }, undefined>, undefined>;
341
502
  }, undefined>, undefined>;
342
503
  readonly policy: v.ObjectSchema<{
343
504
  /** Max concurrently-running spawned tasks across the whole initiative. */
@@ -1 +1 @@
1
- {"version":3,"file":"initiative.d.ts","sourceRoot":"","sources":["../src/initiative.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAwB5B,eAAO,MAAM,iBAAiB,KAAK,CAAA;AACnC,eAAO,MAAM,oBAAoB,MAAM,CAAA;AACvC,eAAO,MAAM,oBAAoB,OAAO,CAAA;AACxC,eAAO,MAAM,oBAAoB,OAAO,CAAA;AACxC,eAAO,MAAM,yBAAyB,KAAK,CAAA;AAQ3C,gFAAgF;AAChF,eAAO,MAAM,0BAA0B,kGAOrC,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,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,mBAAmB,CAAC,GAAG,EAAE,iBAAiB,GAAG,UAAU,GAAG,IAAI,CAmB7E;AAED,uEAAuE;AACvE,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAE5E;AAED,gFAAgF;AAChF,eAAO,MAAM,iCAAiC,EAAE,WAAW,CAAC,oBAAoB,CAG9E,CAAA"}
@@ -1,4 +1,6 @@
1
1
  import * as v from 'valibot';
2
+ import { taskTypeFieldsSchema } from './primitives.js';
3
+ import { agentConfigValuesSchema } from './agent-config.js';
2
4
  // ---------------------------------------------------------------------------
3
5
  // Initiative wire contracts. An Initiative is the longer-running counterpart to
4
6
  // a task: a multi-phase body of work (a cross-cutting refactor, a migration, a
@@ -30,6 +32,27 @@ const idField = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(INITIAT
30
32
  const titleField = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(INITIATIVE_TITLE_MAX));
31
33
  const proseField = v.pipe(v.string(), v.maxLength(INITIATIVE_PROSE_MAX));
32
34
  const shortProseField = v.pipe(v.string(), v.maxLength(INITIATIVE_SHORT_MAX));
35
+ // ---------------------------------------------------------------------------
36
+ // Initiative-preset inputs. A preset (see `initiative-preset.ts`) bundles a
37
+ // backend-supplied FORM the user fills at create time; the filled values are this
38
+ // bounded JSON record, persisted on the entity (`presetInputs`) and FROZEN after
39
+ // create. Kept HERE (with the entity that persists them, next to the item `spawn`
40
+ // bag) rather than in `initiative-preset.ts` so the entity can reference the shape
41
+ // without a module cycle — the preset descriptor imports these back the other way.
42
+ // ---------------------------------------------------------------------------
43
+ /** Bound on a single string / string-array element value in {@link initiativePresetInputsSchema}. */
44
+ export const INITIATIVE_PRESET_INPUT_MAX = 2000;
45
+ /** Bound on the number of elements in a `checkbox-group`/multi-value input. */
46
+ export const INITIATIVE_PRESET_INPUT_ARRAY_MAX = 50;
47
+ /** One filled preset-form value: a scalar (`text`/`select`/`path`/…), a multi-select, a toggle, or a number. */
48
+ export const initiativePresetInputValueSchema = v.union([
49
+ v.pipe(v.string(), v.maxLength(INITIATIVE_PRESET_INPUT_MAX)),
50
+ v.pipe(v.array(v.pipe(v.string(), v.maxLength(INITIATIVE_PRESET_INPUT_MAX))), v.maxLength(INITIATIVE_PRESET_INPUT_ARRAY_MAX)),
51
+ v.boolean(),
52
+ v.number(),
53
+ ]);
54
+ /** The user's filled preset form — a bounded map from field `key` to its value. */
55
+ export const initiativePresetInputsSchema = v.record(v.pipe(v.string(), v.minLength(1), v.maxLength(INITIATIVE_ID_MAX)), initiativePresetInputValueSchema);
33
56
  /** Lifecycle of a single tracker item (one unit of work → one spawned task). */
34
57
  export const initiativeItemStatusSchema = v.picklist([
35
58
  'pending',
@@ -99,6 +122,23 @@ export const initiativePhaseSchema = v.object({
99
122
  /** Optional tighter concurrency cap for this phase alone. */
100
123
  maxConcurrent: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(INITIATIVE_MAX_CONCURRENT))),
101
124
  });
125
+ /**
126
+ * Preset-authored decoration for a spawned task, folded onto the task block by the
127
+ * execution loop's `buildTaskBlock` (slice 5) so an item comes out as a first-class typed
128
+ * task rather than a bare description block. Every field is optional and additive:
129
+ * - `taskTypeFields` — the per-type block fields (a doc task's `targetPath`/`docKind`, …).
130
+ * - `fragmentIds` — best-practice prompt fragments to stamp on the block.
131
+ * - `agentConfig` — per-agent-kind config values for the spawned pipeline.
132
+ * - `gates` — a per-run gate override (parallel to the pipeline's steps, one
133
+ * boolean each), threaded through the slice-2 gate-override seam.
134
+ * Emitted by the planner (via the draft item) and/or enforced by a preset's `seedPlan`.
135
+ */
136
+ export const initiativeItemSpawnSchema = v.object({
137
+ taskTypeFields: v.optional(taskTypeFieldsSchema),
138
+ fragmentIds: v.optional(v.array(v.string())),
139
+ agentConfig: v.optional(agentConfigValuesSchema),
140
+ gates: v.optional(v.array(v.boolean())),
141
+ });
102
142
  /** One unit of work in the tracker — spawned just-in-time as a task block. */
103
143
  export const initiativeItemSchema = v.object({
104
144
  id: idField,
@@ -120,6 +160,8 @@ export const initiativeItemSchema = v.object({
120
160
  pr: v.optional(v.object({ url: v.string(), number: v.optional(v.number()) })),
121
161
  /** Loop/human annotation — e.g. the failure detail that blocked the item. */
122
162
  note: v.optional(shortProseField),
163
+ /** Preset-authored spawn decoration stamped onto the spawned task block (slice 5). */
164
+ spawn: v.optional(initiativeItemSpawnSchema),
123
165
  });
124
166
  /** A decision recorded on the tracker (made during planning or mid-flight). */
125
167
  export const initiativeDecisionSchema = v.object({
@@ -188,6 +230,16 @@ export const initiativeSchema = v.object({
188
230
  /** Stable slug naming the in-repo tracker folder (`docs/initiatives/<slug>/`). */
189
231
  slug: idField,
190
232
  title: titleField,
233
+ /**
234
+ * The initiative-preset this initiative was created from (see `initiative-preset.ts`).
235
+ * Absent ⇒ a preset-less initiative created by an old client / the public API — its
236
+ * behaviour is byte-for-byte today's (the generic pipeline, human review on). The SPA
237
+ * picker seeds `preset_generic` for new initiatives, but a preset only ever ADDS context;
238
+ * nothing in the planning/loop path branches on its presence.
239
+ */
240
+ presetId: v.optional(idField),
241
+ /** The user's filled preset form, FROZEN at create (the `agentConfig` freeze precedent). */
242
+ presetInputs: v.optional(initiativePresetInputsSchema),
191
243
  /** The agreed goal statement (from planning). */
192
244
  goal: v.optional(proseField, ''),
193
245
  constraints: v.optional(v.array(shortProseField), []),
@@ -228,6 +280,8 @@ export const initiativeDraftItemSchema = v.object({
228
280
  dependsOn: v.optional(v.array(idField), []),
229
281
  estimate: v.optional(initiativeEstimateSchema),
230
282
  pipelineId: v.optional(idField),
283
+ /** Preset-authored spawn decoration (a `seedPlan` may enforce/override it at ingest). */
284
+ spawn: v.optional(initiativeItemSpawnSchema),
231
285
  });
232
286
  /**
233
287
  * The `initiative-planner` agent's structured output: the multi-phase plan minus