@cat-factory/contracts 0.86.0 → 0.88.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 (70) hide show
  1. package/dist/agent-presentation.d.ts +2 -2
  2. package/dist/entities.d.ts +31 -1
  3. package/dist/entities.d.ts.map +1 -1
  4. package/dist/entities.js +30 -0
  5. package/dist/entities.js.map +1 -1
  6. package/dist/events.d.ts +11 -0
  7. package/dist/events.d.ts.map +1 -1
  8. package/dist/index.d.ts +3 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +3 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/initiative.d.ts +408 -0
  13. package/dist/initiative.d.ts.map +1 -0
  14. package/dist/initiative.js +325 -0
  15. package/dist/initiative.js.map +1 -0
  16. package/dist/primitives.d.ts +5 -2
  17. package/dist/primitives.d.ts.map +1 -1
  18. package/dist/primitives.js +5 -2
  19. package/dist/primitives.js.map +1 -1
  20. package/dist/public-api-keys.d.ts +54 -0
  21. package/dist/public-api-keys.d.ts.map +1 -0
  22. package/dist/public-api-keys.js +42 -0
  23. package/dist/public-api-keys.js.map +1 -0
  24. package/dist/public-api.d.ts +57 -0
  25. package/dist/public-api.d.ts.map +1 -0
  26. package/dist/public-api.js +50 -0
  27. package/dist/public-api.js.map +1 -0
  28. package/dist/result-views.d.ts +1 -1
  29. package/dist/result-views.d.ts.map +1 -1
  30. package/dist/result-views.js +1 -0
  31. package/dist/result-views.js.map +1 -1
  32. package/dist/routes/agent-runs.d.ts +2 -0
  33. package/dist/routes/agent-runs.d.ts.map +1 -1
  34. package/dist/routes/board.d.ts +30 -10
  35. package/dist/routes/board.d.ts.map +1 -1
  36. package/dist/routes/execution.d.ts +14 -2
  37. package/dist/routes/execution.d.ts.map +1 -1
  38. package/dist/routes/human-review.d.ts +1 -0
  39. package/dist/routes/human-review.d.ts.map +1 -1
  40. package/dist/routes/human-test.d.ts +5 -0
  41. package/dist/routes/human-test.d.ts.map +1 -1
  42. package/dist/routes/index.d.ts +2 -0
  43. package/dist/routes/index.d.ts.map +1 -1
  44. package/dist/routes/index.js +2 -0
  45. package/dist/routes/index.js.map +1 -1
  46. package/dist/routes/initiative.d.ts +663 -0
  47. package/dist/routes/initiative.d.ts.map +1 -0
  48. package/dist/routes/initiative.js +45 -0
  49. package/dist/routes/initiative.js.map +1 -0
  50. package/dist/routes/pipelines.d.ts +6 -0
  51. package/dist/routes/pipelines.d.ts.map +1 -1
  52. package/dist/routes/public-api.d.ts +206 -0
  53. package/dist/routes/public-api.d.ts.map +1 -0
  54. package/dist/routes/public-api.js +48 -0
  55. package/dist/routes/public-api.js.map +1 -0
  56. package/dist/routes/tasks.d.ts +9 -3
  57. package/dist/routes/tasks.d.ts.map +1 -1
  58. package/dist/routes/visual-confirm.d.ts +3 -0
  59. package/dist/routes/visual-confirm.d.ts.map +1 -1
  60. package/dist/routes/workspaces.d.ts +182 -4
  61. package/dist/routes/workspaces.d.ts.map +1 -1
  62. package/dist/snapshot.d.ts +97 -2
  63. package/dist/snapshot.d.ts.map +1 -1
  64. package/dist/snapshot.js +8 -0
  65. package/dist/snapshot.js.map +1 -1
  66. package/dist/visual-pipeline.d.ts +12 -6
  67. package/dist/visual-pipeline.d.ts.map +1 -1
  68. package/dist/visual-pipeline.js +12 -6
  69. package/dist/visual-pipeline.js.map +1 -1
  70. package/package.json +1 -1
@@ -0,0 +1,408 @@
1
+ import * as v from 'valibot';
2
+ export declare const INITIATIVE_ID_MAX = 80;
3
+ export declare const INITIATIVE_TITLE_MAX = 200;
4
+ export declare const INITIATIVE_PROSE_MAX = 8000;
5
+ export declare const INITIATIVE_SHORT_MAX = 2000;
6
+ export declare const INITIATIVE_MAX_CONCURRENT = 20;
7
+ /** Lifecycle of a single tracker item (one unit of work → one spawned task). */
8
+ export declare const initiativeItemStatusSchema: v.PicklistSchema<["pending", "in_progress", "pr_open", "done", "blocked", "skipped"], undefined>;
9
+ export type InitiativeItemStatus = v.InferOutput<typeof initiativeItemStatusSchema>;
10
+ /** Lifecycle of the initiative as a whole. */
11
+ export declare const initiativeStatusSchema: v.PicklistSchema<["planning", "awaiting_approval", "executing", "paused", "done", "cancelled"], undefined>;
12
+ export type InitiativeStatus = v.InferOutput<typeof initiativeStatusSchema>;
13
+ /**
14
+ * A planner-authored triage of one item on the task-estimator axes. Stamped onto
15
+ * the spawned block's `estimate` (with `createdAt`/`model` added) so downstream
16
+ * estimate-gated steps see it, and matched against the initiative's pipeline
17
+ * rules to pick the task's pipeline.
18
+ */
19
+ export declare const initiativeEstimateSchema: v.ObjectSchema<{
20
+ readonly complexity: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
21
+ readonly risk: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
22
+ readonly impact: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
23
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
24
+ }, undefined>;
25
+ export type InitiativeEstimate = v.InferOutput<typeof initiativeEstimateSchema>;
26
+ /**
27
+ * One ordered pipeline-selection rule: the item's estimate matches when ANY
28
+ * supplied axis is met or exceeded (OR across axes — the `StepGating` semantics
29
+ * of `shouldRunGatedStep`). First matching rule wins; no match falls through to
30
+ * the policy's `defaultPipelineId`. A rule with no thresholds never matches.
31
+ */
32
+ export declare const initiativePipelineRuleSchema: v.ObjectSchema<{
33
+ readonly pipelineId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
34
+ readonly minComplexity: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
35
+ readonly minRisk: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
36
+ readonly minImpact: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
37
+ }, undefined>;
38
+ export type InitiativePipelineRule = v.InferOutput<typeof initiativePipelineRuleSchema>;
39
+ /**
40
+ * How the execution loop runs the plan: how many tasks may be in flight at once,
41
+ * and which pipeline each spawned task gets. Agreed during planning.
42
+ */
43
+ export declare const initiativeExecutionPolicySchema: v.ObjectSchema<{
44
+ /** Max concurrently-running spawned tasks across the whole initiative. */
45
+ readonly maxConcurrent: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 20, undefined>]>;
46
+ /** Ordered estimate→pipeline rules; first match wins. */
47
+ readonly rules: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
48
+ readonly pipelineId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
49
+ readonly minComplexity: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
50
+ readonly minRisk: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
51
+ readonly minImpact: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
52
+ }, undefined>, undefined>, readonly []>;
53
+ /** Pipeline used when no rule matches (or the item carries no estimate). */
54
+ readonly defaultPipelineId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
55
+ /**
56
+ * What to do when an item has NO estimate: `default` uses `defaultPipelineId`;
57
+ * `strongest` uses the last rule's pipeline (rules are ordered weakest-first),
58
+ * fail-safe to thoroughness.
59
+ */
60
+ readonly onMissingEstimate: v.OptionalSchema<v.PicklistSchema<["default", "strongest"], undefined>, "default">;
61
+ }, undefined>;
62
+ export type InitiativeExecutionPolicy = v.InferOutput<typeof initiativeExecutionPolicySchema>;
63
+ /** One phase of the plan. Array order IS the phase order; phases run sequentially. */
64
+ export declare const initiativePhaseSchema: v.ObjectSchema<{
65
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
66
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
67
+ /** What this phase achieves — shown on the tracker, not fed to agents. */
68
+ readonly goal: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
69
+ /** Optional tighter concurrency cap for this phase alone. */
70
+ 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
+ }, undefined>;
72
+ export type InitiativePhase = v.InferOutput<typeof initiativePhaseSchema>;
73
+ /** One unit of work in the tracker — spawned just-in-time as a task block. */
74
+ export declare const initiativeItemSchema: v.ObjectSchema<{
75
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
76
+ /** The owning phase (must reference a `phases[].id`). */
77
+ readonly phaseId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
78
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
79
+ /** The spawned task's description — written to be self-sufficient. */
80
+ readonly description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 8000, undefined>]>;
81
+ /** Intra-initiative item ids that must be `done` before this item may start. */
82
+ readonly dependsOn: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>, readonly []>;
83
+ /** Planner-authored estimate driving pipeline selection (absent ⇒ policy fallback). */
84
+ readonly estimate: v.OptionalSchema<v.ObjectSchema<{
85
+ readonly complexity: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
86
+ readonly risk: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
87
+ readonly impact: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
88
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
89
+ }, undefined>, undefined>;
90
+ /** Explicit pipeline override; absent ⇒ the policy's rules decide. */
91
+ readonly pipelineId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
92
+ readonly status: v.PicklistSchema<["pending", "in_progress", "pr_open", "done", "blocked", "skipped"], undefined>;
93
+ /** Id of the task block the loop spawned for this item; null until spawned. */
94
+ readonly blockId: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
95
+ /** The item's pull request, copied from the spawned block at settlement. */
96
+ readonly pr: v.OptionalSchema<v.ObjectSchema<{
97
+ readonly url: v.StringSchema<undefined>;
98
+ readonly number: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
99
+ }, undefined>, undefined>;
100
+ /** Loop/human annotation — e.g. the failure detail that blocked the item. */
101
+ readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
102
+ }, undefined>;
103
+ export type InitiativeItem = v.InferOutput<typeof initiativeItemSchema>;
104
+ /** A decision recorded on the tracker (made during planning or mid-flight). */
105
+ export declare const initiativeDecisionSchema: v.ObjectSchema<{
106
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
107
+ readonly at: v.NumberSchema<undefined>;
108
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
109
+ readonly detail: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
110
+ readonly source: v.PicklistSchema<["planning", "human", "agent"], undefined>;
111
+ }, undefined>;
112
+ export type InitiativeDecision = v.InferOutput<typeof initiativeDecisionSchema>;
113
+ /** A deviation from the plan discovered mid-flight (e.g. a failed item's cause). */
114
+ export declare const initiativeDeviationSchema: v.ObjectSchema<{
115
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
116
+ readonly at: v.NumberSchema<undefined>;
117
+ /** The item the deviation relates to; null for initiative-wide deviations. */
118
+ readonly itemId: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>, undefined>;
119
+ readonly description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
120
+ readonly resolution: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
121
+ }, undefined>;
122
+ export type InitiativeDeviation = v.InferOutput<typeof initiativeDeviationSchema>;
123
+ /** A follow-up surfaced during execution, awaiting triage into a real item. */
124
+ export declare const initiativeFollowUpSchema: v.ObjectSchema<{
125
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
126
+ readonly at: v.NumberSchema<undefined>;
127
+ /** The item whose run surfaced this follow-up; null when raised by a human. */
128
+ readonly sourceItemId: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>, undefined>;
129
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
130
+ readonly detail: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
131
+ readonly status: v.PicklistSchema<["open", "promoted", "dismissed"], undefined>;
132
+ /** The item this follow-up was promoted into, once `promoted`. */
133
+ readonly promotedItemId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
134
+ }, undefined>;
135
+ export type InitiativeFollowUp = v.InferOutput<typeof initiativeFollowUpSchema>;
136
+ /** A single planning-interview exchange, kept as a bounded digest on the tracker. */
137
+ export declare const initiativeQaSchema: v.ObjectSchema<{
138
+ readonly question: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
139
+ readonly answer: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
140
+ }, undefined>;
141
+ export type InitiativeQa = v.InferOutput<typeof initiativeQaSchema>;
142
+ /**
143
+ * The persisted initiative entity — the DB source of truth the loop mutates and
144
+ * the snapshot carries. `rev` is the optimistic-concurrency token: every write
145
+ * goes through a compare-and-swap on it, making the execution loop a single
146
+ * writer by construction. The current phase is DERIVED (the first phase with a
147
+ * non-`done`/non-`skipped` item), never stored.
148
+ */
149
+ export declare const initiativeSchema: v.ObjectSchema<{
150
+ readonly id: v.StringSchema<undefined>;
151
+ /** The initiative-level board block this entity belongs to (1:1). */
152
+ readonly blockId: v.StringSchema<undefined>;
153
+ /** Stable slug naming the in-repo tracker folder (`docs/initiatives/<slug>/`). */
154
+ readonly slug: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
155
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
156
+ /** The agreed goal statement (from planning). */
157
+ readonly goal: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 8000, undefined>]>, "">;
158
+ readonly constraints: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, readonly []>;
159
+ readonly nonGoals: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, readonly []>;
160
+ /** Bounded digest of the planning interview. */
161
+ readonly qa: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
162
+ readonly question: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
163
+ readonly answer: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
164
+ }, undefined>, undefined>, readonly []>;
165
+ /** Bounded summary of the codebase analysis that informed the plan. */
166
+ readonly analysisSummary: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 8000, undefined>]>, "">;
167
+ readonly phases: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
168
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
169
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
170
+ /** What this phase achieves — shown on the tracker, not fed to agents. */
171
+ readonly goal: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
172
+ /** Optional tighter concurrency cap for this phase alone. */
173
+ 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>;
174
+ }, undefined>, undefined>, readonly []>;
175
+ readonly items: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
176
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
177
+ /** The owning phase (must reference a `phases[].id`). */
178
+ readonly phaseId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
179
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
180
+ /** The spawned task's description — written to be self-sufficient. */
181
+ readonly description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 8000, undefined>]>;
182
+ /** Intra-initiative item ids that must be `done` before this item may start. */
183
+ readonly dependsOn: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>, readonly []>;
184
+ /** Planner-authored estimate driving pipeline selection (absent ⇒ policy fallback). */
185
+ readonly estimate: v.OptionalSchema<v.ObjectSchema<{
186
+ readonly complexity: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
187
+ readonly risk: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
188
+ readonly impact: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
189
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
190
+ }, undefined>, undefined>;
191
+ /** Explicit pipeline override; absent ⇒ the policy's rules decide. */
192
+ readonly pipelineId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
193
+ readonly status: v.PicklistSchema<["pending", "in_progress", "pr_open", "done", "blocked", "skipped"], undefined>;
194
+ /** Id of the task block the loop spawned for this item; null until spawned. */
195
+ readonly blockId: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
196
+ /** The item's pull request, copied from the spawned block at settlement. */
197
+ readonly pr: v.OptionalSchema<v.ObjectSchema<{
198
+ readonly url: v.StringSchema<undefined>;
199
+ readonly number: v.OptionalSchema<v.NumberSchema<undefined>, undefined>;
200
+ }, undefined>, undefined>;
201
+ /** Loop/human annotation — e.g. the failure detail that blocked the item. */
202
+ readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
203
+ }, undefined>, undefined>, readonly []>;
204
+ readonly policy: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
205
+ /** Max concurrently-running spawned tasks across the whole initiative. */
206
+ readonly maxConcurrent: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 20, undefined>]>;
207
+ /** Ordered estimate→pipeline rules; first match wins. */
208
+ readonly rules: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
209
+ readonly pipelineId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
210
+ readonly minComplexity: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
211
+ readonly minRisk: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
212
+ readonly minImpact: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
213
+ }, undefined>, undefined>, readonly []>;
214
+ /** Pipeline used when no rule matches (or the item carries no estimate). */
215
+ readonly defaultPipelineId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
216
+ /**
217
+ * What to do when an item has NO estimate: `default` uses `defaultPipelineId`;
218
+ * `strongest` uses the last rule's pipeline (rules are ordered weakest-first),
219
+ * fail-safe to thoroughness.
220
+ */
221
+ readonly onMissingEstimate: v.OptionalSchema<v.PicklistSchema<["default", "strongest"], undefined>, "default">;
222
+ }, undefined>, undefined>, undefined>;
223
+ readonly decisions: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
224
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
225
+ readonly at: v.NumberSchema<undefined>;
226
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
227
+ readonly detail: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
228
+ readonly source: v.PicklistSchema<["planning", "human", "agent"], undefined>;
229
+ }, undefined>, undefined>, readonly []>;
230
+ readonly deviations: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
231
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
232
+ readonly at: v.NumberSchema<undefined>;
233
+ /** The item the deviation relates to; null for initiative-wide deviations. */
234
+ readonly itemId: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>, undefined>;
235
+ readonly description: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>;
236
+ readonly resolution: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>;
237
+ }, undefined>, undefined>, readonly []>;
238
+ readonly followUps: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
239
+ readonly id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
240
+ readonly at: v.NumberSchema<undefined>;
241
+ /** The item whose run surfaced this follow-up; null when raised by a human. */
242
+ readonly sourceItemId: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>, undefined>;
243
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
244
+ readonly detail: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
245
+ readonly status: v.PicklistSchema<["open", "promoted", "dismissed"], undefined>;
246
+ /** The item this follow-up was promoted into, once `promoted`. */
247
+ readonly promotedItemId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
248
+ }, undefined>, undefined>, readonly []>;
249
+ readonly caveats: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, readonly []>;
250
+ readonly status: v.PicklistSchema<["planning", "awaiting_approval", "executing", "paused", "done", "cancelled"], undefined>;
251
+ /**
252
+ * Repo-mirror bookkeeping: the last committed tracker version + content hash
253
+ * (see {@link initiativeVersionSchema}). Absent until the first commit, or
254
+ * forever on a GitHub-unwired workspace — render from the entity, never assume
255
+ * the mirror exists.
256
+ */
257
+ readonly doc: v.OptionalSchema<v.ObjectSchema<{
258
+ readonly version: v.NumberSchema<undefined>;
259
+ readonly hash: v.StringSchema<undefined>;
260
+ readonly committedAt: v.NumberSchema<undefined>;
261
+ }, undefined>, undefined>;
262
+ /** Optimistic-concurrency token; bumped on every successful write. */
263
+ readonly rev: v.NumberSchema<undefined>;
264
+ readonly createdAt: v.NumberSchema<undefined>;
265
+ readonly updatedAt: v.NumberSchema<undefined>;
266
+ }, undefined>;
267
+ export type Initiative = v.InferOutput<typeof initiativeSchema>;
268
+ /** A draft item as the planner emits it — no runtime fields yet. */
269
+ export declare const initiativeDraftItemSchema: v.ObjectSchema<{
270
+ readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
271
+ readonly phaseId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
272
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
273
+ readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 8000, undefined>]>, "">;
274
+ readonly dependsOn: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>, readonly []>;
275
+ readonly estimate: v.OptionalSchema<v.ObjectSchema<{
276
+ readonly complexity: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
277
+ readonly risk: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
278
+ readonly impact: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
279
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
280
+ }, undefined>, undefined>;
281
+ readonly pipelineId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
282
+ }, undefined>;
283
+ export type InitiativeDraftItem = v.InferOutput<typeof initiativeDraftItemSchema>;
284
+ /**
285
+ * The `initiative-planner` agent's structured output: the multi-phase plan minus
286
+ * all runtime state. Ingest turns it into the persisted entity (`applyPlanDraft`),
287
+ * assigning deterministic ids where the draft omitted them and stamping every
288
+ * item `pending`.
289
+ */
290
+ export declare const initiativePlanDraftSchema: v.ObjectSchema<{
291
+ readonly goal: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 8000, undefined>]>, "">;
292
+ readonly constraints: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, readonly []>;
293
+ readonly nonGoals: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, readonly []>;
294
+ readonly analysisSummary: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 8000, undefined>]>, "">;
295
+ readonly phases: v.ArraySchema<v.ObjectSchema<{
296
+ readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
297
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
298
+ readonly goal: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
299
+ 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>;
300
+ }, undefined>, undefined>;
301
+ readonly items: v.ArraySchema<v.ObjectSchema<{
302
+ readonly id: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
303
+ readonly phaseId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
304
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
305
+ readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 8000, undefined>]>, "">;
306
+ readonly dependsOn: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>, readonly []>;
307
+ readonly estimate: v.OptionalSchema<v.ObjectSchema<{
308
+ readonly complexity: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
309
+ readonly risk: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
310
+ readonly impact: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>;
311
+ readonly rationale: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
312
+ }, undefined>, undefined>;
313
+ readonly pipelineId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
314
+ }, undefined>, undefined>;
315
+ readonly policy: v.ObjectSchema<{
316
+ /** Max concurrently-running spawned tasks across the whole initiative. */
317
+ readonly maxConcurrent: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 20, undefined>]>;
318
+ /** Ordered estimate→pipeline rules; first match wins. */
319
+ readonly rules: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
320
+ readonly pipelineId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
321
+ readonly minComplexity: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
322
+ readonly minRisk: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
323
+ readonly minImpact: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 1, undefined>]>, undefined>;
324
+ }, undefined>, undefined>, readonly []>;
325
+ /** Pipeline used when no rule matches (or the item carries no estimate). */
326
+ readonly defaultPipelineId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>;
327
+ /**
328
+ * What to do when an item has NO estimate: `default` uses `defaultPipelineId`;
329
+ * `strongest` uses the last rule's pipeline (rules are ordered weakest-first),
330
+ * fail-safe to thoroughness.
331
+ */
332
+ readonly onMissingEstimate: v.OptionalSchema<v.PicklistSchema<["default", "strongest"], undefined>, "default">;
333
+ }, undefined>;
334
+ readonly decisions: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
335
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
336
+ readonly detail: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, "">;
337
+ }, undefined>, undefined>, readonly []>;
338
+ readonly caveats: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2000, undefined>]>, undefined>, readonly []>;
339
+ }, undefined>;
340
+ export type InitiativePlanDraft = v.InferOutput<typeof initiativePlanDraftSchema>;
341
+ /** Create an initiative block (+ its empty entity) under a service frame. */
342
+ export declare const createInitiativeSchema: v.ObjectSchema<{
343
+ readonly frameId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
344
+ readonly title: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 200, undefined>]>;
345
+ readonly description: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 8000, undefined>]>, "">;
346
+ }, undefined>;
347
+ export type CreateInitiativeInput = v.InferOutput<typeof createInitiativeSchema>;
348
+ /** Folder, relative to the repo root, that holds all initiative trackers. */
349
+ export declare const INITIATIVE_DOC_DIR = "docs/initiatives";
350
+ /** Folder for one initiative's tracker files. */
351
+ export declare function initiativeDocDir(slug: string): string;
352
+ /**
353
+ * Canonical machine-readable tracker file. This is a CONTENT PROJECTION of the entity, NOT a
354
+ * full `Initiative`: the volatile bookkeeping (`rev`, `updatedAt`, `doc`) is deliberately
355
+ * excluded so its content hash stays stable across no-op DB writes (see
356
+ * `initiativeContentView`/`canonicalInitiativeJson` in `@cat-factory/agents`). Do NOT feed it
357
+ * back through `parseInitiative` — those required fields are absent by design; the DB row, not
358
+ * this file, is the source of truth for the runtime state.
359
+ */
360
+ export declare function initiativeJsonPath(slug: string): string;
361
+ /** Human-readable tracker rendering (the CLAUDE.md tracker-document convention). */
362
+ export declare function initiativeTrackerPath(slug: string): string;
363
+ /** Tiny manifest read for quick staleness checks without parsing the full entity. */
364
+ export declare function initiativeVersionPath(slug: string): string;
365
+ /** The lightweight `version.json` manifest committed alongside the tracker. */
366
+ export declare const initiativeVersionSchema: v.ObjectSchema<{
367
+ readonly version: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
368
+ readonly generatedAt: v.StringSchema<undefined>;
369
+ /** sha256 (hex) of the canonical `initiative.json` bytes. */
370
+ readonly hash: v.StringSchema<undefined>;
371
+ readonly items: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
372
+ }, undefined>;
373
+ export type InitiativeVersion = v.InferOutput<typeof initiativeVersionSchema>;
374
+ /**
375
+ * Strictly parse an arbitrary value into an {@link Initiative}, enforcing the
376
+ * exact schema shape. **Throws** on any violation — use at every trust boundary
377
+ * (reading `initiative.json`, ingesting a stored row).
378
+ */
379
+ export declare function parseInitiative(value: unknown): Initiative;
380
+ /** Non-throwing variant: returns the parsed initiative or `undefined` when invalid. */
381
+ export declare function safeParseInitiative(value: unknown): Initiative | undefined;
382
+ /**
383
+ * The persisted-row shape both facades store an initiative as: the entity as a JSON
384
+ * `doc` blob plus the loop-relevant keys lifted into their own columns (the CAS
385
+ * predicate runs on the `rev` COLUMN, so the columns — not the blob — are authoritative).
386
+ */
387
+ export interface InitiativeRowLike {
388
+ id: string;
389
+ block_id: string;
390
+ slug: string;
391
+ status: string;
392
+ rev: number;
393
+ doc: string;
394
+ created_at: number;
395
+ updated_at: number;
396
+ }
397
+ /**
398
+ * Decode a stored row into the entity, re-imposing the column-lifted keys over the
399
+ * `doc` blob (a corrupt/unparseable row ⇒ null, so a list read can drop it rather than
400
+ * fail the whole board load). Shared by the D1 and Drizzle repositories so the
401
+ * column↔field contract lives in exactly one place and the runtimes can't drift.
402
+ */
403
+ export declare function decodeInitiativeRow(row: InitiativeRowLike): Initiative | null;
404
+ /** Strictly parse a planner plan draft. Throws on shape violations. */
405
+ export declare function parseInitiativePlanDraft(value: unknown): InitiativePlanDraft;
406
+ /** Item statuses that count as settled (nothing left for the loop to drive). */
407
+ export declare const INITIATIVE_ITEM_TERMINAL_STATUSES: ReadonlySet<InitiativeItemStatus>;
408
+ //# sourceMappingURL=initiative.d.ts.map
@@ -0,0 +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,0BAA0B,CAAC,CAAA;AAEnF,8CAA8C;AAC9C,eAAO,MAAM,sBAAsB,4GAOj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