omp-fabric 1.27.2 → 1.28.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 (121) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/README.md +1 -1
  3. package/dist/capture/interceptor.d.ts.map +1 -1
  4. package/dist/chunks/{chunk-OJZNMROB.js → chunk-4PPAWZM6.js} +36 -50
  5. package/dist/chunks/chunk-4PPAWZM6.js.map +7 -0
  6. package/dist/chunks/{chunk-KIH3KLZU.js → chunk-C2YMZNT5.js} +5 -5
  7. package/dist/chunks/chunk-C2YMZNT5.js.map +7 -0
  8. package/dist/chunks/chunk-CHXPTZUF.js +277 -0
  9. package/dist/chunks/chunk-CHXPTZUF.js.map +7 -0
  10. package/dist/chunks/chunk-CYNNPPN4.js +93 -0
  11. package/dist/chunks/chunk-CYNNPPN4.js.map +7 -0
  12. package/dist/chunks/{chunk-ANHZ3SWB.js → chunk-DGKGPZET.js} +9 -4
  13. package/dist/chunks/{chunk-ANHZ3SWB.js.map → chunk-DGKGPZET.js.map} +2 -2
  14. package/dist/chunks/{chunk-2BOZMRT5.js → chunk-FVNEGH4J.js} +32 -49
  15. package/dist/chunks/chunk-FVNEGH4J.js.map +7 -0
  16. package/dist/chunks/{chunk-CNCRWY4Q.js → chunk-GS6IWGXQ.js} +9 -1
  17. package/dist/chunks/chunk-GS6IWGXQ.js.map +7 -0
  18. package/dist/chunks/{chunk-7QKSPNXQ.js → chunk-V5FB7D4C.js} +3 -3
  19. package/dist/chunks/chunk-VDYGBL4Z.js +132 -0
  20. package/dist/chunks/chunk-VDYGBL4Z.js.map +7 -0
  21. package/dist/chunks/chunk-XVA63H6I.js +151 -0
  22. package/dist/chunks/chunk-XVA63H6I.js.map +7 -0
  23. package/dist/chunks/{chunk-NOZBB266.js → chunk-XZIQGFF7.js} +9 -13
  24. package/dist/chunks/chunk-XZIQGFF7.js.map +7 -0
  25. package/dist/chunks/{chunk-4XLJPEI4.js → chunk-ZJ7HHWW4.js} +20 -41
  26. package/dist/chunks/chunk-ZJ7HHWW4.js.map +7 -0
  27. package/dist/config.d.ts +2 -0
  28. package/dist/config.d.ts.map +1 -1
  29. package/dist/core/approval-controller.d.ts.map +1 -1
  30. package/dist/fabric-exec-tool.d.ts.map +1 -1
  31. package/dist/fabric-runtime-state.js +5 -3
  32. package/dist/fabric-runtime-state.js.map +1 -1
  33. package/dist/host-compatibility.d.ts +1 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +180 -170
  36. package/dist/index.js.map +3 -3
  37. package/dist/residency/host.js +3 -3
  38. package/dist/residency/omp-entry.js +3 -3
  39. package/dist/topology/participant-directory.d.ts.map +1 -1
  40. package/dist/ui/arc-group.d.ts +1 -1
  41. package/dist/ui/arc-group.d.ts.map +1 -1
  42. package/dist/ui/code-preview-shell.d.ts +2 -2
  43. package/dist/ui/code-preview-shell.d.ts.map +1 -1
  44. package/dist/ui/controller.d.ts.map +1 -1
  45. package/dist/ui/conversation-chrome.d.ts +1 -5
  46. package/dist/ui/conversation-chrome.d.ts.map +1 -1
  47. package/dist/ui/conversation-chrome.js +2 -2
  48. package/dist/ui/conversation-queue.d.ts +3 -2
  49. package/dist/ui/conversation-queue.d.ts.map +1 -1
  50. package/dist/ui/conversation-render.d.ts +19 -23
  51. package/dist/ui/conversation-render.d.ts.map +1 -1
  52. package/dist/ui/conversation.d.ts +7 -17
  53. package/dist/ui/conversation.d.ts.map +1 -1
  54. package/dist/ui/conversation.js +317 -318
  55. package/dist/ui/conversation.js.map +3 -3
  56. package/dist/ui/core-tool-render.d.ts +1 -1
  57. package/dist/ui/core-tool-render.d.ts.map +1 -1
  58. package/dist/ui/dashboard-detail.d.ts +4 -4
  59. package/dist/ui/dashboard-detail.d.ts.map +1 -1
  60. package/dist/ui/dashboard-fabric-graph.d.ts +1 -1
  61. package/dist/ui/dashboard-fabric-graph.d.ts.map +1 -1
  62. package/dist/ui/dashboard-presentation.d.ts +1 -1
  63. package/dist/ui/dashboard-presentation.d.ts.map +1 -1
  64. package/dist/ui/dashboard.d.ts +8 -8
  65. package/dist/ui/dashboard.d.ts.map +1 -1
  66. package/dist/ui/dashboard.js +206 -343
  67. package/dist/ui/dashboard.js.map +3 -3
  68. package/dist/ui/diff-background.d.ts +1 -1
  69. package/dist/ui/diff-background.d.ts.map +1 -1
  70. package/dist/ui/fabric-actor-delivery-selector.d.ts +4 -4
  71. package/dist/ui/fabric-actor-delivery-selector.d.ts.map +1 -1
  72. package/dist/ui/fabric-actor-tool-selector.d.ts +5 -6
  73. package/dist/ui/fabric-actor-tool-selector.d.ts.map +1 -1
  74. package/dist/ui/fabric-host-event-selector.d.ts +4 -4
  75. package/dist/ui/fabric-host-event-selector.d.ts.map +1 -1
  76. package/dist/ui/fabric-model-selector.d.ts +4 -6
  77. package/dist/ui/fabric-model-selector.d.ts.map +1 -1
  78. package/dist/ui/fabric-render.d.ts +6 -6
  79. package/dist/ui/fabric-render.d.ts.map +1 -1
  80. package/dist/ui/fabric-thinking-selector.d.ts +4 -7
  81. package/dist/ui/fabric-thinking-selector.d.ts.map +1 -1
  82. package/dist/ui/highlight.d.ts +2 -13
  83. package/dist/ui/highlight.d.ts.map +1 -1
  84. package/dist/ui/row-balance.d.ts +6 -6
  85. package/dist/ui/row-balance.d.ts.map +1 -1
  86. package/dist/ui/settings.d.ts +6 -3
  87. package/dist/ui/settings.d.ts.map +1 -1
  88. package/dist/ui/settings.js +239 -113
  89. package/dist/ui/settings.js.map +3 -3
  90. package/dist/ui/state-file-preview.d.ts +1 -1
  91. package/dist/ui/state-file-preview.d.ts.map +1 -1
  92. package/dist/ui/tui/host-term.d.ts +16 -0
  93. package/dist/ui/tui/host-term.d.ts.map +1 -0
  94. package/dist/ui/tui/input.d.ts +19 -0
  95. package/dist/ui/tui/input.d.ts.map +1 -0
  96. package/dist/ui/tui/rows.d.ts +24 -0
  97. package/dist/ui/tui/rows.d.ts.map +1 -0
  98. package/dist/ui/tui/select-list.d.ts +28 -0
  99. package/dist/ui/tui/select-list.d.ts.map +1 -0
  100. package/dist/ui/tui/settings-list.d.ts +38 -0
  101. package/dist/ui/tui/settings-list.d.ts.map +1 -0
  102. package/dist/ui/tui/text-field.d.ts +40 -0
  103. package/dist/ui/tui/text-field.d.ts.map +1 -0
  104. package/dist/ui/tui/view.d.ts +26 -0
  105. package/dist/ui/tui/view.d.ts.map +1 -0
  106. package/dist/ui/widget.d.ts +3 -3
  107. package/dist/ui/widget.d.ts.map +1 -1
  108. package/docs/configuration.md +2 -0
  109. package/docs/interface.md +16 -3
  110. package/package.json +13 -12
  111. package/dist/chunks/chunk-2BOZMRT5.js.map +0 -7
  112. package/dist/chunks/chunk-4XLJPEI4.js.map +0 -7
  113. package/dist/chunks/chunk-CNCRWY4Q.js.map +0 -7
  114. package/dist/chunks/chunk-G2IBGGBM.js +0 -42
  115. package/dist/chunks/chunk-G2IBGGBM.js.map +0 -7
  116. package/dist/chunks/chunk-KIH3KLZU.js.map +0 -7
  117. package/dist/chunks/chunk-NOZBB266.js.map +0 -7
  118. package/dist/chunks/chunk-OJZNMROB.js.map +0 -7
  119. package/dist/ui/symbol-theme.d.ts +0 -3
  120. package/dist/ui/symbol-theme.d.ts.map +0 -1
  121. /package/dist/chunks/{chunk-7QKSPNXQ.js.map → chunk-V5FB7D4C.js.map} +0 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ui/tui/text-field.ts"],
4
+ "sourcesContent": ["import type { KeyEvent } from \"@oh-my-pi/pi-tui\";\nimport type { WidgetAction } from \"@oh-my-pi/pi-tui/term/keymap\";\nimport { inverse } from \"@oh-my-pi/pi-tui/theme/theme\";\nimport { visibleWidth } from \"@oh-my-pi/pi-tui/text/width\";\nimport { actionOf, decodeTerminalInput, typedText } from \"./input.js\";\nimport type { Rows } from \"./view.js\";\n\ninterface TextFieldOptions {\n multiline?: boolean;\n prompt?: string;\n}\n\ninterface Snapshot {\n text: string;\n cursor: number;\n}\n\nconst EDIT_ACTIONS: readonly WidgetAction[] = [\n \"editor.newLine\",\n \"editor.cursorLeft\",\n \"editor.cursorRight\",\n \"editor.cursorWordLeft\",\n \"editor.cursorWordRight\",\n \"editor.cursorLineStart\",\n \"editor.cursorLineEnd\",\n \"editor.cursorUp\",\n \"editor.cursorDown\",\n \"editor.deleteCharBackward\",\n \"editor.deleteCharForward\",\n \"editor.deleteWordBackward\",\n \"editor.deleteWordForward\",\n \"editor.deleteToLineStart\",\n \"editor.deleteToLineEnd\",\n \"editor.yank\",\n \"editor.undo\",\n];\n\nconst UNDO_LIMIT = 100;\nconst segmenter = new Intl.Segmenter(undefined, { granularity: \"grapheme\" });\nconst graphemes = (text: string): string[] => Array.from(segmenter.segment(text), (part) => part.segment);\nconst isWordChar = (grapheme: string): boolean => /[\\p{L}\\p{N}_]/u.test(grapheme);\n\nexport class TextField implements Rows {\n onSubmit: ((text: string) => void) | undefined;\n onChange: ((text: string) => void) | undefined;\n focused = true;\n private text = \"\";\n private cursor = 0;\n private killed = \"\";\n private readonly undoStack: Snapshot[] = [];\n private preferredColumn: number | undefined;\n private lastCursorRow = 0;\n private readonly multiline: boolean;\n private readonly prompt: string;\n\n constructor(options: TextFieldOptions = {}) {\n this.multiline = options.multiline ?? false;\n this.prompt = options.prompt ?? (this.multiline ? \"\" : \"> \");\n }\n\n getText(): string {\n return this.text;\n }\n\n setText(text: string): void {\n const next = this.normalize(text);\n if (next === this.text) return;\n this.text = next;\n this.cursor = next.length;\n this.preferredColumn = undefined;\n this.onChange?.(this.text);\n }\n\n get cursorRow(): number {\n return this.lastCursorRow;\n }\n\n handleInput(data: string): void {\n for (const event of decodeTerminalInput(data)) {\n if (event.type === \"paste\") this.insert(event.text);\n else this.handleKey(event.key);\n }\n }\n\n handleKey(key: KeyEvent): boolean {\n if (key.id === \"enter\") {\n this.onSubmit?.(this.text);\n return true;\n }\n const action = actionOf(key.id, EDIT_ACTIONS);\n if (action) return this.apply(action);\n const typed = typedText(key);\n if (typed === undefined) return false;\n this.insert(typed);\n return true;\n }\n\n render(width: number): string[] {\n return this.multiline ? this.renderLines(width) : [this.renderLine(width)];\n }\n\n private apply(action: WidgetAction): boolean {\n const before = this.text.slice(0, this.cursor);\n const after = this.text.slice(this.cursor);\n const lineStart = before.lastIndexOf(\"\\n\") + 1;\n const lineEndOffset = after.indexOf(\"\\n\");\n const lineEnd = lineEndOffset < 0 ? this.text.length : this.cursor + lineEndOffset;\n switch (action) {\n case \"editor.newLine\":\n if (!this.multiline) return false;\n this.insert(\"\\n\");\n return true;\n case \"editor.cursorLeft\":\n return this.moveTo(this.cursor - (graphemes(before).at(-1)?.length ?? 0));\n case \"editor.cursorRight\":\n return this.moveTo(this.cursor + (graphemes(after)[0]?.length ?? 0));\n case \"editor.cursorWordLeft\":\n return this.moveTo(this.wordBoundaryBefore());\n case \"editor.cursorWordRight\":\n return this.moveTo(this.wordBoundaryAfter());\n case \"editor.cursorLineStart\":\n return this.moveTo(lineStart);\n case \"editor.cursorLineEnd\":\n return this.moveTo(lineEnd);\n case \"editor.cursorUp\":\n return this.moveVertical(-1);\n case \"editor.cursorDown\":\n return this.moveVertical(1);\n case \"editor.deleteCharBackward\":\n return this.remove(this.cursor - (graphemes(before).at(-1)?.length ?? 0), this.cursor, false);\n case \"editor.deleteCharForward\":\n return this.remove(this.cursor, this.cursor + (graphemes(after)[0]?.length ?? 0), false);\n case \"editor.deleteWordBackward\":\n return this.remove(this.wordBoundaryBefore(), this.cursor, true);\n case \"editor.deleteWordForward\":\n return this.remove(this.cursor, this.wordBoundaryAfter(), true);\n case \"editor.deleteToLineStart\":\n return this.remove(lineStart === this.cursor && lineStart > 0 ? lineStart - 1 : lineStart, this.cursor, true);\n case \"editor.deleteToLineEnd\":\n return this.remove(this.cursor, lineEnd === this.cursor && lineEnd < this.text.length ? lineEnd + 1 : lineEnd, true);\n case \"editor.yank\":\n if (this.killed === \"\") return false;\n this.insert(this.killed);\n return true;\n case \"editor.undo\": {\n const previous = this.undoStack.pop();\n if (!previous) return false;\n this.text = previous.text;\n this.cursor = previous.cursor;\n this.preferredColumn = undefined;\n this.onChange?.(this.text);\n return true;\n }\n default:\n return false;\n }\n }\n\n private normalize(text: string): string {\n const unified = text.replace(/\\r\\n?/g, \"\\n\");\n return this.multiline ? unified : unified.replace(/\\n/g, \" \");\n }\n\n private remember(): void {\n this.undoStack.push({ text: this.text, cursor: this.cursor });\n if (this.undoStack.length > UNDO_LIMIT) this.undoStack.shift();\n }\n\n private insert(raw: string): void {\n const text = this.normalize(raw);\n if (text === \"\") return;\n this.remember();\n this.text = `${this.text.slice(0, this.cursor)}${text}${this.text.slice(this.cursor)}`;\n this.cursor += text.length;\n this.preferredColumn = undefined;\n this.onChange?.(this.text);\n }\n\n private remove(from: number, to: number, kill: boolean): boolean {\n if (to <= from) return false;\n this.remember();\n if (kill) this.killed = this.text.slice(from, to);\n this.text = `${this.text.slice(0, from)}${this.text.slice(to)}`;\n this.cursor = from;\n this.preferredColumn = undefined;\n this.onChange?.(this.text);\n return true;\n }\n\n private moveTo(offset: number): boolean {\n this.cursor = Math.max(0, Math.min(offset, this.text.length));\n this.preferredColumn = undefined;\n return true;\n }\n\n private moveVertical(direction: -1 | 1): boolean {\n if (!this.multiline) return false;\n const lines = this.text.split(\"\\n\");\n let row = 0;\n let offset = 0;\n while (row < lines.length - 1 && offset + lines[row]!.length < this.cursor) {\n offset += lines[row]!.length + 1;\n row++;\n }\n const target = row + direction;\n if (target < 0 || target >= lines.length) return false;\n const column = this.preferredColumn ?? visibleWidth(this.text.slice(offset, this.cursor));\n const targetStart = direction < 0\n ? offset - lines[target]!.length - 1\n : offset + lines[row]!.length + 1;\n let position = targetStart;\n let width = 0;\n for (const grapheme of graphemes(lines[target]!)) {\n const next = width + visibleWidth(grapheme);\n if (next > column) break;\n width = next;\n position += grapheme.length;\n }\n this.cursor = position;\n this.preferredColumn = column;\n return true;\n }\n\n private wordBoundaryBefore(): number {\n const parts = graphemes(this.text.slice(0, this.cursor));\n let index = parts.length;\n while (index > 0 && !isWordChar(parts[index - 1]!)) index--;\n while (index > 0 && isWordChar(parts[index - 1]!)) index--;\n return parts.slice(0, index).join(\"\").length;\n }\n\n private wordBoundaryAfter(): number {\n const parts = graphemes(this.text.slice(this.cursor));\n let index = 0;\n while (index < parts.length && !isWordChar(parts[index]!)) index++;\n while (index < parts.length && isWordChar(parts[index]!)) index++;\n return this.cursor + parts.slice(0, index).join(\"\").length;\n }\n\n private caret(grapheme: string): string {\n return this.focused ? inverse(grapheme) : grapheme;\n }\n\n private renderLine(width: number): string {\n const room = Math.max(1, width - visibleWidth(this.prompt));\n const before = graphemes(this.text.slice(0, this.cursor));\n const after = graphemes(this.text.slice(this.cursor));\n const atCursor = after.shift() ?? \" \";\n let used = visibleWidth(atCursor);\n const left: string[] = [];\n for (let index = before.length - 1; index >= 0 && used + visibleWidth(before[index]!) <= room; index--) {\n left.unshift(before[index]!);\n used += visibleWidth(before[index]!);\n }\n const right: string[] = [];\n for (const grapheme of after) {\n if (used + visibleWidth(grapheme) > room) break;\n right.push(grapheme);\n used += visibleWidth(grapheme);\n }\n this.lastCursorRow = 0;\n return `${this.prompt}${left.join(\"\")}${this.caret(atCursor)}${right.join(\"\")}`;\n }\n\n private renderLines(width: number): string[] {\n const room = Math.max(1, width - visibleWidth(this.prompt));\n const indent = \" \".repeat(visibleWidth(this.prompt));\n const rows: string[] = [];\n let offset = 0;\n this.lastCursorRow = 0;\n for (const line of this.text.split(\"\\n\")) {\n let row = \"\";\n let used = 0;\n let position = offset;\n const cursorOnLine = this.cursor >= offset && this.cursor <= offset + line.length;\n const flush = (): void => {\n rows.push(`${rows.length === 0 ? this.prompt : indent}${row}`);\n row = \"\";\n used = 0;\n };\n for (const grapheme of graphemes(line)) {\n const cells = visibleWidth(grapheme);\n if (used + cells > room && used > 0) flush();\n if (position === this.cursor) {\n this.lastCursorRow = rows.length;\n row += this.caret(grapheme);\n } else {\n row += grapheme;\n }\n used += cells;\n position += grapheme.length;\n }\n if (cursorOnLine && this.cursor === offset + line.length) {\n if (used + 1 > room && used > 0) flush();\n this.lastCursorRow = rows.length;\n row += this.caret(\" \");\n }\n flush();\n offset += line.length + 1;\n }\n return rows;\n }\n}\n"],
5
+ "mappings": ";;;;;;;AAEA,SAAS,eAAe;AACxB,SAAS,oBAAoB;AAc7B,IAAM,eAAwC;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,aAAa;AACnB,IAAM,YAAY,IAAI,KAAK,UAAU,QAAW,EAAE,aAAa,WAAW,CAAC;AAC3E,IAAM,YAAY,CAAC,SAA2B,MAAM,KAAK,UAAU,QAAQ,IAAI,GAAG,CAAC,SAAS,KAAK,OAAO;AACxG,IAAM,aAAa,CAAC,aAA8B,iBAAiB,KAAK,QAAQ;AAEzE,IAAM,YAAN,MAAgC;AAAA,EACrC;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACF,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AAAA,EACA,YAAwB,CAAC;AAAA,EAClC;AAAA,EACA,gBAAgB;AAAA,EACP;AAAA,EACA;AAAA,EAEjB,YAAY,UAA4B,CAAC,GAAG;AAC1C,SAAK,YAAY,QAAQ,aAAa;AACtC,SAAK,SAAS,QAAQ,WAAW,KAAK,YAAY,KAAK;AAAA,EACzD;AAAA,EAEA,UAAkB;AAChB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,QAAQ,MAAoB;AAC1B,UAAM,OAAO,KAAK,UAAU,IAAI;AAChC,QAAI,SAAS,KAAK,KAAM;AACxB,SAAK,OAAO;AACZ,SAAK,SAAS,KAAK;AACnB,SAAK,kBAAkB;AACvB,SAAK,WAAW,KAAK,IAAI;AAAA,EAC3B;AAAA,EAEA,IAAI,Y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,KAAK,KAAK,MAAM,IAAI,GAAG;AACxC,UAAI,MAAM;AACV,UAAI,OAAO;AACX,UAAI,WAAW;AACf,YAAM,eAAe,KAAK,UAAU,UAAU,KAAK,UAAU,SAAS,KAAK;AAC3E,YAAM,QAAQ,MAAY;AACxB,aAAK,KAAK,GAAG,KAAK,WAAW,IAAI,KAAK,SAAS,MAAM,GAAG,GAAG,EAAE;AAC7D,cAAM;AACN,eAAO;AAAA,MACT;AACA,iBAAW,YAAY,UAAU,IAAI,GAAG;AACtC,cAAM,QAAQ,aAAa,QAAQ;AACnC,YAAI,OAAO,QAAQ,QAAQ,OAAO,EAAG,OAAM;AAC3C,YAAI,aAAa,KAAK,QAAQ;AAC5B,eAAK,gBAAgB,KAAK;AAC1B,iBAAO,KAAK,MAAM,QAAQ;AAAA,QAC5B,OAAO;AACL,iBAAO;AAAA,QACT;AACA,gBAAQ;AACR,oBAAY,SAAS;AAAA,MACvB;AACA,UAAI,gBAAgB,KAAK,WAAW,SAAS,KAAK,QAAQ;AACxD,YAAI,OAAO,IAAI,QAAQ,OAAO,EAAG,OAAM;AACvC,aAAK,gBAAgB,KAAK;AAC1B,eAAO,KAAK,MAAM,GAAG;AAAA,MACvB;AACA,YAAM;AACN,gBAAU,KAAK,SAAS;AAAA,IAC1B;AACA,WAAO;AAAA,EACT;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,93 @@
1
+ import {
2
+ hostTerm,
3
+ rememberHostKey
4
+ } from "./chunk-XVA63H6I.js";
5
+
6
+ // src/ui/tui/view.ts
7
+ import { isUiNode, signal, UiNode, untrack } from "@oh-my-pi/pi-tui";
8
+ import { truncate } from "@oh-my-pi/pi-tui/text/width";
9
+ var VIEW_ROLE = "fabric.view";
10
+ var WHEEL_ROWS = 3;
11
+ var mounted = /* @__PURE__ */ new WeakMap();
12
+ var roleRegistered = false;
13
+ var registerRole = () => {
14
+ if (roleRegistered) return true;
15
+ const { paint, widgets } = hostTerm();
16
+ if (!paint || !widgets) return false;
17
+ roleRegistered = true;
18
+ paint.defineRolePainter("canvas", VIEW_ROLE, (node, cx) => {
19
+ const rows = mounted.get(node)?.paint(cx.width) ?? [];
20
+ return { rows, hits: rows.length > 0 ? [{ row: 0, col: 0, width: cx.width, height: rows.length, node }] : [] };
21
+ });
22
+ widgets.defineRoleWidget("canvas", VIEW_ROLE, {
23
+ mouse(node, mouse) {
24
+ const entry = mounted.get(node);
25
+ if (!entry?.view.handleWheel || mouse.action !== "press") return false;
26
+ if (mouse.button === "wheel-up") entry.wheel(-WHEEL_ROWS);
27
+ else if (mouse.button === "wheel-down") entry.wheel(WHEEL_ROWS);
28
+ else return false;
29
+ return true;
30
+ }
31
+ });
32
+ return true;
33
+ };
34
+ var EMPTY_ROWS = { render: () => [] };
35
+ var HOST_PREVIEW_UNAVAILABLE = "Preview unavailable: this OMP host does not provide pi-tui term/render.";
36
+ var isRows = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && !isUiNode(value) && "render" in value && typeof value.render === "function";
37
+ var asRows = (output, theme) => {
38
+ if (output === void 0 || output === null || output === false || output === "") return EMPTY_ROWS;
39
+ if (isRows(output)) return output;
40
+ const render = hostTerm().render;
41
+ if (!render) return { render: (width) => [truncate(HOST_PREVIEW_UNAVAILABLE, width)] };
42
+ const node = isUiNode(output) ? output : new UiNode("col", { children: output });
43
+ return { render: (width) => render.renderBlock(node, width, { theme }).rows };
44
+ };
45
+ var errorText = (error) => error instanceof Error ? error.message : String(error);
46
+ var mountView = (size, build, onError) => {
47
+ const role = registerRole();
48
+ const revision = signal(0);
49
+ const requestRender = () => revision.set(untrack(revision) + 1);
50
+ const view = build({ requestRender, size });
51
+ let paintFailed = false;
52
+ const contain = (action) => {
53
+ try {
54
+ action();
55
+ } catch (error) {
56
+ onError?.(error);
57
+ }
58
+ requestRender();
59
+ return true;
60
+ };
61
+ const deliver = (data) => contain(() => view.handleInput?.(data));
62
+ const paint = (width) => {
63
+ revision();
64
+ try {
65
+ const rows = view.render(width).map((row) => truncate(row, width, ""));
66
+ paintFailed = false;
67
+ return rows;
68
+ } catch (error) {
69
+ if (!paintFailed) onError?.(error);
70
+ paintFailed = true;
71
+ return [truncate(`\u26A0 Fabric view failed to render: ${errorText(error)}`, width)];
72
+ }
73
+ };
74
+ const node = new UiNode("canvas", {
75
+ paint,
76
+ ...role ? { term: { role: VIEW_ROLE } } : {},
77
+ onKey: (key) => {
78
+ if (key.kind === "release") return false;
79
+ rememberHostKey(key);
80
+ return deliver(key.raw);
81
+ },
82
+ onPaste: (paste) => deliver(`\x1B[200~${paste.text}\x1B[201~`)
83
+ });
84
+ mounted.set(node, { view, paint, wheel: (rows) => contain(() => view.handleWheel?.(rows)) });
85
+ return { node, view };
86
+ };
87
+
88
+ export {
89
+ isRows,
90
+ asRows,
91
+ mountView
92
+ };
93
+ //# sourceMappingURL=chunk-CYNNPPN4.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/ui/tui/view.ts"],
4
+ "sourcesContent": ["import { isUiNode, signal, type KeyEvent, type PasteEvent, UiNode, untrack } from \"@oh-my-pi/pi-tui\";\nimport type { Theme } from \"@oh-my-pi/pi-tui/theme/contract\";\nimport { truncate } from \"@oh-my-pi/pi-tui/text/width\";\nimport { hostTerm } from \"./host-term.js\";\nimport { rememberHostKey } from \"./input.js\";\n\nexport interface Rows {\n render(width: number): readonly string[];\n invalidate?(): void;\n}\n\nexport interface FabricView extends Rows {\n handleInput?(data: string): void;\n handleWheel?(rows: number): void;\n dispose?(): void;\n}\n\nexport interface FabricViewHost {\n requestRender(): void;\n size(): { readonly columns: number; readonly rows: number };\n}\n\nconst VIEW_ROLE = \"fabric.view\";\nconst WHEEL_ROWS = 3;\nconst mounted = new WeakMap<UiNode, { view: FabricView; paint: (width: number) => string[]; wheel: (rows: number) => void }>();\nlet roleRegistered = false;\n\nconst registerRole = (): boolean => {\n if (roleRegistered) return true;\n const { paint, widgets } = hostTerm();\n if (!paint || !widgets) return false;\n roleRegistered = true;\n paint.defineRolePainter(\"canvas\", VIEW_ROLE, (node, cx) => {\n const rows = mounted.get(node)?.paint(cx.width) ?? [];\n return { rows, hits: rows.length > 0 ? [{ row: 0, col: 0, width: cx.width, height: rows.length, node }] : [] };\n });\n widgets.defineRoleWidget(\"canvas\", VIEW_ROLE, {\n mouse(node, mouse) {\n const entry = mounted.get(node);\n if (!entry?.view.handleWheel || mouse.action !== \"press\") return false;\n if (mouse.button === \"wheel-up\") entry.wheel(-WHEEL_ROWS);\n else if (mouse.button === \"wheel-down\") entry.wheel(WHEEL_ROWS);\n else return false;\n return true;\n },\n });\n return true;\n};\n\nexport const mountedView = (node: unknown): FabricView | undefined =>\n isUiNode(node) ? mounted.get(node)?.view : undefined;\n\nconst EMPTY_ROWS: Rows = { render: () => [] };\nconst HOST_PREVIEW_UNAVAILABLE = \"Preview unavailable: this OMP host does not provide pi-tui term/render.\";\n\nexport const isRows = (value: unknown): value is Rows =>\n typeof value === \"object\" &&\n value !== null &&\n !Array.isArray(value) &&\n !isUiNode(value) &&\n \"render\" in value &&\n typeof value.render === \"function\";\n\nexport const asRows = (output: unknown, theme: Theme): Rows => {\n if (output === undefined || output === null || output === false || output === \"\") return EMPTY_ROWS;\n if (isRows(output)) return output;\n const render = hostTerm().render;\n if (!render) return { render: (width) => [truncate(HOST_PREVIEW_UNAVAILABLE, width)] };\n const node = isUiNode(output) ? output : new UiNode(\"col\", { children: output });\n return { render: (width) => render.renderBlock(node, width, { theme }).rows };\n};\n\nconst errorText = (error: unknown): string => (error instanceof Error ? error.message : String(error));\n\nexport const mountView = <V extends FabricView>(\n size: FabricViewHost[\"size\"],\n build: (host: FabricViewHost) => V,\n onError?: (error: unknown) => void,\n): { node: UiNode; view: V } => {\n const role = registerRole();\n const revision = signal(0);\n const requestRender = (): void => revision.set(untrack(revision) + 1);\n const view = build({ requestRender, size });\n let paintFailed = false;\n const contain = (action: () => void): true => {\n try {\n action();\n } catch (error) {\n onError?.(error);\n }\n requestRender();\n return true;\n };\n const deliver = (data: string): boolean => contain(() => view.handleInput?.(data));\n const paint = (width: number): string[] => {\n revision();\n try {\n const rows = view.render(width).map((row) => truncate(row, width, \"\"));\n paintFailed = false;\n return rows;\n } catch (error) {\n if (!paintFailed) onError?.(error);\n paintFailed = true;\n return [truncate(`\u26A0 Fabric view failed to render: ${errorText(error)}`, width)];\n }\n };\n const node = new UiNode(\"canvas\", {\n paint,\n ...(role ? { term: { role: VIEW_ROLE } } : {}),\n onKey: (key: KeyEvent) => {\n if (key.kind === \"release\") return false;\n rememberHostKey(key);\n return deliver(key.raw);\n },\n onPaste: (paste: PasteEvent) => deliver(`\\x1b[200~${paste.text}\\x1b[201~`),\n });\n mounted.set(node, { view, paint, wheel: (rows) => contain(() => view.handleWheel?.(rows)) });\n return { node, view };\n};\n"],
5
+ "mappings": ";;;;;;AAAA,SAAS,UAAU,QAAwC,QAAQ,eAAe;AAElF,SAAS,gBAAgB;AAoBzB,IAAM,YAAY;AAClB,IAAM,aAAa;AACnB,IAAM,UAAU,oBAAI,QAAyG;AAC7H,IAAI,iBAAiB;AAErB,IAAM,eAAe,MAAe;AAClC,MAAI,eAAgB,QAAO;AAC3B,QAAM,EAAE,OAAO,QAAQ,IAAI,SAAS;AACpC,MAAI,CAAC,SAAS,CAAC,QAAS,QAAO;AAC/B,mBAAiB;AACjB,QAAM,kBAAkB,UAAU,WAAW,CAAC,MAAM,OAAO;AACzD,UAAM,OAAO,QAAQ,IAAI,IAAI,GAAG,MAAM,GAAG,KAAK,KAAK,CAAC;AACpD,WAAO,EAAE,MAAM,MAAM,KAAK,SAAS,IAAI,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,QAAQ,KAAK,QAAQ,KAAK,CAAC,IAAI,CAAC,EAAE;AAAA,EAC/G,CAAC;AACD,UAAQ,iBAAiB,UAAU,WAAW;AAAA,IAC5C,MAAM,MAAM,OAAO;AACjB,YAAM,QAAQ,QAAQ,IAAI,IAAI;AAC9B,UAAI,CA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5C,QAAI;AACF,aAAO;AAAA,IACT,SAAS,OAAO;AACd,gBAAU,KAAK;AAAA,IACjB;AACA,kBAAc;AACd,WAAO;AAAA,EACT;AACA,QAAM,UAAU,CAAC,SAA0B,QAAQ,MAAM,KAAK,cAAc,IAAI,CAAC;AACjF,QAAM,QAAQ,CAAC,UAA4B;AACzC,aAAS;AACT,QAAI;AACF,YAAM,OAAO,KAAK,OAAO,KAAK,EAAE,IAAI,CAAC,QAAQ,SAAS,KAAK,OAAO,EAAE,CAAC;AACrE,oBAAc;AACd,aAAO;AAAA,IACT,SAAS,OAAO;AACd,UAAI,CAAC,YAAa,WAAU,KAAK;AACjC,oBAAc;AACd,aAAO,CAAC,SAAS,wCAAmC,UAAU,KAAK,CAAC,IAAI,KAAK,CAAC;AAAA,IAChF;AAAA,EACF;AACA,QAAM,OAAO,IAAI,OAAO,UAAU;AAAA,IAChC;AAAA,IACA,GAAI,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,EAAE,IAAI,CAAC;AAAA,IAC5C,OAAO,CAAC,QAAkB;AACxB,UAAI,IAAI,SAAS,UAAW,QAAO;AACnC,sBAAgB,GAAG;AACnB,aAAO,QAAQ,IAAI,GAAG;AAAA,IACxB;AAAA,IACA,SAAS,CAAC,UAAsB,QAAQ,YAAY,MAAM,IAAI,WAAW;AAAA,EAC3E,CAAC;AACD,UAAQ,IAAI,MAAM,EAAE,MAAM,OAAO,OAAO,CAAC,SAAS,QAAQ,MAAM,KAAK,cAAc,IAAI,CAAC,EAAE,CAAC;AAC3F,SAAO,EAAE,MAAM,KAAK;AACtB;",
6
+ "names": []
7
+ }
@@ -31,7 +31,7 @@ import {
31
31
  MAX_AGENT_TIMEOUT_MS,
32
32
  MIN_AGENT_TIMEOUT_MS,
33
33
  resolveAgentDir
34
- } from "./chunk-CNCRWY4Q.js";
34
+ } from "./chunk-GS6IWGXQ.js";
35
35
  import {
36
36
  THINKING_LEVELS,
37
37
  isFabricThinking
@@ -6507,7 +6507,7 @@ var ParticipantDirectory = class {
6507
6507
  initialError = error;
6508
6508
  }
6509
6509
  if (this.options.enabled) {
6510
- this.#timer = setInterval(() => void this.refresh().catch(() => void 0), this.#heartbeatMs);
6510
+ this.#timer = setInterval(() => void (this.#refreshing ?? this.refresh()).catch(() => void 0), this.#heartbeatMs);
6511
6511
  this.#timer.unref();
6512
6512
  }
6513
6513
  if (initialError) throw initialError;
@@ -6527,7 +6527,12 @@ var ParticipantDirectory = class {
6527
6527
  }
6528
6528
  async refresh() {
6529
6529
  if (this.#closed) return;
6530
- if (this.#refreshing) return this.#refreshing;
6530
+ const inFlight = this.#refreshing;
6531
+ if (inFlight) {
6532
+ await inFlight.catch(() => void 0);
6533
+ if (this.#closed) return;
6534
+ if (this.#refreshing && this.#refreshing !== inFlight) return this.#refreshing;
6535
+ }
6531
6536
  const operation = this.#refresh();
6532
6537
  this.#refreshing = operation;
6533
6538
  try {
@@ -7003,4 +7008,4 @@ export {
7003
7008
  agentParticipantRecords,
7004
7009
  actorParticipantRecord
7005
7010
  };
7006
- //# sourceMappingURL=chunk-ANHZ3SWB.js.map
7011
+ //# sourceMappingURL=chunk-DGKGPZET.js.map