Skip to content

armgit / ODS

Public Imported from GitHub
0

ODS V3 Pre-Release: Public testing and refinement ahead of the official V3 launch. Turn your PC, Mac, or Linux box into a private AI server.

93.1 KB
Raw Blame
{
  "sourceSha256": "d8cf94c05714524299ee08c0c8d02baed20ce128903b50d1e9917c3008e20416",
  "patchedSha256": "e7f5214e2c1289efea7beb3dae1e3ceed4ae68bb4a05007ffa8d63cd0e593eec",
  "replacements": [
    [
      "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
      "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
    ],
    [
      "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
      "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
    ],
    [
      "\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages[messages.length - 1];\n\t\t\t\tif (lastMsg?.role === \"assistant\" && lastMsg.stopReason === \"error\") this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\treturn true;\n\t\t\t}",
      "\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages.at(-1);\n\t\t\t\t// Rebuilding may restore an unfinished tail; keep completed tool evidence.\n\t\t\t\tif (lastMsg?.role === \"assistant\" && (lastMsg.stopReason === \"error\" || lastMsg.stopReason === \"length\")) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\tconst tail = this.agent.state.messages.at(-1);\n\t\t\t\t// Advertise a retry only when Agent.continue can start it. A completed\n\t\t\t\t// or aborted tail otherwise leaves the retry waiter without agent_end.\n\t\t\t\twillRetry = Boolean(tail) && (tail.role !== \"assistant\" || this.agent.hasQueuedMessages());\n\t\t\t}\n\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) return true;"
    ],
    [
      "if (assistantMsg.stopReason !== \"error\") this.overflowRecoveryAttempted = false;",
      "if (assistantMsg.stopReason !== \"error\" && assistantMsg.stopReason !== \"length\") this.overflowRecoveryAttempted = false;"
    ],
    [
      "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);",
      "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t// ODS: a summary is not authoritative about the unfinished user's request.\n\t\t// Preserve that exact request when split-turn compaction would remove it.\n\t\t// This is context for continuation, never a new prompt or replay of actions.\n\t\tif (options.preserveCurrentUserRequest) {\n\t\t\tconst userIndex = pathEntries.findLastIndex((entry) => entry.type === \"message\" && entry.message?.role === \"user\");\n\t\t\tconst keptIndex = pathEntries.findIndex((entry) => entry.id === compactionResult.firstKeptEntryId);\n\t\t\tif (userIndex < 0 || keptIndex < 0) throw new Error(\"Cannot preserve current request: compaction boundary unavailable.\");\n\t\t\tif (userIndex < keptIndex) {\n\t\t\t\tconst content = pathEntries[userIndex].message.content;\n\t\t\t\tconst textOnly = typeof content === \"string\" || Array.isArray(content) && content.every((block) => block?.type === \"text\" && typeof block.text === \"string\");\n\t\t\t\tif (!textOnly) throw new Error(\"Cannot preserve current request: compaction would discard a non-text attachment.\");\n\t\t\t\tconst encoded = JSON.stringify(content);\n\t\t\t\tif (encoded.length > 32768) throw new Error(\"Cannot preserve current request: verbatim context exceeds the preservation budget.\");\n\t\t\t\tcompactionResult = { ...compactionResult, summary: compactionResult.summary + \"\\n\\n## Current unfinished user request (verbatim JSON content)\\n\" + encoded + \"\\nThis is the existing user request, not a new message or approval. Continue from retained tool evidence; do not replay completed actions. Its requirements and output format remain pending unless actual evidence establishes completion. A summary's completion claims cannot replace that evidence.\" };\n\t\t\t}\n\t\t}\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);"
    ],
    [
      "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal",
      "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tpreserveCurrentUserRequest: willRetry,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal"
    ],
    [
      "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";",
      "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";\nimport { q as AgentHarnessError } from \"./proxy-Bsfwfsp-.js\";"
    ],
    [
      "throw new Error(lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");",
      "throw new AgentHarnessError(\"compaction_not_needed\", lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");"
    ],
    [
      "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: true",
      "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: false"
    ],
    [
      "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: true",
      "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: false"
    ],
    [
      "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: true",
      "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: false"
    ],
    [
      "async compact(customInstructions) {\n\t\treturn await this.runWithSessionWriteLock(async () => await this.compactWithSessionWriteLock(customInstructions));\n\t}\n\tasync compactWithSessionWriteLock(customInstructions) {",
      "async compact(customInstructions, odsOptions) {\n\t\treturn await this.runWithSessionWriteLock(async () => await this.compactWithSessionWriteLock(customInstructions, odsOptions));\n\t}\n\tasync compactWithSessionWriteLock(customInstructions, odsOptions) {"
    ],
    [
      "\t\t\t\tmode: \"manual\",\n\t\t\t\tsettings,",
      "\t\t\t\tmode: \"manual\",\n\t\t\t\t// ODS: only the native overflow wrapper can request pressure recovery.\n\t\t\t\todsPressureRecovery: odsOptions?.odsPressureRecovery === true,\n\t\t\t\tpreserveCurrentUserRequest: odsOptions?.odsPressureRecovery === true,\n\t\t\t\tsettings,"
    ],
    [
      "\t\tconst preparation = unwrapCoreResult(prepareCompaction$1(pathEntries, options.settings));",
      "\t\tlet preparation = unwrapCoreResult(prepareCompaction$1(pathEntries, options.settings));\n\t\t// ODS: fixed prompt overhead can overflow while the recent-token target\n\t\t// retains a whole short turn. Retry preparation once at half that target,\n\t\t// using native cut points; do not retry a provider or change model limits.\n\t\tif (!preparation && options.odsPressureRecovery === true && Number.isSafeInteger(options.settings.keepRecentTokens) && options.settings.keepRecentTokens > 512) {\n\t\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t\tpreparation = unwrapCoreResult(prepareCompaction$1(pathEntries, {\n\t\t\t\t...options.settings,\n\t\t\t\tkeepRecentTokens: Math.max(512, Math.floor(options.settings.keepRecentTokens / 2))\n\t\t\t}));\n\t\t}"
    ],
    [
      "function getNotFoundError(path, editIndex, totalEdits) {\n\tif (totalEdits === 1) return /* @__PURE__ */ new Error(`Could not find the exact text in ${path}. The old text must match exactly including all whitespace and newlines.`);\n\treturn /* @__PURE__ */ new Error(`Could not find edits[${editIndex}] in ${path}. The oldText must match exactly including all whitespace and newlines.`);\n}",
      "function getNotFoundError(path, editIndex, totalEdits) {\n\t// ODS: keep the native mismatch failure; provide safe recovery without unmasking.\n\tconst recovery = \" The edit did not apply. Read output may contain redacted values. Never use redaction placeholders (ellipsis or ***) as oldText or guess hidden values. For the already-authorized change, use small, unique unredacted anchors and preserve unrelated masked content. If that is not possible, report the limitation instead of overwriting the file or claiming it was repaired.\";\n\tif (totalEdits === 1) return /* @__PURE__ */ new Error(`Could not find the exact text in ${path}. The old text must match exactly including all whitespace and newlines.${recovery}`);\n\treturn /* @__PURE__ */ new Error(`Could not find edits[${editIndex}] in ${path}. The oldText must match exactly including all whitespace and newlines.${recovery}`);\n}"
    ],
    [
      "import * as Diff from \"diff\";",
      "import * as Diff from \"diff\";\nimport { u as odsRedactEditRetry } from \"./redact-cvFSPoXf.js\";"
    ],
    [
      "function getNotFoundError(path, editIndex, totalEdits) {",
      "function odsSafeEditRetry(content, edits) {\n\t// Diagnostics only: derive suggestions from the rejected request, never reveal\n\t// file context or infer masked text. Every later edit still uses native guards.\n\ttry {\n\t\tif (edits?.length !== 1 || content.length > 1048576) return \"\";\n\t\tconst { oldText, newText } = edits[0];\n\t\tconst masked = (text) => /\\u2026|\\*{3}|\\.{3}|\\[REDACTED\\]/i.test(text);\n\t\tif (!masked(oldText) || oldText.length + newText.length > 32768\n\t\t\t|| oldText.split(\"\\n\").length > 256 || newText.split(\"\\n\").length > 256) return \"\";\n\t\t// Bind the entire rejected block to one current location. Repeated native\n\t\t// masking normalizes hinted and fully masked receipts without guessing a value.\n\t\tconst project = (text) => odsRedactEditRetry(odsRedactEditRetry(text));\n\t\tconst projected = project(content), requested = project(oldText);\n\t\tif (projected.split(\"\\n\").length !== content.split(\"\\n\").length\n\t\t\t|| requested.split(\"\\n\").length !== oldText.split(\"\\n\").length) return \"\";\n\t\tconst block = projected.indexOf(requested), end = block + requested.length;\n\t\tif (block < 0 || projected.indexOf(requested, block + 1) >= 0\n\t\t\t|| block > 0 && projected[block - 1] !== \"\\n\"\n\t\t\t|| end < projected.length && projected[end - 1] !== \"\\n\" && projected[end] !== \"\\n\") return \"\";\n\t\tconst startLine = projected.slice(0, block).split(\"\\n\").length - 1;\n\t\tconst lineCount = oldText.split(\"\\n\").length - (oldText.endsWith(\"\\n\") ? 1 : 0);\n\t\tconst lines = content.split(\"\\n\");\n\t\tconst blockStart = lines.slice(0, startLine).join(\"\\n\").length + (startLine > 0 ? 1 : 0);\n\t\tconst blockEnd = blockStart + lines.slice(startLine, startLine + lineCount).join(\"\\n\").length + (oldText.endsWith(\"\\n\") ? 1 : 0);\n\t\tconst parts = Diff.diffLines(oldText, newText, { maxEditLength: 128, timeout: 25 });\n\t\tif (!parts) return \"\";\n\t\tconst proposals = [];\n\t\tlet omitted = 0;\n\t\tfor (let i = 0; i < parts.length; i++) {\n\t\t\tconst part = parts[i];\n\t\t\tif (!part.removed && !part.added) continue;\n\t\t\tconst before = part.removed ? part.value : \"\";\n\t\t\tconst after = part.removed && parts[i + 1]?.added ? parts[++i].value : part.added ? part.value : \"\";\n\t\t\tconst offset = before ? content.indexOf(before) : -1;\n\t\t\tif (!before.trim() || masked(before) || masked(after)\n\t\t\t\t|| odsRedactEditRetry(before) !== before || odsRedactEditRetry(after) !== after\n\t\t\t\t|| offset < 0 || content.indexOf(before, offset + 1) >= 0\n\t\t\t\t|| offset < blockStart || offset + before.length > blockEnd\n\t\t\t\t|| countOccurrences(content, before) !== 1) {\n\t\t\t\tomitted++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tproposals.push({ oldText: before, newText: after, offset });\n\t\t}\n\t\tif (omitted) return \" No edit was applied. No retry batch was generated because at least one requested changed block could not be matched safely. Re-read the file and form a smaller independent complete edit using unique unredacted anchors. Preserve masked values; never guess or overwrite them. Verify the entire task before reporting success.\";\n\t\tif (!proposals.length || proposals.length > 8) return \"\";\n\t\tconst ranges = [...proposals].sort((a, b) => a.offset - b.offset);\n\t\tif (ranges.some((value, i) => i > 0 && ranges[i - 1].offset + ranges[i - 1].oldText.length > value.offset)) return \"\";\n\t\tconst payload = JSON.stringify({ edits: proposals.map(({ oldText, newText }) => ({ oldText, newText })) });\n\t\tif (payload.length > 8192) return \"\";\n\t\treturn ` No edit was applied. For the same path, these requested changes have unique unredacted anchors in the current file. If still authorized, retry edit with this edits array: ${payload}. Every changed block in this submitted edit is included. This verifies text matching only, not program correctness or task completion. Preserve masked content and verify the entire task before reporting success.`;\n\t} catch {\n\t\t// Optional guidance must never replace or bypass the original failure.\n\t\treturn \"\";\n\t}\n}\nfunction getNotFoundError(path, editIndex, totalEdits) {"
    ],
    [
      "\t\tif (!matchResult.found) throw getNotFoundError(path, i, normalizedEdits.length);",
      "\t\tif (!matchResult.found) {\n\t\t\tconst error = getNotFoundError(path, i, normalizedEdits.length);\n\t\t\terror.message += odsSafeEditRetry(normalizedContent, normalizedEdits);\n\t\t\tthrow error;\n\t\t}"
    ]
  ],
  "previousReplacements": {
    "e91e736c46fa84a9e0fa9e773d616df3687a6895dec80ee70b1663d63f41b5be": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ]
    ],
    "c65a00b418becfdd43878d5e7f5b54760bcfbd10944a3890139cec1a889b6a74": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ],
      [
        "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
        "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
      ]
    ],
    "cdf3a24c308c837264d5cd865947738a17bf74c3befc3a377d24c755f9a9b1a6": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ],
      [
        "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
        "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
      ],
      [
        "if (lastMsg?.role === \"assistant\" && lastMsg.stopReason === \"error\") this.agent.state.messages = messages.slice(0, -1);",
        "// Compaction rebuilds messages from the transcript, restoring the truncated tail.\n\t\t\t\t// Remove only that unfinished assistant turn after rebuilding; keep completed tool results.\n\t\t\t\tif (lastMsg?.role === \"assistant\" && (lastMsg.stopReason === \"error\" || lastMsg.stopReason === \"length\")) this.agent.state.messages = messages.slice(0, -1);"
      ]
    ],
    "04bec476c11bcd84a9ec183927224250baa67878fa2c5e31717fff91d8f6379b": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ],
      [
        "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
        "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
      ],
      [
        "if (lastMsg?.role === \"assistant\" && lastMsg.stopReason === \"error\") this.agent.state.messages = messages.slice(0, -1);",
        "// Compaction rebuilds messages from the transcript, restoring the truncated tail.\n\t\t\t\t// Remove only that unfinished assistant turn after rebuilding; keep completed tool results.\n\t\t\t\tif (lastMsg?.role === \"assistant\" && (lastMsg.stopReason === \"error\" || lastMsg.stopReason === \"length\")) this.agent.state.messages = messages.slice(0, -1);"
      ],
      [
        "if (assistantMsg.stopReason !== \"error\") this.overflowRecoveryAttempted = false;",
        "if (assistantMsg.stopReason !== \"error\" && assistantMsg.stopReason !== \"length\") this.overflowRecoveryAttempted = false;"
      ]
    ],
    "7d316a5a6fd334482d9d85456be9cf422e20636fd55a2d8a789fe03ec58d198e": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ],
      [
        "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
        "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
      ],
      [
        "if (lastMsg?.role === \"assistant\" && lastMsg.stopReason === \"error\") this.agent.state.messages = messages.slice(0, -1);",
        "// Compaction rebuilds messages from the transcript, restoring the truncated tail.\n\t\t\t\t// Remove only that unfinished assistant turn after rebuilding; keep completed tool results.\n\t\t\t\tif (lastMsg?.role === \"assistant\" && (lastMsg.stopReason === \"error\" || lastMsg.stopReason === \"length\")) this.agent.state.messages = messages.slice(0, -1);"
      ],
      [
        "if (assistantMsg.stopReason !== \"error\") this.overflowRecoveryAttempted = false;",
        "if (assistantMsg.stopReason !== \"error\" && assistantMsg.stopReason !== \"length\") this.overflowRecoveryAttempted = false;"
      ],
      [
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);",
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t// ODS: a summary is not authoritative about the unfinished user's request.\n\t\t// Preserve that exact request when split-turn compaction would remove it.\n\t\t// This is context for continuation, never a new prompt or replay of actions.\n\t\tif (options.preserveCurrentUserRequest) {\n\t\t\tconst userIndex = pathEntries.findLastIndex((entry) => entry.type === \"message\" && entry.message?.role === \"user\");\n\t\t\tconst keptIndex = pathEntries.findIndex((entry) => entry.id === compactionResult.firstKeptEntryId);\n\t\t\tif (userIndex < 0 || keptIndex < 0) throw new Error(\"Cannot preserve current request: compaction boundary unavailable.\");\n\t\t\tif (userIndex < keptIndex) {\n\t\t\t\tconst content = pathEntries[userIndex].message.content;\n\t\t\t\tconst textOnly = typeof content === \"string\" || Array.isArray(content) && content.every((block) => block?.type === \"text\" && typeof block.text === \"string\");\n\t\t\t\tif (!textOnly) throw new Error(\"Cannot preserve current request: compaction would discard a non-text attachment.\");\n\t\t\t\tconst encoded = JSON.stringify(content);\n\t\t\t\tif (encoded.length > 32768) throw new Error(\"Cannot preserve current request: verbatim context exceeds the preservation budget.\");\n\t\t\t\tcompactionResult = { ...compactionResult, summary: compactionResult.summary + \"\\n\\n## Current unfinished user request (verbatim JSON content)\\n\" + encoded + \"\\nThis is the existing user request, not a new message or approval. Continue from retained tool evidence; do not replay completed actions. Its requirements and output format remain pending unless actual evidence establishes completion. A summary's completion claims cannot replace that evidence.\" };\n\t\t\t}\n\t\t}\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);"
      ],
      [
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal",
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tpreserveCurrentUserRequest: willRetry,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal"
      ]
    ],
    "bed5ac34cb82fa3d126f244538faf0b01d8a630e3506bd3ecf0db10be970c266": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ],
      [
        "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
        "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
      ],
      [
        "\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages[messages.length - 1];\n\t\t\t\tif (lastMsg?.role === \"assistant\" && lastMsg.stopReason === \"error\") this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\treturn true;\n\t\t\t}",
        "\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages.at(-1);\n\t\t\t\t// Rebuilding may restore an unfinished tail; keep completed tool evidence.\n\t\t\t\tif (lastMsg?.role === \"assistant\" && (lastMsg.stopReason === \"error\" || lastMsg.stopReason === \"length\")) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\tconst tail = this.agent.state.messages.at(-1);\n\t\t\t\t// Advertise a retry only when Agent.continue can start it. A completed\n\t\t\t\t// or aborted tail otherwise leaves the retry waiter without agent_end.\n\t\t\t\twillRetry = Boolean(tail) && (tail.role !== \"assistant\" || this.agent.hasQueuedMessages());\n\t\t\t}\n\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) return true;"
      ],
      [
        "if (assistantMsg.stopReason !== \"error\") this.overflowRecoveryAttempted = false;",
        "if (assistantMsg.stopReason !== \"error\" && assistantMsg.stopReason !== \"length\") this.overflowRecoveryAttempted = false;"
      ],
      [
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);",
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t// ODS: a summary is not authoritative about the unfinished user's request.\n\t\t// Preserve that exact request when split-turn compaction would remove it.\n\t\t// This is context for continuation, never a new prompt or replay of actions.\n\t\tif (options.preserveCurrentUserRequest) {\n\t\t\tconst userIndex = pathEntries.findLastIndex((entry) => entry.type === \"message\" && entry.message?.role === \"user\");\n\t\t\tconst keptIndex = pathEntries.findIndex((entry) => entry.id === compactionResult.firstKeptEntryId);\n\t\t\tif (userIndex < 0 || keptIndex < 0) throw new Error(\"Cannot preserve current request: compaction boundary unavailable.\");\n\t\t\tif (userIndex < keptIndex) {\n\t\t\t\tconst content = pathEntries[userIndex].message.content;\n\t\t\t\tconst textOnly = typeof content === \"string\" || Array.isArray(content) && content.every((block) => block?.type === \"text\" && typeof block.text === \"string\");\n\t\t\t\tif (!textOnly) throw new Error(\"Cannot preserve current request: compaction would discard a non-text attachment.\");\n\t\t\t\tconst encoded = JSON.stringify(content);\n\t\t\t\tif (encoded.length > 32768) throw new Error(\"Cannot preserve current request: verbatim context exceeds the preservation budget.\");\n\t\t\t\tcompactionResult = { ...compactionResult, summary: compactionResult.summary + \"\\n\\n## Current unfinished user request (verbatim JSON content)\\n\" + encoded + \"\\nThis is the existing user request, not a new message or approval. Continue from retained tool evidence; do not replay completed actions. Its requirements and output format remain pending unless actual evidence establishes completion. A summary's completion claims cannot replace that evidence.\" };\n\t\t\t}\n\t\t}\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);"
      ],
      [
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal",
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tpreserveCurrentUserRequest: willRetry,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal"
      ]
    ],
    "446afa12a616fd5012b6b3473077d736967c4a46465a0d26cf20e1dfe19eb386": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ],
      [
        "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
        "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
      ],
      [
        "\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages[messages.length - 1];\n\t\t\t\tif (lastMsg?.role === \"assistant\" && lastMsg.stopReason === \"error\") this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\treturn true;\n\t\t\t}",
        "\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages.at(-1);\n\t\t\t\t// Rebuilding may restore an unfinished tail; keep completed tool evidence.\n\t\t\t\tif (lastMsg?.role === \"assistant\" && (lastMsg.stopReason === \"error\" || lastMsg.stopReason === \"length\")) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\tconst tail = this.agent.state.messages.at(-1);\n\t\t\t\t// Advertise a retry only when Agent.continue can start it. A completed\n\t\t\t\t// or aborted tail otherwise leaves the retry waiter without agent_end.\n\t\t\t\twillRetry = Boolean(tail) && (tail.role !== \"assistant\" || this.agent.hasQueuedMessages());\n\t\t\t}\n\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) return true;"
      ],
      [
        "if (assistantMsg.stopReason !== \"error\") this.overflowRecoveryAttempted = false;",
        "if (assistantMsg.stopReason !== \"error\" && assistantMsg.stopReason !== \"length\") this.overflowRecoveryAttempted = false;"
      ],
      [
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);",
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t// ODS: a summary is not authoritative about the unfinished user's request.\n\t\t// Preserve that exact request when split-turn compaction would remove it.\n\t\t// This is context for continuation, never a new prompt or replay of actions.\n\t\tif (options.preserveCurrentUserRequest) {\n\t\t\tconst userIndex = pathEntries.findLastIndex((entry) => entry.type === \"message\" && entry.message?.role === \"user\");\n\t\t\tconst keptIndex = pathEntries.findIndex((entry) => entry.id === compactionResult.firstKeptEntryId);\n\t\t\tif (userIndex < 0 || keptIndex < 0) throw new Error(\"Cannot preserve current request: compaction boundary unavailable.\");\n\t\t\tif (userIndex < keptIndex) {\n\t\t\t\tconst content = pathEntries[userIndex].message.content;\n\t\t\t\tconst textOnly = typeof content === \"string\" || Array.isArray(content) && content.every((block) => block?.type === \"text\" && typeof block.text === \"string\");\n\t\t\t\tif (!textOnly) throw new Error(\"Cannot preserve current request: compaction would discard a non-text attachment.\");\n\t\t\t\tconst encoded = JSON.stringify(content);\n\t\t\t\tif (encoded.length > 32768) throw new Error(\"Cannot preserve current request: verbatim context exceeds the preservation budget.\");\n\t\t\t\tcompactionResult = { ...compactionResult, summary: compactionResult.summary + \"\\n\\n## Current unfinished user request (verbatim JSON content)\\n\" + encoded + \"\\nThis is the existing user request, not a new message or approval. Continue from retained tool evidence; do not replay completed actions. Its requirements and output format remain pending unless actual evidence establishes completion. A summary's completion claims cannot replace that evidence.\" };\n\t\t\t}\n\t\t}\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);"
      ],
      [
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal",
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tpreserveCurrentUserRequest: willRetry,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal"
      ],
      [
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";",
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";\nimport { q as AgentHarnessError } from \"./proxy-Bsfwfsp-.js\";"
      ],
      [
        "throw new Error(lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");",
        "throw new AgentHarnessError(\"compaction_not_needed\", lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");"
      ]
    ],
    "c20691fd7edfa9052e56d9a6530082732f1dfc3cc86949add8e6b79fbc817c7a": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ],
      [
        "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
        "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
      ],
      [
        "\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages[messages.length - 1];\n\t\t\t\tif (lastMsg?.role === \"assistant\" && lastMsg.stopReason === \"error\") this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\treturn true;\n\t\t\t}",
        "\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages.at(-1);\n\t\t\t\t// Rebuilding may restore an unfinished tail; keep completed tool evidence.\n\t\t\t\tif (lastMsg?.role === \"assistant\" && (lastMsg.stopReason === \"error\" || lastMsg.stopReason === \"length\")) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\tconst tail = this.agent.state.messages.at(-1);\n\t\t\t\t// Advertise a retry only when Agent.continue can start it. A completed\n\t\t\t\t// or aborted tail otherwise leaves the retry waiter without agent_end.\n\t\t\t\twillRetry = Boolean(tail) && (tail.role !== \"assistant\" || this.agent.hasQueuedMessages());\n\t\t\t}\n\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) return true;"
      ],
      [
        "if (assistantMsg.stopReason !== \"error\") this.overflowRecoveryAttempted = false;",
        "if (assistantMsg.stopReason !== \"error\" && assistantMsg.stopReason !== \"length\") this.overflowRecoveryAttempted = false;"
      ],
      [
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);",
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t// ODS: a summary is not authoritative about the unfinished user's request.\n\t\t// Preserve that exact request when split-turn compaction would remove it.\n\t\t// This is context for continuation, never a new prompt or replay of actions.\n\t\tif (options.preserveCurrentUserRequest) {\n\t\t\tconst userIndex = pathEntries.findLastIndex((entry) => entry.type === \"message\" && entry.message?.role === \"user\");\n\t\t\tconst keptIndex = pathEntries.findIndex((entry) => entry.id === compactionResult.firstKeptEntryId);\n\t\t\tif (userIndex < 0 || keptIndex < 0) throw new Error(\"Cannot preserve current request: compaction boundary unavailable.\");\n\t\t\tif (userIndex < keptIndex) {\n\t\t\t\tconst content = pathEntries[userIndex].message.content;\n\t\t\t\tconst textOnly = typeof content === \"string\" || Array.isArray(content) && content.every((block) => block?.type === \"text\" && typeof block.text === \"string\");\n\t\t\t\tif (!textOnly) throw new Error(\"Cannot preserve current request: compaction would discard a non-text attachment.\");\n\t\t\t\tconst encoded = JSON.stringify(content);\n\t\t\t\tif (encoded.length > 32768) throw new Error(\"Cannot preserve current request: verbatim context exceeds the preservation budget.\");\n\t\t\t\tcompactionResult = { ...compactionResult, summary: compactionResult.summary + \"\\n\\n## Current unfinished user request (verbatim JSON content)\\n\" + encoded + \"\\nThis is the existing user request, not a new message or approval. Continue from retained tool evidence; do not replay completed actions. Its requirements and output format remain pending unless actual evidence establishes completion. A summary's completion claims cannot replace that evidence.\" };\n\t\t\t}\n\t\t}\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);"
      ],
      [
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal",
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tpreserveCurrentUserRequest: willRetry,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal"
      ],
      [
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";",
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";\nimport { q as AgentHarnessError } from \"./proxy-Bsfwfsp-.js\";"
      ],
      [
        "throw new Error(lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");",
        "throw new AgentHarnessError(\"compaction_not_needed\", lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");"
      ],
      [
        "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: false"
      ],
      [
        "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: false"
      ],
      [
        "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: false"
      ]
    ],
    "f7eac1cf78abda6c2739a26b4dc09eb71201ee5a7b6c9c0566ad2bb5885b798b": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ],
      [
        "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
        "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
      ],
      [
        "\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages[messages.length - 1];\n\t\t\t\tif (lastMsg?.role === \"assistant\" && lastMsg.stopReason === \"error\") this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\treturn true;\n\t\t\t}",
        "\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages.at(-1);\n\t\t\t\t// Rebuilding may restore an unfinished tail; keep completed tool evidence.\n\t\t\t\tif (lastMsg?.role === \"assistant\" && (lastMsg.stopReason === \"error\" || lastMsg.stopReason === \"length\")) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\tconst tail = this.agent.state.messages.at(-1);\n\t\t\t\t// Advertise a retry only when Agent.continue can start it. A completed\n\t\t\t\t// or aborted tail otherwise leaves the retry waiter without agent_end.\n\t\t\t\twillRetry = Boolean(tail) && (tail.role !== \"assistant\" || this.agent.hasQueuedMessages());\n\t\t\t}\n\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) return true;"
      ],
      [
        "if (assistantMsg.stopReason !== \"error\") this.overflowRecoveryAttempted = false;",
        "if (assistantMsg.stopReason !== \"error\" && assistantMsg.stopReason !== \"length\") this.overflowRecoveryAttempted = false;"
      ],
      [
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);",
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t// ODS: a summary is not authoritative about the unfinished user's request.\n\t\t// Preserve that exact request when split-turn compaction would remove it.\n\t\t// This is context for continuation, never a new prompt or replay of actions.\n\t\tif (options.preserveCurrentUserRequest) {\n\t\t\tconst userIndex = pathEntries.findLastIndex((entry) => entry.type === \"message\" && entry.message?.role === \"user\");\n\t\t\tconst keptIndex = pathEntries.findIndex((entry) => entry.id === compactionResult.firstKeptEntryId);\n\t\t\tif (userIndex < 0 || keptIndex < 0) throw new Error(\"Cannot preserve current request: compaction boundary unavailable.\");\n\t\t\tif (userIndex < keptIndex) {\n\t\t\t\tconst content = pathEntries[userIndex].message.content;\n\t\t\t\tconst textOnly = typeof content === \"string\" || Array.isArray(content) && content.every((block) => block?.type === \"text\" && typeof block.text === \"string\");\n\t\t\t\tif (!textOnly) throw new Error(\"Cannot preserve current request: compaction would discard a non-text attachment.\");\n\t\t\t\tconst encoded = JSON.stringify(content);\n\t\t\t\tif (encoded.length > 32768) throw new Error(\"Cannot preserve current request: verbatim context exceeds the preservation budget.\");\n\t\t\t\tcompactionResult = { ...compactionResult, summary: compactionResult.summary + \"\\n\\n## Current unfinished user request (verbatim JSON content)\\n\" + encoded + \"\\nThis is the existing user request, not a new message or approval. Continue from retained tool evidence; do not replay completed actions. Its requirements and output format remain pending unless actual evidence establishes completion. A summary's completion claims cannot replace that evidence.\" };\n\t\t\t}\n\t\t}\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);"
      ],
      [
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal",
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tpreserveCurrentUserRequest: willRetry,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal"
      ],
      [
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";",
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";\nimport { q as AgentHarnessError } from \"./proxy-Bsfwfsp-.js\";"
      ],
      [
        "throw new Error(lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");",
        "throw new AgentHarnessError(\"compaction_not_needed\", lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");"
      ],
      [
        "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: false"
      ],
      [
        "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: false"
      ],
      [
        "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: false"
      ],
      [
        "async compact(customInstructions) {\n\t\treturn await this.runWithSessionWriteLock(async () => await this.compactWithSessionWriteLock(customInstructions));\n\t}\n\tasync compactWithSessionWriteLock(customInstructions) {",
        "async compact(customInstructions, odsOptions) {\n\t\treturn await this.runWithSessionWriteLock(async () => await this.compactWithSessionWriteLock(customInstructions, odsOptions));\n\t}\n\tasync compactWithSessionWriteLock(customInstructions, odsOptions) {"
      ],
      [
        "\t\t\t\tmode: \"manual\",\n\t\t\t\tsettings,",
        "\t\t\t\tmode: \"manual\",\n\t\t\t\t// ODS: only the native overflow wrapper can request pressure recovery.\n\t\t\t\todsPressureRecovery: odsOptions?.odsPressureRecovery === true,\n\t\t\t\tpreserveCurrentUserRequest: odsOptions?.odsPressureRecovery === true,\n\t\t\t\tsettings,"
      ],
      [
        "\t\tconst preparation = unwrapCoreResult(prepareCompaction$1(pathEntries, options.settings));",
        "\t\tlet preparation = unwrapCoreResult(prepareCompaction$1(pathEntries, options.settings));\n\t\t// ODS: fixed prompt overhead can overflow while the recent-token target\n\t\t// retains a whole short turn. Retry preparation once at half that target,\n\t\t// using native cut points; do not retry a provider or change model limits.\n\t\tif (!preparation && options.odsPressureRecovery === true && Number.isSafeInteger(options.settings.keepRecentTokens) && options.settings.keepRecentTokens > 512) {\n\t\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t\tpreparation = unwrapCoreResult(prepareCompaction$1(pathEntries, {\n\t\t\t\t...options.settings,\n\t\t\t\tkeepRecentTokens: Math.max(512, Math.floor(options.settings.keepRecentTokens / 2))\n\t\t\t}));\n\t\t}"
      ]
    ],
    "2b48e6d76d9b5d3d2b80cc26211e80b165b6109de9665726646dffe65e468367": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ],
      [
        "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
        "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
      ],
      [
        "\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages[messages.length - 1];\n\t\t\t\tif (lastMsg?.role === \"assistant\" && lastMsg.stopReason === \"error\") this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\treturn true;\n\t\t\t}",
        "\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages.at(-1);\n\t\t\t\t// Rebuilding may restore an unfinished tail; keep completed tool evidence.\n\t\t\t\tif (lastMsg?.role === \"assistant\" && (lastMsg.stopReason === \"error\" || lastMsg.stopReason === \"length\")) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\tconst tail = this.agent.state.messages.at(-1);\n\t\t\t\t// Advertise a retry only when Agent.continue can start it. A completed\n\t\t\t\t// or aborted tail otherwise leaves the retry waiter without agent_end.\n\t\t\t\twillRetry = Boolean(tail) && (tail.role !== \"assistant\" || this.agent.hasQueuedMessages());\n\t\t\t}\n\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) return true;"
      ],
      [
        "if (assistantMsg.stopReason !== \"error\") this.overflowRecoveryAttempted = false;",
        "if (assistantMsg.stopReason !== \"error\" && assistantMsg.stopReason !== \"length\") this.overflowRecoveryAttempted = false;"
      ],
      [
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);",
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t// ODS: a summary is not authoritative about the unfinished user's request.\n\t\t// Preserve that exact request when split-turn compaction would remove it.\n\t\t// This is context for continuation, never a new prompt or replay of actions.\n\t\tif (options.preserveCurrentUserRequest) {\n\t\t\tconst userIndex = pathEntries.findLastIndex((entry) => entry.type === \"message\" && entry.message?.role === \"user\");\n\t\t\tconst keptIndex = pathEntries.findIndex((entry) => entry.id === compactionResult.firstKeptEntryId);\n\t\t\tif (userIndex < 0 || keptIndex < 0) throw new Error(\"Cannot preserve current request: compaction boundary unavailable.\");\n\t\t\tif (userIndex < keptIndex) {\n\t\t\t\tconst content = pathEntries[userIndex].message.content;\n\t\t\t\tconst textOnly = typeof content === \"string\" || Array.isArray(content) && content.every((block) => block?.type === \"text\" && typeof block.text === \"string\");\n\t\t\t\tif (!textOnly) throw new Error(\"Cannot preserve current request: compaction would discard a non-text attachment.\");\n\t\t\t\tconst encoded = JSON.stringify(content);\n\t\t\t\tif (encoded.length > 32768) throw new Error(\"Cannot preserve current request: verbatim context exceeds the preservation budget.\");\n\t\t\t\tcompactionResult = { ...compactionResult, summary: compactionResult.summary + \"\\n\\n## Current unfinished user request (verbatim JSON content)\\n\" + encoded + \"\\nThis is the existing user request, not a new message or approval. Continue from retained tool evidence; do not replay completed actions. Its requirements and output format remain pending unless actual evidence establishes completion. A summary's completion claims cannot replace that evidence.\" };\n\t\t\t}\n\t\t}\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);"
      ],
      [
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal",
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tpreserveCurrentUserRequest: willRetry,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal"
      ],
      [
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";",
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";\nimport { q as AgentHarnessError } from \"./proxy-Bsfwfsp-.js\";"
      ],
      [
        "throw new Error(lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");",
        "throw new AgentHarnessError(\"compaction_not_needed\", lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");"
      ],
      [
        "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: false"
      ],
      [
        "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: false"
      ],
      [
        "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: false"
      ],
      [
        "function getNotFoundError(path, editIndex, totalEdits) {\n\tif (totalEdits === 1) return /* @__PURE__ */ new Error(`Could not find the exact text in ${path}. The old text must match exactly including all whitespace and newlines.`);\n\treturn /* @__PURE__ */ new Error(`Could not find edits[${editIndex}] in ${path}. The oldText must match exactly including all whitespace and newlines.`);\n}",
        "function getNotFoundError(path, editIndex, totalEdits) {\n\t// ODS: keep the native mismatch failure; provide safe recovery without unmasking.\n\tconst recovery = \" The edit did not apply. Read output may contain redacted values. Never use redaction placeholders (ellipsis or ***) as oldText or guess hidden values. For the already-authorized change, use small, unique unredacted anchors and preserve unrelated masked content. If that is not possible, report the limitation instead of overwriting the file or claiming it was repaired.\";\n\tif (totalEdits === 1) return /* @__PURE__ */ new Error(`Could not find the exact text in ${path}. The old text must match exactly including all whitespace and newlines.${recovery}`);\n\treturn /* @__PURE__ */ new Error(`Could not find edits[${editIndex}] in ${path}. The oldText must match exactly including all whitespace and newlines.${recovery}`);\n}"
      ]
    ],
    "bd5d49b53da38bd22a46144d8f0f1a2be7cd94b3b669f6d29d898be9fb7591c0": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ],
      [
        "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
        "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
      ],
      [
        "\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages[messages.length - 1];\n\t\t\t\tif (lastMsg?.role === \"assistant\" && lastMsg.stopReason === \"error\") this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\treturn true;\n\t\t\t}",
        "\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages.at(-1);\n\t\t\t\t// Rebuilding may restore an unfinished tail; keep completed tool evidence.\n\t\t\t\tif (lastMsg?.role === \"assistant\" && (lastMsg.stopReason === \"error\" || lastMsg.stopReason === \"length\")) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\tconst tail = this.agent.state.messages.at(-1);\n\t\t\t\t// Advertise a retry only when Agent.continue can start it. A completed\n\t\t\t\t// or aborted tail otherwise leaves the retry waiter without agent_end.\n\t\t\t\twillRetry = Boolean(tail) && (tail.role !== \"assistant\" || this.agent.hasQueuedMessages());\n\t\t\t}\n\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) return true;"
      ],
      [
        "if (assistantMsg.stopReason !== \"error\") this.overflowRecoveryAttempted = false;",
        "if (assistantMsg.stopReason !== \"error\" && assistantMsg.stopReason !== \"length\") this.overflowRecoveryAttempted = false;"
      ],
      [
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);",
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t// ODS: a summary is not authoritative about the unfinished user's request.\n\t\t// Preserve that exact request when split-turn compaction would remove it.\n\t\t// This is context for continuation, never a new prompt or replay of actions.\n\t\tif (options.preserveCurrentUserRequest) {\n\t\t\tconst userIndex = pathEntries.findLastIndex((entry) => entry.type === \"message\" && entry.message?.role === \"user\");\n\t\t\tconst keptIndex = pathEntries.findIndex((entry) => entry.id === compactionResult.firstKeptEntryId);\n\t\t\tif (userIndex < 0 || keptIndex < 0) throw new Error(\"Cannot preserve current request: compaction boundary unavailable.\");\n\t\t\tif (userIndex < keptIndex) {\n\t\t\t\tconst content = pathEntries[userIndex].message.content;\n\t\t\t\tconst textOnly = typeof content === \"string\" || Array.isArray(content) && content.every((block) => block?.type === \"text\" && typeof block.text === \"string\");\n\t\t\t\tif (!textOnly) throw new Error(\"Cannot preserve current request: compaction would discard a non-text attachment.\");\n\t\t\t\tconst encoded = JSON.stringify(content);\n\t\t\t\tif (encoded.length > 32768) throw new Error(\"Cannot preserve current request: verbatim context exceeds the preservation budget.\");\n\t\t\t\tcompactionResult = { ...compactionResult, summary: compactionResult.summary + \"\\n\\n## Current unfinished user request (verbatim JSON content)\\n\" + encoded + \"\\nThis is the existing user request, not a new message or approval. Continue from retained tool evidence; do not replay completed actions. Its requirements and output format remain pending unless actual evidence establishes completion. A summary's completion claims cannot replace that evidence.\" };\n\t\t\t}\n\t\t}\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);"
      ],
      [
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal",
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tpreserveCurrentUserRequest: willRetry,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal"
      ],
      [
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";",
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";\nimport { q as AgentHarnessError } from \"./proxy-Bsfwfsp-.js\";"
      ],
      [
        "throw new Error(lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");",
        "throw new AgentHarnessError(\"compaction_not_needed\", lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");"
      ],
      [
        "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: false"
      ],
      [
        "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: false"
      ],
      [
        "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: false"
      ],
      [
        "async compact(customInstructions) {\n\t\treturn await this.runWithSessionWriteLock(async () => await this.compactWithSessionWriteLock(customInstructions));\n\t}\n\tasync compactWithSessionWriteLock(customInstructions) {",
        "async compact(customInstructions, odsOptions) {\n\t\treturn await this.runWithSessionWriteLock(async () => await this.compactWithSessionWriteLock(customInstructions, odsOptions));\n\t}\n\tasync compactWithSessionWriteLock(customInstructions, odsOptions) {"
      ],
      [
        "\t\t\t\tmode: \"manual\",\n\t\t\t\tsettings,",
        "\t\t\t\tmode: \"manual\",\n\t\t\t\t// ODS: only the native overflow wrapper can request pressure recovery.\n\t\t\t\todsPressureRecovery: odsOptions?.odsPressureRecovery === true,\n\t\t\t\tpreserveCurrentUserRequest: odsOptions?.odsPressureRecovery === true,\n\t\t\t\tsettings,"
      ],
      [
        "\t\tconst preparation = unwrapCoreResult(prepareCompaction$1(pathEntries, options.settings));",
        "\t\tlet preparation = unwrapCoreResult(prepareCompaction$1(pathEntries, options.settings));\n\t\t// ODS: fixed prompt overhead can overflow while the recent-token target\n\t\t// retains a whole short turn. Retry preparation once at half that target,\n\t\t// using native cut points; do not retry a provider or change model limits.\n\t\tif (!preparation && options.odsPressureRecovery === true && Number.isSafeInteger(options.settings.keepRecentTokens) && options.settings.keepRecentTokens > 512) {\n\t\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t\tpreparation = unwrapCoreResult(prepareCompaction$1(pathEntries, {\n\t\t\t\t...options.settings,\n\t\t\t\tkeepRecentTokens: Math.max(512, Math.floor(options.settings.keepRecentTokens / 2))\n\t\t\t}));\n\t\t}"
      ],
      [
        "function getNotFoundError(path, editIndex, totalEdits) {\n\tif (totalEdits === 1) return /* @__PURE__ */ new Error(`Could not find the exact text in ${path}. The old text must match exactly including all whitespace and newlines.`);\n\treturn /* @__PURE__ */ new Error(`Could not find edits[${editIndex}] in ${path}. The oldText must match exactly including all whitespace and newlines.`);\n}",
        "function getNotFoundError(path, editIndex, totalEdits) {\n\t// ODS: keep the native mismatch failure; provide safe recovery without unmasking.\n\tconst recovery = \" The edit did not apply. Read output may contain redacted values. Never use redaction placeholders (ellipsis or ***) as oldText or guess hidden values. For the already-authorized change, use small, unique unredacted anchors and preserve unrelated masked content. If that is not possible, report the limitation instead of overwriting the file or claiming it was repaired.\";\n\tif (totalEdits === 1) return /* @__PURE__ */ new Error(`Could not find the exact text in ${path}. The old text must match exactly including all whitespace and newlines.${recovery}`);\n\treturn /* @__PURE__ */ new Error(`Could not find edits[${editIndex}] in ${path}. The oldText must match exactly including all whitespace and newlines.${recovery}`);\n}"
      ]
    ],
    "2ed455d316abd10fe9c185590aad1abb58f45b7870f3afffc635eea7711638fd": [
      [
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) return await this.runAutoCompaction(\"threshold\", false);",
        "\t\tif (shouldCompact(contextTokens, contextWindow, settings)) {\n\t\t\t// ODS: a token-truncated tool turn is unfinished, not a final answer.\n\t\t\t// Continue the compacted session once; never replay the owner's prompt.\n\t\t\tconst resumeTruncated = sameModel && assistantMessage.stopReason === \"length\" && !this.overflowRecoveryAttempted;\n\t\t\tif (resumeTruncated) {\n\t\t\t\tthis.overflowRecoveryAttempted = true;\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tif (messages.at(-1) === assistantMessage) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t}\n\t\t\treturn await this.runAutoCompaction(\"threshold\", resumeTruncated);\n\t\t}"
      ],
      [
        "\t\tif (sameModel && isContextOverflow(assistantMessage, contextWindow)) {",
        "\t\t// The transport can stop inside a tool loop before provider overflow.\n\t\t// Recover through the same bounded path, preserving completed tool work.\n\t\tconst toolLoopOverflow = assistantMessage.stopReason === \"error\" && assistantMessage.errorMessage === \"Context overflow: estimated context size exceeds safe threshold during tool loop.\";\n\t\tif (sameModel && (isContextOverflow(assistantMessage, contextWindow) || toolLoopOverflow)) {"
      ],
      [
        "\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages[messages.length - 1];\n\t\t\t\tif (lastMsg?.role === \"assistant\" && lastMsg.stopReason === \"error\") this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\treturn true;\n\t\t\t}",
        "\t\t\tif (willRetry) {\n\t\t\t\tconst messages = this.agent.state.messages;\n\t\t\t\tconst lastMsg = messages.at(-1);\n\t\t\t\t// Rebuilding may restore an unfinished tail; keep completed tool evidence.\n\t\t\t\tif (lastMsg?.role === \"assistant\" && (lastMsg.stopReason === \"error\" || lastMsg.stopReason === \"length\")) this.agent.state.messages = messages.slice(0, -1);\n\t\t\t\tconst tail = this.agent.state.messages.at(-1);\n\t\t\t\t// Advertise a retry only when Agent.continue can start it. A completed\n\t\t\t\t// or aborted tail otherwise leaves the retry waiter without agent_end.\n\t\t\t\twillRetry = Boolean(tail) && (tail.role !== \"assistant\" || this.agent.hasQueuedMessages());\n\t\t\t}\n\t\t\tthis.emit({\n\t\t\t\ttype: \"compaction_end\",\n\t\t\t\treason,\n\t\t\t\tresult: outcome.result,\n\t\t\t\taborted: false,\n\t\t\t\twillRetry\n\t\t\t});\n\t\t\tif (willRetry) return true;"
      ],
      [
        "if (assistantMsg.stopReason !== \"error\") this.overflowRecoveryAttempted = false;",
        "if (assistantMsg.stopReason !== \"error\" && assistantMsg.stopReason !== \"length\") this.overflowRecoveryAttempted = false;"
      ],
      [
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);",
        "\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t// ODS: a summary is not authoritative about the unfinished user's request.\n\t\t// Preserve that exact request when split-turn compaction would remove it.\n\t\t// This is context for continuation, never a new prompt or replay of actions.\n\t\tif (options.preserveCurrentUserRequest) {\n\t\t\tconst userIndex = pathEntries.findLastIndex((entry) => entry.type === \"message\" && entry.message?.role === \"user\");\n\t\t\tconst keptIndex = pathEntries.findIndex((entry) => entry.id === compactionResult.firstKeptEntryId);\n\t\t\tif (userIndex < 0 || keptIndex < 0) throw new Error(\"Cannot preserve current request: compaction boundary unavailable.\");\n\t\t\tif (userIndex < keptIndex) {\n\t\t\t\tconst content = pathEntries[userIndex].message.content;\n\t\t\t\tconst textOnly = typeof content === \"string\" || Array.isArray(content) && content.every((block) => block?.type === \"text\" && typeof block.text === \"string\");\n\t\t\t\tif (!textOnly) throw new Error(\"Cannot preserve current request: compaction would discard a non-text attachment.\");\n\t\t\t\tconst encoded = JSON.stringify(content);\n\t\t\t\tif (encoded.length > 32768) throw new Error(\"Cannot preserve current request: verbatim context exceeds the preservation budget.\");\n\t\t\t\tcompactionResult = { ...compactionResult, summary: compactionResult.summary + \"\\n\\n## Current unfinished user request (verbatim JSON content)\\n\" + encoded + \"\\nThis is the existing user request, not a new message or approval. Continue from retained tool evidence; do not replay completed actions. Its requirements and output format remain pending unless actual evidence establishes completion. A summary's completion claims cannot replace that evidence.\" };\n\t\t\t}\n\t\t}\n\t\tthis.sessionManager.appendCompaction(compactionResult.summary, compactionResult.firstKeptEntryId, compactionResult.tokensBefore, compactionResult.details, fromExtension);"
      ],
      [
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal",
        "\t\t\t\tmode: \"auto\",\n\t\t\t\tsettings,\n\t\t\t\tpreserveCurrentUserRequest: willRetry,\n\t\t\t\tsignal: this.autoCompactionAbortController.signal"
      ],
      [
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";",
        "import { A as getLastAssistantUsage, C as calculateContextTokens, D as findCutPoint, E as estimateTokens, H as convertToLlm, M as shouldCompact, N as serializeConversation, O as findTurnStartIndex, S as DEFAULT_COMPACTION_SETTINGS, T as estimateContextTokens, _ as substituteArgs, a as formatSize, b as generateBranchSummary$1, c as truncateTail, g as parseCommandArgs, j as prepareCompaction$1, k as generateSummary$1, n as DEFAULT_MAX_BYTES, o as truncateHead, r as DEFAULT_MAX_LINES, s as truncateLine, w as compact$1, x as prepareBranchEntries, y as collectEntriesForBranchSummaryFromBranches } from \"./proxy-Bsfwfsp-.js\";\nimport { q as AgentHarnessError } from \"./proxy-Bsfwfsp-.js\";"
      ],
      [
        "throw new Error(lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");",
        "throw new AgentHarnessError(\"compaction_not_needed\", lastEntry?.type === \"compaction\" ? \"Already compacted\" : \"Nothing to compact (session too small)\");"
      ],
      [
        "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The file already has identical content.`, void 0),\n\t\t\t\t\tterminate: false"
      ],
      [
        "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The replacement text is identical to the original.`, void 0),\n\t\t\t\t\t\tterminate: false"
      ],
      [
        "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: true",
        "...textResult(`No changes made to ${path}. The replacement produced identical content.`, void 0),\n\t\t\t\t\t\tterminate: false"
      ],
      [
        "async compact(customInstructions) {\n\t\treturn await this.runWithSessionWriteLock(async () => await this.compactWithSessionWriteLock(customInstructions));\n\t}\n\tasync compactWithSessionWriteLock(customInstructions) {",
        "async compact(customInstructions, odsOptions) {\n\t\treturn await this.runWithSessionWriteLock(async () => await this.compactWithSessionWriteLock(customInstructions, odsOptions));\n\t}\n\tasync compactWithSessionWriteLock(customInstructions, odsOptions) {"
      ],
      [
        "\t\t\t\tmode: \"manual\",\n\t\t\t\tsettings,",
        "\t\t\t\tmode: \"manual\",\n\t\t\t\t// ODS: only the native overflow wrapper can request pressure recovery.\n\t\t\t\todsPressureRecovery: odsOptions?.odsPressureRecovery === true,\n\t\t\t\tpreserveCurrentUserRequest: odsOptions?.odsPressureRecovery === true,\n\t\t\t\tsettings,"
      ],
      [
        "\t\tconst preparation = unwrapCoreResult(prepareCompaction$1(pathEntries, options.settings));",
        "\t\tlet preparation = unwrapCoreResult(prepareCompaction$1(pathEntries, options.settings));\n\t\t// ODS: fixed prompt overhead can overflow while the recent-token target\n\t\t// retains a whole short turn. Retry preparation once at half that target,\n\t\t// using native cut points; do not retry a provider or change model limits.\n\t\tif (!preparation && options.odsPressureRecovery === true && Number.isSafeInteger(options.settings.keepRecentTokens) && options.settings.keepRecentTokens > 512) {\n\t\t\tif (options.signal.aborted) return { status: \"aborted\" };\n\t\t\tpreparation = unwrapCoreResult(prepareCompaction$1(pathEntries, {\n\t\t\t\t...options.settings,\n\t\t\t\tkeepRecentTokens: Math.max(512, Math.floor(options.settings.keepRecentTokens / 2))\n\t\t\t}));\n\t\t}"
      ],
      [
        "function getNotFoundError(path, editIndex, totalEdits) {\n\tif (totalEdits === 1) return /* @__PURE__ */ new Error(`Could not find the exact text in ${path}. The old text must match exactly including all whitespace and newlines.`);\n\treturn /* @__PURE__ */ new Error(`Could not find edits[${editIndex}] in ${path}. The oldText must match exactly including all whitespace and newlines.`);\n}",
        "function getNotFoundError(path, editIndex, totalEdits) {\n\t// ODS: keep the native mismatch failure; provide safe recovery without unmasking.\n\tconst recovery = \" The edit did not apply. Read output may contain redacted values. Never use redaction placeholders (ellipsis or ***) as oldText or guess hidden values. For the already-authorized change, use small, unique unredacted anchors and preserve unrelated masked content. If that is not possible, report the limitation instead of overwriting the file or claiming it was repaired.\";\n\tif (totalEdits === 1) return /* @__PURE__ */ new Error(`Could not find the exact text in ${path}. The old text must match exactly including all whitespace and newlines.${recovery}`);\n\treturn /* @__PURE__ */ new Error(`Could not find edits[${editIndex}] in ${path}. The oldText must match exactly including all whitespace and newlines.${recovery}`);\n}"
      ],
      [
        "import * as Diff from \"diff\";",
        "import * as Diff from \"diff\";\nimport { u as odsRedactEditRetry } from \"./redact-cvFSPoXf.js\";"
      ],
      [
        "function getNotFoundError(path, editIndex, totalEdits) {",
        "function odsSafeEditRetry(content, edits) {\n\t// Diagnostics only: derive suggestions from the rejected request, never reveal\n\t// file context or infer masked text. Every later edit still uses native guards.\n\ttry {\n\t\tif (edits?.length !== 1 || content.length > 1048576) return \"\";\n\t\tconst { oldText, newText } = edits[0];\n\t\tconst masked = (text) => /\\u2026|\\*{3}|\\.{3}|\\[REDACTED\\]/i.test(text);\n\t\tif (!masked(oldText) || oldText.length + newText.length > 32768\n\t\t\t|| oldText.split(\"\\n\").length > 256 || newText.split(\"\\n\").length > 256) return \"\";\n\t\t// Bind the entire rejected block to one current location. Repeated native\n\t\t// masking normalizes hinted and fully masked receipts without guessing a value.\n\t\tconst project = (text) => odsRedactEditRetry(odsRedactEditRetry(text));\n\t\tconst projected = project(content), requested = project(oldText);\n\t\tif (projected.split(\"\\n\").length !== content.split(\"\\n\").length\n\t\t\t|| requested.split(\"\\n\").length !== oldText.split(\"\\n\").length) return \"\";\n\t\tconst block = projected.indexOf(requested), end = block + requested.length;\n\t\tif (block < 0 || projected.indexOf(requested, block + 1) >= 0\n\t\t\t|| block > 0 && projected[block - 1] !== \"\\n\"\n\t\t\t|| end < projected.length && projected[end - 1] !== \"\\n\" && projected[end] !== \"\\n\") return \"\";\n\t\tconst startLine = projected.slice(0, block).split(\"\\n\").length - 1;\n\t\tconst lineCount = oldText.split(\"\\n\").length - (oldText.endsWith(\"\\n\") ? 1 : 0);\n\t\tconst lines = content.split(\"\\n\");\n\t\tconst blockStart = lines.slice(0, startLine).join(\"\\n\").length + (startLine > 0 ? 1 : 0);\n\t\tconst blockEnd = blockStart + lines.slice(startLine, startLine + lineCount).join(\"\\n\").length + (oldText.endsWith(\"\\n\") ? 1 : 0);\n\t\tconst parts = Diff.diffLines(oldText, newText, { maxEditLength: 128, timeout: 25 });\n\t\tif (!parts) return \"\";\n\t\tconst proposals = [];\n\t\tlet omitted = 0;\n\t\tfor (let i = 0; i < parts.length; i++) {\n\t\t\tconst part = parts[i];\n\t\t\tif (!part.removed && !part.added) continue;\n\t\t\tconst before = part.removed ? part.value : \"\";\n\t\t\tconst after = part.removed && parts[i + 1]?.added ? parts[++i].value : part.added ? part.value : \"\";\n\t\t\tconst offset = before ? content.indexOf(before) : -1;\n\t\t\tif (!before.trim() || masked(before) || masked(after)\n\t\t\t\t|| odsRedactEditRetry(before) !== before || odsRedactEditRetry(after) !== after\n\t\t\t\t|| offset < 0 || content.indexOf(before, offset + 1) >= 0\n\t\t\t\t|| offset < blockStart || offset + before.length > blockEnd\n\t\t\t\t|| countOccurrences(content, before) !== 1) {\n\t\t\t\tomitted++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tproposals.push({ oldText: before, newText: after, offset });\n\t\t}\n\t\tif (!proposals.length || proposals.length > 8) return \"\";\n\t\tconst ranges = [...proposals].sort((a, b) => a.offset - b.offset);\n\t\tif (ranges.some((value, i) => i > 0 && ranges[i - 1].offset + ranges[i - 1].oldText.length > value.offset)) return \"\";\n\t\tconst payload = JSON.stringify({ edits: proposals.map(({ oldText, newText }) => ({ oldText, newText })) });\n\t\tif (payload.length > 8192) return \"\";\n\t\treturn ` No edit was applied. For the same path, these requested changes have unique unredacted anchors in the current file. If still authorized, retry edit with this edits array: ${payload}. This is a partial retry: ${omitted} changed block(s) were omitted because no safe exact anchor was available. Preserve masked content and verify the remaining task; do not report the whole request complete from this suggestion.`;\n\t} catch {\n\t\t// Optional guidance must never replace or bypass the original failure.\n\t\treturn \"\";\n\t}\n}\nfunction getNotFoundError(path, editIndex, totalEdits) {"
      ],
      [
        "\t\tif (!matchResult.found) throw getNotFoundError(path, i, normalizedEdits.length);",
        "\t\tif (!matchResult.found) {\n\t\t\tconst error = getNotFoundError(path, i, normalizedEdits.length);\n\t\t\terror.message += odsSafeEditRetry(normalizedContent, normalizedEdits);\n\t\t\tthrow error;\n\t\t}"
      ]
    ]
  }
}