@bastani/atomic 0.9.13 → 0.9.14-alpha.1

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 (96) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/builtin/i-have-adhd/package.json +1 -1
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/subagents/package.json +1 -1
  6. package/dist/builtin/web-access/package.json +1 -1
  7. package/dist/builtin/workflows/CHANGELOG.md +12 -0
  8. package/dist/builtin/workflows/README.md +9 -0
  9. package/dist/builtin/workflows/builtin/adversarial-verification.ts +4 -0
  10. package/dist/builtin/workflows/builtin/classify-and-act.ts +4 -0
  11. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.ts +4 -0
  12. package/dist/builtin/workflows/builtin/generate-and-filter.ts +4 -0
  13. package/dist/builtin/workflows/builtin/goal.ts +4 -0
  14. package/dist/builtin/workflows/builtin/loop-until-done.ts +4 -0
  15. package/dist/builtin/workflows/builtin/open-claude-design.ts +4 -0
  16. package/dist/builtin/workflows/builtin/ralph.ts +4 -0
  17. package/dist/builtin/workflows/builtin/tournament.ts +4 -0
  18. package/dist/builtin/workflows/package.json +1 -1
  19. package/dist/builtin/workflows/src/authoring/workflow.ts +9 -0
  20. package/dist/builtin/workflows/src/authoring.d.ts +3 -0
  21. package/dist/builtin/workflows/src/durable/completed-catalog.ts +13 -2
  22. package/dist/builtin/workflows/src/durable/workflow-heartbeat-anchor.ts +153 -0
  23. package/dist/builtin/workflows/src/engine/run-durable-stage-session.ts +28 -0
  24. package/dist/builtin/workflows/src/engine/run.ts +1 -0
  25. package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +138 -0
  26. package/dist/builtin/workflows/src/extension/index.bundle.mjs +766 -4
  27. package/dist/builtin/workflows/src/extension/workflow-heartbeat-delivery.ts +197 -0
  28. package/dist/builtin/workflows/src/extension/workflow-heartbeat-notice.ts +115 -0
  29. package/dist/builtin/workflows/src/extension/workflow-heartbeat-scheduler.ts +962 -0
  30. package/dist/builtin/workflows/src/sdk-surface.ts +9 -0
  31. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +1 -0
  32. package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +1 -0
  33. package/dist/builtin/workflows/src/shared/persistence-restore.ts +12 -0
  34. package/dist/builtin/workflows/src/shared/workflow-authoring-types.d.ts +1 -0
  35. package/dist/builtin/workflows/src/shared/workflow-authoring-types.ts +1 -0
  36. package/dist/builtin/workflows/src/shared/workflow-heartbeat-contract.d.ts +21 -0
  37. package/dist/builtin/workflows/src/shared/workflow-heartbeat-contract.ts +25 -0
  38. package/dist/core/extensions/index.d.ts +1 -0
  39. package/dist/core/extensions/index.d.ts.map +1 -1
  40. package/dist/core/extensions/index.js +1 -0
  41. package/dist/core/extensions/index.js.map +1 -1
  42. package/dist/core/extensions/ui-types.d.ts +26 -0
  43. package/dist/core/extensions/ui-types.d.ts.map +1 -1
  44. package/dist/core/extensions/ui-types.js +17 -1
  45. package/dist/core/extensions/ui-types.js.map +1 -1
  46. package/dist/core/tools/ask-user-question/ask-user-question.d.ts +21 -0
  47. package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
  48. package/dist/core/tools/ask-user-question/ask-user-question.js +34 -9
  49. package/dist/core/tools/ask-user-question/ask-user-question.js.map +1 -1
  50. package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts.map +1 -1
  51. package/dist/core/tools/ask-user-question/view/components/multi-select-view.js +5 -2
  52. package/dist/core/tools/ask-user-question/view/components/multi-select-view.js.map +1 -1
  53. package/dist/core/tools/ask-user-question/view/components/submit-picker.d.ts.map +1 -1
  54. package/dist/core/tools/ask-user-question/view/components/submit-picker.js +3 -1
  55. package/dist/core/tools/ask-user-question/view/components/submit-picker.js.map +1 -1
  56. package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts.map +1 -1
  57. package/dist/core/tools/ask-user-question/view/components/wrapping-select.js +8 -1
  58. package/dist/core/tools/ask-user-question/view/components/wrapping-select.js.map +1 -1
  59. package/dist/index-extensions.d.ts +1 -1
  60. package/dist/index-extensions.d.ts.map +1 -1
  61. package/dist/index-extensions.js +1 -1
  62. package/dist/index-extensions.js.map +1 -1
  63. package/dist/modes/interactive/components/reserved-bottom-overlay.d.ts +95 -0
  64. package/dist/modes/interactive/components/reserved-bottom-overlay.d.ts.map +1 -0
  65. package/dist/modes/interactive/components/reserved-bottom-overlay.js +234 -0
  66. package/dist/modes/interactive/components/reserved-bottom-overlay.js.map +1 -0
  67. package/dist/modes/interactive/interactive-extension-custom-ui.js +94 -6
  68. package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
  69. package/dist/modes/interactive/interactive-mode-base.d.ts +3 -0
  70. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  71. package/dist/modes/interactive/interactive-mode-base.js +5 -1
  72. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  73. package/dist/modes/interactive/interactive-mode-surface.d.ts +2 -0
  74. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  75. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  76. package/dist/modes/interactive/interactive-tui.d.ts +3 -0
  77. package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
  78. package/dist/modes/interactive/interactive-tui.js +14 -0
  79. package/dist/modes/interactive/interactive-tui.js.map +1 -1
  80. package/dist/modes/interactive-engine/engine-custom-ui.d.ts +2 -0
  81. package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
  82. package/dist/modes/interactive-engine/engine-custom-ui.js +1 -0
  83. package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
  84. package/dist/modes/interactive-engine/protocol.d.ts +1 -0
  85. package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
  86. package/dist/modes/interactive-engine/protocol.js +1 -0
  87. package/dist/modes/interactive-engine/protocol.js.map +1 -1
  88. package/dist/modes/interactive-engine/remote-component.d.ts +3 -1
  89. package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
  90. package/dist/modes/interactive-engine/remote-component.js +3 -2
  91. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  92. package/docs/extensions.md +27 -0
  93. package/docs/keybindings.md +1 -0
  94. package/docs/workflows.md +34 -0
  95. package/npm-shrinkwrap.json +29 -29
  96. package/package.json +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reserved-bottom-overlay.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/reserved-bottom-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAsC,MAAM,wBAAwB,CAAC;AAC3G,OAAO,EAAiC,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAChH,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAW1C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAO3C,SAAS,qBAAqB,CAAC,MAA0C;IACxE,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;QAClC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;IACtC,CAAC;IACD,OAAO;QACN,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;QAClC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,CAAC;KACxC,CAAC;AACH,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,uBAAuB,CACtC,SAAgC,EAChC,YAAoB,EACpB,MAA+B;IAE/B,IAAI,SAAS,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC9C,IAAI,MAA0B,CAAC;IAC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,OAAO,YAAY,EAAE,MAAM,KAAK,wBAAwB,CAAC,CAAC,CAAC,wBAAwB,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5G,CAAC","sourcesContent":["import { type Component, CURSOR_MARKER, type OverlayMargin, type SizeValue } from \"@earendil-works/pi-tui\";\nimport { type ExtensionCustomComponent, OVERLAY_ACTIVE_ROW_MARKER } from \"../../../core/extensions/ui-types.ts\";\nimport { theme } from \"../theme/theme.ts\";\n\n/**\n * What {@link ReservedBottomOverlay} needs from the component it wraps: the\n * documented `ctx.ui.custom()` contract, plus the internal-UI-action flag the\n * host reads off whichever component holds focus.\n */\nexport type WrappedOverlayComponent = ExtensionCustomComponent & {\n\thandlesInternalUiAction?: boolean;\n};\n\n/**\n * Transcript rows that must stay visible above a reserving bottom overlay.\n *\n * A bottom-anchored overlay is composited over the transcript rather than\n * measured into the layout, so nothing stops it covering the whole screen. Six\n * rows is the floor at which the transcript is still legible while paging, and\n * it is what makes the reserve arithmetic below total-occlusion-proof:\n * `visibleStrip === terminalRows - overlayHeight`, so bounding the overlay to\n * `terminalRows - MIN_TRANSCRIPT_STRIP_ROWS` guarantees the strip.\n */\nexport const MIN_TRANSCRIPT_STRIP_ROWS = 6;\n\ninterface VerticalOverlayMargin {\n\ttop: number;\n\tbottom: number;\n}\n\nfunction verticalOverlayMargin(margin: OverlayMargin | number | undefined): VerticalOverlayMargin {\n\tif (typeof margin === \"number\") {\n\t\tconst value = Math.max(0, margin);\n\t\treturn { top: value, bottom: value };\n\t}\n\treturn {\n\t\ttop: Math.max(0, margin?.top ?? 0),\n\t\tbottom: Math.max(0, margin?.bottom ?? 0),\n\t};\n}\n\n/** Resolve pi-tui's terminal-relative max-height rule for valid SizeValue input. */\nexport function resolveOverlayMaxHeight(\n\tmaxHeight: SizeValue | undefined,\n\tterminalRows: number,\n\tmargin?: OverlayMargin | number,\n): number | undefined {\n\tif (maxHeight === undefined) return undefined;\n\tlet parsed: number | undefined;\n\tif (typeof maxHeight === \"number\") {\n\t\tparsed = maxHeight;\n\t} else {\n\t\tconst match = /^(\\d+(?:\\.\\d+)?)%$/.exec(maxHeight);\n\t\tif (match?.[1] !== undefined) parsed = Math.floor((terminalRows * Number.parseFloat(match[1])) / 100);\n\t}\n\tif (parsed === undefined) return undefined;\n\tconst normalized = verticalOverlayMargin(margin);\n\tconst availableHeight = Math.max(1, terminalRows - normalized.top - normalized.bottom);\n\treturn Math.trunc(Math.max(1, Math.min(parsed, availableHeight)));\n}\n\n/**\n * Rows kept from the bottom of an over-tall overlay. The dialog's closing\n * border and its key hints live there, and they are the interaction\n * affordances; a plain bottom slice would drop exactly those.\n */\nconst OVERLAY_TAIL_KEEP_ROWS = 3;\n\nfunction trimTrailingBlankRows(lines: readonly string[]): readonly string[] {\n\tlet end = lines.length;\n\twhile (end > 0 && (lines[end - 1] ?? \"\").trim() === \"\") end -= 1;\n\treturn end === lines.length ? lines : lines.slice(0, end);\n}\n\n/**\n * Pull {@link OVERLAY_ACTIVE_ROW_MARKER} out of the rendered frame, reporting the\n * row that carried it. Stripping is unconditional so the mark never reaches the\n * terminal, whether or not the frame ends up cropped.\n */\nfunction takeActiveRow(lines: readonly string[]): { rows: string[]; activeRow: number | undefined } {\n\tlet activeRow: number | undefined;\n\tconst rows = lines.map((line, index) => {\n\t\tconst at = line.indexOf(OVERLAY_ACTIVE_ROW_MARKER);\n\t\tif (activeRow === undefined && (at !== -1 || line.includes(CURSOR_MARKER))) activeRow = index;\n\t\tif (at === -1) return line;\n\t\treturn line.slice(0, at) + line.slice(at + OVERLAY_ACTIVE_ROW_MARKER.length);\n\t});\n\treturn { rows, activeRow };\n}\n\n/**\n * Fit `lines` into `budget` rows.\n *\n * Trailing blank rows go first — a bottom-anchored overlay pays for them in\n * occlusion and they carry nothing. The last {@link OVERLAY_TAIL_KEEP_ROWS} rows\n * are always kept, because the closing border and the key hints live there.\n *\n * What survives in between is a single window of the frame, and it is placed so\n * that it still contains the row the component marked as active. Keeping a fixed\n * head instead — which is what this did first — drops the selected option on a\n * short terminal: at 80 columns the marker sits at row `6 + 2 * optionIndex`, so\n * option 4 disappeared below 24 rows and option 1 below 18, and the dialog looked\n * frozen under the arrow keys. The window is the earliest one that still holds\n * the active row, so a frame whose active row is already near the top crops\n * exactly as it did before.\n */\nexport function boundOverlayLines(lines: readonly string[], budget: number): string[] {\n\tconst { rows, activeRow } = takeActiveRow(lines);\n\tconst trimmed = trimTrailingBlankRows(rows);\n\tif (budget <= 0) return [];\n\tif (trimmed.length <= budget) return [...trimmed];\n\tif (activeRow !== undefined && budget === 1) return [trimmed[activeRow] ?? trimmed[0] ?? \"\"];\n\tconst tail = Math.min(OVERLAY_TAIL_KEEP_ROWS, Math.max(0, budget - (activeRow === undefined ? 1 : 2)));\n\tconst window = budget - tail - 1;\n\tif (window <= 0) return [...trimmed.slice(0, budget)];\n\tconst tailStart = trimmed.length - tail;\n\tconst start =\n\t\tactiveRow !== undefined && activeRow >= window && activeRow < tailStart\n\t\t\t? Math.min(activeRow - window + 1, tailStart - window)\n\t\t\t: 0;\n\tconst kept = trimmed.slice(start, start + window);\n\tconst hidden = trimmed.length - kept.length - tail;\n\tconst notice = theme.fg(\"muted\", `⋮ ${hidden} more rows hidden — answer or cancel to see them`);\n\tconst tailRows = trimmed.slice(tailStart);\n\treturn start === 0 ? [...kept, notice, ...tailRows] : [notice, ...kept, ...tailRows];\n}\n\n/**\n * A blocking overlay that leaves room for the transcript.\n *\n * Wraps the component an extension mounted with `reserveTranscriptRows`, bounds\n * its height so it can never cover the whole screen, and records the height it\n * actually painted so {@link TranscriptOverlayReserve} can extend the\n * transcript's scroll extent by exactly the rows this overlay hides.\n */\nexport class ReservedBottomOverlay implements Component {\n\treadonly wantsKeyRelease: boolean;\n\treadonly handlesInternalUiAction: boolean;\n\n\tprivate readonly inner: WrappedOverlayComponent;\n\tprivate readonly getTerminalRows: () => number;\n\tprivate readonly margin: OverlayMargin | number | undefined;\n\tprivate readonly maxHeight: SizeValue | undefined;\n\tprivate readonly shouldPassViewportInput: (data: string) => boolean;\n\tprivate readonly onHeightChange: () => void;\n\tprivate height = 0;\n\n\tconstructor(\n\t\tinner: WrappedOverlayComponent,\n\t\tgetTerminalRows: () => number,\n\t\tmargin?: OverlayMargin | number,\n\t\tmaxHeight?: SizeValue,\n\t\tshouldPassViewportInput: (data: string) => boolean = () => false,\n\t\tonHeightChange: () => void = () => {},\n\t) {\n\t\tthis.inner = inner;\n\t\tthis.getTerminalRows = getTerminalRows;\n\t\tthis.margin = margin;\n\t\tthis.maxHeight = maxHeight;\n\t\tthis.shouldPassViewportInput = shouldPassViewportInput;\n\t\tthis.onHeightChange = onHeightChange;\n\t\tthis.wantsKeyRelease = inner.wantsKeyRelease === true;\n\t\tthis.handlesInternalUiAction = inner.handlesInternalUiAction === true;\n\t}\n\n\t/** Rows painted by the last `render`. Zero before the first frame. */\n\tget renderedHeight(): number {\n\t\treturn this.height;\n\t}\n\n\trender(width: number): string[] {\n\t\tconst terminalRows = this.getTerminalRows();\n\t\tconst { top, bottom } = verticalOverlayMargin(this.margin);\n\t\tconst availableHeight = Math.max(1, Math.floor(terminalRows - top - bottom));\n\t\tconst transcriptStripBudget = Math.max(1, Math.floor(terminalRows - bottom - MIN_TRANSCRIPT_STRIP_ROWS));\n\t\tconst resolvedMaxHeight = resolveOverlayMaxHeight(this.maxHeight, terminalRows, this.margin);\n\t\tconst budget = Math.min(availableHeight, transcriptStripBudget, resolvedMaxHeight ?? Number.POSITIVE_INFINITY);\n\t\tconst lines = boundOverlayLines(this.inner.render(width), budget);\n\t\tconst previousHeight = this.height;\n\t\tthis.height = lines.length;\n\t\tif (this.height !== previousHeight) this.onHeightChange();\n\t\treturn lines;\n\t}\n\n\thandleInput(data: string): boolean | undefined | Promise<boolean | undefined> {\n\t\tif (this.shouldPassViewportInput(data)) return false;\n\t\tconst handler = this.inner.handleInput;\n\t\tif (typeof handler !== \"function\") return undefined;\n\t\treturn handler.call(this.inner, data);\n\t}\n\n\tinvalidate(): void {\n\t\tthis.inner.invalidate();\n\t}\n\n\tdispose(): void {\n\t\tthis.inner.dispose?.();\n\t}\n}\n\nexport interface TranscriptOverlayIntersection {\n\ttop: number;\n\tbottom: number;\n}\n\n/** Return the terminal-row interval where a bottom overlay covers the transcript. */\nexport function transcriptOverlayIntersection(\n\toverlayHeight: number,\n\tterminalRows: number,\n\ttranscriptViewportHeight: number,\n\tmargin?: OverlayMargin | number,\n): TranscriptOverlayIntersection | undefined {\n\tif (overlayHeight <= 0 || terminalRows <= 0 || transcriptViewportHeight <= 0) return undefined;\n\tconst normalized = verticalOverlayMargin(margin);\n\tconst overlayTop = Math.max(normalized.top, terminalRows - normalized.bottom - overlayHeight);\n\tconst overlayBottom = Math.min(terminalRows, overlayTop + overlayHeight);\n\tconst top = Math.max(0, Math.min(transcriptViewportHeight, overlayTop));\n\tconst bottom = Math.max(0, Math.min(transcriptViewportHeight, overlayBottom));\n\treturn bottom > top ? { top, bottom } : undefined;\n}\n\n/**\n * One host-owned blank-row coordinator appended to the transcript document.\n *\n * Each visible bottom overlay supplies its real transcript intersection. The\n * blank tail equals only the connected covered suffix at the transcript bottom:\n * floating overlays need no tail, while overlapping intervals are unioned once.\n */\nexport class TranscriptOverlayReserve implements Component {\n\tprivate readonly getTranscriptViewportHeight: () => number;\n\tprivate readonly reservations = new Map<symbol, () => TranscriptOverlayIntersection | undefined>();\n\n\tconstructor(getTranscriptViewportHeight: () => number) {\n\t\tthis.getTranscriptViewportHeight = getTranscriptViewportHeight;\n\t}\n\n\tget empty(): boolean {\n\t\treturn this.reservations.size === 0;\n\t}\n\n\tregister(getIntersection: () => TranscriptOverlayIntersection | undefined): () => void {\n\t\tconst token = Symbol();\n\t\tthis.reservations.set(token, getIntersection);\n\t\tlet released = false;\n\t\treturn () => {\n\t\t\tif (released) return;\n\t\t\treleased = true;\n\t\t\tthis.reservations.delete(token);\n\t\t};\n\t}\n\n\thandleInput(_data: string): void {}\n\n\tinvalidate(): void {}\n\n\trender(_width: number): string[] {\n\t\tconst viewportHeight = Math.max(0, Math.trunc(this.getTranscriptViewportHeight()));\n\t\tconst intersections = [...this.reservations.values()]\n\t\t\t.map((getIntersection) => getIntersection())\n\t\t\t.filter((intersection): intersection is TranscriptOverlayIntersection => intersection !== undefined);\n\t\tlet coveredFrom = viewportHeight;\n\t\tlet extended = true;\n\t\twhile (extended) {\n\t\t\textended = false;\n\t\t\tfor (const intersection of intersections) {\n\t\t\t\tconst top = Math.max(0, Math.min(viewportHeight, intersection.top));\n\t\t\t\tconst bottom = Math.max(0, Math.min(viewportHeight, intersection.bottom));\n\t\t\t\tif (top < coveredFrom && bottom >= coveredFrom) {\n\t\t\t\t\tcoveredFrom = top;\n\t\t\t\t\textended = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst rows = Math.max(0, Math.trunc(viewportHeight - coveredFrom));\n\t\treturn Array<string>(rows).fill(\"\");\n\t}\n}\n\n/**\n * Zero-margin compatibility helper for callers that only need the covered\n * transcript-bottom suffix length.\n */\nexport function occludedTranscriptRows(\n\toverlayHeight: number,\n\tterminalRows: number,\n\ttranscriptViewportHeight: number,\n): number {\n\tconst intersection = transcriptOverlayIntersection(overlayHeight, terminalRows, transcriptViewportHeight);\n\treturn intersection?.bottom === transcriptViewportHeight ? transcriptViewportHeight - intersection.top : 0;\n}\n"]}
@@ -1,5 +1,19 @@
1
- import { InteractiveModeBase } from "./interactive-mode-base.js";
1
+ import { ReservedBottomOverlay, TranscriptOverlayReserve, transcriptOverlayIntersection, } from "./components/reserved-bottom-overlay.js";
2
+ import { InteractiveModeBase, isFullscreenViewportAction } from "./interactive-mode-base.js";
2
3
  import { Text, theme, } from "./interactive-mode-deps.js";
4
+ import { isMouseWheelInput, isOverlayMounted } from "./interactive-tui.js";
5
+ function validateReservedBottomOverlayOptions(options) {
6
+ const anchor = options?.anchor;
7
+ if (anchor !== "bottom-left" && anchor !== "bottom-center" && anchor !== "bottom-right") {
8
+ throw new Error("reserveTranscriptRows requires an explicit bottom anchor: bottom-left, bottom-center, or bottom-right");
9
+ }
10
+ if (options?.row !== undefined) {
11
+ throw new Error("reserveTranscriptRows does not support overlayOptions.row");
12
+ }
13
+ if (options?.offsetY !== undefined && options.offsetY !== 0) {
14
+ throw new Error("reserveTranscriptRows does not support a nonzero overlayOptions.offsetY");
15
+ }
16
+ }
3
17
  InteractiveModeBase.prototype.showExtensionNotify = function (message, type) {
4
18
  if (type === "error") {
5
19
  this.showError(message);
@@ -31,6 +45,8 @@ InteractiveModeBase.prototype.showExtensionCustom = async function (factory, opt
31
45
  let overlayHandle;
32
46
  let releaseHostInlineCustomUi;
33
47
  let releaseOverlayInlineCustomUiFocusDeferral;
48
+ let transcriptReserveCoordinator;
49
+ let releaseTranscriptReserveRegistration;
34
50
  const disposeComponent = () => {
35
51
  try {
36
52
  component?.dispose?.();
@@ -49,12 +65,27 @@ InteractiveModeBase.prototype.showExtensionCustom = async function (factory, opt
49
65
  const cleanupAbortListener = () => {
50
66
  options?.signal?.removeEventListener("abort", abortCustomUi);
51
67
  };
68
+ const releaseTranscriptReserve = () => {
69
+ const coordinator = transcriptReserveCoordinator;
70
+ releaseTranscriptReserveRegistration?.();
71
+ releaseTranscriptReserveRegistration = undefined;
72
+ transcriptReserveCoordinator = undefined;
73
+ if (!coordinator)
74
+ return;
75
+ if (coordinator.empty) {
76
+ this.documentContainer.removeChild(coordinator);
77
+ if (this.transcriptOverlayReserve === coordinator)
78
+ this.transcriptOverlayReserve = undefined;
79
+ }
80
+ this.ui.requestRender();
81
+ };
52
82
  const closeMountedUi = () => {
53
83
  if (!mounted)
54
84
  return;
55
85
  if (isOverlay) {
56
86
  releaseOverlayInlineCustomUiFocusDeferral?.();
57
87
  releaseOverlayInlineCustomUiFocusDeferral = undefined;
88
+ releaseTranscriptReserve();
58
89
  // Hide THIS overlay, not whatever is on top: during engine-death
59
90
  // teardown an unrelated native overlay can be above this one, and the
60
91
  // generic top-overlay call would close that instead.
@@ -136,15 +167,72 @@ InteractiveModeBase.prototype.showExtensionCustom = async function (factory, opt
136
167
  const w = component?.width;
137
168
  return w ? { width: w } : undefined;
138
169
  };
139
- const handle = this.ui.showOverlay(component, resolveOptions());
170
+ // A reserving overlay is bounded so a transcript strip always
171
+ // survives, and the rows it still covers are added to the end of
172
+ // the document so the scroll clamp can raise them into that strip.
173
+ const resolvedOverlayOptions = resolveOptions();
174
+ let mountedOverlayOptions = resolvedOverlayOptions;
175
+ let mountedComponent = component;
176
+ let pendingReserve;
177
+ if (options?.reserveTranscriptRows === true) {
178
+ validateReservedBottomOverlayOptions(resolvedOverlayOptions);
179
+ // `custom()` documents the richer `ExtensionCustomComponent`
180
+ // contract; this signature still names pi-tui's narrower one.
181
+ const bounded = new ReservedBottomOverlay(component, () => this.ui.terminal.rows, resolvedOverlayOptions?.margin, resolvedOverlayOptions?.maxHeight, (data) => isFullscreenViewportAction(data, this.keybindings) || isMouseWheelInput(data), () => this.ui.requestRender());
182
+ mountedComponent = bounded;
183
+ if (resolvedOverlayOptions?.maxHeight !== undefined) {
184
+ mountedOverlayOptions = { ...resolvedOverlayOptions };
185
+ delete mountedOverlayOptions.maxHeight;
186
+ }
187
+ // A raw host reset can remove the exact overlay without touching its
188
+ // handle. Stop reserving in that frame, then remove the registration
189
+ // after the document render traversal finishes.
190
+ let removalObserved = false;
191
+ const overlayShowing = () => {
192
+ if (!isOverlayMounted(this.ui, mountedComponent)) {
193
+ if (!removalObserved) {
194
+ removalObserved = true;
195
+ queueMicrotask(releaseTranscriptReserve);
196
+ }
197
+ return false;
198
+ }
199
+ if (overlayHandle === undefined || overlayHandle.isHidden())
200
+ return false;
201
+ const visible = resolvedOverlayOptions?.visible;
202
+ return visible === undefined ? true : visible(this.ui.terminal.columns, this.ui.terminal.rows);
203
+ };
204
+ pendingReserve = () => overlayShowing()
205
+ ? transcriptOverlayIntersection(bounded.renderedHeight, this.ui.terminal.rows, this.transcriptScrollView?.viewportHeight ?? 0, resolvedOverlayOptions?.margin)
206
+ : undefined;
207
+ }
208
+ const handle = this.ui.showOverlay(mountedComponent, mountedOverlayOptions);
140
209
  overlayHandle = handle;
141
210
  mounted = true;
211
+ // Register only once the overlay is really up and `mounted` is
212
+ // set: a throw before this point must not leave a registry entry
213
+ // or blank-row component in the transcript document.
214
+ if (pendingReserve) {
215
+ let coordinator = this.transcriptOverlayReserve;
216
+ if (!coordinator) {
217
+ coordinator = new TranscriptOverlayReserve(() => this.transcriptScrollView?.viewportHeight ?? 0);
218
+ this.transcriptOverlayReserve = coordinator;
219
+ transcriptReserveCoordinator = coordinator;
220
+ this.documentContainer.addChild(coordinator);
221
+ }
222
+ else {
223
+ transcriptReserveCoordinator = coordinator;
224
+ }
225
+ releaseTranscriptReserveRegistration = coordinator.register(pendingReserve);
226
+ }
227
+ let releaseDeferral;
142
228
  if (options?.deferInlineCustomUiFocus) {
143
- let releaseDeferral = this.beginInlineCustomUiFocusDeferral();
229
+ releaseDeferral = this.beginInlineCustomUiFocusDeferral();
144
230
  releaseOverlayInlineCustomUiFocusDeferral = () => {
145
231
  releaseDeferral?.();
146
232
  releaseDeferral = undefined;
147
233
  };
234
+ }
235
+ if (options?.deferInlineCustomUiFocus || pendingReserve) {
148
236
  const release = () => {
149
237
  releaseOverlayInlineCustomUiFocusDeferral?.();
150
238
  releaseOverlayInlineCustomUiFocusDeferral = undefined;
@@ -152,13 +240,14 @@ InteractiveModeBase.prototype.showExtensionCustom = async function (factory, opt
152
240
  const wrappedHandle = {
153
241
  hide: () => {
154
242
  release();
243
+ releaseTranscriptReserve();
155
244
  handle.hide();
156
245
  },
157
246
  setHidden: (hidden) => {
158
247
  if (hidden)
159
248
  release();
160
249
  handle.setHidden(hidden);
161
- if (!hidden && releaseDeferral === undefined) {
250
+ if (!hidden && options?.deferInlineCustomUiFocus && releaseDeferral === undefined) {
162
251
  releaseDeferral = this.beginInlineCustomUiFocusDeferral();
163
252
  releaseOverlayInlineCustomUiFocusDeferral = () => {
164
253
  releaseDeferral?.();
@@ -171,11 +260,10 @@ InteractiveModeBase.prototype.showExtensionCustom = async function (factory, opt
171
260
  unfocus: (unfocusOptions) => handle.unfocus(unfocusOptions),
172
261
  isFocused: () => handle.isFocused(),
173
262
  };
174
- // Expose handle to caller for visibility control
263
+ overlayHandle = wrappedHandle;
175
264
  options?.onHandle?.(wrappedHandle);
176
265
  }
177
266
  else {
178
- // Expose handle to caller for visibility control
179
267
  options?.onHandle?.(handle);
180
268
  }
181
269
  }
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-extension-custom-ui.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-extension-custom-ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAKN,IAAI,EAGJ,KAAK,GACL,MAAM,4BAA4B,CAAC;AAEpC,mBAAmB,CAAC,SAAS,CAAC,mBAAmB,GAAG,UAEnD,OAAe,EACf,IAAmC;IAEnC,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;SAAM,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAC/B,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;SAAM,CAAC;QACP,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC1B,CAAC;AACF,CAAC,CAAC;AAEF,mBAAmB,CAAC,SAAS,CAAC,mBAAmB,GAAG,KAAK,WAExD,OAKmF,EACnF,OAOC;IAED,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACxC,MAAM,SAAS,GAAG,OAAO,EAAE,OAAO,IAAI,KAAK,CAAC;IAE5C,MAAM,aAAa,GAAG,CAAC,WAAoB,EAAE,EAAE;QAC9C,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;QAC7B,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAA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C;IAChE,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9D,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACvC,IAAI,KAAK,EAAE,CAAC;QACX,0CAA0C;QAC1C,MAAM,UAAU,GAAG,KAAK;aACtB,KAAK,CAAC,IAAI,CAAC;aACX,KAAK,CAAC,CAAC,CAAC,CAAC,6CAA6C;aACtD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;aAClD,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,IAAI,UAAU,EAAE,CAAC;YAChB,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC;IACF,CAAC;IACD,IAAI,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;AACzB,CAAC,CAAC","sourcesContent":["import { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Component,\n\ttype KeybindingsManager,\n\ttype OverlayHandle,\n\ttype OverlayOptions,\n\tText,\n\ttype Theme,\n\ttype TUI,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\n\nInteractiveModeBase.prototype.showExtensionNotify = function (\n\tthis: InteractiveModeBase,\n\tmessage: string,\n\ttype?: \"info\" | \"warning\" | \"error\",\n): void {\n\tif (type === \"error\") {\n\t\tthis.showError(message);\n\t} else if (type === \"warning\") {\n\t\tthis.showWarning(message);\n\t} else {\n\t\tthis.showStatus(message);\n\t}\n};\n\nInteractiveModeBase.prototype.showExtensionCustom = async function <T>(\n\tthis: InteractiveModeBase,\n\tfactory: (\n\t\ttui: TUI,\n\t\ttheme: Theme,\n\t\tkeybindings: KeybindingsManager,\n\t\tdone: (result: T) => void,\n\t) => (Component & { dispose?(): void }) | Promise<Component & { dispose?(): void }>,\n\toptions?: {\n\t\toverlay?: boolean;\n\t\tdeferInlineCustomUiFocus?: boolean;\n\t\thandlesInternalUiAction?: boolean;\n\t\tsignal?: AbortSignal;\n\t\toverlayOptions?: OverlayOptions | (() => OverlayOptions);\n\t\tonHandle?: (handle: OverlayHandle) => void;\n\t},\n): Promise<T> {\n\tconst savedText = this.editor.getText();\n\tconst isOverlay = options?.overlay ?? false;\n\n\tconst restoreEditor = (focusEditor: boolean) => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.editor.setText(savedText);\n\t\t// Focus fence: a surviving overlay owns input, and taking it away to\n\t\t// \"restore\" the editor would dismiss a newer native dialog.\n\t\tif (focusEditor && !this.ui.hasOverlay()) this.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\treturn new Promise((resolve, reject) => {\n\t\tlet component: (Component & { dispose?(): void }) | undefined;\n\t\tlet closed = false;\n\t\tlet mounted = false;\n\t\tlet overlayHandle: OverlayHandle | undefined;\n\t\tlet releaseHostInlineCustomUi: (() => void) | undefined;\n\t\tlet releaseOverlayInlineCustomUiFocusDeferral: (() => void) | undefined;\n\n\t\tconst disposeComponent = () => {\n\t\t\ttry {\n\t\t\t\tcomponent?.dispose?.();\n\t\t\t} catch {\n\t\t\t\t/* ignore dispose errors */\n\t\t\t}\n\t\t};\n\n\t\tconst releaseHostCustomUi = () => {\n\t\t\tif (component !== undefined && this.pendingInlineCustomUiFocus === component) {\n\t\t\t\tthis.pendingInlineCustomUiFocus = undefined;\n\t\t\t\tthis.notifyHostCustomUiStateListeners();\n\t\t\t}\n\t\t\treleaseHostInlineCustomUi?.();\n\t\t};\n\n\t\tconst cleanupAbortListener = () => {\n\t\t\toptions?.signal?.removeEventListener(\"abort\", abortCustomUi);\n\t\t};\n\n\t\tconst closeMountedUi = () => {\n\t\t\tif (!mounted) return;\n\t\t\tif (isOverlay) {\n\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral?.();\n\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral = undefined;\n\t\t\t\t// Hide THIS overlay, not whatever is on top: during engine-death\n\t\t\t\t// teardown an unrelated native overlay can be above this one, and the\n\t\t\t\t// generic top-overlay call would close that instead.\n\t\t\t\tif (overlayHandle) overlayHandle.hide();\n\t\t\t\telse this.ui.hideOverlay();\n\t\t\t} else {\n\t\t\t\trestoreEditor(!this.shouldDeferInlineCustomUiFocus() && this.pendingInlineCustomUiFocus !== component);\n\t\t\t}\n\t\t};\n\n\t\tconst close = (result: T) => {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\tcleanupAbortListener();\n\t\t\tcloseMountedUi();\n\t\t\tdisposeComponent();\n\t\t\treleaseHostCustomUi();\n\t\t\tresolve(result);\n\t\t};\n\n\t\tconst rejectAndClose = (reason: unknown) => {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\tcleanupAbortListener();\n\t\t\tcloseMountedUi();\n\t\t\tdisposeComponent();\n\t\t\treleaseHostCustomUi();\n\t\t\treject(reason);\n\t\t};\n\n\t\tfunction abortCustomUi(): void {\n\t\t\trejectAndClose(options?.signal?.reason ?? new Error(\"Extension custom UI aborted\"));\n\t\t}\n\n\t\tif (options?.signal?.aborted) {\n\t\t\tabortCustomUi();\n\t\t\treturn;\n\t\t}\n\t\treleaseHostInlineCustomUi = isOverlay ? undefined : this.beginHostInlineCustomUi();\n\t\tif (options?.signal?.aborted) {\n\t\t\tabortCustomUi();\n\t\t\treturn;\n\t\t}\n\t\toptions?.signal?.addEventListener(\"abort\", abortCustomUi, { once: true });\n\n\t\tlet factoryResult: (Component & { dispose?(): void }) | Promise<Component & { dispose?(): void }>;\n\t\ttry {\n\t\t\tfactoryResult = factory(this.ui, theme, this.keybindings, close);\n\t\t} catch (err) {\n\t\t\trejectAndClose(err);\n\t\t\treturn;\n\t\t}\n\n\t\tPromise.resolve(factoryResult)\n\t\t\t.then((c) => {\n\t\t\t\tif (closed) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tc.dispose?.();\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t/* ignore dispose errors */\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcomponent = c;\n\t\t\t\tif (options?.handlesInternalUiAction === true) {\n\t\t\t\t\t(component as Component & { handlesInternalUiAction?: boolean }).handlesInternalUiAction = true;\n\t\t\t\t}\n\t\t\t\tif (isOverlay) {\n\t\t\t\t\t// Resolve overlay options - can be static or dynamic function\n\t\t\t\t\tconst resolveOptions = (): OverlayOptions | undefined => {\n\t\t\t\t\t\tif (options?.overlayOptions) {\n\t\t\t\t\t\t\tconst opts =\n\t\t\t\t\t\t\t\ttypeof options.overlayOptions === \"function\"\n\t\t\t\t\t\t\t\t\t? options.overlayOptions()\n\t\t\t\t\t\t\t\t\t: options.overlayOptions;\n\t\t\t\t\t\t\treturn opts;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Fallback: use component's width property if available\n\t\t\t\t\t\tconst w = (component as { width?: number } | undefined)?.width;\n\t\t\t\t\t\treturn w ? { width: w } : undefined;\n\t\t\t\t\t};\n\t\t\t\t\tconst handle = this.ui.showOverlay(component, resolveOptions());\n\t\t\t\t\toverlayHandle = handle;\n\t\t\t\t\tmounted = true;\n\t\t\t\t\tif (options?.deferInlineCustomUiFocus) {\n\t\t\t\t\t\tlet releaseDeferral: (() => void) | undefined = this.beginInlineCustomUiFocusDeferral();\n\t\t\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral = () => {\n\t\t\t\t\t\t\treleaseDeferral?.();\n\t\t\t\t\t\t\treleaseDeferral = undefined;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst release = () => {\n\t\t\t\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral?.();\n\t\t\t\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral = undefined;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst wrappedHandle: OverlayHandle = {\n\t\t\t\t\t\t\thide: () => {\n\t\t\t\t\t\t\t\trelease();\n\t\t\t\t\t\t\t\thandle.hide();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsetHidden: (hidden) => {\n\t\t\t\t\t\t\t\tif (hidden) release();\n\t\t\t\t\t\t\t\thandle.setHidden(hidden);\n\t\t\t\t\t\t\t\tif (!hidden && releaseDeferral === undefined) {\n\t\t\t\t\t\t\t\t\treleaseDeferral = this.beginInlineCustomUiFocusDeferral();\n\t\t\t\t\t\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral = () => {\n\t\t\t\t\t\t\t\t\t\treleaseDeferral?.();\n\t\t\t\t\t\t\t\t\t\treleaseDeferral = undefined;\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisHidden: () => handle.isHidden(),\n\t\t\t\t\t\t\tfocus: () => handle.focus(),\n\t\t\t\t\t\t\tunfocus: (unfocusOptions) => handle.unfocus(unfocusOptions),\n\t\t\t\t\t\t\tisFocused: () => handle.isFocused(),\n\t\t\t\t\t\t};\n\t\t\t\t\t\t// Expose handle to caller for visibility control\n\t\t\t\t\t\toptions?.onHandle?.(wrappedHandle);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Expose handle to caller for visibility control\n\t\t\t\t\t\toptions?.onHandle?.(handle);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.disposeActiveSelector();\n\t\t\t\t\tthis.editorContainer.clear();\n\t\t\t\t\tthis.editorContainer.addChild(component);\n\t\t\t\t\tif (this.shouldDeferInlineCustomUiFocus()) {\n\t\t\t\t\t\tthis.pendingInlineCustomUiFocus = component;\n\t\t\t\t\t\tthis.notifyHostCustomUiStateListeners();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.ui.setFocus(component);\n\t\t\t\t\t}\n\t\t\t\t\tmounted = true;\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch((err) => {\n\t\t\t\trejectAndClose(err);\n\t\t\t});\n\t});\n};\n\nInteractiveModeBase.prototype.showExtensionError = function (\n\tthis: InteractiveModeBase,\n\textensionPath: string,\n\terror: string,\n\tstack?: string,\n): void {\n\tconst errorMsg = `Extension \"${extensionPath}\" error: ${error}`;\n\tconst errorText = new Text(theme.fg(\"error\", errorMsg), 1, 0);\n\tthis.chatContainer.addChild(errorText);\n\tif (stack) {\n\t\t// Show stack trace in dim color, indented\n\t\tconst stackLines = stack\n\t\t\t.split(\"\\n\")\n\t\t\t.slice(1) // Skip first line (duplicates error message)\n\t\t\t.map((line) => theme.fg(\"dim\", ` ${line.trim()}`))\n\t\t\t.join(\"\\n\");\n\t\tif (stackLines) {\n\t\t\tthis.chatContainer.addChild(new Text(stackLines, 1, 0));\n\t\t}\n\t}\n\tthis.ui.requestRender();\n};\n"]}
1
+ {"version":3,"file":"interactive-extension-custom-ui.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-extension-custom-ui.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,qBAAqB,EAErB,wBAAwB,EACxB,6BAA6B,GAE7B,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC7F,OAAO,EAKN,IAAI,EAGJ,KAAK,GACL,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE3E,SAAS,oCAAoC,CAAC,OAAmC;IAChF,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,CAAC;IAC/B,IAAI,MAAM,KAAK,aAAa,IAAI,MAAM,KAAK,eAAe,IAAI,MAAM,KAAK,cAAc,EAAE,CAAC;QACzF,MAAM,IAAI,KAAK,CACd,uGAAuG,CACvG,CAAC;IAC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C,CAAC","sourcesContent":["import {\n\tReservedBottomOverlay,\n\ttype TranscriptOverlayIntersection,\n\tTranscriptOverlayReserve,\n\ttranscriptOverlayIntersection,\n\ttype WrappedOverlayComponent,\n} from \"./components/reserved-bottom-overlay.ts\";\nimport { InteractiveModeBase, isFullscreenViewportAction } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Component,\n\ttype KeybindingsManager,\n\ttype OverlayHandle,\n\ttype OverlayOptions,\n\tText,\n\ttype Theme,\n\ttype TUI,\n\ttheme,\n} from \"./interactive-mode-deps.ts\";\nimport { isMouseWheelInput, isOverlayMounted } from \"./interactive-tui.ts\";\n\nfunction validateReservedBottomOverlayOptions(options: OverlayOptions | undefined): void {\n\tconst anchor = options?.anchor;\n\tif (anchor !== \"bottom-left\" && anchor !== \"bottom-center\" && anchor !== \"bottom-right\") {\n\t\tthrow new Error(\n\t\t\t\"reserveTranscriptRows requires an explicit bottom anchor: bottom-left, bottom-center, or bottom-right\",\n\t\t);\n\t}\n\tif (options?.row !== undefined) {\n\t\tthrow new Error(\"reserveTranscriptRows does not support overlayOptions.row\");\n\t}\n\tif (options?.offsetY !== undefined && options.offsetY !== 0) {\n\t\tthrow new Error(\"reserveTranscriptRows does not support a nonzero overlayOptions.offsetY\");\n\t}\n}\n\nInteractiveModeBase.prototype.showExtensionNotify = function (\n\tthis: InteractiveModeBase,\n\tmessage: string,\n\ttype?: \"info\" | \"warning\" | \"error\",\n): void {\n\tif (type === \"error\") {\n\t\tthis.showError(message);\n\t} else if (type === \"warning\") {\n\t\tthis.showWarning(message);\n\t} else {\n\t\tthis.showStatus(message);\n\t}\n};\n\nInteractiveModeBase.prototype.showExtensionCustom = async function <T>(\n\tthis: InteractiveModeBase,\n\tfactory: (\n\t\ttui: TUI,\n\t\ttheme: Theme,\n\t\tkeybindings: KeybindingsManager,\n\t\tdone: (result: T) => void,\n\t) => (Component & { dispose?(): void }) | Promise<Component & { dispose?(): void }>,\n\toptions?: {\n\t\toverlay?: boolean;\n\t\tdeferInlineCustomUiFocus?: boolean;\n\t\thandlesInternalUiAction?: boolean;\n\t\treserveTranscriptRows?: boolean;\n\t\tsignal?: AbortSignal;\n\t\toverlayOptions?: OverlayOptions | (() => OverlayOptions);\n\t\tonHandle?: (handle: OverlayHandle) => void;\n\t},\n): Promise<T> {\n\tconst savedText = this.editor.getText();\n\tconst isOverlay = options?.overlay ?? false;\n\n\tconst restoreEditor = (focusEditor: boolean) => {\n\t\tthis.editorContainer.clear();\n\t\tthis.editorContainer.addChild(this.editor);\n\t\tthis.editor.setText(savedText);\n\t\t// Focus fence: a surviving overlay owns input, and taking it away to\n\t\t// \"restore\" the editor would dismiss a newer native dialog.\n\t\tif (focusEditor && !this.ui.hasOverlay()) this.ui.setFocus(this.editor);\n\t\tthis.ui.requestRender();\n\t};\n\n\treturn new Promise((resolve, reject) => {\n\t\tlet component: (Component & { dispose?(): void }) | undefined;\n\t\tlet closed = false;\n\t\tlet mounted = false;\n\t\tlet overlayHandle: OverlayHandle | undefined;\n\t\tlet releaseHostInlineCustomUi: (() => void) | undefined;\n\t\tlet releaseOverlayInlineCustomUiFocusDeferral: (() => void) | undefined;\n\t\tlet transcriptReserveCoordinator: TranscriptOverlayReserve | undefined;\n\t\tlet releaseTranscriptReserveRegistration: (() => void) | undefined;\n\n\t\tconst disposeComponent = () => {\n\t\t\ttry {\n\t\t\t\tcomponent?.dispose?.();\n\t\t\t} catch {\n\t\t\t\t/* ignore dispose errors */\n\t\t\t}\n\t\t};\n\n\t\tconst releaseHostCustomUi = () => {\n\t\t\tif (component !== undefined && this.pendingInlineCustomUiFocus === component) {\n\t\t\t\tthis.pendingInlineCustomUiFocus = undefined;\n\t\t\t\tthis.notifyHostCustomUiStateListeners();\n\t\t\t}\n\t\t\treleaseHostInlineCustomUi?.();\n\t\t};\n\n\t\tconst cleanupAbortListener = () => {\n\t\t\toptions?.signal?.removeEventListener(\"abort\", abortCustomUi);\n\t\t};\n\n\t\tconst releaseTranscriptReserve = () => {\n\t\t\tconst coordinator = transcriptReserveCoordinator;\n\t\t\treleaseTranscriptReserveRegistration?.();\n\t\t\treleaseTranscriptReserveRegistration = undefined;\n\t\t\ttranscriptReserveCoordinator = undefined;\n\t\t\tif (!coordinator) return;\n\t\t\tif (coordinator.empty) {\n\t\t\t\tthis.documentContainer.removeChild(coordinator);\n\t\t\t\tif (this.transcriptOverlayReserve === coordinator) this.transcriptOverlayReserve = undefined;\n\t\t\t}\n\t\t\tthis.ui.requestRender();\n\t\t};\n\n\t\tconst closeMountedUi = () => {\n\t\t\tif (!mounted) return;\n\t\t\tif (isOverlay) {\n\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral?.();\n\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral = undefined;\n\t\t\t\treleaseTranscriptReserve();\n\t\t\t\t// Hide THIS overlay, not whatever is on top: during engine-death\n\t\t\t\t// teardown an unrelated native overlay can be above this one, and the\n\t\t\t\t// generic top-overlay call would close that instead.\n\t\t\t\tif (overlayHandle) overlayHandle.hide();\n\t\t\t\telse this.ui.hideOverlay();\n\t\t\t} else {\n\t\t\t\trestoreEditor(!this.shouldDeferInlineCustomUiFocus() && this.pendingInlineCustomUiFocus !== component);\n\t\t\t}\n\t\t};\n\n\t\tconst close = (result: T) => {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\tcleanupAbortListener();\n\t\t\tcloseMountedUi();\n\t\t\tdisposeComponent();\n\t\t\treleaseHostCustomUi();\n\t\t\tresolve(result);\n\t\t};\n\n\t\tconst rejectAndClose = (reason: unknown) => {\n\t\t\tif (closed) return;\n\t\t\tclosed = true;\n\t\t\tcleanupAbortListener();\n\t\t\tcloseMountedUi();\n\t\t\tdisposeComponent();\n\t\t\treleaseHostCustomUi();\n\t\t\treject(reason);\n\t\t};\n\n\t\tfunction abortCustomUi(): void {\n\t\t\trejectAndClose(options?.signal?.reason ?? new Error(\"Extension custom UI aborted\"));\n\t\t}\n\n\t\tif (options?.signal?.aborted) {\n\t\t\tabortCustomUi();\n\t\t\treturn;\n\t\t}\n\t\treleaseHostInlineCustomUi = isOverlay ? undefined : this.beginHostInlineCustomUi();\n\t\tif (options?.signal?.aborted) {\n\t\t\tabortCustomUi();\n\t\t\treturn;\n\t\t}\n\t\toptions?.signal?.addEventListener(\"abort\", abortCustomUi, { once: true });\n\n\t\tlet factoryResult: (Component & { dispose?(): void }) | Promise<Component & { dispose?(): void }>;\n\t\ttry {\n\t\t\tfactoryResult = factory(this.ui, theme, this.keybindings, close);\n\t\t} catch (err) {\n\t\t\trejectAndClose(err);\n\t\t\treturn;\n\t\t}\n\n\t\tPromise.resolve(factoryResult)\n\t\t\t.then((c) => {\n\t\t\t\tif (closed) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tc.dispose?.();\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t/* ignore dispose errors */\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tcomponent = c;\n\t\t\t\tif (options?.handlesInternalUiAction === true) {\n\t\t\t\t\t(component as Component & { handlesInternalUiAction?: boolean }).handlesInternalUiAction = true;\n\t\t\t\t}\n\t\t\t\tif (isOverlay) {\n\t\t\t\t\t// Resolve overlay options - can be static or dynamic function\n\t\t\t\t\tconst resolveOptions = (): OverlayOptions | undefined => {\n\t\t\t\t\t\tif (options?.overlayOptions) {\n\t\t\t\t\t\t\tconst opts =\n\t\t\t\t\t\t\t\ttypeof options.overlayOptions === \"function\"\n\t\t\t\t\t\t\t\t\t? options.overlayOptions()\n\t\t\t\t\t\t\t\t\t: options.overlayOptions;\n\t\t\t\t\t\t\treturn opts;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Fallback: use component's width property if available\n\t\t\t\t\t\tconst w = (component as { width?: number } | undefined)?.width;\n\t\t\t\t\t\treturn w ? { width: w } : undefined;\n\t\t\t\t\t};\n\t\t\t\t\t// A reserving overlay is bounded so a transcript strip always\n\t\t\t\t\t// survives, and the rows it still covers are added to the end of\n\t\t\t\t\t// the document so the scroll clamp can raise them into that strip.\n\t\t\t\t\tconst resolvedOverlayOptions = resolveOptions();\n\t\t\t\t\tlet mountedOverlayOptions = resolvedOverlayOptions;\n\t\t\t\t\tlet mountedComponent = component;\n\t\t\t\t\tlet pendingReserve: (() => TranscriptOverlayIntersection | undefined) | undefined;\n\t\t\t\t\tif (options?.reserveTranscriptRows === true) {\n\t\t\t\t\t\tvalidateReservedBottomOverlayOptions(resolvedOverlayOptions);\n\t\t\t\t\t\t// `custom()` documents the richer `ExtensionCustomComponent`\n\t\t\t\t\t\t// contract; this signature still names pi-tui's narrower one.\n\t\t\t\t\t\tconst bounded = new ReservedBottomOverlay(\n\t\t\t\t\t\t\tcomponent as WrappedOverlayComponent,\n\t\t\t\t\t\t\t() => this.ui.terminal.rows,\n\t\t\t\t\t\t\tresolvedOverlayOptions?.margin,\n\t\t\t\t\t\t\tresolvedOverlayOptions?.maxHeight,\n\t\t\t\t\t\t\t(data) => isFullscreenViewportAction(data, this.keybindings) || isMouseWheelInput(data),\n\t\t\t\t\t\t\t() => this.ui.requestRender(),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmountedComponent = bounded;\n\t\t\t\t\t\tif (resolvedOverlayOptions?.maxHeight !== undefined) {\n\t\t\t\t\t\t\tmountedOverlayOptions = { ...resolvedOverlayOptions };\n\t\t\t\t\t\t\tdelete mountedOverlayOptions.maxHeight;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// A raw host reset can remove the exact overlay without touching its\n\t\t\t\t\t\t// handle. Stop reserving in that frame, then remove the registration\n\t\t\t\t\t\t// after the document render traversal finishes.\n\t\t\t\t\t\tlet removalObserved = false;\n\t\t\t\t\t\tconst overlayShowing = (): boolean => {\n\t\t\t\t\t\t\tif (!isOverlayMounted(this.ui, mountedComponent)) {\n\t\t\t\t\t\t\t\tif (!removalObserved) {\n\t\t\t\t\t\t\t\t\tremovalObserved = true;\n\t\t\t\t\t\t\t\t\tqueueMicrotask(releaseTranscriptReserve);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (overlayHandle === undefined || overlayHandle.isHidden()) return false;\n\t\t\t\t\t\t\tconst visible = resolvedOverlayOptions?.visible;\n\t\t\t\t\t\t\treturn visible === undefined ? true : visible(this.ui.terminal.columns, this.ui.terminal.rows);\n\t\t\t\t\t\t};\n\t\t\t\t\t\tpendingReserve = () =>\n\t\t\t\t\t\t\toverlayShowing()\n\t\t\t\t\t\t\t\t? transcriptOverlayIntersection(\n\t\t\t\t\t\t\t\t\t\tbounded.renderedHeight,\n\t\t\t\t\t\t\t\t\t\tthis.ui.terminal.rows,\n\t\t\t\t\t\t\t\t\t\tthis.transcriptScrollView?.viewportHeight ?? 0,\n\t\t\t\t\t\t\t\t\t\tresolvedOverlayOptions?.margin,\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t: undefined;\n\t\t\t\t\t}\n\t\t\t\t\tconst handle = this.ui.showOverlay(mountedComponent, mountedOverlayOptions);\n\t\t\t\t\toverlayHandle = handle;\n\t\t\t\t\tmounted = true;\n\t\t\t\t\t// Register only once the overlay is really up and `mounted` is\n\t\t\t\t\t// set: a throw before this point must not leave a registry entry\n\t\t\t\t\t// or blank-row component in the transcript document.\n\t\t\t\t\tif (pendingReserve) {\n\t\t\t\t\t\tlet coordinator = this.transcriptOverlayReserve;\n\t\t\t\t\t\tif (!coordinator) {\n\t\t\t\t\t\t\tcoordinator = new TranscriptOverlayReserve(() => this.transcriptScrollView?.viewportHeight ?? 0);\n\t\t\t\t\t\t\tthis.transcriptOverlayReserve = coordinator;\n\t\t\t\t\t\t\ttranscriptReserveCoordinator = coordinator;\n\t\t\t\t\t\t\tthis.documentContainer.addChild(coordinator);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttranscriptReserveCoordinator = coordinator;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treleaseTranscriptReserveRegistration = coordinator.register(pendingReserve);\n\t\t\t\t\t}\n\t\t\t\t\tlet releaseDeferral: (() => void) | undefined;\n\t\t\t\t\tif (options?.deferInlineCustomUiFocus) {\n\t\t\t\t\t\treleaseDeferral = this.beginInlineCustomUiFocusDeferral();\n\t\t\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral = () => {\n\t\t\t\t\t\t\treleaseDeferral?.();\n\t\t\t\t\t\t\treleaseDeferral = undefined;\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.deferInlineCustomUiFocus || pendingReserve) {\n\t\t\t\t\t\tconst release = () => {\n\t\t\t\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral?.();\n\t\t\t\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral = undefined;\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst wrappedHandle: OverlayHandle = {\n\t\t\t\t\t\t\thide: () => {\n\t\t\t\t\t\t\t\trelease();\n\t\t\t\t\t\t\t\treleaseTranscriptReserve();\n\t\t\t\t\t\t\t\thandle.hide();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tsetHidden: (hidden) => {\n\t\t\t\t\t\t\t\tif (hidden) release();\n\t\t\t\t\t\t\t\thandle.setHidden(hidden);\n\t\t\t\t\t\t\t\tif (!hidden && options?.deferInlineCustomUiFocus && releaseDeferral === undefined) {\n\t\t\t\t\t\t\t\t\treleaseDeferral = this.beginInlineCustomUiFocusDeferral();\n\t\t\t\t\t\t\t\t\treleaseOverlayInlineCustomUiFocusDeferral = () => {\n\t\t\t\t\t\t\t\t\t\treleaseDeferral?.();\n\t\t\t\t\t\t\t\t\t\treleaseDeferral = undefined;\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tisHidden: () => handle.isHidden(),\n\t\t\t\t\t\t\tfocus: () => handle.focus(),\n\t\t\t\t\t\t\tunfocus: (unfocusOptions) => handle.unfocus(unfocusOptions),\n\t\t\t\t\t\t\tisFocused: () => handle.isFocused(),\n\t\t\t\t\t\t};\n\t\t\t\t\t\toverlayHandle = wrappedHandle;\n\t\t\t\t\t\toptions?.onHandle?.(wrappedHandle);\n\t\t\t\t\t} else {\n\t\t\t\t\t\toptions?.onHandle?.(handle);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tthis.disposeActiveSelector();\n\t\t\t\t\tthis.editorContainer.clear();\n\t\t\t\t\tthis.editorContainer.addChild(component);\n\t\t\t\t\tif (this.shouldDeferInlineCustomUiFocus()) {\n\t\t\t\t\t\tthis.pendingInlineCustomUiFocus = component;\n\t\t\t\t\t\tthis.notifyHostCustomUiStateListeners();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.ui.setFocus(component);\n\t\t\t\t\t}\n\t\t\t\t\tmounted = true;\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t}\n\t\t\t})\n\t\t\t.catch((err) => {\n\t\t\t\trejectAndClose(err);\n\t\t\t});\n\t});\n};\n\nInteractiveModeBase.prototype.showExtensionError = function (\n\tthis: InteractiveModeBase,\n\textensionPath: string,\n\terror: string,\n\tstack?: string,\n): void {\n\tconst errorMsg = `Extension \"${extensionPath}\" error: ${error}`;\n\tconst errorText = new Text(theme.fg(\"error\", errorMsg), 1, 0);\n\tthis.chatContainer.addChild(errorText);\n\tif (stack) {\n\t\t// Show stack trace in dim color, indented\n\t\tconst stackLines = stack\n\t\t\t.split(\"\\n\")\n\t\t\t.slice(1) // Skip first line (duplicates error message)\n\t\t\t.map((line) => theme.fg(\"dim\", ` ${line.trim()}`))\n\t\t\t.join(\"\\n\");\n\t\tif (stackLines) {\n\t\t\tthis.chatContainer.addChild(new Text(stackLines, 1, 0));\n\t\t}\n\t}\n\tthis.ui.requestRender();\n};\n"]}
@@ -10,10 +10,12 @@ import type { EarlyInputSnapshot } from "../../main-early-input.ts";
10
10
  import type { RemoteToolExecutionComponent } from "../interactive-engine/remote-renderer.ts";
11
11
  import { KeybindingsReloadCoordinator } from "../rpc/rpc-keybindings-reload.ts";
12
12
  import type { AtomicWorkingLoader } from "./components/atomic-working-status.ts";
13
+ import type { TranscriptOverlayReserve } from "./components/reserved-bottom-overlay.ts";
13
14
  import { type AgentSession, type AgentSessionRuntime, type AssistantMessage, type AssistantMessageComponent, type AutocompleteProvider, type AutocompleteProviderFactory, type BashExecutionComponent, type Component, Container, type CountdownTimer, CustomEditor, type EditorComponent, type EditorFactory, type ExtensionEditorComponent, type ExtensionInputComponent, type ExtensionSelectorComponent, FooterComponent, FooterDataProvider, type HostCustomUiStateListener, InteractiveThemeController, KeybindingsManager, type Loader, type LoaderIndicatorOptions, type Spacer, type Text, type ToolExecutionComponent, type TUI, UsageMeterComponent } from "./interactive-mode-deps.ts";
14
15
  import "./interactive-mode-surface.ts";
15
16
  import type { CompactionQueuedMessage, InteractiveModeOptions } from "./interactive-mode-types.ts";
16
17
  import type { InteractiveSubmission } from "./interactive-submission.ts";
18
+ export declare function isFullscreenViewportAction(data: string, keybindings: KeybindingsManager): boolean;
17
19
  /**
18
20
  * Decide whether the fullscreen viewport should run before the focused
19
21
  * component. `isMouseInput` is classified by pi-tui's own mouse predicate in
@@ -136,6 +138,7 @@ export declare class InteractiveModeBase {
136
138
  deferredInlineCustomUiFocusDepth: number;
137
139
  pendingInlineCustomUiFocus: Component | undefined;
138
140
  hostCustomUiStateListeners: Set<HostCustomUiStateListener>;
141
+ transcriptOverlayReserve: TranscriptOverlayReserve | undefined;
139
142
  themeController: InteractiveThemeController;
140
143
  extensionWidgetsAbove: Map<string, Component & {
141
144
  dispose?(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-mode-base.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAA+B,KAAK,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE7G,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,qCAAqC,CAA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,MAAM,IAAI,GAAG,MAAM,IAAI,CAGpD;IAED,mBAAmB,CAAC,GAAG,EAAE,GAAG,EAAE,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI,CAMpE;YAEa,qBAAqB;IAcnC,kBAAkB,IAAI,IAAI,CAGzB;IAEO,OAAO,EAAE,sBAAsB,CAAC;IAExC,YAAY,WAAW,EAAE,mBAAmB,EAAE,OAAO,GAAE,sBAA2B,EAmGjF;IAGD,MAAM,CAAC,QAAQ,CAAC,gBAAgB,MAAM;IAEtC;;;;OAIG;IACH,cAAc,UAAS;CACvB"}
@@ -21,6 +21,9 @@ const FULLSCREEN_VIEWPORT_ACTIONS = [
21
21
  "tui.altScreen.top",
22
22
  "tui.altScreen.bottom",
23
23
  ];
24
+ export function isFullscreenViewportAction(data, keybindings) {
25
+ return FULLSCREEN_VIEWPORT_ACTIONS.some((action) => keybindings.matches(data, action));
26
+ }
24
27
  /**
25
28
  * Decide whether the fullscreen viewport should run before the focused
26
29
  * component. `isMouseInput` is classified by pi-tui's own mouse predicate in
@@ -35,7 +38,7 @@ export function shouldHandleFullscreenViewportInput(focused, editor, data, isMou
35
38
  return !focusedIsOverlay;
36
39
  if (focusedIsOverlay && keybindings.matches(data, "app.thinking.toggle"))
37
40
  return false;
38
- return !FULLSCREEN_VIEWPORT_ACTIONS.some((action) => keybindings.matches(data, action));
41
+ return !isFullscreenViewportAction(data, keybindings);
39
42
  }
40
43
  function isCommandLikeStartupInput(text) {
41
44
  const trimmed = text.trimStart();
@@ -253,6 +256,7 @@ export class InteractiveModeBase {
253
256
  this.deferredInlineCustomUiFocusDepth = 0;
254
257
  this.pendingInlineCustomUiFocus = undefined;
255
258
  this.hostCustomUiStateListeners = new Set();
259
+ this.transcriptOverlayReserve = undefined;
256
260
  // Extension widgets (components rendered above/below the editor)
257
261
  this.extensionWidgetsAbove = new Map();
258
262
  this.extensionWidgetsBelow = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-mode-base.js","source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AE,IAAI,CAAC,gCAAgC,GAAG,SAAS,CAAC;gBACzG,IAAI,IAAI,CAAC,aAAa,CAAC,mBAAmB,KAAK,OAAO;oBACrD,IAAI,CAAC,aAAa,CAAC,mBAAmB,GAAG,SAAS,CAAC;YACrD,CAAC,CAAC;QACH,CAAC,EACD,IAAI,CAAC,WAAW,CAChB,CAAC;IACH,CAAC;IAED,0DAA0D;aAC1C,qBAAgB,GAAG,EAAE,AAAL,CAAM;CAQtC","sourcesContent":["/**\n * Shared state and constructor wiring for interactive mode.\n * Responsibility-specific behavior is installed by sibling modules.\n */\nimport { isKeyRelease, isViewportTUI, type ScrollView, type TuiInputListener } from \"@earendil-works/pi-tui\";\n\nimport type { AgentSessionQueuePauseControl } from \"../../core/agent-session-methods.ts\";\nimport type { MarkdownTransformer } from \"../../core/extensions/types.ts\";\nimport type { MermaidRenderingMode } from \"../../core/settings-manager.ts\";\nimport type { EarlyInputSnapshot } from \"../../main-early-input.ts\";\nimport { readClipboardText } from \"../../utils/clipboard.ts\";\nimport { renderEngineDiagnostic } from \"../interactive-engine/engine-diagnostic-view.ts\";\nimport { attachInteractiveEngineHost } from \"../interactive-engine/extension-ui-bridge.ts\";\nimport type { RemoteToolExecutionComponent } from \"../interactive-engine/remote-renderer.ts\";\nimport { KeybindingsReloadCoordinator } from \"../rpc/rpc-keybindings-reload.ts\";\nimport type { AtomicWorkingLoader } from \"./components/atomic-working-status.ts\";\nimport { createMermaidMarkdownTransformer } from \"./components/mermaid.ts\";\nimport {\n\ttype AgentSession,\n\ttype AgentSessionRuntime,\n\ttype AssistantMessage,\n\ttype AssistantMessageComponent,\n\ttype AutocompleteProvider,\n\ttype AutocompleteProviderFactory,\n\ttype BashExecutionComponent,\n\ttype Component,\n\tContainer,\n\ttype CountdownTimer,\n\tCustomEditor,\n\ttype EditorComponent,\n\ttype EditorFactory,\n\ttype ExtensionEditorComponent,\n\ttype ExtensionInputComponent,\n\ttype ExtensionSelectorComponent,\n\tFooterComponent,\n\tFooterDataProvider,\n\tgetEditorTheme,\n\ttype HostCustomUiStateListener,\n\tInteractiveThemeController,\n\tKeybindingsManager,\n\ttype Loader,\n\ttype LoaderIndicatorOptions,\n\ttype Spacer,\n\tsetKeybindings,\n\tsetRegisteredThemes,\n\ttype Text,\n\ttype ToolExecutionComponent,\n\ttype TUI,\n\ttheme,\n\tUsageMeterComponent,\n\tVERSION,\n} from \"./interactive-mode-deps.ts\";\nimport type {} from \"./interactive-mode-surface.ts\";\nimport type { CompactionQueuedMessage, InteractiveModeOptions } from \"./interactive-mode-types.ts\";\nimport { StartupChatContainer } from \"./interactive-startup-chat-container.ts\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\nimport {\n\tcreateInteractiveTui,\n\tcreateInteractiveTuiReference,\n\thandleFocusedOverlayInternalUiAction,\n\ttype InteractiveTui,\n\ttype InternalUiActionResult,\n} from \"./interactive-tui.ts\";\n\nconst FULLSCREEN_VIEWPORT_ACTIONS = [\n\t\"tui.altScreen.pageUp\",\n\t\"tui.altScreen.pageDown\",\n\t\"tui.altScreen.halfPageUp\",\n\t\"tui.altScreen.halfPageDown\",\n\t\"tui.altScreen.previousPrompt\",\n\t\"tui.altScreen.nextPrompt\",\n\t\"tui.altScreen.top\",\n\t\"tui.altScreen.bottom\",\n] as const;\n\n/**\n * Decide whether the fullscreen viewport should run before the focused\n * component. `isMouseInput` is classified by pi-tui's own mouse predicate in\n * `AtomicTuiAltScreen`, so this policy does not duplicate terminal grammars.\n * Mouse deferral is limited to actual overlays so inline components do not\n * disable pi-tui's application-owned transcript selection path.\n */\nexport function shouldHandleFullscreenViewportInput(\n\tfocused: Component | null,\n\teditor: Component,\n\tdata: string,\n\tisMouseInput: boolean,\n\tfocusedIsOverlay: boolean,\n\tkeybindings: KeybindingsManager,\n): boolean {\n\tif (focused === editor || !focused?.handleInput) return true;\n\tif (isMouseInput) return !focusedIsOverlay;\n\tif (focusedIsOverlay && keybindings.matches(data, \"app.thinking.toggle\")) return false;\n\treturn !FULLSCREEN_VIEWPORT_ACTIONS.some((action) => keybindings.matches(data, action));\n}\n\nfunction isCommandLikeStartupInput(text: string): boolean {\n\tconst trimmed = text.trimStart();\n\treturn trimmed.startsWith(\"/\") || trimmed.startsWith(\"!\");\n}\n\nexport function seedStartupInput(\n\tpendingUserInputs: InteractiveSubmission[],\n\teditor: { setText(text: string): void },\n\tstartupInput: EarlyInputSnapshot | undefined,\n\tstartupReplayInputs: string[] = [],\n\tsetStartupDraftText?: (text: string) => void,\n\tsetStartupReplayActiveInput?: (text: string) => void,\n): void {\n\tif (!startupInput) return;\n\tlet commandReplayStarted = false;\n\tfor (const submission of startupInput.submissions) {\n\t\tif (commandReplayStarted) {\n\t\t\tstartupReplayInputs.push(submission);\n\t\t} else if (isCommandLikeStartupInput(submission)) {\n\t\t\tconst commandText = submission.trim();\n\t\t\tcommandReplayStarted = true;\n\t\t\teditor.setText(commandText);\n\t\t\tsetStartupReplayActiveInput?.(commandText);\n\t\t} else {\n\t\t\tpendingUserInputs.push({ text: submission, draft: submission });\n\t\t}\n\t}\n\tif (startupInput.text.length === 0) return;\n\tif (commandReplayStarted) {\n\t\tsetStartupDraftText?.(startupInput.text);\n\t} else {\n\t\teditor.setText(startupInput.text);\n\t}\n}\n\nexport interface InteractiveTuiInputSubscription {\n\thandler: TuiInputListener;\n\tunsubscribe: () => void;\n}\n\nexport class InteractiveModeBase {\n\truntimeHost: AgentSessionRuntime;\n\n\tui: TUI;\n\tprivate renderer: InteractiveTui;\n\n\tprivate readonly shouldHandleViewportInput = (\n\t\tdata: string,\n\t\tisMouseInput: boolean,\n\t\tfocusedIsOverlay: boolean,\n\t): boolean => {\n\t\treturn shouldHandleFullscreenViewportInput(\n\t\t\tthis.renderer.getFocusedComponent(),\n\t\t\tthis.editor,\n\t\t\tdata,\n\t\t\tisMouseInput,\n\t\t\tfocusedIsOverlay,\n\t\t\tthis.keybindings,\n\t\t);\n\t};\n\tprivate readonly onOverlayUnhandledInput = (data: string): boolean => this.handleOverlayUnhandledInput(data);\n\tprivate readonly onOverlayInternalUiAction = (url: string): InternalUiActionResult =>\n\t\thandleFocusedOverlayInternalUiAction(this.renderer, url);\n\n\t/** Dispatch the host thinking action after a focused workflow overlay declines input. */\n\thandleOverlayUnhandledInput(data: string): boolean {\n\t\tif (isKeyRelease(data) || !this.keybindings.matches(data, \"app.thinking.toggle\")) return false;\n\t\t// Reuse the default editor's action dispatcher even while a workflow\n\t\t// overlay owns focus. This keeps the host binding and its user remap as\n\t\t// the source of truth instead of calling the implementation directly.\n\t\treturn this.defaultEditor.handleInput(data);\n\t}\n\n\tprivate readonly onRightClickPaste = (): void => {\n\t\tvoid this.handleRightClickPaste();\n\t};\n\n\tchatContainer: Container;\n\tdocumentContainer: Container;\n\n\ttranscriptScrollView: ScrollView | undefined;\n\n\tfullscreenLayoutRoot: Component | undefined;\n\n\tresourceDisclosureContainer: Container;\n\tstartupNoticesContainer: Container;\n\tpendingMessagesContainer: Container;\n\n\tstatusContainer: Container;\n\n\tdefaultEditor: CustomEditor;\n\n\teditor: EditorComponent;\n\n\teditorComponentFactory: EditorFactory | undefined;\n\n\tautocompleteProvider: AutocompleteProvider | undefined;\n\n\tautocompleteProviderWrappers: AutocompleteProviderFactory[] = [];\n\n\tfdPath: string | undefined;\n\n\teditorContainer: Container;\n\n\tactiveSelectorToken: object | undefined;\n\n\tactiveSelectorDispose: (() => void) | undefined;\n\n\tfooter: FooterComponent;\n\tfooterContainer: Container;\n\n\tusageMeter: UsageMeterComponent;\n\n\tfooterDataProvider: FooterDataProvider;\n\n\t// Stored so the same manager can be injected into custom editors, selectors, and extension UI.\n\tkeybindings: KeybindingsManager;\n\n\treloadCoordinator: KeybindingsReloadCoordinator;\n\n\tinteractiveEngineShortcutHandler: ((data: string) => boolean) | undefined;\n\n\tdisposeInteractiveEngineHost: () => void = () => {};\n\n\tversion: string;\n\n\tisInitialized = false;\n\n\tonInputCallback?: (submission: InteractiveSubmission) => void;\n\n\tpendingUserInputs: InteractiveSubmission[] = [];\n\n\tstartupReplayInputs: string[] = [];\n\n\tstartupReplayActiveInput: string | undefined = undefined;\n\n\tstartupDraftText: string | undefined = undefined;\n\n\tstartupCookedInputRecovered = false;\n\n\tdeferredRenderedUserInputs: string[] = [];\n\n\tdeferredRenderedUserInputComponents = new Map<string, Component[][]>();\n\n\tloadingAnimation: Loader | AtomicWorkingLoader | undefined = undefined;\n\n\tworkingMessage: string | undefined = undefined;\n\n\tworkingVisible = true;\n\n\tworkingIndicatorOptions: LoaderIndicatorOptions | undefined = undefined;\n\n\treadonly defaultWorkingMessage = \"Working...\";\n\n\treadonly defaultHiddenThinkingLabel = \"Thinking...\";\n\n\thiddenThinkingLabel = this.defaultHiddenThinkingLabel;\n\n\tlastSigintTime = 0;\n\n\tlastEscapeTime = 0;\n\n\tchangelogMarkdown: string | undefined = undefined;\n\n\tstartupNoticesShown = false;\n\tstartupNoticesPrepared = false;\n\n\tanthropicSubscriptionWarningShown = false;\n\n\tfirstRunNoticeVisible = false;\n\n\thadLastChangelogVersionAtStartup = false;\n\n\tfirstRunOnboardingNoticeComponents: Component[] = [];\n\n\tautoTrustOnReloadCwd: string | undefined;\n\n\t// Status line tracking (for mutating immediately-sequential status updates)\n\tlastStatusSpacer: Spacer | undefined = undefined;\n\n\tlastStatusText: Text | undefined = undefined;\n\n\t// Streaming message tracking\n\tstreamingComponent: AssistantMessageComponent | undefined = undefined;\n\n\tstreamingMessage: AssistantMessage | undefined = undefined;\n\n\t// Tool execution tracking: toolCallId -> component\n\tpendingTools = new Map<string, ToolExecutionComponent | RemoteToolExecutionComponent>();\n\n\t// Tool output expansion state\n\ttoolOutputExpanded = false;\n\n\t// Thinking block visibility state\n\thideThinkingBlock = false;\n\toutputPad: 0 | 1 = 1;\n\n\tmermaidMarkdownTransformer: MarkdownTransformer = createMermaidMarkdownTransformer({\n\t\tgetMode: () => this.settingsManager.getMermaidRenderingMode(),\n\t\ttheme,\n\t});\n\tmermaidMarkdownTransformerMode: MermaidRenderingMode | undefined;\n\n\t// Skill commands: command name -> skill file path\n\tskillCommands = new Map<string, string>();\n\n\t// Agent subscription unsubscribe function\n\tunsubscribe?: () => void;\n\n\tsignalCleanupHandlers: Array<() => void> = [];\n\n\t// Track if editor is in bash mode (text starts with !)\n\tisBashMode = false;\n\n\t// Track current bash execution component\n\tbashComponent: BashExecutionComponent | undefined = undefined;\n\n\t// Track pending bash components (shown in pending area, moved to chat on submit)\n\tpendingBashComponents: BashExecutionComponent[] = [];\n\n\t// Auto-compaction state\n\tautoCompactionLoader: AtomicWorkingLoader | undefined = undefined;\n\n\tautoCompactionEscapeHandler?: () => void;\n\n\t/** True once the pre-compaction Escape handler has been captured for restore. */\n\tautoCompactionEscapeHandlerSaved = false;\n\n\t/** True while `runUserPromptTurn()` owns the working loader. */\n\tpromptTurnWorkingLoaderActive = false;\n\n\t// Auto-retry state\n\tretryLoader: Loader | undefined = undefined;\n\tfallbackLoader: Loader | undefined = undefined;\n\n\tretryCountdown: CountdownTimer | undefined = undefined;\n\n\tretryEscapeHandler?: () => void;\n\n\t// Messages queued while compaction is running\n\tcompactionQueuedMessages: CompactionQueuedMessage[] = [];\n\n\t/** Keeps input queued while automatic compaction hands off to a manual request. */\n\tmanualCompactionTakeoverPending = false;\n\n\t// Deferred extension load state (first paint happens before extensions load)\n\tdeferredStartupPending = false;\n\tinitialStartupBinding = false;\n\tdeferredStartupPromise: Promise<void> | undefined = undefined;\n\n\tinputHandlerReadyRecorded = false;\n\n\tfirstSubmitRecorded = false;\n\n\t// Shutdown state\n\tshutdownRequested = false;\n\n\t// Extension UI state\n\textensionSelector: ExtensionSelectorComponent | undefined = undefined;\n\n\textensionInput: ExtensionInputComponent | undefined = undefined;\n\n\textensionEditor: ExtensionEditorComponent | undefined = undefined;\n\n\ttuiInputSubscriptions = new Set<InteractiveTuiInputSubscription>();\n\n\textensionTerminalInputSubscriptions = new Set<InteractiveTuiInputSubscription>();\n\n\ttuiRendererChangeListeners = new Set<() => void>();\n\n\tblockingInlineCustomUiDepth = 0;\n\n\tdeferredInlineCustomUiFocusDepth = 0;\n\n\tpendingInlineCustomUiFocus: Component | undefined = undefined;\n\n\thostCustomUiStateListeners = new Set<HostCustomUiStateListener>();\n\n\tthemeController: InteractiveThemeController;\n\n\t// Extension widgets (components rendered above/below the editor)\n\textensionWidgetsAbove = new Map<string, Component & { dispose?(): void }>();\n\n\textensionWidgetsBelow = new Map<string, Component & { dispose?(): void }>();\n\n\twidgetContainerAbove!: Container;\n\n\twidgetContainerBelow!: Container;\n\n\t// Custom footer from extension (undefined = use built-in footer)\n\tcustomFooter: (Component & { dispose?(): void }) | undefined = undefined;\n\n\t// Header container that holds the built-in or custom header\n\theaderContainer: Container;\n\n\t// Built-in header (logo + keybinding hints + changelog)\n\tbuiltInHeader: Component | undefined = undefined;\n\n\t// Custom header from extension (undefined = use built-in header)\n\tcustomHeader: (Component & { dispose?(): void }) | undefined = undefined;\n\n\t// Convenience accessors\n\tget session(): AgentSession & AgentSessionQueuePauseControl {\n\t\treturn this.runtimeHost.session as AgentSession & AgentSessionQueuePauseControl;\n\t}\n\n\t/** Includes the short handoff window that an isolated engine cannot mirror. */\n\tget compactionActive(): boolean {\n\t\treturn this.session.isCompacting || this.manualCompactionTakeoverPending;\n\t}\n\n\tget agent() {\n\t\treturn this.session.agent;\n\t}\n\n\tget sessionManager() {\n\t\treturn this.session.sessionManager;\n\t}\n\n\tget settingsManager() {\n\t\treturn this.session.settingsManager;\n\t}\n\n\t/**\n\t * Tears down the selector that owns `editorContainer`, including in-flight\n\t * work such as a model catalog refresh.\n\t *\n\t * This lives on the base class so behavior modules can dispose a selector\n\t * without relying on `interactive-selectors.ts` load order.\n\t */\n\tdisposeActiveSelector(): void {\n\t\tconst dispose = this.activeSelectorDispose;\n\t\tthis.activeSelectorToken = undefined;\n\t\tthis.activeSelectorDispose = undefined;\n\t\tdispose?.();\n\t}\n\n\taddTuiInputListener(handler: TuiInputListener): () => void {\n\t\tconst subscription: InteractiveTuiInputSubscription = {\n\t\t\thandler,\n\t\t\tunsubscribe: this.ui.addInputListener(handler),\n\t\t};\n\t\tthis.tuiInputSubscriptions.add(subscription);\n\t\treturn () => {\n\t\t\tsubscription.unsubscribe();\n\t\t\tthis.tuiInputSubscriptions.delete(subscription);\n\t\t};\n\t}\n\n\trebindTuiInputListeners(): void {\n\t\tfor (const subscription of this.tuiInputSubscriptions) {\n\t\t\tsubscription.unsubscribe();\n\t\t\tsubscription.unsubscribe = this.ui.addInputListener(subscription.handler);\n\t\t}\n\t}\n\n\tonTuiRendererChange(listener: () => void): () => void {\n\t\tthis.tuiRendererChangeListeners.add(listener);\n\t\treturn () => this.tuiRendererChangeListeners.delete(listener);\n\t}\n\n\tmountInteractiveTui(tui: TUI, components: readonly Component[]): void {\n\t\tfor (const component of components) tui.addChild(component);\n\t\tif (isViewportTUI(tui)) {\n\t\t\tif (!this.fullscreenLayoutRoot) throw new Error(\"Fullscreen layout is not initialized\");\n\t\t\ttui.setLayoutRoot(this.fullscreenLayoutRoot);\n\t\t}\n\t}\n\n\tprivate async handleRightClickPaste(): Promise<void> {\n\t\tconst target = this.renderer.getFocusedComponent();\n\t\tconst handleInput = target?.handleInput;\n\t\tif (!target || !handleInput) return;\n\t\ttry {\n\t\t\tconst text = await readClipboardText();\n\t\t\tif (!text || this.renderer.getFocusedComponent() !== target) return;\n\t\t\thandleInput.call(target, `\\x1b[200~${text}\\x1b[201~`);\n\t\t\tthis.ui.requestRender();\n\t\t} catch {\n\t\t\t// Clipboard paste is best-effort; permission and native-module failures are common.\n\t\t}\n\t}\n\n\tstopInteractiveTui(): void {\n\t\twhile (this.renderer.hasOverlayEntries) this.renderer.hideOverlay();\n\t\tthis.ui.stop();\n\t}\n\n\tdeclare options: InteractiveModeOptions;\n\n\tconstructor(runtimeHost: AgentSessionRuntime, options: InteractiveModeOptions = {}) {\n\t\tthis.runtimeHost = runtimeHost;\n\t\tthis.options = options;\n\t\tthis.deferredStartupPending = Boolean(options.deferredExtensionLoad);\n\t\tthis.autoTrustOnReloadCwd = options.autoTrustOnReloadCwd;\n\t\tthis.runtimeHost.setBeforeSessionInvalidate(() => {\n\t\t\tthis.resetExtensionUI();\n\t\t});\n\t\tthis.runtimeHost.setRebindSession(async () => {\n\t\t\tawait this.rebindCurrentSession();\n\t\t});\n\t\tthis.version = VERSION;\n\t\tthis.renderer = createInteractiveTui({\n\t\t\tshowHardwareCursor: this.settingsManager.getShowHardwareCursor(),\n\t\t\tlogDirectory: runtimeHost.services.agentDir,\n\t\t\tterminal: options.terminal,\n\t\t\tonRightClickPaste: this.onRightClickPaste,\n\t\t\tshouldHandleViewportInput: this.shouldHandleViewportInput,\n\t\t\tonOverlayUnhandledInput: this.onOverlayUnhandledInput,\n\t\t\tonOverlayInternalUiAction: this.onOverlayInternalUiAction,\n\t\t\tonInternalUiAction: () => {\n\t\t\t\tthis.jumpToTranscriptEnd();\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t});\n\t\tthis.ui = createInteractiveTuiReference(() => this.renderer);\n\t\tthis.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n\t\tthis.headerContainer = new Container();\n\t\tthis.documentContainer = new Container();\n\t\tthis.documentContainer.addChild(this.headerContainer);\n\t\tthis.chatContainer = new StartupChatContainer();\n\t\tthis.documentContainer.addChild(this.chatContainer);\n\t\tthis.resourceDisclosureContainer = new Container();\n\t\tthis.startupNoticesContainer = new Container();\n\t\t// The isolated engine can emit session_start UI requests as soon as its\n\t\t// bridge attaches below, before init() mounts chat in the TUI. Reserve the\n\t\t// ordering slots now so those messages can never precede RESOURCES.\n\t\tthis.chatContainer.addChild(this.resourceDisclosureContainer);\n\t\tthis.chatContainer.addChild(this.startupNoticesContainer);\n\t\tthis.pendingMessagesContainer = new Container();\n\t\tthis.statusContainer = new Container();\n\t\tthis.widgetContainerAbove = new Container();\n\t\tthis.widgetContainerBelow = new Container();\n\t\tthis.keybindings = KeybindingsManager.create(runtimeHost.services.agentDir);\n\t\tthis.reloadCoordinator = new KeybindingsReloadCoordinator(this.keybindings);\n\t\tsetKeybindings(this.keybindings);\n\t\tconst editorPaddingX = this.settingsManager.getEditorPaddingX();\n\t\tconst autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();\n\t\tthis.defaultEditor = new CustomEditor(this.ui, getEditorTheme(), this.keybindings, {\n\t\t\tpaddingX: editorPaddingX,\n\t\t\tautocompleteMaxVisible,\n\t\t});\n\n\t\tthis.editor = this.defaultEditor;\n\t\tthis.editorContainer = new Container();\n\t\tthis.editorContainer.addChild(this.editor as Component);\n\t\tthis.footerDataProvider = new FooterDataProvider(this.sessionManager.getCwd());\n\t\tthis.footer = new FooterComponent(this.session, this.footerDataProvider);\n\t\tthis.footerContainer = new Container();\n\t\tthis.footerContainer.addChild(this.footer);\n\t\tthis.usageMeter = new UsageMeterComponent(this.session);\n\t\tthis.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);\n\n\t\t// Load hide thinking block setting\n\t\tthis.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n\t\tthis.outputPad = this.settingsManager.getOutputPad();\n\n\t\t// Register themes from resource loader and initialize\n\t\tsetRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n\t\tthis.themeController = new InteractiveThemeController(\n\t\t\tthis.ui,\n\t\t\tthis.settingsManager,\n\t\t\t(message) => this.showError(message),\n\t\t\t() => this.updateEditorBorderColor(),\n\t\t);\n\t\tthis.disposeInteractiveEngineHost = attachInteractiveEngineHost(\n\t\t\truntimeHost,\n\t\t\tthis.createExtensionUIContext(),\n\t\t\t(diagnostic) =>\n\t\t\t\trenderEngineDiagnostic(diagnostic, {\n\t\t\t\t\tstopWorkingLoader: () => this.stopWorkingLoader(),\n\t\t\t\t\tshowStatus: (message) => this.showStatus(message),\n\t\t\t\t\tshowError: (message) => this.showError(message),\n\t\t\t\t}),\n\t\t\t{\n\t\t\t\tisFullscreen: () => this.renderer.mode === \"fullscreen\",\n\t\t\t\tonRendererReplaced: (listener) => this.onTuiRendererChange(listener),\n\t\t\t},\n\t\t\t(handler) => {\n\t\t\t\tthis.interactiveEngineShortcutHandler = handler;\n\t\t\t\tthis.defaultEditor.onExtensionShortcut = handler;\n\t\t\t\treturn () => {\n\t\t\t\t\tif (this.interactiveEngineShortcutHandler === handler) this.interactiveEngineShortcutHandler = undefined;\n\t\t\t\t\tif (this.defaultEditor.onExtensionShortcut === handler)\n\t\t\t\t\t\tthis.defaultEditor.onExtensionShortcut = undefined;\n\t\t\t\t};\n\t\t\t},\n\t\t\tthis.keybindings,\n\t\t);\n\t}\n\n\t// Maximum total widget lines to prevent viewport overflow\n\tstatic readonly MAX_WIDGET_LINES = 10;\n\n\t/**\n\t * Gracefully shutdown the agent.\n\t * Stops the TUI before emitting shutdown events so extension UI cleanup cannot\n\t * repaint the final frame while the process is exiting.\n\t */\n\tisShuttingDown = false;\n}\n"]}
1
+ {"version":3,"file":"interactive-mode-base.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-mode-base.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAA0C,MAAM,wBAAwB,CAAC;AAM7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAE3F,OAAO,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAC;AAEhF,OAAO,EAAE,gCAAgC,EAAE,MAAM,yBAAyB,CAAC;AAE3E,OAAO,EASN,SAAS,EAET,YAAY,EAMZ,eAAe,EACf,kBAAkB,EAClB,cAAc,EAEd,0BAA0B,EAC1B,kBAAkB,EAIlB,cAAc,EACd,mBAAmB,EAInB,KAAK,EACL,mBAAmB,EACnB,OAAO,GACP,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,OAAO,EACN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X,IAAI,CAAC,wBAAwB,EAAE,EAC/B,CAAC,UAAU,EAAE,EAAE,CACd,sBAAsB,CAAC,UAAU,EAAE;YAClC,iBAAiB,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,iBAAiB,EAAE;YACjD,UAAU,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;YACjD,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC/C,CAAC,EACH;YACC,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY;YACvD,kBAAkB,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC;SACpE,EACD,CAAC,OAAO,EAAE,EAAE;YACX,IAAI,CAAC,gCAAgC,GAAG,OAAO,CAAC;YAChD,IAAI,CAAC,aAAa,CAAC,mBAAmB,GAAG,OAAO,CAAC;YACjD,OAAO,GAAG,EAAE;gBACX,IAAI,IAAI,CAAC,gCAAgC,KAAK,OAAO;oBAAE,IAAI,CAAC,gCAAgC,GAAG,SAAS,CAAC;gBACzG,IAAI,IAAI,CAAC,aAAa,CAAC,mBAAmB,KAAK,OAAO;oBACrD,IAAI,CAAC,aAAa,CAAC,mBAAmB,GAAG,SAAS,CAAC;YACrD,CAAC,CAAC;QACH,CAAC,EACD,IAAI,CAAC,WAAW,CAChB,CAAC;IACH,CAAC;IAED,0DAA0D;aAC1C,qBAAgB,GAAG,EAAE,AAAL,CAAM;CAQtC","sourcesContent":["/**\n * Shared state and constructor wiring for interactive mode.\n * Responsibility-specific behavior is installed by sibling modules.\n */\nimport { isKeyRelease, isViewportTUI, type ScrollView, type TuiInputListener } from \"@earendil-works/pi-tui\";\n\nimport type { AgentSessionQueuePauseControl } from \"../../core/agent-session-methods.ts\";\nimport type { MarkdownTransformer } from \"../../core/extensions/types.ts\";\nimport type { MermaidRenderingMode } from \"../../core/settings-manager.ts\";\nimport type { EarlyInputSnapshot } from \"../../main-early-input.ts\";\nimport { readClipboardText } from \"../../utils/clipboard.ts\";\nimport { renderEngineDiagnostic } from \"../interactive-engine/engine-diagnostic-view.ts\";\nimport { attachInteractiveEngineHost } from \"../interactive-engine/extension-ui-bridge.ts\";\nimport type { RemoteToolExecutionComponent } from \"../interactive-engine/remote-renderer.ts\";\nimport { KeybindingsReloadCoordinator } from \"../rpc/rpc-keybindings-reload.ts\";\nimport type { AtomicWorkingLoader } from \"./components/atomic-working-status.ts\";\nimport { createMermaidMarkdownTransformer } from \"./components/mermaid.ts\";\nimport type { TranscriptOverlayReserve } from \"./components/reserved-bottom-overlay.ts\";\nimport {\n\ttype AgentSession,\n\ttype AgentSessionRuntime,\n\ttype AssistantMessage,\n\ttype AssistantMessageComponent,\n\ttype AutocompleteProvider,\n\ttype AutocompleteProviderFactory,\n\ttype BashExecutionComponent,\n\ttype Component,\n\tContainer,\n\ttype CountdownTimer,\n\tCustomEditor,\n\ttype EditorComponent,\n\ttype EditorFactory,\n\ttype ExtensionEditorComponent,\n\ttype ExtensionInputComponent,\n\ttype ExtensionSelectorComponent,\n\tFooterComponent,\n\tFooterDataProvider,\n\tgetEditorTheme,\n\ttype HostCustomUiStateListener,\n\tInteractiveThemeController,\n\tKeybindingsManager,\n\ttype Loader,\n\ttype LoaderIndicatorOptions,\n\ttype Spacer,\n\tsetKeybindings,\n\tsetRegisteredThemes,\n\ttype Text,\n\ttype ToolExecutionComponent,\n\ttype TUI,\n\ttheme,\n\tUsageMeterComponent,\n\tVERSION,\n} from \"./interactive-mode-deps.ts\";\nimport type {} from \"./interactive-mode-surface.ts\";\nimport type { CompactionQueuedMessage, InteractiveModeOptions } from \"./interactive-mode-types.ts\";\nimport { StartupChatContainer } from \"./interactive-startup-chat-container.ts\";\nimport type { InteractiveSubmission } from \"./interactive-submission.ts\";\nimport {\n\tcreateInteractiveTui,\n\tcreateInteractiveTuiReference,\n\thandleFocusedOverlayInternalUiAction,\n\ttype InteractiveTui,\n\ttype InternalUiActionResult,\n} from \"./interactive-tui.ts\";\n\nconst FULLSCREEN_VIEWPORT_ACTIONS = [\n\t\"tui.altScreen.pageUp\",\n\t\"tui.altScreen.pageDown\",\n\t\"tui.altScreen.halfPageUp\",\n\t\"tui.altScreen.halfPageDown\",\n\t\"tui.altScreen.previousPrompt\",\n\t\"tui.altScreen.nextPrompt\",\n\t\"tui.altScreen.top\",\n\t\"tui.altScreen.bottom\",\n] as const;\n\nexport function isFullscreenViewportAction(data: string, keybindings: KeybindingsManager): boolean {\n\treturn FULLSCREEN_VIEWPORT_ACTIONS.some((action) => keybindings.matches(data, action));\n}\n\n/**\n * Decide whether the fullscreen viewport should run before the focused\n * component. `isMouseInput` is classified by pi-tui's own mouse predicate in\n * `AtomicTuiAltScreen`, so this policy does not duplicate terminal grammars.\n * Mouse deferral is limited to actual overlays so inline components do not\n * disable pi-tui's application-owned transcript selection path.\n */\nexport function shouldHandleFullscreenViewportInput(\n\tfocused: Component | null,\n\teditor: Component,\n\tdata: string,\n\tisMouseInput: boolean,\n\tfocusedIsOverlay: boolean,\n\tkeybindings: KeybindingsManager,\n): boolean {\n\tif (focused === editor || !focused?.handleInput) return true;\n\tif (isMouseInput) return !focusedIsOverlay;\n\tif (focusedIsOverlay && keybindings.matches(data, \"app.thinking.toggle\")) return false;\n\treturn !isFullscreenViewportAction(data, keybindings);\n}\n\nfunction isCommandLikeStartupInput(text: string): boolean {\n\tconst trimmed = text.trimStart();\n\treturn trimmed.startsWith(\"/\") || trimmed.startsWith(\"!\");\n}\n\nexport function seedStartupInput(\n\tpendingUserInputs: InteractiveSubmission[],\n\teditor: { setText(text: string): void },\n\tstartupInput: EarlyInputSnapshot | undefined,\n\tstartupReplayInputs: string[] = [],\n\tsetStartupDraftText?: (text: string) => void,\n\tsetStartupReplayActiveInput?: (text: string) => void,\n): void {\n\tif (!startupInput) return;\n\tlet commandReplayStarted = false;\n\tfor (const submission of startupInput.submissions) {\n\t\tif (commandReplayStarted) {\n\t\t\tstartupReplayInputs.push(submission);\n\t\t} else if (isCommandLikeStartupInput(submission)) {\n\t\t\tconst commandText = submission.trim();\n\t\t\tcommandReplayStarted = true;\n\t\t\teditor.setText(commandText);\n\t\t\tsetStartupReplayActiveInput?.(commandText);\n\t\t} else {\n\t\t\tpendingUserInputs.push({ text: submission, draft: submission });\n\t\t}\n\t}\n\tif (startupInput.text.length === 0) return;\n\tif (commandReplayStarted) {\n\t\tsetStartupDraftText?.(startupInput.text);\n\t} else {\n\t\teditor.setText(startupInput.text);\n\t}\n}\n\nexport interface InteractiveTuiInputSubscription {\n\thandler: TuiInputListener;\n\tunsubscribe: () => void;\n}\n\nexport class InteractiveModeBase {\n\truntimeHost: AgentSessionRuntime;\n\n\tui: TUI;\n\tprivate renderer: InteractiveTui;\n\n\tprivate readonly shouldHandleViewportInput = (\n\t\tdata: string,\n\t\tisMouseInput: boolean,\n\t\tfocusedIsOverlay: boolean,\n\t): boolean => {\n\t\treturn shouldHandleFullscreenViewportInput(\n\t\t\tthis.renderer.getFocusedComponent(),\n\t\t\tthis.editor,\n\t\t\tdata,\n\t\t\tisMouseInput,\n\t\t\tfocusedIsOverlay,\n\t\t\tthis.keybindings,\n\t\t);\n\t};\n\tprivate readonly onOverlayUnhandledInput = (data: string): boolean => this.handleOverlayUnhandledInput(data);\n\tprivate readonly onOverlayInternalUiAction = (url: string): InternalUiActionResult =>\n\t\thandleFocusedOverlayInternalUiAction(this.renderer, url);\n\n\t/** Dispatch the host thinking action after a focused workflow overlay declines input. */\n\thandleOverlayUnhandledInput(data: string): boolean {\n\t\tif (isKeyRelease(data) || !this.keybindings.matches(data, \"app.thinking.toggle\")) return false;\n\t\t// Reuse the default editor's action dispatcher even while a workflow\n\t\t// overlay owns focus. This keeps the host binding and its user remap as\n\t\t// the source of truth instead of calling the implementation directly.\n\t\treturn this.defaultEditor.handleInput(data);\n\t}\n\n\tprivate readonly onRightClickPaste = (): void => {\n\t\tvoid this.handleRightClickPaste();\n\t};\n\n\tchatContainer: Container;\n\tdocumentContainer: Container;\n\n\ttranscriptScrollView: ScrollView | undefined;\n\n\tfullscreenLayoutRoot: Component | undefined;\n\n\tresourceDisclosureContainer: Container;\n\tstartupNoticesContainer: Container;\n\tpendingMessagesContainer: Container;\n\n\tstatusContainer: Container;\n\n\tdefaultEditor: CustomEditor;\n\n\teditor: EditorComponent;\n\n\teditorComponentFactory: EditorFactory | undefined;\n\n\tautocompleteProvider: AutocompleteProvider | undefined;\n\n\tautocompleteProviderWrappers: AutocompleteProviderFactory[] = [];\n\n\tfdPath: string | undefined;\n\n\teditorContainer: Container;\n\n\tactiveSelectorToken: object | undefined;\n\n\tactiveSelectorDispose: (() => void) | undefined;\n\n\tfooter: FooterComponent;\n\tfooterContainer: Container;\n\n\tusageMeter: UsageMeterComponent;\n\n\tfooterDataProvider: FooterDataProvider;\n\n\t// Stored so the same manager can be injected into custom editors, selectors, and extension UI.\n\tkeybindings: KeybindingsManager;\n\n\treloadCoordinator: KeybindingsReloadCoordinator;\n\n\tinteractiveEngineShortcutHandler: ((data: string) => boolean) | undefined;\n\n\tdisposeInteractiveEngineHost: () => void = () => {};\n\n\tversion: string;\n\n\tisInitialized = false;\n\n\tonInputCallback?: (submission: InteractiveSubmission) => void;\n\n\tpendingUserInputs: InteractiveSubmission[] = [];\n\n\tstartupReplayInputs: string[] = [];\n\n\tstartupReplayActiveInput: string | undefined = undefined;\n\n\tstartupDraftText: string | undefined = undefined;\n\n\tstartupCookedInputRecovered = false;\n\n\tdeferredRenderedUserInputs: string[] = [];\n\n\tdeferredRenderedUserInputComponents = new Map<string, Component[][]>();\n\n\tloadingAnimation: Loader | AtomicWorkingLoader | undefined = undefined;\n\n\tworkingMessage: string | undefined = undefined;\n\n\tworkingVisible = true;\n\n\tworkingIndicatorOptions: LoaderIndicatorOptions | undefined = undefined;\n\n\treadonly defaultWorkingMessage = \"Working...\";\n\n\treadonly defaultHiddenThinkingLabel = \"Thinking...\";\n\n\thiddenThinkingLabel = this.defaultHiddenThinkingLabel;\n\n\tlastSigintTime = 0;\n\n\tlastEscapeTime = 0;\n\n\tchangelogMarkdown: string | undefined = undefined;\n\n\tstartupNoticesShown = false;\n\tstartupNoticesPrepared = false;\n\n\tanthropicSubscriptionWarningShown = false;\n\n\tfirstRunNoticeVisible = false;\n\n\thadLastChangelogVersionAtStartup = false;\n\n\tfirstRunOnboardingNoticeComponents: Component[] = [];\n\n\tautoTrustOnReloadCwd: string | undefined;\n\n\t// Status line tracking (for mutating immediately-sequential status updates)\n\tlastStatusSpacer: Spacer | undefined = undefined;\n\n\tlastStatusText: Text | undefined = undefined;\n\n\t// Streaming message tracking\n\tstreamingComponent: AssistantMessageComponent | undefined = undefined;\n\n\tstreamingMessage: AssistantMessage | undefined = undefined;\n\n\t// Tool execution tracking: toolCallId -> component\n\tpendingTools = new Map<string, ToolExecutionComponent | RemoteToolExecutionComponent>();\n\n\t// Tool output expansion state\n\ttoolOutputExpanded = false;\n\n\t// Thinking block visibility state\n\thideThinkingBlock = false;\n\toutputPad: 0 | 1 = 1;\n\n\tmermaidMarkdownTransformer: MarkdownTransformer = createMermaidMarkdownTransformer({\n\t\tgetMode: () => this.settingsManager.getMermaidRenderingMode(),\n\t\ttheme,\n\t});\n\tmermaidMarkdownTransformerMode: MermaidRenderingMode | undefined;\n\n\t// Skill commands: command name -> skill file path\n\tskillCommands = new Map<string, string>();\n\n\t// Agent subscription unsubscribe function\n\tunsubscribe?: () => void;\n\n\tsignalCleanupHandlers: Array<() => void> = [];\n\n\t// Track if editor is in bash mode (text starts with !)\n\tisBashMode = false;\n\n\t// Track current bash execution component\n\tbashComponent: BashExecutionComponent | undefined = undefined;\n\n\t// Track pending bash components (shown in pending area, moved to chat on submit)\n\tpendingBashComponents: BashExecutionComponent[] = [];\n\n\t// Auto-compaction state\n\tautoCompactionLoader: AtomicWorkingLoader | undefined = undefined;\n\n\tautoCompactionEscapeHandler?: () => void;\n\n\t/** True once the pre-compaction Escape handler has been captured for restore. */\n\tautoCompactionEscapeHandlerSaved = false;\n\n\t/** True while `runUserPromptTurn()` owns the working loader. */\n\tpromptTurnWorkingLoaderActive = false;\n\n\t// Auto-retry state\n\tretryLoader: Loader | undefined = undefined;\n\tfallbackLoader: Loader | undefined = undefined;\n\n\tretryCountdown: CountdownTimer | undefined = undefined;\n\n\tretryEscapeHandler?: () => void;\n\n\t// Messages queued while compaction is running\n\tcompactionQueuedMessages: CompactionQueuedMessage[] = [];\n\n\t/** Keeps input queued while automatic compaction hands off to a manual request. */\n\tmanualCompactionTakeoverPending = false;\n\n\t// Deferred extension load state (first paint happens before extensions load)\n\tdeferredStartupPending = false;\n\tinitialStartupBinding = false;\n\tdeferredStartupPromise: Promise<void> | undefined = undefined;\n\n\tinputHandlerReadyRecorded = false;\n\n\tfirstSubmitRecorded = false;\n\n\t// Shutdown state\n\tshutdownRequested = false;\n\n\t// Extension UI state\n\textensionSelector: ExtensionSelectorComponent | undefined = undefined;\n\n\textensionInput: ExtensionInputComponent | undefined = undefined;\n\n\textensionEditor: ExtensionEditorComponent | undefined = undefined;\n\n\ttuiInputSubscriptions = new Set<InteractiveTuiInputSubscription>();\n\n\textensionTerminalInputSubscriptions = new Set<InteractiveTuiInputSubscription>();\n\n\ttuiRendererChangeListeners = new Set<() => void>();\n\n\tblockingInlineCustomUiDepth = 0;\n\n\tdeferredInlineCustomUiFocusDepth = 0;\n\n\tpendingInlineCustomUiFocus: Component | undefined = undefined;\n\n\thostCustomUiStateListeners = new Set<HostCustomUiStateListener>();\n\n\ttranscriptOverlayReserve: TranscriptOverlayReserve | undefined = undefined;\n\n\tthemeController: InteractiveThemeController;\n\n\t// Extension widgets (components rendered above/below the editor)\n\textensionWidgetsAbove = new Map<string, Component & { dispose?(): void }>();\n\n\textensionWidgetsBelow = new Map<string, Component & { dispose?(): void }>();\n\n\twidgetContainerAbove!: Container;\n\n\twidgetContainerBelow!: Container;\n\n\t// Custom footer from extension (undefined = use built-in footer)\n\tcustomFooter: (Component & { dispose?(): void }) | undefined = undefined;\n\n\t// Header container that holds the built-in or custom header\n\theaderContainer: Container;\n\n\t// Built-in header (logo + keybinding hints + changelog)\n\tbuiltInHeader: Component | undefined = undefined;\n\n\t// Custom header from extension (undefined = use built-in header)\n\tcustomHeader: (Component & { dispose?(): void }) | undefined = undefined;\n\n\t// Convenience accessors\n\tget session(): AgentSession & AgentSessionQueuePauseControl {\n\t\treturn this.runtimeHost.session as AgentSession & AgentSessionQueuePauseControl;\n\t}\n\n\t/** Includes the short handoff window that an isolated engine cannot mirror. */\n\tget compactionActive(): boolean {\n\t\treturn this.session.isCompacting || this.manualCompactionTakeoverPending;\n\t}\n\n\tget agent() {\n\t\treturn this.session.agent;\n\t}\n\n\tget sessionManager() {\n\t\treturn this.session.sessionManager;\n\t}\n\n\tget settingsManager() {\n\t\treturn this.session.settingsManager;\n\t}\n\n\t/**\n\t * Tears down the selector that owns `editorContainer`, including in-flight\n\t * work such as a model catalog refresh.\n\t *\n\t * This lives on the base class so behavior modules can dispose a selector\n\t * without relying on `interactive-selectors.ts` load order.\n\t */\n\tdisposeActiveSelector(): void {\n\t\tconst dispose = this.activeSelectorDispose;\n\t\tthis.activeSelectorToken = undefined;\n\t\tthis.activeSelectorDispose = undefined;\n\t\tdispose?.();\n\t}\n\n\taddTuiInputListener(handler: TuiInputListener): () => void {\n\t\tconst subscription: InteractiveTuiInputSubscription = {\n\t\t\thandler,\n\t\t\tunsubscribe: this.ui.addInputListener(handler),\n\t\t};\n\t\tthis.tuiInputSubscriptions.add(subscription);\n\t\treturn () => {\n\t\t\tsubscription.unsubscribe();\n\t\t\tthis.tuiInputSubscriptions.delete(subscription);\n\t\t};\n\t}\n\n\trebindTuiInputListeners(): void {\n\t\tfor (const subscription of this.tuiInputSubscriptions) {\n\t\t\tsubscription.unsubscribe();\n\t\t\tsubscription.unsubscribe = this.ui.addInputListener(subscription.handler);\n\t\t}\n\t}\n\n\tonTuiRendererChange(listener: () => void): () => void {\n\t\tthis.tuiRendererChangeListeners.add(listener);\n\t\treturn () => this.tuiRendererChangeListeners.delete(listener);\n\t}\n\n\tmountInteractiveTui(tui: TUI, components: readonly Component[]): void {\n\t\tfor (const component of components) tui.addChild(component);\n\t\tif (isViewportTUI(tui)) {\n\t\t\tif (!this.fullscreenLayoutRoot) throw new Error(\"Fullscreen layout is not initialized\");\n\t\t\ttui.setLayoutRoot(this.fullscreenLayoutRoot);\n\t\t}\n\t}\n\n\tprivate async handleRightClickPaste(): Promise<void> {\n\t\tconst target = this.renderer.getFocusedComponent();\n\t\tconst handleInput = target?.handleInput;\n\t\tif (!target || !handleInput) return;\n\t\ttry {\n\t\t\tconst text = await readClipboardText();\n\t\t\tif (!text || this.renderer.getFocusedComponent() !== target) return;\n\t\t\thandleInput.call(target, `\\x1b[200~${text}\\x1b[201~`);\n\t\t\tthis.ui.requestRender();\n\t\t} catch {\n\t\t\t// Clipboard paste is best-effort; permission and native-module failures are common.\n\t\t}\n\t}\n\n\tstopInteractiveTui(): void {\n\t\twhile (this.renderer.hasOverlayEntries) this.renderer.hideOverlay();\n\t\tthis.ui.stop();\n\t}\n\n\tdeclare options: InteractiveModeOptions;\n\n\tconstructor(runtimeHost: AgentSessionRuntime, options: InteractiveModeOptions = {}) {\n\t\tthis.runtimeHost = runtimeHost;\n\t\tthis.options = options;\n\t\tthis.deferredStartupPending = Boolean(options.deferredExtensionLoad);\n\t\tthis.autoTrustOnReloadCwd = options.autoTrustOnReloadCwd;\n\t\tthis.runtimeHost.setBeforeSessionInvalidate(() => {\n\t\t\tthis.resetExtensionUI();\n\t\t});\n\t\tthis.runtimeHost.setRebindSession(async () => {\n\t\t\tawait this.rebindCurrentSession();\n\t\t});\n\t\tthis.version = VERSION;\n\t\tthis.renderer = createInteractiveTui({\n\t\t\tshowHardwareCursor: this.settingsManager.getShowHardwareCursor(),\n\t\t\tlogDirectory: runtimeHost.services.agentDir,\n\t\t\tterminal: options.terminal,\n\t\t\tonRightClickPaste: this.onRightClickPaste,\n\t\t\tshouldHandleViewportInput: this.shouldHandleViewportInput,\n\t\t\tonOverlayUnhandledInput: this.onOverlayUnhandledInput,\n\t\t\tonOverlayInternalUiAction: this.onOverlayInternalUiAction,\n\t\t\tonInternalUiAction: () => {\n\t\t\t\tthis.jumpToTranscriptEnd();\n\t\t\t\treturn undefined;\n\t\t\t},\n\t\t});\n\t\tthis.ui = createInteractiveTuiReference(() => this.renderer);\n\t\tthis.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());\n\t\tthis.headerContainer = new Container();\n\t\tthis.documentContainer = new Container();\n\t\tthis.documentContainer.addChild(this.headerContainer);\n\t\tthis.chatContainer = new StartupChatContainer();\n\t\tthis.documentContainer.addChild(this.chatContainer);\n\t\tthis.resourceDisclosureContainer = new Container();\n\t\tthis.startupNoticesContainer = new Container();\n\t\t// The isolated engine can emit session_start UI requests as soon as its\n\t\t// bridge attaches below, before init() mounts chat in the TUI. Reserve the\n\t\t// ordering slots now so those messages can never precede RESOURCES.\n\t\tthis.chatContainer.addChild(this.resourceDisclosureContainer);\n\t\tthis.chatContainer.addChild(this.startupNoticesContainer);\n\t\tthis.pendingMessagesContainer = new Container();\n\t\tthis.statusContainer = new Container();\n\t\tthis.widgetContainerAbove = new Container();\n\t\tthis.widgetContainerBelow = new Container();\n\t\tthis.keybindings = KeybindingsManager.create(runtimeHost.services.agentDir);\n\t\tthis.reloadCoordinator = new KeybindingsReloadCoordinator(this.keybindings);\n\t\tsetKeybindings(this.keybindings);\n\t\tconst editorPaddingX = this.settingsManager.getEditorPaddingX();\n\t\tconst autocompleteMaxVisible = this.settingsManager.getAutocompleteMaxVisible();\n\t\tthis.defaultEditor = new CustomEditor(this.ui, getEditorTheme(), this.keybindings, {\n\t\t\tpaddingX: editorPaddingX,\n\t\t\tautocompleteMaxVisible,\n\t\t});\n\n\t\tthis.editor = this.defaultEditor;\n\t\tthis.editorContainer = new Container();\n\t\tthis.editorContainer.addChild(this.editor as Component);\n\t\tthis.footerDataProvider = new FooterDataProvider(this.sessionManager.getCwd());\n\t\tthis.footer = new FooterComponent(this.session, this.footerDataProvider);\n\t\tthis.footerContainer = new Container();\n\t\tthis.footerContainer.addChild(this.footer);\n\t\tthis.usageMeter = new UsageMeterComponent(this.session);\n\t\tthis.usageMeter.setAutoCompactEnabled(this.session.autoCompactionEnabled);\n\n\t\t// Load hide thinking block setting\n\t\tthis.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();\n\t\tthis.outputPad = this.settingsManager.getOutputPad();\n\n\t\t// Register themes from resource loader and initialize\n\t\tsetRegisteredThemes(this.session.resourceLoader.getThemes().themes);\n\t\tthis.themeController = new InteractiveThemeController(\n\t\t\tthis.ui,\n\t\t\tthis.settingsManager,\n\t\t\t(message) => this.showError(message),\n\t\t\t() => this.updateEditorBorderColor(),\n\t\t);\n\t\tthis.disposeInteractiveEngineHost = attachInteractiveEngineHost(\n\t\t\truntimeHost,\n\t\t\tthis.createExtensionUIContext(),\n\t\t\t(diagnostic) =>\n\t\t\t\trenderEngineDiagnostic(diagnostic, {\n\t\t\t\t\tstopWorkingLoader: () => this.stopWorkingLoader(),\n\t\t\t\t\tshowStatus: (message) => this.showStatus(message),\n\t\t\t\t\tshowError: (message) => this.showError(message),\n\t\t\t\t}),\n\t\t\t{\n\t\t\t\tisFullscreen: () => this.renderer.mode === \"fullscreen\",\n\t\t\t\tonRendererReplaced: (listener) => this.onTuiRendererChange(listener),\n\t\t\t},\n\t\t\t(handler) => {\n\t\t\t\tthis.interactiveEngineShortcutHandler = handler;\n\t\t\t\tthis.defaultEditor.onExtensionShortcut = handler;\n\t\t\t\treturn () => {\n\t\t\t\t\tif (this.interactiveEngineShortcutHandler === handler) this.interactiveEngineShortcutHandler = undefined;\n\t\t\t\t\tif (this.defaultEditor.onExtensionShortcut === handler)\n\t\t\t\t\t\tthis.defaultEditor.onExtensionShortcut = undefined;\n\t\t\t\t};\n\t\t\t},\n\t\t\tthis.keybindings,\n\t\t);\n\t}\n\n\t// Maximum total widget lines to prevent viewport overflow\n\tstatic readonly MAX_WIDGET_LINES = 10;\n\n\t/**\n\t * Gracefully shutdown the agent.\n\t * Stops the TUI before emitting shutdown events so extension UI cleanup cannot\n\t * repaint the final frame while the process is exiting.\n\t */\n\tisShuttingDown = false;\n}\n"]}
@@ -198,6 +198,8 @@ declare module "./interactive-mode-base.ts" {
198
198
  overlay?: boolean;
199
199
  deferInlineCustomUiFocus?: boolean;
200
200
  handlesInternalUiAction?: boolean;
201
+ /** Overlay-only: bound the overlay and reserve transcript scroll extent. */
202
+ reserveTranscriptRows?: boolean;
201
203
  signal?: AbortSignal;
202
204
  overlayOptions?: OverlayOptions | (() => OverlayOptions);
203
205
  onHandle?: (handle: OverlayHandle) => void;