@omacode/micromanager 0.0.0-stage → 1.0.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 +201 -0
- package/README.md +30 -2
- package/THIRD_PARTY.md +100 -0
- package/decider/.python-version +1 -0
- package/decider/README.md +35 -0
- package/decider/decider/__init__.py +1 -0
- package/decider/decider/server.py +327 -0
- package/decider/pyproject.toml +34 -0
- package/decider/uv.lock +1255 -0
- package/dist/agenda.js +51 -0
- package/dist/agents.js +58 -0
- package/dist/artifact/handoff.js +281 -0
- package/dist/ask.js +200 -0
- package/dist/backends.js +219 -0
- package/dist/backlog.js +414 -0
- package/dist/bench.js +427 -0
- package/dist/board.js +1 -0
- package/dist/brief.js +202 -0
- package/dist/browser.js +679 -0
- package/dist/budget.js +61 -0
- package/dist/catalog.js +187 -0
- package/dist/checkchange.js +145 -0
- package/dist/checkpoint.js +94 -0
- package/dist/cli.js +764 -0
- package/dist/comfy-gate.js +258 -0
- package/dist/compact.js +142 -0
- package/dist/config.js +344 -0
- package/dist/context/capture.js +1 -0
- package/dist/context/digest.js +1 -0
- package/dist/context/embed.js +1 -0
- package/dist/context/index.js +2 -0
- package/dist/context/ledger.js +1 -0
- package/dist/context/manager.js +1 -0
- package/dist/context/memory.js +1 -0
- package/dist/context/policy.js +1 -0
- package/dist/context/prices.js +1 -0
- package/dist/context/recall.js +1 -0
- package/dist/context/rules.js +1 -0
- package/dist/context/search.js +1 -0
- package/dist/context/status.js +1 -0
- package/dist/context/store.js +1 -0
- package/dist/context/summary.js +1 -0
- package/dist/context/tokens.js +1 -0
- package/dist/context/tools.js +1 -0
- package/dist/continuation.js +184 -0
- package/dist/contract.js +294 -0
- package/dist/contractround.js +178 -0
- package/dist/control.js +1 -0
- package/dist/creative-tools.js +237 -0
- package/dist/dataset.js +175 -0
- package/dist/decide.js +676 -0
- package/dist/decider.js +171 -0
- package/dist/design-shell.js +448 -0
- package/dist/design.js +1410 -0
- package/dist/desktop.js +44 -0
- package/dist/egress.js +156 -0
- package/dist/eval.js +60 -0
- package/dist/evolver.js +302 -0
- package/dist/features.js +193 -0
- package/dist/followups.js +32 -0
- package/dist/forms.js +195 -0
- package/dist/gate.js +108 -0
- package/dist/gatebox.js +46 -0
- package/dist/grants.js +189 -0
- package/dist/graph.js +65 -0
- package/dist/guard/index.js +1 -0
- package/dist/guard/wire.js +1 -0
- package/dist/helpers.js +85 -0
- package/dist/hooks.js +158 -0
- package/dist/image-models.js +117 -0
- package/dist/integration.js +3 -0
- package/dist/journal.js +1 -0
- package/dist/look.js +363 -0
- package/dist/memory.js +1 -0
- package/dist/mode.js +97 -0
- package/dist/native.js +3348 -0
- package/dist/nogit.js +259 -0
- package/dist/outcomes.js +148 -0
- package/dist/permission.js +35 -0
- package/dist/pick.js +89 -0
- package/dist/pipelines.js +262 -0
- package/dist/plan.js +641 -0
- package/dist/plandoc.js +211 -0
- package/dist/plugin.js +4736 -0
- package/dist/policy.js +58 -0
- package/dist/pools.js +1 -0
- package/dist/preview.js +274 -0
- package/dist/profile.js +165 -0
- package/dist/progress.js +1 -0
- package/dist/promote.js +313 -0
- package/dist/redact.js +1 -0
- package/dist/registry.js +179 -0
- package/dist/riskscore.js +126 -0
- package/dist/roles.js +1 -0
- package/dist/routing.js +1 -0
- package/dist/runner.js +1892 -0
- package/dist/sandbox.js +3 -0
- package/dist/sandboxgate.js +90 -0
- package/dist/scheduler.js +170 -0
- package/dist/services-main.js +131 -0
- package/dist/services.js +265 -0
- package/dist/session.js +241 -0
- package/dist/setup.js +423 -0
- package/dist/shell/decide.js +1 -0
- package/dist/shell/index.js +2 -0
- package/dist/shell/sandbox.js +1 -0
- package/dist/shell/wire.js +1 -0
- package/dist/skills.js +103 -0
- package/dist/state.js +1 -0
- package/dist/store.js +1 -0
- package/dist/switcher.js +1 -0
- package/dist/synth.js +418 -0
- package/dist/tools.js +477 -0
- package/dist/trials.js +223 -0
- package/dist/usage.js +1 -0
- package/dist/wait.js +167 -0
- package/dist/watchdog.js +476 -0
- package/dist/web-guidance.js +43 -0
- package/dist/which.js +20 -0
- package/dist/worktree/git.js +545 -0
- package/dist/writeguard.js +311 -0
- package/evolver/mm_evolve/__init__.py +1 -0
- package/evolver/mm_evolve/entry.py +3 -0
- package/evolver/mm_evolve/evaluator.py +119 -0
- package/evolver/mm_evolve/llm.py +76 -0
- package/evolver/mm_evolve/run.py +89 -0
- package/evolver/mm_evolve/spec.py +62 -0
- package/evolver/pyproject.toml +21 -0
- package/evolver/uv.lock +772 -0
- package/package.json +74 -4
- package/skills/THIRD_PARTY.md +58 -0
- package/skills/code-review/SKILL.md +46 -0
- package/skills/deck/SKILL.md +98 -0
- package/skills/deliberate/SKILL.md +39 -0
- package/skills/design/SKILL.md +150 -0
- package/skills/diagnosing-bugs/SKILL.md +75 -0
- package/skills/image/SKILL.md +66 -0
- package/skills/orchestrator/SKILL.md +107 -0
- package/skills/receiving-code-review/SKILL.md +36 -0
- package/skills/research/SKILL.md +18 -0
- package/skills/tdd/SKILL.md +56 -0
- package/skills/tdd/mocking.md +59 -0
- package/skills/tdd/tests.md +77 -0
- package/skills/verification-before-completion/SKILL.md +50 -0
- package/skills/video/SKILL.md +97 -0
- package/skills/web/SKILL.md +60 -0
package/dist/plandoc.js
ADDED
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// The plan document (A1-T8): what a plan job writes down, and what Build mode reads before it starts at `execute` or
|
|
2
|
+
// decides it has to plan again. The headings are a contract, not decoration: the parser below reads exactly these, and
|
|
3
|
+
// the artifact contracts (B1-T6) will read them too, so a renamed heading is a changed format.
|
|
4
|
+
//
|
|
5
|
+
// The document always carries the same seven sections — goal, findings, decisions, open questions, recommended tasks,
|
|
6
|
+
// artifacts, risks — and, when A1-T7 applied, the line that says the job ran reader-only. An empty section says
|
|
7
|
+
// "(none)" rather than vanishing, so a reader can tell "nothing was found" from "the document was cut short".
|
|
8
|
+
//
|
|
9
|
+
// docFromJob is the document the plugin itself guarantees: the job's goal, decisions, tasks, promoted artifacts and
|
|
10
|
+
// lessons, in this shape, written where a plan job starts and rewritten when a task hands artifacts back. A plan agent
|
|
11
|
+
// may write a richer plan.md itself — that is its job — and the plugin leaves such a document alone (src/native.ts).
|
|
12
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
13
|
+
import { dirname, join } from "node:path";
|
|
14
|
+
import { planArea } from "./worktree/git.js";
|
|
15
|
+
// The heading text, once: the renderer and the parser read the same constants, so they cannot drift apart.
|
|
16
|
+
const HEADINGS = {
|
|
17
|
+
goal: "Goal",
|
|
18
|
+
findings: "Findings",
|
|
19
|
+
decisions: "Decisions",
|
|
20
|
+
openQuestions: "Open questions",
|
|
21
|
+
tasks: "Recommended tasks",
|
|
22
|
+
artifacts: "Artifacts",
|
|
23
|
+
risks: "Risks",
|
|
24
|
+
};
|
|
25
|
+
const NONE = "(none)";
|
|
26
|
+
const BULLET = /^- /;
|
|
27
|
+
const TASK_LINE = /^- \*\*(.*?)\*\* (.*?) · role (\S+) · files: (.*) · acceptance: (.*)$/;
|
|
28
|
+
const ARTIFACT_LINE = /^- (.*?): (.*) \((\d+) B, sha256 ([0-9a-f]{64})\)$/;
|
|
29
|
+
const MODE_LINE = /^\*\*Mode:\*\* reader-only(?: — ?(.*))?$/m;
|
|
30
|
+
const why = (err) => (err instanceof Error ? err.message : String(err));
|
|
31
|
+
// One comma-separated list inside a task bullet; "(none)" is how the renderer spells an empty one.
|
|
32
|
+
function listText(items) {
|
|
33
|
+
return items.length ? items.join(", ") : NONE;
|
|
34
|
+
}
|
|
35
|
+
function listOf(text) {
|
|
36
|
+
const t = text.trim();
|
|
37
|
+
return !t || t === NONE ? [] : t.split(",").map((p) => p.trim()).filter(Boolean);
|
|
38
|
+
}
|
|
39
|
+
function heading(name, body) {
|
|
40
|
+
return [`## ${name}`, "", body, ""];
|
|
41
|
+
}
|
|
42
|
+
export function renderPlanDoc(job, doc) {
|
|
43
|
+
const lines = (items) => (items.length ? items.map((item) => `- ${item}`).join("\n") : NONE);
|
|
44
|
+
const tasks = doc.tasks.length
|
|
45
|
+
? doc.tasks.map((t) => `- **${t.id}** ${t.title} · role ${t.role} · files: ${listText(t.files)} · acceptance: ${listText(t.acceptance)}`).join("\n")
|
|
46
|
+
: NONE;
|
|
47
|
+
const artifacts = doc.artifacts.length
|
|
48
|
+
? doc.artifacts.map((a) => `- ${a.task}: ${a.path} (${a.bytes} B, sha256 ${a.sha256})`).join("\n")
|
|
49
|
+
: NONE;
|
|
50
|
+
const mode = doc.readerOnly !== undefined ? [`**Mode:** reader-only — ${doc.readerOnly}`, ""] : [];
|
|
51
|
+
return [
|
|
52
|
+
`# ${job.id} — plan`,
|
|
53
|
+
"",
|
|
54
|
+
...mode,
|
|
55
|
+
...heading(HEADINGS.goal, doc.goal.trim() || NONE),
|
|
56
|
+
...heading(HEADINGS.findings, lines(doc.findings)),
|
|
57
|
+
...heading(HEADINGS.decisions, lines(doc.decisions)),
|
|
58
|
+
...heading(HEADINGS.openQuestions, lines(doc.openQuestions)),
|
|
59
|
+
...heading(HEADINGS.tasks, tasks),
|
|
60
|
+
...heading(HEADINGS.artifacts, artifacts),
|
|
61
|
+
...heading(HEADINGS.risks, lines(doc.risks)),
|
|
62
|
+
].join("\n").trimEnd() + "\n";
|
|
63
|
+
}
|
|
64
|
+
// The `## ` sections of a document, by heading, as their lines. A heading repeated later merges its lines into the
|
|
65
|
+
// first, which is the lenient reading: the document still says what it says.
|
|
66
|
+
function sections(text) {
|
|
67
|
+
const out = new Map();
|
|
68
|
+
let current;
|
|
69
|
+
for (const line of text.split(/\r?\n/)) {
|
|
70
|
+
const found = /^##\s+(.*?)\s*$/.exec(line);
|
|
71
|
+
if (found) {
|
|
72
|
+
const name = found[1];
|
|
73
|
+
current = out.get(name) ?? [];
|
|
74
|
+
out.set(name, current);
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
current?.push(line);
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
// A section's lines without the blank padding the renderer puts around it.
|
|
82
|
+
function bodyLines(lines) {
|
|
83
|
+
let start = 0;
|
|
84
|
+
let end = lines.length;
|
|
85
|
+
while (start < end && !lines[start].trim())
|
|
86
|
+
start++;
|
|
87
|
+
while (end > start && !lines[end - 1].trim())
|
|
88
|
+
end--;
|
|
89
|
+
return lines.slice(start, end);
|
|
90
|
+
}
|
|
91
|
+
// A section of bullets. A line that is not a bullet continues the one above it, so a wrapped finding survives; text
|
|
92
|
+
// without any bullet is read as one item, which is how a hand-written paragraph in the agent's own document parses.
|
|
93
|
+
function bullets(lines) {
|
|
94
|
+
const out = [];
|
|
95
|
+
for (const line of bodyLines(lines)) {
|
|
96
|
+
if (BULLET.test(line))
|
|
97
|
+
out.push(line.slice(2));
|
|
98
|
+
else if (!line.trim())
|
|
99
|
+
continue;
|
|
100
|
+
else if (out.length)
|
|
101
|
+
out[out.length - 1] += `\n${line}`;
|
|
102
|
+
else
|
|
103
|
+
out.push(line);
|
|
104
|
+
}
|
|
105
|
+
return out.length === 1 && out[0] === NONE ? [] : out;
|
|
106
|
+
}
|
|
107
|
+
function tasksOf(lines, errors) {
|
|
108
|
+
const body = bodyLines(lines);
|
|
109
|
+
if (!body.length || (body.length === 1 && body[0] === NONE))
|
|
110
|
+
return [];
|
|
111
|
+
const out = [];
|
|
112
|
+
for (const line of body) {
|
|
113
|
+
const found = TASK_LINE.exec(line);
|
|
114
|
+
if (!found) {
|
|
115
|
+
errors.push(`a recommended task cannot be read: "${line}"`);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
out.push({ id: found[1], title: found[2], role: found[3], files: listOf(found[4]), acceptance: listOf(found[5]) });
|
|
119
|
+
}
|
|
120
|
+
return out;
|
|
121
|
+
}
|
|
122
|
+
function artifactsOf(lines, errors) {
|
|
123
|
+
const body = bodyLines(lines);
|
|
124
|
+
if (!body.length || (body.length === 1 && body[0] === NONE))
|
|
125
|
+
return [];
|
|
126
|
+
const out = [];
|
|
127
|
+
for (const line of body) {
|
|
128
|
+
const found = ARTIFACT_LINE.exec(line);
|
|
129
|
+
if (!found) {
|
|
130
|
+
errors.push(`an artifact cannot be read: "${line}"`);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
out.push({ task: found[1], path: found[2], bytes: Number(found[3]), sha256: found[4] });
|
|
134
|
+
}
|
|
135
|
+
return out;
|
|
136
|
+
}
|
|
137
|
+
// A document read back. A missing Goal or Recommended tasks heading is refused: the first is what the job is for, the
|
|
138
|
+
// second is what Build mode would start, and a file without them is not this contract's document.
|
|
139
|
+
export function parsePlanDoc(text) {
|
|
140
|
+
const errors = [];
|
|
141
|
+
const found = sections(text);
|
|
142
|
+
const goal = found.get(HEADINGS.goal);
|
|
143
|
+
const tasks = found.get(HEADINGS.tasks);
|
|
144
|
+
if (!goal)
|
|
145
|
+
errors.push(`the plan has no ## ${HEADINGS.goal} section`);
|
|
146
|
+
if (!tasks)
|
|
147
|
+
errors.push(`the plan has no ## ${HEADINGS.tasks} section`);
|
|
148
|
+
if (errors.length || !goal || !tasks)
|
|
149
|
+
return { errors };
|
|
150
|
+
const mode = MODE_LINE.exec(text);
|
|
151
|
+
const goalText = bodyLines(goal).join("\n");
|
|
152
|
+
const doc = {
|
|
153
|
+
goal: goalText === NONE ? "" : goalText,
|
|
154
|
+
findings: bullets(found.get(HEADINGS.findings) ?? []),
|
|
155
|
+
decisions: bullets(found.get(HEADINGS.decisions) ?? []),
|
|
156
|
+
openQuestions: bullets(found.get(HEADINGS.openQuestions) ?? []),
|
|
157
|
+
tasks: tasksOf(tasks, errors),
|
|
158
|
+
artifacts: artifactsOf(found.get(HEADINGS.artifacts) ?? [], errors),
|
|
159
|
+
risks: bullets(found.get(HEADINGS.risks) ?? []),
|
|
160
|
+
...(mode ? { readerOnly: mode[1] ?? "" } : {}),
|
|
161
|
+
};
|
|
162
|
+
return errors.length ? { errors } : { doc, errors };
|
|
163
|
+
}
|
|
164
|
+
// Where the document lives: in the plan area, beside the worktrees, artifacts, findings and patches of the same job.
|
|
165
|
+
export function planDocPath(project, jobId) {
|
|
166
|
+
return join(planArea(project, jobId), "plan.md");
|
|
167
|
+
}
|
|
168
|
+
// Writes the document 0600 under a 0700 directory, like every other record of a plan job.
|
|
169
|
+
export function writePlanDoc(project, jobId, doc) {
|
|
170
|
+
const path = planDocPath(project, jobId);
|
|
171
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
172
|
+
writeFileSync(path, renderPlanDoc({ id: jobId }, doc), { mode: 0o600 });
|
|
173
|
+
return path;
|
|
174
|
+
}
|
|
175
|
+
export function readPlanDoc(project, jobId) {
|
|
176
|
+
const path = planDocPath(project, jobId);
|
|
177
|
+
let text;
|
|
178
|
+
try {
|
|
179
|
+
text = readFileSync(path, "utf8");
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
const missing = err.code === "ENOENT";
|
|
183
|
+
return { errors: [missing ? "no plan.md yet" : `plan.md cannot be read: ${why(err)}`], path };
|
|
184
|
+
}
|
|
185
|
+
const parsed = parsePlanDoc(text);
|
|
186
|
+
return parsed.doc ? { doc: parsed.doc, errors: parsed.errors, path } : { errors: parsed.errors, path };
|
|
187
|
+
}
|
|
188
|
+
// The document the plugin always guarantees, built from the job itself. A plan agent may write a richer document
|
|
189
|
+
// itself — findings it read, questions it has, tasks it recommends before they are `job.tasks`, a risk it noticed — and
|
|
190
|
+
// that one wins (src/native.ts keeps it and only replaces a missing or plugin-written document). This is the floor,
|
|
191
|
+
// not the ceiling. A cancelled task is left out: it is history, not a recommendation. The findings are the finished
|
|
192
|
+
// tasks' summary lines, the risks are the job's lessons, and the artifacts are exactly what the tasks promoted.
|
|
193
|
+
export function docFromJob(job) {
|
|
194
|
+
const tasks = job.tasks
|
|
195
|
+
.filter((t) => t.status !== "cancelled")
|
|
196
|
+
.map((t) => ({ id: t.id, title: t.title, role: t.role, files: [...t.files], acceptance: [...t.acceptance] }));
|
|
197
|
+
const findings = job.tasks
|
|
198
|
+
.filter((t) => t.status === "passed" || t.status === "merged")
|
|
199
|
+
.map((t) => t.summary?.split("\n")[0]?.trim())
|
|
200
|
+
.filter((line) => Boolean(line));
|
|
201
|
+
return {
|
|
202
|
+
goal: job.goal,
|
|
203
|
+
findings,
|
|
204
|
+
decisions: job.decisions.map((d) => d.text),
|
|
205
|
+
openQuestions: [],
|
|
206
|
+
tasks,
|
|
207
|
+
artifacts: job.tasks.flatMap((t) => (t.promoted ?? []).map((a) => ({ task: t.id, path: a.path, bytes: a.bytes, sha256: a.sha256 }))),
|
|
208
|
+
risks: [...job.lessons],
|
|
209
|
+
...(job.planReaderOnly !== undefined ? { readerOnly: job.planReaderOnly } : {}),
|
|
210
|
+
};
|
|
211
|
+
}
|