openhorse 0.1.5
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/README.md +460 -0
- package/bin/openhorse +56 -0
- package/dist/agents/coder.d.ts +12 -0
- package/dist/agents/coder.d.ts.map +1 -0
- package/dist/agents/coder.js +48 -0
- package/dist/agents/coder.js.map +1 -0
- package/dist/agents/leader.d.ts +12 -0
- package/dist/agents/leader.d.ts.map +1 -0
- package/dist/agents/leader.js +49 -0
- package/dist/agents/leader.js.map +1 -0
- package/dist/agents/router.d.ts +59 -0
- package/dist/agents/router.d.ts.map +1 -0
- package/dist/agents/router.js +193 -0
- package/dist/agents/router.js.map +1 -0
- package/dist/cli-ink.d.ts +7 -0
- package/dist/cli-ink.d.ts.map +1 -0
- package/dist/cli-ink.js +135 -0
- package/dist/cli-ink.js.map +1 -0
- package/dist/cli.d.ts +7 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +638 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/index.d.ts +12 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +1095 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/parser.d.ts +26 -0
- package/dist/commands/parser.d.ts.map +1 -0
- package/dist/commands/parser.js +61 -0
- package/dist/commands/parser.js.map +1 -0
- package/dist/commands/types.d.ts +61 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +32 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/core/agent.d.ts +66 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +55 -0
- package/dist/core/agent.js.map +1 -0
- package/dist/core/brain.d.ts +41 -0
- package/dist/core/brain.d.ts.map +1 -0
- package/dist/core/brain.js +92 -0
- package/dist/core/brain.js.map +1 -0
- package/dist/core/cost-tracker.d.ts +107 -0
- package/dist/core/cost-tracker.d.ts.map +1 -0
- package/dist/core/cost-tracker.js +199 -0
- package/dist/core/cost-tracker.js.map +1 -0
- package/dist/core/strategy-tracker.d.ts +61 -0
- package/dist/core/strategy-tracker.d.ts.map +1 -0
- package/dist/core/strategy-tracker.js +124 -0
- package/dist/core/strategy-tracker.js.map +1 -0
- package/dist/framework/index.d.ts +20 -0
- package/dist/framework/index.d.ts.map +1 -0
- package/dist/framework/index.js +29 -0
- package/dist/framework/index.js.map +1 -0
- package/dist/framework/prompt.d.ts +40 -0
- package/dist/framework/prompt.d.ts.map +1 -0
- package/dist/framework/prompt.js +112 -0
- package/dist/framework/prompt.js.map +1 -0
- package/dist/framework/query.d.ts +86 -0
- package/dist/framework/query.d.ts.map +1 -0
- package/dist/framework/query.js +177 -0
- package/dist/framework/query.js.map +1 -0
- package/dist/framework/store.d.ts +64 -0
- package/dist/framework/store.d.ts.map +1 -0
- package/dist/framework/store.js +78 -0
- package/dist/framework/store.js.map +1 -0
- package/dist/framework/tool-state.d.ts +22 -0
- package/dist/framework/tool-state.d.ts.map +1 -0
- package/dist/framework/tool-state.js +40 -0
- package/dist/framework/tool-state.js.map +1 -0
- package/dist/framework/tool.d.ts +88 -0
- package/dist/framework/tool.d.ts.map +1 -0
- package/dist/framework/tool.js +60 -0
- package/dist/framework/tool.js.map +1 -0
- package/dist/harness/harness.d.ts +96 -0
- package/dist/harness/harness.d.ts.map +1 -0
- package/dist/harness/harness.js +224 -0
- package/dist/harness/harness.js.map +1 -0
- package/dist/harness/safety.d.ts +89 -0
- package/dist/harness/safety.d.ts.map +1 -0
- package/dist/harness/safety.js +178 -0
- package/dist/harness/safety.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/init.d.ts +178 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +473 -0
- package/dist/init.js.map +1 -0
- package/dist/ink/bidi.d.ts +16 -0
- package/dist/ink/bidi.d.ts.map +1 -0
- package/dist/ink/bidi.js +124 -0
- package/dist/ink/bidi.js.map +1 -0
- package/dist/ink/clearTerminal.d.ts +14 -0
- package/dist/ink/clearTerminal.d.ts.map +1 -0
- package/dist/ink/clearTerminal.js +63 -0
- package/dist/ink/clearTerminal.js.map +1 -0
- package/dist/ink/colorize.d.ts +17 -0
- package/dist/ink/colorize.d.ts.map +1 -0
- package/dist/ink/colorize.js +208 -0
- package/dist/ink/colorize.js.map +1 -0
- package/dist/ink/components/App.d.ts +73 -0
- package/dist/ink/components/App.d.ts.map +1 -0
- package/dist/ink/components/App.js +646 -0
- package/dist/ink/components/App.js.map +1 -0
- package/dist/ink/components/AppContext.d.ts +12 -0
- package/dist/ink/components/AppContext.d.ts.map +1 -0
- package/dist/ink/components/AppContext.js +14 -0
- package/dist/ink/components/AppContext.js.map +1 -0
- package/dist/ink/components/Box.d.ts +44 -0
- package/dist/ink/components/Box.d.ts.map +1 -0
- package/dist/ink/components/Box.js +191 -0
- package/dist/ink/components/Box.js.map +1 -0
- package/dist/ink/components/ClockContext.d.ts +9 -0
- package/dist/ink/components/ClockContext.d.ts.map +1 -0
- package/dist/ink/components/ClockContext.js +146 -0
- package/dist/ink/components/ClockContext.js.map +1 -0
- package/dist/ink/components/CursorDeclarationContext.d.ts +23 -0
- package/dist/ink/components/CursorDeclarationContext.d.ts.map +1 -0
- package/dist/ink/components/CursorDeclarationContext.js +6 -0
- package/dist/ink/components/CursorDeclarationContext.js.map +1 -0
- package/dist/ink/components/ErrorOverview.d.ts +6 -0
- package/dist/ink/components/ErrorOverview.d.ts.map +1 -0
- package/dist/ink/components/ErrorOverview.js +27 -0
- package/dist/ink/components/ErrorOverview.js.map +1 -0
- package/dist/ink/components/Newline.d.ts +13 -0
- package/dist/ink/components/Newline.d.ts.map +1 -0
- package/dist/ink/components/Newline.js +36 -0
- package/dist/ink/components/Newline.js.map +1 -0
- package/dist/ink/components/NoSelect.d.ts +20 -0
- package/dist/ink/components/NoSelect.d.ts.map +1 -0
- package/dist/ink/components/NoSelect.js +63 -0
- package/dist/ink/components/NoSelect.js.map +1 -0
- package/dist/ink/components/RawAnsi.d.ts +17 -0
- package/dist/ink/components/RawAnsi.d.ts.map +1 -0
- package/dist/ink/components/RawAnsi.js +52 -0
- package/dist/ink/components/RawAnsi.js.map +1 -0
- package/dist/ink/components/Spacer.d.ts +6 -0
- package/dist/ink/components/Spacer.d.ts.map +1 -0
- package/dist/ink/components/Spacer.js +26 -0
- package/dist/ink/components/Spacer.js.map +1 -0
- package/dist/ink/components/StdinContext.d.ts +28 -0
- package/dist/ink/components/StdinContext.d.ts.map +1 -0
- package/dist/ink/components/StdinContext.js +19 -0
- package/dist/ink/components/StdinContext.js.map +1 -0
- package/dist/ink/components/TerminalFocusContext.d.ts +10 -0
- package/dist/ink/components/TerminalFocusContext.d.ts.map +1 -0
- package/dist/ink/components/TerminalFocusContext.js +81 -0
- package/dist/ink/components/TerminalFocusContext.js.map +1 -0
- package/dist/ink/components/TerminalSizeContext.d.ts +6 -0
- package/dist/ink/components/TerminalSizeContext.d.ts.map +1 -0
- package/dist/ink/components/TerminalSizeContext.js +6 -0
- package/dist/ink/components/TerminalSizeContext.js.map +1 -0
- package/dist/ink/components/Text.d.ts +56 -0
- package/dist/ink/components/Text.d.ts.map +1 -0
- package/dist/ink/components/Text.js +201 -0
- package/dist/ink/components/Text.js.map +1 -0
- package/dist/ink/constants.d.ts +2 -0
- package/dist/ink/constants.d.ts.map +1 -0
- package/dist/ink/constants.js +6 -0
- package/dist/ink/constants.js.map +1 -0
- package/dist/ink/devtools.d.ts +3 -0
- package/dist/ink/devtools.d.ts.map +1 -0
- package/dist/ink/devtools.js +5 -0
- package/dist/ink/devtools.js.map +1 -0
- package/dist/ink/dom.d.ts +77 -0
- package/dist/ink/dom.d.ts.map +1 -0
- package/dist/ink/dom.js +322 -0
- package/dist/ink/dom.js.map +1 -0
- package/dist/ink/events/click-event.d.ts +32 -0
- package/dist/ink/events/click-event.d.ts.map +1 -0
- package/dist/ink/events/click-event.js +30 -0
- package/dist/ink/events/click-event.js.map +1 -0
- package/dist/ink/events/dispatcher.d.ts +41 -0
- package/dist/ink/events/dispatcher.d.ts.map +1 -0
- package/dist/ink/events/dispatcher.js +181 -0
- package/dist/ink/events/dispatcher.js.map +1 -0
- package/dist/ink/events/emitter.d.ts +6 -0
- package/dist/ink/events/emitter.d.ts.map +1 -0
- package/dist/ink/events/emitter.js +36 -0
- package/dist/ink/events/emitter.js.map +1 -0
- package/dist/ink/events/event-handlers.d.ts +47 -0
- package/dist/ink/events/event-handlers.d.ts.map +1 -0
- package/dist/ink/events/event-handlers.js +34 -0
- package/dist/ink/events/event-handlers.js.map +1 -0
- package/dist/ink/events/event.d.ts +6 -0
- package/dist/ink/events/event.d.ts.map +1 -0
- package/dist/ink/events/event.js +16 -0
- package/dist/ink/events/event.js.map +1 -0
- package/dist/ink/events/focus-event.d.ts +14 -0
- package/dist/ink/events/focus-event.d.ts.map +1 -0
- package/dist/ink/events/focus-event.js +20 -0
- package/dist/ink/events/focus-event.js.map +1 -0
- package/dist/ink/events/input-event.d.ts +31 -0
- package/dist/ink/events/input-event.d.ts.map +1 -0
- package/dist/ink/events/input-event.js +163 -0
- package/dist/ink/events/input-event.js.map +1 -0
- package/dist/ink/events/keyboard-event.d.ts +20 -0
- package/dist/ink/events/keyboard-event.d.ts.map +1 -0
- package/dist/ink/events/keyboard-event.js +44 -0
- package/dist/ink/events/keyboard-event.js.map +1 -0
- package/dist/ink/events/terminal-event.d.ts +55 -0
- package/dist/ink/events/terminal-event.d.ts.map +1 -0
- package/dist/ink/events/terminal-event.js +79 -0
- package/dist/ink/events/terminal-event.js.map +1 -0
- package/dist/ink/events/terminal-focus-event.d.ts +14 -0
- package/dist/ink/events/terminal-focus-event.d.ts.map +1 -0
- package/dist/ink/events/terminal-focus-event.js +19 -0
- package/dist/ink/events/terminal-focus-event.js.map +1 -0
- package/dist/ink/focus.d.ts +44 -0
- package/dist/ink/focus.d.ts.map +1 -0
- package/dist/ink/focus.js +164 -0
- package/dist/ink/focus.js.map +1 -0
- package/dist/ink/frame.d.ts +95 -0
- package/dist/ink/frame.d.ts.map +1 -0
- package/dist/ink/frame.js +35 -0
- package/dist/ink/frame.js.map +1 -0
- package/dist/ink/get-max-width.d.ts +18 -0
- package/dist/ink/get-max-width.d.ts.map +1 -0
- package/dist/ink/get-max-width.js +26 -0
- package/dist/ink/get-max-width.js.map +1 -0
- package/dist/ink/hit-test.d.ts +34 -0
- package/dist/ink/hit-test.d.ts.map +1 -0
- package/dist/ink/hit-test.js +119 -0
- package/dist/ink/hit-test.js.map +1 -0
- package/dist/ink/hooks/use-animation-frame.d.ts +27 -0
- package/dist/ink/hooks/use-animation-frame.d.ts.map +1 -0
- package/dist/ink/hooks/use-animation-frame.js +52 -0
- package/dist/ink/hooks/use-animation-frame.js.map +1 -0
- package/dist/ink/hooks/use-app.d.ts +6 -0
- package/dist/ink/hooks/use-app.d.ts.map +1 -0
- package/dist/ink/hooks/use-app.js +13 -0
- package/dist/ink/hooks/use-app.js.map +1 -0
- package/dist/ink/hooks/use-declared-cursor.d.ts +27 -0
- package/dist/ink/hooks/use-declared-cursor.d.ts.map +1 -0
- package/dist/ink/hooks/use-declared-cursor.js +67 -0
- package/dist/ink/hooks/use-declared-cursor.js.map +1 -0
- package/dist/ink/hooks/use-input.d.ts +38 -0
- package/dist/ink/hooks/use-input.d.ts.map +1 -0
- package/dist/ink/hooks/use-input.js +86 -0
- package/dist/ink/hooks/use-input.js.map +1 -0
- package/dist/ink/hooks/use-interval.d.ts +19 -0
- package/dist/ink/hooks/use-interval.d.ts.map +1 -0
- package/dist/ink/hooks/use-interval.js +59 -0
- package/dist/ink/hooks/use-interval.js.map +1 -0
- package/dist/ink/hooks/use-search-highlight.d.ts +31 -0
- package/dist/ink/hooks/use-search-highlight.d.ts.map +1 -0
- package/dist/ink/hooks/use-search-highlight.js +39 -0
- package/dist/ink/hooks/use-search-highlight.js.map +1 -0
- package/dist/ink/hooks/use-selection.d.ts +40 -0
- package/dist/ink/hooks/use-selection.d.ts.map +1 -0
- package/dist/ink/hooks/use-selection.js +68 -0
- package/dist/ink/hooks/use-selection.js.map +1 -0
- package/dist/ink/hooks/use-stdin.d.ts +6 -0
- package/dist/ink/hooks/use-stdin.d.ts.map +1 -0
- package/dist/ink/hooks/use-stdin.js +13 -0
- package/dist/ink/hooks/use-stdin.js.map +1 -0
- package/dist/ink/hooks/use-tab-status.d.ts +14 -0
- package/dist/ink/hooks/use-tab-status.d.ts.map +1 -0
- package/dist/ink/hooks/use-tab-status.js +61 -0
- package/dist/ink/hooks/use-tab-status.js.map +1 -0
- package/dist/ink/hooks/use-terminal-focus.d.ts +11 -0
- package/dist/ink/hooks/use-terminal-focus.d.ts.map +1 -0
- package/dist/ink/hooks/use-terminal-focus.js +22 -0
- package/dist/ink/hooks/use-terminal-focus.js.map +1 -0
- package/dist/ink/hooks/use-terminal-title.d.ts +13 -0
- package/dist/ink/hooks/use-terminal-title.d.ts.map +1 -0
- package/dist/ink/hooks/use-terminal-title.js +36 -0
- package/dist/ink/hooks/use-terminal-title.js.map +1 -0
- package/dist/ink/hooks/use-terminal-viewport.d.ts +30 -0
- package/dist/ink/hooks/use-terminal-viewport.d.ts.map +1 -0
- package/dist/ink/hooks/use-terminal-viewport.js +81 -0
- package/dist/ink/hooks/use-terminal-viewport.js.map +1 -0
- package/dist/ink/index.d.ts +54 -0
- package/dist/ink/index.d.ts.map +1 -0
- package/dist/ink/index.js +111 -0
- package/dist/ink/index.js.map +1 -0
- package/dist/ink/ink.d.ts +371 -0
- package/dist/ink/ink.d.ts.map +1 -0
- package/dist/ink/ink.js +1686 -0
- package/dist/ink/ink.js.map +1 -0
- package/dist/ink/instances.d.ts +4 -0
- package/dist/ink/instances.d.ts.map +1 -0
- package/dist/ink/instances.js +10 -0
- package/dist/ink/instances.js.map +1 -0
- package/dist/ink/line-width-cache.d.ts +2 -0
- package/dist/ink/line-width-cache.d.ts.map +1 -0
- package/dist/ink/line-width-cache.js +23 -0
- package/dist/ink/line-width-cache.js.map +1 -0
- package/dist/ink/log-update.d.ts +18 -0
- package/dist/ink/log-update.d.ts.map +1 -0
- package/dist/ink/log-update.js +637 -0
- package/dist/ink/log-update.js.map +1 -0
- package/dist/ink/measure-element.d.ts +17 -0
- package/dist/ink/measure-element.d.ts.map +1 -0
- package/dist/ink/measure-element.js +11 -0
- package/dist/ink/measure-element.js.map +1 -0
- package/dist/ink/measure-text.d.ts +7 -0
- package/dist/ink/measure-text.d.ts.map +1 -0
- package/dist/ink/measure-text.js +38 -0
- package/dist/ink/measure-text.js.map +1 -0
- package/dist/ink/node-cache.d.ts +21 -0
- package/dist/ink/node-cache.d.ts.map +1 -0
- package/dist/ink/node-cache.js +36 -0
- package/dist/ink/node-cache.js.map +1 -0
- package/dist/ink/optimizer.d.ts +16 -0
- package/dist/ink/optimizer.d.ts.map +1 -0
- package/dist/ink/optimizer.js +85 -0
- package/dist/ink/optimizer.js.map +1 -0
- package/dist/ink/output.d.ts +120 -0
- package/dist/ink/output.d.ts.map +1 -0
- package/dist/ink/output.js +559 -0
- package/dist/ink/output.js.map +1 -0
- package/dist/ink/parse-keypress.d.ts +112 -0
- package/dist/ink/parse-keypress.d.ts.map +1 -0
- package/dist/ink/parse-keypress.js +719 -0
- package/dist/ink/parse-keypress.js.map +1 -0
- package/dist/ink/parse-keypress.test.d.ts +2 -0
- package/dist/ink/parse-keypress.test.d.ts.map +1 -0
- package/dist/ink/parse-keypress.test.js +37 -0
- package/dist/ink/parse-keypress.test.js.map +1 -0
- package/dist/ink/reconciler.d.ts +12 -0
- package/dist/ink/reconciler.d.ts.map +1 -0
- package/dist/ink/reconciler.js +456 -0
- package/dist/ink/reconciler.js.map +1 -0
- package/dist/ink/render-border.d.ts +25 -0
- package/dist/ink/render-border.d.ts.map +1 -0
- package/dist/ink/render-border.js +141 -0
- package/dist/ink/render-border.js.map +1 -0
- package/dist/ink/render-node-to-output.d.ts +46 -0
- package/dist/ink/render-node-to-output.d.ts.map +1 -0
- package/dist/ink/render-node-to-output.js +1257 -0
- package/dist/ink/render-node-to-output.js.map +1 -0
- package/dist/ink/render-to-screen.d.ts +47 -0
- package/dist/ink/render-to-screen.d.ts.map +1 -0
- package/dist/ink/render-to-screen.js +213 -0
- package/dist/ink/render-to-screen.js.map +1 -0
- package/dist/ink/renderer.d.ts +15 -0
- package/dist/ink/renderer.d.ts.map +1 -0
- package/dist/ink/renderer.js +169 -0
- package/dist/ink/renderer.js.map +1 -0
- package/dist/ink/root.d.ts +75 -0
- package/dist/ink/root.d.ts.map +1 -0
- package/dist/ink/root.js +89 -0
- package/dist/ink/root.js.map +1 -0
- package/dist/ink/screen.d.ts +270 -0
- package/dist/ink/screen.d.ts.map +1 -0
- package/dist/ink/screen.js +1194 -0
- package/dist/ink/screen.js.map +1 -0
- package/dist/ink/searchHighlight.d.ts +21 -0
- package/dist/ink/searchHighlight.d.ts.map +1 -0
- package/dist/ink/searchHighlight.js +82 -0
- package/dist/ink/searchHighlight.js.map +1 -0
- package/dist/ink/selection.d.ts +230 -0
- package/dist/ink/selection.d.ts.map +1 -0
- package/dist/ink/selection.js +814 -0
- package/dist/ink/selection.js.map +1 -0
- package/dist/ink/squash-text-nodes.d.ts +23 -0
- package/dist/ink/squash-text-nodes.d.ts.map +1 -0
- package/dist/ink/squash-text-nodes.js +60 -0
- package/dist/ink/squash-text-nodes.js.map +1 -0
- package/dist/ink/stringWidth.d.ts +2 -0
- package/dist/ink/stringWidth.d.ts.map +1 -0
- package/dist/ink/stringWidth.js +207 -0
- package/dist/ink/stringWidth.js.map +1 -0
- package/dist/ink/styles.d.ts +307 -0
- package/dist/ink/styles.d.ts.map +1 -0
- package/dist/ink/styles.js +302 -0
- package/dist/ink/styles.js.map +1 -0
- package/dist/ink/supports-hyperlinks.d.ts +14 -0
- package/dist/ink/supports-hyperlinks.d.ts.map +1 -0
- package/dist/ink/supports-hyperlinks.js +48 -0
- package/dist/ink/supports-hyperlinks.js.map +1 -0
- package/dist/ink/tabstops.d.ts +2 -0
- package/dist/ink/tabstops.d.ts.map +1 -0
- package/dist/ink/tabstops.js +43 -0
- package/dist/ink/tabstops.js.map +1 -0
- package/dist/ink/terminal-focus-state.d.ts +7 -0
- package/dist/ink/terminal-focus-state.d.ts.map +1 -0
- package/dist/ink/terminal-focus-state.js +43 -0
- package/dist/ink/terminal-focus-state.js.map +1 -0
- package/dist/ink/terminal-querier.d.ts +130 -0
- package/dist/ink/terminal-querier.d.ts.map +1 -0
- package/dist/ink/terminal-querier.js +184 -0
- package/dist/ink/terminal-querier.js.map +1 -0
- package/dist/ink/terminal.d.ts +56 -0
- package/dist/ink/terminal.d.ts.map +1 -0
- package/dist/ink/terminal.js +249 -0
- package/dist/ink/terminal.js.map +1 -0
- package/dist/ink/termio/csi.d.ts +166 -0
- package/dist/ink/termio/csi.d.ts.map +1 -0
- package/dist/ink/termio/csi.js +285 -0
- package/dist/ink/termio/csi.js.map +1 -0
- package/dist/ink/termio/dec.d.ts +38 -0
- package/dist/ink/termio/dec.d.ts.map +1 -0
- package/dist/ink/termio/dec.js +59 -0
- package/dist/ink/termio/dec.js.map +1 -0
- package/dist/ink/termio.d.ts +25 -0
- package/dist/ink/termio.d.ts.map +1 -0
- package/dist/ink/termio.js +32 -0
- package/dist/ink/termio.js.map +1 -0
- package/dist/ink/useTerminalNotification.d.ts +27 -0
- package/dist/ink/useTerminalNotification.d.ts.map +1 -0
- package/dist/ink/useTerminalNotification.js +62 -0
- package/dist/ink/useTerminalNotification.js.map +1 -0
- package/dist/ink/warn.d.ts +2 -0
- package/dist/ink/warn.d.ts.map +1 -0
- package/dist/ink/warn.js +14 -0
- package/dist/ink/warn.js.map +1 -0
- package/dist/ink/widest-line.d.ts +2 -0
- package/dist/ink/widest-line.d.ts.map +1 -0
- package/dist/ink/widest-line.js +18 -0
- package/dist/ink/widest-line.js.map +1 -0
- package/dist/ink/wrap-text.d.ts +3 -0
- package/dist/ink/wrap-text.d.ts.map +1 -0
- package/dist/ink/wrap-text.js +61 -0
- package/dist/ink/wrap-text.js.map +1 -0
- package/dist/ink/wrapAnsi.d.ts +8 -0
- package/dist/ink/wrapAnsi.d.ts.map +1 -0
- package/dist/ink/wrapAnsi.js +13 -0
- package/dist/ink/wrapAnsi.js.map +1 -0
- package/dist/memory/embeddings.d.ts +33 -0
- package/dist/memory/embeddings.d.ts.map +1 -0
- package/dist/memory/embeddings.js +123 -0
- package/dist/memory/embeddings.js.map +1 -0
- package/dist/memory/index.d.ts +14 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +31 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/prompts.d.ts +12 -0
- package/dist/memory/prompts.d.ts.map +1 -0
- package/dist/memory/prompts.js +117 -0
- package/dist/memory/prompts.js.map +1 -0
- package/dist/memory/semantic-search.d.ts +45 -0
- package/dist/memory/semantic-search.d.ts.map +1 -0
- package/dist/memory/semantic-search.js +112 -0
- package/dist/memory/semantic-search.js.map +1 -0
- package/dist/memory/storage.d.ts +79 -0
- package/dist/memory/storage.d.ts.map +1 -0
- package/dist/memory/storage.js +285 -0
- package/dist/memory/storage.js.map +1 -0
- package/dist/memory/store.d.ts +103 -0
- package/dist/memory/store.d.ts.map +1 -0
- package/dist/memory/store.js +226 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/memory/types.d.ts +40 -0
- package/dist/memory/types.d.ts.map +1 -0
- package/dist/memory/types.js +71 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/memory/validation.d.ts +28 -0
- package/dist/memory/validation.d.ts.map +1 -0
- package/dist/memory/validation.js +147 -0
- package/dist/memory/validation.js.map +1 -0
- package/dist/memory/vector-store.d.ts +49 -0
- package/dist/memory/vector-store.d.ts.map +1 -0
- package/dist/memory/vector-store.js +259 -0
- package/dist/memory/vector-store.js.map +1 -0
- package/dist/screens/REPL.d.ts +21 -0
- package/dist/screens/REPL.d.ts.map +1 -0
- package/dist/screens/REPL.js +139 -0
- package/dist/screens/REPL.js.map +1 -0
- package/dist/services/agent-runner.d.ts +68 -0
- package/dist/services/agent-runner.d.ts.map +1 -0
- package/dist/services/agent-runner.js +186 -0
- package/dist/services/agent-runner.js.map +1 -0
- package/dist/services/atomic-write.d.ts +12 -0
- package/dist/services/atomic-write.d.ts.map +1 -0
- package/dist/services/atomic-write.js +27 -0
- package/dist/services/atomic-write.js.map +1 -0
- package/dist/services/config-dir.d.ts +55 -0
- package/dist/services/config-dir.d.ts.map +1 -0
- package/dist/services/config-dir.js +136 -0
- package/dist/services/config-dir.js.map +1 -0
- package/dist/services/config.d.ts +54 -0
- package/dist/services/config.d.ts.map +1 -0
- package/dist/services/config.js +98 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/file-glob.d.ts +26 -0
- package/dist/services/file-glob.d.ts.map +1 -0
- package/dist/services/file-glob.js +134 -0
- package/dist/services/file-glob.js.map +1 -0
- package/dist/services/global-config.d.ts +109 -0
- package/dist/services/global-config.d.ts.map +1 -0
- package/dist/services/global-config.js +211 -0
- package/dist/services/global-config.js.map +1 -0
- package/dist/services/llm.d.ts +139 -0
- package/dist/services/llm.d.ts.map +1 -0
- package/dist/services/llm.js +376 -0
- package/dist/services/llm.js.map +1 -0
- package/dist/services/memory.d.ts +39 -0
- package/dist/services/memory.d.ts.map +1 -0
- package/dist/services/memory.js +88 -0
- package/dist/services/memory.js.map +1 -0
- package/dist/services/session-storage.d.ts +136 -0
- package/dist/services/session-storage.d.ts.map +1 -0
- package/dist/services/session-storage.js +304 -0
- package/dist/services/session-storage.js.map +1 -0
- package/dist/services/task-manager.d.ts +154 -0
- package/dist/services/task-manager.d.ts.map +1 -0
- package/dist/services/task-manager.js +288 -0
- package/dist/services/task-manager.js.map +1 -0
- package/dist/services/yaml-config.d.ts +57 -0
- package/dist/services/yaml-config.d.ts.map +1 -0
- package/dist/services/yaml-config.js +176 -0
- package/dist/services/yaml-config.js.map +1 -0
- package/dist/skills/discovery.d.ts +22 -0
- package/dist/skills/discovery.d.ts.map +1 -0
- package/dist/skills/discovery.js +75 -0
- package/dist/skills/discovery.js.map +1 -0
- package/dist/skills/index.d.ts +10 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +26 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/loader.d.ts +48 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +231 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/registry.d.ts +37 -0
- package/dist/skills/registry.d.ts.map +1 -0
- package/dist/skills/registry.js +134 -0
- package/dist/skills/registry.js.map +1 -0
- package/dist/skills/types.d.ts +89 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +24 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/tools/bash_security.d.ts +64 -0
- package/dist/tools/bash_security.d.ts.map +1 -0
- package/dist/tools/bash_security.js +291 -0
- package/dist/tools/bash_security.js.map +1 -0
- package/dist/tools/index.d.ts +23 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +965 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/mcp.d.ts +72 -0
- package/dist/tools/mcp.d.ts.map +1 -0
- package/dist/tools/mcp.js +422 -0
- package/dist/tools/mcp.js.map +1 -0
- package/dist/tools/plan.d.ts +18 -0
- package/dist/tools/plan.d.ts.map +1 -0
- package/dist/tools/plan.js +75 -0
- package/dist/tools/plan.js.map +1 -0
- package/dist/tools/todo.d.ts +18 -0
- package/dist/tools/todo.d.ts.map +1 -0
- package/dist/tools/todo.js +153 -0
- package/dist/tools/todo.js.map +1 -0
- package/dist/tools/web.d.ts +13 -0
- package/dist/tools/web.d.ts.map +1 -0
- package/dist/tools/web.js +377 -0
- package/dist/tools/web.js.map +1 -0
- package/dist/ui/box.d.ts +56 -0
- package/dist/ui/box.d.ts.map +1 -0
- package/dist/ui/box.js +241 -0
- package/dist/ui/box.js.map +1 -0
- package/dist/ui/command-panel.d.ts +55 -0
- package/dist/ui/command-panel.d.ts.map +1 -0
- package/dist/ui/command-panel.js +212 -0
- package/dist/ui/command-panel.js.map +1 -0
- package/dist/ui/file-completion.d.ts +62 -0
- package/dist/ui/file-completion.d.ts.map +1 -0
- package/dist/ui/file-completion.js +209 -0
- package/dist/ui/file-completion.js.map +1 -0
- package/dist/ui/markdown.d.ts +12 -0
- package/dist/ui/markdown.d.ts.map +1 -0
- package/dist/ui/markdown.js +215 -0
- package/dist/ui/markdown.js.map +1 -0
- package/dist/ui/multiline-input.d.ts +47 -0
- package/dist/ui/multiline-input.d.ts.map +1 -0
- package/dist/ui/multiline-input.js +94 -0
- package/dist/ui/multiline-input.js.map +1 -0
- package/dist/ui/status-bar.d.ts +33 -0
- package/dist/ui/status-bar.d.ts.map +1 -0
- package/dist/ui/status-bar.js +96 -0
- package/dist/ui/status-bar.js.map +1 -0
- package/dist/ui/stream-markdown.d.ts +35 -0
- package/dist/ui/stream-markdown.d.ts.map +1 -0
- package/dist/ui/stream-markdown.js +138 -0
- package/dist/ui/stream-markdown.js.map +1 -0
- package/dist/ui/suggestions.d.ts +35 -0
- package/dist/ui/suggestions.d.ts.map +1 -0
- package/dist/ui/suggestions.js +118 -0
- package/dist/ui/suggestions.js.map +1 -0
- package/dist/ui/tool-preview.d.ts +34 -0
- package/dist/ui/tool-preview.d.ts.map +1 -0
- package/dist/ui/tool-preview.js +128 -0
- package/dist/ui/tool-preview.js.map +1 -0
- package/package.json +93 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DOMElement } from './dom.js';
|
|
2
|
+
/**
|
|
3
|
+
* Find the deepest DOM element whose rendered rect contains (col, row).
|
|
4
|
+
*
|
|
5
|
+
* Uses the nodeCache populated by renderNodeToOutput — rects are in screen
|
|
6
|
+
* coordinates with all offsets (including scrollTop translation) already
|
|
7
|
+
* applied. Children are traversed in reverse so later siblings (painted on
|
|
8
|
+
* top) win. Nodes not in nodeCache (not rendered this frame, or lacking a
|
|
9
|
+
* yogaNode) are skipped along with their subtrees.
|
|
10
|
+
*
|
|
11
|
+
* Returns the hit node even if it has no onClick — dispatchClick walks up
|
|
12
|
+
* via parentNode to find handlers.
|
|
13
|
+
*/
|
|
14
|
+
export declare function hitTest(node: DOMElement, col: number, row: number): DOMElement | null;
|
|
15
|
+
/**
|
|
16
|
+
* Hit-test the root at (col, row) and bubble a ClickEvent from the deepest
|
|
17
|
+
* containing node up through parentNode. Only nodes with an onClick handler
|
|
18
|
+
* fire. Stops when a handler calls stopImmediatePropagation(). Returns
|
|
19
|
+
* true if at least one onClick handler fired.
|
|
20
|
+
*/
|
|
21
|
+
export declare function dispatchClick(root: DOMElement, col: number, row: number, cellIsBlank?: boolean): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Fire onMouseEnter/onMouseLeave as the pointer moves. Like DOM
|
|
24
|
+
* mouseenter/mouseleave: does NOT bubble — moving between children does
|
|
25
|
+
* not re-fire on the parent. Walks up from the hit node collecting every
|
|
26
|
+
* ancestor with a hover handler; diffs against the previous hovered set;
|
|
27
|
+
* fires leave on the nodes exited, enter on the nodes entered.
|
|
28
|
+
*
|
|
29
|
+
* Mutates `hovered` in place so the caller (App instance) can hold it
|
|
30
|
+
* across calls. Clears the set when the hit is null (cursor moved into a
|
|
31
|
+
* non-rendered gap or off the root rect).
|
|
32
|
+
*/
|
|
33
|
+
export declare function dispatchHover(root: DOMElement, col: number, row: number, hovered: Set<DOMElement>): void;
|
|
34
|
+
//# sourceMappingURL=hit-test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hit-test.d.ts","sourceRoot":"","sources":["../../src/ink/hit-test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAK1C;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CACrB,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,GACV,UAAU,GAAG,IAAI,CAmBnB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,WAAW,UAAQ,GAClB,OAAO,CAmCT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,GAAG,CAAC,UAAU,CAAC,GACvB,IAAI,CAuBN"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hitTest = hitTest;
|
|
4
|
+
exports.dispatchClick = dispatchClick;
|
|
5
|
+
exports.dispatchHover = dispatchHover;
|
|
6
|
+
const click_event_js_1 = require("./events/click-event.js");
|
|
7
|
+
const node_cache_js_1 = require("./node-cache.js");
|
|
8
|
+
/**
|
|
9
|
+
* Find the deepest DOM element whose rendered rect contains (col, row).
|
|
10
|
+
*
|
|
11
|
+
* Uses the nodeCache populated by renderNodeToOutput — rects are in screen
|
|
12
|
+
* coordinates with all offsets (including scrollTop translation) already
|
|
13
|
+
* applied. Children are traversed in reverse so later siblings (painted on
|
|
14
|
+
* top) win. Nodes not in nodeCache (not rendered this frame, or lacking a
|
|
15
|
+
* yogaNode) are skipped along with their subtrees.
|
|
16
|
+
*
|
|
17
|
+
* Returns the hit node even if it has no onClick — dispatchClick walks up
|
|
18
|
+
* via parentNode to find handlers.
|
|
19
|
+
*/
|
|
20
|
+
function hitTest(node, col, row) {
|
|
21
|
+
const rect = node_cache_js_1.nodeCache.get(node);
|
|
22
|
+
if (!rect)
|
|
23
|
+
return null;
|
|
24
|
+
if (col < rect.x ||
|
|
25
|
+
col >= rect.x + rect.width ||
|
|
26
|
+
row < rect.y ||
|
|
27
|
+
row >= rect.y + rect.height) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
// Later siblings paint on top; reversed traversal returns topmost hit.
|
|
31
|
+
for (let i = node.childNodes.length - 1; i >= 0; i--) {
|
|
32
|
+
const child = node.childNodes[i];
|
|
33
|
+
if (child.nodeName === '#text')
|
|
34
|
+
continue;
|
|
35
|
+
const hit = hitTest(child, col, row);
|
|
36
|
+
if (hit)
|
|
37
|
+
return hit;
|
|
38
|
+
}
|
|
39
|
+
return node;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Hit-test the root at (col, row) and bubble a ClickEvent from the deepest
|
|
43
|
+
* containing node up through parentNode. Only nodes with an onClick handler
|
|
44
|
+
* fire. Stops when a handler calls stopImmediatePropagation(). Returns
|
|
45
|
+
* true if at least one onClick handler fired.
|
|
46
|
+
*/
|
|
47
|
+
function dispatchClick(root, col, row, cellIsBlank = false) {
|
|
48
|
+
let target = hitTest(root, col, row) ?? undefined;
|
|
49
|
+
if (!target)
|
|
50
|
+
return false;
|
|
51
|
+
// Click-to-focus: find the closest focusable ancestor and focus it.
|
|
52
|
+
// root is always ink-root, which owns the FocusManager.
|
|
53
|
+
if (root.focusManager) {
|
|
54
|
+
let focusTarget = target;
|
|
55
|
+
while (focusTarget) {
|
|
56
|
+
if (typeof focusTarget.attributes['tabIndex'] === 'number') {
|
|
57
|
+
root.focusManager.handleClickFocus(focusTarget);
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
focusTarget = focusTarget.parentNode;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
const event = new click_event_js_1.ClickEvent(col, row, cellIsBlank);
|
|
64
|
+
let handled = false;
|
|
65
|
+
while (target) {
|
|
66
|
+
const handler = target._eventHandlers?.onClick;
|
|
67
|
+
if (handler) {
|
|
68
|
+
handled = true;
|
|
69
|
+
const rect = node_cache_js_1.nodeCache.get(target);
|
|
70
|
+
if (rect) {
|
|
71
|
+
event.localCol = col - rect.x;
|
|
72
|
+
event.localRow = row - rect.y;
|
|
73
|
+
}
|
|
74
|
+
handler(event);
|
|
75
|
+
if (event.didStopImmediatePropagation())
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
target = target.parentNode;
|
|
79
|
+
}
|
|
80
|
+
return handled;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Fire onMouseEnter/onMouseLeave as the pointer moves. Like DOM
|
|
84
|
+
* mouseenter/mouseleave: does NOT bubble — moving between children does
|
|
85
|
+
* not re-fire on the parent. Walks up from the hit node collecting every
|
|
86
|
+
* ancestor with a hover handler; diffs against the previous hovered set;
|
|
87
|
+
* fires leave on the nodes exited, enter on the nodes entered.
|
|
88
|
+
*
|
|
89
|
+
* Mutates `hovered` in place so the caller (App instance) can hold it
|
|
90
|
+
* across calls. Clears the set when the hit is null (cursor moved into a
|
|
91
|
+
* non-rendered gap or off the root rect).
|
|
92
|
+
*/
|
|
93
|
+
function dispatchHover(root, col, row, hovered) {
|
|
94
|
+
const next = new Set();
|
|
95
|
+
let node = hitTest(root, col, row) ?? undefined;
|
|
96
|
+
while (node) {
|
|
97
|
+
const h = node._eventHandlers;
|
|
98
|
+
if (h?.onMouseEnter || h?.onMouseLeave)
|
|
99
|
+
next.add(node);
|
|
100
|
+
node = node.parentNode;
|
|
101
|
+
}
|
|
102
|
+
for (const old of hovered) {
|
|
103
|
+
if (!next.has(old)) {
|
|
104
|
+
hovered.delete(old);
|
|
105
|
+
// Skip handlers on detached nodes (removed between mouse events)
|
|
106
|
+
if (old.parentNode) {
|
|
107
|
+
;
|
|
108
|
+
old._eventHandlers?.onMouseLeave?.();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
for (const n of next) {
|
|
113
|
+
if (!hovered.has(n)) {
|
|
114
|
+
hovered.add(n);
|
|
115
|
+
n._eventHandlers?.onMouseEnter?.();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=hit-test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hit-test.js","sourceRoot":"","sources":["../../src/ink/hit-test.ts"],"names":[],"mappings":";;AAiBA,0BAuBC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AI,SAAS,CAAA;IACvE,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,CAAC,GAAG,IAAI,CAAC,cAA+C,CAAA;QAC9D,IAAI,CAAC,EAAE,YAAY,IAAI,CAAC,EAAE,YAAY;YAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACtD,IAAI,GAAG,IAAI,CAAC,UAAU,CAAA;IACxB,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACnB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YACnB,iEAAiE;YACjE,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;gBACnB,CAAC;gBAAC,GAAG,CAAC,cAAgD,EAAE,YAAY,EAAE,EAAE,CAAA;YAC1E,CAAC;QACH,CAAC;IACH,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CACb;YAAC,CAAC,CAAC,cAAgD,EAAE,YAAY,EAAE,EAAE,CAAA;QACxE,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DOMElement } from '../dom.js';
|
|
2
|
+
/**
|
|
3
|
+
* Hook for synchronized animations that pause when offscreen.
|
|
4
|
+
*
|
|
5
|
+
* Returns a ref to attach to the animated element and the current animation time.
|
|
6
|
+
* All instances share the same clock, so animations stay in sync.
|
|
7
|
+
* The clock only runs when at least one keepAlive subscriber exists.
|
|
8
|
+
*
|
|
9
|
+
* Pass `null` to pause — unsubscribes from the clock so no ticks fire.
|
|
10
|
+
* Time freezes at the last value and resumes from the current clock time
|
|
11
|
+
* when a number is passed again.
|
|
12
|
+
*
|
|
13
|
+
* @param intervalMs - How often to update, or null to pause
|
|
14
|
+
* @returns [ref, time] - Ref to attach to element, elapsed time in ms
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* function Spinner() {
|
|
18
|
+
* const [ref, time] = useAnimationFrame(120)
|
|
19
|
+
* const frame = Math.floor(time / 120) % FRAMES.length
|
|
20
|
+
* return <Box ref={ref}>{FRAMES[frame]}</Box>
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* The clock automatically slows when the terminal is blurred,
|
|
24
|
+
* so consumers don't need to handle focus state.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useAnimationFrame(intervalMs?: number | null): [ref: (element: DOMElement | null) => void, time: number];
|
|
27
|
+
//# sourceMappingURL=use-animation-frame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-animation-frame.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-animation-frame.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAG3C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,GAAE,MAAM,GAAG,IAAS,GAC7B,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAyB3D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAnimationFrame = useAnimationFrame;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const ClockContext_js_1 = require("../components/ClockContext.js");
|
|
6
|
+
const use_terminal_viewport_js_1 = require("./use-terminal-viewport.js");
|
|
7
|
+
/**
|
|
8
|
+
* Hook for synchronized animations that pause when offscreen.
|
|
9
|
+
*
|
|
10
|
+
* Returns a ref to attach to the animated element and the current animation time.
|
|
11
|
+
* All instances share the same clock, so animations stay in sync.
|
|
12
|
+
* The clock only runs when at least one keepAlive subscriber exists.
|
|
13
|
+
*
|
|
14
|
+
* Pass `null` to pause — unsubscribes from the clock so no ticks fire.
|
|
15
|
+
* Time freezes at the last value and resumes from the current clock time
|
|
16
|
+
* when a number is passed again.
|
|
17
|
+
*
|
|
18
|
+
* @param intervalMs - How often to update, or null to pause
|
|
19
|
+
* @returns [ref, time] - Ref to attach to element, elapsed time in ms
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* function Spinner() {
|
|
23
|
+
* const [ref, time] = useAnimationFrame(120)
|
|
24
|
+
* const frame = Math.floor(time / 120) % FRAMES.length
|
|
25
|
+
* return <Box ref={ref}>{FRAMES[frame]}</Box>
|
|
26
|
+
* }
|
|
27
|
+
*
|
|
28
|
+
* The clock automatically slows when the terminal is blurred,
|
|
29
|
+
* so consumers don't need to handle focus state.
|
|
30
|
+
*/
|
|
31
|
+
function useAnimationFrame(intervalMs = 16) {
|
|
32
|
+
const clock = (0, react_1.useContext)(ClockContext_js_1.ClockContext);
|
|
33
|
+
const [viewportRef, { isVisible }] = (0, use_terminal_viewport_js_1.useTerminalViewport)();
|
|
34
|
+
const [time, setTime] = (0, react_1.useState)(() => clock?.now() ?? 0);
|
|
35
|
+
const active = isVisible && intervalMs !== null;
|
|
36
|
+
(0, react_1.useEffect)(() => {
|
|
37
|
+
if (!clock || !active)
|
|
38
|
+
return;
|
|
39
|
+
let lastUpdate = clock.now();
|
|
40
|
+
const onChange = () => {
|
|
41
|
+
const now = clock.now();
|
|
42
|
+
if (now - lastUpdate >= intervalMs) {
|
|
43
|
+
lastUpdate = now;
|
|
44
|
+
setTime(now);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
// keepAlive: true — visible animations drive the clock
|
|
48
|
+
return clock.subscribe(onChange, true);
|
|
49
|
+
}, [clock, intervalMs, active]);
|
|
50
|
+
return [viewportRef, time];
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=use-animation-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@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-app.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-app.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,QAAA,MAAM,MAAM,WAA+B,CAAA;AAC3C,eAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const AppContext_js_1 = __importDefault(require("../components/AppContext.js"));
|
|
8
|
+
/**
|
|
9
|
+
* `useApp` is a React hook, which exposes a method to manually exit the app (unmount).
|
|
10
|
+
*/
|
|
11
|
+
const useApp = () => (0, react_1.useContext)(AppContext_js_1.default);
|
|
12
|
+
exports.default = useApp;
|
|
13
|
+
//# sourceMappingURL=use-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-app.js","sourceRoot":"","sources":["../../../src/ink/hooks/use-app.ts"],"names":[],"mappings":";;;;;AAAA,iCAAkC;AAClC,gFAAoD;AAEpD;;GAEG;AACH,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAA,kBAAU,EAAC,uBAAU,CAAC,CAAA;AAC3C,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DOMElement } from '../dom.js';
|
|
2
|
+
/**
|
|
3
|
+
* Declares where the terminal cursor should be parked after each frame.
|
|
4
|
+
*
|
|
5
|
+
* Terminal emulators render IME preedit text at the physical cursor
|
|
6
|
+
* position, and screen readers / screen magnifiers track the native
|
|
7
|
+
* cursor — so parking it at the text input's caret makes CJK input
|
|
8
|
+
* appear inline and lets accessibility tools follow the input.
|
|
9
|
+
*
|
|
10
|
+
* Returns a ref callback to attach to the Box that contains the input.
|
|
11
|
+
* The declared (line, column) is interpreted relative to that Box's
|
|
12
|
+
* nodeCache rect (populated by renderNodeToOutput).
|
|
13
|
+
*
|
|
14
|
+
* Timing: Both ref attach and useLayoutEffect fire in React's layout
|
|
15
|
+
* phase — after resetAfterCommit calls scheduleRender. scheduleRender
|
|
16
|
+
* defers onRender via queueMicrotask, so onRender runs AFTER layout
|
|
17
|
+
* effects commit and reads the fresh declaration on the first frame
|
|
18
|
+
* (no one-keystroke lag). Test env uses onImmediateRender (synchronous,
|
|
19
|
+
* no microtask), so tests compensate by calling ink.onRender()
|
|
20
|
+
* explicitly after render.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useDeclaredCursor({ line, column, active, }: {
|
|
23
|
+
line: number;
|
|
24
|
+
column: number;
|
|
25
|
+
active: boolean;
|
|
26
|
+
}): (element: DOMElement | null) => void;
|
|
27
|
+
//# sourceMappingURL=use-declared-cursor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-declared-cursor.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-declared-cursor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,MAAM,EACN,MAAM,GACP,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,OAAO,CAAA;CAChB,GAAG,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,KAAK,IAAI,CAwCvC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useDeclaredCursor = useDeclaredCursor;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const CursorDeclarationContext_js_1 = __importDefault(require("../components/CursorDeclarationContext.js"));
|
|
9
|
+
/**
|
|
10
|
+
* Declares where the terminal cursor should be parked after each frame.
|
|
11
|
+
*
|
|
12
|
+
* Terminal emulators render IME preedit text at the physical cursor
|
|
13
|
+
* position, and screen readers / screen magnifiers track the native
|
|
14
|
+
* cursor — so parking it at the text input's caret makes CJK input
|
|
15
|
+
* appear inline and lets accessibility tools follow the input.
|
|
16
|
+
*
|
|
17
|
+
* Returns a ref callback to attach to the Box that contains the input.
|
|
18
|
+
* The declared (line, column) is interpreted relative to that Box's
|
|
19
|
+
* nodeCache rect (populated by renderNodeToOutput).
|
|
20
|
+
*
|
|
21
|
+
* Timing: Both ref attach and useLayoutEffect fire in React's layout
|
|
22
|
+
* phase — after resetAfterCommit calls scheduleRender. scheduleRender
|
|
23
|
+
* defers onRender via queueMicrotask, so onRender runs AFTER layout
|
|
24
|
+
* effects commit and reads the fresh declaration on the first frame
|
|
25
|
+
* (no one-keystroke lag). Test env uses onImmediateRender (synchronous,
|
|
26
|
+
* no microtask), so tests compensate by calling ink.onRender()
|
|
27
|
+
* explicitly after render.
|
|
28
|
+
*/
|
|
29
|
+
function useDeclaredCursor({ line, column, active, }) {
|
|
30
|
+
const setCursorDeclaration = (0, react_1.useContext)(CursorDeclarationContext_js_1.default);
|
|
31
|
+
const nodeRef = (0, react_1.useRef)(null);
|
|
32
|
+
const setNode = (0, react_1.useCallback)((node) => {
|
|
33
|
+
nodeRef.current = node;
|
|
34
|
+
}, []);
|
|
35
|
+
// When active, set unconditionally. When inactive, clear conditionally
|
|
36
|
+
// (only if the currently-declared node is ours). The node-identity check
|
|
37
|
+
// handles two hazards:
|
|
38
|
+
// 1. A memo()ized active instance elsewhere (e.g. the search input in
|
|
39
|
+
// a memo'd Footer) doesn't re-render this commit — an inactive
|
|
40
|
+
// instance re-rendering here must not clobber it.
|
|
41
|
+
// 2. Sibling handoff (menu focus moving between list items) — when
|
|
42
|
+
// focus moves opposite to sibling order, the newly-inactive item's
|
|
43
|
+
// effect runs AFTER the newly-active item's set. Without the node
|
|
44
|
+
// check it would clobber.
|
|
45
|
+
// No dep array: must re-declare every commit so the active instance
|
|
46
|
+
// re-claims the declaration after another instance's unmount-cleanup or
|
|
47
|
+
// sibling handoff nulls it.
|
|
48
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
49
|
+
const node = nodeRef.current;
|
|
50
|
+
if (active && node) {
|
|
51
|
+
setCursorDeclaration({ relativeX: column, relativeY: line, node });
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
setCursorDeclaration(null, node);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
// Clear on unmount (conditionally — another instance may own by then).
|
|
58
|
+
// Separate effect with empty deps so cleanup only fires once — not on
|
|
59
|
+
// every line/column change, which would transiently null between commits.
|
|
60
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
61
|
+
return () => {
|
|
62
|
+
setCursorDeclaration(null, nodeRef.current);
|
|
63
|
+
};
|
|
64
|
+
}, [setCursorDeclaration]);
|
|
65
|
+
return setNode;
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=use-declared-cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-declared-cursor.js","sourceRoot":"","sources":["../../../src/ink/hooks/use-declared-cursor.ts"],"names":[],"mappings":";;;;;AAwBA,8CAgDC;AAxED,iCAAwE;AACxE,4GAAgF;AAGhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,MAAM,EACN,MAAM,GAKP;IACC,MAAM,oBAAoB,GAAG,IAAA,kBAAU,EAAC,qCAAwB,CAAC,CAAA;IACjE,MAAM,OAAO,GAAG,IAAA,cAAM,EAAoB,IAAI,CAAC,CAAA;IAE/C,MAAM,OAAO,GAAG,IAAA,mBAAW,EAAC,CAAC,IAAuB,EAAE,EAAE;QACtD,OAAO,CAAC,OAAO,GAAG,IAAI,CAAA;IACxB,CAAC,EAAE,EAAE,CAAC,CAAA;IAEN,uEAAuE;IACvE,yEAAyE;IACzE,uBAAuB;IACvB,wEAAwE;IACxE,oEAAoE;IACpE,uDAAuD;IACvD,qEAAqE;IACrE,wEAAwE;IACxE,uEAAuE;IACvE,+BAA+B;IAC/B,oEAAoE;IACpE,wEAAwE;IACxE,4BAA4B;IAC5B,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAA;QAC5B,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACnB,oBAAoB,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAA;QACpE,CAAC;aAAM,CAAC;YACN,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,uEAAuE;IACvE,sEAAsE;IACtE,0EAA0E;IAC1E,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,OAAO,GAAG,EAAE;YACV,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;QAC7C,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAA;IAE1B,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { InputEvent, Key } from '../events/input-event.js';
|
|
2
|
+
type Handler = (input: string, key: Key, event: InputEvent) => void;
|
|
3
|
+
type Options = {
|
|
4
|
+
/**
|
|
5
|
+
* Enable or disable capturing of user input.
|
|
6
|
+
* Useful when there are multiple useInput hooks used at once to avoid handling the same input several times.
|
|
7
|
+
*
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
|
+
isActive?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* This hook is used for handling user input.
|
|
14
|
+
* It's a more convenient alternative to using `StdinContext` and listening to `data` events.
|
|
15
|
+
* The callback you pass to `useInput` is called for each character when user enters any input.
|
|
16
|
+
* However, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.
|
|
17
|
+
*
|
|
18
|
+
* ```
|
|
19
|
+
* import {useInput} from 'ink';
|
|
20
|
+
*
|
|
21
|
+
* const UserInput = () => {
|
|
22
|
+
* useInput((input, key) => {
|
|
23
|
+
* if (input === 'q') {
|
|
24
|
+
* // Exit program
|
|
25
|
+
* }
|
|
26
|
+
*
|
|
27
|
+
* if (key.leftArrow) {
|
|
28
|
+
* // Left arrow key pressed
|
|
29
|
+
* }
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* return …
|
|
33
|
+
* };
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare const useInput: (inputHandler: Handler, options?: Options) => void;
|
|
37
|
+
export default useInput;
|
|
38
|
+
//# sourceMappingURL=use-input.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-input.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-input.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAG/D,KAAK,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;AAEnE,KAAK,OAAO,GAAG;IACb;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,QAAQ,GAAI,cAAc,OAAO,EAAE,UAAS,OAAY,SA0D7D,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = require("react");
|
|
7
|
+
const usehooks_ts_1 = require("usehooks-ts");
|
|
8
|
+
const use_stdin_js_1 = __importDefault(require("./use-stdin.js"));
|
|
9
|
+
/**
|
|
10
|
+
* This hook is used for handling user input.
|
|
11
|
+
* It's a more convenient alternative to using `StdinContext` and listening to `data` events.
|
|
12
|
+
* The callback you pass to `useInput` is called for each character when user enters any input.
|
|
13
|
+
* However, if user pastes text and it's more than one character, the callback will be called only once and the whole string will be passed as `input`.
|
|
14
|
+
*
|
|
15
|
+
* ```
|
|
16
|
+
* import {useInput} from 'ink';
|
|
17
|
+
*
|
|
18
|
+
* const UserInput = () => {
|
|
19
|
+
* useInput((input, key) => {
|
|
20
|
+
* if (input === 'q') {
|
|
21
|
+
* // Exit program
|
|
22
|
+
* }
|
|
23
|
+
*
|
|
24
|
+
* if (key.leftArrow) {
|
|
25
|
+
* // Left arrow key pressed
|
|
26
|
+
* }
|
|
27
|
+
* });
|
|
28
|
+
*
|
|
29
|
+
* return …
|
|
30
|
+
* };
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
const useInput = (inputHandler, options = {}) => {
|
|
34
|
+
const { setRawMode, internal_exitOnCtrlC, internal_eventEmitter } = (0, use_stdin_js_1.default)();
|
|
35
|
+
// useLayoutEffect (not useEffect) so that raw mode is enabled synchronously
|
|
36
|
+
// during React's commit phase, before render() returns. With useEffect, raw
|
|
37
|
+
// mode setup is deferred to the next event loop tick via React's scheduler,
|
|
38
|
+
// leaving the terminal in cooked mode — keystrokes echo and the cursor is
|
|
39
|
+
// visible until the effect fires.
|
|
40
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
41
|
+
if (options.isActive === false) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
setRawMode(true);
|
|
45
|
+
return () => {
|
|
46
|
+
setRawMode(false);
|
|
47
|
+
};
|
|
48
|
+
}, [options.isActive, setRawMode]);
|
|
49
|
+
// Register the listener once on mount so its slot in the EventEmitter's
|
|
50
|
+
// listener array is stable. If isActive were in the effect's deps, the
|
|
51
|
+
// listener would re-append on false→true, moving it behind listeners
|
|
52
|
+
// that registered while it was inactive — breaking
|
|
53
|
+
// stopImmediatePropagation() ordering. useEventCallback keeps the
|
|
54
|
+
// reference stable while reading latest isActive/inputHandler from
|
|
55
|
+
// closure (it syncs via useLayoutEffect, so it's compiler-safe).
|
|
56
|
+
//
|
|
57
|
+
// Use useLayoutEffect (not useEffect) so the handler is registered
|
|
58
|
+
// synchronously during the commit phase, before any stdin data can be
|
|
59
|
+
// processed. In data mode, stdin.write() fires handleDataChunk
|
|
60
|
+
// synchronously, which calls processInput → discreteUpdates → emit('input').
|
|
61
|
+
// If the handler were in useEffect (passive effect, fires asynchronously
|
|
62
|
+
// after the scheduler flushes), there's a window where stdin has a
|
|
63
|
+
// listener but the EventEmitter has no handlers — keys are silently
|
|
64
|
+
// dropped. This is safe because EventEmitter listener registration is
|
|
65
|
+
// synchronous, lightweight, and has no visual side effects.
|
|
66
|
+
const handleData = (0, usehooks_ts_1.useEventCallback)((event) => {
|
|
67
|
+
if (options.isActive === false) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const { input, key } = event;
|
|
71
|
+
// If app is not supposed to exit on Ctrl+C, then let input listener handle it
|
|
72
|
+
// Note: discreteUpdates is called at the App level when emitting events,
|
|
73
|
+
// so all listeners are already within a high-priority update context.
|
|
74
|
+
if (!(input === 'c' && key.ctrl) || !internal_exitOnCtrlC) {
|
|
75
|
+
inputHandler(input, key, event);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
79
|
+
internal_eventEmitter?.on('input', handleData);
|
|
80
|
+
return () => {
|
|
81
|
+
internal_eventEmitter?.removeListener('input', handleData);
|
|
82
|
+
};
|
|
83
|
+
}, [internal_eventEmitter, handleData]);
|
|
84
|
+
};
|
|
85
|
+
exports.default = useInput;
|
|
86
|
+
//# sourceMappingURL=use-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-input.js","sourceRoot":"","sources":["../../../src/ink/hooks/use-input.ts"],"names":[],"mappings":";;;;;AAAA,iCAAuC;AACvC,6CAA8C;AAE9C,kEAAqC;AAcrC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,QAAQ,GAAG,CAAC,YAAqB,EAAE,UAAmB,EAAE,EAAE,EAAE;IAChE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,GAAG,IAAA,sBAAQ,GAAE,CAAA;IAE9E,4EAA4E;IAC5E,4EAA4E;IAC5E,4EAA4E;IAC5E,0EAA0E;IAC1E,kCAAkC;IAClC,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YAC/B,OAAM;QACR,CAAC;QAED,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,KAAK,CAAC,CAAA;QACnB,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAA;IAElC,wEAAwE;IACxE,uEAAuE;IACvE,qEAAqE;IACrE,mDAAmD;IACnD,kEAAkE;IAClE,mEAAmE;IACnE,iEAAiE;IACjE,EAAE;IACF,mEAAmE;IACnE,sEAAsE;IACtE,+DAA+D;IAC/D,6EAA6E;IAC7E,yEAAyE;IACzE,mEAAmE;IACnE,oEAAoE;IACpE,sEAAsE;IACtE,4DAA4D;IAC5D,MAAM,UAAU,GAAG,IAAA,8BAAgB,EAAC,CAAC,KAAiB,EAAE,EAAE;QACxD,IAAI,OAAO,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC;YAC/B,OAAM;QACR,CAAC;QACD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,CAAA;QAE5B,8EAA8E;QAC9E,yEAAyE;QACzE,sEAAsE;QACtE,IAAI,CAAC,CAAC,KAAK,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC1D,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,CAAA;QACjC,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,qBAAqB,EAAE,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAE9C,OAAO,GAAG,EAAE;YACV,qBAAqB,EAAE,cAAc,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QAC5D,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,qBAAqB,EAAE,UAAU,CAAC,CAAC,CAAA;AACzC,CAAC,CAAA;AAED,kBAAe,QAAQ,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the clock time, updating at the given interval.
|
|
3
|
+
* Subscribes as non-keepAlive — won't keep the clock alive on its own,
|
|
4
|
+
* but updates whenever a keepAlive subscriber (e.g. the spinner)
|
|
5
|
+
* is driving the clock.
|
|
6
|
+
*
|
|
7
|
+
* Use this to drive pure time-based computations (shimmer position,
|
|
8
|
+
* frame index) from the shared clock.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useAnimationTimer(intervalMs: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* Interval hook backed by the shared Clock.
|
|
13
|
+
*
|
|
14
|
+
* Unlike `useInterval` from `usehooks-ts` (which creates its own setInterval),
|
|
15
|
+
* this piggybacks on the single shared clock so all timers consolidate into
|
|
16
|
+
* one wake-up. Pass `null` for intervalMs to pause.
|
|
17
|
+
*/
|
|
18
|
+
export declare function useInterval(callback: () => void, intervalMs: number | null): void;
|
|
19
|
+
//# sourceMappingURL=use-interval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-interval.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-interval.ts"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAqB5D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,IAAI,EACpB,UAAU,EAAE,MAAM,GAAG,IAAI,GACxB,IAAI,CAqBN"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useAnimationTimer = useAnimationTimer;
|
|
4
|
+
exports.useInterval = useInterval;
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const ClockContext_js_1 = require("../components/ClockContext.js");
|
|
7
|
+
/**
|
|
8
|
+
* Returns the clock time, updating at the given interval.
|
|
9
|
+
* Subscribes as non-keepAlive — won't keep the clock alive on its own,
|
|
10
|
+
* but updates whenever a keepAlive subscriber (e.g. the spinner)
|
|
11
|
+
* is driving the clock.
|
|
12
|
+
*
|
|
13
|
+
* Use this to drive pure time-based computations (shimmer position,
|
|
14
|
+
* frame index) from the shared clock.
|
|
15
|
+
*/
|
|
16
|
+
function useAnimationTimer(intervalMs) {
|
|
17
|
+
const clock = (0, react_1.useContext)(ClockContext_js_1.ClockContext);
|
|
18
|
+
const [time, setTime] = (0, react_1.useState)(() => clock?.now() ?? 0);
|
|
19
|
+
(0, react_1.useEffect)(() => {
|
|
20
|
+
if (!clock)
|
|
21
|
+
return;
|
|
22
|
+
let lastUpdate = clock.now();
|
|
23
|
+
const onChange = () => {
|
|
24
|
+
const now = clock.now();
|
|
25
|
+
if (now - lastUpdate >= intervalMs) {
|
|
26
|
+
lastUpdate = now;
|
|
27
|
+
setTime(now);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
return clock.subscribe(onChange, false);
|
|
31
|
+
}, [clock, intervalMs]);
|
|
32
|
+
return time;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Interval hook backed by the shared Clock.
|
|
36
|
+
*
|
|
37
|
+
* Unlike `useInterval` from `usehooks-ts` (which creates its own setInterval),
|
|
38
|
+
* this piggybacks on the single shared clock so all timers consolidate into
|
|
39
|
+
* one wake-up. Pass `null` for intervalMs to pause.
|
|
40
|
+
*/
|
|
41
|
+
function useInterval(callback, intervalMs) {
|
|
42
|
+
const callbackRef = (0, react_1.useRef)(callback);
|
|
43
|
+
callbackRef.current = callback;
|
|
44
|
+
const clock = (0, react_1.useContext)(ClockContext_js_1.ClockContext);
|
|
45
|
+
(0, react_1.useEffect)(() => {
|
|
46
|
+
if (!clock || intervalMs === null)
|
|
47
|
+
return;
|
|
48
|
+
let lastUpdate = clock.now();
|
|
49
|
+
const onChange = () => {
|
|
50
|
+
const now = clock.now();
|
|
51
|
+
if (now - lastUpdate >= intervalMs) {
|
|
52
|
+
lastUpdate = now;
|
|
53
|
+
callbackRef.current();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return clock.subscribe(onChange, false);
|
|
57
|
+
}, [clock, intervalMs]);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=use-interval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-interval.js","sourceRoot":"","sources":["../../../src/ink/hooks/use-interval.ts"],"names":[],"mappings":";;AAYA,8CAqBC;AASD,kCAwBC;AAlED,iCAA+D;AAC/D,mEAA4D;AAE5D;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAAC,UAAkB;IAClD,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,8BAAY,CAAC,CAAA;IACtC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,KAAK,EAAE,GA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QAAQ,EAAE,KAAK,CAAC,CAAA;IACzC,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { DOMElement } from '../dom.js';
|
|
2
|
+
import type { MatchPosition } from '../render-to-screen.js';
|
|
3
|
+
/**
|
|
4
|
+
* Set the search highlight query on the Ink instance. Non-empty → all
|
|
5
|
+
* visible occurrences are inverted on the next frame (SGR 7, screen-buffer
|
|
6
|
+
* overlay, same damage machinery as selection). Empty → clears.
|
|
7
|
+
*
|
|
8
|
+
* This is a screen-space highlight — it matches the RENDERED text, not the
|
|
9
|
+
* source message text. Works for anything visible (bash output, file paths,
|
|
10
|
+
* error messages) regardless of where it came from in the message tree. A
|
|
11
|
+
* query that matched in source but got truncated/ellipsized in rendering
|
|
12
|
+
* won't highlight; that's acceptable — we highlight what you see.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useSearchHighlight(): {
|
|
15
|
+
setQuery: (query: string) => void;
|
|
16
|
+
/** Paint an existing DOM subtree (from the MAIN tree) to a fresh
|
|
17
|
+
* Screen at its natural height, scan. Element-relative positions
|
|
18
|
+
* (row 0 = element top). Zero context duplication — the element
|
|
19
|
+
* IS the one built with all real providers. */
|
|
20
|
+
scanElement: (el: DOMElement) => MatchPosition[];
|
|
21
|
+
/** Position-based CURRENT highlight. Every frame writes yellow at
|
|
22
|
+
* positions[currentIdx] + rowOffset. The scan-highlight (inverse on
|
|
23
|
+
* all matches) still runs — this overlays on top. rowOffset tracks
|
|
24
|
+
* scroll; positions stay stable (message-relative). null clears. */
|
|
25
|
+
setPositions: (state: {
|
|
26
|
+
positions: MatchPosition[];
|
|
27
|
+
rowOffset: number;
|
|
28
|
+
currentIdx: number;
|
|
29
|
+
} | null) => void;
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=use-search-highlight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-search-highlight.d.ts","sourceRoot":"","sources":["../../../src/ink/hooks/use-search-highlight.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3D;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,IAAI;IACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC;;;oDAGgD;IAChD,WAAW,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,aAAa,EAAE,CAAA;IAChD;;;yEAGqE;IACrE,YAAY,EAAE,CACZ,KAAK,EAAE;QACL,SAAS,EAAE,aAAa,EAAE,CAAA;QAC1B,SAAS,EAAE,MAAM,CAAA;QACjB,UAAU,EAAE,MAAM,CAAA;KACnB,GAAG,IAAI,KACL,IAAI,CAAA;CACV,CAiBA"}
|