@timurproko/a1 0.2.7-dev.1252 → 0.2.7-dev.1255

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 (253) hide show
  1. package/bin/ui.js +3 -3
  2. package/dist/app/session-shell/clipboard-diagnostics.d.ts +2 -2
  3. package/dist/app/session-shell/clipboard-image.d.ts +0 -1
  4. package/dist/app/session-shell/clipboard-image.js +1 -1
  5. package/dist/app/session-shell/dialog-coordinator.d.ts +6 -5
  6. package/dist/app/session-shell/dialog-coordinator.js +3 -4
  7. package/dist/app/session-shell/dock-chrome.d.ts +11 -6
  8. package/dist/app/session-shell/dock-chrome.js +5 -8
  9. package/dist/app/session-shell/editor-hyperlink-budget.d.ts +0 -2
  10. package/dist/app/session-shell/editor-hyperlink-budget.js +1 -1
  11. package/dist/app/session-shell/exit-notice.d.ts +2 -2
  12. package/dist/app/session-shell/exit-notice.js +1 -1
  13. package/dist/app/session-shell/extension-surface.d.ts +8 -7
  14. package/dist/app/session-shell/helper-pool.d.ts +3 -4
  15. package/dist/app/session-shell/helper-pool.js +1 -1
  16. package/dist/app/session-shell/image-preparation-client.d.ts +4 -3
  17. package/dist/app/session-shell/image-preparation.d.ts +0 -2
  18. package/dist/app/session-shell/image-preparation.js +2 -2
  19. package/dist/app/session-shell/image-source.d.ts +2 -3
  20. package/dist/app/session-shell/image-source.js +2 -2
  21. package/dist/app/session-shell/input-surface-switch.d.ts +9 -7
  22. package/dist/app/session-shell/input-surface-switch.js +1 -2
  23. package/dist/app/session-shell/login-interaction.d.ts +5 -4
  24. package/dist/app/session-shell/login-interaction.js +2 -3
  25. package/dist/app/session-shell/paste-executor.d.ts +4 -8
  26. package/dist/app/session-shell/paste-executor.js +2 -2
  27. package/dist/app/session-shell/paste-protocol.d.ts +2 -2
  28. package/dist/app/session-shell/path-chip-presentation.d.ts +0 -5
  29. package/dist/app/session-shell/path-chip-presentation.js +3 -3
  30. package/dist/app/session-shell/prompt-chips.d.ts +8 -7
  31. package/dist/app/session-shell/prompt-history-controller.d.ts +3 -3
  32. package/dist/app/session-shell/prompt-submission.d.ts +5 -2
  33. package/dist/app/session-shell/prompt-submission.js +4 -5
  34. package/dist/app/session-shell/quit-outro-effects.d.ts +3 -3
  35. package/dist/app/session-shell/quit-outro-effects.js +1 -4
  36. package/dist/app/session-shell/quit-outro.d.ts +9 -12
  37. package/dist/app/session-shell/quit-outro.js +11 -11
  38. package/dist/app/session-shell/response-copy-protocol.d.ts +3 -2
  39. package/dist/app/session-shell/response-copy-transport.d.ts +2 -14
  40. package/dist/app/session-shell/response-copy-transport.js +1 -1
  41. package/dist/app/session-shell/session-lifecycle.d.ts +2 -1
  42. package/dist/app/session-shell/session-shell-root.d.ts +74 -89
  43. package/dist/app/session-shell/session-shell-root.js +81 -113
  44. package/dist/app/session-shell/session-shell.d.ts +13 -16
  45. package/dist/app/session-shell/session-shell.js +144 -268
  46. package/dist/app/session-shell/session-viewport-controller.d.ts +7 -6
  47. package/dist/app/session-shell/session-viewport-controller.js +2 -2
  48. package/dist/app/session-shell/settings-bindings.d.ts +24 -2
  49. package/dist/app/session-shell/settings-bindings.js +24 -0
  50. package/dist/app/session-shell/share-operation.d.ts +3 -3
  51. package/dist/app/session-shell/share-operation.js +4 -6
  52. package/dist/app/session-shell/shell-clipboard.d.ts +59 -0
  53. package/dist/app/session-shell/shell-clipboard.js +119 -0
  54. package/dist/app/session-shell/shell-editor-factory.d.ts +8 -4
  55. package/dist/app/session-shell/shell-editor-factory.js +13 -15
  56. package/dist/app/session-shell/shell-host.d.ts +16 -17
  57. package/dist/app/session-shell/shell-host.js +18 -19
  58. package/dist/app/session-shell/shell-layout.d.ts +2 -2
  59. package/dist/app/session-shell/shell-prompt-suggestions.d.ts +26 -0
  60. package/dist/app/session-shell/shell-prompt-suggestions.js +48 -0
  61. package/dist/app/session-shell/suggestion-surface.d.ts +1 -6
  62. package/dist/app/session-shell/suggestion-surface.js +1 -1
  63. package/dist/app/session-shell/system-clipboard.d.ts +2 -14
  64. package/dist/app/session-shell/system-clipboard.js +2 -7
  65. package/dist/app/session-shell/transcript-document.d.ts +11 -8
  66. package/dist/app/session-shell/transcript-document.js +13 -14
  67. package/dist/app/session-shell/viewport-layout.d.ts +2 -2
  68. package/dist/app/session-shell/workflow-output.d.ts +5 -3
  69. package/dist/app/session-shell/workflow-output.js +13 -15
  70. package/dist/cli/package-messages.d.ts +0 -1
  71. package/dist/cli/package-messages.js +1 -1
  72. package/dist/cli/session-context.d.ts +1 -1
  73. package/dist/cli/uninstall.d.ts +3 -2
  74. package/dist/composition/owned-settings.d.ts +2 -1
  75. package/dist/composition/owned-settings.js +0 -3
  76. package/dist/composition/owned-ui.d.ts +1 -1
  77. package/dist/composition/owned-ui.js +27 -27
  78. package/dist/composition/reference-selection-options.d.ts +1 -1
  79. package/dist/composition/reference-selection-options.js +1 -1
  80. package/dist/composition/session-runtime-registry.d.ts +2 -1
  81. package/dist/composition/settings-route-host.js +3 -10
  82. package/dist/composition/settings-search-input.d.ts +2 -1
  83. package/dist/composition/startup-route.d.ts +2 -2
  84. package/dist/composition/startup-route.js +2 -2
  85. package/dist/contracts/owned-ui/extension-ui.d.ts +2 -1
  86. package/dist/contracts/owned-ui/index.d.ts +1 -0
  87. package/dist/contracts/owned-ui/session-presenters.d.ts +3 -0
  88. package/dist/contracts/owned-ui/shell-components.d.ts +543 -0
  89. package/dist/contracts/owned-ui/shell-components.js +1 -0
  90. package/dist/contracts/presentation/component.d.ts +17 -0
  91. package/dist/contracts/presentation/component.js +8 -0
  92. package/dist/contracts/presentation/index.d.ts +6 -15
  93. package/dist/contracts/presentation/index.js +2 -0
  94. package/dist/contracts/presentation/terminal.d.ts +290 -0
  95. package/dist/contracts/presentation/terminal.js +1 -0
  96. package/dist/contracts/presentation/theme.d.ts +46 -0
  97. package/dist/contracts/presentation/theme.js +1 -0
  98. package/dist/features/launch/development-launch.js +1 -1
  99. package/dist/features/launch/runtime-selection.d.ts +2 -2
  100. package/dist/features/launch/runtime-selection.js +2 -2
  101. package/dist/features/owned-ui/project-trust-prompt.d.ts +2 -2
  102. package/dist/features/owned-ui/project-trust-prompt.js +1 -1
  103. package/dist/features/owned-ui/release-note-state.d.ts +2 -1
  104. package/dist/features/owned-ui/settings-app.js +38 -219
  105. package/dist/features/owned-ui/settings-edits.d.ts +31 -0
  106. package/dist/features/owned-ui/settings-edits.js +139 -0
  107. package/dist/features/owned-ui/settings-scroll-rail.d.ts +29 -0
  108. package/dist/features/owned-ui/settings-scroll-rail.js +79 -0
  109. package/dist/features/owned-ui/settings-search-input.d.ts +2 -1
  110. package/dist/features/prompt-history/service.d.ts +3 -2
  111. package/dist/foundation/lifecycle/claim-gate.d.ts +2 -1
  112. package/dist/foundation/release/automatic-update.d.ts +5 -14
  113. package/dist/foundation/release/automatic-update.js +14 -14
  114. package/dist/foundation/release/bootstrap.js +4 -4
  115. package/dist/foundation/release/dependency-certification.d.ts +0 -1
  116. package/dist/foundation/release/dependency-certification.js +1 -1
  117. package/dist/foundation/release/early-accent.d.ts +2 -2
  118. package/dist/foundation/release/early-accent.js +1 -1
  119. package/dist/foundation/release/index.d.ts +2 -2
  120. package/dist/foundation/release/index.js +1 -1
  121. package/dist/foundation/release/latest-release.d.ts +3 -18
  122. package/dist/foundation/release/latest-release.js +10 -10
  123. package/dist/foundation/release/ordinary-launch-selection.d.ts +1 -1
  124. package/dist/foundation/release/ordinary-launch-selection.js +1 -1
  125. package/dist/foundation/release/release-gc.d.ts +3 -3
  126. package/dist/foundation/release/release-gc.js +4 -4
  127. package/dist/foundation/release/{cohort-state.d.ts → release-state.d.ts} +23 -23
  128. package/dist/foundation/release/{cohort-state.js → release-state.js} +8 -8
  129. package/dist/foundation/release/update-activation.js +2 -2
  130. package/dist/foundation/release/update-execution-lease.d.ts +2 -3
  131. package/dist/foundation/release/update-execution-lease.js +1 -1
  132. package/dist/foundation/release/update-launch.d.ts +2 -2
  133. package/dist/foundation/release/update.d.ts +0 -2
  134. package/dist/foundation/release/update.js +14 -14
  135. package/dist/foundation/startup/startup-budget.d.ts +5 -5
  136. package/dist/foundation/startup/startup-budget.js +2 -2
  137. package/dist/integrations/pi/components/editor-interaction.d.ts +4 -12
  138. package/dist/integrations/pi/components/index.d.ts +15 -9
  139. package/dist/integrations/pi/components/index.js +9 -5
  140. package/dist/integrations/pi/components/lazy-selectors.d.ts +2 -10
  141. package/dist/integrations/pi/components/lazy-selectors.js +1 -1
  142. package/dist/integrations/pi/components/modal-frame.d.ts +5 -22
  143. package/dist/integrations/pi/components/modal-frame.js +3 -23
  144. package/dist/integrations/pi/components/owned-editor-ux.d.ts +4 -3
  145. package/dist/integrations/pi/components/prompt-input-port.d.ts +2 -19
  146. package/dist/integrations/pi/components/resources/builtin-themes.d.ts +2 -1
  147. package/dist/integrations/pi/components/shell-editor-autocomplete.d.ts +3 -2
  148. package/dist/integrations/pi/components/shell-footer-status.d.ts +2 -2
  149. package/dist/integrations/pi/components/shell-footer-status.js +3 -2
  150. package/dist/integrations/pi/components/shell-presenters-info.d.ts +6 -5
  151. package/dist/integrations/pi/components/shell-presenters-info.js +2 -1
  152. package/dist/integrations/pi/components/shell-session-info-reference.d.ts +2 -1
  153. package/dist/integrations/pi/components/shell-shared-facade.d.ts +33 -227
  154. package/dist/integrations/pi/components/shell-shared-facade.js +8 -1
  155. package/dist/integrations/pi/components/skills-command.d.ts +1 -9
  156. package/dist/integrations/pi/components/skills-command.js +5 -5
  157. package/dist/integrations/pi/components/theme.d.ts +9 -2
  158. package/dist/integrations/pi/components/theme.js +17 -2
  159. package/dist/integrations/pi/components/thinking-selector-dialog.d.ts +2 -1
  160. package/dist/integrations/pi/components/upstream/adjacent/core/keybindings.d.ts +2 -2
  161. package/dist/integrations/pi/engine/adapter.d.ts +3 -5
  162. package/dist/integrations/pi/engine/adapter.js +3 -12
  163. package/dist/integrations/pi/engine/changelog.d.ts +2 -2
  164. package/dist/integrations/pi/engine/changelog.js +3 -3
  165. package/dist/integrations/pi/engine/compaction-progress.d.ts +2 -3
  166. package/dist/integrations/pi/engine/compaction-progress.js +1 -1
  167. package/dist/integrations/pi/engine/conformance.d.ts +2 -1
  168. package/dist/integrations/pi/engine/default-model-setting.d.ts +0 -2
  169. package/dist/integrations/pi/engine/default-model-setting.js +1 -2
  170. package/dist/integrations/pi/engine/event-delivery.d.ts +2 -1
  171. package/dist/integrations/pi/engine/extension-ui-binding.d.ts +2 -1
  172. package/dist/integrations/pi/engine/host.js +2 -2
  173. package/dist/integrations/pi/engine/message-values.d.ts +0 -1
  174. package/dist/integrations/pi/engine/message-values.js +1 -1
  175. package/dist/integrations/pi/engine/pending-delivery.d.ts +0 -4
  176. package/dist/integrations/pi/engine/pending-delivery.js +3 -3
  177. package/dist/integrations/pi/engine/ports.d.ts +7 -1
  178. package/dist/integrations/pi/engine/ports.js +4 -0
  179. package/dist/integrations/pi/engine/project-trust-preflight.d.ts +2 -1
  180. package/dist/integrations/pi/engine/prompt-suggestions.d.ts +3 -2
  181. package/dist/integrations/pi/engine/provider-authentication.d.ts +1 -1
  182. package/dist/integrations/pi/engine/public-main-entry.d.ts +1 -5
  183. package/dist/integrations/pi/engine/public-main-entry.js +1 -1
  184. package/dist/integrations/pi/engine/repository-pr-rest.d.ts +1 -9
  185. package/dist/integrations/pi/engine/repository-pr-rest.js +2 -2
  186. package/dist/integrations/pi/engine/repository-pr.d.ts +1 -3
  187. package/dist/integrations/pi/engine/repository-pr.js +1 -1
  188. package/dist/integrations/pi/engine/resource-catalog.d.ts +2 -1
  189. package/dist/integrations/pi/engine/session-integration.d.ts +1 -1
  190. package/dist/integrations/pi/engine/session-runtime.d.ts +4 -3
  191. package/dist/integrations/pi/engine/settings-bridge.d.ts +0 -2
  192. package/dist/integrations/pi/engine/settings-bridge.js +1 -1
  193. package/dist/integrations/pi/engine/settings-port.d.ts +3 -2
  194. package/dist/integrations/pi/engine/transcript-projection.d.ts +2 -1
  195. package/dist/integrations/pi/engine/workflow-contexts.d.ts +1 -1
  196. package/dist/integrations/pi/engine/workflow-runner.d.ts +1 -1
  197. package/dist/integrations/pi/engine/workflow-support.d.ts +0 -6
  198. package/dist/integrations/pi/engine/workflow-support.js +4 -18
  199. package/dist/integrations/pi/engine/workflows.d.ts +5 -5
  200. package/dist/integrations/pi/session-presenters/components.d.ts +3 -0
  201. package/dist/integrations/pi/session-presenters/components.js +75 -0
  202. package/dist/integrations/pi/session-presenters/index.d.ts +1 -0
  203. package/dist/integrations/pi/session-presenters/index.js +1 -0
  204. package/dist/integrations/pi/session-presenters/presentation.d.ts +3 -0
  205. package/dist/integrations/pi/session-presenters/presentation.js +10 -0
  206. package/dist/integrations/pi/session-presenters/presenters.d.ts +2 -1
  207. package/dist/integrations/pi/session-presenters/presenters.js +3 -1
  208. package/dist/integrations/pi/tui-runtime/adapter.js +21 -30
  209. package/dist/integrations/pi/tui-runtime/contracts.d.ts +22 -166
  210. package/dist/integrations/pi/tui-runtime/damage-aware-terminal.d.ts +5 -40
  211. package/dist/integrations/pi/tui-runtime/index.d.ts +1 -0
  212. package/dist/integrations/pi/tui-runtime/index.js +1 -0
  213. package/dist/integrations/pi/tui-runtime/input-presentation-coordinator.d.ts +4 -6
  214. package/dist/integrations/pi/tui-runtime/overlay-geometry.d.ts +2 -8
  215. package/dist/integrations/pi/tui-runtime/overlay-geometry.js +3 -9
  216. package/dist/integrations/pi/tui-runtime/runtime-factory.d.ts +3 -0
  217. package/dist/integrations/pi/tui-runtime/runtime-factory.js +11 -0
  218. package/dist/ui/components/index.d.ts +2 -2
  219. package/dist/ui/components/index.js +1 -1
  220. package/dist/ui/components/selection-copy.d.ts +0 -1
  221. package/dist/ui/components/selection-copy.js +0 -12
  222. package/dist/ui/components/theme.d.ts +4 -19
  223. package/dist/ui/components/theme.js +6 -0
  224. package/dist/ui/settings/declarations.d.ts +2 -3
  225. package/dist/ui/settings/declarations.js +2 -3
  226. package/dist/ui/settings/early-accent.js +1 -1
  227. package/dist/ui/settings/index.d.ts +3 -5
  228. package/dist/ui/settings/index.js +2 -3
  229. package/dist/ui/settings/manager.d.ts +0 -4
  230. package/dist/ui/settings/manager.js +6 -62
  231. package/dist/ui/settings/resolution.d.ts +6 -18
  232. package/dist/ui/settings/resolution.js +4 -103
  233. package/dist/ui/settings/sections.d.ts +0 -4
  234. package/dist/ui/settings/sections.js +1 -1
  235. package/docs/architecture/boundaries.md +2 -2
  236. package/docs/architecture/internal-naming.md +2 -0
  237. package/docs/architecture/project-structure.md +4 -2
  238. package/docs/validation.md +1 -1
  239. package/package.json +3 -4
  240. package/dist/integrations/pi/components/components.d.ts +0 -4
  241. package/dist/integrations/pi/components/components.js +0 -48
  242. package/dist/integrations/pi/components/conformance.d.ts +0 -18
  243. package/dist/integrations/pi/components/conformance.js +0 -70
  244. package/dist/integrations/pi/components/shell-components.d.ts +0 -7
  245. package/dist/integrations/pi/components/shell-components.js +0 -7
  246. package/dist/integrations/pi/components/upstream/theme/theme-controller.d.ts +0 -33
  247. package/dist/integrations/pi/components/upstream/theme/theme-controller.js +0 -114
  248. package/dist/ui/settings/migrations.d.ts +0 -19
  249. package/dist/ui/settings/migrations.js +0 -225
  250. package/dist/ui/settings/progress-palette.generated.d.ts +0 -139
  251. package/dist/ui/settings/progress-palette.generated.js +0 -139
  252. /package/dist/{foundation/release → contracts/presentation}/progress-palette.generated.d.ts +0 -0
  253. /package/dist/{foundation/release → contracts/presentation}/progress-palette.generated.js +0 -0
@@ -0,0 +1,3 @@
1
+ import type { OwnedUiShellComponents, OwnedUiShellLazySelectorLoader } from "../../../contracts/owned-ui/index.js";
2
+ /** The Pi components and helpers behind the shell's neutral component record. */
3
+ export declare function createPiShellComponents(loadLazySelectors: () => Promise<OwnedUiShellLazySelectorLoader>): OwnedUiShellComponents;
@@ -0,0 +1,75 @@
1
+ import { createPiShellEditor } from "../components/shell-editor-autocomplete.js";
2
+ import { createPiExtensionUiBridge } from "../components/shell-extension-ui.js";
3
+ import { createPiQueuedInputStatus, createPiShellFooter, createPiShellHeader, createPiShellLoadedResources, createPiShellStatus, } from "../components/shell-footer-status.js";
4
+ import { createPiShellChangelog, createPiShellCollapsedChangelog, createPiShellHotkeys, createPiShellSessionInfo, renderPiShellCommandMessage, renderPiShellPackageUpdateNotice, renderPiShellReleaseUpdateBanner, renderPiShellReleaseUpdateNotice, renderPiShellStatusText, } from "../components/shell-presenters-info.js";
5
+ import { createPiShellTranscriptComponent, isPiPromptStyleCompaction, renderPiShellStartupDiagnostic, renderPiShellTranscriptBlock, } from "../components/shell-presenters-transcript.js";
6
+ import { createPiShellArmin, createPiShellAuthProviderSelector, createPiShellDialog, createPiShellEarendilAnnouncement, createPiShellExtensionSelector, createPiShellLoginDialog, createPiShellReloadBox, createPiShellSelector, createPiShellSkillsSelector, createPiShellTrustSelector, createPiShellUserMessageSelector, } from "../components/shell-selectors-dialogs.js";
7
+ import { piShellHyperlink, piShellTruncateToWidth, piShellVisibleWidth, renderPiShellInstalledUpdateStatus, } from "../components/shell-shared-facade.js";
8
+ import { SKILLS_COMMAND_NAME, findSkillByArgument, rewriteSkillsTunnelSubmission, skillPrompt, skillsFromCommands, } from "../components/skills-command.js";
9
+ import { ProgramStatusReporter } from "../components/upstream/program-status-reporter.js";
10
+ import { workflowCommandNames } from "../engine/workflows.js";
11
+ /** The Pi components and helpers behind the shell's neutral component record. */
12
+ export function createPiShellComponents(loadLazySelectors) {
13
+ return {
14
+ editor: { create: createPiShellEditor },
15
+ chrome: {
16
+ header: createPiShellHeader,
17
+ status: createPiShellStatus,
18
+ footer: createPiShellFooter,
19
+ queuedInput: createPiQueuedInputStatus,
20
+ loadedResources: createPiShellLoadedResources,
21
+ installedUpdateStatus: renderPiShellInstalledUpdateStatus,
22
+ releaseUpdateBanner: renderPiShellReleaseUpdateBanner,
23
+ programStatusReporter: (report, getSessionName, app) => new ProgramStatusReporter(report, getSessionName, app),
24
+ },
25
+ transcript: {
26
+ component: createPiShellTranscriptComponent,
27
+ renderBlock: renderPiShellTranscriptBlock,
28
+ renderStartupDiagnostic: renderPiShellStartupDiagnostic,
29
+ isPromptStyleCompaction: isPiPromptStyleCompaction,
30
+ },
31
+ info: {
32
+ changelog: createPiShellChangelog,
33
+ collapsedChangelog: createPiShellCollapsedChangelog,
34
+ hotkeys: createPiShellHotkeys,
35
+ sessionInfo: createPiShellSessionInfo,
36
+ commandMessage: renderPiShellCommandMessage,
37
+ statusText: renderPiShellStatusText,
38
+ packageUpdateNotice: renderPiShellPackageUpdateNotice,
39
+ releaseUpdateNotice: renderPiShellReleaseUpdateNotice,
40
+ armin: createPiShellArmin,
41
+ earendilAnnouncement: createPiShellEarendilAnnouncement,
42
+ reloadBox: createPiShellReloadBox,
43
+ },
44
+ dialogs: {
45
+ dialog: createPiShellDialog,
46
+ selector: createPiShellSelector,
47
+ extensionSelector: createPiShellExtensionSelector,
48
+ authProviderSelector: createPiShellAuthProviderSelector,
49
+ loginDialog: createPiShellLoginDialog,
50
+ skillsSelector: createPiShellSkillsSelector,
51
+ trustSelector: createPiShellTrustSelector,
52
+ userMessageSelector: createPiShellUserMessageSelector,
53
+ async shareProgress(runtime, message, style) {
54
+ // Rationale: sharing is rare, so its progress surfaces stay off the startup graph.
55
+ const surfaces = await import("../components/share-operation-dialog.js");
56
+ return (style === "dialog" ? surfaces.createPiShellShareOperationDialog : surfaces.createPiShellOperationLoader)(runtime, message);
57
+ },
58
+ extensionUiBridge: createPiExtensionUiBridge,
59
+ lazySelectors: loadLazySelectors,
60
+ },
61
+ text: {
62
+ visibleWidth: piShellVisibleWidth,
63
+ truncateToWidth: piShellTruncateToWidth,
64
+ hyperlink: piShellHyperlink,
65
+ },
66
+ workflows: { commandNames: workflowCommandNames },
67
+ skills: {
68
+ commandName: SKILLS_COMMAND_NAME,
69
+ fromCommands: skillsFromCommands,
70
+ findByArgument: findSkillByArgument,
71
+ rewriteTunnelSubmission: rewriteSkillsTunnelSubmission,
72
+ prompt: skillPrompt,
73
+ },
74
+ };
75
+ }
@@ -1,2 +1,3 @@
1
+ export { PI_SHELL_PRESENTATION } from "./presentation.js";
1
2
  export { createPiSessionPresenters } from "./presenters.js";
2
3
  export type { PiSessionPresenterBackend, PiSessionPresentersOptions } from "./presenters.js";
@@ -1 +1,2 @@
1
+ export { PI_SHELL_PRESENTATION } from "./presentation.js";
1
2
  export { createPiSessionPresenters } from "./presenters.js";
@@ -0,0 +1,3 @@
1
+ import type { ShellPresentationPorts } from "../../../contracts/presentation/index.js";
2
+ /** Everything the shell takes from Pi's presentation, assembled once from the component and TUI adapters. */
3
+ export declare const PI_SHELL_PRESENTATION: ShellPresentationPorts;
@@ -0,0 +1,10 @@
1
+ import { PI_THEME_SOURCE } from "../components/theme.js";
2
+ import { piCanvasBackgroundAnsi, PINNED_PI_LAYOUT } from "../components/upstream/theme/theme.js";
3
+ import { PI_TERMINAL_RUNTIME } from "../tui-runtime/runtime-factory.js";
4
+ /** Everything the shell takes from Pi's presentation, assembled once from the component and TUI adapters. */
5
+ export const PI_SHELL_PRESENTATION = Object.freeze({
6
+ theme: PI_THEME_SOURCE,
7
+ canvasBackground: (style) => piCanvasBackgroundAnsi(style),
8
+ pinnedOutputPad: PINNED_PI_LAYOUT.outputPad,
9
+ terminalRuntime: PI_TERMINAL_RUNTIME,
10
+ });
@@ -1,4 +1,5 @@
1
1
  import type { OwnedUiSessionBackend, OwnedUiSessionPresenters } from "../../../contracts/owned-ui/index.js";
2
+ import type { ShellPresentationPorts } from "../../../contracts/presentation/index.js";
2
3
  import type { PiSessionPresentationSource } from "../engine/adapter.js";
3
4
  import type { PiShellLazySelectorLoader } from "../components/lazy-selectors.js";
4
5
  /** The session backend plus the Pi objects its selectors are built from; the Pi engine adapter is one. */
@@ -13,4 +14,4 @@ export interface PiSessionPresentersOptions {
13
14
  * Builds the selectors and transcript renderers whose inputs are Pi engine objects. This owner is the one place
14
15
  * that sees both the engine adapter and the Pi components, so the shell only ever holds the neutral port.
15
16
  */
16
- export declare function createPiSessionPresenters(adapter: PiSessionPresenterBackend, options?: PiSessionPresentersOptions): OwnedUiSessionPresenters;
17
+ export declare function createPiSessionPresenters(adapter: PiSessionPresenterBackend, options?: PiSessionPresentersOptions): OwnedUiSessionPresenters & ShellPresentationPorts;
@@ -1,4 +1,6 @@
1
1
  import { createPiShellModelSelector, createPiShellModelsDialog, createPiShellScopedModelsSelector, createPiShellSessionSelector, createPiShellSettingsSelector, } from "../components/shell-selectors-dialogs.js";
2
+ import { PI_SHELL_PRESENTATION } from "./presentation.js";
3
+ import { createPiShellComponents } from "./components.js";
2
4
  const MODEL_REFRESH_TIMEOUT_MS = 15_000;
3
5
  const MODEL_REFRESH_TIMED_OUT = "Model refresh timed out; showing cached models.";
4
6
  /**
@@ -24,7 +26,7 @@ export function createPiSessionPresenters(adapter, options = {}) {
24
26
  // Compatibility: the component adapter passes Pi's own keybinding config through the neutral port.
25
27
  getShortcuts: bindings => source().pinnedShortcutDescriptions(bindings),
26
28
  };
27
- return {
29
+ return { ...PI_SHELL_PRESENTATION, components: createPiShellComponents(loadLazySelectors),
28
30
  transcriptRenderers: () => renderers,
29
31
  openModelSelector(host, initialSearchInput) {
30
32
  const context = source().pinnedModelSelectorContext();
@@ -136,8 +136,6 @@ export class PiTuiRuntimeAdapter {
136
136
  #preInputListeners = new Set();
137
137
  #consumeUnhandledMouse;
138
138
  #inputCoordinator;
139
- #inputDiagnostics;
140
- #diagnosticNow;
141
139
  #inputSink;
142
140
  #state = "idle";
143
141
  #stopPromise;
@@ -149,15 +147,14 @@ export class PiTuiRuntimeAdapter {
149
147
  this.#overlayGeometry = options.onOverlayGeometry === undefined ? undefined : new OverlayGeometryTracker(options.onOverlayGeometry);
150
148
  this.#terminal = options.terminal ?? new ProcessTerminal();
151
149
  this.#consumeUnhandledMouse = options.consumeUnhandledMouse ?? false;
152
- this.#inputDiagnostics = options.inputDiagnostics;
153
- this.#diagnosticNow = options.inputDiagnostics?.now ?? (() => performance.now());
150
+ const diagnostics = options.inputDiagnostics;
151
+ const diagnosticNow = diagnostics?.now ?? (() => performance.now());
152
+ const tracePhase = diagnostics === undefined ? undefined : runtimePhaseTracer(diagnostics, diagnosticNow, () => this.#inputCoordinator);
154
153
  // Invariant: the pinned renderer's frames pass through this gate, while writeControl and
155
154
  // the stop sequence reach the terminal directly. Freezing drops frames without touching
156
155
  // the renderer, so a scheduled repaint cannot land on top of the quit outro.
157
156
  const gatedTerminal = frozenGateTerminal(this.#terminal, () => this.#presentationFrozen || this.#presentationHolds.size > 0);
158
- const tracedTerminal = options.inputDiagnostics === undefined
159
- ? gatedTerminal
160
- : diagnosticTerminal(gatedTerminal, phase => this.#traceRuntimePhase(phase));
157
+ const tracedTerminal = tracePhase === undefined ? gatedTerminal : diagnosticTerminal(gatedTerminal, tracePhase);
161
158
  const decoratedTerminal = options.decorateTerminal?.(tracedTerminal) ?? tracedTerminal;
162
159
  const coordination = options.inputCoordination ?? (options.inputDiagnostics === undefined
163
160
  ? undefined
@@ -173,10 +170,8 @@ export class PiTuiRuntimeAdapter {
173
170
  },
174
171
  ...(coordination.onReceipt === undefined ? {} : { onReceipt: coordination.onReceipt }),
175
172
  ...(coordination.scheduler === undefined ? {} : { scheduler: coordination.scheduler }),
176
- now: this.#diagnosticNow,
177
- ...(options.inputDiagnostics === undefined ? {} : {
178
- onTrace: event => this.#traceInputCoordination(event),
179
- }),
173
+ now: diagnosticNow,
174
+ ...(diagnostics === undefined ? {} : { onTrace: event => diagnostics.onEvent(event) }),
180
175
  });
181
176
  this.#tuiTerminal = this.#inputCoordinator === undefined
182
177
  ? preInputTerminal(decoratedTerminal, data => this.#routePreInput(data), this.#overlayGeometry !== undefined)
@@ -187,9 +182,7 @@ export class PiTuiRuntimeAdapter {
187
182
  this.#tuiTerminal.restoreOnExit = (before, after) => exitTerminal.restoreOnExit?.(before, after);
188
183
  this.#layoutRoot = options.layoutRoot;
189
184
  this.#logDirectory = options.logDirectory;
190
- this.#rootBridge = new ComponentBridge(options.root, options.inputDiagnostics === undefined
191
- ? undefined
192
- : phase => this.#traceRuntimePhase(phase));
185
+ this.#rootBridge = new ComponentBridge(options.root, tracePhase);
193
186
  this.#bridges.set(options.root, this.#rootBridge);
194
187
  this.#mountedComponents.add(options.root);
195
188
  try {
@@ -560,22 +553,6 @@ export class PiTuiRuntimeAdapter {
560
553
  }
561
554
  return undefined;
562
555
  }
563
- #traceInputCoordination(event) {
564
- this.#inputDiagnostics?.onEvent(event);
565
- }
566
- #traceRuntimePhase(phase) {
567
- if (this.#inputDiagnostics === undefined)
568
- return;
569
- const coordinator = this.#inputCoordinator;
570
- this.#inputDiagnostics.onEvent({
571
- phase,
572
- revision: coordinator?.appliedRevision ?? 0,
573
- atMs: this.#diagnosticNow(),
574
- pendingDepth: coordinator?.pendingDepth ?? 0,
575
- pendingPresentationDepth: coordinator?.pendingPresentation === true ? 1 : 0,
576
- appliedRevision: coordinator?.appliedRevision ?? 0,
577
- });
578
- }
579
556
  #mountTui(tui) {
580
557
  tui.addChild(this.#rootBridge);
581
558
  if (tui instanceof TuiAltScreen && this.#layoutRoot !== undefined) {
@@ -854,3 +831,17 @@ function toOverlayOptions(options) {
854
831
  mapped.nonCapturing = options.nonCapturing;
855
832
  return mapped;
856
833
  }
834
+ /** Reports one runtime phase with the input coordinator's depth and revision at that moment. */
835
+ function runtimePhaseTracer(diagnostics, now, coordinator) {
836
+ return phase => {
837
+ const current = coordinator();
838
+ diagnostics.onEvent({
839
+ phase,
840
+ revision: current?.appliedRevision ?? 0,
841
+ atMs: now(),
842
+ pendingDepth: current?.pendingDepth ?? 0,
843
+ pendingPresentationDepth: current?.pendingPresentation === true ? 1 : 0,
844
+ appliedRevision: current?.appliedRevision ?? 0,
845
+ });
846
+ };
847
+ }
@@ -1,166 +1,22 @@
1
- import type { PresentationComponentPort, PresentationPointerSurface } from "../../../contracts/presentation/index.js";
2
- import type { ProgramStatus, WheelScrollLines } from "@earendil-works/pi-tui";
3
- import type { PiTuiInputCoordinationDecision, PiTuiInputCoordinationScheduler, PiTuiInputSurfaceKind } from "./input-presentation-coordinator.js";
4
- export type PiTuiRuntimeState = "idle" | "running" | "stopping" | "stopped" | "failed";
5
- export interface PiTuiViewport {
6
- readonly columns: number;
7
- readonly rows: number;
8
- }
9
- export interface PiTuiScrollState {
10
- readonly scrollTop: number;
11
- readonly viewportHeight: number;
12
- readonly followingEnd: boolean;
13
- readonly scrollbarVisible: boolean;
14
- }
15
- export type PiTuiPointerSurface = PresentationPointerSurface;
16
- export interface PiTuiComponentPort extends PresentationComponentPort {
17
- readonly wantsKeyRelease?: boolean;
18
- }
19
- export interface PiTuiTerminalPort {
20
- start(onInput: (data: string) => void, onResize: () => void): void;
21
- stop(): void;
22
- drainInput(maxMs?: number, idleMs?: number): Promise<void>;
23
- write(data: string): void;
24
- readonly columns: number;
25
- readonly rows: number;
26
- readonly kittyProtocolActive: boolean;
27
- moveBy(lines: number): void;
28
- hideCursor(): void;
29
- showCursor(): void;
30
- clearLine(): void;
31
- clearFromCursor(): void;
32
- clearScreen(): void;
33
- setTitle(title: string): void;
34
- setProgress(active: boolean): void;
35
- /** Optional for neutral test/decorator ports; the Pi-facing adapter always supplies it. */
36
- setProgramStatus?(status: ProgramStatus): void;
37
- /**
38
- * Optional synchronous last-resort mode restore that Pi TUI invokes from a process `exit` handler when
39
- * `stop()` did not run; the runtime adapter binds it to the undecorated terminal, so decorators need not forward it.
40
- */
41
- restoreOnExit?(before: string, after: string): void;
42
- }
43
- export type PiTuiSizeValue = number | `${number}%`;
44
- export type PiTuiOverlayAnchor = "center" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-center" | "bottom-center" | "left-center" | "right-center";
45
- export interface PiTuiOverlayMargin {
46
- readonly top?: number;
47
- readonly right?: number;
48
- readonly bottom?: number;
49
- readonly left?: number;
50
- }
51
- export interface PiTuiOverlayOptions {
52
- readonly width?: PiTuiSizeValue;
53
- readonly minWidth?: number;
54
- readonly maxHeight?: PiTuiSizeValue;
55
- readonly anchor?: PiTuiOverlayAnchor;
56
- readonly offsetX?: number;
57
- readonly offsetY?: number;
58
- readonly row?: PiTuiSizeValue;
59
- readonly col?: PiTuiSizeValue;
60
- readonly margin?: PiTuiOverlayMargin | number;
61
- readonly visible?: (columns: number, rows: number) => boolean;
62
- readonly nonCapturing?: boolean;
63
- /** A1-owned input scheduling declaration; omitted extension overlays fail closed. */
64
- readonly inputCoordination?: Exclude<PiTuiInputSurfaceKind, "editor">;
65
- }
66
- export interface PiTuiOverlayUnfocusOptions {
67
- readonly target: PiTuiComponentPort | null;
68
- }
69
- export interface PiTuiOverlayHandle {
70
- hide(): void;
71
- setHidden(hidden: boolean): void;
72
- isHidden(): boolean;
73
- focus(): void;
74
- unfocus(options?: PiTuiOverlayUnfocusOptions): void;
75
- isFocused(): boolean;
76
- /** The most recently rendered terminal-relative rectangle of a visible overlay. */
77
- getBounds(): {
78
- readonly row: number;
79
- readonly col: number;
80
- readonly width: number;
81
- readonly height: number;
82
- } | undefined;
83
- }
84
- export interface PiTuiInputListenerResult {
85
- readonly consume?: boolean;
86
- readonly data?: string;
87
- }
88
- export type PiTuiInputListener = (data: string) => PiTuiInputListenerResult | undefined;
89
- /** Runs at the terminal bridge before Pi TUI receives physical input. */
90
- export type PiTuiPreInputListener = PiTuiInputListener;
91
- export interface PiTuiLayoutEntry {
92
- readonly node: PiTuiLayoutNode;
93
- readonly basis?: number | "auto";
94
- readonly grow?: number;
95
- readonly shrink?: number;
96
- readonly minSize?: number;
97
- readonly maxSize?: number;
98
- readonly visible?: (viewport: PiTuiViewport) => boolean;
99
- }
100
- export type PiTuiLayoutNode = {
101
- readonly type: "component";
102
- readonly component: PiTuiComponentPort;
103
- } | {
104
- readonly type: "stack";
105
- readonly direction: "vertical" | "horizontal";
106
- readonly children: readonly PiTuiLayoutEntry[];
107
- readonly gap?: number;
108
- readonly align?: "stretch" | "start" | "center" | "end";
109
- } | {
110
- readonly type: "scroll";
111
- readonly id: string;
112
- readonly child: PiTuiLayoutNode;
113
- readonly follow?: "none" | "end";
114
- readonly primary?: boolean;
115
- readonly overscroll?: "chain" | "contain";
116
- readonly scrollbar?: "hidden" | "auto" | "always";
117
- /** Styles the scrollbar track; the pinned runtime draws it as foreground text. */
118
- readonly scrollbarTrackStyle?: (text: string) => string;
119
- /** Styles the scrollbar thumb; the pinned runtime draws it as foreground text. */
120
- readonly scrollbarThumbStyle?: (text: string) => string;
121
- readonly scrollbarHideDelayMs?: number;
122
- };
123
- export type PiTuiInputDiagnosticsPhase = "receipt" | "semantic-start" | "semantic-end" | "composition-start" | "composition-end" | "write-start" | "write-end";
124
- export interface PiTuiInputDiagnosticsEvent {
125
- readonly phase: PiTuiInputDiagnosticsPhase;
126
- readonly revision: number;
127
- readonly atMs: number;
128
- readonly pendingDepth: number;
129
- readonly pendingPresentationDepth: 0 | 1;
130
- readonly appliedRevision: number;
131
- }
132
- export interface PiTuiRuntimeAdapterOptions {
133
- readonly root: PiTuiComponentPort;
134
- /** Bare viewport only: painted overlays in back-to-front order; null while geometry is stale. */
135
- readonly onOverlayGeometry?: (surfaces: readonly PiTuiPointerSurface[] | null) => void;
136
- readonly mode?: "regular" | "fullscreen";
137
- readonly layoutRoot?: PiTuiLayoutNode;
138
- readonly terminal?: PiTuiTerminalPort;
139
- /** A1-owned public-boundary decorator; comparison paths omit it. */
140
- readonly decorateTerminal?: (terminal: PiTuiTerminalPort) => PiTuiTerminalPort;
141
- /** Bare-custom-viewport scheduling policy; comparison paths omit it. */
142
- readonly inputCoordination?: {
143
- readonly classify: (data: string, focusedOverlay?: Exclude<PiTuiInputSurfaceKind, "editor">) => PiTuiInputCoordinationDecision;
144
- readonly onReceipt?: () => void;
145
- readonly scheduler?: PiTuiInputCoordinationScheduler;
146
- };
147
- /** Optional bounded evidence hook. Production composition omits it. */
148
- readonly inputDiagnostics?: {
149
- readonly onEvent: (event: PiTuiInputDiagnosticsEvent) => void;
150
- readonly now?: () => number;
151
- };
152
- readonly hardwareCursor?: boolean;
153
- readonly mouse?: boolean;
154
- /** Consume residual SGR mouse reports after every pre-input listener has run. */
155
- readonly consumeUnhandledMouse?: boolean;
156
- readonly wheelScrollLines?: WheelScrollLines;
157
- readonly openUrl?: (url: string) => void;
158
- readonly onRightClickPaste?: () => void;
159
- readonly logDirectory?: string;
160
- }
161
- export interface PiTuiStopOptions {
162
- readonly preserveScreen?: boolean;
163
- readonly drainInput?: boolean;
164
- readonly drainMaxMs?: number;
165
- readonly drainIdleMs?: number;
166
- }
1
+ import type { TerminalRuntimeState, TerminalViewport, TerminalScrollState, TerminalPointerSurface, TerminalComponentPort, TerminalPort, TerminalSizeValue, TerminalOverlayAnchor, TerminalOverlayMargin, TerminalOverlayOptions, TerminalOverlayUnfocusOptions, TerminalOverlayHandle, TerminalInputListenerResult, TerminalInputListener, TerminalPreInputListener, TerminalLayoutEntry, TerminalLayoutNode, TerminalInputDiagnosticsPhase, TerminalInputDiagnosticsEvent, TerminalRuntimeOptions, TerminalStopOptions } from "../../../contracts/presentation/index.js";
2
+ export type PiTuiRuntimeState = TerminalRuntimeState;
3
+ export type PiTuiViewport = TerminalViewport;
4
+ export type PiTuiScrollState = TerminalScrollState;
5
+ export type PiTuiPointerSurface = TerminalPointerSurface;
6
+ export type PiTuiComponentPort = TerminalComponentPort;
7
+ export type PiTuiTerminalPort = TerminalPort;
8
+ export type PiTuiSizeValue = TerminalSizeValue;
9
+ export type PiTuiOverlayAnchor = TerminalOverlayAnchor;
10
+ export type PiTuiOverlayMargin = TerminalOverlayMargin;
11
+ export type PiTuiOverlayOptions = TerminalOverlayOptions;
12
+ export type PiTuiOverlayUnfocusOptions = TerminalOverlayUnfocusOptions;
13
+ export type PiTuiOverlayHandle = TerminalOverlayHandle;
14
+ export type PiTuiInputListenerResult = TerminalInputListenerResult;
15
+ export type PiTuiInputListener = TerminalInputListener;
16
+ export type PiTuiPreInputListener = TerminalPreInputListener;
17
+ export type PiTuiLayoutEntry = TerminalLayoutEntry;
18
+ export type PiTuiLayoutNode = TerminalLayoutNode;
19
+ export type PiTuiInputDiagnosticsPhase = TerminalInputDiagnosticsPhase;
20
+ export type PiTuiInputDiagnosticsEvent = TerminalInputDiagnosticsEvent;
21
+ export type PiTuiRuntimeAdapterOptions = TerminalRuntimeOptions;
22
+ export type PiTuiStopOptions = TerminalStopOptions;
@@ -1,45 +1,10 @@
1
1
  import type { PiTuiTerminalPort } from "./contracts.js";
2
2
  export declare const PINNED_PI_TUI_DAMAGE_GRAMMAR = "@earendil-works/pi-tui@1.5.0:tui-alt-screen-one-write-v1";
3
- export interface PiTuiDamageFrameDescriptor {
4
- /**
5
- * Frame ids are compared only within one presentation epoch; absent means the current epoch. A
6
- * presenter switch starts a new epoch, because each presenter numbers its own frames.
7
- */
8
- readonly epoch?: number;
9
- readonly frameId: number;
10
- readonly width: number;
11
- readonly height: number;
12
- readonly transcript: {
13
- readonly rowStart: number;
14
- readonly rowEnd: number;
15
- } | null;
16
- readonly dock: {
17
- readonly rowStart: number;
18
- readonly rowEnd: number;
19
- } | null;
20
- /**
21
- * Visible rows owned by the block that is currently streaming. A live block repaints
22
- * every row it owns when it reflows, so the allowed damage follows the declared tail
23
- * instead of assuming a one-row tail.
24
- */
25
- readonly liveTailRows?: number;
26
- readonly verticalShiftRows: number;
27
- readonly safeVerticalShift: boolean;
28
- readonly cause: string;
29
- }
30
- export interface PiTuiDamageFrameSafety {
31
- readonly overlayActive: boolean;
32
- readonly selectionActive: boolean;
33
- readonly replacementSurfaceActive: boolean;
34
- }
35
- export type PiTuiDamageDecisionReason = "transformed" | "suppressed-redundant-clear" | "hyperlink-cleanup" | "pending-hyperlink-cleanup" | "not-armed" | "unsafe-frame" | "stale-frame" | "unsupported-region-scroll" | "geometry-mismatch" | "grammar-mismatch" | "unsafe-terminal-content" | "incomplete-prior-frame" | "excessive-real-damage";
36
- export interface PiTuiDamageDecision {
37
- readonly frameId: number | null;
38
- readonly transformed: boolean;
39
- readonly reason: PiTuiDamageDecisionReason;
40
- readonly shiftRows: number;
41
- readonly paintedRows: readonly number[];
42
- }
3
+ import type { TerminalDamageDecision, TerminalDamageDecisionReason, TerminalDamageFrameDescriptor, TerminalDamageFrameSafety } from "../../../contracts/presentation/index.js";
4
+ export type PiTuiDamageFrameDescriptor = TerminalDamageFrameDescriptor;
5
+ export type PiTuiDamageFrameSafety = TerminalDamageFrameSafety;
6
+ export type PiTuiDamageDecisionReason = TerminalDamageDecisionReason;
7
+ export type PiTuiDamageDecision = TerminalDamageDecision;
43
8
  export interface DamageAwareTerminalOptions {
44
9
  readonly regionalScroll: boolean;
45
10
  /** The shell supplies visible-row analysis; the terminal layer owns no UI parser. */
@@ -1,5 +1,6 @@
1
1
  export type { PiTuiComponentPort, PiTuiInputDiagnosticsEvent, PiTuiInputDiagnosticsPhase, PiTuiInputListener, PiTuiInputListenerResult, PiTuiLayoutEntry, PiTuiLayoutNode, PiTuiOverlayAnchor, PiTuiOverlayHandle, PiTuiOverlayMargin, PiTuiOverlayOptions, PiTuiOverlayUnfocusOptions, PiTuiPointerSurface, PiTuiPreInputListener, PiTuiRuntimeAdapterOptions, PiTuiRuntimeState, PiTuiScrollState, PiTuiSizeValue, PiTuiStopOptions, PiTuiTerminalPort, PiTuiViewport, } from "./contracts.js";
2
2
  export { samePointerSurfaces } from "./overlay-geometry.js";
3
+ export { PI_TERMINAL_RUNTIME } from "./runtime-factory.js";
3
4
  export { DamageAwareTerminalAdapter, PINNED_PI_TUI_DAMAGE_GRAMMAR, paintTerminalCanvasFrame, rebaseTerminalDefaultBackground, } from "./damage-aware-terminal.js";
4
5
  export type { DamageAwareTerminalOptions, PiTuiDamageDecision, PiTuiDamageDecisionReason, PiTuiDamageFrameDescriptor, PiTuiDamageFrameSafety, } from "./damage-aware-terminal.js";
5
6
  export { InputPresentationCoordinator, classifyPiTuiInput } from "./input-presentation-coordinator.js";
@@ -1,4 +1,5 @@
1
1
  export { samePointerSurfaces } from "./overlay-geometry.js";
2
+ export { PI_TERMINAL_RUNTIME } from "./runtime-factory.js";
2
3
  export { DamageAwareTerminalAdapter, PINNED_PI_TUI_DAMAGE_GRAMMAR, paintTerminalCanvasFrame, rebaseTerminalDefaultBackground, } from "./damage-aware-terminal.js";
3
4
  export { InputPresentationCoordinator, classifyPiTuiInput } from "./input-presentation-coordinator.js";
4
5
  export { PiTuiRuntimeAdapter, PiTuiRuntimeError } from "./adapter.js";
@@ -1,9 +1,7 @@
1
- export type PiTuiInputCoordinationDecision = "safe" | "barrier";
2
- export type PiTuiInputSurfaceKind = "editor" | "owned" | "opaque";
3
- export interface PiTuiInputCoordinationScheduler {
4
- scheduleImmediate(callback: () => void): ReturnType<typeof setImmediate>;
5
- cancelImmediate(handle: ReturnType<typeof setImmediate>): void;
6
- }
1
+ import type { TerminalInputCoordinationDecision, TerminalInputCoordinationScheduler, TerminalInputSurfaceKind } from "../../../contracts/presentation/index.js";
2
+ export type PiTuiInputCoordinationDecision = TerminalInputCoordinationDecision;
3
+ export type PiTuiInputSurfaceKind = TerminalInputSurfaceKind;
4
+ export type PiTuiInputCoordinationScheduler = TerminalInputCoordinationScheduler;
7
5
  export interface PiTuiInputCoordinationTrace {
8
6
  readonly phase: "receipt" | "semantic-start" | "semantic-end";
9
7
  readonly revision: number;
@@ -1,5 +1,6 @@
1
1
  import { TuiAltScreen, type Component, type OverlayHandle, type OverlayOptions } from "@earendil-works/pi-tui";
2
2
  import type { PresentationComponentPort, PresentationPointerSurface } from "../../../contracts/presentation/index.js";
3
+ import { samePointerSurfaces } from "../../../contracts/presentation/index.js";
3
4
  import type { PiTuiOverlayOptions } from "./contracts.js";
4
5
  /** Observes public component renders in compositor order, without accessing renderer state. */
5
6
  export declare class OverlayGeometryTracker {
@@ -22,11 +23,4 @@ export declare class GeometryObservedAltScreen extends TuiAltScreen {
22
23
  hideOverlay(): void;
23
24
  protected compositeOverlays(lines: string[], width: number, height: number): string[];
24
25
  }
25
- /** Compare only geometry and ownership, never animation content or transcript position. */
26
- export declare function samePointerSurfaces(a: readonly PresentationPointerSurface[], b: readonly PresentationPointerSurface[]): boolean;
27
- /**
28
- * Resolve the pinned public overlay options against the actual render width/height.
29
- * The runtime still owns layout and painting. Independent terminal-cell tests certify
30
- * this option-to-hit-region projection against its compositor, including clipping.
31
- */
32
- export declare function overlayPointerSurface(component: PresentationComponentPort, options: PiTuiOverlayOptions | undefined, width: number, renderedHeight: number, columns: number, rows: number): PresentationPointerSurface | undefined;
26
+ export { samePointerSurfaces };
@@ -1,4 +1,5 @@
1
1
  import { TuiAltScreen, isFocusable } from "@earendil-works/pi-tui";
2
+ import { samePointerSurfaces } from "../../../contracts/presentation/index.js";
2
3
  /** Observes public component renders in compositor order, without accessing renderer state. */
3
4
  export class OverlayGeometryTracker {
4
5
  #frame = [];
@@ -97,20 +98,13 @@ export class GeometryObservedAltScreen extends TuiAltScreen {
97
98
  return result;
98
99
  }
99
100
  }
100
- /** Compare only geometry and ownership, never animation content or transcript position. */
101
- export function samePointerSurfaces(a, b) {
102
- return a.length === b.length && a.every((surface, index) => {
103
- const other = b[index];
104
- return surface.component === other.component && surface.columnStart === other.columnStart
105
- && surface.columnEnd === other.columnEnd && surface.rowStart === other.rowStart && surface.rowEnd === other.rowEnd;
106
- });
107
- }
101
+ export { samePointerSurfaces };
108
102
  /**
109
103
  * Resolve the pinned public overlay options against the actual render width/height.
110
104
  * The runtime still owns layout and painting. Independent terminal-cell tests certify
111
105
  * this option-to-hit-region projection against its compositor, including clipping.
112
106
  */
113
- export function overlayPointerSurface(component, options, width, renderedHeight, columns, rows) {
107
+ function overlayPointerSurface(component, options, width, renderedHeight, columns, rows) {
114
108
  const opt = options ?? {};
115
109
  const margin = typeof opt.margin === "number"
116
110
  ? { top: opt.margin, right: opt.margin, bottom: opt.margin, left: opt.margin }
@@ -0,0 +1,3 @@
1
+ import type { TerminalRuntimeFactory } from "../../../contracts/presentation/index.js";
2
+ /** The Pi TUI runtime behind the neutral terminal runtime factory the shell uses. */
3
+ export declare const PI_TERMINAL_RUNTIME: TerminalRuntimeFactory;
@@ -0,0 +1,11 @@
1
+ import { legacyKeyInput, PiTuiRuntimeAdapter } from "./adapter.js";
2
+ import { DamageAwareTerminalAdapter, rebaseTerminalDefaultBackground } from "./damage-aware-terminal.js";
3
+ import { classifyPiTuiInput } from "./input-presentation-coordinator.js";
4
+ /** The Pi TUI runtime behind the neutral terminal runtime factory the shell uses. */
5
+ export const PI_TERMINAL_RUNTIME = Object.freeze({
6
+ createRuntime: options => new PiTuiRuntimeAdapter(options),
7
+ createDamageTerminal: (terminal, options) => new DamageAwareTerminalAdapter(terminal, options),
8
+ classifyInput: (data, surface) => classifyPiTuiInput(data, surface),
9
+ legacyKeyInput: data => legacyKeyInput(data),
10
+ rebaseDefaultBackground: (content, backgroundAnsi) => rebaseTerminalDefaultBackground(content, backgroundAnsi),
11
+ });
@@ -44,7 +44,7 @@ export { displayColumnSlice, displayWidth, displayWordColumnRange, faint, padToW
44
44
  export type { DisplayColumnRange, DisplayColumnSlice } from "./text.js";
45
45
  export { TEXT_SELECTION_MULTI_CLICK_MS, extendTextSelection, orderedTextSelection, paintTextSelection, plainTextBetweenColumns, pressTextSelection, releaseTextSelection, textSelectionLineExtendColumn, textSelectionPointAt, textSelectionText, usefulTextLineContent, } from "./text-selection.js";
46
46
  export type { OrderedTextSelection, TextSelection, TextSelectionClick, TextSelectionLineContent, TextSelectionPoint, TextSelectionPressInput, } from "./text-selection.js";
47
- export { PLAIN_THEME } from "./theme.js";
48
- export type { UiTheme, UiThemeToken } from "./theme.js";
47
+ export { PLAIN_THEME, PLAIN_THEME_SOURCE } from "./theme.js";
48
+ export type { ThemeSource, UiTheme, UiThemeBackground, UiThemeToken } from "./theme.js";
49
49
  export { menuRowAt, renderValueMenu, valueMenuFrame } from "./value-menu.js";
50
50
  export type { ValueMenuAnchor, ValueMenuFrame, ValueMenuLayout, ValueMenuState } from "./value-menu.js";
@@ -22,5 +22,5 @@ export { TranscriptViewport, assertTranscriptViewportFrameDescriptor } from "./t
22
22
  export { RAIL_COLUMNS, renderEmptyState, withScrollbarRail } from "./surface.js";
23
23
  export { displayColumnSlice, displayWidth, displayWordColumnRange, faint, padToWidth, stripAnsi, truncateToWidth } from "./text.js";
24
24
  export { TEXT_SELECTION_MULTI_CLICK_MS, extendTextSelection, orderedTextSelection, paintTextSelection, plainTextBetweenColumns, pressTextSelection, releaseTextSelection, textSelectionLineExtendColumn, textSelectionPointAt, textSelectionText, usefulTextLineContent, } from "./text-selection.js";
25
- export { PLAIN_THEME } from "./theme.js";
25
+ export { PLAIN_THEME, PLAIN_THEME_SOURCE } from "./theme.js";
26
26
  export { menuRowAt, renderValueMenu, valueMenuFrame } from "./value-menu.js";
@@ -19,6 +19,5 @@ export interface SelectionCopySnapshot {
19
19
  readonly rejected?: "size";
20
20
  }
21
21
  export declare function selectionCopyLineContent(text: string, prompt: SelectionCopyPrompt): TextSelectionLineContent;
22
- export declare function literalSelectionCopySnapshot(text: string, revision?: number): SelectionCopySnapshot | null;
23
22
  /** Extracts one snapshot row with the existing grapheme/newline policy; run expensive rows off-thread. */
24
23
  export declare function selectionCopyRowText(snapshot: Pick<SelectionCopySnapshot, "selection" | "literal">, row: SelectionCopyRow, index: number): string;
@@ -22,18 +22,6 @@ export function selectionCopyLineContent(text, prompt) {
22
22
  return { from, to: from + 1 };
23
23
  return usefulTextLineContent(plain, from);
24
24
  }
25
- export function literalSelectionCopySnapshot(text, revision = 0) {
26
- if (text.trim().length === 0)
27
- return null;
28
- const selection = {
29
- start: { line: 0, column: 0 },
30
- end: { line: 0, column: Number.MAX_SAFE_INTEGER },
31
- };
32
- if (text.length > MAX_COPY_SOURCE_UNITS) {
33
- return { literal: true, selection, revision, rows: [], sourceUnits: 0, rejected: "size" };
34
- }
35
- return { literal: true, selection, revision, rows: [{ text }], sourceUnits: text.length };
36
- }
37
25
  /** Extracts one snapshot row with the existing grapheme/newline policy; run expensive rows off-thread. */
38
26
  export function selectionCopyRowText(snapshot, row, index) {
39
27
  if (snapshot.literal)