@kenkaiiii/ggcoder 5.19.0 → 5.19.2

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 (89) hide show
  1. package/dist/app-sidecar.js +15 -1
  2. package/dist/app-sidecar.js.map +1 -1
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +3 -0
  5. package/dist/cli.js.map +1 -1
  6. package/dist/core/agent-session-compaction.test.js +437 -9
  7. package/dist/core/agent-session-compaction.test.js.map +1 -1
  8. package/dist/core/agent-session-review-coverage.test.js +26 -0
  9. package/dist/core/agent-session-review-coverage.test.js.map +1 -1
  10. package/dist/core/agent-session-tool-result-policy.test.js +14 -1
  11. package/dist/core/agent-session-tool-result-policy.test.js.map +1 -1
  12. package/dist/core/agent-session.d.ts +21 -0
  13. package/dist/core/agent-session.d.ts.map +1 -1
  14. package/dist/core/agent-session.js +175 -33
  15. package/dist/core/agent-session.js.map +1 -1
  16. package/dist/core/compaction/active-context.d.ts +17 -0
  17. package/dist/core/compaction/active-context.d.ts.map +1 -0
  18. package/dist/core/compaction/active-context.js +20 -0
  19. package/dist/core/compaction/active-context.js.map +1 -0
  20. package/dist/core/compaction/active-context.test.d.ts +2 -0
  21. package/dist/core/compaction/active-context.test.d.ts.map +1 -0
  22. package/dist/core/compaction/active-context.test.js +36 -0
  23. package/dist/core/compaction/active-context.test.js.map +1 -0
  24. package/dist/core/compaction/compactor.d.ts +10 -17
  25. package/dist/core/compaction/compactor.d.ts.map +1 -1
  26. package/dist/core/compaction/compactor.js +21 -33
  27. package/dist/core/compaction/compactor.js.map +1 -1
  28. package/dist/core/compaction/compactor.test.js +74 -66
  29. package/dist/core/compaction/compactor.test.js.map +1 -1
  30. package/dist/core/compaction/token-estimator.d.ts +25 -1
  31. package/dist/core/compaction/token-estimator.d.ts.map +1 -1
  32. package/dist/core/compaction/token-estimator.js +86 -1
  33. package/dist/core/compaction/token-estimator.js.map +1 -1
  34. package/dist/core/compaction/token-estimator.test.js +147 -1
  35. package/dist/core/compaction/token-estimator.test.js.map +1 -1
  36. package/dist/core/compaction/tool-result-pruner.d.ts +37 -0
  37. package/dist/core/compaction/tool-result-pruner.d.ts.map +1 -0
  38. package/dist/core/compaction/tool-result-pruner.js +103 -0
  39. package/dist/core/compaction/tool-result-pruner.js.map +1 -0
  40. package/dist/core/compaction/tool-result-pruner.test.d.ts +2 -0
  41. package/dist/core/compaction/tool-result-pruner.test.d.ts.map +1 -0
  42. package/dist/core/compaction/tool-result-pruner.test.js +148 -0
  43. package/dist/core/compaction/tool-result-pruner.test.js.map +1 -0
  44. package/dist/core/ideal-review.d.ts +6 -0
  45. package/dist/core/ideal-review.d.ts.map +1 -1
  46. package/dist/core/ideal-review.js +14 -0
  47. package/dist/core/ideal-review.js.map +1 -1
  48. package/dist/core/ideal-review.test.js +10 -1
  49. package/dist/core/ideal-review.test.js.map +1 -1
  50. package/dist/core/index.d.ts +1 -1
  51. package/dist/core/index.d.ts.map +1 -1
  52. package/dist/core/index.js +1 -1
  53. package/dist/core/index.js.map +1 -1
  54. package/dist/core/settings-manager.js +2 -2
  55. package/dist/core/settings-manager.js.map +1 -1
  56. package/dist/tools/bash.d.ts +9 -0
  57. package/dist/tools/bash.d.ts.map +1 -1
  58. package/dist/tools/bash.js +28 -18
  59. package/dist/tools/bash.js.map +1 -1
  60. package/dist/tools/bash.test.d.ts +2 -0
  61. package/dist/tools/bash.test.d.ts.map +1 -0
  62. package/dist/tools/bash.test.js +56 -0
  63. package/dist/tools/bash.test.js.map +1 -0
  64. package/dist/tools/overflow.d.ts +12 -2
  65. package/dist/tools/overflow.d.ts.map +1 -1
  66. package/dist/tools/overflow.js +49 -4
  67. package/dist/tools/overflow.js.map +1 -1
  68. package/dist/tools/overflow.test.d.ts +2 -0
  69. package/dist/tools/overflow.test.d.ts.map +1 -0
  70. package/dist/tools/overflow.test.js +62 -0
  71. package/dist/tools/overflow.test.js.map +1 -0
  72. package/dist/ui/App.d.ts.map +1 -1
  73. package/dist/ui/App.js +3 -16
  74. package/dist/ui/App.js.map +1 -1
  75. package/dist/ui/hooks/useAgentLoop.d.ts +2 -4
  76. package/dist/ui/hooks/useAgentLoop.d.ts.map +1 -1
  77. package/dist/ui/hooks/useAgentLoop.js +6 -2
  78. package/dist/ui/hooks/useAgentLoop.js.map +1 -1
  79. package/dist/ui/hooks/useAgentLoop.test.js +31 -0
  80. package/dist/ui/hooks/useAgentLoop.test.js.map +1 -1
  81. package/dist/ui/hooks/useContextCompaction.d.ts +5 -8
  82. package/dist/ui/hooks/useContextCompaction.d.ts.map +1 -1
  83. package/dist/ui/hooks/useContextCompaction.js +77 -16
  84. package/dist/ui/hooks/useContextCompaction.js.map +1 -1
  85. package/dist/ui/hooks/useContextCompaction.test.d.ts +2 -0
  86. package/dist/ui/hooks/useContextCompaction.test.d.ts.map +1 -0
  87. package/dist/ui/hooks/useContextCompaction.test.js +135 -0
  88. package/dist/ui/hooks/useContextCompaction.test.js.map +1 -0
  89. package/package.json +4 -4
@@ -34,6 +34,7 @@ import { driveAutopilotCycle, frameAutopilotInjection } from "./core/autopilot-c
34
34
  import { validateKenModelPref, effectiveKenModel } from "./core/ken-model.js";
35
35
  import { normalizeAutopilotMarkersForHistory, normalizeAppMarkersForHistory, normalizeKenTurnsForHistory, restoreUserRow, restoreAssistantTexts, autopilotMarkerCopySeed, } from "./core/session-history.js";
36
36
  import { AuthStorage } from "./core/auth-storage.js";
37
+ import { cleanupToolOutputs } from "./tools/overflow.js";
37
38
  import { fetchSubscriptionUsage, MOONSHOT_OAUTH_KEY, SubscriptionUsageError, XIAOMI_CREDITS_KEY, } from "@kenkaiiii/gg-core";
38
39
  import { loginAnthropic } from "./core/oauth/anthropic.js";
39
40
  import { loginOpenAI } from "./core/oauth/openai.js";
@@ -510,6 +511,9 @@ async function main() {
510
511
  // before anything spawns (bash tool, background tasks, LSP, git helpers all
511
512
  // inherit it). Best-effort — never blocks startup beyond its internal cap.
512
513
  await enrichProcessPath();
514
+ // Sweep recoverable full tool outputs (~/.gg/tool-output/) older than 48h.
515
+ // Fire-and-forget: cleanup must never delay or break startup.
516
+ void cleanupToolOutputs().catch(() => { });
513
517
  const auth = new AuthStorage(paths.authFile);
514
518
  await auth.load();
515
519
  // Every window's session lives here as an in-process object, keyed by the id
@@ -1268,8 +1272,10 @@ async function createSession(deps, opts) {
1268
1272
  // Autopilot (auto-review) toggle for THIS window's project. Loaded from
1269
1273
  // gg-app.json on boot; flipped via POST /autopilot. When on, POST /prompt runs
1270
1274
  // runAutopilotCycle after the user's turn settles — Ken auto-reviews the work
1271
- // and drives the review→prompt→review loop.
1275
+ // and drives the review→prompt→review loop. Ken is the sole verification
1276
+ // owner in this mode, so suppress the build session's redundant Ideal hook.
1272
1277
  let autopilot = mode === "code" && (await loadAutopilot(cwd));
1278
+ session.setIdealReviewSuppressed(autopilot);
1273
1279
  // True while an autopilot review is in flight (used to defer kenAuto model
1274
1280
  // switches, like kenRunning does for chat Ken, and to drive the spinner).
1275
1281
  let autopilotReviewing = false;
@@ -1466,6 +1472,9 @@ async function createSession(deps, opts) {
1466
1472
  // (often >5 min) regardless of the user's global speedProfile pick.
1467
1473
  forceLongCacheRetention: true,
1468
1474
  });
1475
+ // Ken is already the independent autopilot reviewer; recursively running
1476
+ // his own Ideal self-review adds latency and can corrupt the verdict shape.
1477
+ ken.setIdealReviewSuppressed(true);
1469
1478
  await ken.initialize();
1470
1479
  // Deliberately no bus bridge: the review is silent. Errors surface via the
1471
1480
  // runAutopilotReview try/catch as autopilot_error frames.
@@ -1688,6 +1697,7 @@ async function createSession(deps, opts) {
1688
1697
  const generation = runLifecycle.begin(abortOwnedWork).generation;
1689
1698
  pendingCancelDrain = null;
1690
1699
  autopilotActive = true;
1700
+ session.setIdealReviewSuppressed(true);
1691
1701
  // Generation captured by the last plan review; acceptPlan re-checks it so
1692
1702
  // a user Accept/Reject landing mid-review always wins.
1693
1703
  let planGenAtReview = -1;
@@ -1801,6 +1811,7 @@ async function createSession(deps, opts) {
1801
1811
  }
1802
1812
  finally {
1803
1813
  autopilotActive = false;
1814
+ session.setIdealReviewSuppressed(autopilot);
1804
1815
  finishOwnedGeneration(generation, true);
1805
1816
  queueMicrotask(() => void runStrandedQueue());
1806
1817
  }
@@ -2781,6 +2792,9 @@ async function createSession(deps, opts) {
2781
2792
  return;
2782
2793
  }
2783
2794
  autopilot = enabled;
2795
+ // A toggle-off during an active cycle takes effect after Ken finishes;
2796
+ // until then, injected build runs must not re-enable Ideal self-review.
2797
+ session.setIdealReviewSuppressed(enabled || autopilotActive);
2784
2798
  await saveAutopilot(cwd, enabled);
2785
2799
  log("INFO", "app-sidecar", "autopilot toggled", { enabled: String(enabled) });
2786
2800
  broadcast("autopilot", { autopilot: enabled });