zidane 5.9.18 → 5.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/{agent-CYPEZ9i3.d.ts → agent-AnumGPWj.d.ts} +24 -8
  2. package/dist/{agent-CYPEZ9i3.d.ts.map → agent-AnumGPWj.d.ts.map} +1 -1
  3. package/dist/chat/pure.d.ts +3 -3
  4. package/dist/chat/pure.js +1 -1
  5. package/dist/chat.d.ts +6 -6
  6. package/dist/chat.d.ts.map +1 -1
  7. package/dist/chat.js +3 -3
  8. package/dist/{contexts-BD2U_xpi.js → contexts-CbI8dRfI.js} +25 -7
  9. package/dist/contexts-CbI8dRfI.js.map +1 -0
  10. package/dist/contexts.js +1 -1
  11. package/dist/{edit-utils-eeS8-F2k.js → edit-utils-EGosADZq.js} +20 -4
  12. package/dist/edit-utils-EGosADZq.js.map +1 -0
  13. package/dist/eval.d.ts +1 -1
  14. package/dist/eval.js +6 -7
  15. package/dist/eval.js.map +1 -1
  16. package/dist/{fetch-url-D0M3oft5.js → fetch-url-BUozXjZR.js} +29 -13
  17. package/dist/fetch-url-BUozXjZR.js.map +1 -0
  18. package/dist/{headless-D0yusQui.js → headless-D0qfvzG9.js} +11 -8
  19. package/dist/headless-D0qfvzG9.js.map +1 -0
  20. package/dist/headless.d.ts +1 -1
  21. package/dist/headless.js +1 -1
  22. package/dist/{index-BangznMk.d.ts → index-DsvHiyYU.d.ts} +44 -5
  23. package/dist/index-DsvHiyYU.d.ts.map +1 -0
  24. package/dist/{index-DutpkJJ7.d.ts → index-LX8KCBXU.d.ts} +27 -13
  25. package/dist/index-LX8KCBXU.d.ts.map +1 -0
  26. package/dist/index.d.ts +4 -4
  27. package/dist/index.js +27 -19
  28. package/dist/index.js.map +1 -1
  29. package/dist/{interpolate-CmcrnzDZ.js → interpolate-DwVIJpB3.js} +57 -8
  30. package/dist/interpolate-DwVIJpB3.js.map +1 -0
  31. package/dist/{login-WeATNRoo.js → login-DocBwMVo.js} +4 -4
  32. package/dist/{login-WeATNRoo.js.map → login-DocBwMVo.js.map} +1 -1
  33. package/dist/{mcp-BF_Md0r5.js → mcp-DzuTfq-I.js} +25 -11
  34. package/dist/mcp-DzuTfq-I.js.map +1 -0
  35. package/dist/mcp.d.ts +1 -1
  36. package/dist/mcp.js +1 -1
  37. package/dist/{messages-wOJ8LTs0.js → messages-DdfOKKx_.js} +55 -17
  38. package/dist/messages-DdfOKKx_.js.map +1 -0
  39. package/dist/output/stream-json.d.ts +2 -2
  40. package/dist/output/stream-json.d.ts.map +1 -1
  41. package/dist/output/stream-json.js +1 -1
  42. package/dist/output/stream-json.js.map +1 -1
  43. package/dist/output/terminal.d.ts +11 -3
  44. package/dist/output/terminal.d.ts.map +1 -1
  45. package/dist/output/terminal.js +33 -16
  46. package/dist/output/terminal.js.map +1 -1
  47. package/dist/{presets-DQRxHLX1.js → presets-CTNbWXWz.js} +7 -5
  48. package/dist/presets-CTNbWXWz.js.map +1 -0
  49. package/dist/presets.d.ts +2 -2
  50. package/dist/presets.js +1 -1
  51. package/dist/{providers-BcR0maEr.js → providers-BxHepM_P.js} +177 -54
  52. package/dist/providers-BxHepM_P.js.map +1 -0
  53. package/dist/providers.d.ts +1 -1
  54. package/dist/providers.js +2 -2
  55. package/dist/{read-state-DMHYFRR9.js → read-state-CDVYj7q-.js} +17 -10
  56. package/dist/read-state-CDVYj7q-.js.map +1 -0
  57. package/dist/restate.d.ts +20 -6
  58. package/dist/restate.d.ts.map +1 -1
  59. package/dist/restate.js +2 -2
  60. package/dist/restate.js.map +1 -1
  61. package/dist/session/sqlite.d.ts +1 -1
  62. package/dist/session/sqlite.d.ts.map +1 -1
  63. package/dist/session/sqlite.js +6 -1
  64. package/dist/session/sqlite.js.map +1 -1
  65. package/dist/{session-z0E9-e4b.js → session-C0uGIWm_.js} +32 -17
  66. package/dist/session-C0uGIWm_.js.map +1 -0
  67. package/dist/session.d.ts +1 -1
  68. package/dist/session.js +2 -2
  69. package/dist/skills.d.ts +3 -3
  70. package/dist/skills.js +2 -2
  71. package/dist/skills.js.map +1 -1
  72. package/dist/{tool-formatters-COxisyPk.d.ts → tool-formatters-5nr1eXPn.d.ts} +2 -2
  73. package/dist/{tool-formatters-COxisyPk.d.ts.map → tool-formatters-5nr1eXPn.d.ts.map} +1 -1
  74. package/dist/tools/fetch-url.d.ts +8 -2
  75. package/dist/tools/fetch-url.d.ts.map +1 -1
  76. package/dist/tools/fetch-url.js +1 -1
  77. package/dist/tools/web-search.d.ts +1 -1
  78. package/dist/tools/web-search.d.ts.map +1 -1
  79. package/dist/tools/web-search.js +9 -2
  80. package/dist/tools/web-search.js.map +1 -1
  81. package/dist/{tools-Cjxkfh-F.js → tools-ycHDeHBZ.js} +281 -112
  82. package/dist/tools-ycHDeHBZ.js.map +1 -0
  83. package/dist/tools.d.ts +2 -2
  84. package/dist/tools.js +2 -2
  85. package/dist/{transcript-anchors-BkXXxUlW.js → transcript-anchors-D6Sw-Gzk.js} +44 -13
  86. package/dist/transcript-anchors-D6Sw-Gzk.js.map +1 -0
  87. package/dist/{transcript-anchors-D7Nc5Rmy.d.ts → transcript-anchors-DezrH1sp.d.ts} +28 -15
  88. package/dist/transcript-anchors-DezrH1sp.d.ts.map +1 -0
  89. package/dist/tui.d.ts +3 -3
  90. package/dist/tui.js +23 -18
  91. package/dist/tui.js.map +1 -1
  92. package/dist/{turn-operations-DS1-Y50b.js → turn-operations-C70p-7Nn.js} +2 -2
  93. package/dist/{turn-operations-DS1-Y50b.js.map → turn-operations-C70p-7Nn.js.map} +1 -1
  94. package/dist/{turn-operations-BzYtF4E8.d.ts → turn-operations-CICEEhrU.d.ts} +8 -3
  95. package/dist/turn-operations-CICEEhrU.d.ts.map +1 -0
  96. package/dist/types.d.ts +2 -2
  97. package/package.json +45 -45
  98. package/dist/contexts-BD2U_xpi.js.map +0 -1
  99. package/dist/edit-utils-eeS8-F2k.js.map +0 -1
  100. package/dist/fetch-url-D0M3oft5.js.map +0 -1
  101. package/dist/headless-D0yusQui.js.map +0 -1
  102. package/dist/index-BangznMk.d.ts.map +0 -1
  103. package/dist/index-DutpkJJ7.d.ts.map +0 -1
  104. package/dist/interpolate-CmcrnzDZ.js.map +0 -1
  105. package/dist/mcp-BF_Md0r5.js.map +0 -1
  106. package/dist/messages-wOJ8LTs0.js.map +0 -1
  107. package/dist/presets-DQRxHLX1.js.map +0 -1
  108. package/dist/providers-BcR0maEr.js.map +0 -1
  109. package/dist/read-state-DMHYFRR9.js.map +0 -1
  110. package/dist/session-z0E9-e4b.js.map +0 -1
  111. package/dist/tools-Cjxkfh-F.js.map +0 -1
  112. package/dist/transcript-anchors-BkXXxUlW.js.map +0 -1
  113. package/dist/transcript-anchors-D7Nc5Rmy.d.ts.map +0 -1
  114. package/dist/turn-operations-BzYtF4E8.d.ts.map +0 -1
package/dist/contexts.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as createProcessContext, t as createSandboxContext } from "./contexts-BD2U_xpi.js";
1
+ import { n as createProcessContext, t as createSandboxContext } from "./contexts-CbI8dRfI.js";
2
2
  export { createProcessContext, createSandboxContext };
@@ -126,7 +126,7 @@ function resolveOldString(haystack, needle) {
126
126
  const desan = desanitize(needle);
127
127
  if (desan !== needle) {
128
128
  const desanCount = countExactMatches(haystack, desan);
129
- if (desanCount > 0) return {
129
+ if (desanCount === 1) return {
130
130
  actual: desan,
131
131
  occurrences: desanCount,
132
132
  via: "desanitize"
@@ -135,7 +135,7 @@ function resolveOldString(haystack, needle) {
135
135
  const combo = desanitize(normNeedle);
136
136
  if (combo !== needle) {
137
137
  const m = locateAndCount(haystack, normFile, combo, "quotes+desanitize");
138
- if (m) return m;
138
+ if (m && m.occurrences === 1) return m;
139
139
  }
140
140
  const stripped = stripLineNumberPrefixes(needle);
141
141
  if (stripped !== needle && stripped.trim().length > 0) {
@@ -154,6 +154,22 @@ function resolveOldString(haystack, needle) {
154
154
  return null;
155
155
  }
156
156
  /**
157
+ * Short human-readable label for a recovery path, used by `edit` /
158
+ * `multi_edit` to flag non-exact matches in their result messages — when a
159
+ * fallback mistargets, the model (and the user reading the transcript) can
160
+ * see WHICH transform fired instead of silently trusting the edit.
161
+ */
162
+ function describeVia(via) {
163
+ switch (via) {
164
+ case "exact": return "exact match";
165
+ case "quotes": return "curly-quote normalization";
166
+ case "desanitize": return "sanitization recovery (e.g. <n> → <name>)";
167
+ case "quotes+desanitize": return "sanitization recovery + curly-quote normalization";
168
+ case "line-numbers": return "line-number-prefix stripping";
169
+ case "quotes+line-numbers": return "line-number-prefix stripping + curly-quote normalization";
170
+ }
171
+ }
172
+ /**
157
173
  * Apply the same recovery transforms used to find `old_string` to
158
174
  * `new_string`, so the file gets back its native form: desanitize when
159
175
  * the model emitted `<n>` for `<name>`, strip line-number prefixes when
@@ -213,6 +229,6 @@ function isOpeningContext(chars, i) {
213
229
  return prev === " " || prev === " " || prev === "\n" || prev === "\r" || prev === "(" || prev === "[" || prev === "{" || prev === "—" || prev === "–";
214
230
  }
215
231
  //#endregion
216
- export { stripLineNumberPrefixes as n, styleReplacementForVia as r, resolveOldString as t };
232
+ export { styleReplacementForVia as i, resolveOldString as n, stripLineNumberPrefixes as r, describeVia as t };
217
233
 
218
- //# sourceMappingURL=edit-utils-eeS8-F2k.js.map
234
+ //# sourceMappingURL=edit-utils-EGosADZq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit-utils-EGosADZq.js","names":[],"sources":["../src/tools/edit-utils.ts"],"sourcesContent":["/**\n * Internal helpers shared between the `edit` and `multi_edit` tools.\n *\n * Not part of the public API — intentionally not re-exported from `tools/index.ts`\n * or the package barrel.\n */\n\n/**\n * Count exact (non-overlapping) occurrences of `needle` in `haystack`.\n * Returns 0 for an empty needle — both edit tools reject empty `old_string`\n * up front, so this branch is defensive rather than semantic.\n */\nexport function countExactMatches(haystack: string, needle: string): number {\n if (needle.length === 0)\n return 0\n let count = 0\n let idx = 0\n while (true) {\n const next = haystack.indexOf(needle, idx)\n if (next === -1)\n break\n count++\n idx = next + needle.length\n }\n return count\n}\n\n// ---------------------------------------------------------------------------\n// Curly-quote normalization + SDK-sanitization fallbacks\n// ---------------------------------------------------------------------------\n//\n// Models can't reliably emit Unicode curly quotes, and the Anthropic API\n// silently sanitizes a handful of XML-like tags before they hit the model\n// (`<name>` → `<n>`, etc.). When `old_string` doesn't match exactly, we retry\n// against the same content with both transforms applied so an \"old_string not\n// found\" failure that's only typographical resolves on the second pass.\n//\n// Mirrors the Claude Code Edit tool's recovery strategy. Verbatim port of the\n// quote constants and the desanitization table; the resolve loop below is\n// reorganized to share state between exact / quote-normalized / desanitized.\n\nexport const LEFT_SINGLE_CURLY_QUOTE = '\\u2018'\nexport const RIGHT_SINGLE_CURLY_QUOTE = '\\u2019'\nexport const LEFT_DOUBLE_CURLY_QUOTE = '\\u201C'\nexport const RIGHT_DOUBLE_CURLY_QUOTE = '\\u201D'\n\n/** Map curly quotes (any of the four) to their straight ASCII equivalents. */\nexport function normalizeQuotes(str: string): string {\n return str\n .replaceAll(LEFT_SINGLE_CURLY_QUOTE, '\\'')\n .replaceAll(RIGHT_SINGLE_CURLY_QUOTE, '\\'')\n .replaceAll(LEFT_DOUBLE_CURLY_QUOTE, '\"')\n .replaceAll(RIGHT_DOUBLE_CURLY_QUOTE, '\"')\n}\n\n/**\n * Substitutions Anthropic's API applies to assistant output before the model\n * sees it. The model emits the sanitized form; the file on disk contains the\n * unsanitized form. We undo the substitutions on `old_string` so the search\n * lands on the actual file contents.\n *\n * Verbatim from `claude-code/tools/FileEditTool/utils.ts`.\n */\nconst DESANITIZATIONS: ReadonlyArray<readonly [string, string]> = [\n ['<fnr>', '<function_results>'],\n ['<n>', '<name>'],\n ['</n>', '</name>'],\n ['<o>', '<output>'],\n ['</o>', '</output>'],\n ['<e>', '<error>'],\n ['</e>', '</error>'],\n ['<s>', '<system>'],\n ['</s>', '</system>'],\n ['<r>', '<result>'],\n ['</r>', '</result>'],\n ['< META_START >', '<META_START>'],\n ['< META_END >', '<META_END>'],\n ['< EOT >', '<EOT>'],\n ['< META >', '<META>'],\n ['< SOS >', '<SOS>'],\n ['\\n\\nH:', '\\n\\nHuman:'],\n ['\\n\\nA:', '\\n\\nAssistant:'],\n]\n\n/**\n * Apply the SDK desanitization table to a string. Exported so the edit tools\n * can apply it to `new_string` whenever `old_string` matched via a\n * desanitize-class fallback — keeps the file's unsanitized form on disk\n * instead of writing the model's abbreviated form back.\n */\nexport function desanitize(s: string): string {\n let out = s\n for (const [from, to] of DESANITIZATIONS)\n out = out.replaceAll(from, to)\n return out\n}\n\n/**\n * Strip line-number prefixes from each line of a needle, used as a recovery\n * fallback when the model pastes a `read_file` chunk verbatim into\n * `old_string` — the on-disk file doesn't carry the metadata prefix.\n *\n * Accepts three separator characters so a model that learned on a different\n * agent stack still works here: `\\t` (Claude Code compact, our default),\n * `|`, and `→`. Pattern: optional leading whitespace, 1-9 digits, then one\n * of `\\t | →`. The 9-digit ceiling covers files up to ~1B lines without\n * overshooting into legitimate `\\d{N}<sep>` content like Markdown table\n * cells with long numeric IDs.\n */\nconst LINE_NUMBER_PREFIX_RE = /^[ \\t]*\\d{1,9}[\\t|\\u2192]/gm\nexport function stripLineNumberPrefixes(s: string): string {\n return s.replace(LINE_NUMBER_PREFIX_RE, '')\n}\n\n/**\n * Locate the actual substring in `haystack` that corresponds to `needle`,\n * recovering from typographical mismatch on six escalating fallbacks:\n *\n * 1. Exact substring match (the happy path — no transformation).\n * 2. Curly-quote normalization on both sides — when the model emits straight\n * quotes but the file has curly ones (or vice versa), the slice of the\n * file at the matched position carries the file's actual typography.\n * 3. Anthropic-sanitization undo on the needle — the model's `<n>` becomes\n * the file's `<name>`, etc.\n * 4. Combined: desanitize + quote normalization on the needle.\n * 5. Line-number-prefix strip — when the model pasted a numbered `read_file`\n * chunk verbatim into `old_string` and the file carries no such prefix.\n * 6. Combined: line-number strip + quote normalization — paste-back of a\n * numbered chunk against a file whose typography differs from the model's.\n *\n * Returns `{ actual, occurrences }` — `actual` is the string that exists in\n * the file (use this to do the actual replace; preserves the file's\n * typography). `occurrences` is the count of those matches in the file.\n *\n * Fallbacks 3-4 (desanitize-class) only fire when the transformed needle is\n * UNIQUE in the file — they rewrite the needle's meaning rather than its\n * typography, so an ambiguous match risks silently retargeting the wrong\n * text (see the inline comment at step 3).\n *\n * Returns `null` when no recovery worked.\n */\nexport interface ResolvedMatch {\n actual: string\n occurrences: number\n /** Recovery path — `'exact'` when no transformation was applied. */\n via: 'exact' | 'quotes' | 'desanitize' | 'quotes+desanitize' | 'line-numbers' | 'quotes+line-numbers'\n}\n\n/**\n * Search `target` in `normFile` and slice the matching span out of the\n * original `haystack`, counting all non-overlapping occurrences. `normFile`\n * is the haystack with whatever transform (quotes / desanitize / combined)\n * was applied to make the indices align — slicing the original haystack\n * preserves the file's actual typography so `replace_all` writes back the\n * file's form, not the model's.\n *\n * Pre-condition: `normFile.length === haystack.length` (every transform\n * we use is one-to-one). Returns null on miss.\n */\nfunction locateAndCount(\n haystack: string,\n normFile: string,\n target: string,\n via: ResolvedMatch['via'],\n): ResolvedMatch | null {\n const idx = normFile.indexOf(target)\n if (idx === -1)\n return null\n const actual = haystack.slice(idx, idx + target.length)\n let occ = 0\n let cursor = 0\n while (true) {\n const next = normFile.indexOf(target, cursor)\n if (next === -1)\n break\n occ++\n cursor = next + target.length\n }\n return { actual, occurrences: occ, via }\n}\n\nexport function resolveOldString(haystack: string, needle: string): ResolvedMatch | null {\n // 1. Exact match — happy path.\n const exact = countExactMatches(haystack, needle)\n if (exact > 0)\n return { actual: needle, occurrences: exact, via: 'exact' }\n\n // 2. Curly-quote normalization. Either side can carry curly quotes:\n // model emitted straight + file has curly, OR model emitted curly +\n // file has straight. Normalize both and look there. Slice the original\n // haystack to recover the actual file-side typography.\n const normNeedle = normalizeQuotes(needle)\n const normFile = normalizeQuotes(haystack)\n if (normNeedle !== needle || normFile !== haystack) {\n const m = locateAndCount(haystack, normFile, normNeedle, 'quotes')\n if (m)\n return m\n }\n\n // 3. Desanitize the needle — model-side substitution undo (`<n>` → `<name>`,\n // etc.) The file always has the unsanitized form; only the model emits\n // the abbreviated version.\n //\n // Desanitize-class fallbacks additionally require a UNIQUE transformed\n // match. Unlike the quote / line-number transforms (typography-only /\n // verbatim paste-back), this one rewrites the needle's meaning — a model\n // that genuinely meant the literal `<n>` against a file full of `<name>`\n // would otherwise silently retarget every occurrence under `replace_all`.\n // A unique hit bounds the blast radius to one visible replacement.\n const desan = desanitize(needle)\n if (desan !== needle) {\n const desanCount = countExactMatches(haystack, desan)\n if (desanCount === 1)\n return { actual: desan, occurrences: desanCount, via: 'desanitize' }\n }\n\n // 4. Combined: desanitize + quote normalization. Hit when the model\n // emitted both sanitized tokens and straight quotes, but the file has\n // the unsanitized form with curly quotes. Same uniqueness requirement\n // as #3.\n const combo = desanitize(normNeedle)\n if (combo !== needle) {\n const m = locateAndCount(haystack, normFile, combo, 'quotes+desanitize')\n if (m && m.occurrences === 1)\n return m\n }\n\n // 5. Line-number-prefix strip. When `read_file` returns line-numbered\n // output and the model pasted the chunk verbatim into `old_string`,\n // the on-disk file doesn't carry those prefixes. Strip them and\n // retry; the file-side `actual` is the prefix-free needle so the\n // replacement lands on real bytes.\n //\n // Guard against a needle that strips down to whitespace-only (e.g.\n // `1\\t\\n2\\t\\n3\\t` → `\\n\\n`). Searching for `\\n\\n` would match arbitrary\n // blank-line patterns anywhere in the file — a high false-positive risk.\n // Require the stripped needle to carry at least one non-whitespace\n // character before we trust the result.\n const stripped = stripLineNumberPrefixes(needle)\n if (stripped !== needle && stripped.trim().length > 0) {\n const count = countExactMatches(haystack, stripped)\n if (count > 0)\n return { actual: stripped, occurrences: count, via: 'line-numbers' }\n\n // 6. Combined: line-number strip + curly-quote normalization. The\n // typography mismatch may live in the file, the needle, or both.\n const strippedNorm = normalizeQuotes(stripped)\n if (strippedNorm !== stripped || normFile !== haystack) {\n const m = locateAndCount(haystack, normFile, strippedNorm, 'quotes+line-numbers')\n if (m)\n return m\n }\n }\n\n return null\n}\n\n/**\n * Short human-readable label for a recovery path, used by `edit` /\n * `multi_edit` to flag non-exact matches in their result messages — when a\n * fallback mistargets, the model (and the user reading the transcript) can\n * see WHICH transform fired instead of silently trusting the edit.\n */\nexport function describeVia(via: ResolvedMatch['via']): string {\n switch (via) {\n case 'exact': return 'exact match'\n case 'quotes': return 'curly-quote normalization'\n case 'desanitize': return 'sanitization recovery (e.g. <n> → <name>)'\n case 'quotes+desanitize': return 'sanitization recovery + curly-quote normalization'\n case 'line-numbers': return 'line-number-prefix stripping'\n case 'quotes+line-numbers': return 'line-number-prefix stripping + curly-quote normalization'\n }\n}\n\n/**\n * Apply the same recovery transforms used to find `old_string` to\n * `new_string`, so the file gets back its native form: desanitize when\n * the model emitted `<n>` for `<name>`, strip line-number prefixes when\n * the match required them, then re-curlify when the match required\n * quote normalization. Shared between `edit` and `multi_edit`.\n */\nexport function styleReplacementForVia(\n replacement: string,\n via: ResolvedMatch['via'],\n actual: string,\n): string {\n let out = replacement\n if (via === 'desanitize' || via === 'quotes+desanitize')\n out = desanitize(out)\n if (via === 'line-numbers' || via === 'quotes+line-numbers')\n out = stripLineNumberPrefixes(out)\n if (via === 'quotes' || via === 'quotes+desanitize' || via === 'quotes+line-numbers')\n out = preserveQuoteStyle(actual, out)\n return out\n}\n\n/**\n * When `old_string` matched via curly-quote normalization, re-style\n * `new_string` so the file's typography is preserved across the edit.\n * Detects whether the matched file region had curly singles, doubles, or\n * both, and applies the matching curlification to the replacement.\n *\n * Apostrophes in contractions (`don't`, `it's`) get the right-single curly\n * quote regardless of opening context — that's the canonical typographer's\n * convention for English. Other quotes use a simple\n * preceded-by-whitespace-or-opening-punctuation heuristic.\n */\nexport function preserveQuoteStyle(actual: string, replacement: string): string {\n const hasDouble = actual.includes(LEFT_DOUBLE_CURLY_QUOTE) || actual.includes(RIGHT_DOUBLE_CURLY_QUOTE)\n const hasSingle = actual.includes(LEFT_SINGLE_CURLY_QUOTE) || actual.includes(RIGHT_SINGLE_CURLY_QUOTE)\n if (!hasDouble && !hasSingle)\n return replacement\n\n let out = replacement\n if (hasDouble)\n out = applyCurly(out, '\"', LEFT_DOUBLE_CURLY_QUOTE, RIGHT_DOUBLE_CURLY_QUOTE, false)\n if (hasSingle)\n out = applyCurly(out, '\\'', LEFT_SINGLE_CURLY_QUOTE, RIGHT_SINGLE_CURLY_QUOTE, true)\n return out\n}\n\nfunction applyCurly(\n s: string,\n straight: string,\n left: string,\n right: string,\n contractionAware: boolean,\n): string {\n const chars = [...s]\n const result: string[] = []\n for (let i = 0; i < chars.length; i++) {\n if (chars[i] !== straight) {\n result.push(chars[i])\n continue\n }\n if (contractionAware) {\n const prev = i > 0 ? chars[i - 1] : ''\n const next = i < chars.length - 1 ? chars[i + 1] : ''\n // Letter-quote-letter is a contraction, not a quote — always right.\n if (/\\p{L}/u.test(prev) && /\\p{L}/u.test(next)) {\n result.push(right)\n continue\n }\n }\n result.push(isOpeningContext(chars, i) ? left : right)\n }\n return result.join('')\n}\n\nfunction isOpeningContext(chars: string[], i: number): boolean {\n if (i === 0)\n return true\n const prev = chars[i - 1]\n return prev === ' ' || prev === '\\t' || prev === '\\n' || prev === '\\r'\n || prev === '(' || prev === '[' || prev === '{'\n || prev === '\\u2014' || prev === '\\u2013' // em / en dash\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgB,kBAAkB,UAAkB,QAAwB;CAC1E,IAAI,OAAO,WAAW,GACpB,OAAO;CACT,IAAI,QAAQ;CACZ,IAAI,MAAM;CACV,OAAO,MAAM;EACX,MAAM,OAAO,SAAS,QAAQ,QAAQ,GAAG;EACzC,IAAI,SAAS,IACX;EACF;EACA,MAAM,OAAO,OAAO;CACtB;CACA,OAAO;AACT;;AAsBA,SAAgB,gBAAgB,KAAqB;CACnD,OAAO,IACJ,WAAA,KAAoC,GAAI,EACxC,WAAA,KAAqC,GAAI,EACzC,WAAA,KAAoC,IAAG,EACvC,WAAA,KAAqC,IAAG;AAC7C;;;;;;;;;AAU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AS,OAAQ,SAAS,QAAQ,SAAS,QAC7D,SAAS,OAAO,SAAS,OAAO,SAAS,OACzC,SAAS,OAAY,SAAS;AACrC"}
package/dist/eval.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $t as ReusableExecutionContext, An as statusCompleted, At as EvalDefinitionContext, Bt as EvalScorer, Cn as formatTrajectoryLine, Ct as EvalAgentRunResult, Dn as registerEvalTests, Dt as EvalCaseOptions, En as normalizeMetric, Et as EvalArtifacts, Ft as EvalRunReporterOptions, Gt as EvalWorkspaceSnapshot, Ht as EvalTestRunner, It as EvalRunSummary, Jt as MetricEmitter, Kt as LlmJudgeOptions, Lt as EvalRunSummaryCase, Mt as EvalMetricError, Nt as EvalRunMetricAggregate, On as relativeArtifactPath, Ot as EvalCaseResult, Pt as EvalRunReporter, Qt as RegisterEvalTestsOptions, Rt as EvalRunUsage, Sn as formatEvalRunSummary, St as EvalAgentRunOptions, Tn as llmJudge, Tt as EvalAgentStats, Ut as EvalWorkspaceFile, Vt as EvalScorerContext, Wt as EvalWorkspaceOptions, Xt as MetricSpecMap, Yt as MetricSpec, Zt as MetricStats, _n as fileContentQuality, an as buildRegisteredEvals, bn as finalizeEvalMetrics, bt as EvalAgent, cn as computeEvalTagScores, dn as createReusableExecutionContext, en as Trajectory, fn as defineEval, gn as fileContains, hn as emitEfficiencyMetrics, in as buildEvalRunSummary, jt as EvalMetric, kn as runEvalCase, kt as EvalDefinition, ln as createEvalAgent, mn as efficiencyMetricValues, nn as TrajectoryStepKind, on as buildTrajectory, pn as defineMetrics, qt as MetricDirection, rn as artifactPath, sn as clearRegisteredEvals, tn as TrajectoryStep, un as createEvalRunReporter, vn as fileExists, vt as CreateEvalAgentOptions, wn as functionalityMetric, wt as EvalAgentRunStats, xn as formatEvalCaseSummary, xt as EvalAgentMcpServers, yn as fileExistsOneOf, yt as EFFICIENCY_METRICS, zt as EvalScore } from "./index-DutpkJJ7.js";
1
+ import { $t as ReusableExecutionContext, An as statusCompleted, At as EvalDefinitionContext, Bt as EvalScorer, Cn as formatTrajectoryLine, Ct as EvalAgentRunResult, Dn as registerEvalTests, Dt as EvalCaseOptions, En as normalizeMetric, Et as EvalArtifacts, Ft as EvalRunReporterOptions, Gt as EvalWorkspaceSnapshot, Ht as EvalTestRunner, It as EvalRunSummary, Jt as MetricEmitter, Kt as LlmJudgeOptions, Lt as EvalRunSummaryCase, Mt as EvalMetricError, Nt as EvalRunMetricAggregate, On as relativeArtifactPath, Ot as EvalCaseResult, Pt as EvalRunReporter, Qt as RegisterEvalTestsOptions, Rt as EvalRunUsage, Sn as formatEvalRunSummary, St as EvalAgentRunOptions, Tn as llmJudge, Tt as EvalAgentStats, Ut as EvalWorkspaceFile, Vt as EvalScorerContext, Wt as EvalWorkspaceOptions, Xt as MetricSpecMap, Yt as MetricSpec, Zt as MetricStats, _n as fileContentQuality, an as buildRegisteredEvals, bn as finalizeEvalMetrics, bt as EvalAgent, cn as computeEvalTagScores, dn as createReusableExecutionContext, en as Trajectory, fn as defineEval, gn as fileContains, hn as emitEfficiencyMetrics, in as buildEvalRunSummary, jt as EvalMetric, kn as runEvalCase, kt as EvalDefinition, ln as createEvalAgent, mn as efficiencyMetricValues, nn as TrajectoryStepKind, on as buildTrajectory, pn as defineMetrics, qt as MetricDirection, rn as artifactPath, sn as clearRegisteredEvals, tn as TrajectoryStep, un as createEvalRunReporter, vn as fileExists, vt as CreateEvalAgentOptions, wn as functionalityMetric, wt as EvalAgentRunStats, xn as formatEvalCaseSummary, xt as EvalAgentMcpServers, yn as fileExistsOneOf, yt as EFFICIENCY_METRICS, zt as EvalScore } from "./index-LX8KCBXU.js";
2
2
  export { CreateEvalAgentOptions, EFFICIENCY_METRICS, EvalAgent, EvalAgentMcpServers, EvalAgentRunOptions, EvalAgentRunResult, EvalAgentRunStats, EvalAgentStats, EvalArtifacts, EvalCaseOptions, EvalCaseResult, EvalDefinition, EvalDefinitionContext, EvalMetric, EvalMetricError, EvalRunMetricAggregate, EvalRunReporter, EvalRunReporterOptions, EvalRunSummary, EvalRunSummaryCase, EvalRunUsage, EvalScore, EvalScorer, EvalScorerContext, EvalTestRunner, EvalWorkspaceFile, EvalWorkspaceOptions, EvalWorkspaceSnapshot, LlmJudgeOptions, MetricDirection, MetricEmitter, MetricSpec, MetricSpecMap, MetricStats, RegisterEvalTestsOptions, ReusableExecutionContext, Trajectory, TrajectoryStep, TrajectoryStepKind, artifactPath, buildEvalRunSummary, buildRegisteredEvals, buildTrajectory, clearRegisteredEvals, computeEvalTagScores, createEvalAgent, createEvalRunReporter, createReusableExecutionContext, defineEval, defineMetrics, efficiencyMetricValues, emitEfficiencyMetrics, fileContains, fileContentQuality, fileExists, fileExistsOneOf, finalizeEvalMetrics, formatEvalCaseSummary, formatEvalRunSummary, formatTrajectoryLine, functionalityMetric, llmJudge, normalizeMetric, registerEvalTests, relativeArtifactPath, runEvalCase, statusCompleted };
package/dist/eval.js CHANGED
@@ -1,10 +1,10 @@
1
- import { h as alwaysQuote } from "./tools-Cjxkfh-F.js";
2
- import { n as createProcessContext } from "./contexts-BD2U_xpi.js";
3
- import { a as headlessEventToJsonl, c as runHeadless } from "./headless-D0yusQui.js";
4
- import { i as createMemoryStore, t as createSession } from "./session-z0E9-e4b.js";
1
+ import { h as alwaysQuote } from "./tools-ycHDeHBZ.js";
2
+ import { n as createProcessContext } from "./contexts-CbI8dRfI.js";
3
+ import { a as headlessEventToJsonl, c as runHeadless } from "./headless-D0qfvzG9.js";
4
+ import { i as createMemoryStore, t as createSession } from "./session-C0uGIWm_.js";
5
5
  import { join, relative, resolve } from "node:path";
6
- import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
7
6
  import { tmpdir } from "node:os";
7
+ import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
8
8
  import chalk from "chalk";
9
9
  //#region src/eval.ts
10
10
  /**
@@ -139,7 +139,6 @@ function createEvalAgent(options) {
139
139
  runInFlight = true;
140
140
  try {
141
141
  const session = await getSession();
142
- const before = session.turns.length;
143
142
  const { mcpServers: runMcpServers, onEvent: runOnEvent, ...restRunOptions } = runOptions;
144
143
  const mcpServers = await resolveMcpServers(runMcpServers);
145
144
  const result = await runHeadless({
@@ -153,7 +152,7 @@ function createEvalAgent(options) {
153
152
  runOnEvent?.(event);
154
153
  }
155
154
  });
156
- const newTranscript = result.transcript.slice(before);
155
+ const newTranscript = result.transcript.slice();
157
156
  const runStats = {
158
157
  input: result.usage.input,
159
158
  output: result.usage.output,