@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/session.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
// The planning session (design.md §6): a design tree owned by code, worked one question per turn.
|
|
2
|
+
//
|
|
3
|
+
// The facilitator (the micromanager, on the user's session model) drafts the tree and asks; code validates the tree,
|
|
4
|
+
// keeps the frontier, applies the user's shortcuts and answers, and tells the facilitator what to do next. There
|
|
5
|
+
// are no suggested answers: options or explanations come only when the user is stuck or asks for them.
|
|
6
|
+
const IMPACT_RANK = { low: 0, medium: 1, high: 2 };
|
|
7
|
+
const CAP = { light: 5, normal: 12, frequent: Infinity };
|
|
8
|
+
const MAX_NODES = 25;
|
|
9
|
+
const ID = /^[A-Za-z][\w.-]{0,15}$/;
|
|
10
|
+
// The facilitator's draft: [{ id, question, kind, dependsOn, impact }], or { nodes: [...] }.
|
|
11
|
+
export function parseTree(raw, depth = "normal") {
|
|
12
|
+
const list = Array.isArray(raw) ? raw : raw?.nodes;
|
|
13
|
+
if (!Array.isArray(list) || list.length === 0)
|
|
14
|
+
return { errors: ["the tree needs a non-empty list of questions"] };
|
|
15
|
+
if (list.length > MAX_NODES)
|
|
16
|
+
return { errors: [`at most ${MAX_NODES} questions, got ${list.length}`] };
|
|
17
|
+
const errors = [];
|
|
18
|
+
const nodes = [];
|
|
19
|
+
for (const [i, item] of list.entries()) {
|
|
20
|
+
const n = item;
|
|
21
|
+
const where = `question ${i + 1}${typeof n.id === "string" ? ` (${n.id})` : ""}`;
|
|
22
|
+
const deps = n.dependsOn ?? [];
|
|
23
|
+
if (typeof n.id !== "string" || !ID.test(n.id))
|
|
24
|
+
errors.push(`${where}: needs a short id`);
|
|
25
|
+
if (typeof n.question !== "string" || n.question.trim().length < 5)
|
|
26
|
+
errors.push(`${where}: needs the question text`);
|
|
27
|
+
if (!["decision", "fact", "assumption"].includes(String(n.kind ?? "decision")))
|
|
28
|
+
errors.push(`${where}: kind must be decision, fact or assumption`);
|
|
29
|
+
if (!["low", "medium", "high"].includes(String(n.impact)))
|
|
30
|
+
errors.push(`${where}: impact must be low, medium or high`);
|
|
31
|
+
if (!Array.isArray(deps) || !deps.every((d) => typeof d === "string"))
|
|
32
|
+
errors.push(`${where}: dependsOn must be a list of ids`);
|
|
33
|
+
if (errors.length)
|
|
34
|
+
continue;
|
|
35
|
+
nodes.push({
|
|
36
|
+
id: n.id,
|
|
37
|
+
question: n.question.trim(),
|
|
38
|
+
kind: (n.kind ?? "decision"),
|
|
39
|
+
dependsOn: deps,
|
|
40
|
+
impact: n.impact,
|
|
41
|
+
status: "open",
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const ids = new Set();
|
|
45
|
+
for (const n of nodes) {
|
|
46
|
+
if (ids.has(n.id))
|
|
47
|
+
errors.push(`${n.id}: duplicate id`);
|
|
48
|
+
ids.add(n.id);
|
|
49
|
+
}
|
|
50
|
+
for (const n of nodes)
|
|
51
|
+
for (const d of n.dependsOn)
|
|
52
|
+
if (!ids.has(d))
|
|
53
|
+
errors.push(`${n.id}: depends on unknown ${d}`);
|
|
54
|
+
if (hasCycle(nodes))
|
|
55
|
+
errors.push("the questions depend on each other in a cycle");
|
|
56
|
+
return errors.length ? { errors } : { tree: { nodes, depth, asked: 0, turn: 0 } };
|
|
57
|
+
}
|
|
58
|
+
function hasCycle(nodes) {
|
|
59
|
+
const deps = new Map(nodes.map((n) => [n.id, n.dependsOn]));
|
|
60
|
+
const state = new Map();
|
|
61
|
+
const visit = (id) => {
|
|
62
|
+
if (state.get(id) === 2)
|
|
63
|
+
return false;
|
|
64
|
+
if (state.get(id) === 1)
|
|
65
|
+
return true;
|
|
66
|
+
state.set(id, 1);
|
|
67
|
+
const found = (deps.get(id) ?? []).some(visit);
|
|
68
|
+
state.set(id, 2);
|
|
69
|
+
return found;
|
|
70
|
+
};
|
|
71
|
+
return nodes.some((n) => visit(n.id));
|
|
72
|
+
}
|
|
73
|
+
// Adds nodes the facilitator found later (a new branch); same rules as the draft.
|
|
74
|
+
export function addNodes(tree, raw) {
|
|
75
|
+
const merged = parseTree([...tree.nodes.map((n) => ({ ...n })), ...(Array.isArray(raw) ? raw : [])], tree.depth);
|
|
76
|
+
if (merged.errors)
|
|
77
|
+
return merged.errors;
|
|
78
|
+
const known = new Map(tree.nodes.map((n) => [n.id, n]));
|
|
79
|
+
tree.nodes = merged.tree.nodes.map((n) => known.get(n.id) ?? n);
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
const RESOLVED = new Set(["settled", "assumed", "out_of_scope"]);
|
|
83
|
+
// Low-impact open decisions are not asked: they become assumptions, shown at the checkpoint. Open facts wait
|
|
84
|
+
// for agents, never for the user.
|
|
85
|
+
export function assumeLowImpact(tree) {
|
|
86
|
+
const assumed = tree.nodes.filter((n) => n.status === "open" && n.kind !== "fact" && n.impact === "low");
|
|
87
|
+
for (const n of assumed) {
|
|
88
|
+
n.status = "assumed";
|
|
89
|
+
n.origin = "assumed";
|
|
90
|
+
}
|
|
91
|
+
return assumed;
|
|
92
|
+
}
|
|
93
|
+
// Open decisions whose prerequisites are all resolved: the questions that can be asked now without guessing.
|
|
94
|
+
export function frontier(tree) {
|
|
95
|
+
const byId = new Map(tree.nodes.map((n) => [n.id, n]));
|
|
96
|
+
return tree.nodes.filter((n) => n.status === "open" && n.kind === "decision" && n.dependsOn.every((d) => RESOLVED.has(byId.get(d)?.status ?? "open")));
|
|
97
|
+
}
|
|
98
|
+
export function openFacts(tree) {
|
|
99
|
+
return tree.nodes.filter((n) => n.kind === "fact" && (n.status === "open" || n.status === "researching"));
|
|
100
|
+
}
|
|
101
|
+
// The rules' pick: highest impact, then the one most other questions wait on, then the draft's order.
|
|
102
|
+
export function ruleNext(tree) {
|
|
103
|
+
const waiting = (id) => tree.nodes.filter((n) => n.status === "open" && n.dependsOn.includes(id)).length;
|
|
104
|
+
return [...frontier(tree)].sort((a, b) => IMPACT_RANK[b.impact] - IMPACT_RANK[a.impact] || waiting(b.id) - waiting(a.id))[0];
|
|
105
|
+
}
|
|
106
|
+
export function capReached(tree) {
|
|
107
|
+
return tree.asked >= CAP[tree.depth];
|
|
108
|
+
}
|
|
109
|
+
export function settle(tree, id, answer, origin = "user") {
|
|
110
|
+
const n = tree.nodes.find((x) => x.id === id);
|
|
111
|
+
if (!n)
|
|
112
|
+
return;
|
|
113
|
+
n.status = "settled";
|
|
114
|
+
n.answer = answer;
|
|
115
|
+
n.origin = origin;
|
|
116
|
+
n.settledAt = tree.turn;
|
|
117
|
+
}
|
|
118
|
+
export function matchSessionShortcut(text) {
|
|
119
|
+
const t = text.trim().toLowerCase().replace(/[.!?]+$/, "");
|
|
120
|
+
if (["stop", "enough", "that's enough"].includes(t))
|
|
121
|
+
return { kind: "stop" };
|
|
122
|
+
if (["skip", "decide it yourself", "you decide"].includes(t))
|
|
123
|
+
return { kind: "skip" };
|
|
124
|
+
if (["wait what", "i don't get it", "i do not get it", "what do you mean"].includes(t))
|
|
125
|
+
return { kind: "wait_what" };
|
|
126
|
+
if (["light", "normal", "frequent"].includes(t))
|
|
127
|
+
return { kind: "depth", depth: t };
|
|
128
|
+
if (["confirm", "confirmed", "looks good", "go"].includes(t))
|
|
129
|
+
return { kind: "confirm" };
|
|
130
|
+
if (t === "discuss")
|
|
131
|
+
return { kind: "discuss" };
|
|
132
|
+
const back = t.match(/^(?:go )?back to ([a-z][\w.-]*)$/);
|
|
133
|
+
if (back)
|
|
134
|
+
return { kind: "back", id: back[1] };
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
// One user turn while a question is open. Without a reading (no decision model), an answer counts as settling.
|
|
138
|
+
export function applyAnswer(tree, text, reading = { settles: true }) {
|
|
139
|
+
tree.turn++;
|
|
140
|
+
const node = tree.nodes.find((n) => n.id === tree.current);
|
|
141
|
+
if (!node)
|
|
142
|
+
return undefined;
|
|
143
|
+
// A clear decision wins: help is offered only when the answer does not decide the question (live test: a firm
|
|
144
|
+
// answer also scored 0.71 on "asks for options").
|
|
145
|
+
if ((reading.stuck || reading.asksOptions) && !reading.settles)
|
|
146
|
+
return { kind: "explain", node };
|
|
147
|
+
if (reading.outOfScope) {
|
|
148
|
+
node.status = "out_of_scope";
|
|
149
|
+
node.answer = text;
|
|
150
|
+
return undefined;
|
|
151
|
+
}
|
|
152
|
+
if (reading.contradicts) {
|
|
153
|
+
const earlier = tree.nodes.filter((n) => n.status === "settled" && n.origin === "user");
|
|
154
|
+
if (earlier.length)
|
|
155
|
+
return { kind: "contradiction", node, earlier };
|
|
156
|
+
}
|
|
157
|
+
if (reading.settles === false)
|
|
158
|
+
return { kind: "repitch", node };
|
|
159
|
+
settle(tree, node.id, text);
|
|
160
|
+
if (reading.newBranches)
|
|
161
|
+
return { kind: "add_branches", node };
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
export function applyShortcut(tree, s) {
|
|
165
|
+
const node = tree.nodes.find((n) => n.id === tree.current);
|
|
166
|
+
switch (s.kind) {
|
|
167
|
+
case "stop":
|
|
168
|
+
return { kind: "stopped" };
|
|
169
|
+
case "skip":
|
|
170
|
+
if (node) {
|
|
171
|
+
node.status = "assumed";
|
|
172
|
+
node.origin = "assumed";
|
|
173
|
+
}
|
|
174
|
+
return undefined;
|
|
175
|
+
case "wait_what":
|
|
176
|
+
return node ? { kind: "repitch", node } : undefined;
|
|
177
|
+
case "back": {
|
|
178
|
+
const target = tree.nodes.find((n) => n.id.toLowerCase() === s.id.toLowerCase());
|
|
179
|
+
if (target) {
|
|
180
|
+
target.status = "open";
|
|
181
|
+
target.answer = undefined;
|
|
182
|
+
target.origin = undefined;
|
|
183
|
+
return { kind: "ask", node: target, reason: "the user reopened it" };
|
|
184
|
+
}
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
case "depth":
|
|
188
|
+
tree.depth = s.depth;
|
|
189
|
+
return undefined;
|
|
190
|
+
default:
|
|
191
|
+
return undefined; // confirm and discuss belong to the checkpoint
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
// After a turn: the next question, the checkpoint, or waiting for facts.
|
|
195
|
+
export function nextStep(tree, pick) {
|
|
196
|
+
assumeLowImpact(tree);
|
|
197
|
+
const options = frontier(tree);
|
|
198
|
+
if (options.length === 0 || capReached(tree)) {
|
|
199
|
+
const facts = openFacts(tree);
|
|
200
|
+
if (options.length === 0 && facts.length > 0 && tree.nodes.some((n) => n.status === "open" && n.kind === "decision")) {
|
|
201
|
+
return { kind: "facts_pending", facts };
|
|
202
|
+
}
|
|
203
|
+
return { kind: "checkpoint" };
|
|
204
|
+
}
|
|
205
|
+
const chosen = options.find((n) => n.id === pick) ?? ruleNext(tree);
|
|
206
|
+
tree.current = chosen.id;
|
|
207
|
+
tree.asked++;
|
|
208
|
+
return { kind: "ask", node: chosen, reason: pick === chosen.id ? "the decision model picked it" : "highest impact first" };
|
|
209
|
+
}
|
|
210
|
+
// --- what the facilitator is told -------------------------------------------------------------------------
|
|
211
|
+
const RULES = `Rules of the planning session: ask exactly one question, in plain words, with one to three sentences of
|
|
212
|
+
context. Give no options, no examples of possible answers and no recommendation. Do not answer the question yourself. If a term may be new to the
|
|
213
|
+
user, add a short "Concept:" or "Why this matters:" line. Then stop and wait for the user's answer.`;
|
|
214
|
+
export function instruction(step, job, tree) {
|
|
215
|
+
const decided = tree.nodes.filter((n) => n.status === "settled" && n.origin === "user");
|
|
216
|
+
const settledLine = decided.length ? `\nDecided so far: ${decided.map((n) => `${n.id} ${n.answer}`).join(" | ")}` : "";
|
|
217
|
+
switch (step.kind) {
|
|
218
|
+
case "ask":
|
|
219
|
+
return `[planning session ${job}] Ask the user question ${step.node.id} now: "${step.node.question}"\n${RULES}${settledLine}`;
|
|
220
|
+
case "repitch":
|
|
221
|
+
return `[planning session ${job}] The user did not follow question ${step.node.id} ("${step.node.question}"). Ask it again with the context they were missing, in simpler words, still without options or a recommendation.${settledLine}`;
|
|
222
|
+
case "explain":
|
|
223
|
+
return `[planning session ${job}] The user is stuck on ${step.node.id} ("${step.node.question}") or asked for help. Now, and only now: explain the concept briefly or show two or three approaches with their trade-offs, without picking one. Then hand the decision back: ask which they would take, and why.${settledLine}`;
|
|
224
|
+
case "contradiction":
|
|
225
|
+
return `[planning session ${job}] The user's answer to ${step.node.id} may contradict an earlier decision (${step.earlier.map((n) => `${n.id}: ${n.answer}`).join("; ")}). Name both statements and ask which one holds. No recommendation.`;
|
|
226
|
+
case "add_branches":
|
|
227
|
+
return `[planning session ${job}] The answer to ${step.node.id} raised new decisions. Call plan_questions with job "${job}" and only the new questions (same format: id, question, kind, dependsOn, impact). Do not ask the user anything in this turn.`;
|
|
228
|
+
case "facts_pending":
|
|
229
|
+
return `[planning session ${job}] The remaining decisions wait for facts the agents must find: ${step.facts.map((n) => `${n.id} "${n.question}"`).join("; ")}. Tell the user briefly that these are being looked up; never ask the user for facts.`;
|
|
230
|
+
case "checkpoint":
|
|
231
|
+
return `[planning session ${job}] Design checkpoint. Show the user, apart from each other: (1) their decisions: ${decided.map((n) => `${n.id} ${n.question} -> ${n.answer}`).join("; ") || "none"}; (2) what was assumed without asking (mark these as proposals): ${tree.nodes.filter((n) => n.status === "assumed").map((n) => `${n.id} ${n.question}`).join("; ") || "nothing"}. Then ask them to answer "confirm" to plan with this, or "discuss" to change something.`;
|
|
232
|
+
case "stopped":
|
|
233
|
+
return `[planning session ${job}] The user stopped the planning session. Confirm briefly that the job is paused; plan_job with the job id continues it later.`;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
// The settled tree as the planner gets it: decisions and assumptions, one per line.
|
|
237
|
+
export function decisionsText(tree) {
|
|
238
|
+
return tree.nodes
|
|
239
|
+
.filter((n) => n.status === "settled" || n.status === "assumed")
|
|
240
|
+
.map((n) => `${n.question} -> ${n.status === "assumed" ? "assumed: the planner decides, and says what it chose" : n.answer}`);
|
|
241
|
+
}
|