@kenkaiiii/ggcoder 5.60.3 → 5.60.5

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 +27 -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 +29 -0
  6. package/dist/core/agent-session.js +141 -4
  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 +6 -0
  28. package/dist/core/run-status.js +15 -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/thinking-level.d.ts +1 -1
  33. package/dist/core/thinking-level.js +1 -1
  34. package/dist/core/thinking-level.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 } 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,10 @@ 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
+ reviewPending: !cancelled && runSucceeded && (reviewPending() || !ownsGeneration),
2277
+ ...describeRunVerification(session.getVerificationEvidence(), verificationProblem),
2278
+ ...(verificationProblem ? { verificationReason: verificationProblem } : {}),
2263
2279
  runState: runLifecycle.state,
2264
2280
  });
2265
2281
  }
@@ -2544,7 +2560,7 @@ async function createSession(deps, opts) {
2544
2560
  else {
2545
2561
  await session.prompt(next.text);
2546
2562
  }
2547
- });
2563
+ }, () => autopilot);
2548
2564
  const decision = shouldStartAutopilotCycle({
2549
2565
  enabled: autopilot,
2550
2566
  cancelled: autopilotCancelled,
@@ -2566,7 +2582,8 @@ async function createSession(deps, opts) {
2566
2582
  });
2567
2583
  await runAutopilotCycle(next.text);
2568
2584
  }
2569
- else if (autopilot) {
2585
+ else {
2586
+ broadcast("autopilot_ignored", { reason: decision.reason });
2570
2587
  log("INFO", "app-sidecar", "autopilot skipped (queued turn)", {
2571
2588
  reason: decision.reason,
2572
2589
  });
@@ -2854,6 +2871,7 @@ async function createSession(deps, opts) {
2854
2871
  mode,
2855
2872
  chatAgent,
2856
2873
  running,
2874
+ reviewPending: autopilotActive,
2857
2875
  runState: runLifecycle.state,
2858
2876
  thinkingLevel: session.getThinkingLevel() ?? null,
2859
2877
  supportedThinkingLevels: getSupportedThinkingLevels(st.provider, st.model),
@@ -3602,7 +3620,7 @@ async function createSession(deps, opts) {
3602
3620
  // while the webview keeps showing the short `/name`.
3603
3621
  await session.prompt(text);
3604
3622
  }
3605
- });
3623
+ }, () => autopilot);
3606
3624
  // After the user's run settles, kick off Ken's auto-review loop — but
3607
3625
  // only when the turn is actually reviewable (shouldStartAutopilotCycle):
3608
3626
  // workflow commands (/compare, /expand, …) end with reports or
@@ -3631,7 +3649,8 @@ async function createSession(deps, opts) {
3631
3649
  log("INFO", "app-sidecar", "autopilot cycle starting", { kind: decision.kind });
3632
3650
  await runAutopilotCycle(text);
3633
3651
  }
3634
- else if (autopilot) {
3652
+ else {
3653
+ broadcast("autopilot_ignored", { reason: decision.reason });
3635
3654
  log("INFO", "app-sidecar", "autopilot skipped", { reason: decision.reason });
3636
3655
  }
3637
3656
  // A prompt sent while Ken was reviewing (build idle) queued but had no