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,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bash Security Module
|
|
3
|
+
*
|
|
4
|
+
* Provides safety checks and sandbox options for command execution.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Commands that are considered read-only and safe to execute without confirmation.
|
|
8
|
+
* These commands only read data and do not modify the filesystem.
|
|
9
|
+
*/
|
|
10
|
+
export declare const READ_ONLY_COMMANDS: string[];
|
|
11
|
+
/**
|
|
12
|
+
* Dangerous command patterns that should always be blocked or require confirmation.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DANGEROUS_PATTERNS: {
|
|
15
|
+
pattern: RegExp;
|
|
16
|
+
reason: string;
|
|
17
|
+
}[];
|
|
18
|
+
/**
|
|
19
|
+
* Potentially destructive patterns that should ask for confirmation.
|
|
20
|
+
*/
|
|
21
|
+
export declare const POTENTIALLY_DESTRUCTIVE_PATTERNS: RegExp[];
|
|
22
|
+
/**
|
|
23
|
+
* Check if a command is read-only and safe to execute without confirmation.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isReadOnlyCommand(cmd: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Check if a command matches dangerous patterns.
|
|
28
|
+
* Returns the first matched dangerous pattern, or null if safe.
|
|
29
|
+
*/
|
|
30
|
+
export declare function checkDangerousCommand(cmd: string): {
|
|
31
|
+
pattern: RegExp;
|
|
32
|
+
reason: string;
|
|
33
|
+
} | null;
|
|
34
|
+
/**
|
|
35
|
+
* Check if a command is potentially destructive.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isPotentiallyDestructive(cmd: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Get the security assessment for a command.
|
|
40
|
+
*/
|
|
41
|
+
export declare function assessCommandSecurity(cmd: string): {
|
|
42
|
+
level: 'safe' | 'caution' | 'dangerous' | 'blocked';
|
|
43
|
+
reason?: string;
|
|
44
|
+
isReadOnly: boolean;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Sandbox execution options.
|
|
48
|
+
*/
|
|
49
|
+
export interface SandboxOptions {
|
|
50
|
+
mode: 'none' | 'docker' | 'bubblewrap';
|
|
51
|
+
container?: string;
|
|
52
|
+
timeout?: number;
|
|
53
|
+
network?: boolean;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Default sandbox options (disabled).
|
|
57
|
+
*/
|
|
58
|
+
export declare const DEFAULT_SANDBOX_OPTIONS: SandboxOptions;
|
|
59
|
+
/**
|
|
60
|
+
* Wrap command for sandbox execution.
|
|
61
|
+
* Returns the modified command for sandbox execution.
|
|
62
|
+
*/
|
|
63
|
+
export declare function wrapForSandbox(cmd: string, options: SandboxOptions): string;
|
|
64
|
+
//# sourceMappingURL=bash_security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash_security.d.ts","sourceRoot":"","sources":["../../src/tools/bash_security.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAoH9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;GAiC9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gCAAgC,UAW5C,CAAC;AAEF;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAmCtD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAO7F;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAO7D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG;IAClD,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;IACpD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;CACrB,CAkCA;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,YAAY,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,cAErC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,GAAG,MAAM,CAkB3E"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Bash Security Module
|
|
4
|
+
*
|
|
5
|
+
* Provides safety checks and sandbox options for command execution.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.DEFAULT_SANDBOX_OPTIONS = exports.POTENTIALLY_DESTRUCTIVE_PATTERNS = exports.DANGEROUS_PATTERNS = exports.READ_ONLY_COMMANDS = void 0;
|
|
9
|
+
exports.isReadOnlyCommand = isReadOnlyCommand;
|
|
10
|
+
exports.checkDangerousCommand = checkDangerousCommand;
|
|
11
|
+
exports.isPotentiallyDestructive = isPotentiallyDestructive;
|
|
12
|
+
exports.assessCommandSecurity = assessCommandSecurity;
|
|
13
|
+
exports.wrapForSandbox = wrapForSandbox;
|
|
14
|
+
/**
|
|
15
|
+
* Commands that are considered read-only and safe to execute without confirmation.
|
|
16
|
+
* These commands only read data and do not modify the filesystem.
|
|
17
|
+
*/
|
|
18
|
+
exports.READ_ONLY_COMMANDS = [
|
|
19
|
+
// File listing/reading
|
|
20
|
+
'ls',
|
|
21
|
+
'dir',
|
|
22
|
+
'cat',
|
|
23
|
+
'head',
|
|
24
|
+
'tail',
|
|
25
|
+
'less',
|
|
26
|
+
'more',
|
|
27
|
+
'file',
|
|
28
|
+
'stat',
|
|
29
|
+
'wc',
|
|
30
|
+
'du',
|
|
31
|
+
'tree',
|
|
32
|
+
'find',
|
|
33
|
+
'locate',
|
|
34
|
+
'which',
|
|
35
|
+
'whereis',
|
|
36
|
+
// File searching
|
|
37
|
+
'grep',
|
|
38
|
+
'egrep',
|
|
39
|
+
'fgrep',
|
|
40
|
+
'rg',
|
|
41
|
+
'ag',
|
|
42
|
+
'ack',
|
|
43
|
+
'sed', // when without -i flag
|
|
44
|
+
'awk',
|
|
45
|
+
'cut',
|
|
46
|
+
'sort',
|
|
47
|
+
'uniq',
|
|
48
|
+
'tr',
|
|
49
|
+
'diff',
|
|
50
|
+
'cmp',
|
|
51
|
+
// Git read operations
|
|
52
|
+
'git status',
|
|
53
|
+
'git log',
|
|
54
|
+
'git diff',
|
|
55
|
+
'git show',
|
|
56
|
+
'git branch', // listing branches
|
|
57
|
+
'git tag', // listing tags
|
|
58
|
+
'git remote',
|
|
59
|
+
'git rev-parse',
|
|
60
|
+
'git ls-files',
|
|
61
|
+
'git ls-tree',
|
|
62
|
+
// Package/dependency info
|
|
63
|
+
'npm list',
|
|
64
|
+
'npm info',
|
|
65
|
+
'npm view',
|
|
66
|
+
'npm search',
|
|
67
|
+
'npm outdated',
|
|
68
|
+
'yarn list',
|
|
69
|
+
'yarn info',
|
|
70
|
+
'pnpm list',
|
|
71
|
+
'pnpm info',
|
|
72
|
+
// Node/Python version
|
|
73
|
+
'node --version',
|
|
74
|
+
'node -v',
|
|
75
|
+
'npm --version',
|
|
76
|
+
'npm -v',
|
|
77
|
+
'yarn --version',
|
|
78
|
+
'pnpm --version',
|
|
79
|
+
'python --version',
|
|
80
|
+
'python -V',
|
|
81
|
+
'python3 --version',
|
|
82
|
+
'pip --version',
|
|
83
|
+
'pip3 --version',
|
|
84
|
+
// System info
|
|
85
|
+
'echo',
|
|
86
|
+
'printenv',
|
|
87
|
+
'env',
|
|
88
|
+
'whoami',
|
|
89
|
+
'hostname',
|
|
90
|
+
'date',
|
|
91
|
+
'uptime',
|
|
92
|
+
'uname',
|
|
93
|
+
'arch',
|
|
94
|
+
'pwd',
|
|
95
|
+
'id',
|
|
96
|
+
'groups',
|
|
97
|
+
'getent',
|
|
98
|
+
// Network info (read-only)
|
|
99
|
+
'ping',
|
|
100
|
+
'curl', // when without file output
|
|
101
|
+
'wget', // when without file output
|
|
102
|
+
'nslookup',
|
|
103
|
+
'dig',
|
|
104
|
+
'host',
|
|
105
|
+
'ip',
|
|
106
|
+
'ifconfig',
|
|
107
|
+
'netstat',
|
|
108
|
+
// Process info
|
|
109
|
+
'ps',
|
|
110
|
+
'top',
|
|
111
|
+
'htop',
|
|
112
|
+
'jobs',
|
|
113
|
+
// JSON/YAML processing (read-only when no file write)
|
|
114
|
+
'jq',
|
|
115
|
+
'yq',
|
|
116
|
+
// Help/version commands
|
|
117
|
+
'help',
|
|
118
|
+
'man',
|
|
119
|
+
'info',
|
|
120
|
+
'whatis',
|
|
121
|
+
'--help',
|
|
122
|
+
'-h',
|
|
123
|
+
'--version',
|
|
124
|
+
'-V',
|
|
125
|
+
];
|
|
126
|
+
/**
|
|
127
|
+
* Dangerous command patterns that should always be blocked or require confirmation.
|
|
128
|
+
*/
|
|
129
|
+
exports.DANGEROUS_PATTERNS = [
|
|
130
|
+
// Filesystem destruction
|
|
131
|
+
{ pattern: /rm\s+-rf\s+\/$/, reason: 'Attempting to delete root directory' },
|
|
132
|
+
{ pattern: /rm\s+-rf\s+~$/, reason: 'Attempting to delete home directory' },
|
|
133
|
+
{ pattern: /rm\s+-rf\s+\*/, reason: 'Attempting to delete all files in current directory' },
|
|
134
|
+
{ pattern: /rm\s+-rf\s+\.\//, reason: 'Attempting to delete current directory contents' },
|
|
135
|
+
// Disk operations
|
|
136
|
+
{ pattern: /mkfs/, reason: 'Attempting to format filesystem' },
|
|
137
|
+
{ pattern: /dd\s+of=\/dev/, reason: 'Attempting to write directly to disk device' },
|
|
138
|
+
{ pattern: /fdisk/, reason: 'Attempting to modify disk partitions' },
|
|
139
|
+
// Fork bombs
|
|
140
|
+
{ pattern: /:\(\)\s*\{/, reason: 'Fork bomb detected' },
|
|
141
|
+
{ pattern: /\|\:\&/, reason: 'Fork bomb variant detected' },
|
|
142
|
+
// System modification
|
|
143
|
+
{ pattern: /chmod\s+-R\s+777/, reason: 'Attempting to make all files executable' },
|
|
144
|
+
{ pattern: /chown\s+-R/, reason: 'Attempting to change ownership recursively' },
|
|
145
|
+
// Package removal
|
|
146
|
+
{ pattern: /apt\s+remove/, reason: 'Attempting to remove system packages' },
|
|
147
|
+
{ pattern: /apt-get\s+remove/, reason: 'Attempting to remove system packages' },
|
|
148
|
+
{ pattern: /yum\s+remove/, reason: 'Attempting to remove system packages' },
|
|
149
|
+
{ pattern: /brew\s+uninstall/, reason: 'Attempting to remove packages' },
|
|
150
|
+
// Process killing (mass)
|
|
151
|
+
{ pattern: /kill\s+-9\s+-1/, reason: 'Attempting to kill all processes' },
|
|
152
|
+
{ pattern: /pkill\s+-9/, reason: 'Attempting to force kill processes' },
|
|
153
|
+
// Network dangerous
|
|
154
|
+
{ pattern: /iptables\s+-F/, reason: 'Attempting to flush firewall rules' },
|
|
155
|
+
{ pattern: /iptables\s+-P\s+INPUT\s+DROP/, reason: 'Attempting to block all incoming traffic' },
|
|
156
|
+
];
|
|
157
|
+
/**
|
|
158
|
+
* Potentially destructive patterns that should ask for confirmation.
|
|
159
|
+
*/
|
|
160
|
+
exports.POTENTIALLY_DESTRUCTIVE_PATTERNS = [
|
|
161
|
+
/rm\s+-[rf]/,
|
|
162
|
+
/rm\s+.*\s+-[rf]/,
|
|
163
|
+
/chmod/,
|
|
164
|
+
/chown/,
|
|
165
|
+
/kill/,
|
|
166
|
+
/pkill/,
|
|
167
|
+
/mv\s+.*\s+\/dev\/null/,
|
|
168
|
+
/>\s*\/dev\/sda/,
|
|
169
|
+
/curl.*>\s*\//,
|
|
170
|
+
/wget.*-O\s*\//,
|
|
171
|
+
];
|
|
172
|
+
/**
|
|
173
|
+
* Check if a command is read-only and safe to execute without confirmation.
|
|
174
|
+
*/
|
|
175
|
+
function isReadOnlyCommand(cmd) {
|
|
176
|
+
const trimmedCmd = cmd.trim();
|
|
177
|
+
// Check exact matches first
|
|
178
|
+
if (exports.READ_ONLY_COMMANDS.includes(trimmedCmd)) {
|
|
179
|
+
return true;
|
|
180
|
+
}
|
|
181
|
+
// Check if command starts with a read-only command
|
|
182
|
+
const baseCmd = trimmedCmd.split(' ')[0];
|
|
183
|
+
if (exports.READ_ONLY_COMMANDS.includes(baseCmd)) {
|
|
184
|
+
// Additional checks for commands that might modify files
|
|
185
|
+
if (baseCmd === 'sed' && trimmedCmd.includes('-i')) {
|
|
186
|
+
return false; // sed -i modifies files
|
|
187
|
+
}
|
|
188
|
+
if (baseCmd === 'curl' && trimmedCmd.includes('>')) {
|
|
189
|
+
return false; // curl with output redirect writes file
|
|
190
|
+
}
|
|
191
|
+
if (baseCmd === 'wget' && /-O|--output-document/.test(trimmedCmd)) {
|
|
192
|
+
return false; // wget -O writes file
|
|
193
|
+
}
|
|
194
|
+
return true;
|
|
195
|
+
}
|
|
196
|
+
// Check for git read commands
|
|
197
|
+
if (trimmedCmd.startsWith('git ')) {
|
|
198
|
+
const gitCmd = trimmedCmd.slice(4).trim();
|
|
199
|
+
for (const roGitCmd of exports.READ_ONLY_COMMANDS.filter(c => c.startsWith('git '))) {
|
|
200
|
+
if (gitCmd.startsWith(roGitCmd.slice(4))) {
|
|
201
|
+
return true;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Check if a command matches dangerous patterns.
|
|
209
|
+
* Returns the first matched dangerous pattern, or null if safe.
|
|
210
|
+
*/
|
|
211
|
+
function checkDangerousCommand(cmd) {
|
|
212
|
+
for (const { pattern, reason } of exports.DANGEROUS_PATTERNS) {
|
|
213
|
+
if (pattern.test(cmd)) {
|
|
214
|
+
return { pattern, reason };
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Check if a command is potentially destructive.
|
|
221
|
+
*/
|
|
222
|
+
function isPotentiallyDestructive(cmd) {
|
|
223
|
+
for (const pattern of exports.POTENTIALLY_DESTRUCTIVE_PATTERNS) {
|
|
224
|
+
if (pattern.test(cmd)) {
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Get the security assessment for a command.
|
|
232
|
+
*/
|
|
233
|
+
function assessCommandSecurity(cmd) {
|
|
234
|
+
// Check for blocked commands
|
|
235
|
+
const dangerousMatch = checkDangerousCommand(cmd);
|
|
236
|
+
if (dangerousMatch) {
|
|
237
|
+
return {
|
|
238
|
+
level: 'blocked',
|
|
239
|
+
reason: dangerousMatch.reason,
|
|
240
|
+
isReadOnly: false,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
// Check for read-only commands
|
|
244
|
+
if (isReadOnlyCommand(cmd)) {
|
|
245
|
+
return {
|
|
246
|
+
level: 'safe',
|
|
247
|
+
isReadOnly: true,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
// Check for potentially destructive commands
|
|
251
|
+
if (isPotentiallyDestructive(cmd)) {
|
|
252
|
+
return {
|
|
253
|
+
level: 'caution',
|
|
254
|
+
reason: 'Command may have destructive effects',
|
|
255
|
+
isReadOnly: false,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
// Default: ask for confirmation for unknown commands
|
|
259
|
+
return {
|
|
260
|
+
level: 'caution',
|
|
261
|
+
reason: 'Command requires confirmation',
|
|
262
|
+
isReadOnly: false,
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Default sandbox options (disabled).
|
|
267
|
+
*/
|
|
268
|
+
exports.DEFAULT_SANDBOX_OPTIONS = {
|
|
269
|
+
mode: 'none',
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Wrap command for sandbox execution.
|
|
273
|
+
* Returns the modified command for sandbox execution.
|
|
274
|
+
*/
|
|
275
|
+
function wrapForSandbox(cmd, options) {
|
|
276
|
+
if (options.mode === 'none') {
|
|
277
|
+
return cmd;
|
|
278
|
+
}
|
|
279
|
+
if (options.mode === 'docker') {
|
|
280
|
+
const container = options.container || 'openhorse-sandbox';
|
|
281
|
+
const networkFlag = options.network ? '' : '--network none';
|
|
282
|
+
return `docker exec ${networkFlag} ${container} sh -c '${cmd.replace(/'/g, "'\\''")}'`;
|
|
283
|
+
}
|
|
284
|
+
if (options.mode === 'bubblewrap') {
|
|
285
|
+
// bubblewrap (bwrap) for Linux sandboxing
|
|
286
|
+
const networkFlag = options.network ? '' : '--unshare-net';
|
|
287
|
+
return `bwrap ${networkFlag} --ro-bind /usr /usr --ro-bind /lib /lib --ro-bind /bin /bin --bind /tmp /tmp --proc /proc --dev-bind /dev /dev sh -c '${cmd.replace(/'/g, "'\\''")}'`;
|
|
288
|
+
}
|
|
289
|
+
return cmd;
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=bash_security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash_security.js","sourceRoot":"","sources":["../../src/tools/bash_security.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAqLH,8CAmCC;AAMD,sDAOC;AAKD,4DAOC;AAKD,sDAsCC;AAuBD,wCAkBC;AAnUD;;;GAGG;AACU,QAAA,kBAAkB,GAAG;IAChC,uBAAuB;IACvB,IAAI;IACJ,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,IAAI;IACJ,IAAI;IACJ,MAAM;IACN,MAAM;IACN,QAAQ;IACR,OAAO;IACP,SAAS;IAET,iBAAiB;IACjB,MAAM;IACN,OAAO;IACP,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK,EAAG,uBAAuB;IAC/B,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,IAAI;IACJ,MAAM;IACN,KAAK;IAEL,sBAAsB;IACtB,YAAY;IACZ,SAAS;IACT,UAAU;IACV,UAAU;IACV,YAAY,EAAG,mBAAmB;IAClC,SAAS,EAAM,eAAe;IAC9B,YAAY;IACZ,eAAe;IACf,cAAc;IACd,aAAa;IAEb,0BAA0B;IAC1B,UAAU;IACV,UAAU;IACV,UAAU;IACV,YAAY;IACZ,cAAc;IACd,WAAW;IACX,WAAW;IACX,WAAW;IACX,WAA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AAI,KAAK,MAAM,EAAE,CAAC;QAC5B,OAAO,GAAG,CAAC;IACb,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,mBAAmB,CAAC;QAC3D,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC;QAC5D,OAAO,eAAe,WAAW,IAAI,SAAS,WAAW,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;IACzF,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QAClC,0CAA0C;QAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;QAC3D,OAAO,SAAS,WAAW,0HAA0H,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;IACrL,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* openhorse - 工具集
|
|
3
|
+
*
|
|
4
|
+
* 定义 Agent 可用的工具(Tool System v2):
|
|
5
|
+
* - read_file: 读取文件内容
|
|
6
|
+
* - write_file: 写入文件
|
|
7
|
+
* - list_files: 列出目录
|
|
8
|
+
* - exec_command: 执行 shell 命令
|
|
9
|
+
*
|
|
10
|
+
* 使用 buildTool() 工厂模式。
|
|
11
|
+
*/
|
|
12
|
+
import { type OpenHorseTool } from '../framework/tool';
|
|
13
|
+
export declare const TOOLS: OpenHorseTool[];
|
|
14
|
+
/**
|
|
15
|
+
* 执行一个工具调用,返回结构化结果字符串
|
|
16
|
+
*/
|
|
17
|
+
export declare function executeTool(name: string, args: Record<string, unknown>): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* 获取可用工具名称列表
|
|
20
|
+
*/
|
|
21
|
+
export declare function getToolNames(): string;
|
|
22
|
+
export { READ_ONLY_COMMANDS, DANGEROUS_PATTERNS, POTENTIALLY_DESTRUCTIVE_PATTERNS, isReadOnlyCommand, checkDangerousCommand, isPotentiallyDestructive, assessCommandSecurity, wrapForSandbox, type SandboxOptions, DEFAULT_SANDBOX_OPTIONS, } from './bash_security';
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,EAAa,KAAK,aAAa,EAAqC,MAAM,mBAAmB,CAAC;AA6BrG,eAAO,MAAM,KAAK,EAAE,aAAa,EA0kBhC,CAAC;AAkXF;;GAEG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CA+B9F;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAGD,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,gCAAgC,EAChC,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACd,KAAK,cAAc,EACnB,uBAAuB,GACxB,MAAM,iBAAiB,CAAC"}
|