immune-brain 5.1.0 → 5.1.2
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/package.json +1 -1
- package/plugins/immune-brain/.claude-plugin/plugin.json +1 -1
- package/plugins/immune-brain/.pi-extension/imm-canary-work.ts +37 -5
- package/plugins/immune-brain/.pi-extension/imm-unattended-batch.ts +230 -10
- package/plugins/immune-brain/.pi-extension/pi-canary-assurance-progression.ts +66 -3
- package/plugins/immune-brain/agents/immune-brain-reviewer.md +26 -1
- package/plugins/immune-brain/dist/claude/mcp-server.mjs +8712 -7410
- package/plugins/immune-brain/dist/docs/reference/planning-quality-gate.md +1 -1
- package/plugins/immune-brain/dist/docs/reference/subagent-dispatch-protocol.md +8 -6
- package/plugins/immune-brain/dist/imm-brainstorm.md +4 -4
- package/plugins/immune-brain/dist/imm-planner.md +41 -5
- package/plugins/immune-brain/dist/imm-run.md +123 -9
- package/plugins/immune-brain/dist/role-prompts/code-review.md +25 -0
- package/plugins/immune-brain/dist/role-prompts/executor.md +7 -0
- package/plugins/immune-brain/hooks/hooks.json +22 -1
- package/plugins/immune-brain/runtime/assurance/active_task_notice.ts +42 -0
- package/plugins/immune-brain/runtime/assurance/coordinator.ts +31 -4
- package/plugins/immune-brain/runtime/assurance/delivery_workspace.ts +4 -1
- package/plugins/immune-brain/runtime/assurance/review_mediation.ts +107 -0
- package/plugins/immune-brain/runtime/assurance/verdict_authority.ts +3 -0
- package/plugins/immune-brain/runtime/claude/interaction.ts +15 -0
- package/plugins/immune-brain/runtime/claude/kernel_ports.ts +120 -59
- package/plugins/immune-brain/runtime/claude/lane_guard.ts +33 -0
- package/plugins/immune-brain/runtime/claude/mcp_server.ts +142 -31
- package/plugins/immune-brain/runtime/commands/kernel.ts +54 -1
- package/plugins/immune-brain/runtime/github_issue_tracker.ts +235 -7
- package/plugins/immune-brain/runtime/kernel/assurance_projection.ts +4 -1
- package/plugins/immune-brain/runtime/kernel/canary_application.ts +9 -2
- package/plugins/immune-brain/runtime/kernel/completion.ts +24 -1
- package/plugins/immune-brain/runtime/kernel/reducer.ts +15 -2
- package/plugins/immune-brain/runtime/kernel/runtime_contracts.json +7 -0
- package/plugins/immune-brain/runtime/kernel/runtime_contracts.ts +75 -0
- package/plugins/immune-brain/runtime/kernel/spec_binding.ts +6 -0
- package/plugins/immune-brain/runtime/kernel/storage.ts +20 -4
- package/plugins/immune-brain/runtime/kernel/storage_paths.ts +33 -3
- package/plugins/immune-brain/runtime/kernel/types.ts +7 -0
- package/plugins/immune-brain/runtime/kernel/validation.ts +13 -2
- package/plugins/immune-brain/runtime/plugin_version.ts +1 -1
- package/plugins/immune-brain/runtime/prompts/code-review.md +25 -0
- package/plugins/immune-brain/runtime/prompts/executor.md +7 -0
- package/plugins/immune-brain/runtime/role_prompt_bridge.ts +1 -1
- package/plugins/immune-brain/runtime/unattended/batch_delegation.ts +160 -0
- package/plugins/immune-brain/runtime/unattended/batch_disposition.ts +222 -0
- package/plugins/immune-brain/runtime/unattended/batch_final_verification.ts +72 -0
- package/plugins/immune-brain/runtime/unattended/batch_lanes.ts +447 -37
- package/plugins/immune-brain/runtime/unattended/batch_leak_restore.ts +131 -0
- package/plugins/immune-brain/runtime/unattended/batch_preflight.ts +33 -16
- package/plugins/immune-brain/runtime/unattended/batch_reasons.ts +16 -3
- package/plugins/immune-brain/runtime/unattended/batch_runner.ts +44 -0
- package/plugins/immune-brain/runtime/unattended/batch_schedule.ts +40 -0
- package/plugins/immune-brain/runtime/unattended/batch_state.ts +199 -6
- package/plugins/immune-brain/runtime/unattended/lane_workspace.ts +58 -0
- package/plugins/immune-brain/skills/imm-brainstorm/SKILL.md +1 -1
- package/plugins/immune-brain/skills/imm-planner/SKILL.md +3 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Full verification of the batch branch once every child is integrated. The
|
|
2
|
+
// commands are the project's own convention, resolved by the Parent from its
|
|
3
|
+
// instruction files and recorded on the batch record when the batch starts, so
|
|
4
|
+
// the completing tick runs exactly what the literal user saw at confirmation.
|
|
5
|
+
// A failure marks the completion report as not passed; integrated commits are
|
|
6
|
+
// never rolled back. Only exit status and timing are recorded, never output.
|
|
7
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
8
|
+
|
|
9
|
+
export const MAX_FINAL_VERIFICATION_COMMANDS = 8;
|
|
10
|
+
const MAX_COMMAND_LENGTH = 512;
|
|
11
|
+
const DEFAULT_TIMEOUT_MS = 30 * 60 * 1000;
|
|
12
|
+
|
|
13
|
+
export interface FinalVerificationResult {
|
|
14
|
+
command: string;
|
|
15
|
+
exit_code: number | null;
|
|
16
|
+
signal: string | null;
|
|
17
|
+
passed: boolean;
|
|
18
|
+
duration_ms: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface FinalVerificationReport {
|
|
22
|
+
passed: boolean;
|
|
23
|
+
head: string | null;
|
|
24
|
+
results: FinalVerificationResult[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** Untrusted tool input: a short list of plain commands, split on whitespace and never run through a shell. */
|
|
28
|
+
export function parseFinalVerification(value: unknown): string[] | undefined {
|
|
29
|
+
if (value === undefined || value === null) return undefined;
|
|
30
|
+
if (!Array.isArray(value) || value.length === 0 || value.length > MAX_FINAL_VERIFICATION_COMMANDS)
|
|
31
|
+
throw new Error(`invalid final_verification: expected 1 to ${MAX_FINAL_VERIFICATION_COMMANDS} commands`);
|
|
32
|
+
return value.map((command) => {
|
|
33
|
+
if (typeof command !== "string" || !command.trim() || command.length > MAX_COMMAND_LENGTH || /[\0\n\r]/.test(command))
|
|
34
|
+
throw new Error("invalid final_verification: each command must be one non-empty line");
|
|
35
|
+
if (/[|&;<>`$(){}"'\\]/.test(command))
|
|
36
|
+
throw new Error("invalid final_verification: commands run without a shell and are split on spaces, so shell syntax and quoting are not allowed");
|
|
37
|
+
return command.trim().replace(/\s+/g, " ");
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** One command, asynchronously, so a long suite never blocks the Host's event loop. */
|
|
42
|
+
function runOne(root: string, command: string, timeoutMs: number): Promise<FinalVerificationResult> {
|
|
43
|
+
const [executable, ...argv] = command.split(" ");
|
|
44
|
+
const started = Date.now();
|
|
45
|
+
return new Promise((resolve) => {
|
|
46
|
+
let settled = false;
|
|
47
|
+
const finish = (exitCode: number | null, signal: string | null) => {
|
|
48
|
+
if (settled) return;
|
|
49
|
+
settled = true;
|
|
50
|
+
clearTimeout(timer);
|
|
51
|
+
resolve({ command, exit_code: exitCode, signal, passed: exitCode === 0, duration_ms: Date.now() - started });
|
|
52
|
+
};
|
|
53
|
+
const child = spawn(executable!, argv, { cwd: root, stdio: "ignore", env: process.env });
|
|
54
|
+
const timer = setTimeout(() => {
|
|
55
|
+
child.kill("SIGKILL");
|
|
56
|
+
finish(null, "timeout");
|
|
57
|
+
}, timeoutMs);
|
|
58
|
+
child.once("error", (error) => finish(null, String((error as NodeJS.ErrnoException).code ?? "spawn_failed")));
|
|
59
|
+
child.once("close", (code, signal) => finish(code, signal));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export async function runFinalVerification(
|
|
64
|
+
root: string,
|
|
65
|
+
commands: readonly string[],
|
|
66
|
+
options: { timeoutMs?: number } = {},
|
|
67
|
+
): Promise<FinalVerificationReport> {
|
|
68
|
+
const head = spawnSync("git", ["-C", root, "rev-parse", "HEAD"], { encoding: "utf8" });
|
|
69
|
+
const results: FinalVerificationResult[] = [];
|
|
70
|
+
for (const command of commands) results.push(await runOne(root, command, options.timeoutMs ?? DEFAULT_TIMEOUT_MS));
|
|
71
|
+
return { passed: results.every((result) => result.passed), head: head.status === 0 ? head.stdout.trim() : null, results };
|
|
72
|
+
}
|