@prestyj/cli 5.21.0 → 5.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/app-sidecar.js +33 -8
  2. package/dist/app-sidecar.js.map +1 -1
  3. package/dist/cli.js +5 -10
  4. package/dist/cli.js.map +1 -1
  5. package/dist/core/agent-session.d.ts +6 -0
  6. package/dist/core/agent-session.js +11 -3
  7. package/dist/core/agent-session.js.map +1 -1
  8. package/dist/core/autopilot-cycle.d.ts +3 -4
  9. package/dist/core/autopilot-cycle.js +18 -11
  10. package/dist/core/autopilot-cycle.js.map +1 -1
  11. package/dist/core/autopilot-gate.d.ts +1 -3
  12. package/dist/core/autopilot-gate.js +4 -16
  13. package/dist/core/autopilot-gate.js.map +1 -1
  14. package/dist/core/event-bus.d.ts +3 -0
  15. package/dist/core/event-bus.js +5 -0
  16. package/dist/core/event-bus.js.map +1 -1
  17. package/dist/core/ideal-review.js +7 -1
  18. package/dist/core/ideal-review.js.map +1 -1
  19. package/dist/core/nolan-context.d.ts +1 -2
  20. package/dist/core/nolan-context.js +81 -21
  21. package/dist/core/nolan-context.js.map +1 -1
  22. package/dist/core/nolan-prompt.js +52 -48
  23. package/dist/core/nolan-prompt.js.map +1 -1
  24. package/dist/core/prompt-command-expansion.d.ts +13 -0
  25. package/dist/core/prompt-command-expansion.js +48 -0
  26. package/dist/core/prompt-command-expansion.js.map +1 -0
  27. package/dist/core/run-status.d.ts +17 -0
  28. package/dist/core/run-status.js +28 -0
  29. package/dist/core/run-status.js.map +1 -0
  30. package/dist/core/session-history.js +5 -14
  31. package/dist/core/session-history.js.map +1 -1
  32. package/dist/core/verification-gate.d.ts +6 -1
  33. package/dist/core/verification-gate.js +26 -4
  34. package/dist/core/verification-gate.js.map +1 -1
  35. package/dist/ui/prompt-routing.js +2 -1
  36. package/dist/ui/prompt-routing.js.map +1 -1
  37. package/package.json +4 -4
@@ -35,6 +35,7 @@ import { buildNolanDigest, buildNolanAutopilotContext, buildNolanAutopilotPlanCo
35
35
  import { parseAutopilotVerdict } from "./core/autopilot-verdict.js";
36
36
  import { isWorkflowCommandText, countAssistantMessages, shouldStartAutopilotCycle, extractTurnToolCalls, isMechanicalOnlyTurn, } from "./core/autopilot-gate.js";
37
37
  import { driveAutopilotCycle, frameAutopilotInjection } from "./core/autopilot-cycle.js";
38
+ import { describeRunVerification, describeTurnVerification } from "./core/run-status.js";
38
39
  import { validateNolanModelPref, effectiveNolanModel, } from "./core/nolan-model.js";
39
40
  import { normalizeAutopilotMarkersForHistory, normalizeAppMarkersForHistory, normalizeNolanTurnsForHistory, getHistoryMessageVisibility, replayMessagesInOrder, restoreUserRow, restoreAssistantTexts, resolveRestoredCommand, autopilotMarkerCopySeed, } from "./core/session-history.js";
40
41
  import { sessionToMarkdown, defaultExportFilename, } from "./core/session-export.js";
@@ -1830,6 +1831,11 @@ async function createSession(deps, opts) {
1830
1831
  recordApprovedPlanMarkers(d.text);
1831
1832
  });
1832
1833
  session.eventBus.on("thinking_delta", (d) => broadcast("thinking_delta", d));
1834
+ session.eventBus.on("retry", (d) => {
1835
+ if (!d.silent)
1836
+ broadcast("retry", { reason: d.reason, attempt: d.attempt, delayMs: d.delayMs });
1837
+ });
1838
+ session.eventBus.on("max_turns", (d) => broadcast("max_turns", d));
1833
1839
  // The agent consumed queued steering at a turn boundary. Re-broadcast as the
1834
1840
  // usual `queued` depth update so the webview drops the pending affordance the
1835
1841
  // moment the message lands in the loop, not at run_end.
@@ -2139,8 +2145,10 @@ async function createSession(deps, opts) {
2139
2145
  // his own Ideal self-review adds latency and can corrupt the verdict shape.
2140
2146
  nolanAgent.setIdealReviewSuppressed(true);
2141
2147
  await nolanAgent.initialize();
2142
- // Deliberately no bus bridge: the review is silent. Errors surface via the
2143
- // runAutopilotReview try/catch as autopilot_error frames.
2148
+ // Keep review text/tools silent; report usage only for whole-task accounting.
2149
+ nolanAgent.eventBus.on("turn_end", (d) => {
2150
+ broadcast("autopilot_usage", { outputTokens: d.usage.outputTokens });
2151
+ });
2144
2152
  nolanAutoSession = nolanAgent;
2145
2153
  log("INFO", "app-sidecar", "nolan autopilot session ready", {
2146
2154
  provider: target.provider,
@@ -2182,7 +2190,7 @@ async function createSession(deps, opts) {
2182
2190
  }
2183
2191
  // Core provider-run bracket. Standalone runs own a lifecycle generation;
2184
2192
  // injected autopilot runs share the cycle's outer generation.
2185
- async function runAgent(label, run) {
2193
+ async function runAgent(label, run, reviewPending = () => false) {
2186
2194
  const ownsGeneration = !runLifecycle.running;
2187
2195
  const generation = ownsGeneration
2188
2196
  ? runLifecycle.begin(abortOwnedWork).generation
@@ -2195,7 +2203,11 @@ async function createSession(deps, opts) {
2195
2203
  const cancelGenAtStart = cancelGeneration;
2196
2204
  const assistantsBeforeRun = countAssistantMessages(session.getMessages());
2197
2205
  let runSucceeded = false;
2198
- broadcast("run_start", { text: label, runState: runLifecycle.state });
2206
+ broadcast("run_start", {
2207
+ text: label,
2208
+ runState: runLifecycle.state,
2209
+ continued: !ownsGeneration,
2210
+ });
2199
2211
  try {
2200
2212
  if (!runLifecycle.isCancellationRequested(generation))
2201
2213
  await run();
@@ -2266,6 +2278,16 @@ async function createSession(deps, opts) {
2266
2278
  broadcast("run_end", {
2267
2279
  ...(cancelled ? { cancelled: true } : {}),
2268
2280
  ...(verificationProblem ? { unverified: true } : {}),
2281
+ failed: !cancelled && !runSucceeded,
2282
+ // The cycle refuses an unresolved verification gate. Do not advertise
2283
+ // a review handoff that will exit before emitting any review events.
2284
+ reviewPending: !cancelled &&
2285
+ runSucceeded &&
2286
+ !verificationProblem &&
2287
+ (reviewPending() || !ownsGeneration),
2288
+ ...describeRunVerification(session.getVerificationEvidence(), verificationProblem),
2289
+ turnVerification: describeTurnVerification(session.getRunVerificationActivity(), verificationProblem),
2290
+ ...(verificationProblem ? { verificationReason: verificationProblem } : {}),
2269
2291
  runState: runLifecycle.state,
2270
2292
  });
2271
2293
  }
@@ -2554,7 +2576,7 @@ async function createSession(deps, opts) {
2554
2576
  else {
2555
2577
  await session.prompt(next.text);
2556
2578
  }
2557
- });
2579
+ }, () => autopilot);
2558
2580
  const decision = shouldStartAutopilotCycle({
2559
2581
  enabled: autopilot,
2560
2582
  cancelled: autopilotCancelled,
@@ -2576,7 +2598,8 @@ async function createSession(deps, opts) {
2576
2598
  });
2577
2599
  await runAutopilotCycle(next.text);
2578
2600
  }
2579
- else if (autopilot) {
2601
+ else {
2602
+ broadcast("autopilot_ignored", { reason: decision.reason });
2580
2603
  log("INFO", "app-sidecar", "autopilot skipped (queued turn)", {
2581
2604
  reason: decision.reason,
2582
2605
  });
@@ -2880,6 +2903,7 @@ async function createSession(deps, opts) {
2880
2903
  mode,
2881
2904
  chatAgent,
2882
2905
  running,
2906
+ reviewPending: autopilotActive,
2883
2907
  runState: runLifecycle.state,
2884
2908
  thinkingLevel: session.getThinkingLevel() ?? null,
2885
2909
  supportedThinkingLevels: getSupportedThinkingLevels(st.provider, st.model),
@@ -3746,7 +3770,7 @@ async function createSession(deps, opts) {
3746
3770
  // while the webview keeps showing the short `/name`.
3747
3771
  await session.prompt(text);
3748
3772
  }
3749
- });
3773
+ }, () => autopilot);
3750
3774
  // After the user's run settles, kick off Nolan's auto-review loop — but
3751
3775
  // only when the turn is actually reviewable (shouldStartAutopilotCycle):
3752
3776
  // workflow commands (/compare, /expand, …) end with reports or
@@ -3775,7 +3799,8 @@ async function createSession(deps, opts) {
3775
3799
  log("INFO", "app-sidecar", "autopilot cycle starting", { kind: decision.kind });
3776
3800
  await runAutopilotCycle(text);
3777
3801
  }
3778
- else if (autopilot) {
3802
+ else {
3803
+ broadcast("autopilot_ignored", { reason: decision.reason });
3779
3804
  log("INFO", "app-sidecar", "autopilot skipped", { reason: decision.reason });
3780
3805
  }
3781
3806
  // A prompt sent while Nolan was reviewing (build idle) queued but had no