@digital-agora/friday 0.12.0 → 0.13.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/README.md +1 -1
- package/bundles/friday-claude-0.13.0.zip +0 -0
- package/bundles/{friday-opencode-0.1.0.zip → friday-opencode-0.13.0.zip} +0 -0
- package/dist/adapters/claude/runtime.js +5 -0
- package/dist/adapters/claude/workflows.js +4 -1
- package/dist/adapters/drivers.js +4 -1
- package/dist/adapters/opencode/index.js +1 -1
- package/dist/adapters/skill.js +1 -1
- package/dist/flow.js +8 -5
- package/dist/handoff.js +1 -1
- package/dist/prompts.js +7 -0
- package/dist/slice.js +36 -0
- package/pack/pack.yaml +2 -1
- package/package.json +2 -2
- package/bundles/friday-claude-0.1.0.zip +0 -0
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ npx -y @digital-agora/friday install --target opencode --dir ../my-project
|
|
|
52
52
|
```
|
|
53
53
|
|
|
54
54
|
```bash
|
|
55
|
-
npx -y @digital-agora/friday install --from ./friday-claude
|
|
55
|
+
npx -y @digital-agora/friday install --from ./friday-claude-<version>.zip --dir .
|
|
56
56
|
```
|
|
57
57
|
|
|
58
58
|
`--dry-run` shows what would change. Installing again only updates files Friday wrote; a file you
|
|
Binary file
|
|
Binary file
|
|
@@ -131,6 +131,9 @@ function factsText() {
|
|
|
131
131
|
// contracts that list it (or list no task), the interface contracts its brief names (all when the
|
|
132
132
|
// brief names none), the standards, its build plan entry and the red tests it owns.
|
|
133
133
|
const SLICED = A.sliceScoped !== false;
|
|
134
|
+
// A step outside the task loop gets an index of the handoff and its path, not the whole of it, when
|
|
135
|
+
// the run passes args.handoffPath (decision 66); args.handoffIndex: false gives it the whole again.
|
|
136
|
+
const INDEXED = typeof A.handoffPath === "string" && A.handoffPath.length > 0 && A.handoffIndex !== false;
|
|
134
137
|
// handoffSlice is src/slice.ts, embedded in the script by the compiler: the estimate in
|
|
135
138
|
// friday handoff check counts the same slice (decision 61).
|
|
136
139
|
function sliceOf(item) { return handoffSlice(HANDOFF, item, COMMANDS); }
|
|
@@ -163,6 +166,8 @@ function context(stepId, item) {
|
|
|
163
166
|
if (tb) parts.push("Task brief (approved with the handoff; the handoff below stays the source of truth):\n" + tb.text);
|
|
164
167
|
if (HANDOFF && SLICED && item && item.codebase) {
|
|
165
168
|
parts.push("Approved handoff, scoped to this task (the only source of truth; anything it does not settle is a blocker, not a guess):\n" + JSON.stringify(sliceOf(item)));
|
|
169
|
+
} else if (HANDOFF && INDEXED) {
|
|
170
|
+
parts.push(HANDOFF_INDEX + "\n" + JSON.stringify(handoffIndex(HANDOFF, A.handoffPath)));
|
|
166
171
|
} else if (HANDOFF) {
|
|
167
172
|
parts.push("Approved handoff (the only source of truth; anything it does not settle is a blocker, not a guess):\n" + JSON.stringify(HANDOFF));
|
|
168
173
|
} else {
|
|
@@ -4,7 +4,7 @@ import { RUNTIME } from "./runtime.js";
|
|
|
4
4
|
import { SUMMARY_DROPS, loopMap, readsMap, stepPlaces } from "../../reads.js";
|
|
5
5
|
// Parking is the orchestration check's call (decision 58): the runtime parks only when it says so.
|
|
6
6
|
import { canPark } from "../../flow.js";
|
|
7
|
-
import { handoffSlice } from "../../slice.js";
|
|
7
|
+
import { handoffIndex, handoffSlice } from "../../slice.js";
|
|
8
8
|
import { contractIssues } from "../../contracts.js";
|
|
9
9
|
const j = (v) => JSON.stringify(v);
|
|
10
10
|
function refLit(r) {
|
|
@@ -352,6 +352,7 @@ export function compileClaudeWorkflow(w, ir) {
|
|
|
352
352
|
`const LEVELS = ${j(Object.fromEntries((ir.pack.testPyramid?.levels ?? []).map((l) => [l.id, l.commands])))};`,
|
|
353
353
|
`const DECIDE_BLOCKER = ${j(P.DECIDE_BLOCKER)};`,
|
|
354
354
|
`const PRECEDENCE = ${j(P.PRECEDENCE)};`,
|
|
355
|
+
`const HANDOFF_INDEX = ${j(P.HANDOFF_INDEX)};`,
|
|
355
356
|
// The project's documented decisions (decision 64): upstream steps get them, the join settles by topic.
|
|
356
357
|
`const DECISIONS = ${j(w.stream === "upstream" ? ir.decisions.map((d) => ({ id: d.id, topics: d.topics, source: d.source })) : [])};`,
|
|
357
358
|
`const DECISIONS_TEXT = ${j(w.stream === "upstream" && ir.decisions.length ? P.documentedDecisionsText(ir.decisions) : "")};`,
|
|
@@ -366,6 +367,8 @@ export function compileClaudeWorkflow(w, ir) {
|
|
|
366
367
|
`const SUMMARY_DROPS = ${j(SUMMARY_DROPS)};`,
|
|
367
368
|
// The handoff slice a task's agents get (decisions 60, 61), shared with friday handoff check.
|
|
368
369
|
handoffSlice.toString(),
|
|
370
|
+
// The handoff index a step outside the task loop gets (decision 66).
|
|
371
|
+
handoffIndex.toString(),
|
|
369
372
|
// The interface contract DSL's checks (decision 65), shared with friday handoff check.
|
|
370
373
|
contractIssues.toString(),
|
|
371
374
|
RUNTIME,
|
package/dist/adapters/drivers.js
CHANGED
|
@@ -285,7 +285,10 @@ export function downstreamDriver(w, opts, pack) {
|
|
|
285
285
|
to finish the upstream workflow first. Do not fix the handoff yourself. It prints an
|
|
286
286
|
\`estimate:\` line, the run's worst-case prompt tokens of handoff and agent calls (decision 61):
|
|
287
287
|
show it to the user before the run, with any warning about it.
|
|
288
|
-
3. ${opts.run} with \`{ workId, handoff, commands, maxPromptTokens, maxAgentCalls }\`, where \`handoff\` is the YAML parsed to an object
|
|
288
|
+
3. ${opts.run} with \`{ workId, handoff, handoffPath, commands, maxPromptTokens, maxAgentCalls }\`, where \`handoff\` is the YAML parsed to an object
|
|
289
|
+
and \`handoffPath\` its path, \`docs/friday/<workId>/handoff.yaml\`: a step outside the task loop then
|
|
290
|
+
gets an index of the handoff and reads the sections it needs from the file (decision 66). Pass
|
|
291
|
+
\`handoffIndex: false\` only when the user asks for the whole handoff in every such prompt.
|
|
289
292
|
\`maxPromptTokens\` and \`maxAgentCalls\` cap the run while it goes: by default the estimate's
|
|
290
293
|
tokens and calls, or what the user sets; leave them out only when the user asks for no cap.
|
|
291
294
|
A run stopped at a cap returns \`failed\` with its \`usage\`: show it, and resume the same run
|
|
@@ -145,7 +145,7 @@ function orchestrator(w, ir) {
|
|
|
145
145
|
const persona = ir.agentIndex[w.orchestrator] ?? {};
|
|
146
146
|
const kind = persona.decide ? "decide" : (Object.keys(persona)[0] ?? "decide");
|
|
147
147
|
const up = w.stream === "upstream";
|
|
148
|
-
const run = "Execute the step plan above yourself, in order, delegating every step to the named subagent with the task tool. Give each subagent the work id, the request or the handoff (for a step on a task, " + P.TASK_SLICE + ", decision 60), the answers and resolved gaps it sees (upstream: those of its own step and the steps before it, decision 59) and the results of earlier steps (only the steps a plan step says it reads, when it says so; for a task, its own results whole, its dependencies' summarized without raw output, evidence or failures, and no other task's: decision 55), and tell it which JSON shape to return (below). Steps marked parallel or in one wave may be delegated at the same time. Never do a step's work yourself and never use a different subagent or model than the plan names";
|
|
148
|
+
const run = "Execute the step plan above yourself, in order, delegating every step to the named subagent with the task tool. Give each subagent the work id, the request or the handoff (for a step on a task, " + P.TASK_SLICE + ", decision 60; for any other step, " + P.HANDOFF_INDEX_SKILL + "), the answers and resolved gaps it sees (upstream: those of its own step and the steps before it, decision 59) and the results of earlier steps (only the steps a plan step says it reads, when it says so; for a task, its own results whole, its dependencies' summarized without raw output, evidence or failures, and no other task's: decision 55), and tell it which JSON shape to return (below). Steps marked parallel or in one wave may be delegated at the same time. Never do a step's work yourself and never use a different subagent or model than the plan names";
|
|
149
149
|
const ask = "the question tool (one question per call, as many calls as needed)";
|
|
150
150
|
const driver = up
|
|
151
151
|
? upstreamDriver(w, { run, ask }, ir.pack.id)
|
package/dist/adapters/skill.js
CHANGED
|
@@ -163,7 +163,7 @@ function runSection(w, t, ir) {
|
|
|
163
163
|
? "Approved handoff (the only source of truth; anything it does not settle is a blocker, not a guess):"
|
|
164
164
|
: "Run arguments (anything they and the repository do not settle is a blocker, not a guess):",
|
|
165
165
|
w.requires?.includes("handoff")
|
|
166
|
-
? `<for a step on a task, ${P.TASK_SLICE} (decision 60; the whole handoff only when the run passes sliceScoped: false); for any other step,
|
|
166
|
+
? `<for a step on a task, ${P.TASK_SLICE} (decision 60; the whole handoff only when the run passes sliceScoped: false); for any other step, ${P.HANDOFF_INDEX_SKILL}>`
|
|
167
167
|
: "<the run arguments>",
|
|
168
168
|
"Results of earlier steps: <step id -> its result, as section 3 scopes them>",
|
|
169
169
|
];
|
package/dist/flow.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CONTAINER_TYPES, readIssue, stepPlaces } from "./reads.js";
|
|
2
|
-
import { estimateTokens, handoffSlice } from "./slice.js";
|
|
2
|
+
import { estimateTokens, handoffIndex, handoffSlice } from "./slice.js";
|
|
3
3
|
/** An orchestration's `id: step: message`, the form the validator reports. */
|
|
4
4
|
export const flowMessage = (i) => `${i.orchestration}: ${i.step ? `step ${i.step}: ` : ""}${i.message}`;
|
|
5
5
|
// ---------------------------------------------------------------------------------------------
|
|
@@ -202,9 +202,12 @@ export function orchestrationCheck(w, pack) {
|
|
|
202
202
|
export function promptTokenEstimate(w, handoff, pack, opts = {}) {
|
|
203
203
|
const calls = orchestrationBudget(w).calls;
|
|
204
204
|
const tasks = handoff.tasks ?? [];
|
|
205
|
-
const
|
|
205
|
+
const full = estimateTokens(JSON.stringify(handoff));
|
|
206
|
+
// A call outside the task loop carries the index when the run passes the handoff's path (decision 66).
|
|
207
|
+
const indexed = opts.indexed !== false;
|
|
208
|
+
const whole = indexed ? estimateTokens(JSON.stringify(handoffIndex(handoff, opts.path ?? "docs/friday/<workId>/handoff.yaml"))) : full;
|
|
206
209
|
const sliced = opts.sliced !== false;
|
|
207
|
-
const slices = tasks.map((t) => (sliced ? estimateTokens(JSON.stringify(handoffSlice(handoff, t, handoff.commands ?? {}))) :
|
|
210
|
+
const slices = tasks.map((t) => (sliced ? estimateTokens(JSON.stringify(handoffSlice(handoff, t, handoff.commands ?? {}))) : full));
|
|
208
211
|
const sum = slices.reduce((a, b) => a + b, 0);
|
|
209
212
|
const avg = slices.length ? sum / slices.length : whole;
|
|
210
213
|
const size = {
|
|
@@ -222,6 +225,6 @@ export function promptTokenEstimate(w, handoff, pack, opts = {}) {
|
|
|
222
225
|
promptTokens = Math.round(promptTokens);
|
|
223
226
|
const n = evaluate(calls, size);
|
|
224
227
|
const largest = slices.length ? Math.max(...slices) : whole;
|
|
225
|
-
const text = `worst case about ${promptTokens.toLocaleString("en-US")} prompt tokens of handoff over ${n} agent calls (${tasks.length} tasks, ${size.stack} stacks, ${size.followup} follow-ups per round assumed): the whole handoff is about ${
|
|
226
|
-
return { calls: n, handoffTokens: whole, largestSliceTokens: largest, promptTokens, text };
|
|
228
|
+
const text = `worst case about ${promptTokens.toLocaleString("en-US")} prompt tokens of handoff over ${n} agent calls (${tasks.length} tasks, ${size.stack} stacks, ${size.followup} follow-ups per round assumed): the whole handoff is about ${full.toLocaleString("en-US")} tokens, ${indexed ? `its index for the steps outside the task loop about ${whole.toLocaleString("en-US")} (the sections they read from the file come on top)` : "sent whole to the steps outside the task loop"}, the largest task slice about ${largest.toLocaleString("en-US")}`;
|
|
229
|
+
return { calls: n, handoffTokens: full, ...(indexed ? { indexTokens: whole } : {}), largestSliceTokens: largest, promptTokens, text };
|
|
227
230
|
}
|
package/dist/handoff.js
CHANGED
|
@@ -275,7 +275,7 @@ export function checkHandoff(file, opts = {}) {
|
|
|
275
275
|
let estimate;
|
|
276
276
|
const w = opts.budget?.orchestrations.find((o) => o.id === h.workflow);
|
|
277
277
|
if (w && w.stream === "downstream") {
|
|
278
|
-
estimate = promptTokenEstimate(w, data, opts.budget.pack);
|
|
278
|
+
estimate = promptTokenEstimate(w, data, opts.budget.pack, { path: file });
|
|
279
279
|
const cap = opts.budget.pack.agentCallBudget?.warnPromptTokensAbove;
|
|
280
280
|
if (cap !== undefined && estimate.promptTokens > cap)
|
|
281
281
|
warnings.push(`${estimate.text}; above agentCallBudget.warnPromptTokensAbove (${cap.toLocaleString("en-US")})`);
|
package/dist/prompts.js
CHANGED
|
@@ -29,6 +29,13 @@ export const DECISION_JOIN = "Join the open items on the documented decisions by
|
|
|
29
29
|
/** DSL first, code after (decision 65): the one re-run a step whose contracts fail their checks gets. */
|
|
30
30
|
export const CONTRACT_RETRY = "Your interface contracts are not yet a DSL delivery can code from. Return them complete, fixing each problem below; change nothing else:";
|
|
31
31
|
export const CONTRACT_GAP_WHY = "Delivery codes the interfaces from this DSL and nothing else (decision 65): an incomplete contract would be guessed.";
|
|
32
|
+
/**
|
|
33
|
+
* What a step outside the task loop is told about the handoff index (decision 66): the file is the
|
|
34
|
+
* source of truth, and it reads from it only the sections its work needs.
|
|
35
|
+
*/
|
|
36
|
+
export const HANDOFF_INDEX = "Approved handoff, as an index (decision 66). The whole handoff is the file at `path` in the repository, the only source of truth. The index holds its scope, data classification, delivery policy, prerequisites and commands, one line per task, decision and interface contract, and the size of every other section. Read from the file the sections and entries your step needs (find a section by its top-level key; read a large one in parts), and nothing more; anything the handoff does not settle is a blocker, not a guess:";
|
|
37
|
+
/** The same index, as a skill or the OpenCode orchestrator builds it (decision 66). */
|
|
38
|
+
export const HANDOFF_INDEX_SKILL = "the handoff's path with an index of it: its scope, data classification, delivery policy, prerequisites and commands, one line per task (id, title, stack, codebase, taskKind, dependsOn, covers), per decision (id, where) and per interface contract (id, change, kind, owner), and the size of every other section; the agent reads from the file the sections its step needs (decision 66)";
|
|
32
39
|
export const CLARIFY = (topic) => [
|
|
33
40
|
`Clarify: ${topic}`,
|
|
34
41
|
"",
|
package/dist/slice.js
CHANGED
|
@@ -88,3 +88,39 @@ export function estimateTokens(text) {
|
|
|
88
88
|
const n = text.length + 3;
|
|
89
89
|
return (n - (n % 4)) / 4;
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* What a step outside the task loop gets of the handoff when the run passes the handoff's path
|
|
93
|
+
* (decision 66): an index, not the whole of it. It carries the parts every such step needs and
|
|
94
|
+
* that stay small (scope, data classification, delivery policy, prerequisites, commands), one line
|
|
95
|
+
* per task, decision and interface contract, and every other section by its size; the step reads
|
|
96
|
+
* from the file the sections its work needs. Self-contained, like handoffSlice.
|
|
97
|
+
*/
|
|
98
|
+
export function handoffIndex(handoff, path) {
|
|
99
|
+
function tokens(v) { const n = JSON.stringify(v === undefined ? null : v).length + 3; return (n - (n % 4)) / 4; }
|
|
100
|
+
const inline = ["workId", "status", "workflow", "scope", "dataClassification", "deliveryPolicy", "prerequisites", "commands", "git"];
|
|
101
|
+
const listed = ["tasks", "decisions", "interfaceContracts"];
|
|
102
|
+
const sections = {};
|
|
103
|
+
Object.keys(handoff).forEach(function (k) {
|
|
104
|
+
if (inline.indexOf(k) >= 0 || listed.indexOf(k) >= 0)
|
|
105
|
+
return;
|
|
106
|
+
const v = handoff[k];
|
|
107
|
+
sections[k] = { items: Array.isArray(v) ? v.length : v && typeof v === "object" ? Object.keys(v).length : 1, tokens: tokens(v) };
|
|
108
|
+
});
|
|
109
|
+
const index = { path: path };
|
|
110
|
+
inline.forEach(function (k) { if (handoff[k] !== undefined)
|
|
111
|
+
index[k] = handoff[k]; });
|
|
112
|
+
index.tasks = (handoff.tasks || []).map(function (t) {
|
|
113
|
+
return { id: t.id, title: t.title, stack: t.stack, codebase: t.codebase, taskKind: t.taskKind, dependsOn: t.dependsOn || [], covers: t.covers || [] };
|
|
114
|
+
});
|
|
115
|
+
index.decisions = (handoff.decisions || []).map(function (d) { return d.where ? { id: d.id, where: d.where } : { id: d.id }; });
|
|
116
|
+
if ((handoff.interfaceContracts || []).length) {
|
|
117
|
+
index.interfaceContracts = handoff.interfaceContracts.map(function (c) {
|
|
118
|
+
const o = { id: c.id };
|
|
119
|
+
["change", "kind", "owner"].forEach(function (k) { if (c[k] !== undefined)
|
|
120
|
+
o[k] = c[k]; });
|
|
121
|
+
return o;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
index.sections = Object.assign({ tasks: { items: index.tasks.length, tokens: tokens(handoff.tasks) }, decisions: { items: index.decisions.length, tokens: tokens(handoff.decisions) } }, handoff.interfaceContracts ? { interfaceContracts: { items: handoff.interfaceContracts.length, tokens: tokens(handoff.interfaceContracts) } } : {}, sections);
|
|
125
|
+
return index;
|
|
126
|
+
}
|
package/pack/pack.yaml
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
# come in a specialization (decision 41), which lists the repositories they cite in its sources.
|
|
5
5
|
id: friday
|
|
6
6
|
name: Friday
|
|
7
|
-
version:
|
|
7
|
+
# The release's version: pnpm version-packages copies it from package.json (decision 67).
|
|
8
|
+
version: 0.13.0
|
|
8
9
|
description: SDLC agents, workflows and conventions (hexagonal core, TDD pairs, a test pyramid, people approving every handoff).
|
|
9
10
|
sources: []
|
|
10
11
|
# A task's `stack` (set by the lead developer upstream) picks the engineer that implements it.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digital-agora/friday",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Friday: the source of truth for AI-assisted SDLC. Compiles YAML personas, workflows and conventions into agent bundles (Claude Code, OpenCode).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"bundles": "node -e \"require('fs').rmSync('bundles',{recursive:true,force:true})\" && node dist/cli.js bundle --target all --out bundles",
|
|
32
32
|
"prepack": "pnpm build && pnpm bundles",
|
|
33
33
|
"changeset": "changeset",
|
|
34
|
-
"version-packages": "changeset version"
|
|
34
|
+
"version-packages": "changeset version && node scripts/sync-pack-version.mjs"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"ajv": "^8.17.1",
|
|
Binary file
|