zidane 6.2.13 → 6.2.15

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 (36) hide show
  1. package/dist/acp-cli.js +2 -2
  2. package/dist/{anthropic-BYsc6qWj.js → anthropic-CTAXBVsj.js} +2 -2
  3. package/dist/anthropic-CTAXBVsj.js.map +1 -0
  4. package/dist/{auth-Bb479DFB.js → auth-BCpEbzvO.js} +2 -2
  5. package/dist/{auth-Bb479DFB.js.map → auth-BCpEbzvO.js.map} +1 -1
  6. package/dist/chat/pure.d.ts +3 -3
  7. package/dist/chat/pure.js +3 -2
  8. package/dist/chat.d.ts +3 -3
  9. package/dist/chat.js +5 -4
  10. package/dist/chat.js.map +1 -1
  11. package/dist/history-search-C4bk1Wz_.js +486 -0
  12. package/dist/history-search-C4bk1Wz_.js.map +1 -0
  13. package/dist/history-search-worker.d.ts +1 -0
  14. package/dist/history-search-worker.js +86 -0
  15. package/dist/history-search-worker.js.map +1 -0
  16. package/dist/index.js +1 -1
  17. package/dist/providers/anthropic.js +1 -1
  18. package/dist/providers.js +1 -1
  19. package/dist/{tool-formatters-BSwVkSX2.d.ts → tool-formatters-DdgS-xE2.d.ts} +90 -4
  20. package/dist/tool-formatters-DdgS-xE2.d.ts.map +1 -0
  21. package/dist/transcript-anchors-DKjXpQ0h.d.ts.map +1 -1
  22. package/dist/{transcript-anchors-yogJHuBW.js → transcript-anchors-DZ-8BF4p.js} +3 -3
  23. package/dist/transcript-anchors-DZ-8BF4p.js.map +1 -0
  24. package/dist/tui.d.ts +52 -10
  25. package/dist/tui.d.ts.map +1 -1
  26. package/dist/tui.js +1340 -246
  27. package/dist/tui.js.map +1 -1
  28. package/dist/{turn-operations-CXjRaltC.js → turn-operations-CokV32wf.js} +82 -11
  29. package/dist/turn-operations-CokV32wf.js.map +1 -0
  30. package/dist/{turn-operations-CjkgQKmR.d.ts → turn-operations-sE-Sli9H.d.ts} +2 -2
  31. package/dist/{turn-operations-CjkgQKmR.d.ts.map → turn-operations-sE-Sli9H.d.ts.map} +1 -1
  32. package/package.json +1 -1
  33. package/dist/anthropic-BYsc6qWj.js.map +0 -1
  34. package/dist/tool-formatters-BSwVkSX2.d.ts.map +0 -1
  35. package/dist/transcript-anchors-yogJHuBW.js.map +0 -1
  36. package/dist/turn-operations-CXjRaltC.js.map +0 -1
@@ -2,6 +2,7 @@ import { i as styleReplacementForVia, n as resolveOldString } from "./edit-utils
2
2
  import { r as utf8ByteLength } from "./utils-ngQzYzZD.js";
3
3
  import { l as shortId, t as ageString } from "./format-BF745pLL.js";
4
4
  import { t as effectiveInputFromTurn } from "./stats-DAKBEKjc.js";
5
+ import { a as searchHighlightRanges } from "./history-search-C4bk1Wz_.js";
5
6
  import { Fzf } from "fzf";
6
7
  //#region src/chat/completion-chats.ts
7
8
  const CHATS_TRIGGER = "#";
@@ -991,6 +992,17 @@ const EDIT_TOOL_NAMES = /* @__PURE__ */ new Set([
991
992
  "write_file"
992
993
  ]);
993
994
  /**
995
+ * Keep turn-selection mode alive after deleting its active row. Prefer the
996
+ * row that slides into the deleted index; at the tail, select the new last
997
+ * row. Returns null only when no selectable rows survive.
998
+ */
999
+ function selectionAfterTurnRemoval(before, removedId, after) {
1000
+ if (after.includes(removedId)) return removedId;
1001
+ if (after.length === 0) return null;
1002
+ const index = before.indexOf(removedId);
1003
+ return after[Math.min(Math.max(0, index), after.length - 1)] ?? null;
1004
+ }
1005
+ /**
994
1006
  * Recognize a tool-result body as carrying NON-success information so the
995
1007
  * renderer doesn't suppress it under `showEditDiffs`. Three categories:
996
1008
  *
@@ -1043,6 +1055,18 @@ function promptHistoryFromEvents(events) {
1043
1055
  else if (event.kind === "tool" && isUserBashEvent(event) && typeof event.input?.command === "string") history.push(`!${event.input.command}`);
1044
1056
  return history;
1045
1057
  }
1058
+ /** Searchable text of one stream event — tool name, label, and body text. */
1059
+ function streamEventSearchText(event) {
1060
+ return [
1061
+ event.tool,
1062
+ event.label,
1063
+ event.text
1064
+ ].filter(Boolean).join("\n");
1065
+ }
1066
+ function isVisibleDuringSearch(event, settings, query) {
1067
+ if (isVisible(event, settings)) return true;
1068
+ return (event.depth ?? 0) === 0 && searchHighlightRanges(streamEventSearchText(event), query).length > 0;
1069
+ }
1046
1070
  /**
1047
1071
  * Per-event visibility — filters honor user toggles and the
1048
1072
  * `hideSubagentOutput` setting. When subagent output is hidden:
@@ -1098,22 +1122,34 @@ function isVisible(event, settings) {
1098
1122
  */
1099
1123
  function turnSelectionOwnership(events) {
1100
1124
  const orderedTurnIds = [];
1101
- const eventKindsByTurn = /* @__PURE__ */ new Map();
1125
+ const summaryByTurn = /* @__PURE__ */ new Map();
1126
+ const callOwner = /* @__PURE__ */ new Map();
1102
1127
  for (const e of events) {
1103
1128
  if (!e.turnId) continue;
1104
1129
  if (e.childId) continue;
1105
- if (!eventKindsByTurn.has(e.turnId)) {
1130
+ let summary = summaryByTurn.get(e.turnId);
1131
+ if (!summary) {
1106
1132
  orderedTurnIds.push(e.turnId);
1107
- eventKindsByTurn.set(e.turnId, []);
1133
+ summary = {
1134
+ kinds: [],
1135
+ resultCallIds: []
1136
+ };
1137
+ summaryByTurn.set(e.turnId, summary);
1138
+ }
1139
+ summary.kinds.push(e.kind);
1140
+ if (e.callId) {
1141
+ if (e.kind === "tool") callOwner.set(e.callId, e.turnId);
1142
+ else if (e.kind === "tool-result") summary.resultCallIds.push(e.callId);
1108
1143
  }
1109
- eventKindsByTurn.get(e.turnId).push(e.kind);
1110
1144
  }
1111
1145
  const ownership = /* @__PURE__ */ new Map();
1112
1146
  let lastToolEmitterTurnId = null;
1113
1147
  for (const tid of orderedTurnIds) {
1114
- const kinds = eventKindsByTurn.get(tid);
1148
+ const { kinds, resultCallIds } = summaryByTurn.get(tid);
1115
1149
  if (kinds.length > 0 && kinds.every((k) => k === "tool-result")) {
1116
- if (lastToolEmitterTurnId) ownership.set(tid, lastToolEmitterTurnId);
1150
+ const exactOwner = resultCallIds.map((callId) => callOwner.get(callId)).find((owner) => owner !== void 0 && owner !== tid);
1151
+ if (exactOwner) ownership.set(tid, exactOwner);
1152
+ else if (lastToolEmitterTurnId) ownership.set(tid, lastToolEmitterTurnId);
1117
1153
  continue;
1118
1154
  }
1119
1155
  if (kinds.includes("tool")) lastToolEmitterTurnId = tid;
@@ -1134,7 +1170,7 @@ function turnSelectionOwnership(events) {
1134
1170
  function isTurnHighlighted(event, selectedTurnId, ownership) {
1135
1171
  if (selectedTurnId === null || !event.turnId) return false;
1136
1172
  if (event.turnId === selectedTurnId) return true;
1137
- return ownership.get(event.turnId) === selectedTurnId;
1173
+ return ownership.get(event.turnId) === selectedTurnId || ownership.get(selectedTurnId) === event.turnId;
1138
1174
  }
1139
1175
  /**
1140
1176
  * Deduplicated, in-order list of **parent-conversation** turn ids that appear
@@ -1156,12 +1192,12 @@ function isTurnHighlighted(event, selectedTurnId, ownership) {
1156
1192
  * Synthetic events (separator, spawn-start, spawn-end) have no `turnId` and
1157
1193
  * are skipped naturally.
1158
1194
  */
1159
- function selectableTurnIds(events, settings) {
1195
+ function selectableTurnIds(events, settings, visible) {
1160
1196
  const ownership = turnSelectionOwnership(events);
1161
1197
  const visibleCount = settings ? /* @__PURE__ */ new Map() : null;
1162
1198
  if (settings && visibleCount) for (const e of events) {
1163
1199
  if (!e.turnId || e.childId) continue;
1164
- if (!isVisible(e, settings)) continue;
1200
+ if (!(visible ? visible(e) : isVisible(e, settings))) continue;
1165
1201
  visibleCount.set(e.turnId, (visibleCount.get(e.turnId) ?? 0) + 1);
1166
1202
  }
1167
1203
  const seen = /* @__PURE__ */ new Set();
@@ -2113,6 +2149,10 @@ const TRANSCRIPT_TRIM_TO_EVENTS = 1200;
2113
2149
  * event kind.
2114
2150
  */
2115
2151
  const HIDDEN_MARKER_RE = /^… (\d+) earlier transcript items hidden/;
2152
+ function hiddenEarlierTranscriptCount(events) {
2153
+ const first = events[0];
2154
+ return first?.kind === "info" ? Number(HIDDEN_MARKER_RE.exec(first.text)?.[1] ?? 0) : 0;
2155
+ }
2116
2156
  function hiddenMarkerEvent(count) {
2117
2157
  return {
2118
2158
  kind: "info",
@@ -2120,6 +2160,36 @@ function hiddenMarkerEvent(count) {
2120
2160
  };
2121
2161
  }
2122
2162
  /**
2163
+ * Reveal one older page while retaining everything currently visible.
2164
+ * The default transcript is memory-bounded; memory grows only when the user
2165
+ * deliberately scrolls into the marker. The cut expands to a turn boundary
2166
+ * so tool-call/result groups are never split.
2167
+ */
2168
+ function replaceTranscriptTurnEvents(displayed, rebuilt, turnId) {
2169
+ const replacements = rebuilt.filter((event) => event.turnId === turnId);
2170
+ let inserted = false;
2171
+ const patched = displayed.flatMap((event) => {
2172
+ if (event.turnId !== turnId) return [event];
2173
+ if (inserted) return [];
2174
+ inserted = true;
2175
+ return replacements;
2176
+ });
2177
+ return inserted ? patched : null;
2178
+ }
2179
+ function revealEarlierTranscriptEvents(all, displayed, pageSize = 600) {
2180
+ const hidden = hiddenEarlierTranscriptCount(displayed);
2181
+ if (hidden <= 0) return displayed;
2182
+ const tail = displayed.slice(1);
2183
+ const anchorTurnId = tail.find((e) => e.turnId !== void 0)?.turnId;
2184
+ const anchorIndex = anchorTurnId !== void 0 ? all.findIndex((e) => e.turnId === anchorTurnId) : -1;
2185
+ const seam = anchorIndex >= 0 ? anchorIndex : Math.min(hidden, all.length);
2186
+ let from = Math.max(0, seam - Math.max(1, pageSize));
2187
+ while (from > 0 && all[from]?.turnId !== void 0 && all[from]?.turnId === all[from - 1]?.turnId) from--;
2188
+ const out = [...all.slice(from, seam), ...tail];
2189
+ if (from > 0) out.unshift(hiddenMarkerEvent(from));
2190
+ return out;
2191
+ }
2192
+ /**
2123
2193
  * Bound a transcript event array for display. Identity below the cap
2124
2194
  * (no re-render churn on the hot append path); above it, drops the
2125
2195
  * oldest events down to {@link TRANSCRIPT_TRIM_TO_EVENTS} — extended to
@@ -2148,6 +2218,7 @@ function capTranscriptEvents(events, max = MAX_TRANSCRIPT_EVENTS, trimTo = TRANS
2148
2218
  if (turn === void 0 || turn !== turnAtCut(cut - 1)) break;
2149
2219
  cut++;
2150
2220
  }
2221
+ while (cut < events.length && turnAtCut(cut) === void 0) cut++;
2151
2222
  if (cut >= events.length) cut = events.length - 1;
2152
2223
  return [hiddenMarkerEvent(previouslyHidden + (cut - start)), ...events.slice(cut)];
2153
2224
  }
@@ -2584,6 +2655,6 @@ function countNeighbors(turnIds, turnId) {
2584
2655
  };
2585
2656
  }
2586
2657
  //#endregion
2587
- export { buildEditOutcomesAnnotation as $, blendHsl as A, turnSelectionOwnership as B, stripHtmlCommentsOutsideCode as C, FILES_TRIGGER as D, uniqueSkillNamesFromReferences as E, isTurnHighlighted as F, computeInlineDiff as G, buildContextualDiff as H, isUserBashEvent as I, filetypeFromPath as J, computeLineDiff as K, isVisible as L, BASH_CALL_ID_PREFIX as M, EDIT_TOOL_NAMES as N, createFilesCompletionProvider as O, isEditErrorResult as P, tokenize as Q, promptHistoryFromEvents as R, splitMarkdownCodeBlocks as S, createSkillsCompletionProvider as T, buildUnifiedDiff as U, applyEditPayload as V, clipDiffForRender as W, splitLines as X, previewEditPayload as Y, summarizeEditPayload as Z, filterModelCatalog as _, TOOL_DISPLAY as a, stripEditOutcomesAnnotation as at, chunkMarkdownForRender as b, MAX_TRANSCRIPT_EVENTS as c, chatReferenceTokensFromText as ct, finalizeStreamingMarkdown as d, maskToOutcomeKinds as et, finalizeStreamingMarkdownForOwner as f, buildModelCatalog as g, splitPromptSegments as h, turnAsText as i, rewriteMultiEditHeader as it, buildLinearRamp as j, uniqueFilesFromReferences as k, TRANSCRIPT_TRIM_TO_EVENTS as l, createChatsCompletionProvider as lt, turnContextSize as m, deleteTurnSafely as n, parseEditOutcomesFromResult as nt, displayNameFor as o, summarizeOutcomes as ot, ownerOf as p, extractEditPayload as q, truncateTurnsAt as r, resolveApprovalForPayload as rt, formatToolCall as s, CHATS_TRIGGER as st, countNeighbors as t, mergeApprovalAndBodyOutcomes as tt, capTranscriptEvents as u, uniqueChatIdsFromReferences as ut, indexOfEntry as v, SKILLS_TRIGGER as w, normalizeMarkdownCodeFences as x, MARKDOWN_RENDER_CHUNK_TARGET_BYTES as y, selectableTurnIds as z };
2658
+ export { extractEditPayload as $, FILES_TRIGGER as A, isVisible as B, chunkMarkdownForRender as C, SKILLS_TRIGGER as D, stripHtmlCommentsOutsideCode as E, BASH_CALL_ID_PREFIX as F, streamEventSearchText as G, promptHistoryFromEvents as H, EDIT_TOOL_NAMES as I, buildContextualDiff as J, turnSelectionOwnership as K, isEditErrorResult as L, uniqueFilesFromReferences as M, blendHsl as N, createSkillsCompletionProvider as O, buildLinearRamp as P, computeLineDiff as Q, isTurnHighlighted as R, MARKDOWN_RENDER_CHUNK_TARGET_BYTES as S, splitMarkdownCodeBlocks as T, selectableTurnIds as U, isVisibleDuringSearch as V, selectionAfterTurnRemoval as W, clipDiffForRender as X, buildUnifiedDiff as Y, computeInlineDiff as Z, turnContextSize as _, TOOL_DISPLAY as a, buildEditOutcomesAnnotation as at, filterModelCatalog as b, MAX_TRANSCRIPT_EVENTS as c, parseEditOutcomesFromResult as ct, finalizeStreamingMarkdown as d, stripEditOutcomesAnnotation as dt, filetypeFromPath as et, finalizeStreamingMarkdownForOwner as f, summarizeOutcomes as ft, revealEarlierTranscriptEvents as g, uniqueChatIdsFromReferences as gt, replaceTranscriptTurnEvents as h, createChatsCompletionProvider as ht, turnAsText as i, tokenize as it, createFilesCompletionProvider as j, uniqueSkillNamesFromReferences as k, TRANSCRIPT_TRIM_TO_EVENTS as l, resolveApprovalForPayload as lt, ownerOf as m, chatReferenceTokensFromText as mt, deleteTurnSafely as n, splitLines as nt, displayNameFor as o, maskToOutcomeKinds as ot, hiddenEarlierTranscriptCount as p, CHATS_TRIGGER as pt, applyEditPayload as q, truncateTurnsAt as r, summarizeEditPayload as rt, formatToolCall as s, mergeApprovalAndBodyOutcomes as st, countNeighbors as t, previewEditPayload as tt, capTranscriptEvents as u, rewriteMultiEditHeader as ut, splitPromptSegments as v, normalizeMarkdownCodeFences as w, indexOfEntry as x, buildModelCatalog as y, isUserBashEvent as z };
2588
2659
 
2589
- //# sourceMappingURL=turn-operations-CXjRaltC.js.map
2660
+ //# sourceMappingURL=turn-operations-CokV32wf.js.map