@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.
- package/dist/agent-presentation.d.ts +2 -2
- package/dist/entities.d.ts +31 -1
- package/dist/entities.d.ts.map +1 -1
- package/dist/entities.js +30 -0
- package/dist/entities.js.map +1 -1
- package/dist/events.d.ts +11 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/initiative.d.ts +408 -0
- package/dist/initiative.d.ts.map +1 -0
- package/dist/initiative.js +325 -0
- package/dist/initiative.js.map +1 -0
- package/dist/primitives.d.ts +5 -2
- package/dist/primitives.d.ts.map +1 -1
- package/dist/primitives.js +5 -2
- package/dist/primitives.js.map +1 -1
- package/dist/public-api-keys.d.ts +54 -0
- package/dist/public-api-keys.d.ts.map +1 -0
- package/dist/public-api-keys.js +42 -0
- package/dist/public-api-keys.js.map +1 -0
- package/dist/public-api.d.ts +57 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +50 -0
- package/dist/public-api.js.map +1 -0
- package/dist/result-views.d.ts +1 -1
- package/dist/result-views.d.ts.map +1 -1
- package/dist/result-views.js +1 -0
- package/dist/result-views.js.map +1 -1
- package/dist/routes/agent-runs.d.ts +2 -0
- package/dist/routes/agent-runs.d.ts.map +1 -1
- package/dist/routes/board.d.ts +30 -10
- package/dist/routes/board.d.ts.map +1 -1
- package/dist/routes/execution.d.ts +14 -2
- package/dist/routes/execution.d.ts.map +1 -1
- package/dist/routes/human-review.d.ts +1 -0
- package/dist/routes/human-review.d.ts.map +1 -1
- package/dist/routes/human-test.d.ts +5 -0
- package/dist/routes/human-test.d.ts.map +1 -1
- package/dist/routes/index.d.ts +2 -0
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +2 -0
- package/dist/routes/index.js.map +1 -1
- package/dist/routes/initiative.d.ts +663 -0
- package/dist/routes/initiative.d.ts.map +1 -0
- package/dist/routes/initiative.js +45 -0
- package/dist/routes/initiative.js.map +1 -0
- package/dist/routes/pipelines.d.ts +6 -0
- package/dist/routes/pipelines.d.ts.map +1 -1
- package/dist/routes/public-api.d.ts +206 -0
- package/dist/routes/public-api.d.ts.map +1 -0
- package/dist/routes/public-api.js +48 -0
- package/dist/routes/public-api.js.map +1 -0
- package/dist/routes/tasks.d.ts +9 -3
- package/dist/routes/tasks.d.ts.map +1 -1
- package/dist/routes/visual-confirm.d.ts +3 -0
- package/dist/routes/visual-confirm.d.ts.map +1 -1
- package/dist/routes/workspaces.d.ts +182 -4
- package/dist/routes/workspaces.d.ts.map +1 -1
- package/dist/snapshot.d.ts +97 -2
- package/dist/snapshot.d.ts.map +1 -1
- package/dist/snapshot.js +8 -0
- package/dist/snapshot.js.map +1 -1
- package/dist/visual-pipeline.d.ts +12 -6
- package/dist/visual-pipeline.d.ts.map +1 -1
- package/dist/visual-pipeline.js +12 -6
- package/dist/visual-pipeline.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Initiative wire contracts. An Initiative is the longer-running counterpart to
|
|
4
|
+
// a task: a multi-phase body of work (a cross-cutting refactor, a migration, a
|
|
5
|
+
// strangler conversion) planned once by the Initiative Planning pipeline and
|
|
6
|
+
// then executed as a loop of ordinary tasks until every item is resolved.
|
|
7
|
+
//
|
|
8
|
+
// The DB row (the `initiatives` table, one per initiative-level block) is the
|
|
9
|
+
// SOURCE OF TRUTH: the execution loop needs transactional state (a `rev` CAS
|
|
10
|
+
// token, item↔block mapping) that a Git file cannot provide. The committed
|
|
11
|
+
// in-repo tracker (`docs/initiatives/<slug>/…`) is a deterministic, rendered
|
|
12
|
+
// PROJECTION of this entity — the blueprint artifact pattern — so the plan
|
|
13
|
+
// travels with the code and stays human-readable.
|
|
14
|
+
//
|
|
15
|
+
// Items carry planner-authored estimates (the task-estimator axes) so the loop
|
|
16
|
+
// can pick each spawned task's pipeline by matching the estimate against the
|
|
17
|
+
// initiative's ordered pipeline rules (OR across axes — `StepGating` semantics).
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
// Field length/value bounds, exported as named constants so the lenient coercion in
|
|
20
|
+
// `@cat-factory/agents` (`coerceInitiativePlan`) clamps to the SAME limits this strict schema
|
|
21
|
+
// enforces — a single source of truth, so bumping a bound here can't leave the coercion
|
|
22
|
+
// silently truncating to a stale value (or emitting a plan the parser then rejects).
|
|
23
|
+
export const INITIATIVE_ID_MAX = 80;
|
|
24
|
+
export const INITIATIVE_TITLE_MAX = 200;
|
|
25
|
+
export const INITIATIVE_PROSE_MAX = 8000;
|
|
26
|
+
export const INITIATIVE_SHORT_MAX = 2000;
|
|
27
|
+
export const INITIATIVE_MAX_CONCURRENT = 20;
|
|
28
|
+
const score = v.pipe(v.number(), v.minValue(0), v.maxValue(1));
|
|
29
|
+
const idField = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(INITIATIVE_ID_MAX));
|
|
30
|
+
const titleField = v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(INITIATIVE_TITLE_MAX));
|
|
31
|
+
const proseField = v.pipe(v.string(), v.maxLength(INITIATIVE_PROSE_MAX));
|
|
32
|
+
const shortProseField = v.pipe(v.string(), v.maxLength(INITIATIVE_SHORT_MAX));
|
|
33
|
+
/** Lifecycle of a single tracker item (one unit of work → one spawned task). */
|
|
34
|
+
export const initiativeItemStatusSchema = v.picklist([
|
|
35
|
+
'pending',
|
|
36
|
+
'in_progress',
|
|
37
|
+
'pr_open',
|
|
38
|
+
'done',
|
|
39
|
+
'blocked',
|
|
40
|
+
'skipped',
|
|
41
|
+
]);
|
|
42
|
+
/** Lifecycle of the initiative as a whole. */
|
|
43
|
+
export const initiativeStatusSchema = v.picklist([
|
|
44
|
+
'planning',
|
|
45
|
+
'awaiting_approval',
|
|
46
|
+
'executing',
|
|
47
|
+
'paused',
|
|
48
|
+
'done',
|
|
49
|
+
'cancelled',
|
|
50
|
+
]);
|
|
51
|
+
/**
|
|
52
|
+
* A planner-authored triage of one item on the task-estimator axes. Stamped onto
|
|
53
|
+
* the spawned block's `estimate` (with `createdAt`/`model` added) so downstream
|
|
54
|
+
* estimate-gated steps see it, and matched against the initiative's pipeline
|
|
55
|
+
* rules to pick the task's pipeline.
|
|
56
|
+
*/
|
|
57
|
+
export const initiativeEstimateSchema = v.object({
|
|
58
|
+
complexity: score,
|
|
59
|
+
risk: score,
|
|
60
|
+
impact: score,
|
|
61
|
+
rationale: v.optional(shortProseField, ''),
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* One ordered pipeline-selection rule: the item's estimate matches when ANY
|
|
65
|
+
* supplied axis is met or exceeded (OR across axes — the `StepGating` semantics
|
|
66
|
+
* of `shouldRunGatedStep`). First matching rule wins; no match falls through to
|
|
67
|
+
* the policy's `defaultPipelineId`. A rule with no thresholds never matches.
|
|
68
|
+
*/
|
|
69
|
+
export const initiativePipelineRuleSchema = v.object({
|
|
70
|
+
pipelineId: idField,
|
|
71
|
+
minComplexity: v.optional(score),
|
|
72
|
+
minRisk: v.optional(score),
|
|
73
|
+
minImpact: v.optional(score),
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* How the execution loop runs the plan: how many tasks may be in flight at once,
|
|
77
|
+
* and which pipeline each spawned task gets. Agreed during planning.
|
|
78
|
+
*/
|
|
79
|
+
export const initiativeExecutionPolicySchema = v.object({
|
|
80
|
+
/** Max concurrently-running spawned tasks across the whole initiative. */
|
|
81
|
+
maxConcurrent: v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(INITIATIVE_MAX_CONCURRENT)),
|
|
82
|
+
/** Ordered estimate→pipeline rules; first match wins. */
|
|
83
|
+
rules: v.optional(v.array(initiativePipelineRuleSchema), []),
|
|
84
|
+
/** Pipeline used when no rule matches (or the item carries no estimate). */
|
|
85
|
+
defaultPipelineId: idField,
|
|
86
|
+
/**
|
|
87
|
+
* What to do when an item has NO estimate: `default` uses `defaultPipelineId`;
|
|
88
|
+
* `strongest` uses the last rule's pipeline (rules are ordered weakest-first),
|
|
89
|
+
* fail-safe to thoroughness.
|
|
90
|
+
*/
|
|
91
|
+
onMissingEstimate: v.optional(v.picklist(['default', 'strongest']), 'default'),
|
|
92
|
+
});
|
|
93
|
+
/** One phase of the plan. Array order IS the phase order; phases run sequentially. */
|
|
94
|
+
export const initiativePhaseSchema = v.object({
|
|
95
|
+
id: idField,
|
|
96
|
+
title: titleField,
|
|
97
|
+
/** What this phase achieves — shown on the tracker, not fed to agents. */
|
|
98
|
+
goal: v.optional(shortProseField, ''),
|
|
99
|
+
/** Optional tighter concurrency cap for this phase alone. */
|
|
100
|
+
maxConcurrent: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(INITIATIVE_MAX_CONCURRENT))),
|
|
101
|
+
});
|
|
102
|
+
/** One unit of work in the tracker — spawned just-in-time as a task block. */
|
|
103
|
+
export const initiativeItemSchema = v.object({
|
|
104
|
+
id: idField,
|
|
105
|
+
/** The owning phase (must reference a `phases[].id`). */
|
|
106
|
+
phaseId: idField,
|
|
107
|
+
title: titleField,
|
|
108
|
+
/** The spawned task's description — written to be self-sufficient. */
|
|
109
|
+
description: proseField,
|
|
110
|
+
/** Intra-initiative item ids that must be `done` before this item may start. */
|
|
111
|
+
dependsOn: v.optional(v.array(idField), []),
|
|
112
|
+
/** Planner-authored estimate driving pipeline selection (absent ⇒ policy fallback). */
|
|
113
|
+
estimate: v.optional(initiativeEstimateSchema),
|
|
114
|
+
/** Explicit pipeline override; absent ⇒ the policy's rules decide. */
|
|
115
|
+
pipelineId: v.optional(idField),
|
|
116
|
+
status: initiativeItemStatusSchema,
|
|
117
|
+
/** Id of the task block the loop spawned for this item; null until spawned. */
|
|
118
|
+
blockId: v.optional(v.nullable(v.string())),
|
|
119
|
+
/** The item's pull request, copied from the spawned block at settlement. */
|
|
120
|
+
pr: v.optional(v.object({ url: v.string(), number: v.optional(v.number()) })),
|
|
121
|
+
/** Loop/human annotation — e.g. the failure detail that blocked the item. */
|
|
122
|
+
note: v.optional(shortProseField),
|
|
123
|
+
});
|
|
124
|
+
/** A decision recorded on the tracker (made during planning or mid-flight). */
|
|
125
|
+
export const initiativeDecisionSchema = v.object({
|
|
126
|
+
id: idField,
|
|
127
|
+
at: v.number(),
|
|
128
|
+
title: titleField,
|
|
129
|
+
detail: v.optional(shortProseField, ''),
|
|
130
|
+
source: v.picklist(['planning', 'human', 'agent']),
|
|
131
|
+
});
|
|
132
|
+
/** A deviation from the plan discovered mid-flight (e.g. a failed item's cause). */
|
|
133
|
+
export const initiativeDeviationSchema = v.object({
|
|
134
|
+
id: idField,
|
|
135
|
+
at: v.number(),
|
|
136
|
+
/** The item the deviation relates to; null for initiative-wide deviations. */
|
|
137
|
+
itemId: v.optional(v.nullable(idField)),
|
|
138
|
+
description: shortProseField,
|
|
139
|
+
resolution: v.optional(shortProseField),
|
|
140
|
+
});
|
|
141
|
+
/** A follow-up surfaced during execution, awaiting triage into a real item. */
|
|
142
|
+
export const initiativeFollowUpSchema = v.object({
|
|
143
|
+
id: idField,
|
|
144
|
+
at: v.number(),
|
|
145
|
+
/** The item whose run surfaced this follow-up; null when raised by a human. */
|
|
146
|
+
sourceItemId: v.optional(v.nullable(idField)),
|
|
147
|
+
title: titleField,
|
|
148
|
+
detail: v.optional(shortProseField, ''),
|
|
149
|
+
status: v.picklist(['open', 'promoted', 'dismissed']),
|
|
150
|
+
/** The item this follow-up was promoted into, once `promoted`. */
|
|
151
|
+
promotedItemId: v.optional(idField),
|
|
152
|
+
});
|
|
153
|
+
/** A single planning-interview exchange, kept as a bounded digest on the tracker. */
|
|
154
|
+
export const initiativeQaSchema = v.object({
|
|
155
|
+
question: shortProseField,
|
|
156
|
+
answer: shortProseField,
|
|
157
|
+
});
|
|
158
|
+
/**
|
|
159
|
+
* The persisted initiative entity — the DB source of truth the loop mutates and
|
|
160
|
+
* the snapshot carries. `rev` is the optimistic-concurrency token: every write
|
|
161
|
+
* goes through a compare-and-swap on it, making the execution loop a single
|
|
162
|
+
* writer by construction. The current phase is DERIVED (the first phase with a
|
|
163
|
+
* non-`done`/non-`skipped` item), never stored.
|
|
164
|
+
*/
|
|
165
|
+
export const initiativeSchema = v.object({
|
|
166
|
+
id: v.string(),
|
|
167
|
+
/** The initiative-level board block this entity belongs to (1:1). */
|
|
168
|
+
blockId: v.string(),
|
|
169
|
+
/** Stable slug naming the in-repo tracker folder (`docs/initiatives/<slug>/`). */
|
|
170
|
+
slug: idField,
|
|
171
|
+
title: titleField,
|
|
172
|
+
/** The agreed goal statement (from planning). */
|
|
173
|
+
goal: v.optional(proseField, ''),
|
|
174
|
+
constraints: v.optional(v.array(shortProseField), []),
|
|
175
|
+
nonGoals: v.optional(v.array(shortProseField), []),
|
|
176
|
+
/** Bounded digest of the planning interview. */
|
|
177
|
+
qa: v.optional(v.array(initiativeQaSchema), []),
|
|
178
|
+
/** Bounded summary of the codebase analysis that informed the plan. */
|
|
179
|
+
analysisSummary: v.optional(proseField, ''),
|
|
180
|
+
phases: v.optional(v.array(initiativePhaseSchema), []),
|
|
181
|
+
items: v.optional(v.array(initiativeItemSchema), []),
|
|
182
|
+
policy: v.optional(v.nullable(initiativeExecutionPolicySchema)),
|
|
183
|
+
decisions: v.optional(v.array(initiativeDecisionSchema), []),
|
|
184
|
+
deviations: v.optional(v.array(initiativeDeviationSchema), []),
|
|
185
|
+
followUps: v.optional(v.array(initiativeFollowUpSchema), []),
|
|
186
|
+
caveats: v.optional(v.array(shortProseField), []),
|
|
187
|
+
status: initiativeStatusSchema,
|
|
188
|
+
/**
|
|
189
|
+
* Repo-mirror bookkeeping: the last committed tracker version + content hash
|
|
190
|
+
* (see {@link initiativeVersionSchema}). Absent until the first commit, or
|
|
191
|
+
* forever on a GitHub-unwired workspace — render from the entity, never assume
|
|
192
|
+
* the mirror exists.
|
|
193
|
+
*/
|
|
194
|
+
doc: v.optional(v.object({ version: v.number(), hash: v.string(), committedAt: v.number() })),
|
|
195
|
+
/** Optimistic-concurrency token; bumped on every successful write. */
|
|
196
|
+
rev: v.number(),
|
|
197
|
+
createdAt: v.number(),
|
|
198
|
+
updatedAt: v.number(),
|
|
199
|
+
});
|
|
200
|
+
// ---- Planner output (the plan draft) ---------------------------------------
|
|
201
|
+
/** A draft item as the planner emits it — no runtime fields yet. */
|
|
202
|
+
export const initiativeDraftItemSchema = v.object({
|
|
203
|
+
id: v.optional(idField),
|
|
204
|
+
phaseId: idField,
|
|
205
|
+
title: titleField,
|
|
206
|
+
description: v.optional(proseField, ''),
|
|
207
|
+
dependsOn: v.optional(v.array(idField), []),
|
|
208
|
+
estimate: v.optional(initiativeEstimateSchema),
|
|
209
|
+
pipelineId: v.optional(idField),
|
|
210
|
+
});
|
|
211
|
+
/**
|
|
212
|
+
* The `initiative-planner` agent's structured output: the multi-phase plan minus
|
|
213
|
+
* all runtime state. Ingest turns it into the persisted entity (`applyPlanDraft`),
|
|
214
|
+
* assigning deterministic ids where the draft omitted them and stamping every
|
|
215
|
+
* item `pending`.
|
|
216
|
+
*/
|
|
217
|
+
export const initiativePlanDraftSchema = v.object({
|
|
218
|
+
goal: v.optional(proseField, ''),
|
|
219
|
+
constraints: v.optional(v.array(shortProseField), []),
|
|
220
|
+
nonGoals: v.optional(v.array(shortProseField), []),
|
|
221
|
+
analysisSummary: v.optional(proseField, ''),
|
|
222
|
+
phases: v.array(v.object({
|
|
223
|
+
id: v.optional(idField),
|
|
224
|
+
title: titleField,
|
|
225
|
+
goal: v.optional(shortProseField, ''),
|
|
226
|
+
maxConcurrent: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(INITIATIVE_MAX_CONCURRENT))),
|
|
227
|
+
})),
|
|
228
|
+
items: v.array(initiativeDraftItemSchema),
|
|
229
|
+
policy: initiativeExecutionPolicySchema,
|
|
230
|
+
decisions: v.optional(v.array(v.object({ title: titleField, detail: v.optional(shortProseField, '') })), []),
|
|
231
|
+
caveats: v.optional(v.array(shortProseField), []),
|
|
232
|
+
});
|
|
233
|
+
// ---- Request bodies ---------------------------------------------------------
|
|
234
|
+
/** Create an initiative block (+ its empty entity) under a service frame. */
|
|
235
|
+
export const createInitiativeSchema = v.object({
|
|
236
|
+
frameId: v.pipe(v.string(), v.trim(), v.minLength(1)),
|
|
237
|
+
title: titleField,
|
|
238
|
+
description: v.optional(proseField, ''),
|
|
239
|
+
});
|
|
240
|
+
// ---- In-repo tracker artifact ----------------------------------------------
|
|
241
|
+
// The loop mirrors the entity into the target repo so the plan travels with the
|
|
242
|
+
// code, following the blueprint artifact pattern: a canonical JSON file, a
|
|
243
|
+
// deterministic human-readable markdown rendering, and a tiny version manifest
|
|
244
|
+
// for cheap staleness checks.
|
|
245
|
+
/** Folder, relative to the repo root, that holds all initiative trackers. */
|
|
246
|
+
export const INITIATIVE_DOC_DIR = 'docs/initiatives';
|
|
247
|
+
/** Folder for one initiative's tracker files. */
|
|
248
|
+
export function initiativeDocDir(slug) {
|
|
249
|
+
return `${INITIATIVE_DOC_DIR}/${slug}`;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Canonical machine-readable tracker file. This is a CONTENT PROJECTION of the entity, NOT a
|
|
253
|
+
* full `Initiative`: the volatile bookkeeping (`rev`, `updatedAt`, `doc`) is deliberately
|
|
254
|
+
* excluded so its content hash stays stable across no-op DB writes (see
|
|
255
|
+
* `initiativeContentView`/`canonicalInitiativeJson` in `@cat-factory/agents`). Do NOT feed it
|
|
256
|
+
* back through `parseInitiative` — those required fields are absent by design; the DB row, not
|
|
257
|
+
* this file, is the source of truth for the runtime state.
|
|
258
|
+
*/
|
|
259
|
+
export function initiativeJsonPath(slug) {
|
|
260
|
+
return `${initiativeDocDir(slug)}/initiative.json`;
|
|
261
|
+
}
|
|
262
|
+
/** Human-readable tracker rendering (the CLAUDE.md tracker-document convention). */
|
|
263
|
+
export function initiativeTrackerPath(slug) {
|
|
264
|
+
return `${initiativeDocDir(slug)}/tracker.md`;
|
|
265
|
+
}
|
|
266
|
+
/** Tiny manifest read for quick staleness checks without parsing the full entity. */
|
|
267
|
+
export function initiativeVersionPath(slug) {
|
|
268
|
+
return `${initiativeDocDir(slug)}/version.json`;
|
|
269
|
+
}
|
|
270
|
+
/** The lightweight `version.json` manifest committed alongside the tracker. */
|
|
271
|
+
export const initiativeVersionSchema = v.object({
|
|
272
|
+
version: v.pipe(v.number(), v.integer(), v.minValue(0)),
|
|
273
|
+
generatedAt: v.string(),
|
|
274
|
+
/** sha256 (hex) of the canonical `initiative.json` bytes. */
|
|
275
|
+
hash: v.string(),
|
|
276
|
+
items: v.pipe(v.number(), v.integer(), v.minValue(0)),
|
|
277
|
+
});
|
|
278
|
+
/**
|
|
279
|
+
* Strictly parse an arbitrary value into an {@link Initiative}, enforcing the
|
|
280
|
+
* exact schema shape. **Throws** on any violation — use at every trust boundary
|
|
281
|
+
* (reading `initiative.json`, ingesting a stored row).
|
|
282
|
+
*/
|
|
283
|
+
export function parseInitiative(value) {
|
|
284
|
+
return v.parse(initiativeSchema, value);
|
|
285
|
+
}
|
|
286
|
+
/** Non-throwing variant: returns the parsed initiative or `undefined` when invalid. */
|
|
287
|
+
export function safeParseInitiative(value) {
|
|
288
|
+
const result = v.safeParse(initiativeSchema, value);
|
|
289
|
+
return result.success ? result.output : undefined;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Decode a stored row into the entity, re-imposing the column-lifted keys over the
|
|
293
|
+
* `doc` blob (a corrupt/unparseable row ⇒ null, so a list read can drop it rather than
|
|
294
|
+
* fail the whole board load). Shared by the D1 and Drizzle repositories so the
|
|
295
|
+
* column↔field contract lives in exactly one place and the runtimes can't drift.
|
|
296
|
+
*/
|
|
297
|
+
export function decodeInitiativeRow(row) {
|
|
298
|
+
let parsed;
|
|
299
|
+
try {
|
|
300
|
+
parsed = JSON.parse(row.doc);
|
|
301
|
+
}
|
|
302
|
+
catch {
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
return (safeParseInitiative({
|
|
306
|
+
...(typeof parsed === 'object' && parsed !== null ? parsed : {}),
|
|
307
|
+
id: row.id,
|
|
308
|
+
blockId: row.block_id,
|
|
309
|
+
slug: row.slug,
|
|
310
|
+
status: row.status,
|
|
311
|
+
rev: row.rev,
|
|
312
|
+
createdAt: row.created_at,
|
|
313
|
+
updatedAt: row.updated_at,
|
|
314
|
+
}) ?? null);
|
|
315
|
+
}
|
|
316
|
+
/** Strictly parse a planner plan draft. Throws on shape violations. */
|
|
317
|
+
export function parseInitiativePlanDraft(value) {
|
|
318
|
+
return v.parse(initiativePlanDraftSchema, value);
|
|
319
|
+
}
|
|
320
|
+
/** Item statuses that count as settled (nothing left for the loop to drive). */
|
|
321
|
+
export const INITIATIVE_ITEM_TERMINAL_STATUSES = new Set([
|
|
322
|
+
'done',
|
|
323
|
+
'skipped',
|
|
324
|
+
]);
|
|
325
|
+
//# sourceMappingURL=initiative.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initiative.js","sourceRoot":"","sources":["../src/initiative.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,8EAA8E;AAC9E,gFAAgF;AAChF,+EAA+E;AAC/E,6EAA6E;AAC7E,0EAA0E;AAC1E,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,2EAA2E;AAC3E,6EAA6E;AAC7E,2EAA2E;AAC3E,kDAAkD;AAClD,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,iFAAiF;AACjF,8EAA8E;AAE9E,oFAAoF;AACpF,8FAA8F;AAC9F,wFAAwF;AACxF,qFAAqF;AACrF,MAAM,CAAC,MAAM,iBAAiB,GAAG,EAAE,CAAA;AACnC,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAA;AACvC,MAAM,CAAC,MAA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,CAAC,MAAM;QAClB,GAAG,EAAE,GAAG,CAAC,GAAG;QACZ,SAAS,EAAE,GAAG,CAAC,UAAU;QACzB,SAAS,EAAE,GAAG,CAAC,UAAU;KAC1B,CAAC,IAAI,IAAI,CACX,CAAA;AACH,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,wBAAwB,CAAC,KAAc;IACrD,OAAO,CAAC,CAAC,KAAK,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAAA;AAClD,CAAC;AAED,gFAAgF;AAChF,MAAM,CAAC,MAAM,iCAAiC,GAAsC,IAAI,GAAG,CAAC;IAC1F,MAAM;IACN,SAAS;CACV,CAAC,CAAA"}
|
package/dist/primitives.d.ts
CHANGED
|
@@ -22,9 +22,12 @@ export type BlockStatus = v.InferOutput<typeof blockStatusSchema>;
|
|
|
22
22
|
* structural containment tree (`parentId`); `epic` is a NON-structural grouping
|
|
23
23
|
* node — it groups tasks (which may live under different modules/services) via
|
|
24
24
|
* their `epicId` membership link, not via `parentId`, so deleting an epic never
|
|
25
|
-
* deletes its member tasks.
|
|
25
|
+
* deletes its member tasks. `initiative` is a structural child of a frame (like
|
|
26
|
+
* a module) anchoring a long-running multi-task body of work: its plan lives in
|
|
27
|
+
* the `initiatives` entity, and the tasks its execution loop spawns link back
|
|
28
|
+
* via their `initiativeId` membership link (epic-style, not containment).
|
|
26
29
|
*/
|
|
27
|
-
export declare const blockLevelSchema: v.PicklistSchema<["frame", "module", "task", "epic"], undefined>;
|
|
30
|
+
export declare const blockLevelSchema: v.PicklistSchema<["frame", "module", "task", "epic", "initiative"], undefined>;
|
|
28
31
|
export type BlockLevel = v.InferOutput<typeof blockLevelSchema>;
|
|
29
32
|
/**
|
|
30
33
|
* The kind of work a task represents, chosen by the human at creation. Drives the
|
package/dist/primitives.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../src/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,K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MAAM,cAAc;;;aAGzB,CAAA;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,cAAc,CAAC,CAAA;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;aAGrB,CAAA;AACF,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,UAAU,CAAC,CAAA"}
|
package/dist/primitives.js
CHANGED
|
@@ -40,9 +40,12 @@ export const blockStatusSchema = v.picklist([
|
|
|
40
40
|
* structural containment tree (`parentId`); `epic` is a NON-structural grouping
|
|
41
41
|
* node — it groups tasks (which may live under different modules/services) via
|
|
42
42
|
* their `epicId` membership link, not via `parentId`, so deleting an epic never
|
|
43
|
-
* deletes its member tasks.
|
|
43
|
+
* deletes its member tasks. `initiative` is a structural child of a frame (like
|
|
44
|
+
* a module) anchoring a long-running multi-task body of work: its plan lives in
|
|
45
|
+
* the `initiatives` entity, and the tasks its execution loop spawns link back
|
|
46
|
+
* via their `initiativeId` membership link (epic-style, not containment).
|
|
44
47
|
*/
|
|
45
|
-
export const blockLevelSchema = v.picklist(['frame', 'module', 'task', 'epic']);
|
|
48
|
+
export const blockLevelSchema = v.picklist(['frame', 'module', 'task', 'epic', 'initiative']);
|
|
46
49
|
/**
|
|
47
50
|
* The kind of work a task represents, chosen by the human at creation. Drives the
|
|
48
51
|
* task card's icon/badge, per-type creation fields, and (optionally) the per-service
|
package/dist/primitives.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"primitives.js","sourceRoot":"","sources":["../src/primitives.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,+EAA+E;AAC/E,iFAAiF;AACjF,8BAA8B;AAE9B,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,QAAQ,CAAC;IACxC,UAAU;IACV,SAAS;IACT,SAAS;IACT,UAAU;IACV,KAAK;IACL,UAAU;IACV,OAAO;IACP,a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,QAAQ,CAAC,CAAC,CAAC,CAAC;CACrC,CAAC,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
/** One public-API key as exposed to clients — metadata only, never the secret. */
|
|
3
|
+
export declare const publicApiKeySchema: v.ObjectSchema<{
|
|
4
|
+
/** `pak_*` — also the non-secret lookup id embedded in the raw key. */
|
|
5
|
+
readonly id: v.StringSchema<undefined>;
|
|
6
|
+
readonly accountId: v.StringSchema<undefined>;
|
|
7
|
+
readonly workspaceId: v.StringSchema<undefined>;
|
|
8
|
+
readonly label: v.StringSchema<undefined>;
|
|
9
|
+
readonly createdAt: v.NumberSchema<undefined>;
|
|
10
|
+
readonly lastUsedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
11
|
+
/** Set when the key was revoked (tombstone); a revoked key never authenticates. */
|
|
12
|
+
readonly revokedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
13
|
+
}, undefined>;
|
|
14
|
+
export type PublicApiKey = v.InferOutput<typeof publicApiKeySchema>;
|
|
15
|
+
export declare const publicApiKeyListResultSchema: v.ObjectSchema<{
|
|
16
|
+
readonly keys: v.ArraySchema<v.ObjectSchema<{
|
|
17
|
+
/** `pak_*` — also the non-secret lookup id embedded in the raw key. */
|
|
18
|
+
readonly id: v.StringSchema<undefined>;
|
|
19
|
+
readonly accountId: v.StringSchema<undefined>;
|
|
20
|
+
readonly workspaceId: v.StringSchema<undefined>;
|
|
21
|
+
readonly label: v.StringSchema<undefined>;
|
|
22
|
+
readonly createdAt: v.NumberSchema<undefined>;
|
|
23
|
+
readonly lastUsedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
24
|
+
/** Set when the key was revoked (tombstone); a revoked key never authenticates. */
|
|
25
|
+
readonly revokedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
26
|
+
}, undefined>, undefined>;
|
|
27
|
+
}, undefined>;
|
|
28
|
+
export type PublicApiKeyListResult = v.InferOutput<typeof publicApiKeyListResultSchema>;
|
|
29
|
+
/** Mint a new key. Only a label is supplied; the scope comes from the mounting workspace. */
|
|
30
|
+
export declare const createPublicApiKeySchema: v.ObjectSchema<{
|
|
31
|
+
readonly label: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 120, undefined>]>;
|
|
32
|
+
}, undefined>;
|
|
33
|
+
export type CreatePublicApiKeyInput = v.InferOutput<typeof createPublicApiKeySchema>;
|
|
34
|
+
/**
|
|
35
|
+
* The create response: the key metadata PLUS the raw secret (`cf_live_<id>.<secret>`),
|
|
36
|
+
* returned exactly once and never again — the caller must store it now.
|
|
37
|
+
*/
|
|
38
|
+
export declare const createdPublicApiKeySchema: v.ObjectSchema<{
|
|
39
|
+
readonly key: v.ObjectSchema<{
|
|
40
|
+
/** `pak_*` — also the non-secret lookup id embedded in the raw key. */
|
|
41
|
+
readonly id: v.StringSchema<undefined>;
|
|
42
|
+
readonly accountId: v.StringSchema<undefined>;
|
|
43
|
+
readonly workspaceId: v.StringSchema<undefined>;
|
|
44
|
+
readonly label: v.StringSchema<undefined>;
|
|
45
|
+
readonly createdAt: v.NumberSchema<undefined>;
|
|
46
|
+
readonly lastUsedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
47
|
+
/** Set when the key was revoked (tombstone); a revoked key never authenticates. */
|
|
48
|
+
readonly revokedAt: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
|
|
49
|
+
}, undefined>;
|
|
50
|
+
/** The full raw key, shown once. Store it — it is not recoverable. */
|
|
51
|
+
readonly secret: v.StringSchema<undefined>;
|
|
52
|
+
}, undefined>;
|
|
53
|
+
export type CreatedPublicApiKey = v.InferOutput<typeof createdPublicApiKeySchema>;
|
|
54
|
+
//# sourceMappingURL=public-api-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api-keys.d.ts","sourceRoot":"","sources":["../src/public-api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAiB5B,kFAAkF;AAClF,eAAO,MAAM,kBAAkB;IAC7B,uEAAuE;;;;;;;IAOvE,mFAAmF;;aAEnF,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAEnE,eAAO,MAAM,4BAA4B;;QAZvC,uEAAuE;;;;;;;QAOvE,mFAAmF;;;aAKM,CAAA;AAC3F,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,4BAA4B,CAAC,CAAA;AAEvF,6FAA6F;AAC7F,eAAO,MAAM,wBAAwB;;aAEnC,CAAA;AACF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAEpF;;;GAGG;AACH,eAAO,MAAM,yBAAyB;;QAzBpC,uEAAuE;;;;;;;QAOvE,mFAAmF;;;IAoBnF,sEAAsE;;aAEtE,CAAA;AACF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Inbound public-API key wire contracts.
|
|
4
|
+
//
|
|
5
|
+
// Unlike the direct-provider API keys (`api-keys.ts`, OUTBOUND credentials the
|
|
6
|
+
// platform hands to an LLM vendor and therefore stores ENCRYPTED so it can be
|
|
7
|
+
// recovered), a public-API key authenticates an EXTERNAL CALLER to our own
|
|
8
|
+
// `/api/v1` surface. The platform only ever VERIFIES it, never replays it, so
|
|
9
|
+
// the secret is stored as a one-way peppered hash (`HMAC-SHA256(secret,
|
|
10
|
+
// ENCRYPTION_KEY)`) — irrecoverable, DB-leak-resistant. The raw key is returned
|
|
11
|
+
// exactly once, on create; thereafter only metadata is exposed.
|
|
12
|
+
//
|
|
13
|
+
// A key is scoped to one account + workspace: every `/api/v1` call it makes is
|
|
14
|
+
// bound to that workspace.
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
/** One public-API key as exposed to clients — metadata only, never the secret. */
|
|
17
|
+
export const publicApiKeySchema = v.object({
|
|
18
|
+
/** `pak_*` — also the non-secret lookup id embedded in the raw key. */
|
|
19
|
+
id: v.string(),
|
|
20
|
+
accountId: v.string(),
|
|
21
|
+
workspaceId: v.string(),
|
|
22
|
+
label: v.string(),
|
|
23
|
+
createdAt: v.number(),
|
|
24
|
+
lastUsedAt: v.nullable(v.number()),
|
|
25
|
+
/** Set when the key was revoked (tombstone); a revoked key never authenticates. */
|
|
26
|
+
revokedAt: v.nullable(v.number()),
|
|
27
|
+
});
|
|
28
|
+
export const publicApiKeyListResultSchema = v.object({ keys: v.array(publicApiKeySchema) });
|
|
29
|
+
/** Mint a new key. Only a label is supplied; the scope comes from the mounting workspace. */
|
|
30
|
+
export const createPublicApiKeySchema = v.object({
|
|
31
|
+
label: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(120)),
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* The create response: the key metadata PLUS the raw secret (`cf_live_<id>.<secret>`),
|
|
35
|
+
* returned exactly once and never again — the caller must store it now.
|
|
36
|
+
*/
|
|
37
|
+
export const createdPublicApiKeySchema = v.object({
|
|
38
|
+
key: publicApiKeySchema,
|
|
39
|
+
/** The full raw key, shown once. Store it — it is not recoverable. */
|
|
40
|
+
secret: v.string(),
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=public-api-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api-keys.js","sourceRoot":"","sources":["../src/public-api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,8EAA8E;AAC9E,yCAAyC;AACzC,EAAE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AAC,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
/** Start an initiative run. */
|
|
3
|
+
export declare const createInitiativeJobSchema: v.ObjectSchema<{
|
|
4
|
+
/** Id of a PUBLIC, inline pipeline (e.g. `pl_initiative_breakdown`). */
|
|
5
|
+
readonly pipelineId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
6
|
+
/** The initiative brief — becomes the run's task description. */
|
|
7
|
+
readonly input: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 50000, undefined>]>;
|
|
8
|
+
/** Optional human-readable title for the run; defaults to a truncated `input`. */
|
|
9
|
+
readonly title: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MaxLengthAction<string, 200, undefined>]>, undefined>;
|
|
10
|
+
}, undefined>;
|
|
11
|
+
export type CreateInitiativeJobInput = v.InferOutput<typeof createInitiativeJobSchema>;
|
|
12
|
+
/**
|
|
13
|
+
* The coarse public job status, mapped from the internal execution status:
|
|
14
|
+
* `done` → `succeeded`, `failed` → `failed`, everything else (running / paused /
|
|
15
|
+
* blocked) → `running`. External callers never see the block/board internals.
|
|
16
|
+
*/
|
|
17
|
+
export declare const publicJobStatusSchema: v.PicklistSchema<["running", "succeeded", "failed"], undefined>;
|
|
18
|
+
export type PublicJobStatus = v.InferOutput<typeof publicJobStatusSchema>;
|
|
19
|
+
/** The persisted result of a finished run — the terminal step's output. */
|
|
20
|
+
export declare const publicJobResultSchema: v.ObjectSchema<{
|
|
21
|
+
/** The agent's prose output (the final reply). */
|
|
22
|
+
readonly output: v.StringSchema<undefined>;
|
|
23
|
+
/** The structured decomposition, when the agent produced one (`step.custom`). */
|
|
24
|
+
readonly data: v.NullableSchema<v.UnknownSchema, undefined>;
|
|
25
|
+
}, undefined>;
|
|
26
|
+
export type PublicJobResult = v.InferOutput<typeof publicJobResultSchema>;
|
|
27
|
+
/** A public job resource — the external view of a headless initiative run. */
|
|
28
|
+
export declare const publicJobSchema: v.ObjectSchema<{
|
|
29
|
+
readonly jobId: v.StringSchema<undefined>;
|
|
30
|
+
readonly status: v.PicklistSchema<["running", "succeeded", "failed"], undefined>;
|
|
31
|
+
readonly pipelineId: v.StringSchema<undefined>;
|
|
32
|
+
readonly createdAt: v.NumberSchema<undefined>;
|
|
33
|
+
/** Present once the run reaches `succeeded`; null while running or on failure. */
|
|
34
|
+
readonly result: v.NullableSchema<v.ObjectSchema<{
|
|
35
|
+
/** The agent's prose output (the final reply). */
|
|
36
|
+
readonly output: v.StringSchema<undefined>;
|
|
37
|
+
/** The structured decomposition, when the agent produced one (`step.custom`). */
|
|
38
|
+
readonly data: v.NullableSchema<v.UnknownSchema, undefined>;
|
|
39
|
+
}, undefined>, undefined>;
|
|
40
|
+
/** Present when `status` is `failed`; null otherwise. */
|
|
41
|
+
readonly error: v.NullableSchema<v.ObjectSchema<{
|
|
42
|
+
readonly code: v.StringSchema<undefined>;
|
|
43
|
+
readonly message: v.StringSchema<undefined>;
|
|
44
|
+
}, undefined>, undefined>;
|
|
45
|
+
}, undefined>;
|
|
46
|
+
export type PublicJob = v.InferOutput<typeof publicJobSchema>;
|
|
47
|
+
/** The `202` returned by `POST /initiatives`: the job id + where to follow it. */
|
|
48
|
+
export declare const initiativeAcceptedSchema: v.ObjectSchema<{
|
|
49
|
+
readonly jobId: v.StringSchema<undefined>;
|
|
50
|
+
readonly status: v.PicklistSchema<["running", "succeeded", "failed"], undefined>;
|
|
51
|
+
readonly links: v.ObjectSchema<{
|
|
52
|
+
readonly self: v.StringSchema<undefined>;
|
|
53
|
+
readonly events: v.StringSchema<undefined>;
|
|
54
|
+
}, undefined>;
|
|
55
|
+
}, undefined>;
|
|
56
|
+
export type InitiativeAccepted = v.InferOutput<typeof initiativeAcceptedSchema>;
|
|
57
|
+
//# sourceMappingURL=public-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api.d.ts","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAY5B,+BAA+B;AAC/B,eAAO,MAAM,yBAAyB;IACpC,wEAAwE;;IAExE,iEAAiE;;IAEjE,kFAAkF;;aAElF,CAAA;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAEtF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,iEAAiD,CAAA;AACnF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE,2EAA2E;AAC3E,eAAO,MAAM,qBAAqB;IAChC,kDAAkD;;IAElD,iFAAiF;;aAEjF,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEzE,8EAA8E;AAC9E,eAAO,MAAM,eAAe;;;;;IAK1B,kFAAkF;;QAblF,kDAAkD;;QAElD,iFAAiF;;;IAajF,yDAAyD;;;;;aAEzD,CAAA;AACF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,eAAe,CAAC,CAAA;AAE7D,kFAAkF;AAClF,eAAO,MAAM,wBAAwB;;;;;;;aAInC,CAAA;AACF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Public-API wire contracts (the `/api/v1` surface for external systems).
|
|
4
|
+
//
|
|
5
|
+
// First use-case: "break down an initiative". An external caller picks a public,
|
|
6
|
+
// inline (no-GitHub) pipeline and supplies an initial brief; the platform runs it
|
|
7
|
+
// headlessly and persists the result in the DB for asynchronous retrieval (poll
|
|
8
|
+
// `GET /jobs/:id` or subscribe to `GET /jobs/:id/events` over SSE). Nothing is
|
|
9
|
+
// committed to GitHub.
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
/** Start an initiative run. */
|
|
12
|
+
export const createInitiativeJobSchema = v.object({
|
|
13
|
+
/** Id of a PUBLIC, inline pipeline (e.g. `pl_initiative_breakdown`). */
|
|
14
|
+
pipelineId: v.pipe(v.string(), v.trim(), v.minLength(1)),
|
|
15
|
+
/** The initiative brief — becomes the run's task description. */
|
|
16
|
+
input: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(50_000)),
|
|
17
|
+
/** Optional human-readable title for the run; defaults to a truncated `input`. */
|
|
18
|
+
title: v.optional(v.pipe(v.string(), v.trim(), v.maxLength(200))),
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* The coarse public job status, mapped from the internal execution status:
|
|
22
|
+
* `done` → `succeeded`, `failed` → `failed`, everything else (running / paused /
|
|
23
|
+
* blocked) → `running`. External callers never see the block/board internals.
|
|
24
|
+
*/
|
|
25
|
+
export const publicJobStatusSchema = v.picklist(['running', 'succeeded', 'failed']);
|
|
26
|
+
/** The persisted result of a finished run — the terminal step's output. */
|
|
27
|
+
export const publicJobResultSchema = v.object({
|
|
28
|
+
/** The agent's prose output (the final reply). */
|
|
29
|
+
output: v.string(),
|
|
30
|
+
/** The structured decomposition, when the agent produced one (`step.custom`). */
|
|
31
|
+
data: v.nullable(v.unknown()),
|
|
32
|
+
});
|
|
33
|
+
/** A public job resource — the external view of a headless initiative run. */
|
|
34
|
+
export const publicJobSchema = v.object({
|
|
35
|
+
jobId: v.string(),
|
|
36
|
+
status: publicJobStatusSchema,
|
|
37
|
+
pipelineId: v.string(),
|
|
38
|
+
createdAt: v.number(),
|
|
39
|
+
/** Present once the run reaches `succeeded`; null while running or on failure. */
|
|
40
|
+
result: v.nullable(publicJobResultSchema),
|
|
41
|
+
/** Present when `status` is `failed`; null otherwise. */
|
|
42
|
+
error: v.nullable(v.object({ code: v.string(), message: v.string() })),
|
|
43
|
+
});
|
|
44
|
+
/** The `202` returned by `POST /initiatives`: the job id + where to follow it. */
|
|
45
|
+
export const initiativeAcceptedSchema = v.object({
|
|
46
|
+
jobId: v.string(),
|
|
47
|
+
status: publicJobStatusSchema,
|
|
48
|
+
links: v.object({ self: v.string(), events: v.string() }),
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=public-api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-api.js","sourceRoot":"","sources":["../src/public-api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAA;AAE5B,8EAA8E;AAC9E,0EAA0E;AAC1E,EAAE;AACF,iFAAiF;AACjF,kFAAkF;AAClF,gFAAgF;AAChF,+EAA+E;AAC/E,uBAAuB;AACvB,8EAA8E;AAE9E,+BAA+B;AAC/B,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,wEAAwE;IACxE,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACxD,iEAAiE;IACjE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxE,kFAAkF;IAClF,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;CA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