@femtomc/mu-orchestrator 26.2.21 → 26.2.22
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/dag_runner.d.ts.map +1 -1
- package/dist/dag_runner.js +3 -2
- package/dist/mu_roles.d.ts.map +1 -1
- package/dist/mu_roles.js +36 -30
- package/dist/pi_backend.d.ts +3 -1
- package/dist/pi_backend.d.ts.map +1 -1
- package/dist/pi_backend.js +19 -4
- package/package.json +1 -1
package/dist/dag_runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dag_runner.d.ts","sourceRoot":"","sources":["../src/dag_runner.ts"],"names":[],"mappings":"AAGA,OAAO,EAEN,KAAK,QAAQ,EAKb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAuB,MAAM,uBAAuB,CAAC;AAGjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD,MAAM,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE,YAAY,GAAG,oBAAoB,GAAG,qBAAqB,GAAG,OAAO,CAAC;IAC9E,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IACh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AAE,cAAc,CAAC;CACvB,CAAC;AAkBF,qBAAa,SAAS;;gBAYpB,KAAK,EAAE,UAAU,EACjB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,GAAE;QAAE,OAAO,CAAC,EAAE,aAAa,CAAC;QAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;QAAC,cAAc,CAAC,EAAE,cAAc,CAAA;KAAO;IAkLrF,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAW,EAAE,IAAI,GAAE,gBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;CAiNjG"}
|
package/dist/dag_runner.js
CHANGED
|
@@ -58,9 +58,10 @@ export class DagRunner {
|
|
|
58
58
|
const rendered = await this.#renderUserPrompt(issue, rootId, step, opts.attempt ?? 1);
|
|
59
59
|
const systemPrompt = systemPromptForRole(role);
|
|
60
60
|
const { logsDir } = getStorePaths(this.#repoRoot);
|
|
61
|
-
|
|
61
|
+
const rootLogsDir = join(logsDir, rootId);
|
|
62
|
+
await mkdir(rootLogsDir, { recursive: true });
|
|
62
63
|
const suffix = logSuffix ? `.${logSuffix}` : "";
|
|
63
|
-
const teePath = join(
|
|
64
|
+
const teePath = join(rootLogsDir, `${issue.id}${suffix}.jsonl`);
|
|
64
65
|
await this.#events.emit("backend.run.start", {
|
|
65
66
|
source: "backend",
|
|
66
67
|
issueId: issue.id,
|
package/dist/mu_roles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mu_roles.d.ts","sourceRoot":"","sources":["../src/mu_roles.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,cAAc,GAAG,QAAQ,CAAC;AAE/C,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAM5D;
|
|
1
|
+
{"version":3,"file":"mu_roles.d.ts","sourceRoot":"","sources":["../src/mu_roles.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,cAAc,GAAG,QAAQ,CAAC;AAE/C,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAM5D;AAgED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAwExD"}
|
package/dist/mu_roles.js
CHANGED
|
@@ -15,7 +15,12 @@ const MU_CLI_REFERENCE = `
|
|
|
15
15
|
## mu CLI
|
|
16
16
|
|
|
17
17
|
You are running inside **mu**, an issue-driven orchestration system.
|
|
18
|
-
You have four tools: bash, read, write, edit.
|
|
18
|
+
You have four tools: bash, read, write, edit.
|
|
19
|
+
|
|
20
|
+
- Orchestrator: use bash to run \`mu\` commands; do NOT use write/edit (and avoid read).
|
|
21
|
+
- Worker: use tools as needed to implement your assigned issue.
|
|
22
|
+
|
|
23
|
+
Tip: run \`mu <command> --help\` for details.
|
|
19
24
|
|
|
20
25
|
### Issues
|
|
21
26
|
|
|
@@ -67,40 +72,41 @@ export function systemPromptForRole(role) {
|
|
|
67
72
|
return [
|
|
68
73
|
"# Mu Orchestrator",
|
|
69
74
|
"",
|
|
70
|
-
"You are mu's orchestrator
|
|
75
|
+
"You are mu's orchestrator: the hierarchical planner for the issue DAG.",
|
|
76
|
+
"",
|
|
77
|
+
"## Non-Negotiable Constraints",
|
|
71
78
|
"",
|
|
72
|
-
"
|
|
79
|
+
"1. You MUST NOT execute work directly. No code changes, no file edits, no git commits.",
|
|
80
|
+
"2. You MUST decompose the assigned issue into worker child issues, then close the assigned issue with `--outcome expanded`.",
|
|
81
|
+
"3. Decomposition MUST be deterministic and minimal. Use `blocks` edges for sequencing.",
|
|
73
82
|
"",
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
83
|
+
"Even if the task looks atomic: create exactly one worker child issue rather than doing the work yourself.",
|
|
84
|
+
"If you catch yourself about to implement: STOP and create/refine worker issues instead.",
|
|
85
|
+
"",
|
|
86
|
+
"Your only job is to create child issues, add any required `blocks` dependencies, and then close yourself with outcome=expanded.",
|
|
78
87
|
"",
|
|
79
88
|
"## Workflow",
|
|
80
89
|
"",
|
|
81
|
-
"1.
|
|
82
|
-
"2.
|
|
83
|
-
"3.
|
|
84
|
-
"4.
|
|
85
|
-
"
|
|
90
|
+
"1. Investigate: `mu issues get <id>`, `mu forum read issue:<id> --limit 20`, `mu issues children <id>`.",
|
|
91
|
+
"2. Decompose: create child issues with `mu issues create` (always set `--parent` and `--role worker`).",
|
|
92
|
+
"3. Order: add `blocks` edges between children where sequencing matters.",
|
|
93
|
+
"4. Close: `mu issues close <id> --outcome expanded`.",
|
|
94
|
+
"",
|
|
95
|
+
"The ONLY valid outcome for you is `expanded`.",
|
|
96
|
+
"Never close with `success`, `failure`, `needs_work`, or `skipped` — those are for workers.",
|
|
86
97
|
"",
|
|
87
98
|
"## Rules",
|
|
88
99
|
"",
|
|
89
100
|
"- Use only roles: orchestrator, worker.",
|
|
90
|
-
"-
|
|
91
|
-
"-
|
|
92
|
-
"",
|
|
93
|
-
"## Review Pattern",
|
|
101
|
+
"- Every executable leaf MUST be `--role worker`.",
|
|
102
|
+
"- Never create a child without an explicit role.",
|
|
94
103
|
"",
|
|
95
|
-
"
|
|
96
|
-
"1. Create worker issues for implementation.",
|
|
97
|
-
"2. Create a review issue (`--role orchestrator`) blocked by the workers.",
|
|
98
|
-
"3. The review runs after workers complete — verify, test, or expand further.",
|
|
104
|
+
"## Strategies For Good Plans",
|
|
99
105
|
"",
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
"
|
|
106
|
+
"- Include feedback loops in worker issues: tests, typecheck, build, lint, repro steps.",
|
|
107
|
+
"- Prefer small issues with crisp acceptance criteria over large ambiguous ones.",
|
|
108
|
+
"- If the work needs verification, add a worker review issue blocked by implementation.",
|
|
109
|
+
" If review fails, that worker should close with outcome=needs_work and describe what failed.",
|
|
104
110
|
"",
|
|
105
111
|
MU_CLI_REFERENCE,
|
|
106
112
|
].join("\n");
|
|
@@ -114,21 +120,21 @@ export function systemPromptForRole(role) {
|
|
|
114
120
|
"",
|
|
115
121
|
"- Implement the work described in your assigned issue.",
|
|
116
122
|
"- Keep scope tight to the issue specification.",
|
|
117
|
-
"- Verify results (tests, typecheck, build, etc.) and report what changed.",
|
|
123
|
+
"- Verify results (tests, typecheck, build, lint, etc.) and report what changed.",
|
|
118
124
|
"- Close your issue with a terminal outcome when done.",
|
|
119
125
|
"",
|
|
120
126
|
"## Workflow",
|
|
121
127
|
"",
|
|
122
|
-
"1.
|
|
123
|
-
"2. Implement
|
|
124
|
-
"3. Verify: run tests
|
|
128
|
+
"1. Inspect: `mu issues get <id>` and `mu forum read issue:<id> --limit 20`.",
|
|
129
|
+
"2. Implement: edit files, run commands, and keep changes scoped to the issue.",
|
|
130
|
+
"3. Verify: run tests/build/typecheck/lint as appropriate. Prefer hard feedback loops.",
|
|
125
131
|
"4. Close: `mu issues close <id> --outcome success` (or `failure`/`skipped`).",
|
|
126
|
-
"5.
|
|
132
|
+
"5. Log key notes: `mu forum post issue:<id> -m '...' --author worker`.",
|
|
127
133
|
"",
|
|
128
134
|
"## Rules",
|
|
129
135
|
"",
|
|
130
136
|
"- Do NOT create child issues — that is the orchestrator's job.",
|
|
131
|
-
"- If the issue is too large
|
|
137
|
+
"- If the issue is too large/unclear, close with `--outcome needs_work` and explain what is missing.",
|
|
132
138
|
"",
|
|
133
139
|
MU_CLI_REFERENCE,
|
|
134
140
|
].join("\n");
|
package/dist/pi_backend.d.ts
CHANGED
|
@@ -16,9 +16,11 @@ export type BackendRunOpts = {
|
|
|
16
16
|
export interface BackendRunner {
|
|
17
17
|
run(opts: BackendRunOpts): Promise<number>;
|
|
18
18
|
}
|
|
19
|
+
export type PiCliArgvOpts = Pick<BackendRunOpts, "prompt" | "systemPrompt" | "provider" | "model" | "thinking">;
|
|
20
|
+
/** Build argv for the `pi` CLI. Exported for regression testing. */
|
|
21
|
+
export declare function buildPiCliArgv(opts: PiCliArgvOpts): string[];
|
|
19
22
|
export declare function piStreamHasError(line: string): boolean;
|
|
20
23
|
export declare class PiCliBackend implements BackendRunner {
|
|
21
|
-
#private;
|
|
22
24
|
run(opts: BackendRunOpts): Promise<number>;
|
|
23
25
|
}
|
|
24
26
|
//# sourceMappingURL=pi_backend.d.ts.map
|
package/dist/pi_backend.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi_backend.d.ts","sourceRoot":"","sources":["../src/pi_backend.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,aAAa;IAC7B,GAAG,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA4BtD;AAED,qBAAa,YAAa,YAAW,aAAa
|
|
1
|
+
{"version":3,"file":"pi_backend.d.ts","sourceRoot":"","sources":["../src/pi_backend.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,aAAa;IAC7B,GAAG,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3C;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,cAAc,GAAG,UAAU,GAAG,OAAO,GAAG,UAAU,CAAC,CAAC;AAEhH,oEAAoE;AACpE,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,EAAE,CAgB5D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CA4BtD;AAED,qBAAa,YAAa,YAAW,aAAa;IACpC,GAAG,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;CAuEvD"}
|
package/dist/pi_backend.js
CHANGED
|
@@ -3,6 +3,24 @@ import { mkdir, open } from "node:fs/promises";
|
|
|
3
3
|
import { dirname } from "node:path";
|
|
4
4
|
import { createInterface } from "node:readline";
|
|
5
5
|
import { PassThrough } from "node:stream";
|
|
6
|
+
/** Build argv for the `pi` CLI. Exported for regression testing. */
|
|
7
|
+
export function buildPiCliArgv(opts) {
|
|
8
|
+
return [
|
|
9
|
+
"pi",
|
|
10
|
+
"--mode",
|
|
11
|
+
"json",
|
|
12
|
+
"--no-session",
|
|
13
|
+
"--provider",
|
|
14
|
+
opts.provider,
|
|
15
|
+
"--model",
|
|
16
|
+
opts.model,
|
|
17
|
+
"--thinking",
|
|
18
|
+
opts.thinking,
|
|
19
|
+
"--system-prompt",
|
|
20
|
+
opts.systemPrompt,
|
|
21
|
+
opts.prompt,
|
|
22
|
+
];
|
|
23
|
+
}
|
|
6
24
|
export function piStreamHasError(line) {
|
|
7
25
|
let event;
|
|
8
26
|
try {
|
|
@@ -31,14 +49,11 @@ export function piStreamHasError(line) {
|
|
|
31
49
|
return false;
|
|
32
50
|
}
|
|
33
51
|
export class PiCliBackend {
|
|
34
|
-
#buildArgv(prompt, model, thinking) {
|
|
35
|
-
return ["pi", "--mode", "json", "--no-session", "--model", model, "--thinking", thinking, prompt];
|
|
36
|
-
}
|
|
37
52
|
async run(opts) {
|
|
38
53
|
if (opts.cli !== "pi") {
|
|
39
54
|
throw new Error(`unsupported backend cli=${JSON.stringify(opts.cli)} (only "pi" is supported)`);
|
|
40
55
|
}
|
|
41
|
-
const argv =
|
|
56
|
+
const argv = buildPiCliArgv(opts);
|
|
42
57
|
let teeFh = null;
|
|
43
58
|
try {
|
|
44
59
|
if (opts.teePath) {
|