nastech-tui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc +11 -0
- package/README.md +346 -0
- package/eslint.config.mjs +111 -0
- package/package.json +51 -0
- package/packages/nastech-ink/ambient.d.ts +83 -0
- package/packages/nastech-ink/index.d.ts +40 -0
- package/packages/nastech-ink/index.js +1 -0
- package/packages/nastech-ink/nastech-ink/ambient.d.ts +83 -0
- package/packages/nastech-ink/nastech-ink/index.d.ts +40 -0
- package/packages/nastech-ink/nastech-ink/index.js +1 -0
- package/packages/nastech-ink/nastech-ink/package.json +54 -0
- package/packages/nastech-ink/nastech-ink/src/bootstrap/state.ts +9 -0
- package/packages/nastech-ink/nastech-ink/src/entry-exports.ts +32 -0
- package/packages/nastech-ink/nastech-ink/src/hooks/use-stderr.ts +15 -0
- package/packages/nastech-ink/nastech-ink/src/hooks/use-stdout.ts +15 -0
- package/packages/nastech-ink/nastech-ink/src/ink/Ansi.tsx +435 -0
- package/packages/nastech-ink/nastech-ink/src/ink/app-mouse.test.ts +123 -0
- package/packages/nastech-ink/nastech-ink/src/ink/bidi.ts +145 -0
- package/packages/nastech-ink/nastech-ink/src/ink/cache-eviction.ts +45 -0
- package/packages/nastech-ink/nastech-ink/src/ink/clearTerminal.ts +68 -0
- package/packages/nastech-ink/nastech-ink/src/ink/colorize.test.ts +60 -0
- package/packages/nastech-ink/nastech-ink/src/ink/colorize.ts +277 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/AlternateScreen.tsx +133 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/App.tsx +830 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/AppContext.ts +20 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/Box.tsx +294 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/Button.tsx +236 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/ClockContext.tsx +133 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/CursorAdvanceContext.ts +35 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/CursorDeclarationContext.ts +28 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/ErrorOverview.tsx +130 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/Link.tsx +38 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/Newline.tsx +43 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/NoSelect.tsx +73 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/RawAnsi.tsx +61 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/ScrollBox.tsx +290 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/Spacer.tsx +23 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/StdinContext.ts +25 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/TerminalFocusContext.tsx +63 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/TerminalSizeContext.tsx +7 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/Text.test.ts +38 -0
- package/packages/nastech-ink/nastech-ink/src/ink/components/Text.tsx +336 -0
- package/packages/nastech-ink/nastech-ink/src/ink/constants.ts +6 -0
- package/packages/nastech-ink/nastech-ink/src/ink/cursor.ts +5 -0
- package/packages/nastech-ink/nastech-ink/src/ink/devtools.ts +2 -0
- package/packages/nastech-ink/nastech-ink/src/ink/dom.ts +495 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/click-event.ts +38 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/cmd-shortcuts.test.ts +65 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/dispatcher.ts +242 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/emitter.ts +40 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/event-handlers.ts +84 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/event.ts +11 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/focus-event.ts +18 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/input-event.ts +176 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/keyboard-event.ts +57 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/mouse-event.ts +18 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/paste-event.ts +10 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/resize-event.ts +12 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/terminal-event.ts +107 -0
- package/packages/nastech-ink/nastech-ink/src/ink/events/terminal-focus-event.ts +19 -0
- package/packages/nastech-ink/nastech-ink/src/ink/focus.ts +219 -0
- package/packages/nastech-ink/nastech-ink/src/ink/frame.ts +124 -0
- package/packages/nastech-ink/nastech-ink/src/ink/get-max-width.ts +27 -0
- package/packages/nastech-ink/nastech-ink/src/ink/global.d.ts +1 -0
- package/packages/nastech-ink/nastech-ink/src/ink/hit-test.test.ts +38 -0
- package/packages/nastech-ink/nastech-ink/src/ink/hit-test.ts +224 -0
- package/packages/nastech-ink/nastech-ink/src/ink/hooks/use-animation-frame.ts +62 -0
- package/packages/nastech-ink/nastech-ink/src/ink/hooks/use-app.ts +9 -0
- package/packages/nastech-ink/nastech-ink/src/ink/hooks/use-cursor-advance.ts +33 -0
- package/packages/nastech-ink/nastech-ink/src/ink/hooks/use-declared-cursor.ts +75 -0
- package/packages/nastech-ink/nastech-ink/src/ink/hooks/use-external-process.ts +27 -0
- package/packages/nastech-ink/nastech-ink/src/ink/hooks/use-input.ts +95 -0
- package/packages/nastech-ink/nastech-ink/src/ink/hooks/use-interval.ts +71 -0
- package/packages/nastech-ink/package.json +57 -0
- package/packages/nastech-ink/src/bootstrap/state.ts +9 -0
- package/packages/nastech-ink/src/entry-exports.ts +32 -0
- package/packages/nastech-ink/src/hooks/use-stderr.ts +15 -0
- package/packages/nastech-ink/src/hooks/use-stdout.ts +15 -0
- package/packages/nastech-ink/src/ink/Ansi.tsx +435 -0
- package/packages/nastech-ink/src/ink/app-mouse.test.ts +123 -0
- package/packages/nastech-ink/src/ink/app-rawmode-mouse.test.ts +91 -0
- package/packages/nastech-ink/src/ink/bidi.ts +145 -0
- package/packages/nastech-ink/src/ink/cache-eviction.ts +45 -0
- package/packages/nastech-ink/src/ink/clearTerminal.ts +68 -0
- package/packages/nastech-ink/src/ink/colorize.test.ts +60 -0
- package/packages/nastech-ink/src/ink/colorize.ts +277 -0
- package/packages/nastech-ink/src/ink/components/AlternateScreen.tsx +133 -0
- package/packages/nastech-ink/src/ink/components/App.tsx +855 -0
- package/packages/nastech-ink/src/ink/components/AppContext.ts +20 -0
- package/packages/nastech-ink/src/ink/components/Box.tsx +294 -0
- package/packages/nastech-ink/src/ink/components/Button.tsx +236 -0
- package/packages/nastech-ink/src/ink/components/ClockContext.tsx +133 -0
- package/packages/nastech-ink/src/ink/components/CursorAdvanceContext.ts +35 -0
- package/packages/nastech-ink/src/ink/components/CursorDeclarationContext.ts +28 -0
- package/packages/nastech-ink/src/ink/components/ErrorOverview.tsx +130 -0
- package/packages/nastech-ink/src/ink/components/Link.tsx +38 -0
- package/packages/nastech-ink/src/ink/components/Newline.tsx +43 -0
- package/packages/nastech-ink/src/ink/components/NoSelect.tsx +73 -0
- package/packages/nastech-ink/src/ink/components/RawAnsi.tsx +61 -0
- package/packages/nastech-ink/src/ink/components/ScrollBox.tsx +290 -0
- package/packages/nastech-ink/src/ink/components/Spacer.tsx +23 -0
- package/packages/nastech-ink/src/ink/components/StdinContext.ts +25 -0
- package/packages/nastech-ink/src/ink/components/TerminalFocusContext.tsx +63 -0
- package/packages/nastech-ink/src/ink/components/TerminalSizeContext.tsx +7 -0
- package/packages/nastech-ink/src/ink/components/Text.test.ts +38 -0
- package/packages/nastech-ink/src/ink/components/Text.tsx +336 -0
- package/packages/nastech-ink/src/ink/constants.ts +6 -0
- package/packages/nastech-ink/src/ink/cursor.ts +5 -0
- package/packages/nastech-ink/src/ink/devtools.ts +2 -0
- package/packages/nastech-ink/src/ink/dom.ts +495 -0
- package/packages/nastech-ink/src/ink/events/click-event.ts +38 -0
- package/packages/nastech-ink/src/ink/events/cmd-shortcuts.test.ts +65 -0
- package/packages/nastech-ink/src/ink/events/dispatcher.ts +242 -0
- package/packages/nastech-ink/src/ink/events/emitter.ts +40 -0
- package/packages/nastech-ink/src/ink/events/event-handlers.ts +84 -0
- package/packages/nastech-ink/src/ink/events/event.ts +11 -0
- package/packages/nastech-ink/src/ink/events/focus-event.ts +18 -0
- package/packages/nastech-ink/src/ink/events/input-event.ts +176 -0
- package/packages/nastech-ink/src/ink/events/keyboard-event.ts +57 -0
- package/packages/nastech-ink/src/ink/events/mouse-event.ts +18 -0
- package/packages/nastech-ink/src/ink/events/paste-event.ts +10 -0
- package/packages/nastech-ink/src/ink/events/resize-event.ts +12 -0
- package/packages/nastech-ink/src/ink/events/terminal-event.ts +107 -0
- package/packages/nastech-ink/src/ink/events/terminal-focus-event.ts +19 -0
- package/packages/nastech-ink/src/ink/focus.ts +219 -0
- package/packages/nastech-ink/src/ink/frame.ts +124 -0
- package/packages/nastech-ink/src/ink/get-max-width.ts +27 -0
- package/packages/nastech-ink/src/ink/global.d.ts +1 -0
- package/packages/nastech-ink/src/ink/hit-test.test.ts +38 -0
- package/packages/nastech-ink/src/ink/hit-test.ts +224 -0
- package/packages/nastech-ink/src/ink/hooks/use-animation-frame.ts +62 -0
- package/packages/nastech-ink/src/ink/hooks/use-app.ts +9 -0
- package/packages/nastech-ink/src/ink/hooks/use-cursor-advance.ts +33 -0
- package/packages/nastech-ink/src/ink/hooks/use-declared-cursor.ts +75 -0
- package/packages/nastech-ink/src/ink/hooks/use-external-process.ts +27 -0
- package/packages/nastech-ink/src/ink/hooks/use-input.ts +95 -0
- package/packages/nastech-ink/src/ink/hooks/use-interval.ts +71 -0
- package/packages/nastech-ink/src/ink/hooks/use-search-highlight.ts +56 -0
- package/packages/nastech-ink/src/ink/hooks/use-selection.ts +101 -0
- package/packages/nastech-ink/src/ink/hooks/use-stdin.ts +9 -0
- package/packages/nastech-ink/src/ink/hooks/use-tab-status.ts +71 -0
- package/packages/nastech-ink/src/ink/hooks/use-terminal-focus.ts +18 -0
- package/packages/nastech-ink/src/ink/hooks/use-terminal-title.ts +34 -0
- package/packages/nastech-ink/src/ink/hooks/use-terminal-viewport.ts +100 -0
- package/packages/nastech-ink/src/ink/hyperlinkHover.ts +52 -0
- package/packages/nastech-ink/src/ink/ink-cursor-advance.test.ts +234 -0
- package/packages/nastech-ink/src/ink/ink-resize.test.ts +50 -0
- package/packages/nastech-ink/src/ink/ink.tsx +2705 -0
- package/packages/nastech-ink/src/ink/instances.ts +10 -0
- package/packages/nastech-ink/src/ink/layout/engine.ts +6 -0
- package/packages/nastech-ink/src/ink/layout/geometry.ts +98 -0
- package/packages/nastech-ink/src/ink/layout/node.ts +145 -0
- package/packages/nastech-ink/src/ink/layout/yoga.ts +313 -0
- package/packages/nastech-ink/src/ink/line-width-cache.ts +38 -0
- package/packages/nastech-ink/src/ink/log-update.test.ts +223 -0
- package/packages/nastech-ink/src/ink/log-update.ts +752 -0
- package/packages/nastech-ink/src/ink/lru.ts +14 -0
- package/packages/nastech-ink/src/ink/measure-element.ts +23 -0
- package/packages/nastech-ink/src/ink/measure-text.ts +50 -0
- package/packages/nastech-ink/src/ink/node-cache.ts +53 -0
- package/packages/nastech-ink/src/ink/optimizer.ts +99 -0
- package/packages/nastech-ink/src/ink/output.ts +845 -0
- package/packages/nastech-ink/src/ink/parse-keypress.test.ts +133 -0
- package/packages/nastech-ink/src/ink/parse-keypress.ts +848 -0
- package/packages/nastech-ink/src/ink/reconciler.ts +382 -0
- package/packages/nastech-ink/src/ink/render-border.ts +206 -0
- package/packages/nastech-ink/src/ink/render-node-to-output.ts +1582 -0
- package/packages/nastech-ink/src/ink/render-to-screen.ts +236 -0
- package/packages/nastech-ink/src/ink/renderer.ts +169 -0
- package/packages/nastech-ink/src/ink/root.ts +204 -0
- package/packages/nastech-ink/src/ink/screen.ts +1590 -0
- package/packages/nastech-ink/src/ink/searchHighlight.ts +91 -0
- package/packages/nastech-ink/src/ink/selection.test.ts +82 -0
- package/packages/nastech-ink/src/ink/selection.ts +1143 -0
- package/packages/nastech-ink/src/ink/squash-text-nodes.ts +74 -0
- package/packages/nastech-ink/src/ink/stringWidth.ts +341 -0
- package/packages/nastech-ink/src/ink/styles.ts +750 -0
- package/packages/nastech-ink/src/ink/supports-hyperlinks.ts +51 -0
- package/packages/nastech-ink/src/ink/tabstops.ts +44 -0
- package/packages/nastech-ink/src/ink/terminal-focus-state.ts +52 -0
- package/packages/nastech-ink/src/ink/terminal-querier.ts +222 -0
- package/packages/nastech-ink/src/ink/terminal.test.ts +15 -0
- package/packages/nastech-ink/src/ink/terminal.ts +299 -0
- package/packages/nastech-ink/src/ink/termio/ansi.ts +75 -0
- package/packages/nastech-ink/src/ink/termio/csi.ts +334 -0
- package/packages/nastech-ink/src/ink/termio/dec.ts +99 -0
- package/packages/nastech-ink/src/ink/termio/esc.ts +69 -0
- package/packages/nastech-ink/src/ink/termio/osc.test.ts +191 -0
- package/packages/nastech-ink/src/ink/termio/osc.ts +724 -0
- package/packages/nastech-ink/src/ink/termio/parser.ts +467 -0
- package/packages/nastech-ink/src/ink/termio/sgr.ts +362 -0
- package/packages/nastech-ink/src/ink/termio/tokenize.test.ts +185 -0
- package/packages/nastech-ink/src/ink/termio/tokenize.ts +350 -0
- package/packages/nastech-ink/src/ink/termio/types.ts +230 -0
- package/packages/nastech-ink/src/ink/termio.ts +42 -0
- package/packages/nastech-ink/src/ink/useTerminalNotification.ts +110 -0
- package/packages/nastech-ink/src/ink/warn.ts +15 -0
- package/packages/nastech-ink/src/ink/widest-line.ts +22 -0
- package/packages/nastech-ink/src/ink/wrap-text.test.ts +17 -0
- package/packages/nastech-ink/src/ink/wrap-text.ts +144 -0
- package/packages/nastech-ink/src/ink/wrapAnsi.ts +13 -0
- package/packages/nastech-ink/src/native-ts/yoga-layout/enums.ts +112 -0
- package/packages/nastech-ink/src/native-ts/yoga-layout/index.ts +2326 -0
- package/packages/nastech-ink/src/utils/debug.ts +6 -0
- package/packages/nastech-ink/src/utils/earlyInput.ts +131 -0
- package/packages/nastech-ink/src/utils/env.ts +66 -0
- package/packages/nastech-ink/src/utils/envUtils.ts +13 -0
- package/packages/nastech-ink/src/utils/execFileNoThrow.test.ts +146 -0
- package/packages/nastech-ink/src/utils/execFileNoThrow.ts +115 -0
- package/packages/nastech-ink/src/utils/fullscreen.ts +3 -0
- package/packages/nastech-ink/src/utils/intl.ts +87 -0
- package/packages/nastech-ink/src/utils/log.ts +7 -0
- package/packages/nastech-ink/src/utils/semver.ts +57 -0
- package/packages/nastech-ink/src/utils/sliceAnsi.ts +106 -0
- package/packages/nastech-ink/text-input.d.ts +2 -0
- package/packages/nastech-ink/text-input.js +1 -0
- package/scripts/build.mjs +61 -0
- package/scripts/profile-tui.mjs +121 -0
- package/src/__tests__/activeSessionSwitcher.test.ts +157 -0
- package/src/__tests__/appChromeStatusRule.test.tsx +84 -0
- package/src/__tests__/appChromeStatusRuleDevCredits.test.tsx +73 -0
- package/src/__tests__/approvalAction.test.ts +50 -0
- package/src/__tests__/asCommandDispatch.test.ts +27 -0
- package/src/__tests__/blockLayout.test.ts +122 -0
- package/src/__tests__/clipboard.test.ts +369 -0
- package/src/__tests__/constants.test.ts +53 -0
- package/src/__tests__/createGatewayEventHandler.test.ts +1091 -0
- package/src/__tests__/createSlashHandler.test.ts +822 -0
- package/src/__tests__/creditsCommand.test.ts +144 -0
- package/src/__tests__/cursorDriftRegression.test.ts +114 -0
- package/src/__tests__/details.test.ts +115 -0
- package/src/__tests__/emoji.test.ts +64 -0
- package/src/__tests__/externalLink.test.ts +144 -0
- package/src/__tests__/forceTruecolor.test.ts +191 -0
- package/src/__tests__/gatewayClient.test.ts +394 -0
- package/src/__tests__/gatewayRecovery.test.ts +47 -0
- package/src/__tests__/markdown.test.ts +331 -0
- package/src/__tests__/mathUnicode.test.ts +293 -0
- package/src/__tests__/memoryMonitor.test.ts +102 -0
- package/src/__tests__/messageLine.test.ts +19 -0
- package/src/__tests__/messages.test.ts +92 -0
- package/src/__tests__/orchestratorPromptSession.test.ts +64 -0
- package/src/__tests__/osc52.test.ts +67 -0
- package/src/__tests__/parentLog.test.ts +75 -0
- package/src/__tests__/paths.test.ts +70 -0
- package/src/__tests__/platform.test.ts +556 -0
- package/src/__tests__/precisionWheel.test.ts +44 -0
- package/src/__tests__/prompt.test.ts +31 -0
- package/src/__tests__/providers.test.ts +65 -0
- package/src/__tests__/reasoning.test.ts +76 -0
- package/src/__tests__/rpc.test.ts +27 -0
- package/src/__tests__/scroll.test.ts +99 -0
- package/src/__tests__/slashParity.test.ts +123 -0
- package/src/__tests__/spawnHistoryStore.test.ts +46 -0
- package/src/__tests__/stateIsolation.test.ts +46 -0
- package/src/__tests__/statusBarTicker.test.ts +18 -0
- package/src/__tests__/statusRule.test.ts +32 -0
- package/src/__tests__/streamingMarkdown.test.ts +121 -0
- package/src/__tests__/subagentTree.test.ts +407 -0
- package/src/__tests__/syntax.test.ts +45 -0
- package/src/__tests__/terminalModes.test.ts +39 -0
- package/src/__tests__/terminalParity.test.ts +77 -0
- package/src/__tests__/terminalSetup.test.ts +386 -0
- package/src/__tests__/termux.test.ts +35 -0
- package/src/__tests__/termuxComposerLayout.test.ts +40 -0
- package/src/__tests__/text.test.ts +233 -0
- package/src/__tests__/textInputBurstInput.test.ts +40 -0
- package/src/__tests__/textInputCursorSourceOfTruth.test.ts +50 -0
- package/src/__tests__/textInputFastEcho.test.ts +200 -0
- package/src/__tests__/textInputLineNav.test.ts +55 -0
- package/src/__tests__/textInputPassThrough.test.ts +59 -0
- package/src/__tests__/textInputRightClick.test.ts +48 -0
- package/src/__tests__/textInputWrap.test.ts +151 -0
- package/src/__tests__/theme.test.ts +311 -0
- package/src/__tests__/turnControllerNotice.test.ts +43 -0
- package/src/__tests__/turnStore.test.ts +66 -0
- package/src/__tests__/useCompletion.test.ts +35 -0
- package/src/__tests__/useComposerState.test.ts +59 -0
- package/src/__tests__/useConfigSync.test.ts +460 -0
- package/src/__tests__/useInputHandlers.test.ts +77 -0
- package/src/__tests__/useQueue.test.ts +28 -0
- package/src/__tests__/useSessionLifecycle.test.ts +60 -0
- package/src/__tests__/useVirtualHistoryHeights.test.ts +39 -0
- package/src/__tests__/viewport.test.ts +58 -0
- package/src/__tests__/viewportStore.test.ts +85 -0
- package/src/__tests__/virtualHeights.test.ts +96 -0
- package/src/__tests__/virtualHistoryClamp.test.ts +19 -0
- package/src/__tests__/virtualHistoryOffsetCache.test.ts +282 -0
- package/src/__tests__/wheelAccel.test.ts +138 -0
- package/src/app/createGatewayEventHandler.ts +833 -0
- package/src/app/createSlashHandler.ts +130 -0
- package/src/app/delegationStore.ts +77 -0
- package/src/app/gatewayContext.tsx +19 -0
- package/src/app/gatewayRecovery.ts +35 -0
- package/src/app/inputSelectionStore.ts +15 -0
- package/src/app/interfaces.ts +394 -0
- package/src/app/overlayStore.ts +53 -0
- package/src/app/scroll.ts +71 -0
- package/src/app/setupHandoff.ts +54 -0
- package/src/app/slash/commands/core.ts +648 -0
- package/src/app/slash/commands/credits.ts +57 -0
- package/src/app/slash/commands/debug.ts +48 -0
- package/src/app/slash/commands/ops.ts +717 -0
- package/src/app/slash/commands/session.ts +554 -0
- package/src/app/slash/commands/setup.ts +20 -0
- package/src/app/slash/registry.ts +20 -0
- package/src/app/slash/types.ts +21 -0
- package/src/app/spawnHistoryStore.ts +159 -0
- package/src/app/turnController.ts +866 -0
- package/src/app/turnStore.ts +85 -0
- package/src/app/uiStore.ts +44 -0
- package/src/app/useComposerState.ts +367 -0
- package/src/app/useConfigSync.ts +288 -0
- package/src/app/useInputHandlers.ts +576 -0
- package/src/app/useLongRunToolCharms.ts +69 -0
- package/src/app/useMainApp.ts +1039 -0
- package/src/app/useSessionLifecycle.ts +366 -0
- package/src/app/useSubmission.ts +429 -0
- package/src/app.tsx +25 -0
- package/src/banner.ts +93 -0
- package/src/components/activeSessionSwitcher.tsx +635 -0
- package/src/components/agentsOverlay.tsx +1073 -0
- package/src/components/appChrome.tsx +554 -0
- package/src/components/appLayout.tsx +444 -0
- package/src/components/appOverlays.tsx +254 -0
- package/src/components/branding.tsx +466 -0
- package/src/components/fpsOverlay.tsx +30 -0
- package/src/components/helpHint.tsx +73 -0
- package/src/components/markdown.tsx +1119 -0
- package/src/components/maskedPrompt.tsx +34 -0
- package/src/components/messageLine.tsx +237 -0
- package/src/components/modelPicker.tsx +527 -0
- package/src/components/overlayControls.tsx +50 -0
- package/src/components/pluginsHub.tsx +238 -0
- package/src/components/prompts.tsx +276 -0
- package/src/components/queuedMessages.tsx +64 -0
- package/src/components/sessionPicker.tsx +227 -0
- package/src/components/skillsHub.tsx +308 -0
- package/src/components/streamingAssistant.tsx +110 -0
- package/src/components/streamingMarkdown.tsx +174 -0
- package/src/components/textInput.tsx +1340 -0
- package/src/components/themed.tsx +30 -0
- package/src/components/thinking.tsx +1224 -0
- package/src/components/todoPanel.tsx +93 -0
- package/src/config/env.ts +64 -0
- package/src/config/limits.ts +13 -0
- package/src/config/timing.ts +6 -0
- package/src/content/charms.ts +1 -0
- package/src/content/faces.ts +17 -0
- package/src/content/fortunes.ts +30 -0
- package/src/content/hotkeys.ts +37 -0
- package/src/content/placeholders.ts +13 -0
- package/src/content/setup.ts +17 -0
- package/src/content/verbs.ts +38 -0
- package/src/domain/blockLayout.ts +146 -0
- package/src/domain/details.ts +76 -0
- package/src/domain/messages.ts +91 -0
- package/src/domain/paths.ts +16 -0
- package/src/domain/providers.ts +11 -0
- package/src/domain/roles.ts +9 -0
- package/src/domain/slash.ts +10 -0
- package/src/domain/usage.ts +3 -0
- package/src/domain/viewport.ts +51 -0
- package/src/entry.tsx +104 -0
- package/src/gatewayClient.ts +730 -0
- package/src/gatewayTypes.ts +568 -0
- package/src/hooks/useCompletion.ts +112 -0
- package/src/hooks/useGitBranch.ts +72 -0
- package/src/hooks/useInputHistory.ts +11 -0
- package/src/hooks/useQueue.ts +76 -0
- package/src/hooks/useVirtualHistory.ts +554 -0
- package/src/lib/circularBuffer.ts +48 -0
- package/src/lib/clipboard.ts +182 -0
- package/src/lib/editor.test.ts +74 -0
- package/src/lib/editor.ts +47 -0
- package/src/lib/emoji.ts +55 -0
- package/src/lib/externalCli.ts +16 -0
- package/src/lib/externalLink.ts +435 -0
- package/src/lib/forceTruecolor.ts +60 -0
- package/src/lib/fpsStore.ts +51 -0
- package/src/lib/fuzzy.test.ts +109 -0
- package/src/lib/fuzzy.ts +177 -0
- package/src/lib/gracefulExit.ts +47 -0
- package/src/lib/history.ts +82 -0
- package/src/lib/inputMetrics.ts +203 -0
- package/src/lib/liveProgress.test.ts +116 -0
- package/src/lib/liveProgress.ts +79 -0
- package/src/lib/mathUnicode.ts +770 -0
- package/src/lib/memory.test.ts +155 -0
- package/src/lib/memory.ts +188 -0
- package/src/lib/memoryMonitor.ts +109 -0
- package/src/lib/messages.test.ts +29 -0
- package/src/lib/messages.ts +8 -0
- package/src/lib/openExternalUrl.test.ts +217 -0
- package/src/lib/openExternalUrl.ts +158 -0
- package/src/lib/osc52.ts +73 -0
- package/src/lib/parentLog.ts +57 -0
- package/src/lib/perfPane.tsx +107 -0
- package/src/lib/platform.ts +409 -0
- package/src/lib/precisionWheel.ts +48 -0
- package/src/lib/prompt.ts +35 -0
- package/src/lib/reasoning.ts +55 -0
- package/src/lib/rpc.ts +41 -0
- package/src/lib/subagentTree.ts +355 -0
- package/src/lib/syntax.ts +117 -0
- package/src/lib/terminalModes.ts +51 -0
- package/src/lib/terminalParity.ts +78 -0
- package/src/lib/terminalSetup.ts +444 -0
- package/src/lib/termux.ts +29 -0
- package/src/lib/text.test.ts +18 -0
- package/src/lib/text.ts +339 -0
- package/src/lib/todo.test.ts +21 -0
- package/src/lib/todo.ts +9 -0
- package/src/lib/viewportStore.ts +124 -0
- package/src/lib/virtualHeights.ts +145 -0
- package/src/lib/wheelAccel.ts +190 -0
- package/src/protocol/interpolation.ts +3 -0
- package/src/protocol/paste.ts +1 -0
- package/src/theme.ts +589 -0
- package/src/types/nastech-ink.d.ts +176 -0
- package/src/types.ts +212 -0
- package/tsconfig.build.json +9 -0
- package/tsconfig.json +19 -0
- package/vitest.config.ts +7 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { parseSlashCommand } from '../domain/slash.js'
|
|
2
|
+
import type { SlashExecResponse } from '../gatewayTypes.js'
|
|
3
|
+
import { asCommandDispatch, rpcErrorMessage } from '../lib/rpc.js'
|
|
4
|
+
|
|
5
|
+
import type { SlashHandlerContext } from './interfaces.js'
|
|
6
|
+
import { findSlashCommand } from './slash/registry.js'
|
|
7
|
+
import type { SlashRunCtx } from './slash/types.js'
|
|
8
|
+
import { getUiState } from './uiStore.js'
|
|
9
|
+
|
|
10
|
+
export function createSlashHandler(ctx: SlashHandlerContext): (cmd: string) => boolean {
|
|
11
|
+
const { gw } = ctx.gateway
|
|
12
|
+
const { catalog } = ctx.local
|
|
13
|
+
const { page, send, sys } = ctx.transcript
|
|
14
|
+
|
|
15
|
+
const handler = (cmd: string): boolean => {
|
|
16
|
+
const flight = ++ctx.slashFlightRef.current
|
|
17
|
+
const ui = getUiState()
|
|
18
|
+
const sid = ui.sid
|
|
19
|
+
const parsed = parseSlashCommand(cmd)
|
|
20
|
+
const argTail = parsed.arg ? ` ${parsed.arg}` : ''
|
|
21
|
+
|
|
22
|
+
const stale = () => flight !== ctx.slashFlightRef.current || getUiState().sid !== sid
|
|
23
|
+
|
|
24
|
+
const guarded =
|
|
25
|
+
<T>(fn: (r: T) => void) =>
|
|
26
|
+
(r: null | T): void => {
|
|
27
|
+
if (!stale() && r) {
|
|
28
|
+
fn(r)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const guardedErr = (e: unknown) => {
|
|
33
|
+
if (!stale()) {
|
|
34
|
+
sys(`error: ${rpcErrorMessage(e)}`)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const runCtx: SlashRunCtx = { ...ctx, flight, guarded, guardedErr, sid, stale, ui }
|
|
39
|
+
|
|
40
|
+
const found = findSlashCommand(parsed.name)
|
|
41
|
+
|
|
42
|
+
if (found) {
|
|
43
|
+
found.run(parsed.arg, runCtx, cmd)
|
|
44
|
+
|
|
45
|
+
return true
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (catalog?.canon) {
|
|
49
|
+
const needle = `/${parsed.name}`.toLowerCase()
|
|
50
|
+
const exact = Object.entries(catalog.canon).find(([alias]) => alias.toLowerCase() === needle)?.[1]
|
|
51
|
+
|
|
52
|
+
if (exact) {
|
|
53
|
+
if (exact.toLowerCase() !== needle) {
|
|
54
|
+
return handler(`${exact}${argTail}`)
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
const matches = [
|
|
58
|
+
...new Set(
|
|
59
|
+
Object.entries(catalog.canon)
|
|
60
|
+
.filter(([alias]) => alias.startsWith(needle))
|
|
61
|
+
.map(([, canon]) => canon)
|
|
62
|
+
)
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
if (matches.length === 1 && matches[0]!.toLowerCase() !== needle) {
|
|
66
|
+
return handler(`${matches[0]}${argTail}`)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (matches.length > 1) {
|
|
70
|
+
sys(`ambiguous command: ${matches.slice(0, 6).join(', ')}${matches.length > 6 ? ', …' : ''}`)
|
|
71
|
+
|
|
72
|
+
return true
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
gw.request<SlashExecResponse>('slash.exec', { command: cmd.slice(1), session_id: sid })
|
|
78
|
+
.then(r => {
|
|
79
|
+
if (stale()) {
|
|
80
|
+
return
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const body = r?.output || `/${parsed.name}: no output`
|
|
84
|
+
const text = r?.warning ? `warning: ${r.warning}\n${body}` : body
|
|
85
|
+
const long = text.length > 180 || text.split('\n').filter(Boolean).length > 2
|
|
86
|
+
|
|
87
|
+
long ? page(text, parsed.name[0]!.toUpperCase() + parsed.name.slice(1)) : sys(text)
|
|
88
|
+
})
|
|
89
|
+
.catch(() => {
|
|
90
|
+
gw.request('command.dispatch', { arg: parsed.arg, name: parsed.name, session_id: sid })
|
|
91
|
+
.then((raw: unknown) => {
|
|
92
|
+
if (stale()) {
|
|
93
|
+
return
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const d = asCommandDispatch(raw)
|
|
97
|
+
|
|
98
|
+
if (!d) {
|
|
99
|
+
return sys('error: invalid response: command.dispatch')
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (d.type === 'exec' || d.type === 'plugin') {
|
|
103
|
+
return sys(d.output || '(no output)')
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (d.type === 'alias') {
|
|
107
|
+
return handler(`/${d.target}${argTail}`)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (d.type === 'skill') {
|
|
111
|
+
sys(`⚡ loading skill: ${d.name}`)
|
|
112
|
+
|
|
113
|
+
return d.message?.trim() ? send(d.message) : sys(`/${parsed.name}: skill payload missing message`)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (d.type === 'send') {
|
|
117
|
+
if (d.notice?.trim()) {
|
|
118
|
+
sys(d.notice)
|
|
119
|
+
}
|
|
120
|
+
return d.message?.trim() ? send(d.message) : sys(`/${parsed.name}: empty message`)
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
.catch(guardedErr)
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
return true
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return handler
|
|
130
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { atom } from 'nanostores'
|
|
2
|
+
|
|
3
|
+
import type { DelegationStatusResponse } from '../gatewayTypes.js'
|
|
4
|
+
|
|
5
|
+
export interface DelegationState {
|
|
6
|
+
// Last known caps from `delegation.status` RPC. null until fetched.
|
|
7
|
+
maxConcurrentChildren: null | number
|
|
8
|
+
maxSpawnDepth: null | number
|
|
9
|
+
// True when spawning is globally paused (see tools/delegate_tool.py).
|
|
10
|
+
paused: boolean
|
|
11
|
+
// Monotonic clock of the last successful status fetch.
|
|
12
|
+
updatedAt: null | number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const buildState = (): DelegationState => ({
|
|
16
|
+
maxConcurrentChildren: null,
|
|
17
|
+
maxSpawnDepth: null,
|
|
18
|
+
paused: false,
|
|
19
|
+
updatedAt: null
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export const $delegationState = atom<DelegationState>(buildState())
|
|
23
|
+
|
|
24
|
+
export const getDelegationState = () => $delegationState.get()
|
|
25
|
+
|
|
26
|
+
export const patchDelegationState = (next: Partial<DelegationState>) =>
|
|
27
|
+
$delegationState.set({ ...$delegationState.get(), ...next })
|
|
28
|
+
|
|
29
|
+
export const resetDelegationState = () => $delegationState.set(buildState())
|
|
30
|
+
|
|
31
|
+
// ── Overlay accordion open-state ──────────────────────────────────────
|
|
32
|
+
//
|
|
33
|
+
// Lifted out of OverlaySection's local useState so collapse choices
|
|
34
|
+
// survive:
|
|
35
|
+
// - navigating to a different subagent (Detail remounts)
|
|
36
|
+
// - switching list ↔ detail mode (Detail unmounts in list mode)
|
|
37
|
+
// - walking history (←/→)
|
|
38
|
+
// Keyed by section title; missing entries fall back to the section's
|
|
39
|
+
// `defaultOpen` prop.
|
|
40
|
+
|
|
41
|
+
export const $overlaySectionsOpen = atom<Record<string, boolean>>({})
|
|
42
|
+
|
|
43
|
+
export const toggleOverlaySection = (title: string, defaultOpen: boolean) => {
|
|
44
|
+
const state = $overlaySectionsOpen.get()
|
|
45
|
+
const current = title in state ? state[title]! : defaultOpen
|
|
46
|
+
|
|
47
|
+
$overlaySectionsOpen.set({ ...state, [title]: !current })
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const getOverlaySectionOpen = (title: string, defaultOpen: boolean): boolean => {
|
|
51
|
+
const state = $overlaySectionsOpen.get()
|
|
52
|
+
|
|
53
|
+
return title in state ? state[title]! : defaultOpen
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Merge a raw RPC response into the store. Tolerant of partial/omitted fields. */
|
|
57
|
+
export const applyDelegationStatus = (r: DelegationStatusResponse | null | undefined) => {
|
|
58
|
+
if (!r) {
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const patch: Partial<DelegationState> = { updatedAt: Date.now() }
|
|
63
|
+
|
|
64
|
+
if (typeof r.max_spawn_depth === 'number') {
|
|
65
|
+
patch.maxSpawnDepth = r.max_spawn_depth
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (typeof r.max_concurrent_children === 'number') {
|
|
69
|
+
patch.maxConcurrentChildren = r.max_concurrent_children
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (typeof r.paused === 'boolean') {
|
|
73
|
+
patch.paused = r.paused
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
patchDelegationState(patch)
|
|
77
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react'
|
|
2
|
+
|
|
3
|
+
import type { GatewayProviderProps, GatewayServices } from './interfaces.js'
|
|
4
|
+
|
|
5
|
+
const GatewayContext = createContext<GatewayServices | null>(null)
|
|
6
|
+
|
|
7
|
+
export function GatewayProvider({ children, value }: GatewayProviderProps) {
|
|
8
|
+
return <GatewayContext.Provider value={value}>{children}</GatewayContext.Provider>
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function useGateway() {
|
|
12
|
+
const value = useContext(GatewayContext)
|
|
13
|
+
|
|
14
|
+
if (!value) {
|
|
15
|
+
throw new Error('GatewayContext missing')
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return value
|
|
19
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Crash-recovery budget for the gateway exit handler. A gateway that
|
|
2
|
+
// crash-loops on startup must not let the TUI spawn-storm, so respawn+resume
|
|
3
|
+
// attempts are capped to GATEWAY_RECOVERY_LIMIT within a sliding
|
|
4
|
+
// GATEWAY_RECOVERY_WINDOW_MS; past the budget the app falls back to the inert
|
|
5
|
+
// "gateway exited" state. Kept pure (no refs/UI) so the bound — including the
|
|
6
|
+
// crash-loop case — is unit-testable.
|
|
7
|
+
export const GATEWAY_RECOVERY_LIMIT = 3
|
|
8
|
+
export const GATEWAY_RECOVERY_WINDOW_MS = 60_000
|
|
9
|
+
|
|
10
|
+
export interface RecoveryPlan {
|
|
11
|
+
// Attempt timestamps to persist (the pruned window, plus `now` iff recovering).
|
|
12
|
+
attempts: number[]
|
|
13
|
+
recover: boolean
|
|
14
|
+
// Session to resume — the live sid, or the not-yet-consumed recovery target
|
|
15
|
+
// when the live sid was already cleared by a prior exit.
|
|
16
|
+
sid: null | string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Decide whether to respawn+resume after a gateway death. `liveSid` is the
|
|
20
|
+
// current session (nulled on the first exit); `recoverSid` is a pending
|
|
21
|
+
// recovery target carried across a respawn that died before gateway.ready —
|
|
22
|
+
// so a startup crash-loop keeps retrying the same session up to the budget
|
|
23
|
+
// instead of stranding it after one attempt.
|
|
24
|
+
export function planGatewayRecovery(
|
|
25
|
+
liveSid: null | string,
|
|
26
|
+
recoverSid: null | string,
|
|
27
|
+
attempts: number[],
|
|
28
|
+
now: number
|
|
29
|
+
): RecoveryPlan {
|
|
30
|
+
const sid = liveSid ?? recoverSid
|
|
31
|
+
const recent = attempts.filter(t => now - t < GATEWAY_RECOVERY_WINDOW_MS)
|
|
32
|
+
const recover = Boolean(sid) && recent.length < GATEWAY_RECOVERY_LIMIT
|
|
33
|
+
|
|
34
|
+
return { attempts: recover ? [...recent, now] : recent, recover, sid }
|
|
35
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { atom } from 'nanostores'
|
|
2
|
+
|
|
3
|
+
export interface InputSelection {
|
|
4
|
+
clear: () => void
|
|
5
|
+
collapseToEnd: () => void
|
|
6
|
+
end: number
|
|
7
|
+
start: number
|
|
8
|
+
value: string
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const $inputSelection = atom<InputSelection | null>(null)
|
|
12
|
+
|
|
13
|
+
export const setInputSelection = (next: InputSelection | null) => $inputSelection.set(next)
|
|
14
|
+
|
|
15
|
+
export const getInputSelection = () => $inputSelection.get()
|
|
@@ -0,0 +1,394 @@
|
|
|
1
|
+
import type { MouseTrackingMode, ScrollBoxHandle } from '@nastechai/ink'
|
|
2
|
+
import type { MutableRefObject, ReactNode, RefObject, SetStateAction } from 'react'
|
|
3
|
+
|
|
4
|
+
import type { PasteEvent } from '../components/textInput.js'
|
|
5
|
+
import type { GatewayClient } from '../gatewayClient.js'
|
|
6
|
+
import type { ImageAttachResponse, SessionCloseResponse } from '../gatewayTypes.js'
|
|
7
|
+
import type { ParsedVoiceRecordKey } from '../lib/platform.js'
|
|
8
|
+
import type { RpcResult } from '../lib/rpc.js'
|
|
9
|
+
import type { Theme } from '../theme.js'
|
|
10
|
+
import type {
|
|
11
|
+
ApprovalReq,
|
|
12
|
+
ClarifyReq,
|
|
13
|
+
ConfirmReq,
|
|
14
|
+
DetailsMode,
|
|
15
|
+
Msg,
|
|
16
|
+
PanelSection,
|
|
17
|
+
SecretReq,
|
|
18
|
+
SectionVisibility,
|
|
19
|
+
SessionInfo,
|
|
20
|
+
SlashCatalog,
|
|
21
|
+
SudoReq,
|
|
22
|
+
Usage
|
|
23
|
+
} from '../types.js'
|
|
24
|
+
|
|
25
|
+
export interface StateSetter<T> {
|
|
26
|
+
(value: SetStateAction<T>): void
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type StatusBarMode = 'bottom' | 'off' | 'top'
|
|
30
|
+
|
|
31
|
+
export type BusyInputMode = 'interrupt' | 'queue' | 'steer'
|
|
32
|
+
|
|
33
|
+
// Single source of truth for indicator style names. Union type is
|
|
34
|
+
// derived from this tuple so adding/removing a style only touches one
|
|
35
|
+
// line — `useConfigSync` (validation) and `session.ts` (slash arg
|
|
36
|
+
// validation + usage hint) both import it.
|
|
37
|
+
export const INDICATOR_STYLES = ['ascii', 'emoji', 'kaomoji', 'unicode'] as const
|
|
38
|
+
export type IndicatorStyle = (typeof INDICATOR_STYLES)[number]
|
|
39
|
+
export const DEFAULT_INDICATOR_STYLE: IndicatorStyle = 'kaomoji'
|
|
40
|
+
|
|
41
|
+
export interface SelectionApi {
|
|
42
|
+
captureScrolledRows: (firstRow: number, lastRow: number, side: 'above' | 'below') => void
|
|
43
|
+
clearSelection: () => void
|
|
44
|
+
copySelection: () => Promise<string>
|
|
45
|
+
copySelectionNoClear: () => Promise<string>
|
|
46
|
+
getState: () => unknown
|
|
47
|
+
version: () => number
|
|
48
|
+
shiftAnchor: (dRow: number, minRow: number, maxRow: number) => void
|
|
49
|
+
shiftSelection: (dRow: number, minRow: number, maxRow: number) => void
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface CompletionItem {
|
|
53
|
+
display: string
|
|
54
|
+
meta?: string
|
|
55
|
+
text: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface GatewayRpc {
|
|
59
|
+
<T extends RpcResult = RpcResult>(method: string, params?: Record<string, unknown>): Promise<null | T>
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface GatewayServices {
|
|
63
|
+
gw: GatewayClient
|
|
64
|
+
rpc: GatewayRpc
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface GatewayProviderProps {
|
|
68
|
+
children: ReactNode
|
|
69
|
+
value: GatewayServices
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface OverlayState {
|
|
73
|
+
agents: boolean
|
|
74
|
+
agentsInitialHistoryIndex: number
|
|
75
|
+
approval: ApprovalReq | null
|
|
76
|
+
clarify: ClarifyReq | null
|
|
77
|
+
confirm: ConfirmReq | null
|
|
78
|
+
modelPicker: boolean
|
|
79
|
+
pager: null | PagerState
|
|
80
|
+
picker: boolean
|
|
81
|
+
secret: null | SecretReq
|
|
82
|
+
sessions: boolean
|
|
83
|
+
skillsHub: boolean
|
|
84
|
+
sudo: null | SudoReq
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface PagerState {
|
|
88
|
+
lines: string[]
|
|
89
|
+
offset: number
|
|
90
|
+
title?: string
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface TranscriptRow {
|
|
94
|
+
index: number
|
|
95
|
+
key: string
|
|
96
|
+
msg: Msg
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export interface UiState {
|
|
100
|
+
bgTasks: Set<string>
|
|
101
|
+
busy: boolean
|
|
102
|
+
busyInputMode: BusyInputMode
|
|
103
|
+
compact: boolean
|
|
104
|
+
detailsMode: DetailsMode
|
|
105
|
+
detailsModeCommandOverride: boolean
|
|
106
|
+
info: null | SessionInfo
|
|
107
|
+
liveSessionCount: number
|
|
108
|
+
inlineDiffs: boolean
|
|
109
|
+
mouseTracking: MouseTrackingMode
|
|
110
|
+
pasteCollapseLines: number
|
|
111
|
+
pasteCollapseChars: number
|
|
112
|
+
|
|
113
|
+
sections: SectionVisibility
|
|
114
|
+
showCost: boolean
|
|
115
|
+
showReasoning: boolean
|
|
116
|
+
indicatorStyle: IndicatorStyle
|
|
117
|
+
sid: null | string
|
|
118
|
+
status: string
|
|
119
|
+
statusBar: StatusBarMode
|
|
120
|
+
streaming: boolean
|
|
121
|
+
theme: Theme
|
|
122
|
+
usage: Usage
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface VirtualHistoryState {
|
|
126
|
+
bottomSpacer: number
|
|
127
|
+
end: number
|
|
128
|
+
measureRef: (key: string) => (el: unknown) => void
|
|
129
|
+
offsets: ArrayLike<number>
|
|
130
|
+
start: number
|
|
131
|
+
topSpacer: number
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface ComposerPasteResult {
|
|
135
|
+
cursor: number
|
|
136
|
+
value: string
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export type MaybePromise<T> = Promise<T> | T
|
|
140
|
+
|
|
141
|
+
export interface ComposerActions {
|
|
142
|
+
clearIn: () => void
|
|
143
|
+
dequeue: () => string | undefined
|
|
144
|
+
enqueue: (text: string) => void
|
|
145
|
+
handleTextPaste: (event: PasteEvent) => MaybePromise<ComposerPasteResult | null>
|
|
146
|
+
openEditor: () => Promise<void>
|
|
147
|
+
pushHistory: (text: string) => void
|
|
148
|
+
removeQueue: (index: number) => void
|
|
149
|
+
replaceQueue: (index: number, text: string) => void
|
|
150
|
+
setCompIdx: StateSetter<number>
|
|
151
|
+
setHistoryIdx: StateSetter<null | number>
|
|
152
|
+
setInput: StateSetter<string>
|
|
153
|
+
setInputBuf: StateSetter<string[]>
|
|
154
|
+
setPasteSnips: StateSetter<PasteSnippet[]>
|
|
155
|
+
setQueueEdit: (index: null | number) => void
|
|
156
|
+
syncQueue: () => void
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface ComposerRefs {
|
|
160
|
+
historyDraftRef: MutableRefObject<string>
|
|
161
|
+
historyRef: MutableRefObject<string[]>
|
|
162
|
+
queueEditRef: MutableRefObject<null | number>
|
|
163
|
+
queueRef: MutableRefObject<string[]>
|
|
164
|
+
submitRef: MutableRefObject<(value: string) => void>
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface ComposerState {
|
|
168
|
+
compIdx: number
|
|
169
|
+
compReplace: number
|
|
170
|
+
completions: CompletionItem[]
|
|
171
|
+
historyIdx: null | number
|
|
172
|
+
input: string
|
|
173
|
+
inputBuf: string[]
|
|
174
|
+
pasteSnips: PasteSnippet[]
|
|
175
|
+
queueEditIdx: null | number
|
|
176
|
+
queuedDisplay: string[]
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface UseComposerStateOptions {
|
|
180
|
+
gw: GatewayClient
|
|
181
|
+
onClipboardPaste: (quiet?: boolean) => Promise<void> | void
|
|
182
|
+
onImageAttached?: (info: ImageAttachResponse) => void
|
|
183
|
+
submitRef: MutableRefObject<(value: string) => void>
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface UseComposerStateResult {
|
|
187
|
+
actions: ComposerActions
|
|
188
|
+
refs: ComposerRefs
|
|
189
|
+
state: ComposerState
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface InputHandlerActions {
|
|
193
|
+
answerClarify: (answer: string) => void
|
|
194
|
+
appendMessage: (msg: Msg) => void
|
|
195
|
+
die: () => void
|
|
196
|
+
dispatchSubmission: (full: string) => void
|
|
197
|
+
guardBusySessionSwitch: (what?: string) => boolean
|
|
198
|
+
newSession: (msg?: string, title?: string) => void
|
|
199
|
+
sys: (text: string) => void
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface InputHandlerContext {
|
|
203
|
+
actions: InputHandlerActions
|
|
204
|
+
composer: {
|
|
205
|
+
actions: ComposerActions
|
|
206
|
+
refs: ComposerRefs
|
|
207
|
+
state: ComposerState
|
|
208
|
+
}
|
|
209
|
+
gateway: GatewayServices
|
|
210
|
+
terminal: {
|
|
211
|
+
hasSelection: boolean
|
|
212
|
+
scrollRef: RefObject<null | ScrollBoxHandle>
|
|
213
|
+
scrollWithSelection: (delta: number) => void
|
|
214
|
+
selection: SelectionApi
|
|
215
|
+
stdout?: NodeJS.WriteStream
|
|
216
|
+
}
|
|
217
|
+
voice: {
|
|
218
|
+
enabled: boolean
|
|
219
|
+
recordKey: ParsedVoiceRecordKey
|
|
220
|
+
recording: boolean
|
|
221
|
+
setProcessing: StateSetter<boolean>
|
|
222
|
+
setRecording: StateSetter<boolean>
|
|
223
|
+
setVoiceEnabled: StateSetter<boolean>
|
|
224
|
+
setVoiceTts: StateSetter<boolean>
|
|
225
|
+
}
|
|
226
|
+
wheelStep: number
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface InputHandlerResult {
|
|
230
|
+
pagerPageSize: number
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface GatewayEventHandlerContext {
|
|
234
|
+
composer: {
|
|
235
|
+
setInput: StateSetter<string>
|
|
236
|
+
}
|
|
237
|
+
gateway: GatewayServices
|
|
238
|
+
session: {
|
|
239
|
+
STARTUP_RESUME_ID: string
|
|
240
|
+
colsRef: MutableRefObject<number>
|
|
241
|
+
newSession: (msg?: string, title?: string) => void
|
|
242
|
+
resetSession: () => void
|
|
243
|
+
resumeById: (id: string) => void
|
|
244
|
+
setCatalog: StateSetter<null | SlashCatalog>
|
|
245
|
+
}
|
|
246
|
+
submission: {
|
|
247
|
+
submitRef: MutableRefObject<(value: string) => void>
|
|
248
|
+
}
|
|
249
|
+
system: {
|
|
250
|
+
bellOnComplete: boolean
|
|
251
|
+
stdout?: NodeJS.WriteStream
|
|
252
|
+
sys: (text: string) => void
|
|
253
|
+
}
|
|
254
|
+
transcript: {
|
|
255
|
+
appendMessage: (msg: Msg) => void
|
|
256
|
+
panel: (title: string, sections: PanelSection[]) => void
|
|
257
|
+
setHistoryItems: StateSetter<Msg[]>
|
|
258
|
+
}
|
|
259
|
+
voice: {
|
|
260
|
+
setProcessing: StateSetter<boolean>
|
|
261
|
+
setRecording: StateSetter<boolean>
|
|
262
|
+
setVoiceEnabled: StateSetter<boolean>
|
|
263
|
+
setVoiceTts: StateSetter<boolean>
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface SlashHandlerContext {
|
|
268
|
+
composer: {
|
|
269
|
+
enqueue: (text: string) => void
|
|
270
|
+
hasSelection: boolean
|
|
271
|
+
paste: (quiet?: boolean) => void
|
|
272
|
+
queueRef: MutableRefObject<string[]>
|
|
273
|
+
selection: SelectionApi
|
|
274
|
+
setInput: StateSetter<string>
|
|
275
|
+
}
|
|
276
|
+
gateway: GatewayServices
|
|
277
|
+
local: {
|
|
278
|
+
catalog: null | SlashCatalog
|
|
279
|
+
getHistoryItems: () => Msg[]
|
|
280
|
+
getLastUserMsg: () => string
|
|
281
|
+
maybeWarn: (value: unknown) => void
|
|
282
|
+
setCatalog: StateSetter<null | SlashCatalog>
|
|
283
|
+
}
|
|
284
|
+
session: {
|
|
285
|
+
closeSession: (targetSid?: null | string) => Promise<unknown>
|
|
286
|
+
die: () => void
|
|
287
|
+
dieWithCode: (code: number) => void
|
|
288
|
+
guardBusySessionSwitch: (what?: string) => boolean
|
|
289
|
+
newLiveSession: (msg?: string, title?: string) => void
|
|
290
|
+
newSession: (msg?: string, title?: string) => void
|
|
291
|
+
resetVisibleHistory: (info?: null | SessionInfo) => void
|
|
292
|
+
resumeById: (id: string) => void
|
|
293
|
+
setSessionStartedAt: StateSetter<number>
|
|
294
|
+
}
|
|
295
|
+
slashFlightRef: MutableRefObject<number>
|
|
296
|
+
transcript: {
|
|
297
|
+
page: (text: string, title?: string) => void
|
|
298
|
+
panel: (title: string, sections: PanelSection[]) => void
|
|
299
|
+
send: (text: string) => void
|
|
300
|
+
setHistoryItems: StateSetter<Msg[]>
|
|
301
|
+
sys: (text: string) => void
|
|
302
|
+
trimLastExchange: (items: Msg[]) => Msg[]
|
|
303
|
+
}
|
|
304
|
+
voice: {
|
|
305
|
+
setVoiceEnabled: StateSetter<boolean>
|
|
306
|
+
setVoiceRecordKey: (v: ParsedVoiceRecordKey) => void
|
|
307
|
+
setVoiceTts: StateSetter<boolean>
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export interface AppLayoutActions {
|
|
312
|
+
answerApproval: (choice: string) => void
|
|
313
|
+
answerClarify: (answer: string) => void
|
|
314
|
+
answerSecret: (value: string) => void
|
|
315
|
+
answerSudo: (pw: string) => void
|
|
316
|
+
clearSelection: () => void
|
|
317
|
+
activateLiveSession: (id: string) => void
|
|
318
|
+
closeLiveSession: (id: string) => Promise<null | SessionCloseResponse>
|
|
319
|
+
newLiveSession: () => void
|
|
320
|
+
newPromptSession: (prompt: string, modelArg?: string) => void
|
|
321
|
+
onModelSelect: (value: string) => void
|
|
322
|
+
resumeById: (id: string) => void
|
|
323
|
+
setStickyPrompt: (value: string) => void
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export interface AppLayoutComposerProps {
|
|
327
|
+
cols: number
|
|
328
|
+
compIdx: number
|
|
329
|
+
completions: CompletionItem[]
|
|
330
|
+
empty: boolean
|
|
331
|
+
handleTextPaste: (event: PasteEvent) => MaybePromise<ComposerPasteResult | null>
|
|
332
|
+
input: string
|
|
333
|
+
inputBuf: string[]
|
|
334
|
+
pagerPageSize: number
|
|
335
|
+
queueEditIdx: null | number
|
|
336
|
+
queuedDisplay: string[]
|
|
337
|
+
submit: (value: string) => void
|
|
338
|
+
updateInput: StateSetter<string>
|
|
339
|
+
voiceRecordKey: ParsedVoiceRecordKey
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export interface AppLayoutProgressProps {
|
|
343
|
+
showProgressArea: boolean
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export interface AppLayoutStatusProps {
|
|
347
|
+
cwdLabel: string
|
|
348
|
+
goodVibesTick: number
|
|
349
|
+
sessionStartedAt: null | number
|
|
350
|
+
showStickyPrompt: boolean
|
|
351
|
+
statusColor: string
|
|
352
|
+
stickyPrompt: string
|
|
353
|
+
turnStartedAt: null | number
|
|
354
|
+
voiceLabel: string
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export interface AppLayoutTranscriptProps {
|
|
358
|
+
historyItems: Msg[]
|
|
359
|
+
scrollRef: RefObject<null | ScrollBoxHandle>
|
|
360
|
+
virtualHistory: VirtualHistoryState
|
|
361
|
+
virtualRows: TranscriptRow[]
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export interface AppLayoutProps {
|
|
365
|
+
actions: AppLayoutActions
|
|
366
|
+
composer: AppLayoutComposerProps
|
|
367
|
+
mouseTracking: MouseTrackingMode
|
|
368
|
+
progress: AppLayoutProgressProps
|
|
369
|
+
status: AppLayoutStatusProps
|
|
370
|
+
transcript: AppLayoutTranscriptProps
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export interface AppOverlaysProps {
|
|
374
|
+
cols: number
|
|
375
|
+
compIdx: number
|
|
376
|
+
completions: CompletionItem[]
|
|
377
|
+
onApprovalChoice: (choice: string) => void
|
|
378
|
+
onClarifyAnswer: (value: string) => void
|
|
379
|
+
onActiveSessionSelect: (sessionId: string) => void
|
|
380
|
+
onActiveSessionClose: (sessionId: string) => Promise<null | SessionCloseResponse>
|
|
381
|
+
onModelSelect: (value: string) => void
|
|
382
|
+
onNewLiveSession: () => void
|
|
383
|
+
onNewPromptSession: (prompt: string, modelArg?: string) => void
|
|
384
|
+
onPickerSelect: (sessionId: string) => void
|
|
385
|
+
onSecretSubmit: (value: string) => void
|
|
386
|
+
onSudoSubmit: (pw: string) => void
|
|
387
|
+
pagerPageSize: number
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export interface PasteSnippet {
|
|
391
|
+
label: string
|
|
392
|
+
path?: string
|
|
393
|
+
text: string
|
|
394
|
+
}
|