@digital-agora/friday 0.0.0-stage → 0.10.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/LICENSE +21 -0
- package/README.md +296 -2
- package/bundles/friday-claude-0.1.0.zip +0 -0
- package/bundles/friday-opencode-0.1.0.zip +0 -0
- package/dist/adapters/adapter.js +6 -0
- package/dist/adapters/claude/guards.js +40 -0
- package/dist/adapters/claude/index.js +161 -0
- package/dist/adapters/claude/runtime.js +645 -0
- package/dist/adapters/claude/workflows.js +323 -0
- package/dist/adapters/drivers.js +300 -0
- package/dist/adapters/index.js +16 -0
- package/dist/adapters/opencode/index.js +232 -0
- package/dist/adapters/skill.js +327 -0
- package/dist/build.js +77 -0
- package/dist/cli.js +197 -0
- package/dist/frontmatter.js +16 -0
- package/dist/graph.js +218 -0
- package/dist/handoff.js +329 -0
- package/dist/install.js +137 -0
- package/dist/ir.js +177 -0
- package/dist/load.js +42 -0
- package/dist/paths.js +24 -0
- package/dist/prompts.js +230 -0
- package/dist/specialize.js +237 -0
- package/dist/step-schemas.js +444 -0
- package/dist/types.js +8 -0
- package/dist/validate.js +576 -0
- package/pack/conventions/changesets.yaml +20 -0
- package/pack/conventions/ci-workflows.yaml +16 -0
- package/pack/conventions/config-secrets.yaml +16 -0
- package/pack/conventions/data-classification.yaml +16 -0
- package/pack/conventions/decisions.yaml +13 -0
- package/pack/conventions/git.yaml +28 -0
- package/pack/conventions/hexagonal.yaml +31 -0
- package/pack/conventions/security-code.yaml +17 -0
- package/pack/conventions/testing.yaml +44 -0
- package/pack/conventions/typescript-node.yaml +16 -0
- package/pack/model-policy.yaml +80 -0
- package/pack/orchestrations/architecture-decision.yaml +52 -0
- package/pack/orchestrations/bugfix-tdd.yaml +67 -0
- package/pack/orchestrations/data-analysis.yaml +23 -0
- package/pack/orchestrations/discovery.yaml +214 -0
- package/pack/orchestrations/feature-delivery.yaml +129 -0
- package/pack/orchestrations/prompt-delivery.yaml +155 -0
- package/pack/orchestrations/prompt-discovery.yaml +201 -0
- package/pack/orchestrations/release.yaml +40 -0
- package/pack/pack.yaml +137 -0
- package/pack/personas/architect.yaml +18 -0
- package/pack/personas/backend-engineer.yaml +21 -0
- package/pack/personas/data-analyst-non-pii.yaml +14 -0
- package/pack/personas/data-analyst-pii.yaml +28 -0
- package/pack/personas/devops-engineer.yaml +19 -0
- package/pack/personas/frontend-engineer.yaml +18 -0
- package/pack/personas/git-steward.yaml +24 -0
- package/pack/personas/lead-developer.yaml +23 -0
- package/pack/personas/prompt-engineer.yaml +38 -0
- package/pack/personas/qa-engineer.yaml +24 -0
- package/pack/personas/security-steward.yaml +20 -0
- package/package.json +47 -4
- package/schemas/convention.schema.yaml +46 -0
- package/schemas/handoff.schema.yaml +303 -0
- package/schemas/model-policy.schema.yaml +33 -0
- package/schemas/orchestration.schema.yaml +224 -0
- package/schemas/pack.schema.yaml +168 -0
- package/schemas/persona.schema.yaml +41 -0
- package/schemas/specialization-patch.schema.yaml +39 -0
- package/schemas/specialization.schema.yaml +57 -0
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
// JSON Schemas every workflow step's agent must return. Upstream steps always report
|
|
2
|
+
// questions, assumptions and gaps, so nothing is assumed silently ("assumptions kill").
|
|
3
|
+
const str = { type: "string" };
|
|
4
|
+
const strs = { type: "array", items: str };
|
|
5
|
+
// Shared by questions, assumptions and gaps: the runtime merges items of one topic across
|
|
6
|
+
// perspectives, and a close-out round asks the user only what changes behaviour or contradicts.
|
|
7
|
+
const triage = {
|
|
8
|
+
topic: { type: "string", description: "Short kebab-case subject, the same in every step for the same subject (e.g. export-retention). Items with one topic are merged." },
|
|
9
|
+
blocking: { type: "boolean", description: "true only when a downstream agent cannot safely write or test its task without the answer; false means defer it." },
|
|
10
|
+
changesBehaviour: { type: "boolean", description: "Whether the answer changes what is built or how it behaves for a user; independent of whether it blocks planning." },
|
|
11
|
+
contradicts: { ...strs, description: "Ids of recorded answers this item contradicts." },
|
|
12
|
+
};
|
|
13
|
+
export const QUESTION = {
|
|
14
|
+
type: "object",
|
|
15
|
+
required: ["id", "question", "why", "options", "recommended", "topic", "blocking"],
|
|
16
|
+
properties: {
|
|
17
|
+
...triage,
|
|
18
|
+
id: { type: "string", description: "Stable id, e.g. q-retention. Reuse it on re-runs." },
|
|
19
|
+
question: str,
|
|
20
|
+
why: { type: "string", description: "Why the answer matters and what it changes." },
|
|
21
|
+
options: {
|
|
22
|
+
type: "array",
|
|
23
|
+
minItems: 2,
|
|
24
|
+
maxItems: 4,
|
|
25
|
+
items: { type: "object", required: ["label", "description"], properties: { label: str, description: str } },
|
|
26
|
+
},
|
|
27
|
+
recommended: { type: "integer", minimum: 0, description: "Index of the recommended option." },
|
|
28
|
+
proposable: {
|
|
29
|
+
type: "boolean",
|
|
30
|
+
description: "Prompt pyramid levels only: true when the recommended option is defensible from the request, the conventions and the approved levels below, so the person can accept it in the level's list of proposals; false (asked on its own) when it touches personal data, security or data access, or a cost or risk only the person can own.",
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
export const ASSUMPTION = {
|
|
35
|
+
type: "object",
|
|
36
|
+
required: ["id", "assumption", "why", "topic", "blocking"],
|
|
37
|
+
properties: { ...triage, id: str, assumption: str, why: str },
|
|
38
|
+
};
|
|
39
|
+
export const GAP = {
|
|
40
|
+
type: "object",
|
|
41
|
+
required: ["id", "area", "gap", "why", "impact", "solutions", "recommended", "topic", "blocking"],
|
|
42
|
+
properties: {
|
|
43
|
+
...triage,
|
|
44
|
+
id: { type: "string", description: "Stable id, e.g. G-retention. Reuse it on re-runs." },
|
|
45
|
+
area: { enum: ["scope", "architecture", "security", "data", "testing", "ops", "conventions"] },
|
|
46
|
+
gap: str,
|
|
47
|
+
why: { type: "string", description: "Why it is a gap: the convention, decision or information that is missing." },
|
|
48
|
+
impact: { enum: ["low", "medium", "high"] },
|
|
49
|
+
solutions: {
|
|
50
|
+
type: "array",
|
|
51
|
+
minItems: 1,
|
|
52
|
+
maxItems: 4,
|
|
53
|
+
items: { type: "object", required: ["option", "tradeoff"], properties: { option: str, tradeoff: str } },
|
|
54
|
+
},
|
|
55
|
+
recommended: { type: "integer", minimum: 0 },
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
const upstreamProps = {
|
|
59
|
+
summary: str,
|
|
60
|
+
result: { type: "object", description: "Findings and decisions of this step." },
|
|
61
|
+
questions: { type: "array", items: QUESTION },
|
|
62
|
+
assumptions: { type: "array", items: ASSUMPTION, description: "Anything you had to assume. Each becomes a question to the user." },
|
|
63
|
+
gaps: { type: "array", items: GAP },
|
|
64
|
+
};
|
|
65
|
+
export const UPSTREAM = {
|
|
66
|
+
type: "object",
|
|
67
|
+
required: ["summary", "result", "questions", "assumptions", "gaps"],
|
|
68
|
+
properties: upstreamProps,
|
|
69
|
+
};
|
|
70
|
+
const mergedFrom = {
|
|
71
|
+
type: "array",
|
|
72
|
+
items: str,
|
|
73
|
+
description: "Ids of the open items this one replaces (duplicates or overlaps). Keep the id of one of them as this item's id.",
|
|
74
|
+
};
|
|
75
|
+
const merged = (s) => ({ ...s, properties: { ...s.properties, mergedFrom } });
|
|
76
|
+
export const CONTRADICTION = {
|
|
77
|
+
type: "object",
|
|
78
|
+
required: ["id", "conflict", "between", "why", "overlap", "premise", "options", "recommended"],
|
|
79
|
+
properties: {
|
|
80
|
+
id: { type: "string", description: "Stable id, e.g. C-export-format. Reuse it on re-runs." },
|
|
81
|
+
conflict: { type: "string", description: "What contradicts what, in one sentence." },
|
|
82
|
+
between: { ...strs, minItems: 2, description: "The conflicting sources: answer ids, step ids or decision ids." },
|
|
83
|
+
why: { type: "string", description: "Why it matters: what a downstream agent could not build while both stand." },
|
|
84
|
+
overlap: {
|
|
85
|
+
type: "string",
|
|
86
|
+
description: "The inner join: what every conflicting source already holds or accepts. Empty when they share nothing.",
|
|
87
|
+
},
|
|
88
|
+
premise: {
|
|
89
|
+
type: "string",
|
|
90
|
+
description: "The assumption every option rests on, e.g. that the consumer pulls the data (decision 54).",
|
|
91
|
+
},
|
|
92
|
+
options: {
|
|
93
|
+
...QUESTION.properties.options,
|
|
94
|
+
description: 'First the sweet spot: the overlap plus the least each side must add to meet the acceptance criteria. Then each side as it stands. Last "None of these: the premise is wrong".',
|
|
95
|
+
},
|
|
96
|
+
recommended: QUESTION.properties.recommended,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
/** A consolidating gap analysis: the one list of open items the user sees this round. */
|
|
100
|
+
export const CONSOLIDATED = {
|
|
101
|
+
type: "object",
|
|
102
|
+
required: ["summary", "result", "questions", "assumptions", "gaps", "contradictions", "dropped"],
|
|
103
|
+
properties: {
|
|
104
|
+
...upstreamProps,
|
|
105
|
+
questions: { type: "array", items: merged(QUESTION) },
|
|
106
|
+
assumptions: { type: "array", items: merged(ASSUMPTION) },
|
|
107
|
+
gaps: { type: "array", items: merged(GAP) },
|
|
108
|
+
contradictions: { type: "array", items: CONTRADICTION },
|
|
109
|
+
dropped: {
|
|
110
|
+
type: "array",
|
|
111
|
+
description: "Open items from earlier steps you leave out, each with the reason (settled by an answer or a convention, or not blocking).",
|
|
112
|
+
items: { type: "object", required: ["id", "reason"], properties: { id: str, reason: str } },
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
export const TASK = {
|
|
117
|
+
type: "object",
|
|
118
|
+
required: ["id", "title", "stack", "codebase", "taskKind", "acceptance", "dependsOn"],
|
|
119
|
+
properties: {
|
|
120
|
+
id: str,
|
|
121
|
+
title: str,
|
|
122
|
+
stack: str,
|
|
123
|
+
codebase: str,
|
|
124
|
+
scope: { type: "string", description: "Id of the scope this task delivers, one of the scopes the scope step inferred." },
|
|
125
|
+
taskKind: { enum: ["implement", "scaffold", "adapter"] },
|
|
126
|
+
acceptance: { type: "array", minItems: 1, items: str },
|
|
127
|
+
dependsOn: strs,
|
|
128
|
+
conventions: strs,
|
|
129
|
+
lowestLevel: { type: "string", description: "Lowest test pyramid level that proves it (default unit)." },
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
/** A breakdown task: what it proves, the access it needs and the codebases it leaves red (decision 50). */
|
|
133
|
+
const BREAKDOWN_TASK = {
|
|
134
|
+
...TASK,
|
|
135
|
+
properties: {
|
|
136
|
+
...TASK.properties,
|
|
137
|
+
covers: { ...strs, description: "Scope acceptance criteria this task proves: each criterion's id (AC12) or the start of its text." },
|
|
138
|
+
needs: { type: "array", items: { enum: ["registry"] }, description: "registry: a dependency or version bump or a lockfile change, as its own task." },
|
|
139
|
+
breaks: { ...strs, description: "Codebases left red because this task removes or renames a public symbol they use." },
|
|
140
|
+
closedBy: { ...strs, description: "Ids of the tasks that make the codebases in breaks green again." },
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
export const TASKS = {
|
|
144
|
+
type: "object",
|
|
145
|
+
required: ["summary", "result", "questions", "assumptions", "gaps"],
|
|
146
|
+
properties: {
|
|
147
|
+
...upstreamProps,
|
|
148
|
+
result: {
|
|
149
|
+
type: "object",
|
|
150
|
+
required: ["tasks", "acceptance"],
|
|
151
|
+
properties: {
|
|
152
|
+
tasks: { type: "array", minItems: 1, items: BREAKDOWN_TASK },
|
|
153
|
+
acceptance: { ...strs, minItems: 1, description: "Every scope acceptance criterion, as the handoff will list it, each starting with its id (AC1, AC2, ...)." },
|
|
154
|
+
guardChecks: {
|
|
155
|
+
type: "array",
|
|
156
|
+
description: "Each new guard test run (or dry-run) against the current repository.",
|
|
157
|
+
items: {
|
|
158
|
+
type: "object",
|
|
159
|
+
required: ["test", "command", "result"],
|
|
160
|
+
properties: { test: str, command: str, result: { enum: ["pass", "fail", "not-run"] }, findings: str, addressedBy: { ...strs, description: "Task or gap ids that settle a failure." } },
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
/** One task brief (decision 40): the prompt a task's agents receive, and what it relies on. */
|
|
168
|
+
export const TASK_BRIEF = {
|
|
169
|
+
type: "object",
|
|
170
|
+
required: ["task", "text"],
|
|
171
|
+
properties: {
|
|
172
|
+
task: { type: "string", description: "The task id this brief is for; one brief per task." },
|
|
173
|
+
text: { type: "string", description: "The prompt its agents receive, in Markdown sections; only what the handoff holds." },
|
|
174
|
+
contracts: { ...strs, description: "Ids of the handoff's contracts the task consumes." },
|
|
175
|
+
interfaces: { ...strs, description: "Ids of the handoff's interfaceContracts the task consumes." },
|
|
176
|
+
decisions: { ...strs, description: "Ids of the handoff's decisions that apply to the task." },
|
|
177
|
+
files: { ...strs, description: "Files the task may change: only files the build plan gives it." },
|
|
178
|
+
testFiles: { ...strs, description: "Test files the task owns: only those the build plan gives it." },
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
export const BRIEFS = {
|
|
182
|
+
type: "object",
|
|
183
|
+
required: ["summary", "result", "questions", "assumptions", "gaps"],
|
|
184
|
+
properties: {
|
|
185
|
+
...upstreamProps,
|
|
186
|
+
result: {
|
|
187
|
+
type: "object",
|
|
188
|
+
required: ["briefs"],
|
|
189
|
+
properties: { briefs: { type: "array", minItems: 1, items: TASK_BRIEF } },
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
const blocked = {
|
|
194
|
+
type: "object",
|
|
195
|
+
description: "Set with status blocked: what is missing. It goes back upstream; never guess.",
|
|
196
|
+
required: ["reason"],
|
|
197
|
+
properties: { reason: str, questions: strs },
|
|
198
|
+
};
|
|
199
|
+
export const RESULT = {
|
|
200
|
+
type: "object",
|
|
201
|
+
required: ["status", "summary"],
|
|
202
|
+
properties: {
|
|
203
|
+
status: { enum: ["done", "blocked", "failed"] },
|
|
204
|
+
summary: str,
|
|
205
|
+
result: {
|
|
206
|
+
type: "object",
|
|
207
|
+
description: "Structured findings the step's task asks for (e.g. result.contracts, result.standards, result.interfaces, result.plan, result.expectedRed); later steps read them.",
|
|
208
|
+
},
|
|
209
|
+
files: strs,
|
|
210
|
+
checks: { type: "array", items: { type: "object", required: ["command", "result"], properties: { command: str, result: str } } },
|
|
211
|
+
testConflict: {
|
|
212
|
+
type: "object",
|
|
213
|
+
description: "A test written for this task contradicts an existing test or a repository fact. It goes back to test-design, not upstream.",
|
|
214
|
+
required: ["test", "conflictsWith", "why"],
|
|
215
|
+
properties: { test: str, conflictsWith: { type: "string", description: "The existing test or repo fact." }, why: str },
|
|
216
|
+
},
|
|
217
|
+
blocked,
|
|
218
|
+
},
|
|
219
|
+
};
|
|
220
|
+
export const TEST = {
|
|
221
|
+
type: "object",
|
|
222
|
+
required: ["status", "summary", "testFiles", "failureOutput"],
|
|
223
|
+
properties: {
|
|
224
|
+
status: { enum: ["done", "blocked", "failed"] },
|
|
225
|
+
summary: str,
|
|
226
|
+
testFiles: strs,
|
|
227
|
+
failureOutput: { type: "string", description: "The output proving the tests fail for the right reason (with alreadyMet: the passing output that proves the acceptance)." },
|
|
228
|
+
alreadyMet: { type: "boolean", description: "The acceptance is already met and existing tests prove it and pass (e.g. a resumed run). testFiles are those tests." },
|
|
229
|
+
commands: { type: "array", items: str, description: "Every test command you ran, verbatim." },
|
|
230
|
+
// The test pyramid (decision 47): one test per criterion, at the lowest level that proves it.
|
|
231
|
+
levels: { ...strs, description: "The pyramid level of each test in testFiles: the lowest that proves its criterion, never the same criterion at every level." },
|
|
232
|
+
// Undecided behaviour goes back upstream, never into a note (decision 52).
|
|
233
|
+
questions: {
|
|
234
|
+
type: "array",
|
|
235
|
+
items: QUESTION,
|
|
236
|
+
description: "Every behaviour the handoff leaves undecided (error types, helper signatures, option names, retry semantics); empty when none. A non-empty list goes back upstream.",
|
|
237
|
+
},
|
|
238
|
+
testChange: {
|
|
239
|
+
type: "object",
|
|
240
|
+
description: "Only after a test conflict: whether you kept the test or changed it, and why.",
|
|
241
|
+
required: ["kept", "justification"],
|
|
242
|
+
properties: {
|
|
243
|
+
kept: { type: "boolean", description: "true: the test is right and stays as it was; the implementer makes it pass." },
|
|
244
|
+
criterion: { type: "string", description: "The acceptance criterion the test proves, verbatim." },
|
|
245
|
+
justification: { type: "string", description: "Kept: why the test is right. Changed: the repository fact or existing test it contradicted, and why the new test still proves the criterion." },
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
blocked,
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
export const VERIFY = {
|
|
252
|
+
type: "object",
|
|
253
|
+
required: ["green", "summary", "failures", "evidence"],
|
|
254
|
+
properties: {
|
|
255
|
+
green: { type: "boolean", description: "This task's own tests and the static checks passed." },
|
|
256
|
+
summary: str,
|
|
257
|
+
failures: { ...strs, description: "Failures of this task's own tests and checks only." },
|
|
258
|
+
// Evidence before green (decision 44): green counts only with a command per level in scope.
|
|
259
|
+
evidence: {
|
|
260
|
+
type: "array",
|
|
261
|
+
description: "Every command you ran, verbatim, with its exit code. Green needs a passing command for each level in scope.",
|
|
262
|
+
items: { type: "object", required: ["command", "exitCode"], properties: { command: str, exitCode: { type: "integer" }, output: { type: "string", description: "The last lines of the output." } } },
|
|
263
|
+
},
|
|
264
|
+
foreignFailures: {
|
|
265
|
+
type: "array",
|
|
266
|
+
description: "Failing tests owned by another task of the same working tree (its test files or acceptance). They do not make this task red.",
|
|
267
|
+
items: { type: "object", required: ["test", "owner"], properties: { test: str, owner: { type: "string", description: "The id of the task that owns the test." }, output: str } },
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
export const REVIEW = {
|
|
272
|
+
type: "object",
|
|
273
|
+
required: ["pass", "summary", "findings"],
|
|
274
|
+
properties: {
|
|
275
|
+
pass: { type: "boolean" },
|
|
276
|
+
summary: str,
|
|
277
|
+
findings: {
|
|
278
|
+
type: "array",
|
|
279
|
+
items: {
|
|
280
|
+
type: "object",
|
|
281
|
+
required: ["severity", "issue", "fix"],
|
|
282
|
+
properties: { severity: { enum: ["low", "medium", "high"] }, file: str, issue: str, fix: str },
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
export const GIT = {
|
|
288
|
+
type: "object",
|
|
289
|
+
required: ["status", "summary"],
|
|
290
|
+
properties: {
|
|
291
|
+
status: { enum: ["done", "blocked", "failed"] },
|
|
292
|
+
summary: str,
|
|
293
|
+
branch: str,
|
|
294
|
+
commits: strs,
|
|
295
|
+
prUrl: str,
|
|
296
|
+
tag: str,
|
|
297
|
+
blocked,
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
export const FOLLOWUP = {
|
|
301
|
+
...TASK,
|
|
302
|
+
required: [...TASK.required, "reason", "lowestLevel"],
|
|
303
|
+
properties: {
|
|
304
|
+
...TASK.properties,
|
|
305
|
+
reason: { type: "string", description: "The failing suite and output this follow-up fixes." },
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
export const INTEGRATION = {
|
|
309
|
+
type: "object",
|
|
310
|
+
required: ["status", "green", "summary", "suites", "followups"],
|
|
311
|
+
properties: {
|
|
312
|
+
status: { enum: ["done", "blocked", "failed"] },
|
|
313
|
+
green: { type: "boolean", description: "Every level in scope passed." },
|
|
314
|
+
summary: str,
|
|
315
|
+
suites: {
|
|
316
|
+
type: "array",
|
|
317
|
+
items: { type: "object", required: ["level", "command", "result"], properties: { level: str, command: str, result: { enum: ["pass", "fail", "not-run"] }, output: str } },
|
|
318
|
+
},
|
|
319
|
+
followups: { type: "array", items: FOLLOWUP, description: "One task per gap found. Fixes go through the task loop, not here." },
|
|
320
|
+
blocked,
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
export const HANDOFF_RESULT = {
|
|
324
|
+
type: "object",
|
|
325
|
+
required: ["summary", "handoffPath", "gapReportPath"],
|
|
326
|
+
properties: { summary: str, handoffPath: str, gapReportPath: str },
|
|
327
|
+
};
|
|
328
|
+
/** The delivery decider's answer to a downstream blocker. */
|
|
329
|
+
export const DECISION = {
|
|
330
|
+
type: "object",
|
|
331
|
+
required: ["settled", "kind", "summary"],
|
|
332
|
+
properties: {
|
|
333
|
+
settled: { type: "boolean", description: "true when the standing policy lets delivery settle it; the step re-runs with the decision." },
|
|
334
|
+
kind: { enum: ["product", "copy", "security-widening", "test-fixture", "lint-suppression", "repo-fact-exception", "command-mapping", "other"] },
|
|
335
|
+
decision: { type: "string", description: "What delivery does, when settled." },
|
|
336
|
+
why: str,
|
|
337
|
+
summary: str,
|
|
338
|
+
},
|
|
339
|
+
};
|
|
340
|
+
export const RETRO = {
|
|
341
|
+
type: "object",
|
|
342
|
+
required: ["summary", "retroPath", "improvements"],
|
|
343
|
+
properties: {
|
|
344
|
+
summary: str,
|
|
345
|
+
retroPath: str,
|
|
346
|
+
improvements: {
|
|
347
|
+
type: "array",
|
|
348
|
+
description: "Proposed changes to Friday itself (pack, prompts, runtime), generic lessons only: no personal data, no repository-internal names.",
|
|
349
|
+
items: { type: "object", required: ["title", "problem", "proposal"], properties: { title: str, problem: str, proposal: str, evidence: str } },
|
|
350
|
+
},
|
|
351
|
+
indicators: {
|
|
352
|
+
type: "object",
|
|
353
|
+
description: "Leading indicators of the run, counted from its facts; a number the run does not show is left out.",
|
|
354
|
+
properties: {
|
|
355
|
+
tasks: { type: "integer" },
|
|
356
|
+
firstPassGreen: { type: "integer", description: "Tasks green on their first verify round." },
|
|
357
|
+
reworkRounds: { type: "integer", description: "Red rounds beyond the first, over all tasks." },
|
|
358
|
+
gateLoops: { type: "integer" },
|
|
359
|
+
upstreamReturns: { type: "integer" },
|
|
360
|
+
questionRounds: { type: "integer" },
|
|
361
|
+
planDriftFiles: { type: "integer", description: "Files changed outside the build plan." },
|
|
362
|
+
},
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
};
|
|
366
|
+
const resolvedItems = (extra, required) => ({
|
|
367
|
+
type: "array",
|
|
368
|
+
items: {
|
|
369
|
+
type: "object",
|
|
370
|
+
required: [...required, "resolved", "evidence"],
|
|
371
|
+
properties: { ...extra, resolved: { type: "boolean" }, evidence: str },
|
|
372
|
+
},
|
|
373
|
+
});
|
|
374
|
+
/** Downstream, before any task loop: one install, every prerequisite and pin resolved here (decision 48). */
|
|
375
|
+
export const PREFLIGHT = {
|
|
376
|
+
type: "object",
|
|
377
|
+
required: ["status", "summary", "bootstrap", "prerequisites", "pins"],
|
|
378
|
+
properties: {
|
|
379
|
+
status: { enum: ["done", "blocked", "failed"] },
|
|
380
|
+
summary: str,
|
|
381
|
+
bootstrap: {
|
|
382
|
+
type: "object",
|
|
383
|
+
required: ["commands", "offline"],
|
|
384
|
+
properties: {
|
|
385
|
+
commands: { ...strs, description: "The install commands you ran, verbatim; every later step reuses them." },
|
|
386
|
+
offline: { type: "boolean", description: "The install resolved from the lockfile and the local store only." },
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
prerequisites: { ...resolvedItems({ id: str }, ["id"]), description: "One per handoff prerequisite; evidence is the check you ran and what it printed." },
|
|
390
|
+
pins: { ...resolvedItems({ package: str, version: str, task: str }, ["package", "version"]), description: "One per package version the handoff's tasks or prerequisites name." },
|
|
391
|
+
blocked,
|
|
392
|
+
},
|
|
393
|
+
};
|
|
394
|
+
export const STEP_SCHEMAS = { UPSTREAM, CONSOLIDATED, TASKS, BRIEFS, RESULT, TEST, VERIFY, REVIEW, GIT, INTEGRATION, HANDOFF_RESULT, RETRO, DECISION, PREFLIGHT };
|
|
395
|
+
// ---------------------------------------------------------------- what the agent tool receives
|
|
396
|
+
//
|
|
397
|
+
// Claude Code's auto mode starts an agent unreviewed only when its output schema is at most 4096
|
|
398
|
+
// characters; a larger one blocks the step ("output schema is over 4096 characters"). The schema
|
|
399
|
+
// passed to the agent is therefore the shape only (LEAN_SCHEMAS), and the field descriptions travel
|
|
400
|
+
// in the prompt as a short field guide (FIELD_GUIDES). The source schemas above stay the one place
|
|
401
|
+
// that says both.
|
|
402
|
+
/** Auto mode's limit on an agent's output schema, in characters of its JSON. */
|
|
403
|
+
export const MAX_SCHEMA_CHARS = 4096;
|
|
404
|
+
/** The schema without its string `description` keywords (a property named "description" stays). */
|
|
405
|
+
export function lean(schema) {
|
|
406
|
+
if (Array.isArray(schema))
|
|
407
|
+
return schema.map(lean);
|
|
408
|
+
if (!schema || typeof schema !== "object")
|
|
409
|
+
return schema;
|
|
410
|
+
const out = {};
|
|
411
|
+
for (const [k, v] of Object.entries(schema)) {
|
|
412
|
+
if (k === "description" && typeof v === "string")
|
|
413
|
+
continue;
|
|
414
|
+
out[k] = k === "properties" ? Object.fromEntries(Object.entries(v).map(([p, s]) => [p, lean(s)])) : lean(v);
|
|
415
|
+
}
|
|
416
|
+
return out;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* The descriptions of a schema as prompt text: one line per description, naming every field path
|
|
420
|
+
* that carries it ("questions[].topic, gaps[].topic: ..."), so shared fields are explained once.
|
|
421
|
+
*/
|
|
422
|
+
export function fieldGuide(schema) {
|
|
423
|
+
const byText = new Map();
|
|
424
|
+
const walk = (s, at) => {
|
|
425
|
+
if (!s || typeof s !== "object" || Array.isArray(s))
|
|
426
|
+
return;
|
|
427
|
+
const o = s;
|
|
428
|
+
if (at && typeof o.description === "string")
|
|
429
|
+
byText.set(o.description, [...(byText.get(o.description) ?? []), at]);
|
|
430
|
+
if (o.properties && typeof o.properties === "object") {
|
|
431
|
+
for (const [p, sub] of Object.entries(o.properties))
|
|
432
|
+
walk(sub, at ? `${at}.${p}` : p);
|
|
433
|
+
}
|
|
434
|
+
if (o.items)
|
|
435
|
+
walk(o.items, `${at}[]`);
|
|
436
|
+
};
|
|
437
|
+
walk(schema, "");
|
|
438
|
+
return [...byText].map(([text, paths]) => `- ${paths.join(", ")}: ${text}`).join("\n");
|
|
439
|
+
}
|
|
440
|
+
const mapValues = (o, f) => Object.fromEntries(Object.entries(o).map(([k, v]) => [k, f(v)]));
|
|
441
|
+
/** What every generated workflow passes to the agent tool as `schema`. */
|
|
442
|
+
export const LEAN_SCHEMAS = mapValues(STEP_SCHEMAS, lean);
|
|
443
|
+
/** What it appends to the agent's prompt for the same step. */
|
|
444
|
+
export const FIELD_GUIDES = mapValues(STEP_SCHEMAS, fieldGuide);
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Shapes of the pack YAML after schema validation. The schemas in schemas/*.schema.yaml are the
|
|
2
|
+
// source of truth; these types mirror them for the compiler.
|
|
3
|
+
export const TARGET_IDS = ["claude", "opencode"];
|
|
4
|
+
/** The schema default: an orchestration without `outputs` compiles to a workflow script. */
|
|
5
|
+
export const outputsOf = (o) => (o.outputs?.length ? o.outputs : ["workflow"]);
|
|
6
|
+
export const emits = (o, output) => outputsOf(o).includes(output);
|
|
7
|
+
/** Step types a skill can run without the workflow runtime (no task loops, gates or foreach). */
|
|
8
|
+
export const SKILL_STEP_TYPES = new Set(["agent", "clarify", "gap-analysis", "parallel", "sequential", "handoff", "approval", "preflight"]);
|