@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 @@
1
+ export declare function truncateUtf8BytesForDisplay(value: string, maximumBytes: number): string;
@@ -0,0 +1,2 @@
1
+ import type { SubagentSummary } from "../protocol/index.js";
2
+ export declare function upsertSubagentSummary(subagents: readonly SubagentSummary[], next: SubagentSummary): readonly SubagentSummary[];
@@ -0,0 +1,2 @@
1
+ export declare function humanizeWorkflowName(name: string): string;
2
+ export declare function serializeWorkflowValue(value: unknown): string;
@@ -0,0 +1,25 @@
1
+ import type { EventCursor, HappyAgentClient, HappyAgentEvent } from "@slopus/happy-agent-client";
2
+ /**
3
+ * Happy Terminal's one global daemon event subscription.
4
+ *
5
+ * The hub keeps a small replay window so a mutation can answer with a cursor
6
+ * before its caller begins waiting. Conversation settlement, title updates,
7
+ * questions, and other live UI all fan out from this one ordered source.
8
+ */
9
+ export declare class HappyAgentEventHub {
10
+ #private;
11
+ constructor(client: HappyAgentClient, after: EventCursor);
12
+ start(): void;
13
+ close(): Promise<void>;
14
+ /**
15
+ * Replays everything after `after`, then follows live until `onEvent`
16
+ * returns true or the signal is aborted.
17
+ */
18
+ follow(options: {
19
+ after: EventCursor;
20
+ /** Refreshes authoritative state when the daemon can no longer replay `after`. */
21
+ onGap: (cursor: EventCursor) => void | Promise<void>;
22
+ onEvent: (event: HappyAgentEvent) => boolean | Promise<boolean>;
23
+ signal?: AbortSignal;
24
+ }): Promise<void>;
25
+ }
@@ -0,0 +1,74 @@
1
+ import type { Context } from "@steve.kite/stdlib";
2
+ import type { Agent as ApiAgent, AgentBootstrapResponse, DaemonConfig, HappyAgentClient, HappyAgentEvent, MessageHistoryResponse } from "@slopus/happy-agent-client";
3
+ import type { AgentCompactionResult, AgentLoopEvent, AgentSnapshot, ContentBlock, Message, Model, PermissionMode, ServiceTier } from "../protocol/index.js";
4
+ import type { AgentRunOptions, AgentRunResult, CodingAssistantAgentBackend, CodingAssistantClientProvider, CodingAssistantModelChoice, SteeringRunOptions } from "../app/CodingAssistantAgentBackend.js";
5
+ import type { AbortRunOptions, AbortRunResponse, GetSessionUsageResponse, ReadBackgroundProcessResponse, RunShellCommandResponse, SessionProviderQuota, SteerMessageResponse, StopBackgroundProcessResponse } from "../protocol/index.js";
6
+ import type { HappyAgentEventHub } from "./HappyAgentEventHub.js";
7
+ export interface RemoteAgentOptions {
8
+ agent: ApiAgent;
9
+ bootstrap: AgentBootstrapResponse;
10
+ client: HappyAgentClient;
11
+ config: DaemonConfig;
12
+ events: HappyAgentEventHub;
13
+ history: MessageHistoryResponse;
14
+ }
15
+ /**
16
+ * The TUI's agent backend over the public Happy Agent API.
17
+ *
18
+ * This class projects public message blocks into Happy Terminal's renderer vocabulary, but
19
+ * it never reconstructs or calls the removed session protocol. Runs, messages,
20
+ * steering, compaction, drafts, questions, and processes all go through the
21
+ * durable `HappyAgentClient` instance supplied by the daemon connection.
22
+ */
23
+ export declare class RemoteAgent implements CodingAssistantAgentBackend {
24
+ #private;
25
+ readonly id: string;
26
+ constructor(options: RemoteAgentOptions);
27
+ get canChangeModel(): boolean;
28
+ get confirmedServiceTier(): ServiceTier | undefined;
29
+ get provider(): CodingAssistantClientProvider;
30
+ get model(): Model;
31
+ get modelChoices(): readonly CodingAssistantModelChoice[];
32
+ get permissionMode(): PermissionMode;
33
+ get draft(): string;
34
+ get draftUpdatedAt(): number | undefined;
35
+ setDraft(draft: string, options?: {
36
+ origin?: string;
37
+ updatedAt?: number;
38
+ }): Promise<void>;
39
+ abort(options?: AbortRunOptions): Promise<AbortRunResponse>;
40
+ stopBackgroundProcesses(): Promise<number>;
41
+ readBackgroundProcess(_sessionId: number, _options?: {
42
+ waitMs?: number;
43
+ }): Promise<ReadBackgroundProcessResponse | undefined>;
44
+ stopBackgroundProcess(_sessionId: number): Promise<StopBackgroundProcessResponse>;
45
+ /**
46
+ * The current provider's account quota, probed at most once per provider. Happy Terminal signs in
47
+ * through the system coding assistants, so the terminal asks the vendor with this machine's
48
+ * own credentials rather than adding a daemon surface for it.
49
+ */
50
+ providerQuotas(): Promise<readonly SessionProviderQuota[]>;
51
+ getUsage(): Promise<GetSessionUsageResponse>;
52
+ compact(_ctx: Context, _signal?: AbortSignal, _onEvent?: AgentRunOptions["onEvent"]): Promise<AgentCompactionResult>;
53
+ reset(): Promise<void>;
54
+ runShellCommand(_command: string, _options: {
55
+ commandId: string;
56
+ }): Promise<RunShellCommandResponse>;
57
+ steer(content: string | readonly ContentBlock[], options?: SteeringRunOptions): Promise<void | SteerMessageResponse>;
58
+ send(_ctx: Context, content: string | readonly ContentBlock[], options?: AgentRunOptions): Promise<AgentRunResult>;
59
+ setEffort(effort: string | undefined): void;
60
+ setModel(modelId: string, effort: string | undefined, providerId?: string): void;
61
+ setServiceTier(serviceTier: ServiceTier | undefined): void;
62
+ setPermissionMode(permissionMode: PermissionMode): Promise<void>;
63
+ snapshot(): AgentSnapshot;
64
+ /** Reloads the authoritative agent and transcript after an event-stream gap. */
65
+ resync(): Promise<AgentSnapshot>;
66
+ /** Applies one global API event and returns a renderable message when it carried one. */
67
+ applyEvent(event: HappyAgentEvent): Message | undefined;
68
+ /**
69
+ * Projects streaming and reset API events into Happy Terminal's live inference vocabulary. A send that
70
+ * carries its own onEvent callback receives loop events there instead, so this global path
71
+ * stays silent for it rather than delivering every event twice.
72
+ */
73
+ applyLoopEvent(event: HappyAgentEvent): AgentLoopEvent | undefined;
74
+ }
@@ -0,0 +1,4 @@
1
+ export declare class RemoteAgentRunError extends Error {
2
+ readonly debugDirectory: string | undefined;
3
+ constructor(message: string, debugDirectory?: string);
4
+ }
@@ -0,0 +1,19 @@
1
+ import type { GhosttyTerminal } from "@slopus/ghostty-wasm/node";
2
+ import { type RemoteTerminalProtocolClient, type RemoteTerminalReconnectState, type RemoteTerminalScrollbackPage } from "@slopus/ghostty-web";
3
+ import type { RemoteTerminalClientReplica } from "./RemoteTerminalClientReplica.js";
4
+ export declare class RemoteTerminalAttachment {
5
+ #private;
6
+ readonly clientId: string;
7
+ readonly exited: Promise<number | null>;
8
+ readonly protocol: RemoteTerminalProtocolClient;
9
+ readonly replica: RemoteTerminalClientReplica;
10
+ readonly terminal: GhosttyTerminal;
11
+ constructor(clientId: string, replica: RemoteTerminalClientReplica, createProtocol: (onExit: (exitCode: number | null) => void) => RemoteTerminalProtocolClient);
12
+ close(): void;
13
+ reconnectState(): RemoteTerminalReconnectState;
14
+ requestScrollback(start: number, count: number, basis?: {
15
+ historyEpoch: string;
16
+ historyRevision: number;
17
+ }): Promise<RemoteTerminalScrollbackPage>;
18
+ writeInput(data: Uint8Array | string): number;
19
+ }
@@ -0,0 +1,14 @@
1
+ import { type GhosttyTerminal } from "@slopus/ghostty-wasm/node";
2
+ import { type RemoteTerminalGridState, type RemoteTerminalReplica } from "@slopus/ghostty-web";
3
+ import type { RemoteTerminalColorScheme } from "../terminal/index.js";
4
+ export declare class RemoteTerminalClientReplica implements RemoteTerminalReplica {
5
+ #private;
6
+ grid: RemoteTerminalGridState | undefined;
7
+ readonly terminal: GhosttyTerminal;
8
+ private constructor();
9
+ static create(colorScheme: RemoteTerminalColorScheme): Promise<RemoteTerminalClientReplica>;
10
+ applyGrid(state: RemoteTerminalGridState): void;
11
+ applyVt(data: Uint8Array): void | Promise<void>;
12
+ close(): void;
13
+ resize(cols: number, rows: number): void | Promise<void>;
14
+ }
@@ -0,0 +1,10 @@
1
+ /** Retained as a type-only compatibility surface for older terminal integrations. */
2
+ export interface DaemonRestartRequest {
3
+ currentIdentity: {
4
+ version: string;
5
+ };
6
+ runningIdentity: {
7
+ version: string;
8
+ };
9
+ }
10
+ export { ensureLocalProtocolServer, readTokenIfPresent, runDaemonInProcess, type EnsureLocalProtocolServerOptions, type LocalProtocolServerConnection, } from "../daemon/index.js";
@@ -0,0 +1,10 @@
1
+ import type { SessionProviderQuota } from "../protocol/index.js";
2
+ /**
3
+ * Probes the current provider's account quota with this machine's own credentials.
4
+ *
5
+ * Happy Terminal signs in through the system coding assistants, so the quota that matters is the one their
6
+ * credentials see; the terminal asks the vendor directly rather than adding a daemon surface for
7
+ * it. Quota is a courtesy: a provider without a quota window, a missing credential, or a failed
8
+ * probe all resolve to no quota rather than an error.
9
+ */
10
+ export declare function fetchProviderQuotas(providerId: string, providerType: string | undefined, env?: NodeJS.ProcessEnv): Promise<readonly SessionProviderQuota[]>;
@@ -0,0 +1,8 @@
1
+ export { ensureLocalProtocolServer, readTokenIfPresent, runDaemonInProcess, type DaemonRestartRequest, type EnsureLocalProtocolServerOptions, type LocalProtocolServerConnection, } from "./ensureLocalProtocolServer.js";
2
+ export { createUnixSocketFetch } from "../daemon/index.js";
3
+ export { HappyAgentEventHub } from "./HappyAgentEventHub.js";
4
+ export { ensureWorkspaceForCwd, loadAgentCatalog, waitForWorkspaceReady, workspaceForCwd, type AgentCatalog, type AgentCatalogEntry, } from "./loadAgentCatalog.js";
5
+ export { RemoteTerminalAttachment } from "./RemoteTerminalAttachment.js";
6
+ export { RemoteTerminalClientReplica } from "./RemoteTerminalClientReplica.js";
7
+ export { RemoteAgent, type RemoteAgentOptions } from "./RemoteAgent.js";
8
+ export { RemoteAgentRunError } from "./RemoteAgentRunError.js";
@@ -0,0 +1,32 @@
1
+ import { type Agent, type HappyAgentClient, type Project, type Workspace } from "@slopus/happy-agent-client";
2
+ /** One top-level agent together with the file workspace that owns it. */
3
+ export interface AgentCatalogEntry {
4
+ agent: Agent;
5
+ cwd: string;
6
+ projectId: string;
7
+ workspaceId: string;
8
+ }
9
+ export interface AgentCatalog {
10
+ entries: AgentCatalogEntry[];
11
+ projects: Project[];
12
+ workspaces: Workspace[];
13
+ }
14
+ /**
15
+ * Reads the public project/workspace catalogs and flattens their ordered
16
+ * top-level agent series for terminal pickers.
17
+ *
18
+ * There is deliberately no global agent-list call: root agents come from
19
+ * projects and child-workspace agents come from workspaces.
20
+ */
21
+ export declare function loadAgentCatalog(client: HappyAgentClient): Promise<AgentCatalog>;
22
+ /** Finds the deepest registered file workspace whose host path is this cwd. */
23
+ export declare function workspaceForCwd(catalog: AgentCatalog, cwd: string): Workspace | Project | undefined;
24
+ /** Registers the cwd as a project only when no public workspace already owns it. */
25
+ export declare function ensureWorkspaceForCwd(client: HappyAgentClient, cwd: string): Promise<Workspace>;
26
+ /**
27
+ * Resolves the public workspace only after its asynchronous provisioning reaches a usable state.
28
+ *
29
+ * `GET /v0/workspaces/:id` deliberately answers `not_initialized` during provisioning. Every
30
+ * other response is terminal and remains authoritative.
31
+ */
32
+ export declare function waitForWorkspaceReady(client: Pick<HappyAgentClient, "getWorkspace">, workspaceId: string): Promise<Workspace>;
@@ -0,0 +1,10 @@
1
+ import type { PartialHappyTerminalConfig } from "./types.js";
2
+ /**
3
+ * The startup notice shown when a project's config file asked for a machine-level setting the
4
+ * merge refused. Only the permission mode is machine-level in this file's schema; everything
5
+ * else it may set is an ordinary preference.
6
+ */
7
+ export declare function createProjectConfigSecurityNotice(config: PartialHappyTerminalConfig, configFileName?: string): {
8
+ text: string;
9
+ title: string;
10
+ } | undefined;
@@ -0,0 +1,2 @@
1
+ import type { HappyTerminalConfig } from "./types.js";
2
+ export declare const DEFAULT_HAPPY_TERMINAL_CONFIG: HappyTerminalConfig;
@@ -0,0 +1 @@
1
+ export declare function getDefaultGlobalConfigPath(env?: NodeJS.ProcessEnv, homeDirectory?: string): string;
@@ -0,0 +1 @@
1
+ export declare function getDefaultLocalConfigPath(cwd?: string): string;
@@ -0,0 +1 @@
1
+ export declare function getDefaultRuntimeConfigPath(env?: NodeJS.ProcessEnv, homeDirectory?: string): string;
@@ -0,0 +1 @@
1
+ export declare function getHappyConfigDirectory(environment?: NodeJS.ProcessEnv, homeDirectory?: string, platform?: NodeJS.Platform): string;
@@ -0,0 +1 @@
1
+ export declare function getHappyTerminalHome(environment?: NodeJS.ProcessEnv, homeDirectory?: string): string;
@@ -0,0 +1,15 @@
1
+ export { DEFAULT_HAPPY_TERMINAL_CONFIG } from "./defaultConfig.js";
2
+ export { getDefaultGlobalConfigPath } from "./getDefaultGlobalConfigPath.js";
3
+ export { getDefaultLocalConfigPath } from "./getDefaultLocalConfigPath.js";
4
+ export { getDefaultRuntimeConfigPath } from "./getDefaultRuntimeConfigPath.js";
5
+ export { getHappyConfigDirectory } from "./getHappyConfigDirectory.js";
6
+ export { getHappyTerminalHome } from "./getHappyTerminalHome.js";
7
+ export { createProjectConfigSecurityNotice } from "./createProjectConfigSecurityNotice.js";
8
+ export { loadConfig } from "./loadConfig.js";
9
+ export { mergeConfigValues } from "./mergeConfigValues.js";
10
+ export { parseConfigToml, parseConfigTomlWithUnknownSettings, type ParsedConfigToml, } from "./parseConfigToml.js";
11
+ export { resolveConfigPaths } from "./resolveConfigPaths.js";
12
+ export { updateRuntimePreferences } from "./updateRuntimePreferences.js";
13
+ export { writeRuntimeConfig } from "./writeRuntimeConfig.js";
14
+ export { writeRuntimeConfigDefaults } from "./writeRuntimeConfigDefaults.js";
15
+ export type { ConfigDefaults, ConfigPaths, ConfigSettings, ConfigSource, ConfigTheme, LoadedConfig, LoadConfigOptions, PartialConfigDefaults, PartialConfigSettings, PartialConfigTheme, PartialHappyTerminalConfig, HappyTerminalConfig, } from "./types.js";
@@ -0,0 +1,2 @@
1
+ import type { LoadedConfig, LoadConfigOptions } from "./types.js";
2
+ export declare function loadConfig(options?: LoadConfigOptions): Promise<LoadedConfig>;
@@ -0,0 +1,2 @@
1
+ import type { PartialHappyTerminalConfig, HappyTerminalConfig } from "./types.js";
2
+ export declare function mergeConfigValues(base: HappyTerminalConfig, ...configs: readonly PartialHappyTerminalConfig[]): HappyTerminalConfig;
@@ -0,0 +1,7 @@
1
+ import type { PartialHappyTerminalConfig } from "./types.js";
2
+ export interface ParsedConfigToml {
3
+ unknownSettings: readonly string[];
4
+ values: PartialHappyTerminalConfig;
5
+ }
6
+ export declare function parseConfigToml(source: string): PartialHappyTerminalConfig;
7
+ export declare function parseConfigTomlWithUnknownSettings(source: string): ParsedConfigToml;
@@ -0,0 +1,2 @@
1
+ import type { ConfigSource } from "./types.js";
2
+ export declare function readConfigFile(path: string): Promise<ConfigSource>;
@@ -0,0 +1,2 @@
1
+ import type { ConfigSource } from "./types.js";
2
+ export declare function readProjectConfigFile(happyTomlPath: string): Promise<ConfigSource>;
@@ -0,0 +1,2 @@
1
+ import type { ConfigPaths, LoadConfigOptions } from "./types.js";
2
+ export declare function resolveConfigPaths(options?: LoadConfigOptions): ConfigPaths;
@@ -0,0 +1 @@
1
+ export declare function runWithRuntimeConfigLock<T>(operation: () => Promise<T>): Promise<T>;
@@ -0,0 +1,74 @@
1
+ import type { PermissionMode, ServiceTier } from "../protocol/index.js";
2
+ export interface ConfigDefaults {
3
+ effort?: string;
4
+ instructions?: string;
5
+ modelId: string;
6
+ permissionMode: PermissionMode;
7
+ providerId?: string;
8
+ serviceTier?: ServiceTier;
9
+ }
10
+ export interface PartialConfigDefaults {
11
+ effort?: string;
12
+ instructions?: string;
13
+ modelId?: string;
14
+ permissionMode?: PermissionMode;
15
+ providerId?: string;
16
+ serviceTier?: ServiceTier | null;
17
+ }
18
+ export interface ConfigSettings {
19
+ compactCompletedTurns: boolean;
20
+ completionChime: boolean;
21
+ showReasoning: boolean;
22
+ showUsage: boolean;
23
+ }
24
+ export interface PartialConfigSettings {
25
+ compactCompletedTurns?: boolean;
26
+ completionChime?: boolean;
27
+ showReasoning?: boolean;
28
+ showUsage?: boolean;
29
+ }
30
+ export interface ConfigTheme {
31
+ accent: string;
32
+ brand: string;
33
+ error: string;
34
+ primary: string;
35
+ secondary: string;
36
+ success: string;
37
+ warning: string;
38
+ }
39
+ export type PartialConfigTheme = Partial<ConfigTheme>;
40
+ export interface HappyTerminalConfig {
41
+ defaults: ConfigDefaults;
42
+ settings: ConfigSettings;
43
+ theme: ConfigTheme;
44
+ }
45
+ export interface PartialHappyTerminalConfig {
46
+ defaults?: PartialConfigDefaults;
47
+ settings?: PartialConfigSettings;
48
+ theme?: PartialConfigTheme;
49
+ }
50
+ export interface ConfigPaths {
51
+ global: string;
52
+ local: string;
53
+ runtime: string;
54
+ }
55
+ export interface ConfigSource {
56
+ exists: boolean;
57
+ path: string;
58
+ values: PartialHappyTerminalConfig;
59
+ unknownSettings: readonly string[];
60
+ }
61
+ export interface LoadedConfig {
62
+ config: HappyTerminalConfig;
63
+ paths: ConfigPaths;
64
+ sources: {
65
+ global: ConfigSource;
66
+ local: ConfigSource;
67
+ runtime: ConfigSource;
68
+ };
69
+ }
70
+ export interface LoadConfigOptions {
71
+ cwd?: string;
72
+ env?: NodeJS.ProcessEnv;
73
+ homeDirectory?: string;
74
+ }
@@ -0,0 +1,2 @@
1
+ import type { PartialHappyTerminalConfig } from "./types.js";
2
+ export declare function updateRuntimeConfig(path: string, update: () => Promise<PartialHappyTerminalConfig>): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { PartialHappyTerminalConfig } from "./types.js";
2
+ export declare function updateRuntimePreferences(path: string, preferences: PartialHappyTerminalConfig): Promise<void>;
@@ -0,0 +1,7 @@
1
+ import type { PartialHappyTerminalConfig } from "./types.js";
2
+ /**
3
+ * A checked-in project file may carry preferences, never this machine's permission boundary.
4
+ * The permission mode is dropped here so a hostile repository cannot elevate the session, and
5
+ * the startup notice tells the person what was ignored.
6
+ */
7
+ export declare function withoutProjectMachineSettings(config: PartialHappyTerminalConfig): PartialHappyTerminalConfig;
@@ -0,0 +1,3 @@
1
+ import type { PartialHappyTerminalConfig } from "./types.js";
2
+ export declare function writeRuntimeConfig(path: string, config: PartialHappyTerminalConfig): Promise<void>;
3
+ export declare function writeRuntimeConfigInsideLock(path: string, config: PartialHappyTerminalConfig): Promise<void>;
@@ -0,0 +1,2 @@
1
+ import type { PartialConfigDefaults } from "./types.js";
2
+ export declare function writeRuntimeConfigDefaults(path: string, defaults: PartialConfigDefaults): Promise<void>;
@@ -0,0 +1,2 @@
1
+ /** Adapts the daemon's Unix socket to the Fetch API consumed by HappyAgentClient. */
2
+ export declare function createUnixSocketFetch(socketPath: string): typeof globalThis.fetch;
@@ -0,0 +1,11 @@
1
+ import type { Context } from "@steve.kite/stdlib";
2
+ export interface KillDaemonFromPidFileResult {
3
+ readonly found: boolean;
4
+ readonly killed: boolean;
5
+ readonly pid?: number;
6
+ }
7
+ export declare function readDaemonPid(pidPath: string): Promise<number | undefined>;
8
+ export declare function removeDaemonPid(pidPath: string, expectedPid: number): Promise<boolean>;
9
+ export declare function killDaemonFromPidFile(ctx: Context, pidPath: string): Promise<KillDaemonFromPidFileResult>;
10
+ /** Immediately kill one exact daemon PID and wait for the operating system to release it. */
11
+ export declare function killDaemonProcess(ctx: Context, pid: number, timeoutMs?: number): Promise<boolean>;
@@ -0,0 +1,15 @@
1
+ import { type HappyDaemonPaths } from "./getHappyDaemonPaths.js";
2
+ export interface HappyAgentBinary {
3
+ readonly path: string;
4
+ readonly version: string;
5
+ }
6
+ export interface EnsureHappyAgentBinaryOptions {
7
+ arch?: NodeJS.Architecture;
8
+ extractArchive?: (archivePath: string, destination: string, archivedBinaryName: string) => Promise<void>;
9
+ fetch?: typeof globalThis.fetch;
10
+ onStatus?: (message: string) => void;
11
+ paths?: HappyDaemonPaths;
12
+ platform?: NodeJS.Platform;
13
+ }
14
+ /** Returns the selected installed release, downloading one only for an empty installation. */
15
+ export declare function ensureHappyAgentBinary(options?: EnsureHappyAgentBinaryOptions): Promise<HappyAgentBinary>;
@@ -0,0 +1,24 @@
1
+ import { HappyAgentClient, type HealthResponse } from "@slopus/happy-agent-client";
2
+ import { type HappyDaemonPaths } from "./getHappyDaemonPaths.js";
3
+ export interface LocalProtocolServerConnection {
4
+ readonly client: HappyAgentClient;
5
+ readonly health: HealthResponse;
6
+ readonly paths: HappyDaemonPaths;
7
+ readonly token: string;
8
+ }
9
+ export type ObservedLocalProtocolServer = LocalProtocolServerConnection;
10
+ export interface EnsureLocalProtocolServerOptions {
11
+ onStatus?: (message: string) => void;
12
+ }
13
+ interface LocalHappyAgentSources {
14
+ cliPath: string;
15
+ runModuleUrl: string;
16
+ }
17
+ /** Connects to the running daemon, or starts local source/release code when no socket responds. */
18
+ export declare function ensureLocalProtocolServer(options?: EnsureLocalProtocolServerOptions): Promise<LocalProtocolServerConnection>;
19
+ export declare function observeLocalProtocolServer(paths?: HappyDaemonPaths): Promise<ObservedLocalProtocolServer | undefined>;
20
+ export declare function readTokenIfPresent(tokenPath: string): Promise<string | undefined>;
21
+ /** The local Gym keeps the daemon in the TUI process to make full-system scenarios inexpensive. */
22
+ export declare function runDaemonInProcess(environment?: NodeJS.ProcessEnv): boolean;
23
+ export declare function resolveLocalHappyAgentSources(moduleUrl?: string, exists?: (path: URL) => boolean): LocalHappyAgentSources | undefined;
24
+ export {};
@@ -0,0 +1,16 @@
1
+ /** Filesystem locations shared by Happy Terminal and the Happy Agent daemon. */
2
+ export interface HappyDaemonPaths {
3
+ readonly agentDirectory: string;
4
+ readonly binaryConfigPath: string;
5
+ readonly distDirectory: string;
6
+ readonly happyHome: string;
7
+ readonly installLockPath: string;
8
+ readonly logPath: string;
9
+ readonly observationLogPath: string;
10
+ readonly pidPath: string;
11
+ readonly socketPath: string;
12
+ readonly tokenPath: string;
13
+ readonly versionsDirectory: string;
14
+ }
15
+ export declare function getHappyDaemonPaths(environment?: NodeJS.ProcessEnv, homeDirectory?: string): HappyDaemonPaths;
16
+ export declare function happyAgentBinaryPath(paths: HappyDaemonPaths, version: string): string;
@@ -0,0 +1,15 @@
1
+ import { type Static } from "@sinclair/typebox";
2
+ import { type HappyDaemonPaths } from "./getHappyDaemonPaths.js";
3
+ export declare const SEMANTIC_VERSION_PATTERN = "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$";
4
+ export declare const happyAgentBinaryConfigSchema: import("@sinclair/typebox").TObject<{
5
+ downloadedVersions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
6
+ selectedVersion: import("@sinclair/typebox").TString;
7
+ }>;
8
+ export type HappyAgentBinaryConfig = Static<typeof happyAgentBinaryConfigSchema>;
9
+ export declare function readHappyAgentBinaryConfig(paths: HappyDaemonPaths): Promise<HappyAgentBinaryConfig | undefined>;
10
+ export declare function selectedHappyAgentBinary(paths: HappyDaemonPaths): Promise<{
11
+ path: string;
12
+ version: string;
13
+ } | undefined>;
14
+ export declare function writeHappyAgentBinaryConfig(paths: HappyDaemonPaths, selectedVersion: string): Promise<HappyAgentBinaryConfig>;
15
+ export declare function isExecutableFile(path: string): Promise<boolean>;
@@ -0,0 +1,5 @@
1
+ export { createUnixSocketFetch } from "./createUnixSocketFetch.js";
2
+ export { ensureHappyAgentBinary, type EnsureHappyAgentBinaryOptions, type HappyAgentBinary, } from "./ensureHappyAgentBinary.js";
3
+ export { ensureLocalProtocolServer, observeLocalProtocolServer, readTokenIfPresent, resolveLocalHappyAgentSources, runDaemonInProcess, type EnsureLocalProtocolServerOptions, type LocalProtocolServerConnection, type ObservedLocalProtocolServer, } from "./ensureLocalProtocolServer.js";
4
+ export { getHappyDaemonPaths, happyAgentBinaryPath, type HappyDaemonPaths, } from "./getHappyDaemonPaths.js";
5
+ export { runDaemonCommand, type DaemonCommand } from "./runDaemonCommand.js";
@@ -0,0 +1,4 @@
1
+ import { type Context } from "@steve.kite/stdlib";
2
+ export type DaemonCommand = "kill" | "reload" | "start" | "status" | "stop";
3
+ /** Runs one `happy daemon` lifecycle command through the same downloaded/dev daemon path as Happy Terminal. */
4
+ export declare function runDaemonCommand(command: DaemonCommand, log?: (line: string) => void, ctx?: Context): Promise<void>;
@@ -0,0 +1,11 @@
1
+ export interface DebugLogOptions {
2
+ directory: string;
3
+ now?: () => number;
4
+ }
5
+ export declare class DebugLog {
6
+ #private;
7
+ readonly directory: string;
8
+ constructor(options: DebugLogOptions);
9
+ flush(): Promise<void>;
10
+ record(type: string, data: unknown): Promise<void>;
11
+ }
@@ -0,0 +1 @@
1
+ export declare function closeNodeInspector(): boolean;
@@ -0,0 +1 @@
1
+ export declare function createDebugJsonReplacer(): (key: string, value: unknown) => unknown;
@@ -0,0 +1 @@
1
+ export declare function createRequestDebugDirectory(cwd: string, runId: string, createdAt: number): string;
@@ -0,0 +1 @@
1
+ export declare function getDebugRootDirectory(cwd: string): string;
@@ -0,0 +1 @@
1
+ export declare function getNodeInspectorUrl(): string | undefined;
@@ -0,0 +1,8 @@
1
+ export { DebugLog } from "./DebugLog.js";
2
+ export type { DebugLogOptions } from "./DebugLog.js";
3
+ export { createRequestDebugDirectory } from "./createRequestDebugDirectory.js";
4
+ export { closeNodeInspector } from "./closeNodeInspector.js";
5
+ export { getNodeInspectorUrl } from "./getNodeInspectorUrl.js";
6
+ export { getDebugRootDirectory } from "./getDebugRootDirectory.js";
7
+ export { openNodeInspector } from "./openNodeInspector.js";
8
+ export { registerHappyTerminalDebugRoot, type HappyTerminalDebugRoot, } from "./registerHappyTerminalDebugRoot.js";
@@ -0,0 +1 @@
1
+ export declare function openNodeInspector(): string;
@@ -0,0 +1,5 @@
1
+ export interface HappyTerminalDebugRoot {
2
+ kind: "daemon" | "tui";
3
+ [name: string]: unknown;
4
+ }
5
+ export declare function registerHappyTerminalDebugRoot(root: HappyTerminalDebugRoot): void;