@kernlang/agon 0.1.1 → 0.1.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.
@@ -6,7 +6,7 @@ import {
6
6
  filterDefaultOrchestrationEngines,
7
7
  parseConfidence,
8
8
  runForge
9
- } from "./chunk-HVJTVOXT.js";
9
+ } from "./chunk-IA4AR2R4.js";
10
10
  import {
11
11
  RUNS_DIR,
12
12
  acquireApplyLock,
@@ -1590,4 +1590,4 @@ export {
1590
1590
  inferProjectFitnessCommand,
1591
1591
  handleForge
1592
1592
  };
1593
- //# sourceMappingURL=chunk-RSS3RL6Z.js.map
1593
+ //# sourceMappingURL=chunk-F72VMPTY.js.map
@@ -9,7 +9,7 @@ import {
9
9
  runDelegate,
10
10
  runForge,
11
11
  runTribunal
12
- } from "./chunk-HVJTVOXT.js";
12
+ } from "./chunk-IA4AR2R4.js";
13
13
  import {
14
14
  AgentSession,
15
15
  AgentTeam,
@@ -2724,4 +2724,4 @@ export {
2724
2724
  handleExitPlanMode,
2725
2725
  buildStepExecutors
2726
2726
  };
2727
- //# sourceMappingURL=chunk-LVW723TJ.js.map
2727
+ //# sourceMappingURL=chunk-GLQ5IQ5X.js.map
@@ -8434,6 +8434,13 @@ function detectNarratedToolStall(text) {
8434
8434
  const STALL_RE = /\b(?:let me (?:check|look|examine|read|search|find|see|review|explore|investigate|understand|get|grab|continue)|i (?:need|want|should|will) (?:to )?(?:check|look|examine|read|search|find|see|review|explore|investigate|understand|get|grab|continue)|now (?:let me|i'll)|continu(?:e|ing)|keep (?:reading|investigating|looking)|next[,.]?\s*(?:i|let)|before (?:i can|proceeding|implementing|deciding))\b/i;
8435
8435
  return FAKE_GATE_RE.test(tail) || READ_INTENT_RE.test(tail) || SEARCH_INTENT_RE.test(tail) || DIR_INTENT_RE.test(tail) || STALL_RE.test(tail);
8436
8436
  }
8437
+ function detectMutationIntentStall(text) {
8438
+ const body = String(text ?? "").trim();
8439
+ if (!body) return false;
8440
+ const MUTATION_INTENT_RE = /\b(?:edit|write|apply|patch|implement|insert|replace|land it|commit it|the (?:change|fix|diff|patch|edit)|make the (?:edit|change)s?|ready to (?:paste|apply))\b/i;
8441
+ const HANDBACK_RE = /\b(?:read-?only|can'?t (?:write|edit|apply|mutate|touch)|no (?:write|edit|bash) tool|(?:edit|write|bash)(?: tool)?(?: is)? (?:not enabled|disabled|not wired|not available|unavailable)|not (?:enabled|wired|reachable) in this (?:context|session|turn)|spawn (?:an? )?agent|dispatch (?:an? )?agent|paste (?:it|this|the\b)|apply (?:it|this)\b|git apply|you (?:can )?(?:run|apply|paste)|in your terminal|hand you the (?:patch|diff|commands?)|copy[- ]?paste)\b/i;
8442
+ return MUTATION_INTENT_RE.test(body) && HANDBACK_RE.test(body);
8443
+ }
8437
8444
  function eagerFailedToolNames(results) {
8438
8445
  const names = [];
8439
8446
  for (const result of results ?? []) {
@@ -9354,7 +9361,7 @@ ${cleaned}`;
9354
9361
  }
9355
9362
  }
9356
9363
  if (name === "ExitPlanMode") {
9357
- const { handleExitPlanMode } = await import("./plan-mode-KBJY2FJN.js");
9364
+ const { handleExitPlanMode } = await import("./plan-mode-DCE7VGQV.js");
9358
9365
  return "[DELEGATION_BREAK] " + handleExitPlanMode(String(args.reason ?? ""), ctx.cesar?.planDispatch ?? null, ctx);
9359
9366
  }
9360
9367
  if (name === "ProposePlan") {
@@ -9377,7 +9384,7 @@ ${cleaned}`;
9377
9384
  }
9378
9385
  }
9379
9386
  }
9380
- const { handleProposePlan } = await import("./plan-mode-KBJY2FJN.js");
9387
+ const { handleProposePlan } = await import("./plan-mode-DCE7VGQV.js");
9381
9388
  const dispatch = ctx.cesar.planDispatch;
9382
9389
  if (!dispatch) {
9383
9390
  return "[PLAN_ERROR] Internal plan display dispatch unavailable. Retry the plan request so Agon can render the approval panel.";
@@ -10859,7 +10866,7 @@ ${enrichedInput}`;
10859
10866
  });
10860
10867
  continue;
10861
10868
  }
10862
- const { handleProposePlan } = await import("./plan-mode-KBJY2FJN.js");
10869
+ const { handleProposePlan } = await import("./plan-mode-DCE7VGQV.js");
10863
10870
  const planDispatch = ctx.cesar.planDispatch ?? dispatch;
10864
10871
  if (planDispatch) {
10865
10872
  try {
@@ -10872,7 +10879,7 @@ ${enrichedInput}`;
10872
10879
  }
10873
10880
  } else if (signal.tool === "ExitPlanMode") {
10874
10881
  recordToolUse("ExitPlanMode", "mcp", JSON.stringify(signal.args ?? {}), "done");
10875
- const { handleExitPlanMode } = await import("./plan-mode-KBJY2FJN.js");
10882
+ const { handleExitPlanMode } = await import("./plan-mode-DCE7VGQV.js");
10876
10883
  const planDispatch = ctx.cesar.planDispatch ?? dispatch;
10877
10884
  try {
10878
10885
  const exitResult = handleExitPlanMode(String(signal.args?.reason ?? ""), planDispatch, ctx);
@@ -11088,7 +11095,7 @@ ${enrichedInput}`;
11088
11095
  output: "A Cesar plan is already active; nested plans are blocked. Resume or cancel the current plan before proposing another."
11089
11096
  });
11090
11097
  } else {
11091
- const { handleProposePlan } = await import("./plan-mode-KBJY2FJN.js");
11098
+ const { handleProposePlan } = await import("./plan-mode-DCE7VGQV.js");
11092
11099
  const planDispatch = ctx.cesar.planDispatch ?? dispatch;
11093
11100
  const plan = await handleProposePlan(ppArgs, planDispatch, ctx);
11094
11101
  if (ctx.setActivePlan) ctx.setActivePlan(plan);
@@ -11112,7 +11119,7 @@ ${enrichedInput}`;
11112
11119
  const epArgs = ctx.cesar._exitPlanModeArgs;
11113
11120
  delete ctx.cesar._exitPlanModeArgs;
11114
11121
  try {
11115
- const { handleExitPlanMode } = await import("./plan-mode-KBJY2FJN.js");
11122
+ const { handleExitPlanMode } = await import("./plan-mode-DCE7VGQV.js");
11116
11123
  const planDispatch = ctx.cesar.planDispatch ?? dispatch;
11117
11124
  const exitResult = handleExitPlanMode(String(epArgs?.reason ?? ""), planDispatch, ctx);
11118
11125
  dispatch({ type: "tool-call", engineId: cesarEngineId, tool: "ExitPlanMode", input: JSON.stringify(epArgs ?? {}), status: "done", output: exitResult });
@@ -11196,11 +11203,18 @@ ${qnResult.challengeText}` : ""
11196
11203
  }
11197
11204
  }
11198
11205
  const investigationResponse = response;
11206
+ let mutationStallForced = false;
11207
+ if (!mutationDeferred && !inPlanMode && !ctx.cesar.pendingDelegation && (hadToolActivity || ranToolLoop) && session.alive && !abort.signal.aborted && detectMutationIntentStall(response)) {
11208
+ mutationDeferred = true;
11209
+ mutationStallForced = true;
11210
+ dispatch({ type: "warning", message: "Cesar described a write but called no tool \u2014 unlocking execution and pushing it to apply directly." });
11211
+ }
11199
11212
  if (mutationDeferred && toolRegistry && session.alive && !abort.signal.aborted) {
11200
11213
  toolCtx.readOnlyMode = false;
11201
11214
  dispatch({ type: "spinner-start", message: "Cesar executing\u2026", color });
11202
11215
  let execResponse = "";
11203
- const execGen = session.send({ message: "Investigation complete. You may now use write, edit, and bash tools to execute your plan. Proceed.", signal: abort.signal });
11216
+ const _execNudge = mutationStallForced ? "You HAVE Edit, Write, and Bash tools and you are NOT read-only. The investigation gate only DEFERS the first mutating call; calling Edit/Write/Bash is what unlocks execution \u2014 and it is unlocked now. Apply the change directly this turn with Edit/Write/Bash. Do NOT say you lack write tools, do NOT delegate to an Agent to do the writing, and do NOT ask the user to paste or apply it themselves." : "Investigation complete. You may now use write, edit, and bash tools to execute your plan. Proceed.";
11217
+ const execGen = session.send({ message: _execNudge, signal: abort.signal });
11204
11218
  for await (const chunk of execGen) {
11205
11219
  if (chunk.type === "text") execResponse += chunk.content;
11206
11220
  if (chunk.type === "done" || chunk.type === "error") break;
@@ -11874,4 +11888,4 @@ export {
11874
11888
  ensureCesarSession,
11875
11889
  handleCesarBrain
11876
11890
  };
11877
- //# sourceMappingURL=chunk-HVJTVOXT.js.map
11891
+ //# sourceMappingURL=chunk-IA4AR2R4.js.map