@slopus/happy-terminal 0.3.0-beta.13

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 (248) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSE-CODEX +203 -0
  3. package/LICENSE-GROK-BUILD +204 -0
  4. package/LICENSE-HAPPY +21 -0
  5. package/README.md +60 -0
  6. package/THIRD-PARTY-NOTICES.md +34 -0
  7. package/dist/HappyTerminalUserError.d.ts +12 -0
  8. package/dist/app/AppTranscriptEntry.d.ts +33 -0
  9. package/dist/app/AppendOnlyStreamingRender.d.ts +12 -0
  10. package/dist/app/CodexFileDiff.d.ts +20 -0
  11. package/dist/app/CodexMcpToolCall.d.ts +25 -0
  12. package/dist/app/CodingAssistantAgentBackend.d.ts +81 -0
  13. package/dist/app/CodingAssistantApp.d.ts +128 -0
  14. package/dist/app/CompletedTurn.d.ts +11 -0
  15. package/dist/app/FileMentionAutocomplete.d.ts +30 -0
  16. package/dist/app/HappyTerminalProcessTerminal.d.ts +7 -0
  17. package/dist/app/NoticeChild.d.ts +4 -0
  18. package/dist/app/SecretMenuController.d.ts +31 -0
  19. package/dist/app/SelectionList.d.ts +24 -0
  20. package/dist/app/SessionDraftSync.d.ts +51 -0
  21. package/dist/app/StartupStatusApp.d.ts +34 -0
  22. package/dist/app/StartupStatusCardModel.d.ts +22 -0
  23. package/dist/app/TemporaryFullscreenController.d.ts +9 -0
  24. package/dist/app/TerminalColorLevel.d.ts +1 -0
  25. package/dist/app/TerminalOutputTrace.d.ts +12 -0
  26. package/dist/app/TerminalTheme.d.ts +11 -0
  27. package/dist/app/TranscriptEntryRenderCache.d.ts +10 -0
  28. package/dist/app/applyWorkflowRunUpdate.d.ts +2 -0
  29. package/dist/app/blendComposerBackground.d.ts +2 -0
  30. package/dist/app/boundedJsonStringify.d.ts +1 -0
  31. package/dist/app/calculateCacheHitPercent.d.ts +2 -0
  32. package/dist/app/codexDiffAnsi.d.ts +17 -0
  33. package/dist/app/compactCompletedTurnEntries.d.ts +2 -0
  34. package/dist/app/containsMarkdownTable.d.ts +1 -0
  35. package/dist/app/createAgentMarkdownTheme.d.ts +3 -0
  36. package/dist/app/createBackgroundTerminalViewer.d.ts +16 -0
  37. package/dist/app/createCompletedTurn.d.ts +6 -0
  38. package/dist/app/createEditorTheme.d.ts +3 -0
  39. package/dist/app/createFileMentionAutocompleteItems.d.ts +3 -0
  40. package/dist/app/createSecretInputPanel.d.ts +12 -0
  41. package/dist/app/createSelectionPanel.d.ts +14 -0
  42. package/dist/app/createSerialTaskQueue.d.ts +1 -0
  43. package/dist/app/createSessionPicker.d.ts +17 -0
  44. package/dist/app/createSlashCommands.d.ts +7 -0
  45. package/dist/app/createStopOnceHandler.d.ts +1 -0
  46. package/dist/app/createSubagentMonitor.d.ts +17 -0
  47. package/dist/app/createTerminalInputBurstHandler.d.ts +5 -0
  48. package/dist/app/createWorkflowMonitor.d.ts +15 -0
  49. package/dist/app/defaultTerminalTheme.d.ts +1 -0
  50. package/dist/app/describeModelChoice.d.ts +4 -0
  51. package/dist/app/describeProviderSignIn.d.ts +2 -0
  52. package/dist/app/describeReasoningLevel.d.ts +4 -0
  53. package/dist/app/detectCodexDiffLanguage.d.ts +1 -0
  54. package/dist/app/encodeModelChoice.d.ts +1 -0
  55. package/dist/app/endsAfterOpeningCodeFence.d.ts +1 -0
  56. package/dist/app/findFileMentionContext.d.ts +9 -0
  57. package/dist/app/findFileMentionPrefix.d.ts +5 -0
  58. package/dist/app/formatActivityElapsedTime.d.ts +1 -0
  59. package/dist/app/formatCodexMcpToolResult.d.ts +3 -0
  60. package/dist/app/formatCompactTokens.d.ts +1 -0
  61. package/dist/app/formatFileMention.d.ts +1 -0
  62. package/dist/app/formatProviderError.d.ts +6 -0
  63. package/dist/app/formatRelativeTime.d.ts +2 -0
  64. package/dist/app/formatResetDuration.d.ts +1 -0
  65. package/dist/app/formatSessionPickerEntry.d.ts +14 -0
  66. package/dist/app/formatSessionTokenStatus.d.ts +6 -0
  67. package/dist/app/formatSessionUsageSummary.d.ts +3 -0
  68. package/dist/app/formatStartupStatusUsageRemaining.d.ts +2 -0
  69. package/dist/app/formatStartupStatusUsageRows.d.ts +2 -0
  70. package/dist/app/formatSubagentToolCall.d.ts +10 -0
  71. package/dist/app/formatToolPermissionNotice.d.ts +3 -0
  72. package/dist/app/formatToolResultForDisplay.d.ts +2 -0
  73. package/dist/app/formatTurnUsageSummary.d.ts +2 -0
  74. package/dist/app/formatWorkUsageSummary.d.ts +14 -0
  75. package/dist/app/highlightAgentCode.d.ts +1 -0
  76. package/dist/app/highlightCodexDiffLine.d.ts +2 -0
  77. package/dist/app/highlightShellCommand.d.ts +1 -0
  78. package/dist/app/humanizeGoalStatus.d.ts +2 -0
  79. package/dist/app/humanizeMcpName.d.ts +1 -0
  80. package/dist/app/humanizePermissionMode.d.ts +2 -0
  81. package/dist/app/humanizePermissionReviewLevel.d.ts +2 -0
  82. package/dist/app/humanizeProviderId.d.ts +1 -0
  83. package/dist/app/humanizeReasoningLevel.d.ts +1 -0
  84. package/dist/app/humanizeSubagentStatus.d.ts +2 -0
  85. package/dist/app/humanizeToolName.d.ts +1 -0
  86. package/dist/app/humanizeWorkflowStatus.d.ts +2 -0
  87. package/dist/app/installResumeInstructions.d.ts +26 -0
  88. package/dist/app/installTerminalCrashCleanup.d.ts +26 -0
  89. package/dist/app/isLightTerminalBackground.d.ts +2 -0
  90. package/dist/app/layoutCodexFileDiff.d.ts +13 -0
  91. package/dist/app/looksLikeAuthenticationFailure.d.ts +5 -0
  92. package/dist/app/nearestXtermColorIndex.d.ts +2 -0
  93. package/dist/app/parseCodexMcpToolInvocation.d.ts +2 -0
  94. package/dist/app/parseSessionCommand.d.ts +6 -0
  95. package/dist/app/providerErrorResetAt.d.ts +2 -0
  96. package/dist/app/providerQuotaToStartupStatusUsage.d.ts +3 -0
  97. package/dist/app/readClipboardImage.d.ts +9 -0
  98. package/dist/app/renderActivityWave.d.ts +3 -0
  99. package/dist/app/renderAgentMarkdown.d.ts +8 -0
  100. package/dist/app/renderBackgroundTerminalCompletion.d.ts +1 -0
  101. package/dist/app/renderBackgroundTerminalInteraction.d.ts +2 -0
  102. package/dist/app/renderBackgroundTerminalSummary.d.ts +1 -0
  103. package/dist/app/renderChildRows.d.ts +13 -0
  104. package/dist/app/renderCodexDiffLine.d.ts +3 -0
  105. package/dist/app/renderCodexFileDiff.d.ts +7 -0
  106. package/dist/app/renderCodexMcpToolCall.d.ts +2 -0
  107. package/dist/app/renderCompletedTurnStats.d.ts +2 -0
  108. package/dist/app/renderExecCommand.d.ts +11 -0
  109. package/dist/app/renderExploration.d.ts +9 -0
  110. package/dist/app/renderFullscreenComponent.d.ts +8 -0
  111. package/dist/app/renderHappyTerminalBanner.d.ts +6 -0
  112. package/dist/app/renderHappyTerminalVersion.d.ts +1 -0
  113. package/dist/app/renderNoticeWithChildren.d.ts +7 -0
  114. package/dist/app/renderPendingSteeringMessages.d.ts +1 -0
  115. package/dist/app/renderStartupStatusCard.d.ts +7 -0
  116. package/dist/app/renderSubagentSummary.d.ts +6 -0
  117. package/dist/app/renderTurnCompletionSeparator.d.ts +1 -0
  118. package/dist/app/renderWorkflowSummary.d.ts +1 -0
  119. package/dist/app/resolveInputBackground.d.ts +3 -0
  120. package/dist/app/resolveStartupProviderQuota.d.ts +3 -0
  121. package/dist/app/resolveStartupSessionId.d.ts +18 -0
  122. package/dist/app/resolveTerminalColorLevel.d.ts +2 -0
  123. package/dist/app/resolveTerminalStyle.d.ts +1 -0
  124. package/dist/app/resolveTerminalTheme.d.ts +5 -0
  125. package/dist/app/runApp.d.ts +27 -0
  126. package/dist/app/runClipboardCommand.d.ts +8 -0
  127. package/dist/app/sanitizeTerminalText.d.ts +1 -0
  128. package/dist/app/shortenHomePath.d.ts +2 -0
  129. package/dist/app/sortSubagentsForDisplay.d.ts +2 -0
  130. package/dist/app/subagentElapsedMs.d.ts +2 -0
  131. package/dist/app/subagentLogMessageText.d.ts +2 -0
  132. package/dist/app/surfaceThemedLine.d.ts +3 -0
  133. package/dist/app/truncatePathToWidth.d.ts +1 -0
  134. package/dist/app/truncateTextForDisplay.d.ts +5 -0
  135. package/dist/app/truncateUtf8BytesForDisplay.d.ts +1 -0
  136. package/dist/app/upsertSubagentSummary.d.ts +2 -0
  137. package/dist/app/workflowDisplay.d.ts +2 -0
  138. package/dist/client/HappyAgentEventHub.d.ts +25 -0
  139. package/dist/client/RemoteAgent.d.ts +74 -0
  140. package/dist/client/RemoteAgentRunError.d.ts +4 -0
  141. package/dist/client/RemoteTerminalAttachment.d.ts +19 -0
  142. package/dist/client/RemoteTerminalClientReplica.d.ts +14 -0
  143. package/dist/client/ensureLocalProtocolServer.d.ts +10 -0
  144. package/dist/client/fetchProviderQuotas.d.ts +10 -0
  145. package/dist/client/index.d.ts +8 -0
  146. package/dist/client/loadAgentCatalog.d.ts +32 -0
  147. package/dist/config/createProjectConfigSecurityNotice.d.ts +10 -0
  148. package/dist/config/defaultConfig.d.ts +2 -0
  149. package/dist/config/getDefaultGlobalConfigPath.d.ts +1 -0
  150. package/dist/config/getDefaultLocalConfigPath.d.ts +1 -0
  151. package/dist/config/getDefaultRuntimeConfigPath.d.ts +1 -0
  152. package/dist/config/getHappyConfigDirectory.d.ts +1 -0
  153. package/dist/config/getHappyTerminalHome.d.ts +1 -0
  154. package/dist/config/index.d.ts +15 -0
  155. package/dist/config/loadConfig.d.ts +2 -0
  156. package/dist/config/mergeConfigValues.d.ts +2 -0
  157. package/dist/config/parseConfigToml.d.ts +7 -0
  158. package/dist/config/readConfigFile.d.ts +2 -0
  159. package/dist/config/readProjectConfigFile.d.ts +2 -0
  160. package/dist/config/resolveConfigPaths.d.ts +2 -0
  161. package/dist/config/runtimeConfigLock.d.ts +1 -0
  162. package/dist/config/types.d.ts +74 -0
  163. package/dist/config/updateRuntimeConfig.d.ts +2 -0
  164. package/dist/config/updateRuntimePreferences.d.ts +2 -0
  165. package/dist/config/withoutProjectMachineSettings.d.ts +7 -0
  166. package/dist/config/writeRuntimeConfig.d.ts +3 -0
  167. package/dist/config/writeRuntimeConfigDefaults.d.ts +2 -0
  168. package/dist/daemon/createUnixSocketFetch.d.ts +2 -0
  169. package/dist/daemon/daemonPid.d.ts +11 -0
  170. package/dist/daemon/ensureHappyAgentBinary.d.ts +15 -0
  171. package/dist/daemon/ensureLocalProtocolServer.d.ts +24 -0
  172. package/dist/daemon/getHappyDaemonPaths.d.ts +16 -0
  173. package/dist/daemon/happyAgentBinaryConfig.d.ts +15 -0
  174. package/dist/daemon/index.d.ts +5 -0
  175. package/dist/daemon/runDaemonCommand.d.ts +4 -0
  176. package/dist/debug/DebugLog.d.ts +11 -0
  177. package/dist/debug/closeNodeInspector.d.ts +1 -0
  178. package/dist/debug/createDebugJsonReplacer.d.ts +1 -0
  179. package/dist/debug/createRequestDebugDirectory.d.ts +1 -0
  180. package/dist/debug/getDebugRootDirectory.d.ts +1 -0
  181. package/dist/debug/getNodeInspectorUrl.d.ts +1 -0
  182. package/dist/debug/index.d.ts +8 -0
  183. package/dist/debug/openNodeInspector.d.ts +1 -0
  184. package/dist/debug/registerHappyTerminalDebugRoot.d.ts +5 -0
  185. package/dist/docs/DESIGN.md +2191 -0
  186. package/dist/docs/README.md +93 -0
  187. package/dist/docs/agents-and-collaboration.md +365 -0
  188. package/dist/docs/architecture.md +468 -0
  189. package/dist/docs/extending.md +561 -0
  190. package/dist/docs/happy.md +386 -0
  191. package/dist/docs/permissions-and-sandbox.md +342 -0
  192. package/dist/docs/workspaces.md +281 -0
  193. package/dist/errorToMessage.d.ts +1 -0
  194. package/dist/formatCliFailure.d.ts +10 -0
  195. package/dist/index.d.ts +3 -0
  196. package/dist/index.js +17151 -0
  197. package/dist/main.js +18946 -0
  198. package/dist/observability/daemonContext.d.ts +16 -0
  199. package/dist/observability/index.d.ts +1 -0
  200. package/dist/processes/BoundedOutputBuffer.d.ts +20 -0
  201. package/dist/processes/NativeProcessManager.d.ts +66 -0
  202. package/dist/processes/ProcessGroupReaper.d.ts +32 -0
  203. package/dist/processes/index.d.ts +7 -0
  204. package/dist/processes/isProcessRunning.d.ts +1 -0
  205. package/dist/processes/isTargetProcessAlive.d.ts +1 -0
  206. package/dist/processes/killProcessTree.d.ts +2 -0
  207. package/dist/processes/resolveSystemShell.d.ts +1 -0
  208. package/dist/processes/startProcessTransport.d.ts +33 -0
  209. package/dist/processes/types.d.ts +41 -0
  210. package/dist/processes/waitForProcessExit.d.ts +2 -0
  211. package/dist/protocol/AppletProtocol.d.ts +101 -0
  212. package/dist/protocol/Attachment.d.ts +96 -0
  213. package/dist/protocol/ClientProtocolTypes.d.ts +481 -0
  214. package/dist/protocol/DocumentProtocol.d.ts +109 -0
  215. package/dist/protocol/EventId.d.ts +1 -0
  216. package/dist/protocol/FolderProtocol.d.ts +236 -0
  217. package/dist/protocol/FolderSharingProtocol.d.ts +97 -0
  218. package/dist/protocol/GitHubPluginProtocol.d.ts +43 -0
  219. package/dist/protocol/GlobalSecurityProtocol.d.ts +7 -0
  220. package/dist/protocol/HappyCloudProtocol.d.ts +178 -0
  221. package/dist/protocol/InstallationProtocol.d.ts +80 -0
  222. package/dist/protocol/OnboardingProtocol.d.ts +47 -0
  223. package/dist/protocol/P2pCredentialProtocol.d.ts +273 -0
  224. package/dist/protocol/P2pIdentityProtocol.d.ts +8 -0
  225. package/dist/protocol/P2pPairingProtocol.d.ts +68 -0
  226. package/dist/protocol/P2pProtocol.d.ts +185 -0
  227. package/dist/protocol/PluginWireTypes.d.ts +81 -0
  228. package/dist/protocol/ProfileProtocol.d.ts +127 -0
  229. package/dist/protocol/ProjectFileProtocol.d.ts +63 -0
  230. package/dist/protocol/ProjectProtocol.d.ts +646 -0
  231. package/dist/protocol/ProtocolVersion.d.ts +8 -0
  232. package/dist/protocol/ServiceNotice.d.ts +175 -0
  233. package/dist/protocol/SessionProtocol.d.ts +1156 -0
  234. package/dist/protocol/SharingProtocol.d.ts +159 -0
  235. package/dist/protocol/SlotProtocol.d.ts +270 -0
  236. package/dist/protocol/TimelineProtocol.d.ts +88 -0
  237. package/dist/protocol/WorkletProtocol.d.ts +159 -0
  238. package/dist/protocol/createEventIdFactory.d.ts +7 -0
  239. package/dist/protocol/index.d.ts +34 -0
  240. package/dist/readPackageVersion.d.ts +1 -0
  241. package/dist/readPackageVersion.js +16 -0
  242. package/dist/reportCliFailure.d.ts +2 -0
  243. package/dist/runHappyTerminal.d.ts +6 -0
  244. package/dist/terminal/index.d.ts +2 -0
  245. package/dist/terminal/types.d.ts +39 -0
  246. package/dist/types.d.ts +6 -0
  247. package/dist/writeStderrSync.d.ts +5 -0
  248. package/package.json +97 -0
@@ -0,0 +1,5 @@
1
+ export interface TerminalInputBurstHandler {
2
+ dispose(): void;
3
+ handle(data: string): void;
4
+ }
5
+ export declare function createTerminalInputBurstHandler(onInput: (data: string) => void): TerminalInputBurstHandler;
@@ -0,0 +1,15 @@
1
+ import { type Component } from "@earendil-works/pi-tui";
2
+ import type { SubagentSummary } from "../protocol/index.js";
3
+ import type { WorkflowRun } from "../protocol/index.js";
4
+ import type { TerminalTheme } from "./TerminalTheme.js";
5
+ export interface CreateWorkflowMonitorOptions {
6
+ getSubagents(): readonly SubagentSummary[];
7
+ getWorkflows(): readonly WorkflowRun[];
8
+ initialRunId?: string;
9
+ now?: () => number;
10
+ onCancel(): void;
11
+ onRequestRender?(): void;
12
+ onStop(runId: string): void | Promise<void>;
13
+ theme?: TerminalTheme;
14
+ }
15
+ export declare function createWorkflowMonitor(options: CreateWorkflowMonitorOptions): Component;
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_TERMINAL_THEME: import("./TerminalTheme.js").TerminalTheme;
@@ -0,0 +1,4 @@
1
+ import type { Model } from "../protocol/index.js";
2
+ export declare function describeModelChoice(model: Model, providerId: string, isCurrent: boolean, options?: {
3
+ unavailable?: boolean;
4
+ }): string;
@@ -0,0 +1,2 @@
1
+ /** The assistant a user signs in through, since Happy Terminal reuses those credentials. */
2
+ export declare function describeProviderSignIn(providerId: string): string | undefined;
@@ -0,0 +1,4 @@
1
+ export declare function describeReasoningLevel(level: string, options: {
2
+ isCurrent: boolean;
3
+ isDefault: boolean;
4
+ }): string;
@@ -0,0 +1 @@
1
+ export declare function detectCodexDiffLanguage(path: string): string | undefined;
@@ -0,0 +1 @@
1
+ export declare function encodeModelChoice(providerId: string, modelId: string): string;
@@ -0,0 +1 @@
1
+ export declare function endsAfterOpeningCodeFence(text: string): boolean;
@@ -0,0 +1,9 @@
1
+ import { type FileMentionPrefix } from "./findFileMentionPrefix.js";
2
+ export interface FileMentionContext extends FileMentionPrefix {
3
+ afterCursor: string;
4
+ key: string;
5
+ }
6
+ export declare function findFileMentionContext(lines: readonly string[], cursor: {
7
+ line: number;
8
+ col: number;
9
+ }): FileMentionContext | undefined;
@@ -0,0 +1,5 @@
1
+ export interface FileMentionPrefix {
2
+ prefix: string;
3
+ query: string;
4
+ }
5
+ export declare function findFileMentionPrefix(textBeforeCursor: string): FileMentionPrefix | undefined;
@@ -0,0 +1 @@
1
+ export declare function formatActivityElapsedTime(elapsedMs: number): string;
@@ -0,0 +1,3 @@
1
+ import type { ContentBlock } from "../protocol/index.js";
2
+ import type { CodexMcpToolCall } from "./CodexMcpToolCall.js";
3
+ export declare function formatCodexMcpToolResult(blocks: readonly ContentBlock[] | undefined): CodexMcpToolCall["result"];
@@ -0,0 +1 @@
1
+ export declare function formatCompactTokens(value: number): string;
@@ -0,0 +1 @@
1
+ export declare function formatFileMention(path: string): string;
@@ -0,0 +1,6 @@
1
+ import type { ProviderError } from "../protocol/index.js";
2
+ export declare function formatProviderError(error: ProviderError | undefined, options: {
3
+ fallbackMessage?: string;
4
+ now?: number;
5
+ providerId: string;
6
+ }): string;
@@ -0,0 +1,2 @@
1
+ /** Turns a past timestamp into a short human phrase such as "just now" or "3 days ago". */
2
+ export declare function formatRelativeTime(timestamp: number, now: number): string;
@@ -0,0 +1 @@
1
+ export declare function formatResetDuration(milliseconds: number): string;
@@ -0,0 +1,14 @@
1
+ import type { AgentCatalogEntry } from "../client/index.js";
2
+ export interface SessionPickerEntry {
3
+ /** Short badge for sessions that need attention or ended unexpectedly. */
4
+ badge?: string;
5
+ /** Last activity plus context size, shown right-aligned next to the title. */
6
+ meta: string;
7
+ /** The most recent thing that happened, or the directory when titles are missing. */
8
+ detail?: string;
9
+ title: string;
10
+ }
11
+ export declare function formatSessionPickerEntry(entry: AgentCatalogEntry, options: {
12
+ now: number;
13
+ showDirectory: boolean;
14
+ }): SessionPickerEntry;
@@ -0,0 +1,6 @@
1
+ import type { Usage } from "../protocol/index.js";
2
+ export declare function formatSessionTokenStatus(options: {
3
+ contextTokens: number;
4
+ contextWindow?: number;
5
+ usage: Usage;
6
+ }): string;
@@ -0,0 +1,3 @@
1
+ import type { GetSessionUsageResponse } from "../protocol/index.js";
2
+ import type { CodingAssistantModelChoice } from "./CodingAssistantAgentBackend.js";
3
+ export declare function formatSessionUsageSummary(summary: GetSessionUsageResponse, modelChoices: readonly CodingAssistantModelChoice[], now?: number): string;
@@ -0,0 +1,2 @@
1
+ import type { StartupStatusCardUsageWindow } from "./StartupStatusCardModel.js";
2
+ export declare function formatStartupStatusUsageRemaining(label: string, value: StartupStatusCardUsageWindow, width: number): string;
@@ -0,0 +1,2 @@
1
+ import type { StartupStatusCardUsage } from "./StartupStatusCardModel.js";
2
+ export declare function formatStartupStatusUsageRows(usage: StartupStatusCardUsage | undefined, width: number): string[];
@@ -0,0 +1,10 @@
1
+ import type { Model } from "../protocol/index.js";
2
+ import type { CodingAssistantModelChoice } from "./CodingAssistantAgentBackend.js";
3
+ export declare function formatSubagentToolCall(options: {
4
+ args: Readonly<Record<string, unknown>>;
5
+ currentModel: Model;
6
+ currentProviderId: string;
7
+ modelChoices: readonly CodingAssistantModelChoice[];
8
+ resolvedModelId?: string;
9
+ toolName: string;
10
+ }): string | undefined;
@@ -0,0 +1,3 @@
1
+ import type { ToolPermission } from "../protocol/index.js";
2
+ /** One compact, human-readable audit line for a tool's automatic permission review. */
3
+ export declare function formatToolPermissionNotice(permission: ToolPermission): string;
@@ -0,0 +1,2 @@
1
+ import type { ToolResultBlock } from "../protocol/index.js";
2
+ export declare function formatToolResultForDisplay(block: Pick<ToolResultBlock, "display" | "failure" | "toolName">): string;
@@ -0,0 +1,2 @@
1
+ import type { Usage } from "../protocol/index.js";
2
+ export declare function formatTurnUsageSummary(usage: Usage): string;
@@ -0,0 +1,14 @@
1
+ import type { Usage } from "../protocol/index.js";
2
+ type WorkUsage = Pick<Usage, "cacheRead" | "input" | "output">;
3
+ type DetailedUsage = WorkUsage & Pick<Usage, "cacheWrite">;
4
+ /** Human-scale work volume for compact status rows. */
5
+ export declare function formatWorkUsageSummary(usage: WorkUsage, options?: {
6
+ readonly contextTokens?: number;
7
+ readonly usedTokens?: number;
8
+ }): string;
9
+ /** Full provider counters for multiline usage views. */
10
+ export declare function formatWorkUsageDetails(usage: DetailedUsage): string[];
11
+ /** Keep one decimal at token-display scales so usage remains informative. */
12
+ export declare function formatUsageTokens(value: number): string;
13
+ export declare function calculateUsedTokens(usage: WorkUsage): number;
14
+ export {};
@@ -0,0 +1 @@
1
+ export declare function highlightAgentCode(code: string, lang?: string): string[];
@@ -0,0 +1,2 @@
1
+ import type { CodexDiffPalette } from "./CodexFileDiff.js";
2
+ export declare function highlightCodexDiffLine(line: string, language?: string, palette?: CodexDiffPalette): string;
@@ -0,0 +1 @@
1
+ export declare function highlightShellCommand(command: string): string;
@@ -0,0 +1,2 @@
1
+ import type { GoalStatus } from "../protocol/index.js";
2
+ export declare function humanizeGoalStatus(status: GoalStatus): string;
@@ -0,0 +1 @@
1
+ export declare function humanizeMcpName(value: string, fallback?: string): string;
@@ -0,0 +1,2 @@
1
+ import type { PermissionMode } from "../protocol/index.js";
2
+ export declare function humanizePermissionMode(mode: PermissionMode): string;
@@ -0,0 +1,2 @@
1
+ import type { AutoPermissionRisk, AutoPermissionUserAuthorization } from "../protocol/index.js";
2
+ export declare function humanizePermissionReviewLevel(level: AutoPermissionRisk | AutoPermissionUserAuthorization): string;
@@ -0,0 +1 @@
1
+ export declare function humanizeProviderId(providerId: string): string;
@@ -0,0 +1 @@
1
+ export declare function humanizeReasoningLevel(level: string): string;
@@ -0,0 +1,2 @@
1
+ import type { SubagentSummary } from "../protocol/index.js";
2
+ export declare function humanizeSubagentStatus(status: SubagentSummary["status"]): string;
@@ -0,0 +1 @@
1
+ export declare function humanizeToolName(name: string): string;
@@ -0,0 +1,2 @@
1
+ import type { WorkflowRunStatus } from "../protocol/index.js";
2
+ export declare function humanizeWorkflowStatus(status: WorkflowRunStatus): string;
@@ -0,0 +1,26 @@
1
+ export interface ResumeInstructions {
2
+ /** Reports the instructions now, on the ordinary exit path. */
3
+ report(): void;
4
+ /** Drops the instructions without reporting them, for a reload that reopens the session. */
5
+ suppress(): void;
6
+ uninstall(): void;
7
+ }
8
+ export interface ResumeInstructionsProcessEvents {
9
+ off(event: "exit", listener: () => void): void;
10
+ on(event: "exit", listener: () => void): void;
11
+ }
12
+ /**
13
+ * Keeps the way back into a session on screen no matter how Happy Terminal leaves it.
14
+ *
15
+ * The session id is the only handle a user has on a session once the TUI is gone, so losing it
16
+ * loses the work. Printing it from the shutdown path alone is not enough: a hangup, a fatal
17
+ * error, or a failure between opening the session and starting the app all skip that path. This
18
+ * installs one hook that fires on any exit once the id is known, reports at most once, and writes
19
+ * synchronously so an immediate `process.exit` cannot truncate it.
20
+ */
21
+ export declare function installResumeInstructions(options: {
22
+ processEvents?: ResumeInstructionsProcessEvents;
23
+ resumeCommand: string;
24
+ sessionId: string;
25
+ write?: (text: string) => void;
26
+ }): ResumeInstructions;
@@ -0,0 +1,26 @@
1
+ export interface TerminalCrashCleanup {
2
+ restore(): void;
3
+ /**
4
+ * Restores the terminal and briefly swallows late answers to Happy Terminal's terminal queries, so
5
+ * focus events and background-colour replies never land in the shell as escape garbage.
6
+ */
7
+ restoreAndDrain(): Promise<void>;
8
+ uninstall(): void;
9
+ }
10
+ export type TerminalCrashCleanupEvent = "uncaughtExceptionMonitor" | "unhandledRejection";
11
+ export interface TerminalCrashCleanupProcessEvents {
12
+ off(event: TerminalCrashCleanupEvent, listener: () => void): void;
13
+ on(event: "uncaughtExceptionMonitor", listener: () => void): void;
14
+ prependListener(event: "unhandledRejection", listener: () => void): void;
15
+ }
16
+ export declare function installTerminalCrashCleanup(options: {
17
+ processEvents?: TerminalCrashCleanupProcessEvents;
18
+ terminal: {
19
+ drainInput?(maxMs?: number, idleMs?: number): Promise<void>;
20
+ stop(): void;
21
+ write(data: string): void;
22
+ };
23
+ tui: {
24
+ stop(): void;
25
+ };
26
+ }): TerminalCrashCleanup;
@@ -0,0 +1,2 @@
1
+ import type { RgbColor } from "@earendil-works/pi-tui";
2
+ export declare function isLightTerminalBackground(background: RgbColor | undefined): boolean;
@@ -0,0 +1,13 @@
1
+ import type { CodexFileDiff, CodexFileDiffLineKind } from "./CodexFileDiff.js";
2
+ export interface LaidOutCodexDiffLine {
3
+ kind: CodexFileDiffLineKind;
4
+ lineNumber: number;
5
+ text: string;
6
+ }
7
+ export type LaidOutCodexDiffRow = {
8
+ readonly type: "hunk_separator";
9
+ } | {
10
+ readonly line: LaidOutCodexDiffLine;
11
+ readonly type: "line";
12
+ };
13
+ export declare function layoutCodexFileDiff(diff: CodexFileDiff): Generator<LaidOutCodexDiffRow>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Detects raw upstream credential rejections so a provider that did not classify its
3
+ * failure still produces readable text instead of a diagnostic string.
4
+ */
5
+ export declare function looksLikeAuthenticationFailure(message: string | undefined): boolean;
@@ -0,0 +1,2 @@
1
+ import type { RgbColor } from "@earendil-works/pi-tui";
2
+ export declare function nearestXtermColorIndex(target: RgbColor): number;
@@ -0,0 +1,2 @@
1
+ import type { CodexMcpToolInvocation } from "./CodexMcpToolCall.js";
2
+ export declare function parseCodexMcpToolInvocation(toolName: string, argumentsValue: unknown): CodexMcpToolInvocation | undefined;
@@ -0,0 +1,6 @@
1
+ export interface SessionCommandOptions {
2
+ all: boolean;
3
+ last: boolean;
4
+ sessionId?: string;
5
+ }
6
+ export declare function parseSessionCommand(args: readonly string[]): SessionCommandOptions;
@@ -0,0 +1,2 @@
1
+ import type { ProviderError } from "../protocol/index.js";
2
+ export declare function providerErrorResetAt(error: ProviderError | undefined): number | undefined;
@@ -0,0 +1,3 @@
1
+ import type { ProviderQuota } from "@slopus/happy-providers";
2
+ import type { StartupStatusCardUsage } from "./StartupStatusCardModel.js";
3
+ export declare function providerQuotaToStartupStatusUsage(quota: ProviderQuota | undefined, now?: number): StartupStatusCardUsage | undefined;
@@ -0,0 +1,9 @@
1
+ export interface ClipboardImage {
2
+ data: string;
3
+ mediaType: string;
4
+ path: string;
5
+ }
6
+ export interface ReadClipboardImageOptions {
7
+ outputDirectory?: string;
8
+ }
9
+ export declare function readClipboardImage(options?: ReadClipboardImageOptions): Promise<ClipboardImage | undefined>;
@@ -0,0 +1,3 @@
1
+ import type { TerminalTheme } from "./TerminalTheme.js";
2
+ export declare const ACTIVITY_WAVE_FRAME_COUNT = 12;
3
+ export declare function renderActivityWave(text: string, frame: number, theme: Pick<TerminalTheme, "isLight">): string;
@@ -0,0 +1,8 @@
1
+ import type { TerminalTheme } from "./TerminalTheme.js";
2
+ export interface RenderAgentMarkdownOptions {
3
+ text: string;
4
+ width: number;
5
+ cwd: string;
6
+ theme?: TerminalTheme;
7
+ }
8
+ export declare function renderAgentMarkdown(options: RenderAgentMarkdownOptions): string[];
@@ -0,0 +1 @@
1
+ export declare function renderBackgroundTerminalCompletion(command: string, width: number): string;
@@ -0,0 +1,2 @@
1
+ import type { BackgroundTerminalInteractionPresentation } from "../protocol/index.js";
2
+ export declare function renderBackgroundTerminalInteraction(interaction: BackgroundTerminalInteractionPresentation, width: number, review?: string): string[];
@@ -0,0 +1 @@
1
+ export declare function renderBackgroundTerminalSummary(count: number, width: number): string | undefined;
@@ -0,0 +1,13 @@
1
+ export interface ChildRow {
2
+ lineLimit?: number;
3
+ prefix?: string;
4
+ suffix?: string;
5
+ text: string;
6
+ wrap?: boolean;
7
+ }
8
+ export declare function renderChildRows(rows: readonly ChildRow[], options: {
9
+ afterMarker?: string;
10
+ markerStyle?: string;
11
+ pad?: boolean;
12
+ width: number;
13
+ }): string[];
@@ -0,0 +1,3 @@
1
+ import type { CodexDiffPalette } from "./CodexFileDiff.js";
2
+ import type { LaidOutCodexDiffLine } from "./layoutCodexFileDiff.js";
3
+ export declare function renderCodexDiffLine(line: LaidOutCodexDiffLine, lineNumberWidth: number, language: string | undefined, palette: CodexDiffPalette, width: number): string;
@@ -0,0 +1,7 @@
1
+ import type { CodexDiffPalette, CodexFileDiff } from "./CodexFileDiff.js";
2
+ export interface RenderCodexFileDiffOptions {
3
+ readonly maxRows?: number;
4
+ readonly palette?: CodexDiffPalette;
5
+ readonly width?: number;
6
+ }
7
+ export declare function renderCodexFileDiff(diff: CodexFileDiff, options?: RenderCodexFileDiffOptions): string[];
@@ -0,0 +1,2 @@
1
+ import type { CodexMcpToolCall, CodexMcpToolRenderOptions } from "./CodexMcpToolCall.js";
2
+ export declare function renderCodexMcpToolCall(call: CodexMcpToolCall, options: CodexMcpToolRenderOptions): string[];
@@ -0,0 +1,2 @@
1
+ import type { CompletedTurnStats } from "./CompletedTurn.js";
2
+ export declare function renderCompletedTurnStats(stats: CompletedTurnStats, width: number, usageSummary?: string): string;
@@ -0,0 +1,11 @@
1
+ import type { ExecCommandPresentation } from "../protocol/index.js";
2
+ export declare function renderExecCommand(presentation: ExecCommandPresentation, options: {
3
+ active?: boolean;
4
+ brand: string;
5
+ detail?: string;
6
+ primary: string;
7
+ review?: string;
8
+ status: string;
9
+ verb: string;
10
+ width: number;
11
+ }): string[];
@@ -0,0 +1,9 @@
1
+ import type { ExplorationToolCallPresentation } from "../protocol/index.js";
2
+ export declare function renderExploration(presentations: readonly ExplorationToolCallPresentation[], options: {
3
+ accent: string;
4
+ brand: string;
5
+ primary: string;
6
+ status: string;
7
+ title: "Awaiting approval" | "Explored" | "Exploring";
8
+ width: number;
9
+ }): string[];
@@ -0,0 +1,8 @@
1
+ import type { Component } from "@earendil-works/pi-tui";
2
+ import type { TerminalTheme } from "./TerminalTheme.js";
3
+ export declare function renderFullscreenComponent(options: {
4
+ component: Component;
5
+ height: number;
6
+ theme: TerminalTheme;
7
+ width: number;
8
+ }): string[];
@@ -0,0 +1,6 @@
1
+ export declare function renderHappyTerminalBanner(options: {
2
+ brand: string;
3
+ secondary: string;
4
+ version: string;
5
+ width: number;
6
+ }): string[];
@@ -0,0 +1 @@
1
+ export declare function renderHappyTerminalVersion(version: string, width: number): string[];
@@ -0,0 +1,7 @@
1
+ import type { NoticeChild } from "./NoticeChild.js";
2
+ export declare function renderNoticeWithChildren(options: {
3
+ readonly children: readonly NoticeChild[];
4
+ readonly color: string;
5
+ readonly title: string;
6
+ readonly width: number;
7
+ }): string[];
@@ -0,0 +1 @@
1
+ export declare function renderPendingSteeringMessages(messages: readonly string[], width: number): string[];
@@ -0,0 +1,7 @@
1
+ import type { StartupStatusCardModel } from "./StartupStatusCardModel.js";
2
+ import type { TerminalTheme } from "./TerminalTheme.js";
3
+ export declare function renderStartupStatusCard(options: {
4
+ model: StartupStatusCardModel;
5
+ theme: TerminalTheme;
6
+ width: number;
7
+ }): string[];
@@ -0,0 +1,6 @@
1
+ export declare function renderSubagentSummary(options: {
2
+ count: number;
3
+ elapsedMs: number;
4
+ totalTokens: number;
5
+ width: number;
6
+ }): string | undefined;
@@ -0,0 +1 @@
1
+ export declare function renderTurnCompletionSeparator(elapsedMs: number, width: number, usageSummary?: string): string;
@@ -0,0 +1 @@
1
+ export declare function renderWorkflowSummary(count: number, width: number): string | undefined;
@@ -0,0 +1,3 @@
1
+ import type { RgbColor } from "@earendil-works/pi-tui";
2
+ import type { TerminalColorLevel } from "./TerminalColorLevel.js";
3
+ export declare function resolveInputBackground(background: RgbColor | undefined, colorLevel: TerminalColorLevel): string;
@@ -0,0 +1,3 @@
1
+ export declare const STARTUP_PROVIDER_QUOTA_BUDGET_MS = 200;
2
+ /** Startup shows quota only when the probe answers within its budget; it never blocks. */
3
+ export declare function resolveStartupProviderQuota<T>(load: () => Promise<T>, budgetMs?: number): Promise<T | undefined>;
@@ -0,0 +1,18 @@
1
+ import type { HappyAgentClient } from "@slopus/happy-agent-client";
2
+ import type { SessionCommandOptions } from "./parseSessionCommand.js";
3
+ import type { StartupStatusApp } from "./StartupStatusApp.js";
4
+ export interface StartupSessionSelection {
5
+ command: "fork" | "resume";
6
+ selection: SessionCommandOptions;
7
+ }
8
+ /**
9
+ * Turns a `happy-terminal resume` or `happy-terminal fork` invocation into the session the TUI should open, asking the
10
+ * user on the startup screen when the command did not name one. Returns undefined when the user
11
+ * dismisses the picker, which is a decision rather than a failure.
12
+ */
13
+ export declare function resolveStartupSessionId(options: {
14
+ client: HappyAgentClient;
15
+ cwd: string;
16
+ selection: StartupSessionSelection;
17
+ startup: StartupStatusApp;
18
+ }): Promise<string | undefined>;
@@ -0,0 +1,2 @@
1
+ import type { TerminalColorLevel } from "./TerminalColorLevel.js";
2
+ export declare function resolveTerminalColorLevel(environment?: NodeJS.ProcessEnv): TerminalColorLevel;
@@ -0,0 +1 @@
1
+ export declare function resolveTerminalStyle(value: string, role: string): string;
@@ -0,0 +1,5 @@
1
+ import type { RgbColor } from "@earendil-works/pi-tui";
2
+ import type { ConfigTheme } from "../config/index.js";
3
+ import type { TerminalTheme } from "./TerminalTheme.js";
4
+ import type { TerminalColorLevel } from "./TerminalColorLevel.js";
5
+ export declare function resolveTerminalTheme(config: ConfigTheme, terminalBackground?: RgbColor, colorLevel?: TerminalColorLevel): TerminalTheme;
@@ -0,0 +1,27 @@
1
+ import type { Context } from "@steve.kite/stdlib";
2
+ import type { PermissionMode } from "../protocol/index.js";
3
+ import { type StartupSessionSelection } from "./resolveStartupSessionId.js";
4
+ export interface RunAppOptions {
5
+ /** Command the host exposes for reopening a session, normally `happy`. */
6
+ commandName?: string;
7
+ compactCompletedTurns?: boolean;
8
+ cwd?: string;
9
+ debug?: boolean;
10
+ effort?: string;
11
+ instructions?: string;
12
+ modelId?: string;
13
+ onError?: (error: unknown) => void;
14
+ providerId?: string;
15
+ permissionMode?: PermissionMode;
16
+ resumeSessionId?: string;
17
+ sessionSelection?: StartupSessionSelection;
18
+ showReasoning?: boolean;
19
+ showUsage?: boolean;
20
+ }
21
+ export type RunAppResult = {
22
+ action: "exit";
23
+ } | {
24
+ action: "reload";
25
+ sessionId: string;
26
+ };
27
+ export declare function runApp(ctx: Context, options?: RunAppOptions): Promise<RunAppResult>;
@@ -0,0 +1,8 @@
1
+ export interface ClipboardCommandResult {
2
+ ok: boolean;
3
+ stdout: Buffer;
4
+ }
5
+ export declare function runClipboardCommand(command: string, args: readonly string[], options: {
6
+ maxBufferBytes: number;
7
+ timeoutMs: number;
8
+ }): Promise<ClipboardCommandResult>;
@@ -0,0 +1 @@
1
+ export declare function sanitizeTerminalText(text: string): string;
@@ -0,0 +1,2 @@
1
+ /** Displays a path the way a shell prompt would, with the home directory written as `~`. */
2
+ export declare function shortenHomePath(path: string): string;
@@ -0,0 +1,2 @@
1
+ import type { SubagentSummary } from "../protocol/index.js";
2
+ export declare function sortSubagentsForDisplay(subagents: readonly SubagentSummary[]): readonly SubagentSummary[];
@@ -0,0 +1,2 @@
1
+ import type { SubagentSummary } from "../protocol/index.js";
2
+ export declare function subagentElapsedMs(subagent: SubagentSummary, now: number): number;
@@ -0,0 +1,2 @@
1
+ import type { Message } from "../protocol/index.js";
2
+ export declare function subagentLogMessageText(message: Message): string;
@@ -0,0 +1,3 @@
1
+ import type { TerminalTheme } from "./TerminalTheme.js";
2
+ /** Paints one panel line onto the theme's surface so the whole panel reads as a single card. */
3
+ export declare function surfaceThemedLine(content: string, width: number, theme: TerminalTheme): string;
@@ -0,0 +1 @@
1
+ export declare function truncatePathToWidth(path: string, width: number): string;
@@ -0,0 +1,5 @@
1
+ export interface TruncatedText {
2
+ readonly text: string;
3
+ readonly truncated: boolean;
4
+ }
5
+ export declare function truncateTextForDisplay(value: string, maximumCharacters: number): TruncatedText;