omnius 1.0.461 → 1.0.463
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.
- package/dist/index.js +262 -77
- package/npm-shrinkwrap.json +14 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -563781,6 +563781,15 @@ function isSuccessfulVerificationEvidence(entry) {
|
|
|
563781
563781
|
function isFailedVerificationEvidence(entry) {
|
|
563782
563782
|
return entry.role === "verification" && entry.success === false;
|
|
563783
563783
|
}
|
|
563784
|
+
function isSuccessfulPostMutationObservation(entry) {
|
|
563785
|
+
if (entry.success !== true)
|
|
563786
|
+
return false;
|
|
563787
|
+
if (entry.role === "blocker")
|
|
563788
|
+
return false;
|
|
563789
|
+
if (isMutationEvidence(entry))
|
|
563790
|
+
return false;
|
|
563791
|
+
return entry.kind === "tool_result" || entry.kind === "runtime_observation" || entry.kind === "delivery_result";
|
|
563792
|
+
}
|
|
563784
563793
|
function verificationFamily(entry) {
|
|
563785
563794
|
if (entry.role !== "verification")
|
|
563786
563795
|
return null;
|
|
@@ -563807,6 +563816,7 @@ function finalizeCompletionLedgerTruth(ledger) {
|
|
|
563807
563816
|
let unresolved = [...ledger.unresolved];
|
|
563808
563817
|
let lastVerificationInvalidatingMutation = -1;
|
|
563809
563818
|
let lastVerification = -1;
|
|
563819
|
+
let lastCriticApprovedVerification = -1;
|
|
563810
563820
|
const lastSuccessfulVerificationByFamily = /* @__PURE__ */ new Map();
|
|
563811
563821
|
ledger.evidence.forEach((entry, index) => {
|
|
563812
563822
|
if (isVerificationInvalidatingMutation(entry))
|
|
@@ -563818,6 +563828,21 @@ function finalizeCompletionLedgerTruth(ledger) {
|
|
|
563818
563828
|
lastSuccessfulVerificationByFamily.set(family, index);
|
|
563819
563829
|
}
|
|
563820
563830
|
});
|
|
563831
|
+
for (const critique2 of ledger.critiques) {
|
|
563832
|
+
if (critique2.verdict !== "approve")
|
|
563833
|
+
continue;
|
|
563834
|
+
if (lastVerificationInvalidatingMutation >= 0 && critique2.evidenceSequence <= lastVerificationInvalidatingMutation) {
|
|
563835
|
+
continue;
|
|
563836
|
+
}
|
|
563837
|
+
const reviewedEvidence = ledger.evidence.slice(Math.max(0, lastVerificationInvalidatingMutation + 1), Math.max(0, critique2.evidenceSequence));
|
|
563838
|
+
if (reviewedEvidence.some(isSuccessfulPostMutationObservation)) {
|
|
563839
|
+
lastCriticApprovedVerification = Math.max(lastCriticApprovedVerification, critique2.evidenceSequence - 1);
|
|
563840
|
+
}
|
|
563841
|
+
}
|
|
563842
|
+
const effectiveLastVerification = Math.max(lastVerification, lastCriticApprovedVerification);
|
|
563843
|
+
if (effectiveLastVerification >= 0 && effectiveLastVerification >= lastVerificationInvalidatingMutation) {
|
|
563844
|
+
unresolved = unresolved.filter((item) => item.source !== "verification_missing" && item.source !== "verification_freshness");
|
|
563845
|
+
}
|
|
563821
563846
|
ledger.evidence.forEach((entry, index) => {
|
|
563822
563847
|
if (isFailedVerificationEvidence(entry)) {
|
|
563823
563848
|
const family = verificationFamily(entry);
|
|
@@ -563830,12 +563855,13 @@ function finalizeCompletionLedgerTruth(ledger) {
|
|
|
563830
563855
|
unresolved = appendUnresolved(unresolved, `Stale edit failure remains unresolved: ${entry.summary}`, entry.id);
|
|
563831
563856
|
}
|
|
563832
563857
|
});
|
|
563833
|
-
if (lastVerificationInvalidatingMutation >= 0 &&
|
|
563858
|
+
if (lastVerificationInvalidatingMutation >= 0 && effectiveLastVerification < 0) {
|
|
563834
563859
|
unresolved = appendUnresolved(unresolved, "File changes occurred without any successful verification evidence.", "verification_missing");
|
|
563835
|
-
} else if (
|
|
563860
|
+
} else if (effectiveLastVerification >= 0 && lastVerificationInvalidatingMutation > effectiveLastVerification) {
|
|
563836
563861
|
unresolved = appendUnresolved(unresolved, "File changes occurred after the last successful verification; final verification is stale.", "verification_freshness");
|
|
563837
563862
|
}
|
|
563838
|
-
const
|
|
563863
|
+
const latestCritique = ledger.critiques.at(-1);
|
|
563864
|
+
const status = ledger.status === "blocked" || ledger.status === "request_changes" ? ledger.status : unresolved.length > 0 ? "incomplete_verification" : latestCritique?.verdict === "approve" ? "approved" : ledger.status === "incomplete_verification" ? "open" : ledger.status;
|
|
563839
563865
|
return {
|
|
563840
563866
|
...ledger,
|
|
563841
563867
|
unresolved,
|
|
@@ -567605,7 +567631,15 @@ function ago(ms) {
|
|
|
567605
567631
|
const h = Math.floor(m2 / 60);
|
|
567606
567632
|
return `${h}h ago`;
|
|
567607
567633
|
}
|
|
567608
|
-
function computeNextActionHint(reconciled) {
|
|
567634
|
+
function computeNextActionHint(reconciled, recentFailures, focusDirective) {
|
|
567635
|
+
if (focusDirective?.requiredNextAction) {
|
|
567636
|
+
const reason = focusDirective.reason ? ` Reason: ${focusDirective.reason.slice(0, 180)}.` : "";
|
|
567637
|
+
return `Active recovery directive requires ${focusDirective.requiredNextAction}.${reason} Follow that before completion or unrelated work.`;
|
|
567638
|
+
}
|
|
567639
|
+
if (recentFailures.length > 0) {
|
|
567640
|
+
const first2 = recentFailures[0];
|
|
567641
|
+
return `Resolve or explicitly account for unresolved failure "${first2.stem}" (${first2.attempts} attempt${first2.attempts === 1 ? "" : "s"}). Do not infer completion from plan state while failures remain.`;
|
|
567642
|
+
}
|
|
567609
567643
|
const inProgress = reconciled.find((t2) => t2.reconciled === "in_progress");
|
|
567610
567644
|
if (inProgress)
|
|
567611
567645
|
return `Continue your in-progress item: "${inProgress.content.slice(0, 100)}".`;
|
|
@@ -567635,7 +567669,10 @@ function computeNextActionHint(reconciled) {
|
|
|
567635
567669
|
const first2 = completedUnverified[0];
|
|
567636
567670
|
return `A completed todo has a verifyCommand that hasn't run during this snapshot: ${first2.rationale}`;
|
|
567637
567671
|
}
|
|
567638
|
-
|
|
567672
|
+
if (reconciled.length === 0) {
|
|
567673
|
+
return `No declared plan items are available. Continue from the active goal and evidence; report completion only with direct verification.`;
|
|
567674
|
+
}
|
|
567675
|
+
return `Declared plan items have no visible gaps. Continue from the active goal and evidence; report completion only with direct verification.`;
|
|
567639
567676
|
}
|
|
567640
567677
|
function regenerate(opts) {
|
|
567641
567678
|
const startMs = Date.now();
|
|
@@ -567730,7 +567767,18 @@ function regenerate(opts) {
|
|
|
567730
567767
|
}
|
|
567731
567768
|
}
|
|
567732
567769
|
lines.push(``);
|
|
567733
|
-
|
|
567770
|
+
if (opts.focusDirective?.requiredNextAction) {
|
|
567771
|
+
lines.push(`ACTIVE RECOVERY DIRECTIVE:`);
|
|
567772
|
+
lines.push(` required_next_action=${opts.focusDirective.requiredNextAction}`);
|
|
567773
|
+
if (opts.focusDirective.state) {
|
|
567774
|
+
lines.push(` state=${opts.focusDirective.state}`);
|
|
567775
|
+
}
|
|
567776
|
+
if (opts.focusDirective.reason) {
|
|
567777
|
+
lines.push(` reason=${opts.focusDirective.reason.slice(0, 240)}`);
|
|
567778
|
+
}
|
|
567779
|
+
lines.push(``);
|
|
567780
|
+
}
|
|
567781
|
+
const nextActionHint = computeNextActionHint(reconciled, opts.recentFailures, opts.focusDirective);
|
|
567734
567782
|
lines.push(`SUGGESTED NEXT STEP (derived from gap analysis, not authoritative):`);
|
|
567735
567783
|
lines.push(` ${nextActionHint}`);
|
|
567736
567784
|
lines.push(``);
|
|
@@ -575131,21 +575179,13 @@ function violatesDirective(directive, input) {
|
|
|
575131
575179
|
}
|
|
575132
575180
|
if (input.toolName === "ask_user")
|
|
575133
575181
|
return false;
|
|
575182
|
+
const family = actionFamily(input.toolName, input.args);
|
|
575183
|
+
if (directive.requiredNextAction !== "update_todos" && directiveExplicitlyForbidsCall(directive, input, family)) {
|
|
575184
|
+
return true;
|
|
575185
|
+
}
|
|
575134
575186
|
if (directive.requiredNextAction === "read_authoritative_target" && input.usesAuthoritativeTargetEvidence && isEditTool(input.toolName)) {
|
|
575135
575187
|
return false;
|
|
575136
575188
|
}
|
|
575137
|
-
const family = actionFamily(input.toolName, input.args);
|
|
575138
|
-
if (directive.requiredNextAction !== "update_todos") {
|
|
575139
|
-
if (directive.forbiddenActionFamilies.includes(family))
|
|
575140
|
-
return true;
|
|
575141
|
-
if (directive.forbiddenActionFamilies.includes(input.toolName)) {
|
|
575142
|
-
if (input.toolName === "shell" && input.isReadLike)
|
|
575143
|
-
return false;
|
|
575144
|
-
if (input.toolName === "shell" && input.shellLikelyMutatesFilesystem)
|
|
575145
|
-
return false;
|
|
575146
|
-
return true;
|
|
575147
|
-
}
|
|
575148
|
-
}
|
|
575149
575189
|
switch (directive.requiredNextAction) {
|
|
575150
575190
|
case "update_todos":
|
|
575151
575191
|
if (input.toolName === "shell")
|
|
@@ -575178,6 +575218,17 @@ function violatesDirective(directive, input) {
|
|
|
575178
575218
|
return false;
|
|
575179
575219
|
}
|
|
575180
575220
|
}
|
|
575221
|
+
function directiveExplicitlyForbidsCall(directive, input, family) {
|
|
575222
|
+
if (directive.forbiddenActionFamilies.includes(family))
|
|
575223
|
+
return true;
|
|
575224
|
+
if (!directive.forbiddenActionFamilies.includes(input.toolName))
|
|
575225
|
+
return false;
|
|
575226
|
+
if (input.toolName === "shell" && input.isReadLike)
|
|
575227
|
+
return false;
|
|
575228
|
+
if (input.toolName === "shell" && input.shellLikelyMutatesFilesystem)
|
|
575229
|
+
return false;
|
|
575230
|
+
return true;
|
|
575231
|
+
}
|
|
575181
575232
|
function forbiddenCachedEvidenceFamilies(input, family) {
|
|
575182
575233
|
return [family];
|
|
575183
575234
|
}
|
|
@@ -579170,6 +579221,15 @@ var init_agenticRunner = __esm({
|
|
|
579170
579221
|
_workboardDir() {
|
|
579171
579222
|
return this.options.workboardDir || this._workingDirectory || process.cwd();
|
|
579172
579223
|
}
|
|
579224
|
+
_todoWriteAvailable() {
|
|
579225
|
+
return this.tools.has("todo_write");
|
|
579226
|
+
}
|
|
579227
|
+
_availablePreferredTools(candidates) {
|
|
579228
|
+
const available = candidates.filter((name10) => this.tools.has(name10));
|
|
579229
|
+
if (available.length > 0)
|
|
579230
|
+
return available;
|
|
579231
|
+
return this.tools.has("task_complete") ? ["task_complete"] : [];
|
|
579232
|
+
}
|
|
579173
579233
|
getOrCreateWorkboard() {
|
|
579174
579234
|
const goal = this._taskState.originalGoal || this._taskState.goal || "";
|
|
579175
579235
|
if (this._workboard) {
|
|
@@ -579425,7 +579485,7 @@ ${parts.join("\n")}
|
|
|
579425
579485
|
cardId: integration.id,
|
|
579426
579486
|
title: integration.title,
|
|
579427
579487
|
reason: "implementation evidence exists; exercise the changed runtime path before more discovery",
|
|
579428
|
-
preferredTools: ["shell"]
|
|
579488
|
+
preferredTools: this._availablePreferredTools(["shell"])
|
|
579429
579489
|
};
|
|
579430
579490
|
}
|
|
579431
579491
|
if (hasVerificationEvidence && verification) {
|
|
@@ -579433,7 +579493,10 @@ ${parts.join("\n")}
|
|
|
579433
579493
|
cardId: verification.id,
|
|
579434
579494
|
title: verification.title,
|
|
579435
579495
|
reason: "verification evidence exists; reconcile outcome, todos, and blockers",
|
|
579436
|
-
preferredTools: [
|
|
579496
|
+
preferredTools: this._availablePreferredTools([
|
|
579497
|
+
"todo_write",
|
|
579498
|
+
"task_complete"
|
|
579499
|
+
])
|
|
579437
579500
|
};
|
|
579438
579501
|
}
|
|
579439
579502
|
if (discoveryEvidence > 0 && !hasImplementationEvidence && implementation2) {
|
|
@@ -579441,7 +579504,12 @@ ${parts.join("\n")}
|
|
|
579441
579504
|
cardId: implementation2.id,
|
|
579442
579505
|
title: implementation2.title,
|
|
579443
579506
|
reason: "discovery evidence is already present; land the smallest concrete repair",
|
|
579444
|
-
preferredTools: [
|
|
579507
|
+
preferredTools: this._availablePreferredTools([
|
|
579508
|
+
"file_patch",
|
|
579509
|
+
"batch_edit",
|
|
579510
|
+
"file_edit",
|
|
579511
|
+
"file_write"
|
|
579512
|
+
])
|
|
579445
579513
|
};
|
|
579446
579514
|
}
|
|
579447
579515
|
const active = snapshot.cards.find((card) => card.status === "in_progress") ?? snapshot.cards.find((card) => card.status === "needs_changes") ?? snapshot.cards.find((card) => card.status === "open") ?? discovery;
|
|
@@ -579451,13 +579519,24 @@ ${parts.join("\n")}
|
|
|
579451
579519
|
cardId: active.id,
|
|
579452
579520
|
title: active.title,
|
|
579453
579521
|
reason: active.id === "discover-current-state" ? "no authoritative target evidence is recorded yet" : "workboard card is the next unresolved card",
|
|
579454
|
-
preferredTools: active.id === "discover-current-state" ? [
|
|
579522
|
+
preferredTools: active.id === "discover-current-state" ? this._availablePreferredTools([
|
|
579523
|
+
"file_read",
|
|
579524
|
+
"grep_search",
|
|
579525
|
+
"list_directory",
|
|
579526
|
+
"shell"
|
|
579527
|
+
]) : this._availablePreferredTools([
|
|
579528
|
+
"file_patch",
|
|
579529
|
+
"batch_edit",
|
|
579530
|
+
"file_edit",
|
|
579531
|
+
"file_write",
|
|
579532
|
+
"shell"
|
|
579533
|
+
])
|
|
579455
579534
|
};
|
|
579456
579535
|
}
|
|
579457
579536
|
_focusToolsForRequiredAction(action) {
|
|
579458
579537
|
switch (action) {
|
|
579459
579538
|
case "update_todos":
|
|
579460
|
-
return "todo_write with a changed plan/status, or a real file edit if that is the active work";
|
|
579539
|
+
return this._todoWriteAvailable() ? "todo_write with a changed plan/status, or a real file edit if that is the active work" : "todo_write is unavailable in this tool surface; continue with the intended substantive action, or task_complete with evidence if done";
|
|
579461
579540
|
case "read_authoritative_target":
|
|
579462
579541
|
return "use cached evidence or one authoritative file_read/read-only shell, then act";
|
|
579463
579542
|
case "use_cached_evidence":
|
|
@@ -579511,7 +579590,9 @@ ${parts.join("\n")}
|
|
|
579511
579590
|
const integration = byId.get("integrate-and-run");
|
|
579512
579591
|
const verification = byId.get("verify-observed-outcome");
|
|
579513
579592
|
lines.push(`workboard_current_card=${action.cardId} (${action.title})`);
|
|
579514
|
-
|
|
579593
|
+
if (action.preferredTools.length > 0) {
|
|
579594
|
+
lines.push(`workboard_preferred_tools=${action.preferredTools.join(", ")}`);
|
|
579595
|
+
}
|
|
579515
579596
|
lines.push(`workboard_reason=${action.reason}`);
|
|
579516
579597
|
lines.push(`workboard_evidence_counts=discover:${this._workboardEvidenceCount(discovery)} implement:${this._workboardEvidenceCount(implementation2)} integrate:${this._workboardEvidenceCount(integration)} verify:${this._workboardEvidenceCount(verification)}`);
|
|
579517
579598
|
if (this._workboardHasEditEvidence(implementation2)) {
|
|
@@ -579537,7 +579618,7 @@ ${parts.join("\n")}
|
|
|
579537
579618
|
}
|
|
579538
579619
|
if (lines.length === 2)
|
|
579539
579620
|
return null;
|
|
579540
|
-
lines.push("not_progress=repeat unchanged todo_write; repeat broad discovery already represented in this frame; keep discovery active after a real mutation");
|
|
579621
|
+
lines.push(this._todoWriteAvailable() ? "not_progress=repeat unchanged todo_write; repeat broad discovery already represented in this frame; keep discovery active after a real mutation" : "not_progress=repeat broad discovery already represented in this frame; keep discovery active after a real mutation");
|
|
579541
579622
|
return lines.join("\n");
|
|
579542
579623
|
}
|
|
579543
579624
|
_workboardTargetCardId(snapshot, toolName, result, meta = {}) {
|
|
@@ -580266,10 +580347,23 @@ ${parts.join("\n")}
|
|
|
580266
580347
|
const pressureCue = pressureCheck(task);
|
|
580267
580348
|
const rawPrompt = getSystemPromptForTier(this.options.modelTier);
|
|
580268
580349
|
const basePrompt = rawPrompt + pressureCue;
|
|
580350
|
+
const todoBatchGuidance = this._todoWriteAvailable() ? " Use todo_write between batches to mark progress." : "";
|
|
580269
580351
|
const _BATCH_GUIDANCE = {
|
|
580270
|
-
small:
|
|
580271
|
-
|
|
580272
|
-
|
|
580352
|
+
small: `
|
|
580353
|
+
|
|
580354
|
+
## Response batching
|
|
580355
|
+
|
|
580356
|
+
Emit AT MOST 2 tool calls per response. After observing their results, plan the next 2 in your following response. Smaller batches let the orchestrator deliver cache/failure/progress signals to you between actions. Tool calls beyond the cap are dropped.${todoBatchGuidance}`,
|
|
580357
|
+
medium: `
|
|
580358
|
+
|
|
580359
|
+
## Response batching
|
|
580360
|
+
|
|
580361
|
+
Emit AT MOST 4 tool calls per response. After observing their results, plan the next batch in your following response. Smaller batches let the orchestrator deliver cache/failure/progress signals to you between actions. Tool calls beyond the cap are dropped.${todoBatchGuidance}`,
|
|
580362
|
+
large: `
|
|
580363
|
+
|
|
580364
|
+
## Response batching
|
|
580365
|
+
|
|
580366
|
+
Emit AT MOST 6 tool calls per response. Smaller batches receive better feedback (cache/failure/progress signals between actions). Tool calls beyond the cap are dropped.${todoBatchGuidance}`
|
|
580273
580367
|
};
|
|
580274
580368
|
const batchGuidance = _BATCH_GUIDANCE[this.options.modelTier ?? "large"] ?? _BATCH_GUIDANCE.large;
|
|
580275
580369
|
const shellGuidance = "\n\n## Shell command patterns\n\nWhen investigating a build/test/install failure, RUN THE COMMAND WITHOUT TRUNCATION FIRST to see the full error.\nAvoid `| tail -N` / `| head -N` / `| sed -n '1,Np'` on commands you don't yet trust — they drop the part of the output where errors usually appear.\nPipefail is on by default in this orchestrator: a pipeline's exit code reflects the FIRST failing stage, not just the last. So `<cmd> | tail -80` returns non-zero if `<cmd>` failed.\nWhen you DO want to limit context (after diagnosis), prefer `<cmd> 2>&1 | tail -300` (or larger) so you keep enough output to see the actual error block.\nIf your command exited 0 but produced suspiciously short output (~< 800 chars), the orchestrator will inject a [HINT — pipe-to-truncator detected] block telling you to re-run without truncation.";
|
|
@@ -581506,6 +581600,8 @@ ${result.output ?? ""}`;
|
|
|
581506
581600
|
getOpenTodoItems() {
|
|
581507
581601
|
if (this.options.disableTodoCompletionGuard)
|
|
581508
581602
|
return [];
|
|
581603
|
+
if (!this._todoWriteAvailable())
|
|
581604
|
+
return [];
|
|
581509
581605
|
const todos = this.readSessionTodos();
|
|
581510
581606
|
if (!todos || todos.length === 0)
|
|
581511
581607
|
return [];
|
|
@@ -582496,6 +582592,8 @@ ${_checks}`
|
|
|
582496
582592
|
* Mutates `_lastTodoReminderTurn` when a reminder is produced.
|
|
582497
582593
|
*/
|
|
582498
582594
|
getTodoReminderContent(currentTurn) {
|
|
582595
|
+
if (!this._todoWriteAvailable())
|
|
582596
|
+
return null;
|
|
582499
582597
|
const todos = this.readSessionTodos();
|
|
582500
582598
|
const result = computeTodoReminder({
|
|
582501
582599
|
currentTurn,
|
|
@@ -582856,6 +582954,8 @@ ${contentPreview}
|
|
|
582856
582954
|
* Recommends marking progress before further work. Returns null otherwise.
|
|
582857
582955
|
*/
|
|
582858
582956
|
_renderProgressNudgeBlock(turn) {
|
|
582957
|
+
if (!this._todoWriteAvailable())
|
|
582958
|
+
return null;
|
|
582859
582959
|
const n2 = this._writesSinceLastTodoWrite;
|
|
582860
582960
|
if (n2 < 4)
|
|
582861
582961
|
return null;
|
|
@@ -583469,11 +583569,14 @@ ${contentPreview}
|
|
|
583469
583569
|
].join("\n");
|
|
583470
583570
|
}
|
|
583471
583571
|
if (latest.tool === "todo_write") {
|
|
583572
|
+
const raw2 = `${latest.error || ""}
|
|
583573
|
+
${latest.output || ""}`;
|
|
583574
|
+
const unavailable = /Unknown tool/i.test(raw2);
|
|
583472
583575
|
return [
|
|
583473
583576
|
`[PLANNING TOOL RECOVERY]`,
|
|
583474
583577
|
`Last failing tool: todo_write (turn ${latest.turn})`,
|
|
583475
|
-
`A checklist write failure is bookkeeping/argument transport, not evidence that the target codebase is broken.`,
|
|
583476
|
-
`Repair the todo_write payload if you still need the visible plan, or continue with the intended first substantive task using the plan content you already attempted to record.`,
|
|
583578
|
+
unavailable ? `todo_write is not registered in this tool surface. Do not retry it.` : `A checklist write failure is bookkeeping/argument transport, not evidence that the target codebase is broken.`,
|
|
583579
|
+
unavailable ? `Use the attempted checklist only as private state; continue with available substantive tools or task_complete with evidence.` : `Repair the todo_write payload if you still need the visible plan, or continue with the intended first substantive task using the plan content you already attempted to record.`,
|
|
583477
583580
|
`Do not inspect or edit project files solely because todo_write rejected its arguments.`
|
|
583478
583581
|
].join("\n");
|
|
583479
583582
|
}
|
|
@@ -583571,7 +583674,7 @@ ${latest.output || ""}`.trim();
|
|
|
583571
583674
|
lines.push(`... +${ordered.length - visible.length} more todo node(s)`);
|
|
583572
583675
|
}
|
|
583573
583676
|
lines.push("decomposition_contract=Use stable ids plus parentId for subtasks. If the active item has multiple remaining actions, rewrite it as a parent with concrete child leaf todos; work leaf-first and do not complete a parent before all children are complete with evidence.");
|
|
583574
|
-
lines.push(`(turn ${turn} — call todo_write ONLY to update state, never to re-read this plan)`);
|
|
583677
|
+
lines.push(this._todoWriteAvailable() ? `(turn ${turn} — call todo_write ONLY to update state, never to re-read this plan)` : `(turn ${turn} — todo_write is unavailable in this tool surface; use this plan as read-only state)`);
|
|
583575
583678
|
return lines.join("\n");
|
|
583576
583679
|
} catch {
|
|
583577
583680
|
return null;
|
|
@@ -583825,12 +583928,13 @@ ${sections.join("\n")}` : sections.join("\n");
|
|
|
583825
583928
|
*/
|
|
583826
583929
|
_buildRepeatGateBlock(toolName, args, hits) {
|
|
583827
583930
|
const argPreview = JSON.stringify(args ?? {}).slice(0, 200);
|
|
583931
|
+
const progressStep = this._todoWriteAvailable() ? ` 1. Call todo_write — decompose the remaining work into concrete, verifiable steps, mark the current step in_progress, and mark anything already done as completed.` : ` 1. Re-anchor on the active evidence and name the concrete next action; do not call unavailable planning tools.`;
|
|
583828
583932
|
return [
|
|
583829
583933
|
`[REPEAT GATE] Exact repeat #${hits} of ${toolName}(${argPreview}).`,
|
|
583830
583934
|
`You ALREADY have this result — re-reading identical arguments cannot produce new information, so this call was NOT executed.`,
|
|
583831
583935
|
``,
|
|
583832
583936
|
`You are looping because progress tracking has drifted. Before any further redundant calls you MUST:`,
|
|
583833
|
-
|
|
583937
|
+
progressStep,
|
|
583834
583938
|
` 2. Then take a CONCRETE action on the evidence you already have: edit/write the implicated file, run a verification command, or call task_complete with evidence.`,
|
|
583835
583939
|
``,
|
|
583836
583940
|
`Do NOT repeat this exact call. If you believe state changed, perform the concrete change first, then retry with distinct evidence.`
|
|
@@ -583847,7 +583951,7 @@ ${sections.join("\n")}` : sections.join("\n");
|
|
|
583847
583951
|
"This call was not executed again, and the cached payload was not re-emitted because repeating it bloats the model context.",
|
|
583848
583952
|
summary,
|
|
583849
583953
|
"",
|
|
583850
|
-
"Required next action: use the active evidence frame/tool cache and take a concrete next step: edit/write, run verification, update todos with changed state, or task_complete with evidence.",
|
|
583954
|
+
this._todoWriteAvailable() ? "Required next action: use the active evidence frame/tool cache and take a concrete next step: edit/write, run verification, update todos with changed state, or task_complete with evidence." : "Required next action: use the active evidence frame/tool cache and take a concrete next step: edit/write, run verification, or task_complete with evidence.",
|
|
583851
583955
|
"If you need different information, use a distinct offset/limit/query. For broad multi-file discovery, use file_explore, grep_search, fanout_explore, or full_sub_agent instead of repeating this call."
|
|
583852
583956
|
].join("\n");
|
|
583853
583957
|
}
|
|
@@ -585221,7 +585325,10 @@ Rewrite it now for ${ctx3.model}.`;
|
|
|
585221
585325
|
path: ["file", "image", "media", "filepath", "file_path", "filename"],
|
|
585222
585326
|
image: ["path", "file", "media", "filepath", "file_path", "filename"],
|
|
585223
585327
|
command: ["cmd", "shell_command"],
|
|
585224
|
-
query: ["prompt", "task", "message", "input", "text"]
|
|
585328
|
+
query: ["prompt", "task", "message", "input", "text"],
|
|
585329
|
+
start_line: ["line", "lineNumber", "line_number", "startLine"],
|
|
585330
|
+
end_line: ["endLine", "end_line", "lineEnd", "line_end", "end"],
|
|
585331
|
+
new_content: ["content", "newContent", "new_content"]
|
|
585225
585332
|
};
|
|
585226
585333
|
for (const required of missingRequired) {
|
|
585227
585334
|
for (const alias of aliasMap[required] ?? []) {
|
|
@@ -586715,6 +586822,7 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
586715
586822
|
preview: (entry.wentWrong || "").slice(0, 200),
|
|
586716
586823
|
distinctErrors: entry.errorSignatures?.size
|
|
586717
586824
|
})).sort((a2, b) => b.attempts - a2.attempts).slice(0, 5);
|
|
586825
|
+
const _wsFocusDirective = this._focusSupervisor?.snapshot().directive ?? null;
|
|
586718
586826
|
const _ws = regenerate({
|
|
586719
586827
|
workingDir: _wsWorkingDir,
|
|
586720
586828
|
goal: this._taskState.originalGoal || this._taskState.goal || "",
|
|
@@ -586722,6 +586830,11 @@ TASK: ${scrubbedTask}` : scrubbedTask;
|
|
|
586722
586830
|
triggerReason: _wsTrigger,
|
|
586723
586831
|
todos: _wsTodos,
|
|
586724
586832
|
recentFailures: _wsFailures,
|
|
586833
|
+
focusDirective: _wsFocusDirective ? {
|
|
586834
|
+
requiredNextAction: _wsFocusDirective.requiredNextAction,
|
|
586835
|
+
reason: _wsFocusDirective.reason,
|
|
586836
|
+
state: _wsFocusDirective.state
|
|
586837
|
+
} : null,
|
|
586725
586838
|
maxFiles: WORLD_STATE_MAX_FILES,
|
|
586726
586839
|
lastBuildSuccess: this._lastBuildSuccessTurn >= 0 ? {
|
|
586727
586840
|
command: this._lastBuildSuccessCommand,
|
|
@@ -587102,6 +587215,25 @@ If this matches your current shape, try it before continuing.`
|
|
|
587102
587215
|
if (_m)
|
|
587103
587216
|
_staleSamples.push(` - ${c9.name}: ${_m[0]}`);
|
|
587104
587217
|
}
|
|
587218
|
+
const _reg44FocusDirective = this._focusDirectiveSuppressesEditPressure();
|
|
587219
|
+
const _reg44ChoiceLines = _reg44FocusDirective ? [
|
|
587220
|
+
`A focus recovery directive is active and overrides the generic stuck escape options.`,
|
|
587221
|
+
`Required next action: ${_reg44FocusDirective.requiredNextAction}.`,
|
|
587222
|
+
`Reason: ${_reg44FocusDirective.reason}.`,
|
|
587223
|
+
`Do not choose a generic produce/complete/debate escape until this recovery directive is satisfied or reported impossible with evidence.`
|
|
587224
|
+
] : [
|
|
587225
|
+
`Pick ONE of these for your next response:`,
|
|
587226
|
+
``,
|
|
587227
|
+
` (a) PRODUCE: emit a file_write / file_edit / file_patch that creates or changes project content. Even a partial draft of the next planned file is progress. Use shell only for commands/tests/system operations, not as a workaround for failed edit-tool encoding.`,
|
|
587228
|
+
``,
|
|
587229
|
+
` (b) ERROR-INFORMED LOCAL TRIAGE: anchor on the freshest local failure, identify the implicated file/path/symbol/command, then make one targeted local move instead of broad exploration.`,
|
|
587230
|
+
``,
|
|
587231
|
+
this._renderLocalFailureNudge(turn),
|
|
587232
|
+
``,
|
|
587233
|
+
` (c) DEBATE: if you've tried 3+ approaches and they all hit the same wall, invoke \`debate\` with the failed task as the prompt — get a second opinion.`,
|
|
587234
|
+
``,
|
|
587235
|
+
` (d) DECLARE BLOCKED: if you genuinely cannot make progress (missing dependency, ambiguous spec, external service down), call \`task_complete\` with a summary that NAMES THE BLOCKER explicitly. Don't keep looping.`
|
|
587236
|
+
];
|
|
587105
587237
|
messages2.push({
|
|
587106
587238
|
role: "system",
|
|
587107
587239
|
content: [
|
|
@@ -587115,17 +587247,7 @@ If this matches your current shape, try it before continuing.`
|
|
|
587115
587247
|
``,
|
|
587116
587248
|
`You are consuming turns without producing new state. Every shape of "agent stuck" — read-heavy without writes, repeated cache hits, blocked-shell loops, no-op todo updates — looks like this signal. The exact tool names don't matter; the ratio does.`,
|
|
587117
587249
|
``,
|
|
587118
|
-
|
|
587119
|
-
``,
|
|
587120
|
-
` (a) PRODUCE: emit a file_write / file_edit / file_patch that creates or changes project content. Even a partial draft of the next planned file is progress. Use shell only for commands/tests/system operations, not as a workaround for failed edit-tool encoding.`,
|
|
587121
|
-
``,
|
|
587122
|
-
` (b) ERROR-INFORMED LOCAL TRIAGE: anchor on the freshest local failure, identify the implicated file/path/symbol/command, then make one targeted local move instead of broad exploration.`,
|
|
587123
|
-
``,
|
|
587124
|
-
this._renderLocalFailureNudge(turn),
|
|
587125
|
-
``,
|
|
587126
|
-
` (c) DEBATE: if you've tried 3+ approaches and they all hit the same wall, invoke \`debate\` with the failed task as the prompt — get a second opinion.`,
|
|
587127
|
-
``,
|
|
587128
|
-
` (d) DECLARE BLOCKED: if you genuinely cannot make progress (missing dependency, ambiguous spec, external service down), call \`task_complete\` with a summary that NAMES THE BLOCKER explicitly. Don't keep looping.`,
|
|
587250
|
+
..._reg44ChoiceLines,
|
|
587129
587251
|
``,
|
|
587130
587252
|
`Recent failures (real or synthetic):`,
|
|
587131
587253
|
_failureBlocks,
|
|
@@ -587280,6 +587402,27 @@ ${_staleSamples.join("\n")}` : ``,
|
|
|
587280
587402
|
});
|
|
587281
587403
|
if (_wtWorstCount >= _wtThreshold && !_wtHadSuccessfulVerify) {
|
|
587282
587404
|
this._writeThrashCooldownUntilTurn = turn + 8;
|
|
587405
|
+
const _reg50FocusDirective = this._focusDirectiveSuppressesEditPressure();
|
|
587406
|
+
const _reg50ChoiceLines = _reg50FocusDirective ? [
|
|
587407
|
+
`A focus recovery directive is active and overrides the generic write-thrash choices.`,
|
|
587408
|
+
`Required next action: ${_reg50FocusDirective.requiredNextAction}.`,
|
|
587409
|
+
`Reason: ${_reg50FocusDirective.reason}.`,
|
|
587410
|
+
`Do not write ${_wtWorstPath} again until the focus directive is satisfied or reported impossible with evidence.`
|
|
587411
|
+
] : [
|
|
587412
|
+
`Pick ONE of these for your next response:`,
|
|
587413
|
+
``,
|
|
587414
|
+
` (a) RUN-AND-READ: Run the EXACT command that fails (test/typecheck/build) and READ THE FULL ERROR MESSAGE LITERALLY. Do not summarize it from memory; paste it back into context. The current write hasn't been validated against any error.`,
|
|
587415
|
+
``,
|
|
587416
|
+
` (b) DELETE-AND-RESTART: If the file has been rewritten ${_wtWorstCount} times, the current approach is wrong. Either delete the file and try a fundamentally different design, OR revert to a known-good earlier version (use git, working_notes, or memory_search to find one).`,
|
|
587417
|
+
``,
|
|
587418
|
+
` (c) ERROR-INFORMED LOCAL TRIAGE: use the exact failing local command and error line to identify one implicated path/symbol/config key, then inspect or change only that target. Do not search online for a codebase-local failure.`,
|
|
587419
|
+
``,
|
|
587420
|
+
this._renderLocalFailureNudge(turn),
|
|
587421
|
+
``,
|
|
587422
|
+
` (d) DECLARE BLOCKED: If the file's correct shape genuinely isn't knowable from the spec + this codebase, call task_complete with a summary that names this specific file as the blocker. Don't burn more turns on it.`,
|
|
587423
|
+
``,
|
|
587424
|
+
`Do NOT in your next response: write to ${_wtWorstPath} again without first running and reading the failing command's output.`
|
|
587425
|
+
];
|
|
587283
587426
|
messages2.push({
|
|
587284
587427
|
role: "system",
|
|
587285
587428
|
content: [
|
|
@@ -587290,19 +587433,7 @@ ${_staleSamples.join("\n")}` : ``,
|
|
|
587290
587433
|
``,
|
|
587291
587434
|
`No successful test/build/typecheck command ran between writes — you are iterating the file blind, hoping the next variation works. This is a write-thrash anti-pattern. Repeated edits without verification confirm nothing.`,
|
|
587292
587435
|
``,
|
|
587293
|
-
|
|
587294
|
-
``,
|
|
587295
|
-
` (a) RUN-AND-READ: Run the EXACT command that fails (test/typecheck/build) and READ THE FULL ERROR MESSAGE LITERALLY. Do not summarize it from memory; paste it back into context. The current write hasn't been validated against any error.`,
|
|
587296
|
-
``,
|
|
587297
|
-
` (b) DELETE-AND-RESTART: If the file has been rewritten ${_wtWorstCount} times, the current approach is wrong. Either delete the file and try a fundamentally different design, OR revert to a known-good earlier version (use git, working_notes, or memory_search to find one).`,
|
|
587298
|
-
``,
|
|
587299
|
-
` (c) ERROR-INFORMED LOCAL TRIAGE: use the exact failing local command and error line to identify one implicated path/symbol/config key, then inspect or change only that target. Do not search online for a codebase-local failure.`,
|
|
587300
|
-
``,
|
|
587301
|
-
this._renderLocalFailureNudge(turn),
|
|
587302
|
-
``,
|
|
587303
|
-
` (d) DECLARE BLOCKED: If the file's correct shape genuinely isn't knowable from the spec + this codebase, call task_complete with a summary that names this specific file as the blocker. Don't burn more turns on it.`,
|
|
587304
|
-
``,
|
|
587305
|
-
`Do NOT in your next response: write to ${_wtWorstPath} again without first running and reading the failing command's output.`
|
|
587436
|
+
..._reg50ChoiceLines
|
|
587306
587437
|
].join("\n")
|
|
587307
587438
|
});
|
|
587308
587439
|
this.emit({
|
|
@@ -587418,6 +587549,25 @@ ${_staleSamples.join("\n")}` : ``,
|
|
|
587418
587549
|
}
|
|
587419
587550
|
if (_efWorstCount >= _efThreshold) {
|
|
587420
587551
|
this._editFailThrashCooldownUntilTurn = turn + 8;
|
|
587552
|
+
const _reg53FocusDirective = this._focusDirectiveSuppressesEditPressure();
|
|
587553
|
+
const _reg53ChoiceLines = _reg53FocusDirective ? [
|
|
587554
|
+
`A focus recovery directive is active and overrides generic stale-edit recovery choices.`,
|
|
587555
|
+
`Required next action: ${_reg53FocusDirective.requiredNextAction}.`,
|
|
587556
|
+
`Reason: ${_reg53FocusDirective.reason}.`,
|
|
587557
|
+
`Do not call file_edit or batch_edit on ${_efWorstPath} again until that directive is satisfied or reported impossible with evidence.`
|
|
587558
|
+
] : [
|
|
587559
|
+
`STOP guessing variants of old_string. Pick ONE of these for your next response:`,
|
|
587560
|
+
``,
|
|
587561
|
+
` (a) FILE_READ + COPY-EXACT: Call file_read on ${_efWorstPath}, then copy the EXACT bytes (whitespace, indentation, punctuation) for old_string from that read. Do not paraphrase or reformat.`,
|
|
587562
|
+
``,
|
|
587563
|
+
` (b) USE THE INLINE SNIPPET: Recent edit failures already include a "closest match" snippet showing the actual current content near where you tried to edit. Read that snippet in your last error message and use its content verbatim as old_string.`,
|
|
587564
|
+
``,
|
|
587565
|
+
` (c) REPLACE_ALL: If you want a global rename, set replace_all=true and the uniqueness check is bypassed.`,
|
|
587566
|
+
``,
|
|
587567
|
+
` (d) CONSTRAINED PATCH: If the exact replacement is too brittle, use file_patch with expected_old_content or batch_edit/file_edit against fresh current text. Use file_write only for new files, dry-run proposals, or deliberate hash-guarded full_file_rewrite actions.`,
|
|
587568
|
+
``,
|
|
587569
|
+
`Do NOT in your next response: call file_edit or batch_edit on ${_efWorstPath} again with another guess at old_string.`
|
|
587570
|
+
];
|
|
587421
587571
|
messages2.push({
|
|
587422
587572
|
role: "system",
|
|
587423
587573
|
content: [
|
|
@@ -587428,17 +587578,7 @@ ${_staleSamples.join("\n")}` : ``,
|
|
|
587428
587578
|
``,
|
|
587429
587579
|
`Each failure means your old_string did not match the file content. Your remembered version of this file has diverged from what's on disk — likely because an earlier edit succeeded and shifted things, or because you guessed at the file's content.`,
|
|
587430
587580
|
``,
|
|
587431
|
-
|
|
587432
|
-
``,
|
|
587433
|
-
` (a) FILE_READ + COPY-EXACT: Call file_read on ${_efWorstPath}, then copy the EXACT bytes (whitespace, indentation, punctuation) for old_string from that read. Do not paraphrase or reformat.`,
|
|
587434
|
-
``,
|
|
587435
|
-
` (b) USE THE INLINE SNIPPET: Recent edit failures already include a "closest match" snippet showing the actual current content near where you tried to edit. Read that snippet in your last error message and use its content verbatim as old_string.`,
|
|
587436
|
-
``,
|
|
587437
|
-
` (c) REPLACE_ALL: If you want a global rename, set replace_all=true and the uniqueness check is bypassed.`,
|
|
587438
|
-
``,
|
|
587439
|
-
` (d) CONSTRAINED PATCH: If the exact replacement is too brittle, use file_patch with expected_old_content or batch_edit/file_edit against fresh current text. Use file_write only for new files, dry-run proposals, or deliberate hash-guarded full_file_rewrite actions.`,
|
|
587440
|
-
``,
|
|
587441
|
-
`Do NOT in your next response: call file_edit or batch_edit on ${_efWorstPath} again with another guess at old_string.`
|
|
587581
|
+
..._reg53ChoiceLines
|
|
587442
587582
|
].join("\n")
|
|
587443
587583
|
});
|
|
587444
587584
|
this.emit({
|
|
@@ -587683,7 +587823,7 @@ ${_staleSamples.join("\n")}` : ``,
|
|
|
587683
587823
|
}
|
|
587684
587824
|
}
|
|
587685
587825
|
const turnTier = this.options.modelTier ?? "large";
|
|
587686
|
-
if (turn === 0 && !this.options.disableTodoPlanningNudges && (turnTier === "small" || turnTier === "medium")) {
|
|
587826
|
+
if (turn === 0 && !this.options.disableTodoPlanningNudges && this._todoWriteAvailable() && (turnTier === "small" || turnTier === "medium")) {
|
|
587687
587827
|
const goal = this._taskState.goal || "";
|
|
587688
587828
|
const substantiveGoal = goal.replace(/\b(?:then\s+)?call\s+task_complete\b[^.?!;]*/gi, "").replace(/\b(?:observe|report|summarize|finish|complete)\b[^.?!;]*/gi, "");
|
|
587689
587829
|
const wordCount2 = substantiveGoal.split(/\s+/).filter(Boolean).length;
|
|
@@ -587796,7 +587936,7 @@ ${top.map((t2) => `- ${t2.name}: ${t2.desc}`).join("\n")}`);
|
|
|
587796
587936
|
const isReadTask = /\bread\b|\bshow\b|\btell me\b|\bwhat is\b/i.test(taskGoal);
|
|
587797
587937
|
const hints = [];
|
|
587798
587938
|
if (isSimpleTask) {
|
|
587799
|
-
hints.push("This is a simple task — if it needs only ONE substantive tool call, skip todo_write and call the tool directly, then task_complete. Do not count reporting, observing output, or task_complete as planning steps. If it needs 2+ substantive work steps, use todo_write to plan.");
|
|
587939
|
+
hints.push(this._todoWriteAvailable() ? "This is a simple task — if it needs only ONE substantive tool call, skip todo_write and call the tool directly, then task_complete. Do not count reporting, observing output, or task_complete as planning steps. If it needs 2+ substantive work steps, use todo_write to plan." : "This is a simple task — if it needs only ONE substantive tool call, call the tool directly, then task_complete. Do not count reporting, observing output, or task_complete as planning steps.");
|
|
587800
587940
|
}
|
|
587801
587941
|
if (isSearchTask) {
|
|
587802
587942
|
hints.push("SEARCH STRATEGY: Use grep_search to find what you need FIRST, THEN file_read only the specific file and lines. Do NOT read entire files hoping to find something.");
|
|
@@ -588532,7 +588672,7 @@ ${memoryLines.join("\n")}`
|
|
|
588532
588672
|
`Best practice for this model tier: emit at most ${_responseCap} tool calls per turn.`,
|
|
588533
588673
|
`Observe the results of the first ${_responseCap}, then plan the next batch in the NEXT turn.`,
|
|
588534
588674
|
`Smaller batches let cache/dedup/progress-gate/failure signals reach you BEFORE you commit to more work.`,
|
|
588535
|
-
`Use todo_write between batches to track which items are done.`
|
|
588675
|
+
this._todoWriteAvailable() ? `Use todo_write between batches to track which items are done.` : `Track progress internally between batches; do not call unavailable planning tools.`
|
|
588536
588676
|
].join("\n")
|
|
588537
588677
|
});
|
|
588538
588678
|
}
|
|
@@ -588873,7 +589013,7 @@ Corrective action: try a different approach first: read relevant files, adjust a
|
|
|
588873
589013
|
turn,
|
|
588874
589014
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
588875
589015
|
});
|
|
588876
|
-
const budgetMsg = `[BUDGET EXHAUSTED] You have used all ${toolBudgets[tc.name]} allowed ${tc.name} calls for the current phase. You ALREADY have enough information from previous calls. DO NOT try to call ${tc.name} again — it will be blocked. If your todo list shows more phases pending: mark the current phase completed via todo_write so a new budget allowance kicks in. If all phases are done: call task_complete with your final summary.`;
|
|
589016
|
+
const budgetMsg = `[BUDGET EXHAUSTED] You have used all ${toolBudgets[tc.name]} allowed ${tc.name} calls for the current phase. You ALREADY have enough information from previous calls. DO NOT try to call ${tc.name} again — it will be blocked. ` + (this._todoWriteAvailable() ? `If your todo list shows more phases pending: mark the current phase completed via todo_write so a new budget allowance kicks in. ` : `If more phases remain, continue with a different available tool instead of repeating the exhausted one. `) + `If all phases are done: call task_complete with your final summary.`;
|
|
588877
589017
|
this.emit({
|
|
588878
589018
|
type: "tool_result",
|
|
588879
589019
|
toolName: tc.name,
|
|
@@ -589404,6 +589544,7 @@ ${cachedResult}`,
|
|
|
589404
589544
|
let validationError = this._validateToolActionReason(resolvedTool?.name ?? tc.name, tc.arguments ?? {});
|
|
589405
589545
|
if (!validationError) {
|
|
589406
589546
|
tc.arguments = this._stripToolActionReasonArgs(tc.arguments ?? {});
|
|
589547
|
+
tc.arguments = this._normalizeToolArgsForExecution(resolvedTool?.name ?? tc.name, tc.arguments ?? {});
|
|
589407
589548
|
validationError = this._validateFileWriteOverwriteContract(resolvedTool?.name ?? tc.name, tc.arguments ?? {}, toolActionReason);
|
|
589408
589549
|
}
|
|
589409
589550
|
if (!validationError) {
|
|
@@ -590559,14 +590700,15 @@ Respond with EXACTLY this structure before your next tool call:
|
|
|
590559
590700
|
}
|
|
590560
590701
|
if (!_prior && !this._opaqueErrorHintInjected.has(_refStem) && _entry.subject == null && (categorizeError(_refErr) === "unknown" || _refErr.length > 100)) {
|
|
590561
590702
|
this._opaqueErrorHintInjected.add(_refStem);
|
|
590703
|
+
const todoWriteUnavailable = tc.name === "todo_write" && /Unknown tool/i.test(_entry.wentWrong);
|
|
590562
590704
|
const opaqueMessage = tc.name === "todo_write" ? [
|
|
590563
590705
|
`[PLANNING TOOL RECOVERY — todo_write failed before updating the visible checklist.]`,
|
|
590564
590706
|
``,
|
|
590565
590707
|
`Tool: ${tc.name}`,
|
|
590566
590708
|
`Error: "${_entry.wentWrong}"`,
|
|
590567
590709
|
``,
|
|
590568
|
-
`This is a recoverable planning-tool argument issue, not a local code or dependency failure.`,
|
|
590569
|
-
`Correct the todo_write payload if a visible checklist is still needed; otherwise continue with the first substantive task from the attempted plan.`,
|
|
590710
|
+
todoWriteUnavailable ? `todo_write is not registered in this tool surface. Do not retry it; continue using the available tools and call task_complete with evidence when done.` : `This is a recoverable planning-tool argument issue, not a local code or dependency failure.`,
|
|
590711
|
+
todoWriteUnavailable ? `Use the attempted checklist only as private state; do not let missing bookkeeping block substantive work.` : `Correct the todo_write payload if a visible checklist is still needed; otherwise continue with the first substantive task from the attempted plan.`,
|
|
590570
590712
|
`Do not pivot to broad shell discovery or code edits solely because todo_write failed.`,
|
|
590571
590713
|
``,
|
|
590572
590714
|
this._renderLocalFailureNudge(turn)
|
|
@@ -593718,7 +593860,17 @@ ${marker}` : marker);
|
|
|
593718
593860
|
};
|
|
593719
593861
|
}
|
|
593720
593862
|
_extractToolActionReason(args) {
|
|
593721
|
-
|
|
593863
|
+
let raw = args["action_reason"] ?? args["actionReason"] ?? args["justification"];
|
|
593864
|
+
if (typeof raw === "string") {
|
|
593865
|
+
const trimmed = raw.trim();
|
|
593866
|
+
if (!trimmed)
|
|
593867
|
+
return null;
|
|
593868
|
+
try {
|
|
593869
|
+
raw = JSON.parse(trimmed);
|
|
593870
|
+
} catch {
|
|
593871
|
+
return null;
|
|
593872
|
+
}
|
|
593873
|
+
}
|
|
593722
593874
|
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
593723
593875
|
return null;
|
|
593724
593876
|
const rec = raw;
|
|
@@ -593735,7 +593887,7 @@ ${marker}` : marker);
|
|
|
593735
593887
|
if (!this._requiresToolActionReason(toolName))
|
|
593736
593888
|
return null;
|
|
593737
593889
|
const raw = args["action_reason"] ?? args["actionReason"] ?? args["justification"];
|
|
593738
|
-
if (!raw || typeof raw
|
|
593890
|
+
if (!raw || typeof raw === "string" && !raw.trim()) {
|
|
593739
593891
|
return [
|
|
593740
593892
|
"[TOOL ACTION REASON CONTRACT]",
|
|
593741
593893
|
`Every tool call must include action_reason: { task_anchor, intent, evidence, expected_result, scope }.`,
|
|
@@ -593774,6 +593926,39 @@ ${marker}` : marker);
|
|
|
593774
593926
|
}
|
|
593775
593927
|
return changed ? next : args;
|
|
593776
593928
|
}
|
|
593929
|
+
_normalizeToolArgsForExecution(toolName, args) {
|
|
593930
|
+
if (toolName !== "file_patch")
|
|
593931
|
+
return args;
|
|
593932
|
+
let next = args;
|
|
593933
|
+
const copy = () => {
|
|
593934
|
+
if (next === args)
|
|
593935
|
+
next = { ...args };
|
|
593936
|
+
return next;
|
|
593937
|
+
};
|
|
593938
|
+
const coerceLineNumber = (value2) => {
|
|
593939
|
+
if (typeof value2 === "number")
|
|
593940
|
+
return value2;
|
|
593941
|
+
if (typeof value2 === "string" && /^\d+$/.test(value2.trim())) {
|
|
593942
|
+
return Number(value2.trim());
|
|
593943
|
+
}
|
|
593944
|
+
return value2;
|
|
593945
|
+
};
|
|
593946
|
+
if (next["start_line"] === void 0 && args["line"] !== void 0) {
|
|
593947
|
+
copy()["start_line"] = coerceLineNumber(args["line"]);
|
|
593948
|
+
}
|
|
593949
|
+
if (next["end_line"] === void 0 && args["line_end"] !== void 0) {
|
|
593950
|
+
copy()["end_line"] = coerceLineNumber(args["line_end"]);
|
|
593951
|
+
}
|
|
593952
|
+
if (next["end_line"] === void 0 && args["endLine"] !== void 0) {
|
|
593953
|
+
copy()["end_line"] = coerceLineNumber(args["endLine"]);
|
|
593954
|
+
}
|
|
593955
|
+
for (const key of ["start_line", "end_line"]) {
|
|
593956
|
+
if (typeof next[key] === "string") {
|
|
593957
|
+
copy()[key] = coerceLineNumber(next[key]);
|
|
593958
|
+
}
|
|
593959
|
+
}
|
|
593960
|
+
return next;
|
|
593961
|
+
}
|
|
593777
593962
|
_validateFileWriteOverwriteContract(toolName, args, actionReason) {
|
|
593778
593963
|
if (toolName !== "file_write")
|
|
593779
593964
|
return null;
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnius",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.463",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "omnius",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.463",
|
|
10
10
|
"bundleDependencies": [
|
|
11
11
|
"image-to-ascii"
|
|
12
12
|
],
|
|
@@ -430,9 +430,9 @@
|
|
|
430
430
|
}
|
|
431
431
|
},
|
|
432
432
|
"node_modules/@helia/utils/node_modules/cborg": {
|
|
433
|
-
"version": "5.1.
|
|
434
|
-
"resolved": "https://registry.npmjs.org/cborg/-/cborg-5.1.
|
|
435
|
-
"integrity": "sha512-
|
|
433
|
+
"version": "5.1.7",
|
|
434
|
+
"resolved": "https://registry.npmjs.org/cborg/-/cborg-5.1.7.tgz",
|
|
435
|
+
"integrity": "sha512-rGg2MG9zZEUKtKqjkBppIWUecTXf9N1vs1Qru43vJWoDaODhCrtmzdehCaA/aq/c1cPI5A0kPrJ5Tf+jIfhV4w==",
|
|
436
436
|
"license": "Apache-2.0",
|
|
437
437
|
"bin": {
|
|
438
438
|
"cborg": "lib/bin.js"
|
|
@@ -461,9 +461,9 @@
|
|
|
461
461
|
}
|
|
462
462
|
},
|
|
463
463
|
"node_modules/@ipld/dag-cbor/node_modules/cborg": {
|
|
464
|
-
"version": "5.1.
|
|
465
|
-
"resolved": "https://registry.npmjs.org/cborg/-/cborg-5.1.
|
|
466
|
-
"integrity": "sha512-
|
|
464
|
+
"version": "5.1.7",
|
|
465
|
+
"resolved": "https://registry.npmjs.org/cborg/-/cborg-5.1.7.tgz",
|
|
466
|
+
"integrity": "sha512-rGg2MG9zZEUKtKqjkBppIWUecTXf9N1vs1Qru43vJWoDaODhCrtmzdehCaA/aq/c1cPI5A0kPrJ5Tf+jIfhV4w==",
|
|
467
467
|
"license": "Apache-2.0",
|
|
468
468
|
"bin": {
|
|
469
469
|
"cborg": "lib/bin.js"
|
|
@@ -480,9 +480,9 @@
|
|
|
480
480
|
}
|
|
481
481
|
},
|
|
482
482
|
"node_modules/@ipld/dag-json/node_modules/cborg": {
|
|
483
|
-
"version": "5.1.
|
|
484
|
-
"resolved": "https://registry.npmjs.org/cborg/-/cborg-5.1.
|
|
485
|
-
"integrity": "sha512-
|
|
483
|
+
"version": "5.1.7",
|
|
484
|
+
"resolved": "https://registry.npmjs.org/cborg/-/cborg-5.1.7.tgz",
|
|
485
|
+
"integrity": "sha512-rGg2MG9zZEUKtKqjkBppIWUecTXf9N1vs1Qru43vJWoDaODhCrtmzdehCaA/aq/c1cPI5A0kPrJ5Tf+jIfhV4w==",
|
|
486
486
|
"license": "Apache-2.0",
|
|
487
487
|
"bin": {
|
|
488
488
|
"cborg": "lib/bin.js"
|
|
@@ -4342,9 +4342,9 @@
|
|
|
4342
4342
|
}
|
|
4343
4343
|
},
|
|
4344
4344
|
"node_modules/ipns/node_modules/cborg": {
|
|
4345
|
-
"version": "5.1.
|
|
4346
|
-
"resolved": "https://registry.npmjs.org/cborg/-/cborg-5.1.
|
|
4347
|
-
"integrity": "sha512-
|
|
4345
|
+
"version": "5.1.7",
|
|
4346
|
+
"resolved": "https://registry.npmjs.org/cborg/-/cborg-5.1.7.tgz",
|
|
4347
|
+
"integrity": "sha512-rGg2MG9zZEUKtKqjkBppIWUecTXf9N1vs1Qru43vJWoDaODhCrtmzdehCaA/aq/c1cPI5A0kPrJ5Tf+jIfhV4w==",
|
|
4348
4348
|
"license": "Apache-2.0",
|
|
4349
4349
|
"bin": {
|
|
4350
4350
|
"cborg": "lib/bin.js"
|
package/package.json
CHANGED