@kenkaiiii/ggcoder 5.60.4 → 5.60.6

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/ken-context.d.ts +1 -2
  20. package/dist/core/ken-context.js +81 -21
  21. package/dist/core/ken-context.js.map +1 -1
  22. package/dist/core/ken-prompt.js +52 -48
  23. package/dist/core/ken-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
@@ -34,6 +34,7 @@ import { buildKenDigest, buildKenAutopilotContext, buildKenAutopilotPlanContext,
34
34
  import { parseAutopilotVerdict } from "./core/autopilot-verdict.js";
35
35
  import { isWorkflowCommandText, countAssistantMessages, shouldStartAutopilotCycle, extractTurnToolCalls, isMechanicalOnlyTurn, } from "./core/autopilot-gate.js";
36
36
  import { driveAutopilotCycle, frameAutopilotInjection } from "./core/autopilot-cycle.js";
37
+ import { describeRunVerification, describeTurnVerification } from "./core/run-status.js";
37
38
  import { validateKenModelPref, effectiveKenModel } from "./core/ken-model.js";
38
39
  import { normalizeAutopilotMarkersForHistory, normalizeAppMarkersForHistory, normalizeKenTurnsForHistory, getHistoryMessageVisibility, replayMessagesInOrder, restoreUserRow, restoreAssistantTexts, resolveRestoredCommand, autopilotMarkerCopySeed, } from "./core/session-history.js";
39
40
  import { sessionToMarkdown, defaultExportFilename, } from "./core/session-export.js";
@@ -1824,6 +1825,11 @@ async function createSession(deps, opts) {
1824
1825
  recordApprovedPlanMarkers(d.text);
1825
1826
  });
1826
1827
  session.eventBus.on("thinking_delta", (d) => broadcast("thinking_delta", d));
1828
+ session.eventBus.on("retry", (d) => {
1829
+ if (!d.silent)
1830
+ broadcast("retry", { reason: d.reason, attempt: d.attempt, delayMs: d.delayMs });
1831
+ });
1832
+ session.eventBus.on("max_turns", (d) => broadcast("max_turns", d));
1827
1833
  // The agent consumed queued steering at a turn boundary. Re-broadcast as the
1828
1834
  // usual `queued` depth update so the webview drops the pending affordance the
1829
1835
  // moment the message lands in the loop, not at run_end.
@@ -2133,8 +2139,10 @@ async function createSession(deps, opts) {
2133
2139
  // his own Ideal self-review adds latency and can corrupt the verdict shape.
2134
2140
  ken.setIdealReviewSuppressed(true);
2135
2141
  await ken.initialize();
2136
- // Deliberately no bus bridge: the review is silent. Errors surface via the
2137
- // runAutopilotReview try/catch as autopilot_error frames.
2142
+ // Keep review text/tools silent; report usage only for whole-task accounting.
2143
+ ken.eventBus.on("turn_end", (d) => {
2144
+ broadcast("autopilot_usage", { outputTokens: d.usage.outputTokens });
2145
+ });
2138
2146
  kenAutoSession = ken;
2139
2147
  log("INFO", "app-sidecar", "ken autopilot session ready", {
2140
2148
  provider: target.provider,
@@ -2176,7 +2184,7 @@ async function createSession(deps, opts) {
2176
2184
  }
2177
2185
  // Core provider-run bracket. Standalone runs own a lifecycle generation;
2178
2186
  // injected autopilot runs share the cycle's outer generation.
2179
- async function runAgent(label, run) {
2187
+ async function runAgent(label, run, reviewPending = () => false) {
2180
2188
  const ownsGeneration = !runLifecycle.running;
2181
2189
  const generation = ownsGeneration
2182
2190
  ? runLifecycle.begin(abortOwnedWork).generation
@@ -2189,7 +2197,11 @@ async function createSession(deps, opts) {
2189
2197
  const cancelGenAtStart = cancelGeneration;
2190
2198
  const assistantsBeforeRun = countAssistantMessages(session.getMessages());
2191
2199
  let runSucceeded = false;
2192
- broadcast("run_start", { text: label, runState: runLifecycle.state });
2200
+ broadcast("run_start", {
2201
+ text: label,
2202
+ runState: runLifecycle.state,
2203
+ continued: !ownsGeneration,
2204
+ });
2193
2205
  try {
2194
2206
  if (!runLifecycle.isCancellationRequested(generation))
2195
2207
  await run();
@@ -2260,6 +2272,16 @@ async function createSession(deps, opts) {
2260
2272
  broadcast("run_end", {
2261
2273
  ...(cancelled ? { cancelled: true } : {}),
2262
2274
  ...(verificationProblem ? { unverified: true } : {}),
2275
+ failed: !cancelled && !runSucceeded,
2276
+ // The cycle refuses an unresolved verification gate. Do not advertise
2277
+ // a review handoff that will exit before emitting any review events.
2278
+ reviewPending: !cancelled &&
2279
+ runSucceeded &&
2280
+ !verificationProblem &&
2281
+ (reviewPending() || !ownsGeneration),
2282
+ ...describeRunVerification(session.getVerificationEvidence(), verificationProblem),
2283
+ turnVerification: describeTurnVerification(session.getRunVerificationActivity(), verificationProblem),
2284
+ ...(verificationProblem ? { verificationReason: verificationProblem } : {}),
2263
2285
  runState: runLifecycle.state,
2264
2286
  });
2265
2287
  }
@@ -2544,7 +2566,7 @@ async function createSession(deps, opts) {
2544
2566
  else {
2545
2567
  await session.prompt(next.text);
2546
2568
  }
2547
- });
2569
+ }, () => autopilot);
2548
2570
  const decision = shouldStartAutopilotCycle({
2549
2571
  enabled: autopilot,
2550
2572
  cancelled: autopilotCancelled,
@@ -2566,7 +2588,8 @@ async function createSession(deps, opts) {
2566
2588
  });
2567
2589
  await runAutopilotCycle(next.text);
2568
2590
  }
2569
- else if (autopilot) {
2591
+ else {
2592
+ broadcast("autopilot_ignored", { reason: decision.reason });
2570
2593
  log("INFO", "app-sidecar", "autopilot skipped (queued turn)", {
2571
2594
  reason: decision.reason,
2572
2595
  });
@@ -2854,6 +2877,7 @@ async function createSession(deps, opts) {
2854
2877
  mode,
2855
2878
  chatAgent,
2856
2879
  running,
2880
+ reviewPending: autopilotActive,
2857
2881
  runState: runLifecycle.state,
2858
2882
  thinkingLevel: session.getThinkingLevel() ?? null,
2859
2883
  supportedThinkingLevels: getSupportedThinkingLevels(st.provider, st.model),
@@ -3602,7 +3626,7 @@ async function createSession(deps, opts) {
3602
3626
  // while the webview keeps showing the short `/name`.
3603
3627
  await session.prompt(text);
3604
3628
  }
3605
- });
3629
+ }, () => autopilot);
3606
3630
  // After the user's run settles, kick off Ken's auto-review loop — but
3607
3631
  // only when the turn is actually reviewable (shouldStartAutopilotCycle):
3608
3632
  // workflow commands (/compare, /expand, …) end with reports or
@@ -3631,7 +3655,8 @@ async function createSession(deps, opts) {
3631
3655
  log("INFO", "app-sidecar", "autopilot cycle starting", { kind: decision.kind });
3632
3656
  await runAutopilotCycle(text);
3633
3657
  }
3634
- else if (autopilot) {
3658
+ else {
3659
+ broadcast("autopilot_ignored", { reason: decision.reason });
3635
3660
  log("INFO", "app-sidecar", "autopilot skipped", { reason: decision.reason });
3636
3661
  }
3637
3662
  // A prompt sent while Ken was reviewing (build idle) queued but had no