omnius 1.0.271 → 1.0.273

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/index.js CHANGED
@@ -555379,6 +555379,327 @@ var init_permissionRuleset = __esm({
555379
555379
  }
555380
555380
  });
555381
555381
 
555382
+ // packages/orchestrator/dist/steeringIntake.js
555383
+ import { randomUUID as randomUUID16 } from "node:crypto";
555384
+ import { appendFileSync as appendFileSync4, existsSync as existsSync79, mkdirSync as mkdirSync45, readFileSync as readFileSync60 } from "node:fs";
555385
+ import { join as join91 } from "node:path";
555386
+ import { z as z16 } from "zod";
555387
+ function createSteeringIngress(input) {
555388
+ return {
555389
+ id: randomUUID16(),
555390
+ rawText: input.rawText.trim(),
555391
+ sourceSurface: input.sourceSurface,
555392
+ authority: "user",
555393
+ isReplacement: input.isReplacement ?? false,
555394
+ currentTaskGoal: input.currentTaskGoal || "(unknown current task)",
555395
+ recentActivity: input.recentActivity,
555396
+ filesTouched: (input.filesTouched ?? []).filter(Boolean).slice(0, 12),
555397
+ toolCallCount: input.toolCallCount ?? 0,
555398
+ taskId: input.taskId,
555399
+ sessionId: input.sessionId,
555400
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
555401
+ };
555402
+ }
555403
+ async function interpretSteeringIngress(backend, ingress, timeoutMs = 8e3) {
555404
+ const first2 = await backend.chatCompletion({
555405
+ messages: [
555406
+ {
555407
+ role: "system",
555408
+ content: [
555409
+ "You interpret human feedback for a running coding agent.",
555410
+ "Return strict JSON only.",
555411
+ "Use only the supplied task trajectory and ingress.",
555412
+ "The JSON fields describe task impact and next-action guidance."
555413
+ ].join("\n")
555414
+ },
555415
+ { role: "user", content: buildInterpretationPrompt(ingress) }
555416
+ ],
555417
+ tools: [],
555418
+ temperature: 0.2,
555419
+ maxTokens: 512,
555420
+ timeoutMs,
555421
+ think: false,
555422
+ responseFormat: steeringInterpretationResponseFormat()
555423
+ });
555424
+ const raw = first2.choices[0]?.message?.content ?? "";
555425
+ const parsed = parseSteeringInterpretation(raw);
555426
+ if (parsed)
555427
+ return parsed;
555428
+ const repaired = await backend.chatCompletion({
555429
+ messages: [
555430
+ {
555431
+ role: "system",
555432
+ content: "Repair the supplied text into strict JSON matching the requested schema. Return JSON only."
555433
+ },
555434
+ {
555435
+ role: "user",
555436
+ content: [
555437
+ "Schema keys: inference, runnerInstruction, conflicts, alternatives, memoryNote.",
555438
+ "Required keys: inference, runnerInstruction.",
555439
+ "",
555440
+ "Original task state and ingress:",
555441
+ buildInterpretationPrompt(ingress),
555442
+ "",
555443
+ "Malformed model output:",
555444
+ raw
555445
+ ].join("\n")
555446
+ }
555447
+ ],
555448
+ tools: [],
555449
+ temperature: 0,
555450
+ maxTokens: 512,
555451
+ timeoutMs,
555452
+ think: false,
555453
+ responseFormat: steeringInterpretationResponseFormat()
555454
+ });
555455
+ return parseSteeringInterpretation(repaired.choices[0]?.message?.content ?? "");
555456
+ }
555457
+ function buildSteeringPacket(ingress, interpretation) {
555458
+ const lines = [
555459
+ STEERING_START,
555460
+ `id: ${ingress.id}`,
555461
+ `sourceSurface: ${ingress.sourceSurface}`,
555462
+ `feedbackKind: external_human`,
555463
+ `authority: ${ingress.authority}`,
555464
+ `replacement: ${ingress.isReplacement ? "true" : "false"}`,
555465
+ `toolCallsSoFar: ${ingress.toolCallCount}`,
555466
+ `timestamp: ${ingress.timestamp}`,
555467
+ "",
555468
+ "Instruction hierarchy:",
555469
+ "- Treat this as user-level steering, below system/developer/tool safety and above older user assumptions when they conflict.",
555470
+ "",
555471
+ "Current task goal:",
555472
+ truncateBlock(ingress.currentTaskGoal || "(unknown current task)", 1200),
555473
+ "",
555474
+ "Recent activity:",
555475
+ truncateBlock(ingress.recentActivity || "(no recent activity recorded)", 1200),
555476
+ "",
555477
+ ingress.filesTouched.length > 0 ? `Files touched so far: ${ingress.filesTouched.join(", ")}` : "Files touched so far: none recorded",
555478
+ "",
555479
+ RAW_START,
555480
+ ingress.rawText,
555481
+ RAW_END,
555482
+ ""
555483
+ ];
555484
+ if (interpretation) {
555485
+ lines.push("Model-derived steering interpretation:", `inference: ${interpretation.inference}`, `runnerInstruction: ${interpretation.runnerInstruction}`);
555486
+ if (interpretation.conflicts?.length) {
555487
+ lines.push("conflicts:", ...interpretation.conflicts.map((item) => `- ${item}`));
555488
+ }
555489
+ if (interpretation.alternatives?.length) {
555490
+ lines.push("alternative interpretations:", ...interpretation.alternatives.map((item) => `- ${item}`));
555491
+ }
555492
+ if (interpretation.memoryNote) {
555493
+ lines.push(`memoryNote: ${interpretation.memoryNote}`);
555494
+ }
555495
+ lines.push("");
555496
+ } else {
555497
+ lines.push("Model-derived steering interpretation: unavailable", "");
555498
+ }
555499
+ lines.push("Interleave contract:", "- Consume this before the next assistant/tool decision.", "- Do not treat it as passive transcript context.", "- Either act on the steering directly, or explicitly reconcile why it does not alter the current plan.", STEERING_END);
555500
+ return lines.join("\n");
555501
+ }
555502
+ function extractMidTaskSteeringInput(value2) {
555503
+ const start2 = value2.indexOf(RAW_START);
555504
+ const end = value2.indexOf(RAW_END);
555505
+ if (start2 < 0 || end <= start2)
555506
+ return null;
555507
+ return value2.slice(start2 + RAW_START.length, end).trim();
555508
+ }
555509
+ function appendSteeringLedgerEntry(repoRoot, entry) {
555510
+ try {
555511
+ const dir = join91(repoRoot, ".omnius", "context");
555512
+ mkdirSync45(dir, { recursive: true });
555513
+ appendFileSync4(join91(dir, LEDGER_FILE), `${JSON.stringify(entry)}
555514
+ `, "utf-8");
555515
+ } catch {
555516
+ }
555517
+ }
555518
+ function appendSteeringOutcome(repoRoot, packetIds, outcome, summary) {
555519
+ for (const packetId of packetIds) {
555520
+ appendSteeringLedgerEntry(repoRoot, {
555521
+ type: "outcome",
555522
+ packetId,
555523
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
555524
+ outcome,
555525
+ summary: summary.slice(0, 1200)
555526
+ });
555527
+ }
555528
+ }
555529
+ function buildRecentSteeringContext(repoRoot, limit = 3) {
555530
+ const entries = readRecentSteeringEntries(repoRoot, limit);
555531
+ if (entries.length === 0)
555532
+ return "";
555533
+ const lines = entries.map((entry, idx) => {
555534
+ const interpretation = entry.interpretation;
555535
+ const inference = interpretation?.inference || "(raw steering only)";
555536
+ const note = interpretation?.memoryNote ? ` Memory note: ${interpretation.memoryNote}` : "";
555537
+ const outcome = entry.outcome ? ` Outcome: ${entry.outcome}.` : "";
555538
+ return `${idx + 1}. ${inference}${note}${outcome}`;
555539
+ });
555540
+ return [
555541
+ "<recent-user-steering>",
555542
+ "Recent user steering reflections from this workspace. Use only when relevant to the current task.",
555543
+ ...lines,
555544
+ "</recent-user-steering>"
555545
+ ].join("\n");
555546
+ }
555547
+ function buildInterpretationPrompt(ingress) {
555548
+ return [
555549
+ "Infer how this human feedback changes, constrains, or clarifies the active task.",
555550
+ "If there are multiple plausible readings, include them in alternatives.",
555551
+ "If the feedback conflicts with prior task assumptions, list the conflict.",
555552
+ "If this should persist beyond the current turn, include memoryNote.",
555553
+ "",
555554
+ "Return JSON:",
555555
+ "{",
555556
+ ' "inference": "concise user-facing task-impact inference",',
555557
+ ' "runnerInstruction": "specific instruction for the next agent decision",',
555558
+ ' "conflicts": ["optional conflict"],',
555559
+ ' "alternatives": ["optional alternate reading"],',
555560
+ ' "memoryNote": "optional durable lesson"',
555561
+ "}",
555562
+ "",
555563
+ `replacement: ${ingress.isReplacement ? "true" : "false"}`,
555564
+ `toolCallsSoFar: ${ingress.toolCallCount}`,
555565
+ "",
555566
+ "Current task goal:",
555567
+ truncateBlock(ingress.currentTaskGoal || "(unknown current task)", 1200),
555568
+ "",
555569
+ "Recent activity:",
555570
+ truncateBlock(ingress.recentActivity || "(no recent activity recorded)", 1200),
555571
+ "",
555572
+ ingress.filesTouched.length > 0 ? `Files touched so far: ${ingress.filesTouched.join(", ")}` : "Files touched so far: none recorded",
555573
+ "",
555574
+ RAW_START,
555575
+ ingress.rawText,
555576
+ RAW_END
555577
+ ].join("\n");
555578
+ }
555579
+ function parseSteeringInterpretation(raw) {
555580
+ const candidate = extractJsonObject(raw);
555581
+ if (!candidate)
555582
+ return null;
555583
+ try {
555584
+ const parsed = SteeringInterpretationSchema.parse(JSON.parse(candidate));
555585
+ return {
555586
+ inference: parsed.inference,
555587
+ runnerInstruction: parsed.runnerInstruction,
555588
+ conflicts: parsed.conflicts,
555589
+ alternatives: parsed.alternatives,
555590
+ memoryNote: parsed.memoryNote
555591
+ };
555592
+ } catch {
555593
+ return null;
555594
+ }
555595
+ }
555596
+ function extractJsonObject(raw) {
555597
+ const text2 = raw.trim();
555598
+ if (!text2)
555599
+ return null;
555600
+ try {
555601
+ JSON.parse(text2);
555602
+ return text2;
555603
+ } catch {
555604
+ }
555605
+ let start2 = -1;
555606
+ let depth = 0;
555607
+ let inString = false;
555608
+ let escaped = false;
555609
+ for (let i2 = 0; i2 < text2.length; i2++) {
555610
+ const ch = text2[i2];
555611
+ if (inString) {
555612
+ if (escaped) {
555613
+ escaped = false;
555614
+ } else if (ch === "\\") {
555615
+ escaped = true;
555616
+ } else if (ch === '"') {
555617
+ inString = false;
555618
+ }
555619
+ continue;
555620
+ }
555621
+ if (ch === '"') {
555622
+ inString = true;
555623
+ continue;
555624
+ }
555625
+ if (ch === "{") {
555626
+ if (depth === 0)
555627
+ start2 = i2;
555628
+ depth++;
555629
+ continue;
555630
+ }
555631
+ if (ch === "}") {
555632
+ depth--;
555633
+ if (depth === 0 && start2 >= 0)
555634
+ return text2.slice(start2, i2 + 1);
555635
+ if (depth < 0) {
555636
+ start2 = -1;
555637
+ depth = 0;
555638
+ }
555639
+ }
555640
+ }
555641
+ return null;
555642
+ }
555643
+ function steeringInterpretationResponseFormat() {
555644
+ return { type: "json_object" };
555645
+ }
555646
+ function readRecentSteeringEntries(repoRoot, limit) {
555647
+ try {
555648
+ const file = join91(repoRoot, ".omnius", "context", LEDGER_FILE);
555649
+ if (!existsSync79(file))
555650
+ return [];
555651
+ const lines = readFileSync60(file, "utf-8").split("\n").filter(Boolean).slice(-100);
555652
+ const parsedEntries = [];
555653
+ for (const line of lines) {
555654
+ try {
555655
+ parsedEntries.push(JSON.parse(line));
555656
+ } catch {
555657
+ }
555658
+ }
555659
+ const latestOutcomes = /* @__PURE__ */ new Map();
555660
+ for (const entry of parsedEntries) {
555661
+ if (entry.type === "outcome")
555662
+ latestOutcomes.set(entry.packetId, entry);
555663
+ }
555664
+ const out = [];
555665
+ for (let i2 = parsedEntries.length - 1; i2 >= 0 && out.length < limit; i2--) {
555666
+ const parsed = parsedEntries[i2];
555667
+ if (parsed.type === "ingress") {
555668
+ const outcome = latestOutcomes.get(parsed.packetId);
555669
+ out.push(outcome ? { ...parsed, outcome: outcome.outcome, summary: outcome.summary } : parsed);
555670
+ }
555671
+ }
555672
+ return out;
555673
+ } catch {
555674
+ return [];
555675
+ }
555676
+ }
555677
+ function truncateBlock(value2, max) {
555678
+ const trimmed = value2.trim();
555679
+ if (trimmed.length <= max)
555680
+ return trimmed;
555681
+ return `${trimmed.slice(0, max).trimEnd()}
555682
+ ...(truncated)`;
555683
+ }
555684
+ var STEERING_START, STEERING_END, RAW_START, RAW_END, LEDGER_FILE, SteeringInterpretationSchema;
555685
+ var init_steeringIntake = __esm({
555686
+ "packages/orchestrator/dist/steeringIntake.js"() {
555687
+ "use strict";
555688
+ STEERING_START = "[MID_TASK_STEERING_INTAKE v2]";
555689
+ STEERING_END = "[/MID_TASK_STEERING_INTAKE]";
555690
+ RAW_START = "<<<USER_ADDED_CONTEXT>>>";
555691
+ RAW_END = "<<<END_USER_ADDED_CONTEXT>>>";
555692
+ LEDGER_FILE = "steering-ledger.jsonl";
555693
+ SteeringInterpretationSchema = z16.object({
555694
+ inference: z16.string().trim().min(1),
555695
+ runnerInstruction: z16.string().trim().min(1),
555696
+ conflicts: z16.array(z16.string().trim().min(1)).optional().default([]),
555697
+ alternatives: z16.array(z16.string().trim().min(1)).optional().default([]),
555698
+ memoryNote: z16.string().trim().min(1).optional()
555699
+ });
555700
+ }
555701
+ });
555702
+
555382
555703
  // packages/orchestrator/dist/completionContract.js
555383
555704
  function normalizeText(value2, max = 500) {
555384
555705
  const text2 = String(value2 ?? "").trim().replace(/\s+/g, " ");
@@ -555565,7 +555886,7 @@ var init_completionContract = __esm({
555565
555886
  });
555566
555887
 
555567
555888
  // packages/orchestrator/dist/completionLedger.js
555568
- import { mkdirSync as mkdirSync45, readFileSync as readFileSync60, writeFileSync as writeFileSync38 } from "node:fs";
555889
+ import { mkdirSync as mkdirSync46, readFileSync as readFileSync61, writeFileSync as writeFileSync38 } from "node:fs";
555569
555890
  import { dirname as dirname27 } from "node:path";
555570
555891
  function nowIso2(now2 = /* @__PURE__ */ new Date()) {
555571
555892
  return now2 instanceof Date ? now2.toISOString() : new Date(now2).toISOString();
@@ -555750,12 +556071,12 @@ function buildCriticPacketFromLedger(ledger) {
555750
556071
  return lines.join("\n");
555751
556072
  }
555752
556073
  function saveCompletionLedger(filePath, ledger) {
555753
- mkdirSync45(dirname27(filePath), { recursive: true });
556074
+ mkdirSync46(dirname27(filePath), { recursive: true });
555754
556075
  writeFileSync38(filePath, `${JSON.stringify(ledger, null, 2)}
555755
556076
  `, "utf8");
555756
556077
  }
555757
556078
  function loadCompletionLedger(filePath) {
555758
- return JSON.parse(readFileSync60(filePath, "utf8"));
556079
+ return JSON.parse(readFileSync61(filePath, "utf8"));
555759
556080
  }
555760
556081
  var init_completionLedger = __esm({
555761
556082
  "packages/orchestrator/dist/completionLedger.js"() {
@@ -556423,9 +556744,9 @@ var init_ollama_pool_cleanup = __esm({
556423
556744
 
556424
556745
  // packages/orchestrator/dist/ollama-pool.js
556425
556746
  import { spawn as spawn24, exec as exec2 } from "node:child_process";
556426
- import { existsSync as existsSync79, readFileSync as readFileSync61, readdirSync as readdirSync24, statfsSync as statfsSync3, statSync as statSync29 } from "node:fs";
556747
+ import { existsSync as existsSync80, readFileSync as readFileSync62, readdirSync as readdirSync24, statfsSync as statfsSync3, statSync as statSync29 } from "node:fs";
556427
556748
  import { homedir as homedir30 } from "node:os";
556428
- import { join as join91 } from "node:path";
556749
+ import { join as join92 } from "node:path";
556429
556750
  import { createServer as createServer3 } from "node:net";
556430
556751
  import { EventEmitter as EventEmitter5 } from "node:events";
556431
556752
  function discoverSystemOllamaModelStore() {
@@ -556438,7 +556759,7 @@ function discoverSystemOllamaModelStore() {
556438
556759
  const candidates = [
556439
556760
  "/usr/share/ollama/.ollama/models",
556440
556761
  "/var/lib/ollama/.ollama/models",
556441
- join91(homedir30(), ".ollama", "models")
556762
+ join92(homedir30(), ".ollama", "models")
556442
556763
  ];
556443
556764
  for (const p2 of candidates) {
556444
556765
  if (isDirectory(p2))
@@ -556448,7 +556769,7 @@ function discoverSystemOllamaModelStore() {
556448
556769
  }
556449
556770
  function isDirectory(path12) {
556450
556771
  try {
556451
- return existsSync79(path12) && statSync29(path12).isDirectory();
556772
+ return existsSync80(path12) && statSync29(path12).isDirectory();
556452
556773
  } catch {
556453
556774
  return false;
556454
556775
  }
@@ -556462,7 +556783,7 @@ function discoverOllamaModelStoreFromProc() {
556462
556783
  return envStore;
556463
556784
  const home = inferHomeFromProcUid(pid);
556464
556785
  if (home) {
556465
- const inferred = join91(home, ".ollama", "models");
556786
+ const inferred = join92(home, ".ollama", "models");
556466
556787
  if (isDirectory(inferred))
556467
556788
  return inferred;
556468
556789
  }
@@ -556473,7 +556794,7 @@ function listOllamaPids() {
556473
556794
  try {
556474
556795
  return readdirSync24("/proc", { withFileTypes: true }).filter((d2) => d2.isDirectory() && /^\d+$/.test(d2.name)).map((d2) => d2.name).filter((pid) => {
556475
556796
  try {
556476
- const comm = readFileSync61(`/proc/${pid}/comm`, "utf8").trim();
556797
+ const comm = readFileSync62(`/proc/${pid}/comm`, "utf8").trim();
556477
556798
  return comm === "ollama";
556478
556799
  } catch {
556479
556800
  return false;
@@ -556485,7 +556806,7 @@ function listOllamaPids() {
556485
556806
  }
556486
556807
  function readProcEnvValue(pid, key) {
556487
556808
  try {
556488
- const raw = readFileSync61(`/proc/${pid}/environ`, "utf8");
556809
+ const raw = readFileSync62(`/proc/${pid}/environ`, "utf8");
556489
556810
  for (const entry of raw.split("\0")) {
556490
556811
  const idx = entry.indexOf("=");
556491
556812
  if (idx <= 0)
@@ -556501,11 +556822,11 @@ function readProcEnvValue(pid, key) {
556501
556822
  }
556502
556823
  function inferHomeFromProcUid(pid) {
556503
556824
  try {
556504
- const status = readFileSync61(`/proc/${pid}/status`, "utf8");
556825
+ const status = readFileSync62(`/proc/${pid}/status`, "utf8");
556505
556826
  const uid = status.match(/^Uid:\s+(\d+)/m)?.[1];
556506
556827
  if (!uid)
556507
556828
  return null;
556508
- const passwd = readFileSync61("/etc/passwd", "utf8");
556829
+ const passwd = readFileSync62("/etc/passwd", "utf8");
556509
556830
  for (const line of passwd.split("\n")) {
556510
556831
  const parts = line.split(":");
556511
556832
  if (parts.length >= 7 && parts[2] === uid)
@@ -556531,7 +556852,7 @@ function detectPeerOmniusOllamaPool() {
556531
556852
  if (e2.name === selfPid || e2.name === selfPpid)
556532
556853
  continue;
556533
556854
  try {
556534
- const cmdline = readFileSync61(`/proc/${e2.name}/cmdline`, "utf8");
556855
+ const cmdline = readFileSync62(`/proc/${e2.name}/cmdline`, "utf8");
556535
556856
  if (!cmdline.includes("node"))
556536
556857
  continue;
556537
556858
  if (!/[/\\]omnius[/\\]dist[/\\]index\.js|[/\\]omnius[/\\]/i.test(cmdline))
@@ -556544,12 +556865,12 @@ function detectPeerOmniusOllamaPool() {
556544
556865
  return false;
556545
556866
  for (const e2 of entries) {
556546
556867
  try {
556547
- const cmd = readFileSync61(`/proc/${e2.name}/cmdline`, "utf8");
556868
+ const cmd = readFileSync62(`/proc/${e2.name}/cmdline`, "utf8");
556548
556869
  if (!cmd.includes("ollama"))
556549
556870
  continue;
556550
556871
  if (!cmd.split("\0").includes("serve"))
556551
556872
  continue;
556552
- const status = readFileSync61(`/proc/${e2.name}/status`, "utf8");
556873
+ const status = readFileSync62(`/proc/${e2.name}/status`, "utf8");
556553
556874
  const ppid = status.match(/^PPid:\s+(\d+)/m)?.[1];
556554
556875
  if (ppid && peerNodePids.has(ppid))
556555
556876
  return true;
@@ -556680,7 +557001,7 @@ function snapshotDisk(path12) {
556680
557001
  }
556681
557002
  function snapshotNetwork() {
556682
557003
  try {
556683
- const raw = readFileSync61("/proc/net/dev", "utf8");
557004
+ const raw = readFileSync62("/proc/net/dev", "utf8");
556684
557005
  let rxBytes = 0;
556685
557006
  let txBytes = 0;
556686
557007
  for (const line of raw.split("\n")) {
@@ -558163,7 +558484,7 @@ var init_mast_tagger = __esm({
558163
558484
  });
558164
558485
 
558165
558486
  // packages/orchestrator/dist/artifact-inspector.js
558166
- import { existsSync as existsSync80, statSync as statSync30 } from "node:fs";
558487
+ import { existsSync as existsSync81, statSync as statSync30 } from "node:fs";
558167
558488
  import { isAbsolute as isAbsolute5, resolve as resolve47 } from "node:path";
558168
558489
  function extractCandidatePaths(content) {
558169
558490
  const out = /* @__PURE__ */ new Set();
@@ -558189,7 +558510,7 @@ function inspectClaimedArtifacts(input) {
558189
558510
  const stale = [];
558190
558511
  for (const p2 of candidates) {
558191
558512
  const resolved = resolveAgainstWorkingDir(input.workingDir, p2);
558192
- if (!existsSync80(resolved)) {
558513
+ if (!existsSync81(resolved)) {
558193
558514
  missing.push(p2);
558194
558515
  continue;
558195
558516
  }
@@ -558259,8 +558580,8 @@ var init_artifact_inspector = __esm({
558259
558580
  });
558260
558581
 
558261
558582
  // packages/orchestrator/dist/lesson-bank.js
558262
- import { existsSync as existsSync81, mkdirSync as mkdirSync46, appendFileSync as appendFileSync4, readFileSync as readFileSync62 } from "node:fs";
558263
- import { join as join92, dirname as dirname28 } from "node:path";
558583
+ import { existsSync as existsSync82, mkdirSync as mkdirSync47, appendFileSync as appendFileSync5, readFileSync as readFileSync63 } from "node:fs";
558584
+ import { join as join93, dirname as dirname28 } from "node:path";
558264
558585
  import { createHash as createHash25 } from "node:crypto";
558265
558586
  function tokenize4(text2) {
558266
558587
  if (!text2)
@@ -558292,20 +558613,20 @@ function solicit(args) {
558292
558613
  };
558293
558614
  }
558294
558615
  function lessonBankPath(workingDir) {
558295
- const base3 = workingDir ? join92(workingDir, ".omnius", "lessons") : join92(process.env["HOME"] || ".", ".omnius", "lessons");
558296
- return join92(base3, "lessons.jsonl");
558616
+ const base3 = workingDir ? join93(workingDir, ".omnius", "lessons") : join93(process.env["HOME"] || ".", ".omnius", "lessons");
558617
+ return join93(base3, "lessons.jsonl");
558297
558618
  }
558298
558619
  function bank(lesson, workingDir) {
558299
558620
  const path12 = lessonBankPath(workingDir);
558300
- mkdirSync46(dirname28(path12), { recursive: true });
558301
- appendFileSync4(path12, JSON.stringify(lesson) + "\n", "utf-8");
558621
+ mkdirSync47(dirname28(path12), { recursive: true });
558622
+ appendFileSync5(path12, JSON.stringify(lesson) + "\n", "utf-8");
558302
558623
  }
558303
558624
  function readAll(workingDir) {
558304
558625
  const path12 = lessonBankPath(workingDir);
558305
- if (!existsSync81(path12))
558626
+ if (!existsSync82(path12))
558306
558627
  return [];
558307
558628
  try {
558308
- const raw = readFileSync62(path12, "utf-8");
558629
+ const raw = readFileSync63(path12, "utf-8");
558309
558630
  const out = [];
558310
558631
  for (const line of raw.split(/\r?\n/)) {
558311
558632
  const trimmed = line.trim();
@@ -558362,13 +558683,13 @@ var init_lesson_bank = __esm({
558362
558683
  });
558363
558684
 
558364
558685
  // packages/orchestrator/dist/intervention-replay.js
558365
- import { existsSync as existsSync82, mkdirSync as mkdirSync47, readFileSync as readFileSync63, writeFileSync as writeFileSync39, readdirSync as readdirSync25 } from "node:fs";
558366
- import { join as join93, dirname as dirname29 } from "node:path";
558686
+ import { existsSync as existsSync83, mkdirSync as mkdirSync48, readFileSync as readFileSync64, writeFileSync as writeFileSync39, readdirSync as readdirSync25 } from "node:fs";
558687
+ import { join as join94, dirname as dirname29 } from "node:path";
558367
558688
  function checkpointDir2(workingDir) {
558368
- return workingDir ? join93(workingDir, ".omnius", "checkpoints") : join93(process.env["HOME"] || ".", ".omnius", "checkpoints");
558689
+ return workingDir ? join94(workingDir, ".omnius", "checkpoints") : join94(process.env["HOME"] || ".", ".omnius", "checkpoints");
558369
558690
  }
558370
558691
  function checkpointPath(workingDir, turn) {
558371
- return join93(checkpointDir2(workingDir), `turn-${String(turn).padStart(4, "0")}.json`);
558692
+ return join94(checkpointDir2(workingDir), `turn-${String(turn).padStart(4, "0")}.json`);
558372
558693
  }
558373
558694
  function writeCheckpoint(args) {
558374
558695
  try {
@@ -558380,7 +558701,7 @@ function writeCheckpoint(args) {
558380
558701
  notes: args.notes
558381
558702
  };
558382
558703
  const path12 = checkpointPath(args.workingDir, args.turn);
558383
- mkdirSync47(dirname29(path12), { recursive: true });
558704
+ mkdirSync48(dirname29(path12), { recursive: true });
558384
558705
  writeFileSync39(path12, JSON.stringify(snap), "utf-8");
558385
558706
  } catch {
558386
558707
  }
@@ -558388,7 +558709,7 @@ function writeCheckpoint(args) {
558388
558709
  function listCheckpoints(workingDir) {
558389
558710
  try {
558390
558711
  const dir = checkpointDir2(workingDir);
558391
- if (!existsSync82(dir))
558712
+ if (!existsSync83(dir))
558392
558713
  return [];
558393
558714
  return readdirSync25(dir).map((f2) => f2.match(/^turn-(\d+)\.json$/)).filter((m2) => m2 !== null).map((m2) => parseInt(m2[1], 10)).filter((n2) => !Number.isNaN(n2)).sort((a2, b) => a2 - b);
558394
558715
  } catch {
@@ -558404,7 +558725,7 @@ function pruneOldCheckpoints(args) {
558404
558725
  for (const t2 of toRemove) {
558405
558726
  try {
558406
558727
  const path12 = checkpointPath(args.workingDir, t2);
558407
- if (existsSync82(path12)) {
558728
+ if (existsSync83(path12)) {
558408
558729
  const fs11 = __require("node:fs");
558409
558730
  fs11.unlinkSync(path12);
558410
558731
  removed++;
@@ -558421,13 +558742,13 @@ var init_intervention_replay = __esm({
558421
558742
  });
558422
558743
 
558423
558744
  // packages/orchestrator/dist/world-state-disk-scan.js
558424
- import { existsSync as existsSync83, readFileSync as readFileSync64, readdirSync as readdirSync26, statSync as statSync31 } from "node:fs";
558425
- import { join as join94, relative as relative8, basename as basename20 } from "node:path";
558745
+ import { existsSync as existsSync84, readFileSync as readFileSync65, readdirSync as readdirSync26, statSync as statSync31 } from "node:fs";
558746
+ import { join as join95, relative as relative8, basename as basename20 } from "node:path";
558426
558747
  function loadIgnoreFile(path12) {
558427
- if (!existsSync83(path12))
558748
+ if (!existsSync84(path12))
558428
558749
  return [];
558429
558750
  try {
558430
- const lines = readFileSync64(path12, "utf-8").split(/\r?\n/);
558751
+ const lines = readFileSync65(path12, "utf-8").split(/\r?\n/);
558431
558752
  const out = [];
558432
558753
  for (const raw of lines) {
558433
558754
  const line = raw.trim();
@@ -558469,7 +558790,7 @@ function scanWorkspace(opts) {
558469
558790
  if (!noDefaults)
558470
558791
  patterns.push(...UNIVERSAL_DEFAULTS);
558471
558792
  if (!noGitignore)
558472
- patterns.push(...loadIgnoreFile(join94(root, ".gitignore")));
558793
+ patterns.push(...loadIgnoreFile(join95(root, ".gitignore")));
558473
558794
  if (opts.extraIgnore)
558474
558795
  patterns.push(...opts.extraIgnore);
558475
558796
  const files = [];
@@ -558500,7 +558821,7 @@ function scanWorkspace(opts) {
558500
558821
  truncated = true;
558501
558822
  break;
558502
558823
  }
558503
- const abs = join94(dir, entry);
558824
+ const abs = join95(dir, entry);
558504
558825
  const rel = relative8(root, abs);
558505
558826
  const base3 = basename20(abs);
558506
558827
  if (shouldIgnore(rel, base3, patterns))
@@ -558588,8 +558909,8 @@ var init_world_state_disk_scan = __esm({
558588
558909
  });
558589
558910
 
558590
558911
  // packages/orchestrator/dist/world-state-plan-reconciler.js
558591
- import { existsSync as existsSync84, statSync as statSync32 } from "node:fs";
558592
- import { isAbsolute as isAbsolute6, join as join95 } from "node:path";
558912
+ import { existsSync as existsSync85, statSync as statSync32 } from "node:fs";
558913
+ import { isAbsolute as isAbsolute6, join as join96 } from "node:path";
558593
558914
  function tokenize5(content) {
558594
558915
  const STOP2 = /* @__PURE__ */ new Set([
558595
558916
  "the",
@@ -558671,7 +558992,7 @@ function reconcileTodo(todo, files, opts) {
558671
558992
  let anyMissing = false;
558672
558993
  let anyEmpty = false;
558673
558994
  for (const p2 of declared) {
558674
- const abs = isAbsolute6(p2) ? p2 : join95(opts.workingDir, p2);
558995
+ const abs = isAbsolute6(p2) ? p2 : join96(opts.workingDir, p2);
558675
558996
  let st = null;
558676
558997
  try {
558677
558998
  st = statSync32(abs);
@@ -558679,7 +559000,7 @@ function reconcileTodo(todo, files, opts) {
558679
559000
  st = null;
558680
559001
  }
558681
559002
  if (!st) {
558682
- if (!existsSync84(abs)) {
559003
+ if (!existsSync85(abs)) {
558683
559004
  checks.push({ path: p2, ok: false, reason: "missing" });
558684
559005
  anyMissing = true;
558685
559006
  allOk = false;
@@ -558777,8 +559098,8 @@ var init_world_state_plan_reconciler = __esm({
558777
559098
  });
558778
559099
 
558779
559100
  // packages/orchestrator/dist/world-state-drift-detector.js
558780
- import { existsSync as existsSync85, readFileSync as readFileSync65, statSync as statSync33 } from "node:fs";
558781
- import { dirname as dirname30, isAbsolute as isAbsolute7, join as join96, resolve as pathResolve } from "node:path";
559101
+ import { existsSync as existsSync86, readFileSync as readFileSync66, statSync as statSync33 } from "node:fs";
559102
+ import { dirname as dirname30, isAbsolute as isAbsolute7, join as join97, resolve as pathResolve } from "node:path";
558782
559103
  function parseImports(source) {
558783
559104
  const out = [];
558784
559105
  const lines = source.split(/\r?\n/);
@@ -558931,11 +559252,11 @@ function loadProjectAliases(workingDir) {
558931
559252
  const configCandidates = ["tsconfig.json", "jsconfig.json"];
558932
559253
  const aliases = {};
558933
559254
  for (const name10 of configCandidates) {
558934
- const path12 = join96(workingDir, name10);
558935
- if (!existsSync85(path12))
559255
+ const path12 = join97(workingDir, name10);
559256
+ if (!existsSync86(path12))
558936
559257
  continue;
558937
559258
  try {
558938
- const raw = readFileSync65(path12, "utf-8");
559259
+ const raw = readFileSync66(path12, "utf-8");
558939
559260
  const parsed = JSON.parse(stripJsonComments(raw));
558940
559261
  const co = parsed?.compilerOptions;
558941
559262
  const paths = co?.paths;
@@ -558982,11 +559303,11 @@ function resolveImportPath2(importingFile, source, workingDir, aliases) {
558982
559303
  for (const ext of FILE_EXTENSIONS)
558983
559304
  candidates.push(base3 + ext);
558984
559305
  for (const ext of FILE_EXTENSIONS)
558985
- candidates.push(join96(base3, "index" + ext));
559306
+ candidates.push(join97(base3, "index" + ext));
558986
559307
  candidates.push(base3);
558987
559308
  for (const c8 of candidates) {
558988
559309
  try {
558989
- if (existsSync85(c8) && statSync33(c8).isFile())
559310
+ if (existsSync86(c8) && statSync33(c8).isFile())
558990
559311
  return c8;
558991
559312
  } catch {
558992
559313
  }
@@ -559024,7 +559345,7 @@ function detectDrift(files, opts) {
559024
559345
  const exportsCache = /* @__PURE__ */ new Map();
559025
559346
  const readSource = (path12) => {
559026
559347
  try {
559027
- const buf = readFileSync65(path12);
559348
+ const buf = readFileSync66(path12);
559028
559349
  if (buf.length > maxBytes)
559029
559350
  return buf.slice(0, maxBytes).toString("utf-8");
559030
559351
  return buf.toString("utf-8");
@@ -559639,16 +559960,16 @@ var init_backward_pass_critic = __esm({
559639
559960
  });
559640
559961
 
559641
559962
  // packages/orchestrator/dist/backward-pass-runner.js
559642
- import { existsSync as existsSync86, readFileSync as readFileSync66, statSync as statSync34 } from "node:fs";
559963
+ import { existsSync as existsSync87, readFileSync as readFileSync67, statSync as statSync34 } from "node:fs";
559643
559964
  import { execSync as execSync45 } from "node:child_process";
559644
- import { isAbsolute as isAbsolute8, join as join97, relative as relative9 } from "node:path";
559965
+ import { isAbsolute as isAbsolute8, join as join98, relative as relative9 } from "node:path";
559645
559966
  function collectDiff(opts) {
559646
559967
  const cap = Math.max(1, opts.maxFiles);
559647
559968
  if (opts.explicitFiles && opts.explicitFiles.length > 0) {
559648
559969
  const files = [];
559649
559970
  for (const p2 of opts.explicitFiles.slice(0, cap)) {
559650
- const abs = isAbsolute8(p2) ? p2 : join97(opts.workingDir, p2);
559651
- if (!existsSync86(abs))
559971
+ const abs = isAbsolute8(p2) ? p2 : join98(opts.workingDir, p2);
559972
+ if (!existsSync87(abs))
559652
559973
  continue;
559653
559974
  let bytes = 0;
559654
559975
  try {
@@ -559659,7 +559980,7 @@ function collectDiff(opts) {
559659
559980
  }
559660
559981
  return { files, strategy: "explicit" };
559661
559982
  }
559662
- if (existsSync86(join97(opts.workingDir, ".git"))) {
559983
+ if (existsSync87(join98(opts.workingDir, ".git"))) {
559663
559984
  try {
559664
559985
  const out = execSync45("git diff --name-status HEAD 2>/dev/null; git ls-files --others --exclude-standard 2>/dev/null", { cwd: opts.workingDir, encoding: "utf-8", maxBuffer: 4 * 1024 * 1024, stdio: ["ignore", "pipe", "ignore"] });
559665
559986
  const files = [];
@@ -559676,9 +559997,9 @@ function collectDiff(opts) {
559676
559997
  status = "added";
559677
559998
  path12 = line.trim();
559678
559999
  }
559679
- const abs = join97(opts.workingDir, path12);
560000
+ const abs = join98(opts.workingDir, path12);
559680
560001
  let bytes = 0;
559681
- if (existsSync86(abs)) {
560002
+ if (existsSync87(abs)) {
559682
560003
  try {
559683
560004
  bytes = statSync34(abs).size;
559684
560005
  } catch {
@@ -559699,7 +560020,7 @@ function collectDiff(opts) {
559699
560020
  }
559700
560021
  function readPreview(absPath, maxBytes) {
559701
560022
  try {
559702
- const buf = readFileSync66(absPath);
560023
+ const buf = readFileSync67(absPath);
559703
560024
  if (buf.length === 0)
559704
560025
  return "";
559705
560026
  const sniff = buf.slice(0, Math.min(8192, buf.length));
@@ -559726,7 +560047,7 @@ async function runBackwardPass(opts) {
559726
560047
  explicitFiles: opts.explicitFiles
559727
560048
  });
559728
560049
  const diff = collected.files.map((f2) => {
559729
- const abs = isAbsolute8(f2.path) ? f2.path : join97(opts.workingDir, f2.path);
560050
+ const abs = isAbsolute8(f2.path) ? f2.path : join98(opts.workingDir, f2.path);
559730
560051
  const preview = f2.status === "deleted" ? "(file deleted)" : readPreview(abs, maxFilePreviewBytes);
559731
560052
  return { ...f2, preview };
559732
560053
  });
@@ -562196,13 +562517,13 @@ var init_hooks2 = __esm({
562196
562517
  });
562197
562518
 
562198
562519
  // packages/orchestrator/dist/todo-context-chunker.js
562199
- import { mkdirSync as mkdirSync50, writeFileSync as writeFileSync42, readFileSync as readFileSync69, existsSync as existsSync89, readdirSync as readdirSync27 } from "node:fs";
562200
- import { join as join100 } from "node:path";
562520
+ import { mkdirSync as mkdirSync51, writeFileSync as writeFileSync42, readFileSync as readFileSync70, existsSync as existsSync90, readdirSync as readdirSync27 } from "node:fs";
562521
+ import { join as join101 } from "node:path";
562201
562522
  function chunkDir(workingDir) {
562202
- return join100(workingDir, ".omnius", "todo-chunks");
562523
+ return join101(workingDir, ".omnius", "todo-chunks");
562203
562524
  }
562204
562525
  function chunkPath(workingDir, todoId) {
562205
- return join100(chunkDir(workingDir), `${sanitizeId(todoId)}.json`);
562526
+ return join101(chunkDir(workingDir), `${sanitizeId(todoId)}.json`);
562206
562527
  }
562207
562528
  function sanitizeId(id) {
562208
562529
  return id.replace(/[^a-zA-Z0-9_-]/g, "_").slice(0, 64);
@@ -562411,17 +562732,17 @@ async function runTodoChunker(opts) {
562411
562732
  }
562412
562733
  function persistTodoChunk(workingDir, chunk) {
562413
562734
  const dir = chunkDir(workingDir);
562414
- if (!existsSync89(dir)) {
562415
- mkdirSync50(dir, { recursive: true });
562735
+ if (!existsSync90(dir)) {
562736
+ mkdirSync51(dir, { recursive: true });
562416
562737
  }
562417
562738
  writeFileSync42(chunkPath(workingDir, chunk.todoId), JSON.stringify(chunk, null, 2), "utf-8");
562418
562739
  }
562419
562740
  function loadTodoChunk(workingDir, todoId) {
562420
562741
  const p2 = chunkPath(workingDir, todoId);
562421
- if (!existsSync89(p2))
562742
+ if (!existsSync90(p2))
562422
562743
  return null;
562423
562744
  try {
562424
- return JSON.parse(readFileSync69(p2, "utf-8"));
562745
+ return JSON.parse(readFileSync70(p2, "utf-8"));
562425
562746
  } catch {
562426
562747
  return null;
562427
562748
  }
@@ -563833,21 +564154,21 @@ __export(preflightSnapshot_exports, {
563833
564154
  formatPreflightStatus: () => formatPreflightStatus,
563834
564155
  freeDiskBytes: () => freeDiskBytes
563835
564156
  });
563836
- import { existsSync as existsSync90, readFileSync as readFileSync70, statSync as statSync35 } from "node:fs";
564157
+ import { existsSync as existsSync91, readFileSync as readFileSync71, statSync as statSync35 } from "node:fs";
563837
564158
  import { execSync as execSync47 } from "node:child_process";
563838
564159
  import { homedir as homedir31, platform as platform3, arch as arch2, totalmem as totalmem3, freemem as freemem3, hostname as hostname3 } from "node:os";
563839
- import { join as join101 } from "node:path";
564160
+ import { join as join102 } from "node:path";
563840
564161
  import { createHash as createHash26 } from "node:crypto";
563841
564162
  function capturePreflightSnapshot(workingDir) {
563842
564163
  const warnings = [];
563843
564164
  const configFingerprints = {};
563844
564165
  for (const det of CONFIG_DETECTORS) {
563845
564166
  const expanded = expandPath(det.path);
563846
- if (!existsSync90(expanded))
564167
+ if (!existsSync91(expanded))
563847
564168
  continue;
563848
564169
  let raw;
563849
564170
  try {
563850
- raw = readFileSync70(expanded, "utf8");
564171
+ raw = readFileSync71(expanded, "utf8");
563851
564172
  } catch {
563852
564173
  continue;
563853
564174
  }
@@ -563860,12 +564181,12 @@ function capturePreflightSnapshot(workingDir) {
563860
564181
  for (const det of CONFIG_DETECTORS) {
563861
564182
  if (det.path.startsWith("~/")) {
563862
564183
  const localName = det.path.replace(/^~\//, "");
563863
- const projectPath = join101(workingDir, localName);
563864
- if (!existsSync90(projectPath))
564184
+ const projectPath = join102(workingDir, localName);
564185
+ if (!existsSync91(projectPath))
563865
564186
  continue;
563866
564187
  let raw;
563867
564188
  try {
563868
- raw = readFileSync70(projectPath, "utf8");
564189
+ raw = readFileSync71(projectPath, "utf8");
563869
564190
  } catch {
563870
564191
  continue;
563871
564192
  }
@@ -564004,7 +564325,7 @@ function captureToolchainVersions() {
564004
564325
  }
564005
564326
  function expandPath(p2) {
564006
564327
  if (p2.startsWith("~/"))
564007
- return join101(homedir31(), p2.slice(2));
564328
+ return join102(homedir31(), p2.slice(2));
564008
564329
  return p2;
564009
564330
  }
564010
564331
  function sha2564(s2) {
@@ -564075,8 +564396,8 @@ __export(postActionVerifier_exports, {
564075
564396
  classifyShellIntent: () => classifyShellIntent,
564076
564397
  verifyShellOutcome: () => verifyShellOutcome
564077
564398
  });
564078
- import { existsSync as existsSync91, readFileSync as readFileSync71, readdirSync as readdirSync28, statSync as statSync36 } from "node:fs";
564079
- import { join as join102 } from "node:path";
564399
+ import { existsSync as existsSync92, readFileSync as readFileSync72, readdirSync as readdirSync28, statSync as statSync36 } from "node:fs";
564400
+ import { join as join103 } from "node:path";
564080
564401
  function classifyShellIntent(cmd) {
564081
564402
  const stripped = cmd.replace(/^cd\s+\S+\s*&&\s*/, "").trim();
564082
564403
  const tokens = stripped.split(/\s+/).filter(Boolean);
@@ -564124,7 +564445,7 @@ function checkMutateMtimeDelta(intent, cwd4, ctx3, _result) {
564124
564445
  if (intent.klass !== "mutate") {
564125
564446
  return { trustworthy: true, intentBucket: bucket, outcomeClass: "unknown" };
564126
564447
  }
564127
- if (!existsSync91(cwd4)) {
564448
+ if (!existsSync92(cwd4)) {
564128
564449
  return {
564129
564450
  trustworthy: false,
564130
564451
  syntheticError: `Command claimed success but the working directory ${cwd4} does not exist.`,
@@ -564163,19 +564484,19 @@ function checkMutateMtimeDelta(intent, cwd4, ctx3, _result) {
564163
564484
  }
564164
564485
  function checkManifestInvariant(cwd4, fallbackBucket) {
564165
564486
  for (const pattern of MANIFEST_PATTERNS) {
564166
- const manifestPath2 = join102(cwd4, pattern.manifest);
564167
- if (!existsSync91(manifestPath2))
564487
+ const manifestPath2 = join103(cwd4, pattern.manifest);
564488
+ if (!existsSync92(manifestPath2))
564168
564489
  continue;
564169
564490
  let declared;
564170
564491
  try {
564171
- declared = pattern.parseDeps(readFileSync71(manifestPath2, "utf8"));
564492
+ declared = pattern.parseDeps(readFileSync72(manifestPath2, "utf8"));
564172
564493
  } catch {
564173
564494
  continue;
564174
564495
  }
564175
564496
  if (declared.length === 0)
564176
564497
  continue;
564177
- const installRootAbs = join102(cwd4, pattern.installRoot);
564178
- if (!existsSync91(installRootAbs)) {
564498
+ const installRootAbs = join103(cwd4, pattern.installRoot);
564499
+ if (!existsSync92(installRootAbs)) {
564179
564500
  continue;
564180
564501
  }
564181
564502
  const installed = pattern.listInstalled ? pattern.listInstalled(installRootAbs) : defaultListDirNames(installRootAbs);
@@ -564276,7 +564597,7 @@ function listNpmInstalled(installRootAbs) {
564276
564597
  for (const name10 of readdirSync28(installRootAbs)) {
564277
564598
  if (name10.startsWith("."))
564278
564599
  continue;
564279
- const sub2 = join102(installRootAbs, name10);
564600
+ const sub2 = join103(installRootAbs, name10);
564280
564601
  try {
564281
564602
  if (!statSync36(sub2).isDirectory())
564282
564603
  continue;
@@ -564293,7 +564614,7 @@ function listNpmInstalled(installRootAbs) {
564293
564614
  }
564294
564615
  continue;
564295
564616
  }
564296
- if (existsSync91(join102(sub2, "package.json")))
564617
+ if (existsSync92(join103(sub2, "package.json")))
564297
564618
  out.add(name10);
564298
564619
  }
564299
564620
  } catch {
@@ -564304,11 +564625,11 @@ function listPipInstalled(installRootAbs) {
564304
564625
  const out = /* @__PURE__ */ new Set();
564305
564626
  const candidates = [];
564306
564627
  try {
564307
- const lib = join102(installRootAbs, "lib");
564308
- if (existsSync91(lib)) {
564628
+ const lib = join103(installRootAbs, "lib");
564629
+ if (existsSync92(lib)) {
564309
564630
  for (const py of readdirSync28(lib)) {
564310
- const sp = join102(lib, py, "site-packages");
564311
- if (existsSync91(sp))
564631
+ const sp = join103(lib, py, "site-packages");
564632
+ if (existsSync92(sp))
564312
564633
  candidates.push(sp);
564313
564634
  }
564314
564635
  }
@@ -564347,7 +564668,7 @@ function mostRecentFileMtimeMs(root, maxDepth) {
564347
564668
  for (const name10 of entries) {
564348
564669
  if (MTIME_EXCLUDES.has(name10))
564349
564670
  continue;
564350
- const full = join102(dir, name10);
564671
+ const full = join103(dir, name10);
564351
564672
  let st;
564352
564673
  try {
564353
564674
  st = statSync36(full);
@@ -564368,8 +564689,8 @@ function mostRecentFileMtimeMs(root, maxDepth) {
564368
564689
  function listExistingChildren(cwd4, candidates) {
564369
564690
  const out = [];
564370
564691
  for (const c8 of candidates) {
564371
- const p2 = join102(cwd4, c8);
564372
- if (existsSync91(p2))
564692
+ const p2 = join103(cwd4, c8);
564693
+ if (existsSync92(p2))
564373
564694
  out.push(p2);
564374
564695
  }
564375
564696
  return out;
@@ -564881,12 +565202,12 @@ RECOVERY: cd to the directory containing '${file}', run a plain install with no
564881
565202
 
564882
565203
  // packages/orchestrator/dist/agenticRunner.js
564883
565204
  import { existsSync as _fsExistsSync, readFileSync as _fsReadFileSync, writeFileSync as _fsWriteFileSync, appendFileSync as _fsAppendFileSync, unlinkSync as _fsUnlinkSync, mkdirSync as _fsMkdirSync } from "node:fs";
564884
- import { execFile as _execFile } from "node:child_process";
565205
+ import { execFile as _execFile, spawn as _spawn } from "node:child_process";
564885
565206
  import { createHash as _createHash } from "node:crypto";
564886
565207
  import { join as _pathJoin, resolve as _pathResolve } from "node:path";
564887
565208
  import { tmpdir as _osTmpdir } from "node:os";
564888
565209
  import { homedir as _osHomedir } from "node:os";
564889
- import { z as z16 } from "zod";
565210
+ import { z as z17 } from "zod";
564890
565211
  function textFromMessageContent(content) {
564891
565212
  if (typeof content === "string")
564892
565213
  return content;
@@ -565366,6 +565687,7 @@ var init_agenticRunner = __esm({
565366
565687
  "use strict";
565367
565688
  init_textSanitize();
565368
565689
  init_permissionRuleset();
565690
+ init_steeringIntake();
565369
565691
  init_completionLedger();
565370
565692
  init_dist6();
565371
565693
  init_ollama_pool();
@@ -565715,6 +566037,10 @@ var init_agenticRunner = __esm({
565715
566037
  // post-implementation reviewer.
565716
566038
  _fileWritesThisRun = 0;
565717
566039
  _backwardPassCyclesUsed = 0;
566040
+ // Completion compile/verify gate: count of times task_complete was blocked
566041
+ // because the configured verify command failed. Bounded by
566042
+ // OMNIUS_COMPLETION_VERIFY_MAX to avoid an endless verify→fix→verify loop.
566043
+ _completionVerifyRejections = 0;
565718
566044
  _lastBackwardPassVerdict = null;
565719
566045
  _lastBackwardPassCritique = null;
565720
566046
  // Run-local completion contract inferred from the user's ask/context before
@@ -566086,6 +566412,7 @@ ${parts.join("\n")}
566086
566412
  allowTurnExtension: options2?.allowTurnExtension ?? true,
566087
566413
  completionProvenanceGuard: options2?.completionProvenanceGuard ?? true,
566088
566414
  backwardPassReview: options2?.backwardPassReview,
566415
+ completionVerifyCommand: options2?.completionVerifyCommand,
566089
566416
  disableAdversaryCritic,
566090
566417
  disableStepCritic: disableAdversaryCritic,
566091
566418
  modelTier: options2?.modelTier ?? "large",
@@ -567351,7 +567678,114 @@ ${input.answerText ?? ""}`.toLowerCase().trim();
567351
567678
  * up auto-blocking and surfaces a status event so the caller can take
567352
567679
  * a different path (eg. surface to user). max cycles enforced here.
567353
567680
  */
567681
+ /**
567682
+ * Completion compile/verify gate (opt-in). Runs a configured shell command
567683
+ * (e.g. a typecheck/build) before `task_complete` is accepted, but ONLY when
567684
+ * the run actually modified code files. A non-zero exit blocks completion and
567685
+ * feeds the error output back so the model fixes it before retrying. Bounded
567686
+ * by OMNIUS_COMPLETION_VERIFY_MAX rejections so a persistently-failing build
567687
+ * does not trap the run forever (it completes with a caveat instead — the
567688
+ * same anti-collapse philosophy as the backward-pass cycle cap).
567689
+ *
567690
+ * Default OFF: unset command → `{ proceed: true }`, preserving the prior
567691
+ * "no deterministic verification gate" behaviour for every existing caller.
567692
+ */
567693
+ async _runCompletionVerifyGate(turn) {
567694
+ const cmd = this.options.completionVerifyCommand || process.env["OMNIUS_COMPLETION_VERIFY_CMD"] || "";
567695
+ if (!cmd.trim())
567696
+ return { proceed: true };
567697
+ const changed = [...this._taskState.modifiedFiles.keys()];
567698
+ const codeChanged = changed.some((p2) => /\.(ts|tsx|js|jsx|mjs|cjs|py|go|rs|java|kt|c|cc|cpp|h|hpp|swift|rb|php)$/i.test(p2));
567699
+ if (!codeChanged)
567700
+ return { proceed: true };
567701
+ const maxRejections = parseInt(process.env["OMNIUS_COMPLETION_VERIFY_MAX"] || "3", 10) || 3;
567702
+ if (this._completionVerifyRejections >= maxRejections) {
567703
+ this._completionCaveat = [
567704
+ `[COMPLETION CAVEAT] Verify command still failing after ${this._completionVerifyRejections} attempt(s): ${cmd}`,
567705
+ "Completing with unresolved build/verify errors — treat as a follow-up blocker."
567706
+ ].join("\n");
567707
+ this.emit({
567708
+ type: "status",
567709
+ content: `completion verify gate exhausted after ${this._completionVerifyRejections} attempts; completing with caveat`,
567710
+ turn,
567711
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
567712
+ });
567713
+ return { proceed: true };
567714
+ }
567715
+ const timeoutMs = parseInt(process.env["OMNIUS_COMPLETION_VERIFY_TIMEOUT_MS"] || "180000", 10) || 18e4;
567716
+ const wd = this._workingDirectory || process.cwd();
567717
+ this.emit({
567718
+ type: "status",
567719
+ content: `completion verify gate: running '${cmd}' (cwd=${wd})`,
567720
+ turn,
567721
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
567722
+ });
567723
+ const { exitCode, outTail } = await new Promise((resolve70) => {
567724
+ const chunks = [];
567725
+ let settled = false;
567726
+ const child = _spawn(cmd, {
567727
+ cwd: wd,
567728
+ shell: true,
567729
+ env: process.env,
567730
+ stdio: ["ignore", "pipe", "pipe"]
567731
+ });
567732
+ const onData = (d2) => {
567733
+ chunks.push(d2.toString());
567734
+ if (chunks.length > 400)
567735
+ chunks.splice(0, chunks.length - 400);
567736
+ };
567737
+ child.stdout?.on("data", onData);
567738
+ child.stderr?.on("data", onData);
567739
+ const killTimer = setTimeout(() => {
567740
+ try {
567741
+ child.kill("SIGKILL");
567742
+ } catch {
567743
+ }
567744
+ }, timeoutMs);
567745
+ killTimer.unref?.();
567746
+ const finish = (code8) => {
567747
+ if (settled)
567748
+ return;
567749
+ settled = true;
567750
+ clearTimeout(killTimer);
567751
+ resolve70({ exitCode: code8, outTail: chunks.join("").slice(-4e3) });
567752
+ };
567753
+ child.on("error", () => finish(1));
567754
+ child.on("close", (code8) => finish(code8 ?? 1));
567755
+ });
567756
+ if (exitCode === 0) {
567757
+ this.emit({
567758
+ type: "status",
567759
+ content: `completion verify gate PASSED ('${cmd}')`,
567760
+ turn,
567761
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
567762
+ });
567763
+ return { proceed: true };
567764
+ }
567765
+ this._completionVerifyRejections++;
567766
+ this.emit({
567767
+ type: "status",
567768
+ content: `completion verify gate FAILED (exit ${exitCode}); task_complete blocked (attempt ${this._completionVerifyRejections}/${maxRejections})`,
567769
+ turn,
567770
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
567771
+ });
567772
+ const feedback = [
567773
+ `[COMPLETION BLOCKED — verification failed] You modified code, but the verify command exited ${exitCode}:`,
567774
+ ` $ ${cmd}`,
567775
+ "",
567776
+ "You CANNOT call task_complete until this passes. Fix the errors below, then",
567777
+ "re-run the verify command yourself (via shell) to confirm before completing.",
567778
+ `(attempt ${this._completionVerifyRejections}/${maxRejections} — after that the run completes with a caveat)`,
567779
+ "",
567780
+ "--- verify output (tail) ---",
567781
+ outTail || "(no output captured)"
567782
+ ].join("\n");
567783
+ return { proceed: false, feedback };
567784
+ }
567354
567785
  async _runBackwardPassReview(turn, toolCallLog, proposedSummary = "") {
567786
+ const _verify = await this._runCompletionVerifyGate(turn);
567787
+ if (!_verify.proceed)
567788
+ return _verify;
567355
567789
  if (this._completionLedger && proposedSummary) {
567356
567790
  const _newClaims = deriveClaimsFromProposedText({
567357
567791
  text: proposedSummary,
@@ -569245,6 +569679,13 @@ ${this._lastPprMemoryLines.slice(0, 5).join("\n")}` : null;
569245
569679
  priority: 35,
569246
569680
  createdTurn: turn,
569247
569681
  ttlTurns: 1
569682
+ }),
569683
+ signalFromBlock("user_steering", "turn.recentSteering", buildRecentSteeringContext(this._workingDirectory || process.cwd()), {
569684
+ id: "recentSteering",
569685
+ dedupeKey: "turn.recentSteering",
569686
+ priority: 40,
569687
+ createdTurn: turn,
569688
+ ttlTurns: 1
569248
569689
  })
569249
569690
  ];
569250
569691
  this._contextLedger.upsertMany(signals.filter(Boolean));
@@ -570196,6 +570637,7 @@ Respond with your assessment, then take action.`;
570196
570637
  this._abortController = new AbortController();
570197
570638
  this._fileWritesThisRun = 0;
570198
570639
  this._backwardPassCyclesUsed = 0;
570640
+ this._completionVerifyRejections = 0;
570199
570641
  this._lastBackwardPassVerdict = null;
570200
570642
  this._lastBackwardPassCritique = null;
570201
570643
  this._completionContract = null;
@@ -581108,9 +581550,9 @@ var init_constraint_learner = __esm({
581108
581550
  });
581109
581551
 
581110
581552
  // packages/orchestrator/dist/nexusBackend.js
581111
- import { existsSync as existsSync92, statSync as statSync37, openSync, readSync, closeSync, unlinkSync as unlinkSync17, writeFileSync as writeFileSync43 } from "node:fs";
581553
+ import { existsSync as existsSync93, statSync as statSync37, openSync, readSync, closeSync, unlinkSync as unlinkSync17, writeFileSync as writeFileSync43 } from "node:fs";
581112
581554
  import { watch as fsWatch } from "node:fs";
581113
- import { join as join103 } from "node:path";
581555
+ import { join as join104 } from "node:path";
581114
581556
  import { tmpdir as tmpdir19 } from "node:os";
581115
581557
  import { randomBytes as randomBytes20 } from "node:crypto";
581116
581558
  var NexusAgenticBackend;
@@ -581313,7 +581755,7 @@ ${suffix}` } : m2);
581313
581755
  * Falls back to unary + word-split if streaming setup fails.
581314
581756
  */
581315
581757
  async *chatCompletionStream(request) {
581316
- const streamFile = join103(tmpdir19(), `nexus-stream-${randomBytes20(6).toString("hex")}.jsonl`);
581758
+ const streamFile = join104(tmpdir19(), `nexus-stream-${randomBytes20(6).toString("hex")}.jsonl`);
581317
581759
  writeFileSync43(streamFile, "", "utf8");
581318
581760
  const effectiveThink = this.effectiveThink(request);
581319
581761
  const daemonArgs = {
@@ -581838,327 +582280,6 @@ var init_cascadeBackend = __esm({
581838
582280
  }
581839
582281
  });
581840
582282
 
581841
- // packages/orchestrator/dist/steeringIntake.js
581842
- import { randomUUID as randomUUID16 } from "node:crypto";
581843
- import { appendFileSync as appendFileSync6, existsSync as existsSync93, mkdirSync as mkdirSync51, readFileSync as readFileSync72 } from "node:fs";
581844
- import { join as join104 } from "node:path";
581845
- import { z as z17 } from "zod";
581846
- function createSteeringIngress(input) {
581847
- return {
581848
- id: randomUUID16(),
581849
- rawText: input.rawText.trim(),
581850
- sourceSurface: input.sourceSurface,
581851
- authority: "user",
581852
- isReplacement: input.isReplacement ?? false,
581853
- currentTaskGoal: input.currentTaskGoal || "(unknown current task)",
581854
- recentActivity: input.recentActivity,
581855
- filesTouched: (input.filesTouched ?? []).filter(Boolean).slice(0, 12),
581856
- toolCallCount: input.toolCallCount ?? 0,
581857
- taskId: input.taskId,
581858
- sessionId: input.sessionId,
581859
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
581860
- };
581861
- }
581862
- async function interpretSteeringIngress(backend, ingress, timeoutMs = 8e3) {
581863
- const first2 = await backend.chatCompletion({
581864
- messages: [
581865
- {
581866
- role: "system",
581867
- content: [
581868
- "You interpret human feedback for a running coding agent.",
581869
- "Return strict JSON only.",
581870
- "Use only the supplied task trajectory and ingress.",
581871
- "The JSON fields describe task impact and next-action guidance."
581872
- ].join("\n")
581873
- },
581874
- { role: "user", content: buildInterpretationPrompt(ingress) }
581875
- ],
581876
- tools: [],
581877
- temperature: 0.2,
581878
- maxTokens: 512,
581879
- timeoutMs,
581880
- think: false,
581881
- responseFormat: steeringInterpretationResponseFormat()
581882
- });
581883
- const raw = first2.choices[0]?.message?.content ?? "";
581884
- const parsed = parseSteeringInterpretation(raw);
581885
- if (parsed)
581886
- return parsed;
581887
- const repaired = await backend.chatCompletion({
581888
- messages: [
581889
- {
581890
- role: "system",
581891
- content: "Repair the supplied text into strict JSON matching the requested schema. Return JSON only."
581892
- },
581893
- {
581894
- role: "user",
581895
- content: [
581896
- "Schema keys: inference, runnerInstruction, conflicts, alternatives, memoryNote.",
581897
- "Required keys: inference, runnerInstruction.",
581898
- "",
581899
- "Original task state and ingress:",
581900
- buildInterpretationPrompt(ingress),
581901
- "",
581902
- "Malformed model output:",
581903
- raw
581904
- ].join("\n")
581905
- }
581906
- ],
581907
- tools: [],
581908
- temperature: 0,
581909
- maxTokens: 512,
581910
- timeoutMs,
581911
- think: false,
581912
- responseFormat: steeringInterpretationResponseFormat()
581913
- });
581914
- return parseSteeringInterpretation(repaired.choices[0]?.message?.content ?? "");
581915
- }
581916
- function buildSteeringPacket(ingress, interpretation) {
581917
- const lines = [
581918
- STEERING_START,
581919
- `id: ${ingress.id}`,
581920
- `sourceSurface: ${ingress.sourceSurface}`,
581921
- `feedbackKind: external_human`,
581922
- `authority: ${ingress.authority}`,
581923
- `replacement: ${ingress.isReplacement ? "true" : "false"}`,
581924
- `toolCallsSoFar: ${ingress.toolCallCount}`,
581925
- `timestamp: ${ingress.timestamp}`,
581926
- "",
581927
- "Instruction hierarchy:",
581928
- "- Treat this as user-level steering, below system/developer/tool safety and above older user assumptions when they conflict.",
581929
- "",
581930
- "Current task goal:",
581931
- truncateBlock(ingress.currentTaskGoal || "(unknown current task)", 1200),
581932
- "",
581933
- "Recent activity:",
581934
- truncateBlock(ingress.recentActivity || "(no recent activity recorded)", 1200),
581935
- "",
581936
- ingress.filesTouched.length > 0 ? `Files touched so far: ${ingress.filesTouched.join(", ")}` : "Files touched so far: none recorded",
581937
- "",
581938
- RAW_START,
581939
- ingress.rawText,
581940
- RAW_END,
581941
- ""
581942
- ];
581943
- if (interpretation) {
581944
- lines.push("Model-derived steering interpretation:", `inference: ${interpretation.inference}`, `runnerInstruction: ${interpretation.runnerInstruction}`);
581945
- if (interpretation.conflicts?.length) {
581946
- lines.push("conflicts:", ...interpretation.conflicts.map((item) => `- ${item}`));
581947
- }
581948
- if (interpretation.alternatives?.length) {
581949
- lines.push("alternative interpretations:", ...interpretation.alternatives.map((item) => `- ${item}`));
581950
- }
581951
- if (interpretation.memoryNote) {
581952
- lines.push(`memoryNote: ${interpretation.memoryNote}`);
581953
- }
581954
- lines.push("");
581955
- } else {
581956
- lines.push("Model-derived steering interpretation: unavailable", "");
581957
- }
581958
- lines.push("Interleave contract:", "- Consume this before the next assistant/tool decision.", "- Do not treat it as passive transcript context.", "- Either act on the steering directly, or explicitly reconcile why it does not alter the current plan.", STEERING_END);
581959
- return lines.join("\n");
581960
- }
581961
- function extractMidTaskSteeringInput(value2) {
581962
- const start2 = value2.indexOf(RAW_START);
581963
- const end = value2.indexOf(RAW_END);
581964
- if (start2 < 0 || end <= start2)
581965
- return null;
581966
- return value2.slice(start2 + RAW_START.length, end).trim();
581967
- }
581968
- function appendSteeringLedgerEntry(repoRoot, entry) {
581969
- try {
581970
- const dir = join104(repoRoot, ".omnius", "context");
581971
- mkdirSync51(dir, { recursive: true });
581972
- appendFileSync6(join104(dir, LEDGER_FILE), `${JSON.stringify(entry)}
581973
- `, "utf-8");
581974
- } catch {
581975
- }
581976
- }
581977
- function appendSteeringOutcome(repoRoot, packetIds, outcome, summary) {
581978
- for (const packetId of packetIds) {
581979
- appendSteeringLedgerEntry(repoRoot, {
581980
- type: "outcome",
581981
- packetId,
581982
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
581983
- outcome,
581984
- summary: summary.slice(0, 1200)
581985
- });
581986
- }
581987
- }
581988
- function buildRecentSteeringContext(repoRoot, limit = 3) {
581989
- const entries = readRecentSteeringEntries(repoRoot, limit);
581990
- if (entries.length === 0)
581991
- return "";
581992
- const lines = entries.map((entry, idx) => {
581993
- const interpretation = entry.interpretation;
581994
- const inference = interpretation?.inference || "(raw steering only)";
581995
- const note = interpretation?.memoryNote ? ` Memory note: ${interpretation.memoryNote}` : "";
581996
- const outcome = entry.outcome ? ` Outcome: ${entry.outcome}.` : "";
581997
- return `${idx + 1}. ${inference}${note}${outcome}`;
581998
- });
581999
- return [
582000
- "<recent-user-steering>",
582001
- "Recent user steering reflections from this workspace. Use only when relevant to the current task.",
582002
- ...lines,
582003
- "</recent-user-steering>"
582004
- ].join("\n");
582005
- }
582006
- function buildInterpretationPrompt(ingress) {
582007
- return [
582008
- "Infer how this human feedback changes, constrains, or clarifies the active task.",
582009
- "If there are multiple plausible readings, include them in alternatives.",
582010
- "If the feedback conflicts with prior task assumptions, list the conflict.",
582011
- "If this should persist beyond the current turn, include memoryNote.",
582012
- "",
582013
- "Return JSON:",
582014
- "{",
582015
- ' "inference": "concise user-facing task-impact inference",',
582016
- ' "runnerInstruction": "specific instruction for the next agent decision",',
582017
- ' "conflicts": ["optional conflict"],',
582018
- ' "alternatives": ["optional alternate reading"],',
582019
- ' "memoryNote": "optional durable lesson"',
582020
- "}",
582021
- "",
582022
- `replacement: ${ingress.isReplacement ? "true" : "false"}`,
582023
- `toolCallsSoFar: ${ingress.toolCallCount}`,
582024
- "",
582025
- "Current task goal:",
582026
- truncateBlock(ingress.currentTaskGoal || "(unknown current task)", 1200),
582027
- "",
582028
- "Recent activity:",
582029
- truncateBlock(ingress.recentActivity || "(no recent activity recorded)", 1200),
582030
- "",
582031
- ingress.filesTouched.length > 0 ? `Files touched so far: ${ingress.filesTouched.join(", ")}` : "Files touched so far: none recorded",
582032
- "",
582033
- RAW_START,
582034
- ingress.rawText,
582035
- RAW_END
582036
- ].join("\n");
582037
- }
582038
- function parseSteeringInterpretation(raw) {
582039
- const candidate = extractJsonObject(raw);
582040
- if (!candidate)
582041
- return null;
582042
- try {
582043
- const parsed = SteeringInterpretationSchema.parse(JSON.parse(candidate));
582044
- return {
582045
- inference: parsed.inference,
582046
- runnerInstruction: parsed.runnerInstruction,
582047
- conflicts: parsed.conflicts,
582048
- alternatives: parsed.alternatives,
582049
- memoryNote: parsed.memoryNote
582050
- };
582051
- } catch {
582052
- return null;
582053
- }
582054
- }
582055
- function extractJsonObject(raw) {
582056
- const text2 = raw.trim();
582057
- if (!text2)
582058
- return null;
582059
- try {
582060
- JSON.parse(text2);
582061
- return text2;
582062
- } catch {
582063
- }
582064
- let start2 = -1;
582065
- let depth = 0;
582066
- let inString = false;
582067
- let escaped = false;
582068
- for (let i2 = 0; i2 < text2.length; i2++) {
582069
- const ch = text2[i2];
582070
- if (inString) {
582071
- if (escaped) {
582072
- escaped = false;
582073
- } else if (ch === "\\") {
582074
- escaped = true;
582075
- } else if (ch === '"') {
582076
- inString = false;
582077
- }
582078
- continue;
582079
- }
582080
- if (ch === '"') {
582081
- inString = true;
582082
- continue;
582083
- }
582084
- if (ch === "{") {
582085
- if (depth === 0)
582086
- start2 = i2;
582087
- depth++;
582088
- continue;
582089
- }
582090
- if (ch === "}") {
582091
- depth--;
582092
- if (depth === 0 && start2 >= 0)
582093
- return text2.slice(start2, i2 + 1);
582094
- if (depth < 0) {
582095
- start2 = -1;
582096
- depth = 0;
582097
- }
582098
- }
582099
- }
582100
- return null;
582101
- }
582102
- function steeringInterpretationResponseFormat() {
582103
- return { type: "json_object" };
582104
- }
582105
- function readRecentSteeringEntries(repoRoot, limit) {
582106
- try {
582107
- const file = join104(repoRoot, ".omnius", "context", LEDGER_FILE);
582108
- if (!existsSync93(file))
582109
- return [];
582110
- const lines = readFileSync72(file, "utf-8").split("\n").filter(Boolean).slice(-100);
582111
- const parsedEntries = [];
582112
- for (const line of lines) {
582113
- try {
582114
- parsedEntries.push(JSON.parse(line));
582115
- } catch {
582116
- }
582117
- }
582118
- const latestOutcomes = /* @__PURE__ */ new Map();
582119
- for (const entry of parsedEntries) {
582120
- if (entry.type === "outcome")
582121
- latestOutcomes.set(entry.packetId, entry);
582122
- }
582123
- const out = [];
582124
- for (let i2 = parsedEntries.length - 1; i2 >= 0 && out.length < limit; i2--) {
582125
- const parsed = parsedEntries[i2];
582126
- if (parsed.type === "ingress") {
582127
- const outcome = latestOutcomes.get(parsed.packetId);
582128
- out.push(outcome ? { ...parsed, outcome: outcome.outcome, summary: outcome.summary } : parsed);
582129
- }
582130
- }
582131
- return out;
582132
- } catch {
582133
- return [];
582134
- }
582135
- }
582136
- function truncateBlock(value2, max) {
582137
- const trimmed = value2.trim();
582138
- if (trimmed.length <= max)
582139
- return trimmed;
582140
- return `${trimmed.slice(0, max).trimEnd()}
582141
- ...(truncated)`;
582142
- }
582143
- var STEERING_START, STEERING_END, RAW_START, RAW_END, LEDGER_FILE, SteeringInterpretationSchema;
582144
- var init_steeringIntake = __esm({
582145
- "packages/orchestrator/dist/steeringIntake.js"() {
582146
- "use strict";
582147
- STEERING_START = "[MID_TASK_STEERING_INTAKE v2]";
582148
- STEERING_END = "[/MID_TASK_STEERING_INTAKE]";
582149
- RAW_START = "<<<USER_ADDED_CONTEXT>>>";
582150
- RAW_END = "<<<END_USER_ADDED_CONTEXT>>>";
582151
- LEDGER_FILE = "steering-ledger.jsonl";
582152
- SteeringInterpretationSchema = z17.object({
582153
- inference: z17.string().trim().min(1),
582154
- runnerInstruction: z17.string().trim().min(1),
582155
- conflicts: z17.array(z17.string().trim().min(1)).optional().default([]),
582156
- alternatives: z17.array(z17.string().trim().min(1)).optional().default([]),
582157
- memoryNote: z17.string().trim().min(1).optional()
582158
- });
582159
- }
582160
- });
582161
-
582162
582283
  // packages/orchestrator/dist/flowstatePrompt.js
582163
582284
  var FLOWSTATE_PROMPT;
582164
582285
  var init_flowstatePrompt = __esm({
@@ -609110,15 +609231,10 @@ ${CONTENT_BG_SEQ}`);
609110
609231
  copySessionToClipboard() {
609111
609232
  const lines = this._contentLines;
609112
609233
  if (!lines || lines.length === 0) return;
609113
- const offset = this._contentScrollOffset;
609114
- const visible = this.contentHeight;
609115
- const startIdx = Math.max(0, offset);
609116
- const endIdx = Math.min(lines.length, startIdx + visible);
609117
- const visibleLines = lines.slice(startIdx, endIdx);
609118
- const stripped = visibleLines.map(
609234
+ const stripped = lines.map(
609119
609235
  (line) => line.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "").replace(/\x1B\]?[^\x07]*\x07/g, "")
609120
609236
  );
609121
- const text2 = stripped.join("\n");
609237
+ const text2 = stripped.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd();
609122
609238
  if (text2.length === 0) return;
609123
609239
  const ok3 = copyText(text2);
609124
609240
  const pos = this.rowPositions(termRows());