@mycompbox/compbox-cli 1.21.2 → 1.21.4

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/index.js CHANGED
@@ -1269,7 +1269,7 @@ var SessionEventType;
1269
1269
  })(SessionEventType || (SessionEventType = {}));
1270
1270
 
1271
1271
  // ../shared/dist/types/mailbox.js
1272
- var START_EXECUTION_KINDS = ["plan", "orchestrate"];
1272
+ var START_EXECUTION_KINDS = ["plan", "orchestrate", "refine"];
1273
1273
  function normalizeGitRemote(raw) {
1274
1274
  const input = (raw ?? "").trim();
1275
1275
  if (input === "")
@@ -5700,6 +5700,18 @@ function looksLikeCompletionAttempt(text) {
5700
5700
  var COMPLETION_REPAIR_INSTRUCTION = 'Your last message looked like a completion but I could NOT parse it as a valid JSON object with all required fields. Re-emit ONLY a single valid JSON object inside a ```json code fence \u2014 no other text \u2014 with every string value properly escaped (escape any internal double-quotes as \\" and any line breaks as \\n), and make sure title, problemStatement, proposedSolution, impactAssessment, and description are all present and non-empty:\n```json\n{"done": true, "title": "...", "problemStatement": "...", "proposedSolution": "...", "impactAssessment": "...", "description": "..."}\n```';
5701
5701
 
5702
5702
  // ../shared/dist/interview-conversation.js
5703
+ function requestLockReason(saved) {
5704
+ if (!saved)
5705
+ return null;
5706
+ if (saved.status !== "pending")
5707
+ return "status";
5708
+ if (!saved.canEdit)
5709
+ return "ownership";
5710
+ return null;
5711
+ }
5712
+ function lockedRequestMessage(reason) {
5713
+ return reason === "ownership" ? "Only the request's creator can change it; you can still discuss it." : "This request is locked, so it can't be changed any more.";
5714
+ }
5703
5715
  var CONVERSATION_QUALITY_ROUNDS = 2;
5704
5716
  var JSON_REPAIRS = 3;
5705
5717
  var STARTER = "Hi! I'd like to propose something.";
@@ -5714,8 +5726,10 @@ function renderSaved(saved) {
5714
5726
  const issues = saved.compliance && saved.compliance.issues.length > 0 ? `
5715
5727
  What the score says is missing or weak:
5716
5728
  ${saved.compliance.issues.slice(0, 8).map((i) => `- ${i.message}`).join("\n")}` : "";
5717
- const locked = saved.status === "pending" ? "It can still be changed." : `Its status is "${saved.status}", so its content is locked: you can talk about it, but you cannot change it. Never emit the completion JSON for a locked request.`;
5718
- return `THE REQUEST IS ALREADY SAVED. This conversation created the request "${saved.title}". ${score} ${locked}${issues}
5729
+ const reason = requestLockReason(saved);
5730
+ const locked = reason === null ? "It can still be changed." : reason === "status" ? `Its status is "${saved.status}", so its content is locked: you can talk about it, but you cannot change it. Never emit the completion JSON for a locked request.` : "Only the request's creator can change it, and the person you're talking to is not its creator, so its content is locked for them: you can talk about it, but you cannot change it. Never emit the completion JSON for a locked request. If they ask for a change, explain that only the creator can make it.";
5731
+ const origin = saved.discussed ? `THE REQUEST ALREADY EXISTS. The person is discussing the existing request "${saved.title}"; this conversation did not create it.` : `THE REQUEST IS ALREADY SAVED. This conversation created the request "${saved.title}".`;
5732
+ return `${origin} ${score} ${locked}${issues}
5719
5733
 
5720
5734
  Its current content:
5721
5735
  title: ${saved.title}
@@ -5791,7 +5805,7 @@ ${followUp}` : text;
5791
5805
  async function runConversationStep(input, deps) {
5792
5806
  const system = buildConversationSystemPrompt(input.saved);
5793
5807
  const messages = toConversationMessages(input.turns);
5794
- const locked = input.saved !== null && input.saved.status !== "pending";
5808
+ const lockReason = requestLockReason(input.saved);
5795
5809
  let requestId = input.saved?.id ?? null;
5796
5810
  let savedNow = null;
5797
5811
  let createdHere = false;
@@ -5814,10 +5828,11 @@ Send another message (for example "try again") when you're ready and I'll pick u
5814
5828
  }
5815
5829
  const draft = extractCompletionJson(reply);
5816
5830
  if (draft) {
5817
- if (locked) {
5818
- messages.push({ role: "assistant", content: reply }, { role: "user", content: "That request is locked and can't be changed. Reply to me in plain text instead." });
5831
+ if (lockReason) {
5832
+ const why = lockReason === "ownership" ? "Only the request's creator can change it, and I'm not its creator." : "That request is locked and can't be changed.";
5833
+ messages.push({ role: "assistant", content: reply }, { role: "user", content: `${why} Reply to me in plain text instead.` });
5819
5834
  if (++repairs > JSON_REPAIRS)
5820
- return { kind: "error", text: "This request is locked, so it can't be changed any more." };
5835
+ return { kind: "error", text: lockedRequestMessage(lockReason) };
5821
5836
  continue;
5822
5837
  }
5823
5838
  let saved;
@@ -5860,7 +5875,7 @@ The request IS already saved, and the person will be shown its score. If you ask
5860
5875
  return { kind: "message", text };
5861
5876
  }
5862
5877
  }
5863
- function savedContextFromRecord(record) {
5878
+ function savedContextFromRecord(record, access) {
5864
5879
  if (typeof record !== "object" || record === null)
5865
5880
  return null;
5866
5881
  const r = record;
@@ -5895,7 +5910,9 @@ function savedContextFromRecord(record) {
5895
5910
  status: typeof r.status === "string" ? r.status : "pending",
5896
5911
  description: typeof r.description === "string" ? r.description : "",
5897
5912
  fields,
5898
- compliance: complianceFromRecord(score)
5913
+ compliance: complianceFromRecord(score),
5914
+ canEdit: access.canEdit,
5915
+ ...access.discussed ? { discussed: true } : {}
5899
5916
  };
5900
5917
  }
5901
5918
  function complianceFromRecord(score) {
@@ -8172,14 +8189,19 @@ function runClaudeCliTurn(prompt, opts) {
8172
8189
  });
8173
8190
  });
8174
8191
  }
8175
- async function loadSavedRequest(apiBaseUrl, userApiToken, epicRequestId) {
8176
- const res = await fetch(
8177
- `${apiBaseUrl.replace(/\/+$/, "")}/api/v1/epic-requests/${encodeURIComponent(epicRequestId)}`,
8178
- { headers: { Authorization: `Bearer ${userApiToken}` } }
8179
- );
8192
+ async function loadSavedRequest(apiBaseUrl, userApiToken, epicRequestId, discussed) {
8193
+ const base = apiBaseUrl.replace(/\/+$/, "");
8194
+ const headers = { Authorization: `Bearer ${userApiToken}` };
8195
+ const [res, meRes] = await Promise.all([
8196
+ fetch(`${base}/api/v1/epic-requests/${encodeURIComponent(epicRequestId)}`, { headers }),
8197
+ fetch(`${base}/api/v1/auth/me`, { headers }).catch(() => null)
8198
+ ]);
8180
8199
  if (!res.ok) return null;
8181
8200
  const body = await res.json().catch(() => null);
8182
- return savedContextFromRecord(body?.data);
8201
+ const me = meRes?.ok ? await meRes.json().catch(() => null) : null;
8202
+ const requestedById = body?.data?.requestedById;
8203
+ const canEdit = typeof me?.id === "string" && typeof requestedById === "string" && me.id === requestedById;
8204
+ return savedContextFromRecord(body?.data, { canEdit, discussed });
8183
8205
  }
8184
8206
  function needsDefaultModel(error) {
8185
8207
  const message = error instanceof Error ? error.message : String(error);
@@ -8208,7 +8230,8 @@ Send another message (for example "try again") and I'll pick up where we left of
8208
8230
  async function takeConversationStep(job, ctx) {
8209
8231
  const routing = await resolveRouting();
8210
8232
  const requestId = savedRequestIdOf(job);
8211
- const saved = requestId ? await loadSavedRequest(ctx.apiBaseUrl, ctx.userApiToken, requestId) : null;
8233
+ const discussed = requestId !== null && parseSeedPayload(job.payload)?.targetEpicRequestId === requestId;
8234
+ const saved = requestId ? await loadSavedRequest(ctx.apiBaseUrl, ctx.userApiToken, requestId, discussed) : null;
8212
8235
  const turns = job.turns.map((t) => ({
8213
8236
  role: t.role,
8214
8237
  content: t.role === "user" ? appendAttachmentNote(t.content, imageAttachmentCount(t.attachments)) : t.content
@@ -8370,6 +8393,62 @@ async function fetchConvertedEpicId(apiBaseUrl, userApiToken, epicRequestId, fet
8370
8393
  return null;
8371
8394
  }
8372
8395
  }
8396
+ function summarizeComplianceScore(raw) {
8397
+ let score = raw;
8398
+ if (typeof score === "string") {
8399
+ try {
8400
+ score = JSON.parse(score);
8401
+ } catch {
8402
+ return null;
8403
+ }
8404
+ }
8405
+ if (!score || typeof score !== "object" || Array.isArray(score)) return null;
8406
+ const s = score;
8407
+ const overall = typeof s.overall === "number" ? s.overall : null;
8408
+ const tier = typeof s.tier === "string" ? s.tier : null;
8409
+ if (overall === null && tier === null) return null;
8410
+ const criticalIssueCodes = Array.isArray(s.issues) ? s.issues.filter(
8411
+ (i) => !!i && typeof i === "object" && typeof i.code === "string"
8412
+ ).filter((i) => i.tier === "critical").map((i) => i.code) : [];
8413
+ return { overall, tier, criticalIssueCodes };
8414
+ }
8415
+ async function fetchEpicComplianceSummary(apiBaseUrl, userApiToken, epicId, fetchImpl) {
8416
+ try {
8417
+ const res = await fetchImpl(
8418
+ `${apiBaseUrl.replace(/\/+$/, "")}/api/v1/epics/${encodeURIComponent(epicId)}`,
8419
+ { headers: { Authorization: `Bearer ${userApiToken}` } }
8420
+ );
8421
+ if (!res.ok) return null;
8422
+ const body = await res.json();
8423
+ return summarizeComplianceScore(body.data?.complianceScore);
8424
+ } catch {
8425
+ return null;
8426
+ }
8427
+ }
8428
+ function buildPlannerFinalTurn(outcome) {
8429
+ const r = outcome.result;
8430
+ if (outcome.status === "done") {
8431
+ const epicId = typeof r.epicId === "string" ? r.epicId : "";
8432
+ return `Planning complete \u2014 created epic ${epicId}.`;
8433
+ }
8434
+ if (r.needsHumanReview === true) {
8435
+ const marker = r.marker && typeof r.marker === "object" ? r.marker : {};
8436
+ const overall = typeof r.overallScore === "number" ? r.overallScore : typeof marker.overallScore === "number" ? marker.overallScore : null;
8437
+ const tier = typeof r.tier === "string" ? r.tier : typeof marker.tier === "string" ? marker.tier : null;
8438
+ const codes = Array.isArray(r.criticalIssueCodes) ? r.criticalIssueCodes.filter((c) => typeof c === "string") : [];
8439
+ const epicId = typeof r.epicId === "string" ? r.epicId : typeof marker.epicId === "string" ? marker.epicId : "";
8440
+ const parts = ["Planner run needs human review"];
8441
+ if (epicId) parts.push(`(epic ${epicId})`);
8442
+ let text = `${parts.join(" ")}.`;
8443
+ if (overall !== null) text += ` Latest audit score: ${String(overall)}/100${tier ? ` (${tier})` : ""}.`;
8444
+ else if (tier) text += ` Latest audit tier: ${tier}.`;
8445
+ if (codes.length > 0) text += ` Critical issues: ${codes.join(", ")}.`;
8446
+ const message = typeof r.message === "string" ? r.message : typeof r.error === "string" ? r.error : "";
8447
+ if (message) text += ` ${message}`;
8448
+ return text.slice(0, PLANNER_FINAL_TURN_MAX_CHARS);
8449
+ }
8450
+ return `Planner run ended: ${JSON.stringify(r).slice(0, PLANNER_FINAL_TURN_MAX_CHARS)}`;
8451
+ }
8373
8452
  async function invokeStartExecutionPlan(ctx, deps = {}) {
8374
8453
  const spawnImpl = deps.spawnImpl ?? spawn3;
8375
8454
  const fetchImpl = deps.fetchImpl ?? fetch;
@@ -8484,19 +8563,198 @@ ${stderr}`;
8484
8563
  finish({
8485
8564
  status: "failed",
8486
8565
  result: {
8566
+ needsHumanReview: true,
8567
+ stage: "VERIFY",
8487
8568
  error: "The planner finished but no epic was produced (the Epic Request was not converted to an epic). It may need human review."
8488
8569
  }
8489
8570
  });
8490
8571
  return;
8491
8572
  }
8573
+ const compliance = await fetchEpicComplianceSummary(
8574
+ ctx.apiBaseUrl,
8575
+ ctx.userApiToken,
8576
+ epicId,
8577
+ fetchImpl
8578
+ );
8579
+ if (compliance?.tier === "critical-fail") {
8580
+ finish({
8581
+ status: "failed",
8582
+ result: {
8583
+ needsHumanReview: true,
8584
+ stage: "EVALUATE",
8585
+ epicId,
8586
+ tier: compliance.tier,
8587
+ overallScore: compliance.overall,
8588
+ criticalIssueCodes: compliance.criticalIssueCodes,
8589
+ message: "The planner exited cleanly but the epic's latest audit is critical-fail; human review required before execution."
8590
+ }
8591
+ });
8592
+ return;
8593
+ }
8492
8594
  finish({ status: "done", result: { epicId } });
8493
8595
  })();
8494
8596
  });
8495
8597
  });
8496
8598
  try {
8497
- const epicId = typeof outcome.result.epicId === "string" ? outcome.result.epicId : "";
8498
- const summary = outcome.status === "done" ? `Planning complete \u2014 created epic ${epicId}.` : `Planner run ended: ${JSON.stringify(outcome.result).slice(0, PLANNER_FINAL_TURN_MAX_CHARS)}`;
8499
- await ctx.mailboxClient.postTurn(ctx.machineToken, ctx.jobId, summary);
8599
+ await ctx.mailboxClient.postTurn(ctx.machineToken, ctx.jobId, buildPlannerFinalTurn(outcome));
8600
+ } catch {
8601
+ }
8602
+ return outcome;
8603
+ }
8604
+ var REFINE_NOTES_ENV = "COMPBOX_REFINE_NOTES";
8605
+ function buildRefineArgs(epicId) {
8606
+ return [
8607
+ "-p",
8608
+ `@planner --refine ${epicId} --gates=auto --non-interactive`,
8609
+ "--permission-mode",
8610
+ "bypassPermissions"
8611
+ ];
8612
+ }
8613
+ function buildRefineEnv(routedEnv, notes) {
8614
+ const { [REFINE_NOTES_ENV]: _inherited, ...rest } = routedEnv;
8615
+ const trimmed = notes?.trim();
8616
+ return {
8617
+ ...rest,
8618
+ COMPBOX_NONINTERACTIVE: "1",
8619
+ PATH: claudeChildEnvPath(routedEnv.PATH),
8620
+ ...trimmed ? { [REFINE_NOTES_ENV]: trimmed } : {}
8621
+ };
8622
+ }
8623
+ function buildRefineFinalTurn(outcome) {
8624
+ const r = outcome.result;
8625
+ const text = (value) => typeof value === "string" && value ? value : void 0;
8626
+ if (outcome.status === "done") {
8627
+ return `Refine finished. The epic ${text(r.epicId) ?? ""} was updated in place.`;
8628
+ }
8629
+ if (r.needsHumanReview === true) {
8630
+ return `Refine needs human review: ${text(r.message) ?? text(r.error) ?? "the epic is still critical-fail"}`.slice(0, PLANNER_FINAL_TURN_MAX_CHARS);
8631
+ }
8632
+ return `Refine run ended: ${text(r.error) ?? JSON.stringify(r)}`.slice(0, PLANNER_FINAL_TURN_MAX_CHARS);
8633
+ }
8634
+ async function invokeStartExecutionRefine(ctx, deps = {}) {
8635
+ const spawnImpl = deps.spawnImpl ?? spawn3;
8636
+ const fetchImpl = deps.fetchImpl ?? fetch;
8637
+ const isGitRepo = deps.isGitRepo ?? isGitRepoDir;
8638
+ const resolveRoutingImpl = deps.resolveRoutingImpl ?? resolveRouting;
8639
+ const heartbeatIntervalMs = deps.heartbeatIntervalMs ?? PLANNER_HEARTBEAT_INTERVAL_MS;
8640
+ const timeoutMs = deps.timeoutMs ?? PLANNER_RUN_TIMEOUT_MS;
8641
+ if (!ctx.projectDir) {
8642
+ return { status: "failed", result: { error: projectDirNotConfiguredMessage() } };
8643
+ }
8644
+ if (!isGitRepo(ctx.projectDir)) {
8645
+ return { status: "failed", result: { error: projectDirNotGitRepoMessage(ctx.projectDir) } };
8646
+ }
8647
+ const routing = await resolveRoutingImpl();
8648
+ const command = resolveClaudeBinary() ?? "claude";
8649
+ const args = ctx.keyRun ? keyRunArgs(buildRefineArgs(ctx.epicId)) : buildRefineArgs(ctx.epicId);
8650
+ const baseEnv = buildRefineEnv(claudeSpawnEnv(process.env, routing), ctx.notes);
8651
+ const childEnv = ctx.keyRun ? keyRunEnv(baseEnv, ctx.keyRun) : baseEnv;
8652
+ try {
8653
+ await ctx.mailboxClient.postTurn(
8654
+ ctx.machineToken,
8655
+ ctx.jobId,
8656
+ `Started the planner in refine mode for epic ${ctx.epicId} (headless)${ctx.notes?.trim() ? ", with your notes" : ""}. This may take several minutes.`
8657
+ );
8658
+ } catch {
8659
+ }
8660
+ const outcome = await new Promise((resolve3) => {
8661
+ let stdout2 = "";
8662
+ let stderr = "";
8663
+ let settled = false;
8664
+ const child = spawnImpl(command, args, {
8665
+ cwd: ctx.projectDir,
8666
+ stdio: ["ignore", "pipe", "pipe"],
8667
+ env: childEnv
8668
+ });
8669
+ const heartbeatTimer = deps.heartbeat ? setInterval(() => {
8670
+ void Promise.resolve(deps.heartbeat?.()).catch(() => {
8671
+ });
8672
+ }, heartbeatIntervalMs) : void 0;
8673
+ const finish = (result) => {
8674
+ if (settled) return;
8675
+ settled = true;
8676
+ if (heartbeatTimer) clearInterval(heartbeatTimer);
8677
+ clearTimeout(timer);
8678
+ resolve3(result);
8679
+ };
8680
+ const timer = setTimeout(() => {
8681
+ child.kill("SIGKILL");
8682
+ finish({
8683
+ status: "failed",
8684
+ result: {
8685
+ error: `The refine run timed out after ${String(Math.round(timeoutMs / 6e4))} minutes and was terminated. The epic may be partially refined.`
8686
+ }
8687
+ });
8688
+ }, timeoutMs);
8689
+ child.stdout.on("data", (chunk) => {
8690
+ stdout2 += chunk.toString("utf-8");
8691
+ });
8692
+ child.stderr.on("data", (chunk) => {
8693
+ stderr += chunk.toString("utf-8");
8694
+ });
8695
+ child.on("error", (error) => {
8696
+ finish({
8697
+ status: "failed",
8698
+ result: {
8699
+ error: error.code === "ENOENT" ? claudeNotFoundMessage() : error.message || "Failed to spawn the planner."
8700
+ }
8701
+ });
8702
+ });
8703
+ child.on("close", (code) => {
8704
+ void (async () => {
8705
+ if (ctx.keyRun) stdout2 = await settleKeyRun(ctx, ctx.keyRun, stdout2);
8706
+ const combined = `${stdout2}
8707
+ ${stderr}`;
8708
+ const review = detectNeedsHumanReview(combined);
8709
+ if (review.needsReview) {
8710
+ finish({
8711
+ status: "failed",
8712
+ result: {
8713
+ needsHumanReview: true,
8714
+ stage: "REFINE",
8715
+ epicId: ctx.epicId,
8716
+ message: "Refine could not clear the epic's critical audit issues; human review required before execution.",
8717
+ ...review.marker ? { marker: review.marker } : {}
8718
+ }
8719
+ });
8720
+ return;
8721
+ }
8722
+ if (code !== 0) {
8723
+ finish({
8724
+ status: "failed",
8725
+ result: {
8726
+ error: stderr.trim() || stdout2.trim().slice(-PLANNER_FINAL_TURN_MAX_CHARS) || `The planner (refine) exited with code ${String(code ?? "null")}.`
8727
+ }
8728
+ });
8729
+ return;
8730
+ }
8731
+ const compliance = await fetchEpicComplianceSummary(
8732
+ ctx.apiBaseUrl,
8733
+ ctx.userApiToken,
8734
+ ctx.epicId,
8735
+ fetchImpl
8736
+ );
8737
+ if (compliance?.tier === "critical-fail") {
8738
+ finish({
8739
+ status: "failed",
8740
+ result: {
8741
+ needsHumanReview: true,
8742
+ stage: "REFINE",
8743
+ epicId: ctx.epicId,
8744
+ tier: compliance.tier,
8745
+ overallScore: compliance.overall,
8746
+ criticalIssueCodes: compliance.criticalIssueCodes,
8747
+ message: "Refine finished but the epic's latest audit is still critical-fail; human review required before execution."
8748
+ }
8749
+ });
8750
+ return;
8751
+ }
8752
+ finish({ status: "done", result: { epicId: ctx.epicId, refined: true } });
8753
+ })();
8754
+ });
8755
+ });
8756
+ try {
8757
+ await ctx.mailboxClient.postTurn(ctx.machineToken, ctx.jobId, buildRefineFinalTurn(outcome));
8500
8758
  } catch {
8501
8759
  }
8502
8760
  return outcome;
@@ -9340,6 +9598,24 @@ async function invokeConnectRepo(payload, deps = {}) {
9340
9598
  }
9341
9599
  }
9342
9600
 
9601
+ // src/utils/keep-awake.ts
9602
+ import { spawn as spawn6 } from "node:child_process";
9603
+ function startKeepAwake(opts) {
9604
+ const platform = opts.platform ?? process.platform;
9605
+ if (opts.enabled === false || platform !== "darwin") return null;
9606
+ const spawnFn = opts.spawnFn ?? spawn6;
9607
+ try {
9608
+ const child = spawnFn("/usr/bin/caffeinate", ["-i", "-s", "-w", String(opts.pid ?? process.pid)], {
9609
+ stdio: "ignore"
9610
+ });
9611
+ child.on("error", () => void 0);
9612
+ child.unref();
9613
+ return child;
9614
+ } catch {
9615
+ return null;
9616
+ }
9617
+ }
9618
+
9343
9619
  // src/commands/run.ts
9344
9620
  var POLL_WAIT_MS = 0;
9345
9621
  var IDLE_POLL_INTERVAL_MS = 15e3;
@@ -9419,6 +9695,16 @@ function parseStartExecutionPayload(payload) {
9419
9695
  if (p.kind === "orchestrate" && typeof p.epicId === "string" && p.epicId.length > 0) {
9420
9696
  return { kind: "orchestrate", epicId: p.epicId, ...projectRemote && { projectRemote }, ...useAiKey && { useAiKey } };
9421
9697
  }
9698
+ if (p.kind === "refine" && typeof p.epicId === "string" && p.epicId.length > 0) {
9699
+ const notes = typeof p.notes === "string" && p.notes.trim().length > 0 ? p.notes : void 0;
9700
+ return {
9701
+ kind: "refine",
9702
+ epicId: p.epicId,
9703
+ ...notes && { notes },
9704
+ ...projectRemote && { projectRemote },
9705
+ ...useAiKey && { useAiKey }
9706
+ };
9707
+ }
9422
9708
  return null;
9423
9709
  }
9424
9710
  async function handleStartExecution(ctx, job) {
@@ -9427,7 +9713,7 @@ async function handleStartExecution(ctx, job) {
9427
9713
  await completeWithFailure(
9428
9714
  ctx,
9429
9715
  job,
9430
- 'The start_execution job payload was missing or malformed (expected {kind:"plan",epicRequestId} or {kind:"orchestrate",epicId}).'
9716
+ 'The start_execution job payload was missing or malformed (expected {kind:"plan",epicRequestId}, {kind:"orchestrate",epicId} or {kind:"refine",epicId,notes?}).'
9431
9717
  );
9432
9718
  return;
9433
9719
  }
@@ -9487,6 +9773,39 @@ async function handleStartExecution(ctx, job) {
9487
9773
  );
9488
9774
  return;
9489
9775
  }
9776
+ if (payload.kind === "refine") {
9777
+ const userApiToken2 = ctx.userApiToken;
9778
+ if (!userApiToken2) {
9779
+ await completeWithFailure(
9780
+ ctx,
9781
+ job,
9782
+ "This device is not paired with a user API token, so the planner cannot refine the epic. Run `compbox configure` to re-pair."
9783
+ );
9784
+ return;
9785
+ }
9786
+ console.log(chalk9.gray(" Running the planner headless (start_execution / refine)..."));
9787
+ await runInvokerAndComplete(
9788
+ ctx,
9789
+ job,
9790
+ () => invokeStartExecutionRefine(
9791
+ {
9792
+ mailboxClient: ctx.client,
9793
+ machineToken: ctx.machineToken,
9794
+ jobId: job.id,
9795
+ apiBaseUrl: ctx.apiBaseUrl,
9796
+ userApiToken: userApiToken2,
9797
+ epicId: payload.epicId,
9798
+ ...payload.notes && { notes: payload.notes },
9799
+ projectDir: jobProjectDir,
9800
+ ...keyRun && { keyRun }
9801
+ },
9802
+ {
9803
+ heartbeat: () => ctx.client.heartbeat(ctx.machineToken).catch(() => void 0)
9804
+ }
9805
+ )
9806
+ );
9807
+ return;
9808
+ }
9490
9809
  const userApiToken = ctx.userApiToken;
9491
9810
  if (!userApiToken) {
9492
9811
  await completeWithFailure(
@@ -9660,6 +9979,9 @@ Couldn't register ${options.projectDir.trim()}: ${error instanceof Error ? error
9660
9979
  };
9661
9980
  const folders = config.projectDirs ?? [];
9662
9981
  const legacyDir = unusedLegacyProjectDir(config);
9982
+ if (startKeepAwake({ enabled: config.keepAwake })) {
9983
+ console.log(chalk9.gray(' Keeping this Mac awake while the runner is on (set "keepAwake": false in ~/.compbox/config.json to stop).'));
9984
+ }
9663
9985
  console.log(chalk9.bold("\nCompBox Agent Runner\n"));
9664
9986
  console.log(chalk9.gray(` Central: ${config.apiBaseUrl}`));
9665
9987
  console.log(chalk9.gray(` Machine: ${config.machineName ?? config.machineId}`));
@@ -10224,6 +10546,21 @@ async function runWorkspace(deps = {}) {
10224
10546
  })
10225
10547
  }
10226
10548
  );
10549
+ } else if (payload.kind === "refine" && payload.epicId) {
10550
+ outcome = await (deps.refine ?? invokeStartExecutionRefine)(
10551
+ {
10552
+ mailboxClient: client,
10553
+ machineToken: env.token,
10554
+ jobId: job.id,
10555
+ apiBaseUrl: env.apiUrl,
10556
+ userApiToken,
10557
+ epicId: payload.epicId,
10558
+ notes: typeof payload.notes === "string" ? payload.notes : void 0,
10559
+ projectDir: repoDir,
10560
+ keyRun
10561
+ },
10562
+ { heartbeat }
10563
+ );
10227
10564
  } else {
10228
10565
  return fail("The job is missing what to plan or build.");
10229
10566
  }
@@ -10333,7 +10670,7 @@ ${error instanceof Error ? error.message : String(error)}`));
10333
10670
  // src/index.ts
10334
10671
  function resolveCliVersion() {
10335
10672
  if (true) {
10336
- return "1.21.2";
10673
+ return "1.21.4";
10337
10674
  }
10338
10675
  const require2 = createRequire(import.meta.url);
10339
10676
  const pkg = require2("../package.json");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycompbox/compbox-cli",
3
- "version": "1.21.2",
3
+ "version": "1.21.4",
4
4
  "description": "CompBox CLI - Install, update, and manage Skill Packs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -225,6 +225,28 @@ export interface NeedsReviewResult {
225
225
  * to surface for review than to mis-report success).
226
226
  */
227
227
  export declare function detectNeedsHumanReview(output: string): NeedsReviewResult;
228
+ /** The parts of an epic's stored complianceScore the planner runner acts on. */
229
+ export interface EpicComplianceSummary {
230
+ overall: number | null;
231
+ tier: string | null;
232
+ /** Codes of the `critical` issues in the latest audit. */
233
+ criticalIssueCodes: string[];
234
+ }
235
+ /**
236
+ * Reduce an epic's API `complianceScore` (parsed object, or a JSON string from
237
+ * older servers) to the fields the planner runner needs. Returns null when no
238
+ * usable score is present. Pure + exported for unit testing (ENG-287-2).
239
+ */
240
+ export declare function summarizeComplianceScore(raw: unknown): EpicComplianceSummary | null;
241
+ /**
242
+ * Build the FINAL mailbox turn for a planner run (H4). A needs-review outcome
243
+ * always names the latest overall score and the critical issue codes when they
244
+ * are known, so the person sees why the plan was held back. Pure + exported.
245
+ */
246
+ export declare function buildPlannerFinalTurn(outcome: {
247
+ status: 'done' | 'failed';
248
+ result: Record<string, unknown>;
249
+ }): string;
228
250
  export interface StartExecutionPlanCtx {
229
251
  mailboxClient: MailboxClient;
230
252
  machineToken: string;
@@ -266,6 +288,45 @@ export interface StartExecutionPlanDeps {
266
288
  * non-zero exit, fail with a result the web failure banner can display.
267
289
  */
268
290
  export declare function invokeStartExecutionPlan(ctx: StartExecutionPlanCtx, deps?: StartExecutionPlanDeps): Promise<InvokeResult>;
291
+ /** The env var the planner's Refine Mode reads the user's notes from. */
292
+ export declare const REFINE_NOTES_ENV = "COMPBOX_REFINE_NOTES";
293
+ /**
294
+ * Argv for the headless refine run. Mirrors {@link buildPlannerArgs}; the notes
295
+ * are deliberately NOT a parameter — see {@link buildRefineEnv}.
296
+ */
297
+ export declare function buildRefineArgs(epicId: string): string[];
298
+ /**
299
+ * Child env for the refine run: the routed (pxpipe) env plus the headless
300
+ * signal, an augmented PATH and — only when non-empty — the notes. Any
301
+ * COMPBOX_REFINE_NOTES inherited from the daemon's own env is dropped so a
302
+ * stale value can never leak into an unrelated run.
303
+ */
304
+ export declare function buildRefineEnv(routedEnv: NodeJS.ProcessEnv, notes: string | undefined): NodeJS.ProcessEnv;
305
+ export interface StartExecutionRefineCtx {
306
+ mailboxClient: MailboxClient;
307
+ machineToken: string;
308
+ jobId: string;
309
+ apiBaseUrl: string;
310
+ userApiToken: string;
311
+ /** The existing epic to refine (payload.epicId). */
312
+ epicId: string;
313
+ /** Optional user notes (payload.notes) — passed via env only. */
314
+ notes?: string | undefined;
315
+ projectDir: string | undefined;
316
+ keyRun?: KeyRun;
317
+ }
318
+ export type StartExecutionRefineDeps = StartExecutionPlanDeps;
319
+ /** One-line final mailbox turn for a refine run. */
320
+ export declare function buildRefineFinalTurn(outcome: InvokeResult): string;
321
+ /**
322
+ * Run the planner headless in Refine Mode for a `start_execution`/`refine` job
323
+ * (ENG-289). Validates the repo, spawns `@planner --refine <epicId> --gates=auto
324
+ * --non-interactive`, keeps the machine alive, and on a clean exit re-reads the
325
+ * epic's latest audit: still critical-fail → needs human review; otherwise
326
+ * done `{ epicId, refined: true }`. The planner's needs-review marker wins
327
+ * regardless of exit code.
328
+ */
329
+ export declare function invokeStartExecutionRefine(ctx: StartExecutionRefineCtx, deps?: StartExecutionRefineDeps): Promise<InvokeResult>;
269
330
  /**
270
331
  * Per-run wall-clock budget for the headless orchestrator child (H4). Executing
271
332
  * a full epic (every phase, every feature-worker, reviewer + QA + security
@@ -1 +1 @@
1
- {"version":3,"file":"agent-invoker.d.ts","sourceRoot":"","sources":["../../src/utils/agent-invoker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAa,MAAM,oBAAoB,CAAC;AAItD,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,kBAAkB,EAClB,6BAA6B,EAI7B,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EAEtB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,EACrB,kBAAkB,EAClB,6BAA6B,GAC9B,CAAC;AACF,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;AAOpD,OAAO,EAAgD,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,KAAK,EAAE,YAAY,EAAgB,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC1F,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,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