@robota-sdk/agent-ui-terminal 3.0.0-beta.81
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.
- package/LICENSE +661 -0
- package/README.md +27 -0
- package/dist/node/index.cjs +32 -0
- package/dist/node/index.d.cts +1066 -0
- package/dist/node/index.d.cts.map +1 -0
- package/dist/node/index.d.ts +1066 -0
- package/dist/node/index.d.ts.map +1 -0
- package/dist/node/index.js +33 -0
- package/dist/node/index.js.map +1 -0
- package/package.json +93 -0
- package/src/App.tsx +146 -0
- package/src/AppPresentation.tsx +190 -0
- package/src/AppView.tsx +26 -0
- package/src/BackgroundTaskPanel.tsx +73 -0
- package/src/CjkTextInput.tsx +336 -0
- package/src/ConfirmPrompt.tsx +140 -0
- package/src/ContextWarningBanner.tsx +45 -0
- package/src/ExecutionWorkspaceDetailPane.tsx +85 -0
- package/src/ExecutionWorkspaceSwitcher.tsx +213 -0
- package/src/HistorySearchOverlay.tsx +150 -0
- package/src/InputArea.tsx +338 -0
- package/src/ListPicker.tsx +158 -0
- package/src/MenuSelect.tsx +159 -0
- package/src/MessageList.tsx +308 -0
- package/src/MultiSelectList.tsx +294 -0
- package/src/PendingActionPrompt.tsx +121 -0
- package/src/PermissionPrompt.tsx +186 -0
- package/src/PluginTUI.tsx +258 -0
- package/src/RoleLabel.tsx +72 -0
- package/src/SafeText.tsx +66 -0
- package/src/SessionEventNotices.tsx +27 -0
- package/src/SessionPicker.tsx +72 -0
- package/src/SessionStatusBar.tsx +76 -0
- package/src/SlashAutocomplete.tsx +154 -0
- package/src/StatusBar.tsx +284 -0
- package/src/StreamingIndicator.tsx +145 -0
- package/src/SupervisedSessionView.tsx +455 -0
- package/src/TextPrompt.tsx +112 -0
- package/src/ThemePicker.tsx +366 -0
- package/src/ToolCommandOutput.tsx +48 -0
- package/src/ToolDiffBlock.tsx +44 -0
- package/src/TransportTUI.tsx +166 -0
- package/src/TuiInteractionChannel.ts +567 -0
- package/src/UpdateNotice.tsx +18 -0
- package/src/UsageSummaryEntry.tsx +49 -0
- package/src/WaveText.tsx +70 -0
- package/src/__tests__/ListPicker.test.tsx +188 -0
- package/src/__tests__/MenuSelect.test.tsx +127 -0
- package/src/__tests__/PendingActionPrompt.test.tsx +193 -0
- package/src/__tests__/PluginTUI.test.tsx +167 -0
- package/src/__tests__/SlashAutocomplete.test.tsx +162 -0
- package/src/__tests__/SupervisedSessionView-render.test.tsx +24 -0
- package/src/__tests__/SupervisedSessionView.test.tsx +629 -0
- package/src/__tests__/TextPrompt.test.tsx +112 -0
- package/src/__tests__/TransportTUI.test.tsx +124 -0
- package/src/__tests__/TuiInteractionChannel.askUser.test.ts +124 -0
- package/src/__tests__/TuiInteractionChannel.display-contract.test.ts +284 -0
- package/src/__tests__/TuiInteractionChannel.lifecycle.test.ts +642 -0
- package/src/__tests__/UpdateNotice.test.tsx +15 -0
- package/src/__tests__/abort-after-permission.test.tsx +160 -0
- package/src/__tests__/abort-streaming-e2e.test.tsx +183 -0
- package/src/__tests__/attention-bell-and-marks.test.ts +144 -0
- package/src/__tests__/autocomplete-editing-keys.test.tsx +127 -0
- package/src/__tests__/background-task-panel-countdown.test.tsx +75 -0
- package/src/__tests__/background-task-panel.test.tsx +98 -0
- package/src/__tests__/background-task-row-format.test.ts +152 -0
- package/src/__tests__/channel-factory-integration.test.ts +150 -0
- package/src/__tests__/cjk-defer-submit.test.tsx +67 -0
- package/src/__tests__/cjk-fallback-render.test.tsx +78 -0
- package/src/__tests__/cjk-text-input-flow.test.ts +186 -0
- package/src/__tests__/cjk-text-input.test.ts +191 -0
- package/src/__tests__/command-handoff-pty-e2e.test.ts +107 -0
- package/src/__tests__/command-output-summary.test.ts +95 -0
- package/src/__tests__/command-result-handler.test.ts +171 -0
- package/src/__tests__/compact-event-bridge.test.ts +20 -0
- package/src/__tests__/confirm-permission-flow.test.ts +149 -0
- package/src/__tests__/confirm-prompt.test.tsx +103 -0
- package/src/__tests__/contextual-keybindings-input.test.tsx +158 -0
- package/src/__tests__/default-tui-cli-adapter-host-settings.test.ts +45 -0
- package/src/__tests__/effort-reaches-the-session.test.ts +41 -0
- package/src/__tests__/execution-workspace-switcher.test.tsx +147 -0
- package/src/__tests__/execution-workspace-view-model.test.ts +94 -0
- package/src/__tests__/external-prompt-notice.test.tsx +100 -0
- package/src/__tests__/fixtures/command-handoff-driver.tsx +111 -0
- package/src/__tests__/fixtures/fake-editor.sh +7 -0
- package/src/__tests__/fixtures/terminal-handoff-driver.tsx +90 -0
- package/src/__tests__/fork-attach.test.tsx +235 -0
- package/src/__tests__/helpers/terminal-profiles.ts +152 -0
- package/src/__tests__/helpers/vt-cursor-interpreter.ts +175 -0
- package/src/__tests__/history-clear-broadcast.test.ts +66 -0
- package/src/__tests__/history-search-overlay.test.tsx +329 -0
- package/src/__tests__/humanize-tool-name.test.ts +30 -0
- package/src/__tests__/input-area-bottom-border.test.tsx +45 -0
- package/src/__tests__/input-area-flow.test.ts +199 -0
- package/src/__tests__/input-area-focus-handoff.test.tsx +77 -0
- package/src/__tests__/interaction-channel-charter.test.ts +13 -0
- package/src/__tests__/key-hint-consistency.test.tsx +249 -0
- package/src/__tests__/key-hint-footer.test.tsx +69 -0
- package/src/__tests__/live-trace-reaches-session.test.ts +14 -0
- package/src/__tests__/message-list-rendering.test.tsx +473 -0
- package/src/__tests__/org-policy-reaches-the-channel.test.ts +77 -0
- package/src/__tests__/output-style-reaches-session.test.ts +35 -0
- package/src/__tests__/palette-consistency.test.ts +330 -0
- package/src/__tests__/permission-prompt-availability.test.tsx +23 -0
- package/src/__tests__/permission-prompt-peer.test.tsx +34 -0
- package/src/__tests__/product-display-name.test.tsx +79 -0
- package/src/__tests__/prompt-queue.test.tsx +260 -0
- package/src/__tests__/provider-definitions-reach-the-session.test.ts +75 -0
- package/src/__tests__/pty/ask-user-question.ptytest.ts +72 -0
- package/src/__tests__/pty/background-work-switcher.ptytest.ts +53 -0
- package/src/__tests__/pty/behavior-2437-git.ptytest.ts +342 -0
- package/src/__tests__/pty/fixtures/ask-user-question.jsonl +3 -0
- package/src/__tests__/pty/fixtures/replay-conversation.jsonl +4 -0
- package/src/__tests__/pty/fixtures/screen-005-ask-shapes.jsonl +5 -0
- package/src/__tests__/pty/fixtures/screen-005-permission.jsonl +3 -0
- package/src/__tests__/pty/fixtures/screen-006-colors.jsonl +3 -0
- package/src/__tests__/pty/fixtures/screen-2002-themes.jsonl +5 -0
- package/src/__tests__/pty/flag-tui.ptytest.ts +56 -0
- package/src/__tests__/pty/flow-2006-deep-link.ptytest.ts +291 -0
- package/src/__tests__/pty/ime-cursor-tmux.ptytest.ts +165 -0
- package/src/__tests__/pty/ime-cursor.ptytest.ts +186 -0
- package/src/__tests__/pty/isolated-home.ts +64 -0
- package/src/__tests__/pty/org-policy.ptytest.ts +71 -0
- package/src/__tests__/pty/provider-setup.ptytest.ts +61 -0
- package/src/__tests__/pty/pty-driver.ts +153 -0
- package/src/__tests__/pty/replay-conversation.ptytest.ts +68 -0
- package/src/__tests__/pty/screen-005-prompt-footers.ptytest.ts +134 -0
- package/src/__tests__/pty/screen-006-no-color.ptytest.ts +138 -0
- package/src/__tests__/pty/screen-010-scrollback.ptytest.ts +123 -0
- package/src/__tests__/pty/screen-1993-scrollback.ptytest.ts +124 -0
- package/src/__tests__/pty/screen-2002-themes.ptytest.ts +292 -0
- package/src/__tests__/pty/screen-2670-prepark.ptytest.ts +228 -0
- package/src/__tests__/pty/screen-reader-mode.ptytest.ts +228 -0
- package/src/__tests__/pty/settings-screen.ptytest.ts +49 -0
- package/src/__tests__/pty/spawn-pty.test.ts +120 -0
- package/src/__tests__/pty/spawn-pty.ts +229 -0
- package/src/__tests__/pty/terminal-handoff.ptytest.ts +79 -0
- package/src/__tests__/pty/tui-pty.ptytest.ts +65 -0
- package/src/__tests__/pty-driver-dispose.test.ts +43 -0
- package/src/__tests__/real-cursor-positioning.test.tsx +263 -0
- package/src/__tests__/rename-broadcast-persistence.test.tsx +140 -0
- package/src/__tests__/render-channel-options.test.ts +201 -0
- package/src/__tests__/render-lifecycle.test.ts +36 -0
- package/src/__tests__/render-markdown.test.ts +164 -0
- package/src/__tests__/rendered-markdown-styling.test.tsx +98 -0
- package/src/__tests__/safe-text-boundary.test.tsx +75 -0
- package/src/__tests__/screen-reader-input.test.tsx +106 -0
- package/src/__tests__/screen-reader-labels.test.ts +91 -0
- package/src/__tests__/screen-reader-menus.test.tsx +200 -0
- package/src/__tests__/screen-reader-pacing.test.ts +230 -0
- package/src/__tests__/screen-reader-prepark-echo.test.tsx +200 -0
- package/src/__tests__/screen-reader-render-options.test.ts +262 -0
- package/src/__tests__/screen-reader-stdout.test.ts +322 -0
- package/src/__tests__/screen-reader-turn-marks-port.test.tsx +85 -0
- package/src/__tests__/screen-reader-turn-signals.test.tsx +125 -0
- package/src/__tests__/sec-019-terminal-sanitizer.test.ts +276 -0
- package/src/__tests__/sec-019-tool-label-render.test.tsx +207 -0
- package/src/__tests__/selection-flow.test.ts +61 -0
- package/src/__tests__/session-event-notices.test.tsx +31 -0
- package/src/__tests__/session-init-poller.test.ts +102 -0
- package/src/__tests__/session-switch-channel.test.tsx +470 -0
- package/src/__tests__/shutdown-signal.test.ts +34 -0
- package/src/__tests__/status-activity.test.ts +71 -0
- package/src/__tests__/status-bar.test.tsx +282 -0
- package/src/__tests__/status-glyph.test.ts +30 -0
- package/src/__tests__/streaming-indicator.test.tsx +177 -0
- package/src/__tests__/terminal-capabilities.test.ts +153 -0
- package/src/__tests__/terminal-handoff-controller.test.ts +173 -0
- package/src/__tests__/terminal-handoff-pty-e2e.test.ts +77 -0
- package/src/__tests__/text-prompt-flow.test.ts +77 -0
- package/src/__tests__/theme-picker.test.tsx +345 -0
- package/src/__tests__/transport-boundary.test.ts +11 -0
- package/src/__tests__/tui-app-channel-port.test.ts +31 -0
- package/src/__tests__/tui-channel-init-failure.test.ts +62 -0
- package/src/__tests__/tui-channel-lifecycle-coordinator.test.ts +258 -0
- package/src/__tests__/tui-interaction-queues.test.ts +139 -0
- package/src/__tests__/tui-preset-capabilities.test.ts +33 -0
- package/src/__tests__/tui-state-manager.error-stall.test.ts +169 -0
- package/src/__tests__/tui-state-manager.test.ts +451 -0
- package/src/__tests__/ui-intent-rendering.test.tsx +291 -0
- package/src/__tests__/wave-text.test.tsx +133 -0
- package/src/app-banner.tsx +42 -0
- package/src/app-static-items.ts +35 -0
- package/src/app-view-model.ts +136 -0
- package/src/attention/__tests__/attention-coordinator.test.ts +166 -0
- package/src/attention/__tests__/attention-tracker.test.ts +103 -0
- package/src/attention/__tests__/countdown.test.ts +15 -0
- package/src/attention/__tests__/focus-input-filter.test.ts +92 -0
- package/src/attention/__tests__/interval-recap.test.ts +49 -0
- package/src/attention/attention-coordinator.ts +71 -0
- package/src/attention/attention-tracker.ts +124 -0
- package/src/attention/countdown.ts +24 -0
- package/src/attention/focus-input-filter.ts +131 -0
- package/src/attention/interval-recap.ts +148 -0
- package/src/attention/time-units.ts +6 -0
- package/src/attention-bell.ts +79 -0
- package/src/attributed-user-echo.ts +30 -0
- package/src/background-task-row-format.ts +99 -0
- package/src/command-interaction.ts +8 -0
- package/src/command-output-summary.ts +129 -0
- package/src/create-default-tui-cli-adapter.ts +45 -0
- package/src/execution-workspace-switcher-selection.ts +118 -0
- package/src/execution-workspace-view-model.ts +139 -0
- package/src/external-prompt-notice.tsx +38 -0
- package/src/flows/__tests__/background-focus-flow.test.ts +48 -0
- package/src/flows/__tests__/defer-submit.test.ts +87 -0
- package/src/flows/__tests__/real-cursor-flow.test.ts +124 -0
- package/src/flows/background-focus-flow.ts +44 -0
- package/src/flows/cjk-cursor-motion.ts +75 -0
- package/src/flows/cjk-text-deletion.ts +53 -0
- package/src/flows/cjk-text-input-flow.ts +248 -0
- package/src/flows/cjk-text-input-types.ts +24 -0
- package/src/flows/confirm-prompt-flow.ts +90 -0
- package/src/flows/defer-submit.ts +67 -0
- package/src/flows/fork-attach-flow.ts +62 -0
- package/src/flows/input-area-flow.ts +188 -0
- package/src/flows/permission-prompt-flow.ts +108 -0
- package/src/flows/real-cursor-flow.ts +83 -0
- package/src/flows/selection-flow.ts +205 -0
- package/src/flows/session-init-poller.ts +76 -0
- package/src/flows/text-prompt-flow.ts +93 -0
- package/src/history-search/__tests__/history-search-flow.test.ts +86 -0
- package/src/history-search/history-search-flow.ts +94 -0
- package/src/history-search/useHistorySearch.ts +336 -0
- package/src/hooks/__tests__/use-app-loop-escape.test.tsx +74 -0
- package/src/hooks/__tests__/use-plugin-callbacks.test.ts +18 -0
- package/src/hooks/__tests__/use-tui-channel-stability.test.tsx +100 -0
- package/src/hooks/__tests__/useAppThemeState.test.tsx +130 -0
- package/src/hooks/command-result-handler.ts +44 -0
- package/src/hooks/side-effects-types.ts +45 -0
- package/src/hooks/useAppController.ts +267 -0
- package/src/hooks/useAppInputBindings.ts +145 -0
- package/src/hooks/useAppInteractionState.ts +81 -0
- package/src/hooks/useAppLifecycleState.ts +81 -0
- package/src/hooks/useAppOverlays.ts +74 -0
- package/src/hooks/useAppScreenState.ts +81 -0
- package/src/hooks/useAppSubmissionState.ts +45 -0
- package/src/hooks/useAppThemeState.ts +157 -0
- package/src/hooks/useAppWorkspaceState.ts +149 -0
- package/src/hooks/useAppearanceSettings.ts +30 -0
- package/src/hooks/useAutocomplete.ts +101 -0
- package/src/hooks/useBackgroundPanel.ts +58 -0
- package/src/hooks/useCountdownTick.ts +24 -0
- package/src/hooks/useExecutionDetailPage.ts +69 -0
- package/src/hooks/useForkAttach.ts +60 -0
- package/src/hooks/useInputAreaHistorySearch.ts +72 -0
- package/src/hooks/useInputAreaKeys.ts +114 -0
- package/src/hooks/useNumberedSelection.ts +76 -0
- package/src/hooks/usePluginCallbacks.ts +38 -0
- package/src/hooks/usePluginScreenData.ts +85 -0
- package/src/hooks/useRealCursorPosition.ts +125 -0
- package/src/hooks/useRenderMarkdown.ts +38 -0
- package/src/hooks/useScreenReaderTurnSignals.ts +113 -0
- package/src/hooks/useSideEffects.ts +144 -0
- package/src/hooks/useStatusLineSettings.ts +50 -0
- package/src/hooks/useTerminalHandoffSuspension.ts +30 -0
- package/src/hooks/useTuiChannel.ts +129 -0
- package/src/humanize-tool-name.ts +51 -0
- package/src/index.ts +56 -0
- package/src/input-area-rules.tsx +71 -0
- package/src/json-value.ts +18 -0
- package/src/key-hint-footer.tsx +54 -0
- package/src/keybindings/__tests__/keybinding-registry.test.ts +228 -0
- package/src/keybindings/__tests__/node-keybindings-source.test.ts +111 -0
- package/src/keybindings/keybinding-catalogue.ts +171 -0
- package/src/keybindings/keybinding-registry.ts +303 -0
- package/src/keybindings/keybinding-syntax.ts +155 -0
- package/src/keybindings/keybindings-context.tsx +124 -0
- package/src/keybindings/node-keybindings-source.ts +189 -0
- package/src/numbered-list.tsx +113 -0
- package/src/plugin-tui-handlers.ts +163 -0
- package/src/product-display-name-context.tsx +30 -0
- package/src/render-markdown.ts +209 -0
- package/src/render.tsx +544 -0
- package/src/sanitize-terminal-text.ts +171 -0
- package/src/screen-reader-announcement.ts +52 -0
- package/src/screen-reader-context.tsx +32 -0
- package/src/screen-reader-labels.ts +64 -0
- package/src/screen-reader-pacing-context.tsx +47 -0
- package/src/screen-reader-pacing.ts +178 -0
- package/src/screen-reader-stdout.ts +328 -0
- package/src/shutdown-signal.ts +34 -0
- package/src/status-activity.ts +70 -0
- package/src/status-glyph.ts +78 -0
- package/src/terminal-capabilities-context.tsx +27 -0
- package/src/terminal-capabilities.ts +77 -0
- package/src/terminal-focus-reporting.ts +50 -0
- package/src/terminal-handoff-controller.ts +98 -0
- package/src/terminal-marks.ts +63 -0
- package/src/theme/__tests__/built-in-themes.test.ts +117 -0
- package/src/theme/__tests__/color-vision.test.ts +82 -0
- package/src/theme/__tests__/theme-context.test.tsx +146 -0
- package/src/theme/__tests__/theme-document.test.ts +222 -0
- package/src/theme/__tests__/theme-registry.test.ts +138 -0
- package/src/theme/__tests__/theme-styles.test.ts +233 -0
- package/src/theme/built-in-themes.ts +342 -0
- package/src/theme/color-vision.ts +171 -0
- package/src/theme/index.ts +45 -0
- package/src/theme/theme-context.tsx +81 -0
- package/src/theme/theme-contracts.ts +139 -0
- package/src/theme/theme-document.ts +278 -0
- package/src/theme/theme-registry.ts +127 -0
- package/src/theme/theme-styles.ts +177 -0
- package/src/tool-summary-status.ts +59 -0
- package/src/tui-app-channel-port.ts +83 -0
- package/src/tui-channel-lifecycle-coordinator.ts +149 -0
- package/src/tui-channel-options.ts +172 -0
- package/src/tui-cli-adapter-context.tsx +13 -0
- package/src/tui-cli-adapter.ts +24 -0
- package/src/tui-interaction-queues.ts +163 -0
- package/src/tui-session-binding.ts +52 -0
- package/src/tui-session-event-projector.ts +140 -0
- package/src/tui-session-events.ts +82 -0
- package/src/tui-session-notice-store.ts +43 -0
- package/src/tui-session-options.ts +118 -0
- package/src/tui-state-manager.ts +327 -0
- package/src/types.ts +19 -0
- package/src/use-terminal-title.ts +29 -0
- package/src/utils/__tests__/edit-diff.test.ts +426 -0
- package/src/utils/__tests__/paste-detection.test.ts +116 -0
- package/src/utils/__tests__/paste-labels.test.ts +46 -0
- package/src/utils/__tests__/tool-call-extractor.test.ts +227 -0
- package/src/utils/__tests__/tool-diff-summary.test.ts +104 -0
- package/src/utils/edit-diff.ts +151 -0
- package/src/utils/input-top-border.ts +19 -0
- package/src/utils/paste-labels.ts +9 -0
- package/src/utils/tool-call-extractor.ts +92 -0
- package/src/utils/tool-diff-summary.ts +75 -0
|
@@ -0,0 +1,1066 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { CommandRegistry, EditCheckpointStore, IAgentDefinition, IAutomaticMemoryConfig, IBackgroundTaskRunner, ICommandHostAdapters, ICommandModule, IContributionSource, ICreateSessionOptions, ILivePromptTracePort, IMemoryStore, INodeHostSettingsSource, IOrgPolicy, IOutputStylePrompt, IPerTurnRecallConfig, IProjectSettingsPath, IPromptHistoryOptions, IProviderErrorGuidance, IRemoteCommandPolicy, ISkillRootDescriptor, IToolCallHandoffPolicy, InteractiveSession, TSettingsSource, TShellExecFn, TSubagentRunnerFactory, TWorkspaceProjectAccess } from "@robota-sdk/agent-framework";
|
|
3
|
+
import { IBranchEvent, ICommandInfo, IContextFileRefreshedEvent, IExecutionResult, IInteractiveSession, IInteractiveSessionEvents, IInteractiveSessionStore, IPlanApprovalEvent, IPromptHistorySource, ITerminalHandoff, IToolState, TInteractiveEventName, TPermissionResultValue } from "@robota-sdk/agent-interface-session";
|
|
4
|
+
import { IAIProvider, IActionRequest, IContextWindowState, IHistoryEntry, IProviderDefinition, IToolWithEventService, TActionResponse, TModelEffortSelection, TPermissionMode, TSessionEndReason, TToolArgs, TUniversalValue } from "@robota-sdk/agent-core";
|
|
5
|
+
import { IExecutionDetailPage, IExecutionWorkspaceSnapshot } from "@robota-sdk/agent-interface-execution";
|
|
6
|
+
import { ICommand, IThemeAppearanceState, IThemeCataloguePort, TReducedMotionOverride } from "@robota-sdk/agent-interface-command";
|
|
7
|
+
import { ITransportRegistryView } from "@robota-sdk/agent-interface-transport";
|
|
8
|
+
import { ITuiCommandInteraction, ITuiConfirmInteraction, ITuiPickerInteraction, ITuiPickerItem, TAnyTuiCommandInteraction, TOnMissingArgsAction } from "@robota-sdk/agent-interface-tui";
|
|
9
|
+
//#region src/screen-reader-pacing.d.ts
|
|
10
|
+
/** Raw timing choices supplied by the embedding host, with names for visible diagnostics. */
|
|
11
|
+
interface IScreenReaderPacingOverrides {
|
|
12
|
+
readonly startupQuiet?: {
|
|
13
|
+
readonly raw: string | undefined;
|
|
14
|
+
readonly label: string;
|
|
15
|
+
};
|
|
16
|
+
readonly prepark?: {
|
|
17
|
+
readonly raw: string | undefined;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/terminal-capabilities-context.d.ts
|
|
23
|
+
/** Host-selected overrides; absent values leave terminal detection in charge. */
|
|
24
|
+
interface ITerminalCapabilityOverrides {
|
|
25
|
+
readonly imeCursorPositioning?: boolean | undefined;
|
|
26
|
+
readonly turnMarks?: boolean | undefined;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/tui-session-events.d.ts
|
|
30
|
+
interface ITuiSessionEventNotice {
|
|
31
|
+
id: string;
|
|
32
|
+
event: 'plan_event' | 'context_file_refreshed' | 'branch_event' | 'delivery-error' |
|
|
33
|
+
/** SCREEN-1992: TUI-originated — the interval recap on return, not a session event. */
|
|
34
|
+
'attention-recap';
|
|
35
|
+
message: string;
|
|
36
|
+
}
|
|
37
|
+
type TTuiNoticeInput = {
|
|
38
|
+
event: 'plan_event';
|
|
39
|
+
payload: IPlanApprovalEvent;
|
|
40
|
+
} | {
|
|
41
|
+
event: 'context_file_refreshed';
|
|
42
|
+
payload: IContextFileRefreshedEvent;
|
|
43
|
+
} | {
|
|
44
|
+
event: 'branch_event';
|
|
45
|
+
payload: IBranchEvent;
|
|
46
|
+
};
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/tui-state-manager.d.ts
|
|
49
|
+
/**
|
|
50
|
+
* TUI view of the core context-window state. The token fields are derived from the agent-core
|
|
51
|
+
* SSOT (`IContextWindowState`) via `Pick` so they stay structurally tied to it; `percentage` is an
|
|
52
|
+
* explicit display-facing mirror of `IContextWindowState.usedPercentage`.
|
|
53
|
+
*/
|
|
54
|
+
type TContextState = Pick<IContextWindowState, 'usedTokens' | 'maxTokens'> & {
|
|
55
|
+
/** Mirror of `IContextWindowState.usedPercentage`, named for the TUI display layer. */
|
|
56
|
+
percentage: number;
|
|
57
|
+
};
|
|
58
|
+
declare class TuiStateManager {
|
|
59
|
+
history: IHistoryEntry[];
|
|
60
|
+
/**
|
|
61
|
+
* Notices this terminal added itself (command results, init errors). They are not in the session's
|
|
62
|
+
* history, so each remembers how many session entries preceded it and is re-inserted there on sync.
|
|
63
|
+
*/
|
|
64
|
+
private localNotices;
|
|
65
|
+
streamingText: string;
|
|
66
|
+
activeTools: IToolState[];
|
|
67
|
+
isThinking: boolean;
|
|
68
|
+
isAborting: boolean;
|
|
69
|
+
pendingPrompt: string | null;
|
|
70
|
+
contextState: TContextState;
|
|
71
|
+
executionWorkspaceSnapshot: IExecutionWorkspaceSnapshot | null;
|
|
72
|
+
selectedExecutionEntryId: string | undefined;
|
|
73
|
+
/** ERR-001 G2: humanized message of the last failed turn; cleared when the next turn starts. */
|
|
74
|
+
lastErrorMessage: string | null;
|
|
75
|
+
/** ERR-001 G3: no stream/tool activity for STALL_HINT_MS while thinking. */
|
|
76
|
+
isStalled: boolean;
|
|
77
|
+
private readonly sessionNoticeStore;
|
|
78
|
+
/** Bounded render-only projection; never merged into canonical session history. */
|
|
79
|
+
readonly sessionEventNotices: ITuiSessionEventNotice[];
|
|
80
|
+
/** Called after any state change. React hook sets this to trigger re-render. */
|
|
81
|
+
onChange: (() => void) | null;
|
|
82
|
+
private streamBuf;
|
|
83
|
+
private debouncedStreamNotify;
|
|
84
|
+
private stallTimer;
|
|
85
|
+
/** (Re)start the dead-air timer — any provider activity proves the connection is alive. */
|
|
86
|
+
private armStallTimer;
|
|
87
|
+
private clearStallTimer;
|
|
88
|
+
private notify;
|
|
89
|
+
onTextDelta: (delta: string) => void;
|
|
90
|
+
onToolStart: (state: IToolState) => void;
|
|
91
|
+
onToolEnd: (state: IToolState) => void;
|
|
92
|
+
onThinking: (thinking: boolean) => void;
|
|
93
|
+
onComplete: (result: IExecutionResult) => void;
|
|
94
|
+
onInterrupted: () => void;
|
|
95
|
+
onError: (error?: Error) => void;
|
|
96
|
+
onContextUpdate: (state: IContextWindowState) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Sync history from InteractiveSession — authoritative SSOT replace (SCREEN-010: no front-windowing).
|
|
99
|
+
* The session history grows monotonically during a session, so Ink `<Static>` (count-based) renders
|
|
100
|
+
* only the newly-appended tail; committed lines already in terminal scrollback are never re-printed.
|
|
101
|
+
*/
|
|
102
|
+
syncHistory(entries: IHistoryEntry[]): void;
|
|
103
|
+
/** Add a notice this terminal owns; it survives the next session-history sync in place. */
|
|
104
|
+
addEntry(entry: IHistoryEntry): void;
|
|
105
|
+
/** Echo the user's prompt at once; the session's own user entry replaces it on the next sync. */
|
|
106
|
+
addUserEcho(entry: IHistoryEntry): void;
|
|
107
|
+
clearHistory(): void;
|
|
108
|
+
/** Update pending prompt state */
|
|
109
|
+
setPendingPrompt(prompt: string | null): void;
|
|
110
|
+
/** Set aborting flag */
|
|
111
|
+
setAborting(aborting: boolean): void;
|
|
112
|
+
/** Update context state */
|
|
113
|
+
setContextState(state: TContextState): void;
|
|
114
|
+
addSessionEventNotice(input: TTuiNoticeInput): void;
|
|
115
|
+
addAttentionRecap(line: string): void;
|
|
116
|
+
addSessionEventDeliveryError(error: Error, event: TInteractiveEventName): void;
|
|
117
|
+
syncExecutionWorkspaceSnapshot(snapshot: IExecutionWorkspaceSnapshot): void;
|
|
118
|
+
selectExecutionWorkspaceEntry(entryId: string): void;
|
|
119
|
+
/**
|
|
120
|
+
* RUNTIME-52: release every timer this manager owns and detach the render callback. Called by the
|
|
121
|
+
* channel's teardown (`stop()`); after dispose the manager must never fire `onChange` or trip the
|
|
122
|
+
* stall hint on a discarded session.
|
|
123
|
+
*/
|
|
124
|
+
dispose(): void;
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/terminal-handoff-controller.d.ts
|
|
128
|
+
/** How the App suspends/resumes its rendering, registered into the controller on mount. */
|
|
129
|
+
interface ITuiSuspendHooks {
|
|
130
|
+
/** Render nothing (release Ink input/raw mode); resolves once that has committed. */
|
|
131
|
+
suspend(): Promise<void>;
|
|
132
|
+
/** Resume rendering and force a redraw. */
|
|
133
|
+
resume(): void;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* SCREEN-1992: terminal modes the TUI negotiated (focus reporting) are released before a child owns
|
|
137
|
+
* the terminal and re-negotiated once it is reclaimed, so the child never receives `CSI I`/`CSI O`
|
|
138
|
+
* and a child that reset the mode does not leave the TUI blind afterwards.
|
|
139
|
+
*/
|
|
140
|
+
interface ITerminalModeHooks {
|
|
141
|
+
/** May be async: SCREEN-2670 drains the parked screen-reader output before the child gets the TTY. */
|
|
142
|
+
preSuspend(): void | Promise<void>;
|
|
143
|
+
postResume(): void;
|
|
144
|
+
}
|
|
145
|
+
/** Minimal slice of the Ink render instance the controller needs. */
|
|
146
|
+
interface IInkClearable {
|
|
147
|
+
clear(): void;
|
|
148
|
+
}
|
|
149
|
+
declare class TerminalHandoffController implements ITerminalHandoff {
|
|
150
|
+
private hooks?;
|
|
151
|
+
private instance?;
|
|
152
|
+
private modeHooks?;
|
|
153
|
+
/**
|
|
154
|
+
* The App registers how to suspend/resume Ink. Returns an unregister function for cleanup on
|
|
155
|
+
* unmount. Only a mounted App provides these hooks, which gates `canHandoffTerminal`.
|
|
156
|
+
*/
|
|
157
|
+
registerSuspendHooks(hooks: ITuiSuspendHooks): () => void;
|
|
158
|
+
/** render.tsx registers the terminal-mode bracket (SCREEN-1992) before `render()`. */
|
|
159
|
+
setTerminalModeHooks(hooks: ITerminalModeHooks | undefined): void;
|
|
160
|
+
/** render.tsx supplies the Ink instance (for `clear()`) after `render()` returns. */
|
|
161
|
+
setInkInstance(instance: IInkClearable): void;
|
|
162
|
+
get canHandoffTerminal(): boolean;
|
|
163
|
+
runWithTerminal<T>(fn: () => Promise<T>): Promise<T>;
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/types.d.ts
|
|
167
|
+
/**
|
|
168
|
+
* Permission result: true (allow once), false (deny), 'allow-session' (remember for session),
|
|
169
|
+
* or 'allow-project' (persist through the host-selected project settings writer).
|
|
170
|
+
*/
|
|
171
|
+
type TPermissionResult = TPermissionResultValue;
|
|
172
|
+
interface IPendingPermissionRequest {
|
|
173
|
+
toolName: string;
|
|
174
|
+
toolArgs: TToolArgs;
|
|
175
|
+
canPersistProjectPermission?: boolean;
|
|
176
|
+
/** The peer session whose message this call serves, when a peer turn asked. */
|
|
177
|
+
requestedByPeer?: string;
|
|
178
|
+
resolve: (result: TPermissionResult) => void;
|
|
179
|
+
}
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region src/tui-app-channel-port.d.ts
|
|
182
|
+
interface ITuiCommandQueryPort {
|
|
183
|
+
getCommands(filter?: string): ICommand[];
|
|
184
|
+
getSubcommands(commandName: string): ICommand[];
|
|
185
|
+
}
|
|
186
|
+
type TTuiSessionUiEventName = 'ui_intent' | 'session_renamed';
|
|
187
|
+
interface ITuiSessionUiEventPort {
|
|
188
|
+
on<E extends TTuiSessionUiEventName>(event: E, handler: IInteractiveSessionEvents[E]): void;
|
|
189
|
+
off<E extends TTuiSessionUiEventName>(event: E, handler: IInteractiveSessionEvents[E]): void;
|
|
190
|
+
}
|
|
191
|
+
interface ITuiRuntimeStatusSnapshot {
|
|
192
|
+
permissionMode: TPermissionMode;
|
|
193
|
+
sessionId: string;
|
|
194
|
+
activePresetId?: string;
|
|
195
|
+
effort?: TModelEffortSelection;
|
|
196
|
+
}
|
|
197
|
+
interface ITuiChannelSnapshot {
|
|
198
|
+
history: readonly IHistoryEntry[];
|
|
199
|
+
streamingText: string;
|
|
200
|
+
activeTools: readonly IToolState[];
|
|
201
|
+
isThinking: boolean;
|
|
202
|
+
isAborting: boolean;
|
|
203
|
+
lastErrorMessage: string | null;
|
|
204
|
+
isStalled: boolean;
|
|
205
|
+
sessionEventNotices: readonly ITuiSessionEventNotice[];
|
|
206
|
+
isShuttingDown: boolean;
|
|
207
|
+
pendingPrompt: string | null;
|
|
208
|
+
pendingCount: number;
|
|
209
|
+
executionWorkspaceSnapshot: IExecutionWorkspaceSnapshot | null;
|
|
210
|
+
selectedExecutionEntryId?: string;
|
|
211
|
+
permissionRequest: IPendingPermissionRequest | null;
|
|
212
|
+
pendingUserAction: IActionRequest | null;
|
|
213
|
+
contextState: {
|
|
214
|
+
percentage: number;
|
|
215
|
+
usedTokens: number;
|
|
216
|
+
maxTokens: number;
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Complete channel surface visible below the top-level App composition shell.
|
|
221
|
+
*
|
|
222
|
+
* Deliberately excludes the concrete-session, concrete-registry and mutable-state-manager
|
|
223
|
+
* compatibility escapes retained by TuiInteractionChannel for non-React consumers.
|
|
224
|
+
*/
|
|
225
|
+
interface ITuiAppChannelPort {
|
|
226
|
+
readonly terminalHandoffController: TerminalHandoffController | undefined;
|
|
227
|
+
readonly sessionName: string | undefined;
|
|
228
|
+
start(): Promise<void>;
|
|
229
|
+
stop(): Promise<void>;
|
|
230
|
+
subscribe(onChange: () => void): () => void;
|
|
231
|
+
getSnapshot(): ITuiChannelSnapshot;
|
|
232
|
+
getCommandQueryPort(): ITuiCommandQueryPort;
|
|
233
|
+
getSessionUiEventPort(): ITuiSessionUiEventPort;
|
|
234
|
+
getRuntimeStatusSnapshot(fallbackPermissionMode: TPermissionMode): ITuiRuntimeStatusSnapshot;
|
|
235
|
+
addEntry(entry: IHistoryEntry): void;
|
|
236
|
+
handleInput(input: string): Promise<void>;
|
|
237
|
+
abort(): void;
|
|
238
|
+
cancelQueue(): void;
|
|
239
|
+
stopWaitingSelfPacedLoop(): Promise<void>;
|
|
240
|
+
shutdown(options?: {
|
|
241
|
+
reason?: TSessionEndReason;
|
|
242
|
+
timeoutMs?: number;
|
|
243
|
+
}): Promise<void>;
|
|
244
|
+
selectExecutionWorkspaceEntry(entryId: string): void;
|
|
245
|
+
readExecutionWorkspaceDetail(entryId: string): Promise<IExecutionDetailPage>;
|
|
246
|
+
sendAgentJob(taskId: string, input: string): Promise<void>;
|
|
247
|
+
resolveUserAction(request: IActionRequest, response: TActionResponse): void;
|
|
248
|
+
}
|
|
249
|
+
//#endregion
|
|
250
|
+
//#region src/attention/attention-tracker.d.ts
|
|
251
|
+
type TAttentionChangeKind = 'lost' | 'returned';
|
|
252
|
+
interface IAttentionChange {
|
|
253
|
+
readonly kind: TAttentionChangeKind;
|
|
254
|
+
/** ISO timestamp of the transition, from the injected clock. */
|
|
255
|
+
readonly at: string;
|
|
256
|
+
}
|
|
257
|
+
type TAttentionListener = (change: IAttentionChange) => void;
|
|
258
|
+
/** What a consumer of attention sees: the level, and every transition. */
|
|
259
|
+
interface IAttentionSource {
|
|
260
|
+
readonly attended: boolean;
|
|
261
|
+
/** Which source decides the level right now — recorded so a degraded run is never a silent default. */
|
|
262
|
+
readonly source: 'focus' | 'idle';
|
|
263
|
+
subscribe(listener: TAttentionListener): () => void;
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/tui-channel-options.d.ts
|
|
267
|
+
/**
|
|
268
|
+
* The TUI channel's option surface.
|
|
269
|
+
*
|
|
270
|
+
* ARCH-013: this lived inside the 698-line channel class, beside the code that consumes it. The
|
|
271
|
+
* projection FROM it — `buildTuiSessionOptions` — already had its own module, so the surface and its
|
|
272
|
+
* one projection now sit together and neither is buried in an implementation file. That matters for
|
|
273
|
+
* this item specifically: a field added to the resolved preset has to be added here to reach the
|
|
274
|
+
* interactive surface at all, and a surface nobody can find is a surface people forget.
|
|
275
|
+
*/
|
|
276
|
+
interface ITuiInteractionChannelOptions {
|
|
277
|
+
livePromptTrace?: ILivePromptTracePort;
|
|
278
|
+
/**
|
|
279
|
+
* Provider definitions, forwarded to the session so `/provider switch` can construct the provider
|
|
280
|
+
* it switches TO.
|
|
281
|
+
*
|
|
282
|
+
* Not optional-by-accident: without it the session holds an empty list, and the hot-swap fails with
|
|
283
|
+
* "Unknown provider: <name>. Currently supported: " — an empty supported-list, which is both wrong
|
|
284
|
+
* and unactionable. The definitions live in the composition root; the session cannot discover them.
|
|
285
|
+
*/
|
|
286
|
+
providerDefinitions?: readonly IProviderDefinition[];
|
|
287
|
+
cwd: string;
|
|
288
|
+
provider: IAIProvider;
|
|
289
|
+
providerErrorGuidance?: IProviderErrorGuidance;
|
|
290
|
+
promptFileReferenceTag?: string;
|
|
291
|
+
modelCommandToolPrefix?: string;
|
|
292
|
+
subagentHookEnvironmentNames?: ICreateSessionOptions['subagentHookEnvironmentNames'];
|
|
293
|
+
observerFailureWarningCode?: ICreateSessionOptions['observerFailureWarningCode'];
|
|
294
|
+
commandHookShell?: string;
|
|
295
|
+
/** Skip instruction files and plugin discovery (`--safe-mode`). */
|
|
296
|
+
bare?: boolean;
|
|
297
|
+
/** Run no hook the settings layers declare (`--safe-mode`). */
|
|
298
|
+
skipConfiguredHooks?: boolean;
|
|
299
|
+
/** Resolved organization policy forwarded to the interactive session. */
|
|
300
|
+
orgPolicy?: IOrgPolicy;
|
|
301
|
+
projectAccess?: TWorkspaceProjectAccess;
|
|
302
|
+
projectSettingsPaths?: readonly IProjectSettingsPath[];
|
|
303
|
+
baselinePermissionAllow?: readonly string[];
|
|
304
|
+
/** Host-selected task-context root; absent means no framework task-directory scan. */
|
|
305
|
+
taskContext?: {
|
|
306
|
+
readonly enabled?: boolean;
|
|
307
|
+
readonly dir?: string;
|
|
308
|
+
};
|
|
309
|
+
contributionSources?: ICreateSessionOptions['contributionSources'];
|
|
310
|
+
skillRoots?: ICreateSessionOptions['skillRoots'];
|
|
311
|
+
userSettingsSources?: readonly INodeHostSettingsSource[];
|
|
312
|
+
/** Explicit authority- and permission-backed edit checkpoint capability. */
|
|
313
|
+
editCheckpointStore?: EditCheckpointStore;
|
|
314
|
+
/**
|
|
315
|
+
* CLI-076: the resolved model id (the same value the status line displays). Forwarded to the session so an
|
|
316
|
+
* explicit `--model` override reaches the provider chat call instead of being silently replaced by the
|
|
317
|
+
* session's default model.
|
|
318
|
+
*/
|
|
319
|
+
model?: string;
|
|
320
|
+
/** CLI-1988: resolved provider-neutral response style. */
|
|
321
|
+
outputStyle?: IOutputStylePrompt;
|
|
322
|
+
/** ARCH-013: resolved preset effort, threaded to the session's `effort` seam. */
|
|
323
|
+
effort?: ICreateSessionOptions['effort'];
|
|
324
|
+
temperature?: number;
|
|
325
|
+
maxOutputTokens?: number;
|
|
326
|
+
/** Preset prompt seed, distinct from the replacing `systemPrompt` option. */
|
|
327
|
+
presetSystemPrompt?: string;
|
|
328
|
+
responseFormat?: ICreateSessionOptions['responseFormat'];
|
|
329
|
+
permissionMode?: TPermissionMode;
|
|
330
|
+
maxTurns?: number;
|
|
331
|
+
sessionStore?: IInteractiveSessionStore;
|
|
332
|
+
disableSessionLoops?: boolean;
|
|
333
|
+
resolveDefaultLoopPrompt?: () => string;
|
|
334
|
+
resumeSessionId?: string;
|
|
335
|
+
forkSession?: boolean;
|
|
336
|
+
/** Issue #3081: this channel's session is the target of a `/cd` from this directory. */
|
|
337
|
+
workspaceMovedFrom?: string;
|
|
338
|
+
sessionName?: string;
|
|
339
|
+
onAutoNamed?: (name: string) => void;
|
|
340
|
+
backgroundTaskRunners?: IBackgroundTaskRunner[];
|
|
341
|
+
/** MCP-004: forwarded to `ICreateSessionOptions.toolCallHandoff`. */
|
|
342
|
+
toolCallHandoff?: IToolCallHandoffPolicy;
|
|
343
|
+
subagentRunnerFactory?: TSubagentRunnerFactory;
|
|
344
|
+
/** ARCH-005: composition-root-contributed subagent definitions (merged capability packs). */
|
|
345
|
+
agentDefinitions?: readonly IAgentDefinition[];
|
|
346
|
+
agentDefinitionRoots?: readonly string[];
|
|
347
|
+
pluginDirectories?: {
|
|
348
|
+
readonly user?: string;
|
|
349
|
+
readonly project?: string;
|
|
350
|
+
};
|
|
351
|
+
/**
|
|
352
|
+
* ARCH-006: tools contributed by the composition root (the capability packs `assembleProduct` merged)
|
|
353
|
+
* and, when the profile hands the packs the whole tool surface, the suppressed framework default tier
|
|
354
|
+
* (`defaultTools: []`). Forwarded to the session's tool-composition seam; absent ⇒ unchanged.
|
|
355
|
+
*/
|
|
356
|
+
additionalTools?: IToolWithEventService[];
|
|
357
|
+
defaultTools?: readonly IToolWithEventService[];
|
|
358
|
+
commandModules?: readonly ICommandModule[];
|
|
359
|
+
commandHostAdapters?: ICommandHostAdapters;
|
|
360
|
+
shellExec?: TShellExecFn;
|
|
361
|
+
/** REMOTE-006: optional remote-command policy (allow-by-default; a transport-origin command runs as a local one). */
|
|
362
|
+
remoteCommandPolicy?: IRemoteCommandPolicy;
|
|
363
|
+
transportRegistry?: ITransportRegistryView;
|
|
364
|
+
/** Bind concrete transports to each newly constructed session before registry startup. */
|
|
365
|
+
bindTransports?: (session: IInteractiveSession) => void | Promise<void>;
|
|
366
|
+
language?: string;
|
|
367
|
+
reloadPluginCommandSource?: (registry: CommandRegistry) => void;
|
|
368
|
+
agentName?: string;
|
|
369
|
+
/** Active preset id selected at startup (PRESET-011 runtime state). Defaults to 'default'. */
|
|
370
|
+
activePresetId?: string;
|
|
371
|
+
/** Preset persona block composed as a `source: 'persona'` system-prompt section (priority 5). */
|
|
372
|
+
persona?: string;
|
|
373
|
+
systemPrompt?: string;
|
|
374
|
+
appendSystemPrompt?: string;
|
|
375
|
+
allowedTools?: readonly string[];
|
|
376
|
+
deniedTools?: readonly string[];
|
|
377
|
+
/** Preset execution capability: activate agent runtime + subagent/background dispatch. */
|
|
378
|
+
enableParallelSubagents?: boolean;
|
|
379
|
+
/** Preset execution capability: run a post-task self-verification step. */
|
|
380
|
+
selfVerification?: boolean;
|
|
381
|
+
/** TERM-002: process-shared terminal-handoff controller (the TUI implementation of ITerminalHandoff). */
|
|
382
|
+
terminalHandoff?: TerminalHandoffController;
|
|
383
|
+
/** SCREEN-1992: the terminal's attention level; absent ⇒ no interval recap. */
|
|
384
|
+
attention?: IAttentionSource;
|
|
385
|
+
/**
|
|
386
|
+
* SELFHOST-008 P6: optional durable-memory store injected by the surface (agent-cli). Forwarded into
|
|
387
|
+
* `buildRuntimeSession`; absent ⇒ memory OFF (today's behavior). Enablement/policy is surface-owned.
|
|
388
|
+
*/
|
|
389
|
+
memoryStore?: IMemoryStore;
|
|
390
|
+
/** SELFHOST-008 P6: optional automatic post-turn capture policy (absent ⇒ capture OFF). */
|
|
391
|
+
automaticMemory?: IAutomaticMemoryConfig;
|
|
392
|
+
/** SELFHOST-008 P6: optional per-turn recall policy (absent ⇒ recall OFF, startup-only injection). */
|
|
393
|
+
recallMemory?: IPerTurnRecallConfig;
|
|
394
|
+
/** Observe TUI-owned session-event rendering failures without failing the committed operation. */
|
|
395
|
+
onSessionEventDeliveryError?: (error: Error, event: TInteractiveEventName) => void;
|
|
396
|
+
/**
|
|
397
|
+
* CLI-2004: the resolved screen-reader mode. A PRESENTATION field — it changes nothing about the
|
|
398
|
+
* session and is deliberately NOT projected into `buildTuiSessionOptions`; it is carried here so
|
|
399
|
+
* the render-options → channel-options projection is complete and the ARCH-110 drop hazard is
|
|
400
|
+
* asserted rather than assumed. Absent ⇒ OFF.
|
|
401
|
+
*/
|
|
402
|
+
screenReader?: boolean;
|
|
403
|
+
/** SCREEN-1993: the session-side prompt-history writer and project key; absent ⇒ nothing recorded. */
|
|
404
|
+
promptHistory?: IPromptHistoryOptions | undefined;
|
|
405
|
+
}
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/TuiInteractionChannel.d.ts
|
|
408
|
+
declare class TuiInteractionChannel implements ITuiAppChannelPort {
|
|
409
|
+
readonly stateManager: TuiStateManager;
|
|
410
|
+
private readonly interactiveSession;
|
|
411
|
+
private readonly registry;
|
|
412
|
+
private readonly opts;
|
|
413
|
+
private submitHandler;
|
|
414
|
+
private readonly userActions;
|
|
415
|
+
private readonly permissions;
|
|
416
|
+
private readonly eventProjector;
|
|
417
|
+
/** SCREEN-1992: joins the terminal's attention to this channel's recap; absent without a source. */
|
|
418
|
+
private readonly attention;
|
|
419
|
+
private readonly lifecycle;
|
|
420
|
+
availableCommands: ICommandInfo[];
|
|
421
|
+
sessionName: string | undefined;
|
|
422
|
+
private autoNameTriggered;
|
|
423
|
+
private initPoller;
|
|
424
|
+
/** TERM-002: the App registers its Ink suspend/resume hooks into this controller. */
|
|
425
|
+
get terminalHandoffController(): TerminalHandoffController | undefined;
|
|
426
|
+
/** Set by React hook to trigger re-render on state change */
|
|
427
|
+
onChange: (() => void) | null;
|
|
428
|
+
constructor(opts: ITuiInteractionChannelOptions);
|
|
429
|
+
private startRuntime;
|
|
430
|
+
private stopTransports;
|
|
431
|
+
get permissionRequest(): IPendingPermissionRequest | null;
|
|
432
|
+
/** CMD-004: the action currently awaiting a user answer, or null. */
|
|
433
|
+
get pendingUserAction(): IActionRequest | null;
|
|
434
|
+
get isShuttingDown(): boolean;
|
|
435
|
+
get isActiveForPeerStatus(): boolean;
|
|
436
|
+
private createSession;
|
|
437
|
+
private createRegistry;
|
|
438
|
+
onSubmit(handler: (text: string) => Promise<void>): void;
|
|
439
|
+
setAvailableCommands(commands: ICommandInfo[]): void;
|
|
440
|
+
setBusy(busy: boolean): void;
|
|
441
|
+
start(): Promise<void>;
|
|
442
|
+
/**
|
|
443
|
+
* Full, idempotent channel teardown (CLI-075). Unwires every session listener, drains both
|
|
444
|
+
* request queues, stops the init poller, disposes the render-state manager, stops transports, and
|
|
445
|
+
* — unless a graceful `shutdown()` already ran — shuts the underlying session down so a discarded
|
|
446
|
+
* or switched-away channel releases its background tasks, subagent processes, and timers.
|
|
447
|
+
*/
|
|
448
|
+
stop(): Promise<void>;
|
|
449
|
+
getSession(): InteractiveSession;
|
|
450
|
+
getRegistry(): CommandRegistry;
|
|
451
|
+
subscribe(onChange: () => void): () => void;
|
|
452
|
+
getSnapshot(): ITuiChannelSnapshot;
|
|
453
|
+
getCommandQueryPort(): ITuiCommandQueryPort;
|
|
454
|
+
getSessionUiEventPort(): ITuiSessionUiEventPort;
|
|
455
|
+
getRuntimeStatusSnapshot(fallbackPermissionMode: TPermissionMode): ITuiRuntimeStatusSnapshot;
|
|
456
|
+
addEntry(entry: IHistoryEntry): void;
|
|
457
|
+
abort(): void;
|
|
458
|
+
cancelQueue(): void;
|
|
459
|
+
stopWaitingSelfPacedLoop(): Promise<void>;
|
|
460
|
+
shutdown(options?: {
|
|
461
|
+
reason?: TSessionEndReason;
|
|
462
|
+
timeoutMs?: number;
|
|
463
|
+
}): Promise<void>;
|
|
464
|
+
selectExecutionWorkspaceEntry(entryId: string): void;
|
|
465
|
+
readExecutionWorkspaceDetail(entryId: string): Promise<IExecutionDetailPage>;
|
|
466
|
+
sendAgentJob(taskId: string, input: string): Promise<void>;
|
|
467
|
+
setSessionName(name: string): void;
|
|
468
|
+
/**
|
|
469
|
+
* Queue an ask and resolve when the user answers. Reached via the `ask_request` event handler
|
|
470
|
+
* (which passes the framework prompt `id` for co-drive dismissal) and by any direct
|
|
471
|
+
* `IInteractionChannel.askUser` caller (no id).
|
|
472
|
+
*/
|
|
473
|
+
askUser(request: IActionRequest, id?: string): Promise<TActionResponse>;
|
|
474
|
+
/** Called by App's PendingActionPrompt when the user answers (or cancels) the pending action. */
|
|
475
|
+
resolveUserAction(request: IActionRequest, response: TActionResponse): void;
|
|
476
|
+
/** Resolve every queued/in-flight ask as cancelled (abort, shutdown). */
|
|
477
|
+
private cancelAllUserActions;
|
|
478
|
+
handleInput(input: string): Promise<void>;
|
|
479
|
+
private handleSlashCommand;
|
|
480
|
+
private handlePermissionRequest;
|
|
481
|
+
/**
|
|
482
|
+
* REMOTE-007 co-drive: another surface answered the prompt with this framework `id`, so dismiss the
|
|
483
|
+
* still-showing local dialog. Resolving the local entry (cancelled) is a no-op on the framework side
|
|
484
|
+
* — that id is already settled — but it clears the TUI's queue + render state.
|
|
485
|
+
*/
|
|
486
|
+
private dismissPromptById;
|
|
487
|
+
/**
|
|
488
|
+
* Resolve every queued/in-flight permission request as `false` (deny) — abort, cancelQueue,
|
|
489
|
+
* shutdown, stop. Symmetric to `cancelAllUserActions()`: tearing down must neither leave a tool's
|
|
490
|
+
* permission promise dangling (the tool would hang) nor silently grant it (CLI-075 RUNTIME-32).
|
|
491
|
+
*/
|
|
492
|
+
private cancelAllPermissions;
|
|
493
|
+
private handleAutoNaming;
|
|
494
|
+
private syncRestoredHistory;
|
|
495
|
+
private startInitCheck;
|
|
496
|
+
/** Throws while the session is not ready; the init poller classifies the error. */
|
|
497
|
+
private runInitCheck;
|
|
498
|
+
/** SCREEN-1992: the recap lands in this channel's notice store; no source ⇒ no coordinator. */
|
|
499
|
+
private createAttention;
|
|
500
|
+
private onInitFailure;
|
|
501
|
+
private stopInitCheck;
|
|
502
|
+
private syncExecutionWorkspace;
|
|
503
|
+
}
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/keybindings/keybinding-catalogue.d.ts
|
|
506
|
+
declare const KEYBINDING_ACTIONS: {
|
|
507
|
+
readonly app: readonly ["open-workspace-switcher"];
|
|
508
|
+
readonly thinking: readonly ["abort"];
|
|
509
|
+
readonly 'background-detail': readonly ["return-to-main"];
|
|
510
|
+
readonly recovery: readonly ["retry"];
|
|
511
|
+
readonly 'chat-input': readonly ["submit", "history-previous", "history-next", "history-search", "cursor-left", "cursor-right", "delete-backward", "delete-word", "delete-line"];
|
|
512
|
+
readonly 'text-input': readonly ["submit", "cursor-left", "cursor-right", "cursor-up", "cursor-down", "delete-backward", "delete-word", "delete-line"];
|
|
513
|
+
readonly 'autocomplete-menu': readonly ["previous", "next", "close", "accept", "execute"];
|
|
514
|
+
readonly 'queued-prompt': readonly ["cancel"];
|
|
515
|
+
readonly 'confirm-prompt': readonly ["previous", "next", "confirm", "choose-yes", "choose-no"];
|
|
516
|
+
readonly 'permission-prompt': readonly ["previous", "next", "confirm", "allow-once", "allow-session", "allow-project", "deny"];
|
|
517
|
+
readonly 'text-prompt': readonly ["submit", "cancel", "delete-backward"];
|
|
518
|
+
readonly 'list-picker': readonly ["previous", "next", "select", "cancel"];
|
|
519
|
+
readonly 'menu-select': readonly ["previous", "next", "select", "back"];
|
|
520
|
+
readonly 'multi-select': readonly ["previous", "next", "toggle", "confirm", "cancel"];
|
|
521
|
+
readonly 'workspace-switcher': readonly ["previous", "next", "select", "close", "attach"];
|
|
522
|
+
readonly 'background-list': readonly ["previous", "next", "open", "close"];
|
|
523
|
+
readonly 'transport-settings': readonly ["previous", "next", "toggle", "close"];
|
|
524
|
+
/** SCREEN-1993: the reverse prompt-history search overlay. */
|
|
525
|
+
readonly 'history-search': readonly ["previous", "next", "cycle-scope", "insert", "execute", "cancel"];
|
|
526
|
+
/**
|
|
527
|
+
* SCREEN-2002: the theme picker. Navigation PREVIEWS; only `select` applies. Printable keys are
|
|
528
|
+
* fine here because the picker takes no text.
|
|
529
|
+
*/
|
|
530
|
+
readonly 'theme-picker': readonly ["previous", "next", "select", "toggle-syntax", "toggle-motion", "cancel"];
|
|
531
|
+
};
|
|
532
|
+
type TKeybindingContext = keyof typeof KEYBINDING_ACTIONS;
|
|
533
|
+
type TKeybindingAction<TContext extends TKeybindingContext = TKeybindingContext> = (typeof KEYBINDING_ACTIONS)[TContext][number];
|
|
534
|
+
//#endregion
|
|
535
|
+
//#region src/keybindings/keybinding-registry.d.ts
|
|
536
|
+
interface IKeybindingWarning {
|
|
537
|
+
readonly code: 'multiplexer-conflict' | 'modifier-delivery';
|
|
538
|
+
readonly path: string;
|
|
539
|
+
readonly message: string;
|
|
540
|
+
}
|
|
541
|
+
interface IKeybindingDiagnostic {
|
|
542
|
+
readonly file: string;
|
|
543
|
+
readonly path: string;
|
|
544
|
+
readonly message: string;
|
|
545
|
+
}
|
|
546
|
+
interface IKeybindingSnapshot {
|
|
547
|
+
readonly generation: number;
|
|
548
|
+
readonly sourcePath: string;
|
|
549
|
+
readonly bindings: Readonly<Record<TKeybindingContext, Readonly<Record<string, readonly string[]>>>>;
|
|
550
|
+
readonly warnings: readonly IKeybindingWarning[];
|
|
551
|
+
readonly diagnostic?: IKeybindingDiagnostic;
|
|
552
|
+
}
|
|
553
|
+
//#endregion
|
|
554
|
+
//#region src/keybindings/node-keybindings-source.d.ts
|
|
555
|
+
interface IKeybindingsFilePort {
|
|
556
|
+
ensureFile(): Promise<string>;
|
|
557
|
+
}
|
|
558
|
+
interface IKeybindingsSource extends IKeybindingsFilePort {
|
|
559
|
+
readonly filePath: string;
|
|
560
|
+
start(): Promise<void>;
|
|
561
|
+
isStarted(): boolean;
|
|
562
|
+
getSnapshot(): IKeybindingSnapshot;
|
|
563
|
+
subscribe(listener: (snapshot: IKeybindingSnapshot) => void): () => void;
|
|
564
|
+
dispose(): void;
|
|
565
|
+
}
|
|
566
|
+
interface INodeKeybindingsSourceOptions {
|
|
567
|
+
readonly filePath: string;
|
|
568
|
+
readonly schemaUrl: string;
|
|
569
|
+
readonly onDiagnostic?: (diagnostic: IKeybindingDiagnostic) => void;
|
|
570
|
+
}
|
|
571
|
+
declare function createNodeKeybindingsSource(options: INodeKeybindingsSourceOptions): IKeybindingsSource;
|
|
572
|
+
//#endregion
|
|
573
|
+
//#region src/screen-reader-announcement.d.ts
|
|
574
|
+
/**
|
|
575
|
+
* CLI-2004 — the first line the process prints.
|
|
576
|
+
*
|
|
577
|
+
* Two mutually exclusive lines, and never more than one:
|
|
578
|
+
* - the mode is ON → `[Screen reader mode: on via flag|env|settings]`. It is the only
|
|
579
|
+
* self-diagnostic in the design: when someone reports "I passed the flag and nothing changed",
|
|
580
|
+
* this line says whether the mode is on and which input turned it on.
|
|
581
|
+
* - the mode is OFF and the environment looks like a reader is present → one advisory line naming
|
|
582
|
+
* the flag. That is the whole of this project's answer to the auto-detection question: opt-in
|
|
583
|
+
* keeps determinism, and a false positive costs one line of text instead of reshaping a sighted
|
|
584
|
+
* user's interface.
|
|
585
|
+
*
|
|
586
|
+
* Printed before Ink's first frame and never during a turn, so it cannot interleave with output a
|
|
587
|
+
* reader is consuming.
|
|
588
|
+
*/
|
|
589
|
+
/** Which input turned the mode on. Mirrors the CLI resolver's channel. */
|
|
590
|
+
type TScreenReaderChannel = 'flag' | 'env' | 'settings';
|
|
591
|
+
//#endregion
|
|
592
|
+
//#region src/theme/theme-contracts.d.ts
|
|
593
|
+
/**
|
|
594
|
+
* SCREEN-2002 — the TUI's one theme token model.
|
|
595
|
+
*
|
|
596
|
+
* Before this, five things decided a colour: `PALETTE` (Ink names), `ANSI` (raw SGR for the markdown
|
|
597
|
+
* pipeline), `marked-terminal`'s own chalk defaults, `cli-highlight`'s `DEFAULT_THEME`, and a handful
|
|
598
|
+
* of `chalk.<name>` calls. A theme that rewrote only the first two would leave a daltonized run with
|
|
599
|
+
* red/green code blocks, because `cli-highlight` falls back PER KEY to its own theme. So the model
|
|
600
|
+
* carries every group a renderer reads, and the style builder derives every encoding from it through
|
|
601
|
+
* chalk — which is exactly what Ink's own `colorize` does, so no mapping layer is invented.
|
|
602
|
+
*
|
|
603
|
+
* Values use INK'S colour grammar verbatim (`<chalk name> | #rrggbb | ansi256(n) | rgb(r,g,b)`), so a
|
|
604
|
+
* theme file, a built-in and a component all speak one language and the grammar doubles as the
|
|
605
|
+
* injection floor: no raw escape sequence can enter through a theme.
|
|
606
|
+
*/
|
|
607
|
+
/** A colour in Ink's grammar. Validated at the boundary, never parsed twice. */
|
|
608
|
+
type TThemeColor = string;
|
|
609
|
+
/** Foreground and border roles every Ink component reads. */
|
|
610
|
+
interface IThemeColors {
|
|
611
|
+
readonly text: {
|
|
612
|
+
readonly accent: TThemeColor;
|
|
613
|
+
readonly emphasis: TThemeColor;
|
|
614
|
+
readonly success: TThemeColor;
|
|
615
|
+
readonly warning: TThemeColor;
|
|
616
|
+
readonly error: TThemeColor;
|
|
617
|
+
readonly session: TThemeColor;
|
|
618
|
+
readonly muted: TThemeColor;
|
|
619
|
+
readonly onAccent: TThemeColor;
|
|
620
|
+
};
|
|
621
|
+
readonly border: {
|
|
622
|
+
readonly attention: TThemeColor;
|
|
623
|
+
readonly focused: TThemeColor;
|
|
624
|
+
readonly active: TThemeColor;
|
|
625
|
+
readonly muted: TThemeColor;
|
|
626
|
+
readonly error: TThemeColor;
|
|
627
|
+
};
|
|
628
|
+
readonly status: {
|
|
629
|
+
readonly running: TThemeColor;
|
|
630
|
+
readonly success: TThemeColor;
|
|
631
|
+
readonly error: TThemeColor;
|
|
632
|
+
readonly denied: TThemeColor;
|
|
633
|
+
readonly waiting: TThemeColor;
|
|
634
|
+
readonly cancelled: TThemeColor;
|
|
635
|
+
readonly idle: TThemeColor;
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Every key `marked-terminal` colours by default, including `html` — a key left out would keep that
|
|
640
|
+
* dependency's own gray under every theme.
|
|
641
|
+
*
|
|
642
|
+
* Deliberately absent, because they carry no colour today and giving them one would change rendering
|
|
643
|
+
* rather than theme it: `strong` (`chalk.bold`), `em` (`chalk.italic`), `listitem` and `hr`
|
|
644
|
+
* (`chalk.reset`), and a diff's `diff `/`index ` metadata rows, which this package writes itself as
|
|
645
|
+
* dim over the inherited foreground.
|
|
646
|
+
*/
|
|
647
|
+
interface IThemeMarkdown {
|
|
648
|
+
readonly heading: TThemeColor;
|
|
649
|
+
readonly firstHeading: TThemeColor;
|
|
650
|
+
readonly code: TThemeColor;
|
|
651
|
+
readonly codespan: TThemeColor;
|
|
652
|
+
readonly link: TThemeColor;
|
|
653
|
+
readonly href: TThemeColor;
|
|
654
|
+
readonly blockquote: TThemeColor;
|
|
655
|
+
readonly del: TThemeColor;
|
|
656
|
+
readonly html: TThemeColor;
|
|
657
|
+
readonly diffAdded: TThemeColor;
|
|
658
|
+
readonly diffRemoved: TThemeColor;
|
|
659
|
+
readonly diffAddedBackground: TThemeColor;
|
|
660
|
+
readonly diffRemovedBackground: TThemeColor;
|
|
661
|
+
readonly diffHunk: TThemeColor;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* `cli-highlight`'s seventeen coloured keys, ALL REQUIRED. Its `colorizeNode` reads
|
|
665
|
+
* `theme[token] || DEFAULT_THEME[token] || plain`, so one missing key restores that dependency's
|
|
666
|
+
* red/green pair — the exact thing a daltonized theme exists to remove.
|
|
667
|
+
*/
|
|
668
|
+
interface IThemeSyntax {
|
|
669
|
+
readonly keyword: TThemeColor;
|
|
670
|
+
readonly built_in: TThemeColor;
|
|
671
|
+
readonly type: TThemeColor;
|
|
672
|
+
readonly literal: TThemeColor;
|
|
673
|
+
readonly number: TThemeColor;
|
|
674
|
+
readonly regexp: TThemeColor;
|
|
675
|
+
readonly string: TThemeColor;
|
|
676
|
+
readonly class: TThemeColor;
|
|
677
|
+
readonly function: TThemeColor;
|
|
678
|
+
readonly comment: TThemeColor;
|
|
679
|
+
readonly doctag: TThemeColor;
|
|
680
|
+
readonly meta: TThemeColor;
|
|
681
|
+
readonly tag: TThemeColor;
|
|
682
|
+
readonly name: TThemeColor;
|
|
683
|
+
readonly attr: TThemeColor;
|
|
684
|
+
readonly addition: TThemeColor;
|
|
685
|
+
readonly deletion: TThemeColor;
|
|
686
|
+
}
|
|
687
|
+
/** The colour ramp of the package's one animation. Cadence is not themed. */
|
|
688
|
+
interface IThemeMotion {
|
|
689
|
+
readonly wave: readonly [TThemeColor, TThemeColor, TThemeColor, TThemeColor];
|
|
690
|
+
}
|
|
691
|
+
type TThemeAppearance = 'dark' | 'light';
|
|
692
|
+
type TThemeSource = 'built-in' | 'user' | 'plugin';
|
|
693
|
+
interface ITuiTheme {
|
|
694
|
+
/** `dark`, `light`, `dark-daltonized`, `light-daltonized`, `custom:<slug>`, `custom:<plugin>:<slug>`. */
|
|
695
|
+
readonly id: string;
|
|
696
|
+
readonly name: string;
|
|
697
|
+
readonly appearance: TThemeAppearance;
|
|
698
|
+
readonly source: TThemeSource;
|
|
699
|
+
readonly colors: IThemeColors;
|
|
700
|
+
readonly markdown: IThemeMarkdown;
|
|
701
|
+
readonly syntax: IThemeSyntax;
|
|
702
|
+
readonly motion: IThemeMotion;
|
|
703
|
+
}
|
|
704
|
+
//#endregion
|
|
705
|
+
//#region src/theme/built-in-themes.d.ts
|
|
706
|
+
/**
|
|
707
|
+
* The catalogue, as a function rather than the array itself. A caller outside `src/theme/` — the
|
|
708
|
+
* theme registry a picker reads — needs to ENUMERATE the built-ins, which is a different act from
|
|
709
|
+
* reaching into one of them for a colour; the floor refuses the second by refusing the DATA's names,
|
|
710
|
+
* so the first gets an accessor of its own instead of an exemption.
|
|
711
|
+
*/
|
|
712
|
+
declare function listBuiltInThemes(): readonly ITuiTheme[];
|
|
713
|
+
//#endregion
|
|
714
|
+
//#region src/theme/theme-registry.d.ts
|
|
715
|
+
/**
|
|
716
|
+
* A theme file that was found and refused. It is carried BESIDE the themes rather than among them,
|
|
717
|
+
* because a surface must be able to show the file without ever resolving to it — an id that can be
|
|
718
|
+
* listed and cannot be applied is the shape of the bug this avoids.
|
|
719
|
+
*/
|
|
720
|
+
interface IThemeSkip {
|
|
721
|
+
/**
|
|
722
|
+
* The id the file WOULD have had, so a `/theme <id>` that fails has a visible reason — or, when
|
|
723
|
+
* the file's own NAME is what made an id impossible, the quoted name in its place. It is a label,
|
|
724
|
+
* not a key: two files can carry the same one.
|
|
725
|
+
*/
|
|
726
|
+
readonly id: string;
|
|
727
|
+
readonly fileName: string;
|
|
728
|
+
/** The path-named diagnostic, verbatim from `parseThemeDocument`. */
|
|
729
|
+
readonly reason: string;
|
|
730
|
+
}
|
|
731
|
+
interface IThemeResolution {
|
|
732
|
+
readonly theme: ITuiTheme;
|
|
733
|
+
/** The id that was asked for and not found. Absent ⇒ the request was satisfied. */
|
|
734
|
+
readonly unknownId?: string;
|
|
735
|
+
}
|
|
736
|
+
interface IThemeRegistry {
|
|
737
|
+
list(): readonly ITuiTheme[];
|
|
738
|
+
get(id: string): ITuiTheme | undefined;
|
|
739
|
+
/** The theme for an id, falling back to the default and NAMING what it could not find. */
|
|
740
|
+
resolve(id: string | undefined): IThemeResolution;
|
|
741
|
+
/** The theme files that were found and refused, with the reason each was refused for. */
|
|
742
|
+
skipped(): readonly IThemeSkip[];
|
|
743
|
+
}
|
|
744
|
+
declare function createThemeRegistry(themes?: readonly ITuiTheme[], skipped?: readonly IThemeSkip[]): IThemeRegistry;
|
|
745
|
+
interface IThemeCataloguePortOptions {
|
|
746
|
+
readonly registry: IThemeRegistry;
|
|
747
|
+
/**
|
|
748
|
+
* Re-read on every call, not captured once: `/theme` reports what is PERSISTED, and the host
|
|
749
|
+
* applies a patch by writing the settings document. A snapshot would answer with the appearance
|
|
750
|
+
* the process started with, so the command would report the change it just made as not having
|
|
751
|
+
* happened.
|
|
752
|
+
*/
|
|
753
|
+
readonly readAppearance: () => IThemeAppearanceState['settings'];
|
|
754
|
+
/**
|
|
755
|
+
* The pin on reduced motion for this run, when something above the settings applied one — WHICH
|
|
756
|
+
* tier and WHAT it pinned, as one value. Two optional fields would let a caller supply the tier
|
|
757
|
+
* alone, and a default for the missing half is exactly the wrong answer this pair exists to stop:
|
|
758
|
+
* `--no-reduced-motion` is an override too and pins the opposite value.
|
|
759
|
+
*/
|
|
760
|
+
readonly reducedMotionPin?: {
|
|
761
|
+
readonly tier: TReducedMotionOverride;
|
|
762
|
+
readonly reducedMotion: boolean;
|
|
763
|
+
} | undefined;
|
|
764
|
+
}
|
|
765
|
+
declare function createThemeCataloguePort(options: IThemeCataloguePortOptions): IThemeCataloguePort;
|
|
766
|
+
//#endregion
|
|
767
|
+
//#region src/tui-cli-adapter.d.ts
|
|
768
|
+
/**
|
|
769
|
+
* CLI seam injected into the renderer.
|
|
770
|
+
*
|
|
771
|
+
* CMD-004 Phase 2 Stage C: READ-ONLY toward settings — the renderer re-reads the persisted
|
|
772
|
+
* settings document for display (statusline refresh-on-result) but never writes it. All settings
|
|
773
|
+
* mutations are host actions executed by the session layer via `ICommandHostAdapters`.
|
|
774
|
+
*/
|
|
775
|
+
interface ITuiCliAdapter {
|
|
776
|
+
getUserSettingsPath(): string;
|
|
777
|
+
readSettings(path: string): Record<string, TUniversalValue>;
|
|
778
|
+
reloadPluginCommandSource(registry: CommandRegistry): void;
|
|
779
|
+
applyActiveModelChange(cwd: string, modelId: string, options?: {
|
|
780
|
+
providerOverride?: string;
|
|
781
|
+
}): {
|
|
782
|
+
applied: boolean;
|
|
783
|
+
};
|
|
784
|
+
getGitBranch(cwd: string): string | undefined;
|
|
785
|
+
getProviderDisplayName(type: string): string;
|
|
786
|
+
/** Optional host-owned command shown when a completed fork can be reopened outside the TUI. */
|
|
787
|
+
formatResumeCommand?: (sessionId: string) => string;
|
|
788
|
+
}
|
|
789
|
+
//#endregion
|
|
790
|
+
//#region src/render.d.ts
|
|
791
|
+
interface IRenderOptions {
|
|
792
|
+
cwd: string;
|
|
793
|
+
livePromptTrace?: ILivePromptTracePort;
|
|
794
|
+
/** Product identity for terminal labels, title, and host-facing copy. */
|
|
795
|
+
productDisplayName?: string;
|
|
796
|
+
modelCommandToolPrefix?: string;
|
|
797
|
+
subagentHookEnvironmentNames?: ICreateSessionOptions['subagentHookEnvironmentNames'];
|
|
798
|
+
observerFailureWarningCode?: ICreateSessionOptions['observerFailureWarningCode'];
|
|
799
|
+
commandHookShell?: string;
|
|
800
|
+
/** Skip instruction files and plugin discovery (`--safe-mode`). */
|
|
801
|
+
bare?: boolean;
|
|
802
|
+
/** Run no hook the settings layers declare (`--safe-mode`). */
|
|
803
|
+
skipConfiguredHooks?: boolean;
|
|
804
|
+
promptFileReferenceTag?: string;
|
|
805
|
+
provider: IAIProvider;
|
|
806
|
+
providerErrorGuidance?: IProviderErrorGuidance;
|
|
807
|
+
projectAccess?: TWorkspaceProjectAccess;
|
|
808
|
+
projectSettingsPaths?: readonly IProjectSettingsPath[];
|
|
809
|
+
baselinePermissionAllow?: readonly string[];
|
|
810
|
+
/** Host-selected task-context root; absent means no framework task-directory scan. */
|
|
811
|
+
taskContext?: {
|
|
812
|
+
readonly enabled?: boolean;
|
|
813
|
+
readonly dir?: string;
|
|
814
|
+
};
|
|
815
|
+
contributionSources?: readonly IContributionSource[];
|
|
816
|
+
skillRoots?: readonly ISkillRootDescriptor[];
|
|
817
|
+
userSettingsSources?: readonly INodeHostSettingsSource[];
|
|
818
|
+
/**
|
|
819
|
+
* CLI-083 (issue #2287) — the org policy, forwarded to the session so `blockedCommands` is
|
|
820
|
+
* enforced on the plain `robota` path as well as under `--serve`.
|
|
821
|
+
*
|
|
822
|
+
* DECLARED, not merely spread through. The shell forwards this with
|
|
823
|
+
* `...(orgPolicy === null ? {} : { orgPolicy })`, and a spread bypasses TypeScript's
|
|
824
|
+
* excess-property check — so before this field existed the value compiled, arrived, and was
|
|
825
|
+
* dropped by `toChannelOptions` below, which copies field by field. The idiom that looked safest
|
|
826
|
+
* is what disabled the one check that would have caught the missing declaration.
|
|
827
|
+
*/
|
|
828
|
+
orgPolicy?: IOrgPolicy | undefined;
|
|
829
|
+
/** Explicit authority- and permission-backed edit checkpoint capability. */
|
|
830
|
+
editCheckpointStore?: EditCheckpointStore;
|
|
831
|
+
providerOverride?: string | undefined;
|
|
832
|
+
/**
|
|
833
|
+
* #1844: forwarded to the session so `/provider switch` can construct the provider it switches TO.
|
|
834
|
+
*
|
|
835
|
+
* The session cannot discover these — they are assembled at the composition root from the provider
|
|
836
|
+
* packages. Without them the hot-swap throws with an empty supported-list, which is the failure
|
|
837
|
+
* this option exists to prevent rather than a nicety.
|
|
838
|
+
*/
|
|
839
|
+
providerDefinitions?: readonly IProviderDefinition[];
|
|
840
|
+
providerType?: string | undefined;
|
|
841
|
+
modelId?: string;
|
|
842
|
+
/** CLI-1988: resolved provider-neutral response style. */
|
|
843
|
+
outputStyle?: IOutputStylePrompt;
|
|
844
|
+
/** ARCH-013: resolved preset effort, forwarded to the session's `effort` seam. */
|
|
845
|
+
effort?: ITuiInteractionChannelOptions['effort'];
|
|
846
|
+
temperature?: number;
|
|
847
|
+
maxOutputTokens?: number;
|
|
848
|
+
/** Preset prompt seed, distinct from the replacing `systemPrompt` option. */
|
|
849
|
+
presetSystemPrompt?: string;
|
|
850
|
+
/** CLI-sourced additive prompt text, composed before the TUI is rendered. */
|
|
851
|
+
appendSystemPrompt?: string;
|
|
852
|
+
responseFormat?: ITuiInteractionChannelOptions['responseFormat'];
|
|
853
|
+
language?: string;
|
|
854
|
+
permissionMode?: TPermissionMode;
|
|
855
|
+
maxTurns?: number;
|
|
856
|
+
allowedTools?: readonly string[];
|
|
857
|
+
deniedTools?: readonly string[];
|
|
858
|
+
version?: string;
|
|
859
|
+
sessionStore?: IInteractiveSessionStore;
|
|
860
|
+
disableSessionLoops?: boolean;
|
|
861
|
+
resolveDefaultLoopPrompt?: () => string;
|
|
862
|
+
resumeSessionId?: string;
|
|
863
|
+
showSessionPickerOnStart?: boolean;
|
|
864
|
+
/** FLOW-2006: text a deep link prefilled into the composer. Never submitted on its own. */
|
|
865
|
+
initialInput?: string;
|
|
866
|
+
/** Where that text came from; `external-link` renders the provenance notice. */
|
|
867
|
+
initialInputOrigin?: 'external-link';
|
|
868
|
+
forkSession?: boolean;
|
|
869
|
+
/** Issue #3081: the startup session is the target of a `/cd` from this directory. */
|
|
870
|
+
workspaceMovedFrom?: string;
|
|
871
|
+
sessionName?: string;
|
|
872
|
+
backgroundTaskRunners?: IBackgroundTaskRunner[];
|
|
873
|
+
/** MCP-004: the tool-call handoff policy the composition root computed for this runtime. */
|
|
874
|
+
toolCallHandoff?: IToolCallHandoffPolicy;
|
|
875
|
+
subagentRunnerFactory?: TSubagentRunnerFactory;
|
|
876
|
+
/**
|
|
877
|
+
* ARCH-005: subagent definitions contributed by the composition root (the capability packs
|
|
878
|
+
* `assembleProduct` merged). Forwarded to the session's `agentDefinitions` seam; absent ⇒ unchanged.
|
|
879
|
+
*/
|
|
880
|
+
agentDefinitions?: readonly IAgentDefinition[];
|
|
881
|
+
agentDefinitionRoots?: readonly string[];
|
|
882
|
+
pluginDirectories?: {
|
|
883
|
+
readonly user?: string;
|
|
884
|
+
readonly project?: string;
|
|
885
|
+
};
|
|
886
|
+
/**
|
|
887
|
+
* ARCH-006: tools contributed by the composition root (the capability packs `assembleProduct` merged)
|
|
888
|
+
* and, when the profile hands the packs the whole tool surface, the suppressed framework default tier
|
|
889
|
+
* (`defaultTools: []`). Forwarded to the session's tool-composition seam; absent ⇒ unchanged.
|
|
890
|
+
*/
|
|
891
|
+
additionalTools?: IToolWithEventService[];
|
|
892
|
+
defaultTools?: readonly IToolWithEventService[];
|
|
893
|
+
commandModules?: readonly ICommandModule[];
|
|
894
|
+
commandHostAdapters?: ICommandHostAdapters;
|
|
895
|
+
shellExec?: TShellExecFn;
|
|
896
|
+
/** REMOTE-006: optional remote-command policy (allow-by-default; local == remote). */
|
|
897
|
+
remoteCommandPolicy?: IRemoteCommandPolicy;
|
|
898
|
+
startupUpdateNotice?: Promise<string | undefined>;
|
|
899
|
+
transportRegistry?: ITransportRegistryView;
|
|
900
|
+
bindTransports?: ITuiInteractionChannelOptions['bindTransports'];
|
|
901
|
+
cliAdapter: ITuiCliAdapter;
|
|
902
|
+
reloadPluginCommandSource?: (registry: CommandRegistry) => void;
|
|
903
|
+
agentName?: string;
|
|
904
|
+
/** Active preset id selected at startup (PRESET-011 runtime state). Defaults to 'default'. */
|
|
905
|
+
activePresetId?: string;
|
|
906
|
+
/** Preset persona block composed as a `source: 'persona'` system-prompt section (priority 5). */
|
|
907
|
+
persona?: string;
|
|
908
|
+
/** Preset execution capability: activate agent runtime + subagent/background dispatch. */
|
|
909
|
+
enableParallelSubagents?: boolean;
|
|
910
|
+
/** Preset execution capability: run a post-task self-verification step. */
|
|
911
|
+
selfVerification?: boolean;
|
|
912
|
+
/**
|
|
913
|
+
* Called with each live channel (including session-switch re-creations). Lets the embedding
|
|
914
|
+
* product wire process-level concerns (ERR-001 G1: error routing into the live session).
|
|
915
|
+
*/
|
|
916
|
+
onChannelReady?: (channel: TuiInteractionChannel) => void;
|
|
917
|
+
/**
|
|
918
|
+
* SELFHOST-008 P6: optional durable-memory store injected by the surface (agent-cli). Forwarded to the
|
|
919
|
+
* channel → `buildRuntimeSession`; absent ⇒ memory OFF (today's behavior). Enablement is surface-owned.
|
|
920
|
+
*/
|
|
921
|
+
memoryStore?: IMemoryStore;
|
|
922
|
+
/** SELFHOST-008 P6: optional automatic post-turn capture policy (absent ⇒ capture OFF). */
|
|
923
|
+
automaticMemory?: IAutomaticMemoryConfig;
|
|
924
|
+
/** SELFHOST-008 P6: optional per-turn recall policy (absent ⇒ recall OFF, startup-only injection). */
|
|
925
|
+
recallMemory?: IPerTurnRecallConfig;
|
|
926
|
+
/**
|
|
927
|
+
* CLI-2004: the resolved screen-reader mode. DECLARED, not spread through — `toChannelOptions`
|
|
928
|
+
* below copies field by field, so an undeclared field compiles, arrives and is silently dropped
|
|
929
|
+
* (the ARCH-110 containment hazard the `orgPolicy` comment above records). Absent ⇒ mode OFF and
|
|
930
|
+
* today's byte stream is unchanged.
|
|
931
|
+
*/
|
|
932
|
+
screenReader?: boolean | undefined;
|
|
933
|
+
/** Host-selected raw timing overrides; absent values use the renderer's defaults. */
|
|
934
|
+
screenReaderPacing?: IScreenReaderPacingOverrides;
|
|
935
|
+
/** Host-selected cursor and turn-mark overrides; absent values use terminal detection. */
|
|
936
|
+
terminalCapabilities?: ITerminalCapabilityOverrides;
|
|
937
|
+
/** CLI-2004: which input turned the mode on — printed in the confirmation line. */
|
|
938
|
+
screenReaderChannel?: TScreenReaderChannel | undefined;
|
|
939
|
+
/** CLI-2004: mode off, but the environment suggests a reader is running ⇒ one advisory line. */
|
|
940
|
+
screenReaderHint?: boolean | undefined;
|
|
941
|
+
/** BEHAVIOR-2003: one watched source shared with the optional `/keybindings` command. */
|
|
942
|
+
keybindingsSource?: IKeybindingsSource;
|
|
943
|
+
/**
|
|
944
|
+
* SCREEN-2002: the theme catalogue this run renders from, shared with the optional `/theme`
|
|
945
|
+
* command. DECLARED, not spread — see the `screenReader` note above. Absent ⇒ the built-ins.
|
|
946
|
+
*/
|
|
947
|
+
themeRegistry?: IThemeRegistry;
|
|
948
|
+
/** SCREEN-2002: reduced motion as the product shell resolved it (settings ← env ← flag). */
|
|
949
|
+
reducedMotion?: boolean | undefined;
|
|
950
|
+
/** SCREEN-2002: which tier decided it, when that was not the settings. */
|
|
951
|
+
reducedMotionOverride?: TReducedMotionOverride | undefined;
|
|
952
|
+
/**
|
|
953
|
+
* SCREEN-1992: the focus-reporting override the product shell resolved from its own environment.
|
|
954
|
+
* `true` forces DECSET 1004 on, `false` is the kill switch, absent ⇒ on for an interactive TTY.
|
|
955
|
+
*/
|
|
956
|
+
focusReporting?: boolean | undefined;
|
|
957
|
+
/**
|
|
958
|
+
* SCREEN-1993: prompt history, resolved by the product shell. `promptHistory` is the session-side
|
|
959
|
+
* writer (forwarded to the channel like `memoryStore`); `promptHistorySource` and
|
|
960
|
+
* `promptHistoryProject` feed the input area's Ctrl+R search. DECLARED, not spread through — the
|
|
961
|
+
* projection below copies field by field. Absent ⇒ nothing is written and `ctrl+r` is inert.
|
|
962
|
+
*/
|
|
963
|
+
promptHistory?: IPromptHistoryOptions;
|
|
964
|
+
promptHistorySource?: IPromptHistorySource;
|
|
965
|
+
promptHistoryProject?: string;
|
|
966
|
+
}
|
|
967
|
+
declare function renderApp(options: IRenderOptions): Promise<void>;
|
|
968
|
+
//#endregion
|
|
969
|
+
//#region src/SupervisedSessionView.d.ts
|
|
970
|
+
interface ISupervisedViewRow {
|
|
971
|
+
readonly id: string;
|
|
972
|
+
readonly liveness: 'alive' | 'dead' | 'unknown';
|
|
973
|
+
readonly control: 'available' | 'unavailable';
|
|
974
|
+
readonly activity: 'working' | 'needs-input' | 'idle' | 'unknown';
|
|
975
|
+
readonly nextLoopAt?: string;
|
|
976
|
+
readonly name?: string;
|
|
977
|
+
readonly cwd?: string;
|
|
978
|
+
readonly pr?: {
|
|
979
|
+
readonly url: string;
|
|
980
|
+
readonly host: string;
|
|
981
|
+
readonly number: number;
|
|
982
|
+
readonly kind: 'pull' | 'merge-request';
|
|
983
|
+
};
|
|
984
|
+
readonly problem?: 'invalid-registration';
|
|
985
|
+
}
|
|
986
|
+
interface ISupervisedSessionViewProps {
|
|
987
|
+
readonly loadRows: (signal: AbortSignal) => Promise<readonly ISupervisedViewRow[]>;
|
|
988
|
+
readonly onStop?: (id: string) => Promise<void>;
|
|
989
|
+
readonly onStart?: () => Promise<string>;
|
|
990
|
+
readonly onOpenPr?: (id: string, url: string) => Promise<void>;
|
|
991
|
+
readonly filteredByCwd?: boolean;
|
|
992
|
+
readonly filteredByName?: boolean;
|
|
993
|
+
readonly filteredByPr?: boolean;
|
|
994
|
+
readonly stateFilter?: TGroup;
|
|
995
|
+
readonly refreshMs?: number;
|
|
996
|
+
}
|
|
997
|
+
declare const GROUP_ORDER: readonly ["needs-input", "working", "idle", "unknown", "unverified", "dead"];
|
|
998
|
+
type TGroup = typeof GROUP_ORDER[number];
|
|
999
|
+
declare function renderSupervisedSessionView(options: ISupervisedSessionViewProps & {
|
|
1000
|
+
readonly screenReader: boolean;
|
|
1001
|
+
readonly screenReaderChannel?: TScreenReaderChannel;
|
|
1002
|
+
readonly screenReaderHint?: boolean;
|
|
1003
|
+
}): Promise<void>;
|
|
1004
|
+
//#endregion
|
|
1005
|
+
//#region src/create-default-tui-cli-adapter.d.ts
|
|
1006
|
+
interface IDefaultTuiCliAdapterOptions {
|
|
1007
|
+
providerDefinitions: readonly IProviderDefinition[];
|
|
1008
|
+
reloadPluginCommandSource: (registry: CommandRegistry) => void;
|
|
1009
|
+
userSettingsPath: string;
|
|
1010
|
+
settingsSources: readonly TSettingsSource[];
|
|
1011
|
+
formatResumeCommand?: (sessionId: string) => string;
|
|
1012
|
+
}
|
|
1013
|
+
declare function createDefaultTuiCliAdapter({ providerDefinitions, reloadPluginCommandSource, userSettingsPath, settingsSources, formatResumeCommand }: IDefaultTuiCliAdapterOptions): ITuiCliAdapter;
|
|
1014
|
+
//#endregion
|
|
1015
|
+
//#region src/theme/theme-document.d.ts
|
|
1016
|
+
interface IThemeDocumentInput {
|
|
1017
|
+
/** The namespaced id the caller minted — `custom:<slug>` or `custom:<plugin>:<slug>`. */
|
|
1018
|
+
readonly id: string;
|
|
1019
|
+
/** The file's own name, for the `Skipped theme "<file>": …` line. */
|
|
1020
|
+
readonly fileName: string;
|
|
1021
|
+
readonly source: TThemeSource;
|
|
1022
|
+
readonly text: string;
|
|
1023
|
+
}
|
|
1024
|
+
type TThemeDocumentResult = {
|
|
1025
|
+
readonly ok: true;
|
|
1026
|
+
readonly theme: ITuiTheme;
|
|
1027
|
+
} | {
|
|
1028
|
+
readonly ok: false;
|
|
1029
|
+
readonly error: string;
|
|
1030
|
+
};
|
|
1031
|
+
/**
|
|
1032
|
+
* Untrusted text on its way into a line a terminal will print — the one escaping policy, exported
|
|
1033
|
+
* so the surfaces that build their OWN diagnostics use it rather than re-deriving it.
|
|
1034
|
+
*
|
|
1035
|
+
* A diagnostic is the one part of a refused file that reaches the terminal, and it quotes what was
|
|
1036
|
+
* wrong — so without this the injection floor the grammar provides is defeated by the message that
|
|
1037
|
+
* reports a violation of it. Escaped rather than stripped, because an author has to SEE what their
|
|
1038
|
+
* file contains (`"\u001b[31m"`) instead of a value that looks fine.
|
|
1039
|
+
*
|
|
1040
|
+
* `JSON.stringify` alone is NOT enough, and that is the whole reason this is a function: it escapes
|
|
1041
|
+
* U+0000–U+001F and leaves U+007F and the C1 range literal — including U+009B and U+009D, the
|
|
1042
|
+
* single-byte spellings of CSI and OSC. A terminal accepts both spellings (`sanitize-terminal-text.ts`
|
|
1043
|
+
* says so and handles both), so quoting only the 7-bit one leaves the 8-bit one's parameters
|
|
1044
|
+
* standing as a live sequence.
|
|
1045
|
+
*/
|
|
1046
|
+
declare function quoteThemeText(value: string): string;
|
|
1047
|
+
/**
|
|
1048
|
+
* The same escaping WITHOUT the surrounding quotes, for a field a caller already quotes — so a
|
|
1049
|
+
* refused file does not print as `Skipped theme ""My Theme.json"": …`.
|
|
1050
|
+
*/
|
|
1051
|
+
declare function escapeThemeText(value: string): string;
|
|
1052
|
+
/**
|
|
1053
|
+
* Prose a surface did not write — a dependency's message, a path from the environment. Sanitized
|
|
1054
|
+
* rather than quoted, because it is a sentence; `sanitizeTerminalText` removes both spellings of
|
|
1055
|
+
* every sequence, and the tab/newline it keeps are flattened so one diagnostic stays one line.
|
|
1056
|
+
*/
|
|
1057
|
+
declare function sanitizeThemeProse(message: string): string;
|
|
1058
|
+
/**
|
|
1059
|
+
* Parse one theme file. The `id`, the `source` and the `appearance` are NOT the document's to
|
|
1060
|
+
* decide: the id is minted from where the file was found so nothing can shadow a built-in, the
|
|
1061
|
+
* source is where it was read from, and the appearance follows the base a theme chose to extend.
|
|
1062
|
+
*/
|
|
1063
|
+
declare function parseThemeDocument(input: IThemeDocumentInput): TThemeDocumentResult;
|
|
1064
|
+
//#endregion
|
|
1065
|
+
export { type IDefaultTuiCliAdapterOptions, type IKeybindingDiagnostic, type IKeybindingSnapshot, type IKeybindingWarning, type IKeybindingsFilePort, type IKeybindingsSource, type INodeKeybindingsSourceOptions, type IRenderOptions, type IScreenReaderPacingOverrides, type ISupervisedSessionViewProps, type ISupervisedViewRow, type ITerminalCapabilityOverrides, type IThemeCataloguePortOptions, type IThemeDocumentInput, type IThemeRegistry, type IThemeResolution, type IThemeSkip, type ITuiCliAdapter, type ITuiCommandInteraction, type ITuiConfirmInteraction, type ITuiInteractionChannelOptions, type ITuiPickerInteraction, type ITuiPickerItem, type ITuiTheme, type TAnyTuiCommandInteraction, type TKeybindingAction, type TKeybindingContext, type TOnMissingArgsAction, type TScreenReaderChannel, type TThemeDocumentResult, type TThemeSource, TuiInteractionChannel, createDefaultTuiCliAdapter, createNodeKeybindingsSource, createThemeCataloguePort, createThemeRegistry, escapeThemeText, listBuiltInThemes, parseThemeDocument, quoteThemeText, renderApp, renderSupervisedSessionView, sanitizeThemeProse };
|
|
1066
|
+
//# sourceMappingURL=index.d.cts.map
|