@kenkaiiii/ggcoder 5.56.0 → 5.57.0

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 (39) hide show
  1. package/dist/app-sidecar.js +27 -7
  2. package/dist/app-sidecar.js.map +1 -1
  3. package/dist/core/agent-session.d.ts +3 -0
  4. package/dist/core/agent-session.d.ts.map +1 -1
  5. package/dist/core/agent-session.js +111 -20
  6. package/dist/core/agent-session.js.map +1 -1
  7. package/dist/core/autopilot-cycle.d.ts +7 -3
  8. package/dist/core/autopilot-cycle.d.ts.map +1 -1
  9. package/dist/core/autopilot-cycle.js +43 -6
  10. package/dist/core/autopilot-cycle.js.map +1 -1
  11. package/dist/core/autopilot-verdict.d.ts +2 -0
  12. package/dist/core/autopilot-verdict.d.ts.map +1 -1
  13. package/dist/core/autopilot-verdict.js +25 -0
  14. package/dist/core/autopilot-verdict.js.map +1 -1
  15. package/dist/core/event-bus.d.ts +1 -0
  16. package/dist/core/event-bus.d.ts.map +1 -1
  17. package/dist/core/event-bus.js.map +1 -1
  18. package/dist/core/ideal-review.d.ts.map +1 -1
  19. package/dist/core/ideal-review.js +18 -5
  20. package/dist/core/ideal-review.js.map +1 -1
  21. package/dist/core/ken-prompt.js +32 -14
  22. package/dist/core/ken-prompt.js.map +1 -1
  23. package/dist/core/session-manager.d.ts +1 -1
  24. package/dist/core/session-manager.d.ts.map +1 -1
  25. package/dist/core/verification-evidence.d.ts +1 -1
  26. package/dist/core/verification-evidence.d.ts.map +1 -1
  27. package/dist/core/verification-evidence.js +35 -2
  28. package/dist/core/verification-evidence.js.map +1 -1
  29. package/dist/core/verification-gate.d.ts +38 -18
  30. package/dist/core/verification-gate.d.ts.map +1 -1
  31. package/dist/core/verification-gate.js +154 -21
  32. package/dist/core/verification-gate.js.map +1 -1
  33. package/dist/system-prompt.js +2 -2
  34. package/dist/system-prompt.js.map +1 -1
  35. package/dist/utils/github-ci.d.ts +19 -0
  36. package/dist/utils/github-ci.d.ts.map +1 -0
  37. package/dist/utils/github-ci.js +137 -0
  38. package/dist/utils/github-ci.js.map +1 -0
  39. package/package.json +4 -4
@@ -56,6 +56,7 @@ import { getModel, getDefaultThinkingLevel, getContextWindow, getAllModels, clea
56
56
  import { resolveStartOrFallback } from "./core/resolve-start.js";
57
57
  import { getGitBranch, getGitDirtyFileCount, isGitRepo } from "./utils/git.js";
58
58
  import { getGitHubOpenCounts, getGitHubRepoSlug } from "./utils/github.js";
59
+ import { startGitHubCIPoll } from "./utils/github-ci.js";
59
60
  import { extractPlanSteps } from "./utils/plan-steps.js";
60
61
  import { getNextThinkingLevel, getSupportedThinkingLevels, isThinkingLevelSupported, } from "./core/thinking-level.js";
61
62
  import { PROMPT_COMMANDS } from "./core/prompt-commands.js";
@@ -1678,6 +1679,7 @@ async function createSession(deps, opts) {
1678
1679
  const gitHubSlug = initialGitHubSlug;
1679
1680
  let gitHubIssues = null;
1680
1681
  let gitHubPRs = null;
1682
+ let gitHubCI = null;
1681
1683
  function currentContextWindow() {
1682
1684
  const st = session.getState();
1683
1685
  return getContextWindow(st.model, { provider: st.provider, accountId: st.accountId });
@@ -1692,6 +1694,7 @@ async function createSession(deps, opts) {
1692
1694
  gitDirtyFileCount,
1693
1695
  gitHubIssues,
1694
1696
  gitHubPRs,
1697
+ gitHubCI,
1695
1698
  gitHubRepoUrl: gitHubSlug ? `https://github.com/${gitHubSlug}` : null,
1696
1699
  tasks: session.listBackgroundProcesses(),
1697
1700
  // Roots added with /add-dir — the header shows a badge when non-empty.
@@ -2196,7 +2199,14 @@ async function createSession(deps, opts) {
2196
2199
  }
2197
2200
  finally {
2198
2201
  const cancelled = runLifecycle.isCancellationRequested(generation);
2202
+ const verificationProblem = cancelled ? null : session.getVerificationProblem();
2203
+ if (runSucceeded && verificationProblem && ownsGeneration) {
2204
+ // Expected control outcome: run_end and the journal already carry Unverified.
2205
+ // Do not format it as a crash or persist a misleading error marker.
2206
+ log("WARN", "app-sidecar", "verification incomplete", { message: verificationProblem });
2207
+ }
2199
2208
  if (runSucceeded &&
2209
+ !verificationProblem &&
2200
2210
  !cancelled &&
2201
2211
  cancelGeneration === cancelGenAtStart &&
2202
2212
  countAssistantMessages(session.getMessages()) > assistantsBeforeRun) {
@@ -2213,12 +2223,14 @@ async function createSession(deps, opts) {
2213
2223
  // A run may have opened/closed issues or PRs — refresh fire-and-forget so
2214
2224
  // teardown isn't delayed by the network. Broadcasts itself on change.
2215
2225
  void refreshGitHubCounts();
2226
+ void ciPoll.refresh();
2216
2227
  // Serialize behind any marker/tool-triggered refresh so the terminal
2217
2228
  // progress snapshot uses the live plan file. Once every canonical step
2218
2229
  // is complete, remove the approved plan from future system prompts and
2219
2230
  // clear the widget before run_end paints the idle activity bar.
2220
2231
  if (runSucceeded &&
2221
2232
  !cancelled &&
2233
+ !verificationProblem &&
2222
2234
  approvedPlanPath !== null &&
2223
2235
  (await queueApprovedPlanProgressSync())) {
2224
2236
  try {
@@ -2235,7 +2247,7 @@ async function createSession(deps, opts) {
2235
2247
  }
2236
2248
  }
2237
2249
  if (ownsGeneration) {
2238
- finishOwnedGeneration(generation, false, runSucceeded ? "completed" : "failed");
2250
+ finishOwnedGeneration(generation, false, verificationProblem ? "unverified" : runSucceeded ? "completed" : "failed");
2239
2251
  }
2240
2252
  // A cancelled injected run is still owned by the surrounding autopilot
2241
2253
  // cycle; its outer finalizer emits the one terminal cancelled run_end.
@@ -2244,6 +2256,7 @@ async function createSession(deps, opts) {
2244
2256
  cancelledRunEndGenerations.add(generation);
2245
2257
  broadcast("run_end", {
2246
2258
  ...(cancelled ? { cancelled: true } : {}),
2259
+ ...(verificationProblem ? { unverified: true } : {}),
2247
2260
  runState: runLifecycle.state,
2248
2261
  });
2249
2262
  }
@@ -2355,7 +2368,7 @@ async function createSession(deps, opts) {
2355
2368
  // control flow lives in driveAutopilotCycle (core/autopilot-cycle.ts) so
2356
2369
  // every exit path is unit-tested; this only wires the real dependencies.
2357
2370
  async function runAutopilotCycle(originalRequest) {
2358
- if (!autopilot || autopilotCancelled)
2371
+ if (!autopilot || autopilotCancelled || session.getVerificationProblem())
2359
2372
  return;
2360
2373
  const generation = runLifecycle.begin(abortOwnedWork).generation;
2361
2374
  pendingCancelDrain = null;
@@ -2371,6 +2384,7 @@ async function createSession(deps, opts) {
2371
2384
  // round available.
2372
2385
  maxRounds: pendingPlanPath !== null ? MAX_AUTOPILOT_ROUNDS + 2 : MAX_AUTOPILOT_ROUNDS,
2373
2386
  isCancelled: () => autopilotCancelled,
2387
+ verificationProblem: () => session.getVerificationProblem(),
2374
2388
  // An injected run entering plan mode WITHOUT submitting (enter_plan,
2375
2389
  // no exit_plan) halts the cycle — Ken never prompts into a read-only
2376
2390
  // plan-mode session. A submitted plan takes the planPending branch.
@@ -2383,7 +2397,7 @@ async function createSession(deps, opts) {
2383
2397
  // Auto-accept: the inlined POST /plan/accept body. Returns false when
2384
2398
  // the plan generation moved since the review (user acted) — the cycle
2385
2399
  // exits silently and the user's action stands.
2386
- acceptPlan: async () => {
2400
+ acceptPlan: async (reason) => {
2387
2401
  if (pendingPlanPath === null || planGeneration !== planGenAtReview)
2388
2402
  return false;
2389
2403
  const planPath = pendingPlanPath;
@@ -2400,11 +2414,11 @@ async function createSession(deps, opts) {
2400
2414
  clearPendingPlan();
2401
2415
  // Keep the approval marker ahead of the reset, then seed the reset
2402
2416
  // with the sidecar's canonical count from the actual plan file.
2403
- broadcast("autopilot_plan_accepted", {});
2417
+ broadcast("autopilot_plan_accepted", reason ? { reason } : {});
2404
2418
  broadcast("session_reset", { planTotal });
2405
2419
  broadcast("plan_progress", planProgressPayload());
2406
2420
  // Persisted into the NEW session so a resume shows the marker.
2407
- void session.persistAutopilotMarker("plan_approved");
2421
+ void session.persistAutopilotMarker("plan_approved", { reason });
2408
2422
  return true;
2409
2423
  },
2410
2424
  runImplement: () => {
@@ -2458,9 +2472,10 @@ async function createSession(deps, opts) {
2458
2472
  version: 1,
2459
2473
  phase: "done",
2460
2474
  afterMessageCount: session.getPersistedTranscriptCount(),
2475
+ ...event.data,
2461
2476
  });
2462
2477
  broadcast(event.type, { ...event.data, copySeed: seed });
2463
- void session.persistAutopilotMarker("done");
2478
+ void session.persistAutopilotMarker("done", event.data);
2464
2479
  return;
2465
2480
  }
2466
2481
  broadcast(event.type, event.data);
@@ -2477,7 +2492,7 @@ async function createSession(deps, opts) {
2477
2492
  finally {
2478
2493
  autopilotActive = false;
2479
2494
  session.setIdealReviewSuppressed(autopilot);
2480
- finishOwnedGeneration(generation, true);
2495
+ finishOwnedGeneration(generation, true, session.getVerificationProblem() ? "unverified" : "completed");
2481
2496
  queueMicrotask(() => void runStrandedQueue());
2482
2497
  }
2483
2498
  }
@@ -2729,6 +2744,10 @@ async function createSession(deps, opts) {
2729
2744
  gitHubPoll.unref?.();
2730
2745
  };
2731
2746
  scheduleGitHubPoll(2000);
2747
+ const ciPoll = startGitHubCIPoll(cwd, (next) => {
2748
+ gitHubCI = next;
2749
+ broadcast("extras", footerExtras());
2750
+ });
2732
2751
  function readBody(req, res) {
2733
2752
  return readCappedBody(req, res);
2734
2753
  }
@@ -5002,6 +5021,7 @@ async function createSession(deps, opts) {
5002
5021
  gitHubPollStopped = true;
5003
5022
  if (gitHubPoll)
5004
5023
  clearTimeout(gitHubPoll);
5024
+ ciPoll.stop();
5005
5025
  // Stop the Telegram serve loop + dispose its per-chat sessions.
5006
5026
  if (serveController)
5007
5027
  await serveController.stop().catch(() => { });