immune-brain 3.6.9 → 4.0.1
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 +3 -2
- package/plugins/immune-brain/.claude-plugin/plugin.json +1 -1
- package/plugins/immune-brain/.pi-extension/imm-canary-enroll.ts +18 -2
- package/plugins/immune-brain/.pi-extension/imm-canary-work.ts +76 -121
- package/plugins/immune-brain/.pi-extension/imm-unattended-batch.ts +106 -600
- package/plugins/immune-brain/.pi-extension/pi-canary-assurance-progression.ts +1 -0
- package/plugins/immune-brain/.pi-extension/pi-canary-verification.ts +3 -3
- package/plugins/immune-brain/.pi-extension/runtime-stub.ts +17 -43
- package/plugins/immune-brain/dist/claude/mcp-server.mjs +7587 -5049
- package/plugins/immune-brain/dist/docs/reference/planning-artifact-retention.md +11 -12
- package/plugins/immune-brain/dist/docs/reference/subagent-dispatch-protocol.md +1 -1
- package/plugins/immune-brain/dist/imm-loop.md +33 -25
- package/plugins/immune-brain/dist/imm-planner.md +41 -27
- package/plugins/immune-brain/dist/imm-review-retro.md +2 -2
- package/plugins/immune-brain/dist/role-prompts/code-review.md +11 -1
- package/plugins/immune-brain/dist/role-prompts/executor.md +4 -4
- package/plugins/immune-brain/runtime/assurance/coordinator.ts +183 -40
- package/plugins/immune-brain/runtime/assurance/delivery_workspace.ts +240 -0
- package/plugins/immune-brain/runtime/assurance/qa.ts +132 -58
- package/plugins/immune-brain/runtime/assurance/review_evidence.ts +15 -7
- package/plugins/immune-brain/runtime/assurance/verification.ts +246 -206
- package/plugins/immune-brain/runtime/authorization_operation.ts +20 -0
- package/plugins/immune-brain/runtime/claude/kernel_ports.ts +288 -721
- package/plugins/immune-brain/runtime/commands/kernel.ts +158 -67
- package/plugins/immune-brain/runtime/github_issue_tracker.ts +1 -1
- package/plugins/immune-brain/runtime/kernel/actor_identity.ts +33 -0
- package/plugins/immune-brain/runtime/kernel/application.ts +22 -6
- package/plugins/immune-brain/runtime/kernel/assurance_projection.ts +94 -5
- package/plugins/immune-brain/runtime/kernel/authority_port.ts +27 -6
- package/plugins/immune-brain/runtime/kernel/backend_claim.ts +43 -16
- package/plugins/immune-brain/runtime/kernel/batch_authority.ts +10 -6
- package/plugins/immune-brain/runtime/kernel/canary_application.ts +50 -63
- package/plugins/immune-brain/runtime/kernel/canary_eligibility.ts +13 -4
- package/plugins/immune-brain/runtime/kernel/completion.ts +5 -14
- package/plugins/immune-brain/runtime/kernel/enrollment.ts +124 -34
- package/plugins/immune-brain/runtime/kernel/enrollment_authority.ts +13 -5
- package/plugins/immune-brain/runtime/kernel/index.ts +3 -1
- package/plugins/immune-brain/runtime/kernel/intent.ts +7 -11
- package/plugins/immune-brain/runtime/kernel/legacy_audit.ts +4 -1
- package/plugins/immune-brain/runtime/kernel/legacy_task_record.ts +323 -0
- package/plugins/immune-brain/runtime/kernel/pi_canary_prepare.ts +10 -1
- package/plugins/immune-brain/runtime/kernel/reducer.ts +32 -31
- package/plugins/immune-brain/runtime/kernel/run_identity.ts +121 -0
- package/plugins/immune-brain/runtime/kernel/spec_binding.ts +100 -0
- package/plugins/immune-brain/runtime/kernel/sqlite_migration.ts +950 -0
- package/plugins/immune-brain/runtime/kernel/sqlite_store.ts +1193 -0
- package/plugins/immune-brain/runtime/kernel/storage.ts +1254 -1206
- package/plugins/immune-brain/runtime/kernel/storage_layout_migration.ts +129 -755
- package/plugins/immune-brain/runtime/kernel/storage_paths.ts +419 -46
- package/plugins/immune-brain/runtime/kernel/types.ts +12 -43
- package/plugins/immune-brain/runtime/kernel/validation.ts +60 -274
- package/plugins/immune-brain/runtime/managed_task_routing_policy.ts +0 -1
- package/plugins/immune-brain/runtime/plan_core.ts +27 -65
- package/plugins/immune-brain/runtime/plugin_version.ts +1 -1
- package/plugins/immune-brain/runtime/prompts/code-review.md +11 -1
- package/plugins/immune-brain/runtime/prompts/executor.md +4 -4
- package/plugins/immune-brain/runtime/staged_intent.ts +58 -0
- package/plugins/immune-brain/runtime/unattended/batch_git.ts +37 -7
- package/plugins/immune-brain/runtime/unattended/batch_plan.ts +42 -2
- package/plugins/immune-brain/runtime/unattended/batch_preflight.ts +771 -0
- package/plugins/immune-brain/runtime/unattended/batch_reasons.ts +189 -0
- package/plugins/immune-brain/runtime/unattended/batch_runner.ts +35 -0
- package/plugins/immune-brain/runtime/unattended/confirmation_deadline.ts +33 -0
- package/plugins/immune-brain/runtime/unattended/types.ts +14 -1
- package/plugins/immune-brain/runtime/v4_runtime.ts +19 -23
- package/plugins/immune-brain/runtime/verification_descriptor.ts +92 -136
- package/plugins/immune-brain/runtime/workspace_scope.ts +98 -13
- package/plugins/immune-brain/skills/imm-planner/SKILL.md +3 -3
- package/plugins/immune-brain/bin/imm-retire-stale-wrapper +0 -4
- package/plugins/immune-brain/bin/imm-retired +0 -4
- package/plugins/immune-brain/runtime/authority_commit_receipts.ts +0 -716
- package/plugins/immune-brain/runtime/kernel/automatic_observations.ts +0 -451
- package/plugins/immune-brain/runtime/kernel/legacy.ts +0 -299
- package/plugins/immune-brain/runtime/kernel/observation.ts +0 -397
- package/plugins/immune-brain/runtime/kernel/readiness.ts +0 -282
- package/plugins/immune-brain/runtime/kernel/readiness_evidence.ts +0 -132
|
@@ -7,10 +7,10 @@ export {
|
|
|
7
7
|
type VerificationDescriptor,
|
|
8
8
|
} from "../runtime/verification_descriptor";
|
|
9
9
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
resolveVerificationCommand,
|
|
11
|
+
assertCommandIdentity,
|
|
12
12
|
runFixedVerification,
|
|
13
13
|
findingsDigest,
|
|
14
14
|
VerificationAbortedError,
|
|
15
|
-
type
|
|
15
|
+
type FrozenCommand,
|
|
16
16
|
} from "../runtime/assurance/verification";
|
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
// carries no static runtime import, but a Kernel contract change now breaks
|
|
7
7
|
// the extension's build instead of silently drifting from it.
|
|
8
8
|
|
|
9
|
+
// --- Kernel constants the extension must carry as values ---
|
|
10
|
+
// The literal-user authority identity. Mirrored here because extensions cannot
|
|
11
|
+
// statically import Kernel modules; tests/dual-host-assurance-conformance.test.ts
|
|
12
|
+
// pins this value to runtime/kernel/actor_identity.ts, so the two cannot drift.
|
|
13
|
+
export const LITERAL_USER_ACTOR_ID = "literal-user";
|
|
14
|
+
|
|
9
15
|
// --- Types (structural contracts, no runtime import) ---
|
|
10
16
|
export interface EnrollmentCapabilityBinding {
|
|
11
17
|
task_id: string;
|
|
@@ -123,6 +129,7 @@ export interface KernelAuthorityProjection {
|
|
|
123
129
|
requested_task_id: string;
|
|
124
130
|
state: "unowned" | "active_owner" | "terminal_owner" | "repairable_stale_claim" | "authority_conflict";
|
|
125
131
|
owner_task_id: string | null;
|
|
132
|
+
owner_run_id: string | null;
|
|
126
133
|
owner_lifecycle: string | null;
|
|
127
134
|
claim_lifecycle_status: "active" | "draining" | null;
|
|
128
135
|
diagnostic: string | null;
|
|
@@ -302,6 +309,14 @@ export async function withKernelStoreLock<T>(root: string, operation: () => T):
|
|
|
302
309
|
const mod = await import(/* @vite-ignore */ kernelPath("storage"));
|
|
303
310
|
return mod.withKernelStoreLock(root, operation);
|
|
304
311
|
}
|
|
312
|
+
export async function withKernelStoreLockForTask<T>(
|
|
313
|
+
root: string,
|
|
314
|
+
taskId: string,
|
|
315
|
+
operation: () => T,
|
|
316
|
+
): Promise<T> {
|
|
317
|
+
const mod = await import(/* @vite-ignore */ kernelPath("storage"));
|
|
318
|
+
return mod.withKernelStoreLockForTask(root, taskId, operation);
|
|
319
|
+
}
|
|
305
320
|
export async function readBackendClaim(root: string): Promise<BackendClaim | null> {
|
|
306
321
|
const mod = await import(/* @vite-ignore */ kernelPath("backend_claim"));
|
|
307
322
|
return mod.readBackendClaim(root);
|
|
@@ -553,51 +568,10 @@ export async function projectAssuranceForTask(root: string, taskId: string): Pro
|
|
|
553
568
|
if (record.contract === "assurance_kernel/task_record/v4") {
|
|
554
569
|
if (!record.git_base_head)
|
|
555
570
|
throw new Error("TaskRecord v4 is missing git_base_head");
|
|
556
|
-
return scopeMod.taskRevisionIdentity(r, record.intent_snapshot.scope_hint, record.git_base_head);
|
|
571
|
+
return scopeMod.taskRevisionIdentity(r, record.intent_snapshot.scope_hint, record.git_base_head, record.task_id);
|
|
557
572
|
}
|
|
558
|
-
return scopeMod.taskDiffIdentity(r, record.intent_snapshot.scope_hint);
|
|
573
|
+
return scopeMod.taskDiffIdentity(r, record.intent_snapshot.scope_hint, record.task_id);
|
|
559
574
|
};
|
|
560
575
|
return assuranceMod.projectAssurance(root, taskId, diffSnapshotOf);
|
|
561
576
|
}
|
|
562
577
|
|
|
563
|
-
export async function findExistingActiveBatch(root: string, initiativeSlug: string): Promise<any> {
|
|
564
|
-
const { join } = await import("node:path");
|
|
565
|
-
const { existsSync, readdirSync, readFileSync } = await import("node:fs");
|
|
566
|
-
const batchesDir = join(root, ".imm", "state", "batches");
|
|
567
|
-
if (!existsSync(batchesDir)) return null;
|
|
568
|
-
const files = readdirSync(batchesDir);
|
|
569
|
-
for (const file of files) {
|
|
570
|
-
if (!file.endsWith(".json")) continue;
|
|
571
|
-
let record: any;
|
|
572
|
-
try {
|
|
573
|
-
record = JSON.parse(readFileSync(join(batchesDir, file), "utf8"));
|
|
574
|
-
} catch {
|
|
575
|
-
// Unreadable Kernel batch state must fail closed: silently treating the
|
|
576
|
-
// initiative as batchless could authorize a parallel run.
|
|
577
|
-
return { corrupt: true, path: file };
|
|
578
|
-
}
|
|
579
|
-
if (record.contract === "assurance_kernel/batch_run_state/v1" && record.initiative_slug === initiativeSlug) {
|
|
580
|
-
const validStates = new Set([
|
|
581
|
-
"prepared",
|
|
582
|
-
"running",
|
|
583
|
-
"needs_human",
|
|
584
|
-
"completed",
|
|
585
|
-
"budget_stopped",
|
|
586
|
-
"failed",
|
|
587
|
-
"rejected",
|
|
588
|
-
]);
|
|
589
|
-
if (
|
|
590
|
-
typeof record.batch_id !== "string" ||
|
|
591
|
-
typeof record.base_head !== "string" ||
|
|
592
|
-
!Array.isArray(record.children) ||
|
|
593
|
-
!validStates.has(record.batch_state)
|
|
594
|
-
) {
|
|
595
|
-
return { corrupt: true, path: file };
|
|
596
|
-
}
|
|
597
|
-
return record;
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
return null;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
|