@kernlang/agon 0.1.6 → 0.1.7

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 (55) hide show
  1. package/dist/{chunk-XWHC6VAH.js → chunk-45YTXJWJ.js} +1 -1
  2. package/dist/chunk-45YTXJWJ.js.map +1 -0
  3. package/dist/{chunk-6IF2AV4Y.js → chunk-6WWOJXG4.js} +104 -47
  4. package/dist/chunk-6WWOJXG4.js.map +1 -0
  5. package/dist/{chunk-3PDYVGRS.js → chunk-AONHRJRW.js} +172 -14
  6. package/dist/chunk-AONHRJRW.js.map +1 -0
  7. package/dist/{chunk-TMNHJOKU.js → chunk-BPKY4OF2.js} +74 -3
  8. package/dist/chunk-BPKY4OF2.js.map +1 -0
  9. package/dist/{chunk-NBV37VMW.js → chunk-I2PMSXJ3.js} +2 -2
  10. package/dist/chunk-I2PMSXJ3.js.map +1 -0
  11. package/dist/{chunk-PUNBDLQO.js → chunk-RKXVKX25.js} +42 -8
  12. package/dist/chunk-RKXVKX25.js.map +1 -0
  13. package/dist/{chunk-HSPQEDHX.js → chunk-SUT2HDOY.js} +1 -1
  14. package/dist/chunk-SUT2HDOY.js.map +1 -0
  15. package/dist/{chunk-7WZ2O5WZ.js → chunk-WDT5NJOA.js} +4 -4
  16. package/dist/chunk-WDT5NJOA.js.map +1 -0
  17. package/dist/{dispatch-S3CR5HKX.js → dispatch-J4RSWLXM.js} +2 -2
  18. package/dist/dispatch-J4RSWLXM.js.map +1 -0
  19. package/dist/{forge-GUOEJ5DJ.js → forge-O2SJ5JIQ.js} +6 -6
  20. package/dist/forge-O2SJ5JIQ.js.map +1 -0
  21. package/dist/index.js +385 -53
  22. package/dist/index.js.map +1 -1
  23. package/dist/mcp/engines/agy.json +43 -0
  24. package/dist/mcp/engines/aider.json +40 -0
  25. package/dist/mcp/engines/claude.json +79 -0
  26. package/dist/mcp/engines/codex.json +77 -0
  27. package/dist/mcp/engines/minimax-coding-plan-minimax-m3.json +27 -0
  28. package/dist/mcp/engines/mistral.json +44 -0
  29. package/dist/mcp/engines/ollama.json +35 -0
  30. package/dist/mcp/engines/opencode.json +55 -0
  31. package/dist/mcp/engines/openrouter.json +54 -0
  32. package/dist/mcp/engines/qwen.json +40 -0
  33. package/dist/mcp/index.js +464 -0
  34. package/dist/mcp/index.js.map +1 -0
  35. package/dist/plan-mode-PFLUPGSY.js +17 -0
  36. package/dist/plan-mode-PFLUPGSY.js.map +1 -0
  37. package/dist/{src-3NWTITZM.js → src-253BUXEF.js} +5 -3
  38. package/dist/src-253BUXEF.js.map +1 -0
  39. package/dist/{update-H3LE4ZSI.js → update-ODAAXWOD.js} +6 -6
  40. package/dist/update-ODAAXWOD.js.map +1 -0
  41. package/package.json +2 -3
  42. package/dist/chunk-3PDYVGRS.js.map +0 -1
  43. package/dist/chunk-6IF2AV4Y.js.map +0 -1
  44. package/dist/chunk-7WZ2O5WZ.js.map +0 -1
  45. package/dist/chunk-HSPQEDHX.js.map +0 -1
  46. package/dist/chunk-NBV37VMW.js.map +0 -1
  47. package/dist/chunk-PUNBDLQO.js.map +0 -1
  48. package/dist/chunk-TMNHJOKU.js.map +0 -1
  49. package/dist/chunk-XWHC6VAH.js.map +0 -1
  50. package/dist/dispatch-S3CR5HKX.js.map +0 -1
  51. package/dist/forge-GUOEJ5DJ.js.map +0 -1
  52. package/dist/plan-mode-35BONR7S.js +0 -17
  53. package/dist/plan-mode-35BONR7S.js.map +0 -1
  54. package/dist/src-3NWTITZM.js.map +0 -1
  55. package/dist/update-H3LE4ZSI.js.map +0 -1
@@ -5,7 +5,7 @@ import {
5
5
  __require,
6
6
  __toCommonJS,
7
7
  apiStreamDispatchWithHistory
8
- } from "./chunk-XWHC6VAH.js";
8
+ } from "./chunk-45YTXJWJ.js";
9
9
 
10
10
  // ../core/src/generated/signals/glicko.ts
11
11
  var glicko_exports = {};
@@ -387,6 +387,7 @@ var DEFAULT_AGON_CONFIG = {
387
387
  isolationMigrationNotified: false,
388
388
  terminalMode: "native",
389
389
  iconTheme: "roman",
390
+ narrationFold: "safe",
390
391
  autoReviewAfterForge: true,
391
392
  autoReviewAfterImpl: true,
392
393
  buddyTimeout: 420,
@@ -1108,10 +1109,61 @@ function hydrateWorktreeBuildArtifacts(repoDir, worktreePath) {
1108
1109
  console.warn(`[agon] worktree artifact hydration failed for ${worktreePath}: ${err instanceof Error ? err.message : String(err)}`);
1109
1110
  }
1110
1111
  }
1112
+ var activeWorktrees = (() => {
1113
+ const g = globalThis;
1114
+ if (!g.__agonActiveWorktrees) {
1115
+ g.__agonActiveWorktrees = /* @__PURE__ */ new Map();
1116
+ }
1117
+ return g.__agonActiveWorktrees;
1118
+ })();
1119
+ function registerExitHooks() {
1120
+ const g = globalThis;
1121
+ if (g.__agonExitHooksRegistered) return;
1122
+ g.__agonExitHooksRegistered = true;
1123
+ const cleanup = () => {
1124
+ if (activeWorktrees.size === 0) return;
1125
+ process.stderr.write(`
1126
+ [agon] Cleaning up active git worktrees...
1127
+ `);
1128
+ const repoDirs = new Set(activeWorktrees.values());
1129
+ for (const [wtPath, repoDir] of activeWorktrees.entries()) {
1130
+ try {
1131
+ execFileSync("git", ["worktree", "remove", wtPath, "--force"], { cwd: repoDir, stdio: "ignore" });
1132
+ activeWorktrees.delete(wtPath);
1133
+ } catch {
1134
+ }
1135
+ }
1136
+ for (const repoDir of repoDirs) {
1137
+ try {
1138
+ execFileSync("git", ["worktree", "prune"], { cwd: repoDir, stdio: "ignore" });
1139
+ } catch {
1140
+ }
1141
+ }
1142
+ };
1143
+ process.on("exit", () => {
1144
+ cleanup();
1145
+ });
1146
+ const handleSigInt = () => {
1147
+ cleanup();
1148
+ if (process.listenerCount("SIGINT") <= 1) {
1149
+ process.exit(130);
1150
+ }
1151
+ };
1152
+ const handleSigTerm = () => {
1153
+ cleanup();
1154
+ if (process.listenerCount("SIGTERM") <= 1) {
1155
+ process.exit(143);
1156
+ }
1157
+ };
1158
+ process.on("SIGINT", handleSigInt);
1159
+ process.on("SIGTERM", handleSigTerm);
1160
+ }
1111
1161
  function worktreeCreate(repoDir, worktreePath, sha) {
1162
+ registerExitHooks();
1112
1163
  worktreePrune(repoDir);
1113
1164
  try {
1114
1165
  git(["worktree", "add", "--detach", worktreePath, sha], repoDir);
1166
+ activeWorktrees.set(worktreePath, repoDir);
1115
1167
  linkWorktreeNodeModules(repoDir, worktreePath);
1116
1168
  hydrateWorktreeBuildArtifacts(repoDir, worktreePath);
1117
1169
  return worktreePath;
@@ -1157,6 +1209,7 @@ function worktreeRemove(repoDir, worktreePath) {
1157
1209
  for (let attempt = 0; attempt < 2; attempt++) {
1158
1210
  try {
1159
1211
  git(["worktree", "remove", worktreePath, "--force"], repoDir);
1212
+ activeWorktrees.delete(worktreePath);
1160
1213
  return;
1161
1214
  } catch (err) {
1162
1215
  lastErr = err;
@@ -1223,6 +1276,23 @@ function worktreePruneAll(repoDir, olderThanMs) {
1223
1276
  } catch {
1224
1277
  }
1225
1278
  }
1279
+ function worktreePruneOrphaned(repoDir) {
1280
+ try {
1281
+ const output = git(["worktree", "list", "--porcelain"], repoDir);
1282
+ const lines = output.split("\n");
1283
+ for (const line of lines) {
1284
+ if (line.startsWith("worktree ")) {
1285
+ const wtPath = line.slice(9).trim();
1286
+ const isAgentWt = wtPath.includes(".agon/agent-worktrees") || wtPath.includes(".agon/speculate-worktrees") || wtPath.includes(".agon/runs") || wtPath.includes(".agon/goals");
1287
+ if (isAgentWt) {
1288
+ worktreeRemoveBestEffort(repoDir, wtPath);
1289
+ }
1290
+ }
1291
+ }
1292
+ } catch (err) {
1293
+ console.warn(`[agon] worktreePruneOrphaned failed: ${err instanceof Error ? err.message : String(err)}`);
1294
+ }
1295
+ }
1226
1296
  function worktreeChangedDiff(cwd, baseSha) {
1227
1297
  try {
1228
1298
  const trackedDiff = gitRaw(["diff", baseSha, "--"], cwd);
@@ -25305,7 +25375,7 @@ ${newSummary.decisions.map((d) => ` - ${d}`).join("\n")}` : "",
25305
25375
  const tier3CompactionEnabled = process.env.AGON_DISABLE_TIER3_COMPACTION !== "1";
25306
25376
  if (tier3CompactionEnabled && afterTier2 > CONTEXT_LIMIT - COMPACTION_BUFFER && config2.engine.api) {
25307
25377
  try {
25308
- const { apiDispatch: apiDispatch2 } = await import("./dispatch-S3CR5HKX.js");
25378
+ const { apiDispatch: apiDispatch2 } = await import("./dispatch-J4RSWLXM.js");
25309
25379
  const compactionPrompt = `Summarize this conversation context into a concise briefing. Preserve: the user's goal, key discoveries, files read/modified, important decisions, and current progress. Drop: verbose tool outputs, repeated attempts, and pleasantries.
25310
25380
 
25311
25381
  CONTEXT TO SUMMARIZE:
@@ -30420,6 +30490,7 @@ export {
30420
30490
  worktreeRemove,
30421
30491
  worktreeRemoveBestEffort,
30422
30492
  worktreePruneAll,
30493
+ worktreePruneOrphaned,
30423
30494
  worktreeChangedDiff,
30424
30495
  worktreeChangedShortstat,
30425
30496
  stashSnapshot,
@@ -30796,4 +30867,4 @@ export {
30796
30867
  predictTeamRating,
30797
30868
  updateTeamElo
30798
30869
  };
30799
- //# sourceMappingURL=chunk-TMNHJOKU.js.map
30870
+ //# sourceMappingURL=chunk-BPKY4OF2.js.map