explorbot 0.0.1 → 0.1.0
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 +80 -26
- package/bin/explorbot-cli.ts +680 -0
- package/boat/api-tester/src/ai/chief/styles.ts +15 -0
- package/boat/api-tester/src/ai/chief.ts +335 -0
- package/boat/api-tester/src/ai/curler-tools.ts +278 -0
- package/boat/api-tester/src/ai/curler.ts +306 -0
- package/boat/api-tester/src/api-client.ts +28 -0
- package/boat/api-tester/src/apibot.ts +203 -0
- package/boat/api-tester/src/cli.ts +301 -0
- package/boat/api-tester/src/config.ts +190 -0
- package/dist/bin/explorbot-cli.js +23 -101
- package/dist/boat/api-tester/bin/apibot-cli.js +0 -1
- package/dist/boat/api-tester/src/ai/chief/styles.js +0 -1
- package/dist/boat/api-tester/src/ai/chief.js +0 -1
- package/dist/boat/api-tester/src/ai/curler-tools.js +0 -1
- package/dist/boat/api-tester/src/ai/curler.js +0 -1
- package/dist/boat/api-tester/src/api-client.js +0 -1
- package/dist/boat/api-tester/src/apibot.js +0 -1
- package/dist/boat/api-tester/src/cli.js +0 -1
- package/dist/boat/api-tester/src/config.js +0 -1
- package/dist/src/action-result.js +0 -1
- package/dist/src/action.js +14 -12
- package/dist/src/activity.js +0 -1
- package/dist/src/ai/agent.js +0 -1
- package/dist/src/ai/bosun.js +0 -1
- package/dist/src/ai/captain/idle-mode.js +0 -1
- package/dist/src/ai/captain/mixin.js +0 -1
- package/dist/src/ai/captain/test-mode.js +0 -1
- package/dist/src/ai/captain/web-mode.js +0 -1
- package/dist/src/ai/captain.js +0 -1
- package/dist/src/ai/conversation.js +0 -1
- package/dist/src/ai/experience-compactor.js +0 -1
- package/dist/src/ai/fisherman-tools.js +0 -1
- package/dist/src/ai/fisherman.js +0 -1
- package/dist/src/ai/historian.js +0 -1
- package/dist/src/ai/navigator.js +0 -1
- package/dist/src/ai/pilot.js +0 -1
- package/dist/src/ai/planner/session-dedup.js +0 -1
- package/dist/src/ai/planner/styles.js +0 -1
- package/dist/src/ai/planner/subpages.js +42 -7
- package/dist/src/ai/planner.js +15 -4
- package/dist/src/ai/provider.js +0 -1
- package/dist/src/ai/quartermaster.js +0 -1
- package/dist/src/ai/researcher/cache.js +13 -9
- package/dist/src/ai/researcher/coordinates.js +4 -3
- package/dist/src/ai/researcher/deep-analysis.js +16 -20
- package/dist/src/ai/researcher/fingerprint-worker.js +0 -1
- package/dist/src/ai/researcher/focus.js +0 -1
- package/dist/src/ai/researcher/locators.js +1 -2
- package/dist/src/ai/researcher/mixin.js +0 -1
- package/dist/src/ai/researcher/parser.js +4 -4
- package/dist/src/ai/researcher/research-result.js +2 -1
- package/dist/src/ai/researcher.js +6 -6
- package/dist/src/ai/rules.js +0 -1
- package/dist/src/ai/task-agent.js +0 -1
- package/dist/src/ai/tester.js +0 -1
- package/dist/src/ai/tools.js +4 -1
- package/dist/src/api/api-client.js +0 -1
- package/dist/src/api/request-result.js +0 -1
- package/dist/src/api/request-store.js +0 -1
- package/dist/src/api/spec-reader.js +0 -1
- package/dist/src/api/xhr-capture.js +0 -1
- package/dist/src/browser-server.js +0 -1
- package/dist/src/command-handler.js +0 -1
- package/dist/src/commands/add-rule-command.js +0 -1
- package/dist/src/commands/base-command.js +0 -1
- package/dist/src/commands/clean-command.js +0 -1
- package/dist/src/commands/context-aria-command.js +0 -1
- package/dist/src/commands/context-command.js +2 -3
- package/dist/src/commands/context-data-command.js +0 -1
- package/dist/src/commands/context-experience-command.js +0 -1
- package/dist/src/commands/context-html-command.js +0 -1
- package/dist/src/commands/context-knowledge-command.js +0 -1
- package/dist/src/commands/debug-command.js +0 -1
- package/dist/src/commands/drill-command.js +0 -1
- package/dist/src/commands/exit-command.js +0 -1
- package/dist/src/commands/explore-command.js +3 -3
- package/dist/src/commands/freesail-command.js +0 -1
- package/dist/src/commands/help-command.js +0 -1
- package/dist/src/commands/index.js +0 -1
- package/dist/src/commands/init-command.js +117 -0
- package/dist/src/commands/knows-command.js +0 -1
- package/dist/src/commands/learn-command.js +0 -1
- package/dist/src/commands/navigate-command.js +0 -1
- package/dist/src/commands/path-command.js +0 -1
- package/dist/src/commands/plan-clear-command.js +0 -1
- package/dist/src/commands/plan-command.js +6 -2
- package/dist/src/commands/plan-edit-command.js +0 -1
- package/dist/src/commands/plan-load-command.js +0 -1
- package/dist/src/commands/plan-reload-command.js +0 -1
- package/dist/src/commands/plan-save-command.js +0 -1
- package/dist/src/commands/research-command.js +0 -1
- package/dist/src/commands/start-command.js +0 -1
- package/dist/src/commands/status-command.js +0 -1
- package/dist/src/commands/test-command.js +0 -1
- package/dist/src/components/ActivityPane.js +0 -1
- package/dist/src/components/AddKnowledge.js +0 -1
- package/dist/src/components/AddRule.js +0 -1
- package/dist/src/components/App.js +0 -1
- package/dist/src/components/Autocomplete.js +0 -1
- package/dist/src/components/InputPane.js +0 -1
- package/dist/src/components/InputReadline.js +0 -1
- package/dist/src/components/LogPane.js +0 -1
- package/dist/src/components/PlanEditor.js +0 -1
- package/dist/src/components/PlanPane.js +0 -1
- package/dist/src/components/SessionTimer.js +0 -1
- package/dist/src/components/StateTransitionPane.js +0 -1
- package/dist/src/components/StatusPane.js +0 -1
- package/dist/src/components/TaskPane.js +0 -1
- package/dist/src/components/Welcome.js +0 -1
- package/dist/src/components/WelcomeChecklist.js +0 -1
- package/dist/src/components/WelcomeCommands.js +0 -1
- package/dist/src/components/autocomplete-store.js +0 -1
- package/dist/src/components/parse-keypress.js +0 -1
- package/dist/src/config.js +0 -1
- package/dist/src/execution-controller.js +0 -1
- package/dist/src/experience-tracker.js +0 -1
- package/dist/src/explorbot.js +1 -2
- package/dist/src/explorer.js +58 -17
- package/dist/src/index.js +0 -1
- package/dist/src/knowledge-tracker.js +2 -2
- package/dist/src/observability.js +0 -1
- package/dist/src/reporter.js +0 -1
- package/dist/src/state-manager.js +0 -1
- package/dist/src/stats.js +0 -1
- package/dist/src/test-plan.js +0 -1
- package/dist/src/utils/aria.js +0 -1
- package/dist/src/utils/cli-name.js +16 -0
- package/dist/src/utils/code-extractor.js +0 -1
- package/dist/src/utils/context-formatter.js +0 -1
- package/dist/src/utils/error-page.js +0 -1
- package/dist/src/utils/expandable.js +0 -1
- package/dist/src/utils/hooks-runner.js +0 -1
- package/dist/src/utils/html-diff.js +0 -1
- package/dist/src/utils/html.js +0 -1
- package/dist/src/utils/logger.js +0 -1
- package/dist/src/utils/loop.js +0 -1
- package/dist/src/utils/markdown-parser.js +0 -1
- package/dist/src/utils/markdown-query.js +0 -1
- package/dist/src/utils/markdown-terminal.js +0 -1
- package/dist/src/utils/research-parser.js +0 -1
- package/dist/src/utils/retry.js +0 -1
- package/dist/src/utils/rules-loader.js +0 -1
- package/dist/src/utils/strings.js +0 -1
- package/dist/src/utils/test-plan-markdown.js +0 -1
- package/dist/src/utils/throttle.js +0 -1
- package/dist/src/utils/unique-names.js +0 -1
- package/dist/src/utils/url-matcher.js +0 -1
- package/dist/src/utils/web-element.js +6 -5
- package/dist/src/utils/xpath.js +0 -1
- package/package.json +28 -4
- package/src/action-result.ts +694 -0
- package/src/action.ts +449 -0
- package/src/activity.ts +111 -0
- package/src/ai/agent.ts +3 -0
- package/src/ai/bosun.ts +557 -0
- package/src/ai/captain/idle-mode.ts +116 -0
- package/src/ai/captain/mixin.ts +22 -0
- package/src/ai/captain/test-mode.ts +262 -0
- package/src/ai/captain/web-mode.ts +136 -0
- package/src/ai/captain.ts +504 -0
- package/src/ai/conversation.ts +205 -0
- package/src/ai/experience-compactor.ts +284 -0
- package/src/ai/fisherman-tools.ts +181 -0
- package/src/ai/fisherman.ts +223 -0
- package/src/ai/historian.ts +457 -0
- package/src/ai/navigator.ts +572 -0
- package/src/ai/pilot.ts +776 -0
- package/src/ai/planner/session-dedup.ts +35 -0
- package/src/ai/planner/styles.ts +17 -0
- package/src/ai/planner/subpages.ts +171 -0
- package/src/ai/planner.ts +549 -0
- package/src/ai/provider.ts +613 -0
- package/src/ai/quartermaster.ts +286 -0
- package/src/ai/researcher/cache.ts +109 -0
- package/src/ai/researcher/coordinates.ts +239 -0
- package/src/ai/researcher/deep-analysis.ts +412 -0
- package/src/ai/researcher/fingerprint-worker.ts +59 -0
- package/src/ai/researcher/focus.ts +42 -0
- package/src/ai/researcher/locators.ts +282 -0
- package/src/ai/researcher/mixin.ts +4 -0
- package/src/ai/researcher/parser.ts +186 -0
- package/src/ai/researcher/research-result.ts +116 -0
- package/src/ai/researcher.ts +858 -0
- package/src/ai/rules.ts +376 -0
- package/src/ai/task-agent.ts +141 -0
- package/src/ai/tester.ts +939 -0
- package/src/ai/tools.ts +1122 -0
- package/src/api/api-client.ts +109 -0
- package/src/api/request-result.ts +212 -0
- package/src/api/request-store.ts +130 -0
- package/src/api/spec-reader.ts +174 -0
- package/src/api/xhr-capture.ts +100 -0
- package/src/browser-server.ts +74 -0
- package/src/command-handler.ts +454 -0
- package/src/commands/add-rule-command.ts +63 -0
- package/src/commands/base-command.ts +27 -0
- package/src/commands/clean-command.ts +73 -0
- package/src/commands/context-aria-command.ts +22 -0
- package/src/commands/context-command.ts +67 -0
- package/src/commands/context-data-command.ts +30 -0
- package/src/commands/context-experience-command.ts +48 -0
- package/src/commands/context-html-command.ts +33 -0
- package/src/commands/context-knowledge-command.ts +43 -0
- package/src/commands/debug-command.ts +13 -0
- package/src/commands/drill-command.ts +34 -0
- package/src/commands/exit-command.ts +32 -0
- package/src/commands/explore-command.ts +129 -0
- package/src/commands/freesail-command.ts +95 -0
- package/src/commands/help-command.ts +8 -0
- package/src/commands/index.ts +69 -0
- package/src/commands/init-command.ts +131 -0
- package/src/commands/knows-command.ts +68 -0
- package/src/commands/learn-command.ts +44 -0
- package/src/commands/navigate-command.ts +18 -0
- package/src/commands/path-command.ts +83 -0
- package/src/commands/plan-clear-command.ts +14 -0
- package/src/commands/plan-command.ts +46 -0
- package/src/commands/plan-edit-command.ts +9 -0
- package/src/commands/plan-load-command.ts +18 -0
- package/src/commands/plan-reload-command.ts +28 -0
- package/src/commands/plan-save-command.ts +25 -0
- package/src/commands/research-command.ts +45 -0
- package/src/commands/start-command.ts +13 -0
- package/src/commands/status-command.tsx +23 -0
- package/src/commands/test-command.ts +84 -0
- package/src/components/ActivityPane.tsx +80 -0
- package/src/components/AddKnowledge.tsx +169 -0
- package/src/components/AddRule.tsx +174 -0
- package/src/components/App.tsx +377 -0
- package/src/components/Autocomplete.tsx +63 -0
- package/src/components/InputPane.tsx +259 -0
- package/src/components/InputReadline.tsx +704 -0
- package/src/components/LogPane.tsx +187 -0
- package/src/components/PlanEditor.tsx +150 -0
- package/src/components/PlanPane.tsx +71 -0
- package/src/components/SessionTimer.tsx +35 -0
- package/src/components/StateTransitionPane.tsx +149 -0
- package/src/components/StatusPane.tsx +62 -0
- package/src/components/TaskPane.tsx +119 -0
- package/src/components/Welcome.tsx +83 -0
- package/src/components/WelcomeChecklist.tsx +118 -0
- package/src/components/WelcomeCommands.tsx +102 -0
- package/src/components/autocomplete-store.ts +35 -0
- package/src/components/parse-keypress.ts +170 -0
- package/src/config.ts +491 -0
- package/src/execution-controller.ts +109 -0
- package/src/experience-tracker.ts +350 -0
- package/src/explorbot.ts +405 -0
- package/src/explorer.ts +760 -0
- package/src/index.tsx +62 -0
- package/src/knowledge-tracker.ts +230 -0
- package/src/observability.ts +150 -0
- package/src/reporter.ts +224 -0
- package/src/state-manager.ts +556 -0
- package/src/stats.ts +53 -0
- package/src/test-plan.ts +432 -0
- package/src/utils/aria.ts +629 -0
- package/src/utils/cli-name.ts +13 -0
- package/src/utils/code-extractor.ts +22 -0
- package/src/utils/context-formatter.ts +239 -0
- package/src/utils/error-page.ts +23 -0
- package/src/utils/expandable.ts +38 -0
- package/src/utils/hooks-runner.ts +79 -0
- package/src/utils/html-diff.ts +918 -0
- package/src/utils/html.ts +1316 -0
- package/src/utils/logger.ts +534 -0
- package/src/utils/loop.ts +176 -0
- package/src/utils/markdown-parser.ts +127 -0
- package/src/utils/markdown-query.ts +466 -0
- package/src/utils/markdown-terminal.ts +43 -0
- package/src/utils/research-parser.ts +11 -0
- package/src/utils/retry.ts +73 -0
- package/src/utils/rules-loader.ts +118 -0
- package/src/utils/strings.ts +13 -0
- package/src/utils/test-plan-markdown.ts +332 -0
- package/src/utils/throttle.ts +18 -0
- package/src/utils/unique-names.ts +14 -0
- package/src/utils/url-matcher.ts +45 -0
- package/src/utils/web-element.ts +147 -0
- package/src/utils/xpath.ts +129 -0
- package/dist/bin/explorbot-cli.js.map +0 -1
- package/dist/boat/api-tester/bin/apibot-cli.js.map +0 -1
- package/dist/boat/api-tester/example/apibot.config.js +0 -31
- package/dist/boat/api-tester/example/apibot.config.js.map +0 -1
- package/dist/boat/api-tester/src/ai/chief/styles.js.map +0 -1
- package/dist/boat/api-tester/src/ai/chief.js.map +0 -1
- package/dist/boat/api-tester/src/ai/curler-tools.js.map +0 -1
- package/dist/boat/api-tester/src/ai/curler.js.map +0 -1
- package/dist/boat/api-tester/src/api-client.js.map +0 -1
- package/dist/boat/api-tester/src/apibot.js.map +0 -1
- package/dist/boat/api-tester/src/cli.js.map +0 -1
- package/dist/boat/api-tester/src/config.js.map +0 -1
- package/dist/prompts/audit-rules.md +0 -124
- package/dist/src/action-result.js.map +0 -1
- package/dist/src/action.js.map +0 -1
- package/dist/src/activity.js.map +0 -1
- package/dist/src/ai/agent.js.map +0 -1
- package/dist/src/ai/bosun.js.map +0 -1
- package/dist/src/ai/captain/idle-mode.js.map +0 -1
- package/dist/src/ai/captain/mixin.js.map +0 -1
- package/dist/src/ai/captain/test-mode.js.map +0 -1
- package/dist/src/ai/captain/web-mode.js.map +0 -1
- package/dist/src/ai/captain.js.map +0 -1
- package/dist/src/ai/conversation.js.map +0 -1
- package/dist/src/ai/experience-compactor.js.map +0 -1
- package/dist/src/ai/fisherman-tools.js.map +0 -1
- package/dist/src/ai/fisherman.js.map +0 -1
- package/dist/src/ai/historian.js.map +0 -1
- package/dist/src/ai/navigator.js.map +0 -1
- package/dist/src/ai/pilot.js.map +0 -1
- package/dist/src/ai/planner/session-dedup.js.map +0 -1
- package/dist/src/ai/planner/styles.js.map +0 -1
- package/dist/src/ai/planner/subpages.js.map +0 -1
- package/dist/src/ai/planner.js.map +0 -1
- package/dist/src/ai/provider.js.map +0 -1
- package/dist/src/ai/quartermaster.js.map +0 -1
- package/dist/src/ai/researcher/cache.js.map +0 -1
- package/dist/src/ai/researcher/coordinates.js.map +0 -1
- package/dist/src/ai/researcher/deep-analysis.js.map +0 -1
- package/dist/src/ai/researcher/fingerprint-worker.js.map +0 -1
- package/dist/src/ai/researcher/focus.js.map +0 -1
- package/dist/src/ai/researcher/locators.js.map +0 -1
- package/dist/src/ai/researcher/mixin.js.map +0 -1
- package/dist/src/ai/researcher/parser.js.map +0 -1
- package/dist/src/ai/researcher/research-result.js.map +0 -1
- package/dist/src/ai/researcher.js.map +0 -1
- package/dist/src/ai/rules.js.map +0 -1
- package/dist/src/ai/task-agent.js.map +0 -1
- package/dist/src/ai/tester.js.map +0 -1
- package/dist/src/ai/tools.js.map +0 -1
- package/dist/src/api/api-client.js.map +0 -1
- package/dist/src/api/request-result.js.map +0 -1
- package/dist/src/api/request-store.js.map +0 -1
- package/dist/src/api/spec-reader.js.map +0 -1
- package/dist/src/api/xhr-capture.js.map +0 -1
- package/dist/src/browser-server.js.map +0 -1
- package/dist/src/command-handler.js.map +0 -1
- package/dist/src/commands/add-rule-command.js.map +0 -1
- package/dist/src/commands/base-command.js.map +0 -1
- package/dist/src/commands/clean-command.js.map +0 -1
- package/dist/src/commands/context-aria-command.js.map +0 -1
- package/dist/src/commands/context-command.js.map +0 -1
- package/dist/src/commands/context-data-command.js.map +0 -1
- package/dist/src/commands/context-experience-command.js.map +0 -1
- package/dist/src/commands/context-html-command.js.map +0 -1
- package/dist/src/commands/context-knowledge-command.js.map +0 -1
- package/dist/src/commands/debug-command.js.map +0 -1
- package/dist/src/commands/drill-command.js.map +0 -1
- package/dist/src/commands/exit-command.js.map +0 -1
- package/dist/src/commands/explore-command.js.map +0 -1
- package/dist/src/commands/freesail-command.js.map +0 -1
- package/dist/src/commands/help-command.js.map +0 -1
- package/dist/src/commands/index.js.map +0 -1
- package/dist/src/commands/knows-command.js.map +0 -1
- package/dist/src/commands/learn-command.js.map +0 -1
- package/dist/src/commands/navigate-command.js.map +0 -1
- package/dist/src/commands/path-command.js.map +0 -1
- package/dist/src/commands/plan-clear-command.js.map +0 -1
- package/dist/src/commands/plan-command.js.map +0 -1
- package/dist/src/commands/plan-edit-command.js.map +0 -1
- package/dist/src/commands/plan-load-command.js.map +0 -1
- package/dist/src/commands/plan-reload-command.js.map +0 -1
- package/dist/src/commands/plan-save-command.js.map +0 -1
- package/dist/src/commands/research-command.js.map +0 -1
- package/dist/src/commands/start-command.js.map +0 -1
- package/dist/src/commands/status-command.js.map +0 -1
- package/dist/src/commands/test-command.js.map +0 -1
- package/dist/src/components/ActivityPane.js.map +0 -1
- package/dist/src/components/AddKnowledge.js.map +0 -1
- package/dist/src/components/AddRule.js.map +0 -1
- package/dist/src/components/App.js.map +0 -1
- package/dist/src/components/Autocomplete.js.map +0 -1
- package/dist/src/components/InputPane.js.map +0 -1
- package/dist/src/components/InputReadline.js.map +0 -1
- package/dist/src/components/LogPane.js.map +0 -1
- package/dist/src/components/PlanEditor.js.map +0 -1
- package/dist/src/components/PlanPane.js.map +0 -1
- package/dist/src/components/SessionTimer.js.map +0 -1
- package/dist/src/components/StateTransitionPane.js.map +0 -1
- package/dist/src/components/StatusPane.js.map +0 -1
- package/dist/src/components/TaskPane.js.map +0 -1
- package/dist/src/components/Welcome.js.map +0 -1
- package/dist/src/components/WelcomeChecklist.js.map +0 -1
- package/dist/src/components/WelcomeCommands.js.map +0 -1
- package/dist/src/components/autocomplete-store.js.map +0 -1
- package/dist/src/components/parse-keypress.js.map +0 -1
- package/dist/src/config.js.map +0 -1
- package/dist/src/execution-controller.js.map +0 -1
- package/dist/src/experience-tracker.js.map +0 -1
- package/dist/src/explorbot.js.map +0 -1
- package/dist/src/explorer.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/knowledge-tracker.js.map +0 -1
- package/dist/src/observability.js.map +0 -1
- package/dist/src/reporter.js.map +0 -1
- package/dist/src/state-manager.js.map +0 -1
- package/dist/src/stats.js.map +0 -1
- package/dist/src/test-plan.js.map +0 -1
- package/dist/src/utils/aria.js.map +0 -1
- package/dist/src/utils/code-extractor.js.map +0 -1
- package/dist/src/utils/context-formatter.js.map +0 -1
- package/dist/src/utils/error-page.js.map +0 -1
- package/dist/src/utils/expandable.js.map +0 -1
- package/dist/src/utils/hooks-runner.js.map +0 -1
- package/dist/src/utils/html-diff.js.map +0 -1
- package/dist/src/utils/html.js.map +0 -1
- package/dist/src/utils/logger.js.map +0 -1
- package/dist/src/utils/loop.js.map +0 -1
- package/dist/src/utils/markdown-parser.js.map +0 -1
- package/dist/src/utils/markdown-query.js.map +0 -1
- package/dist/src/utils/markdown-terminal.js.map +0 -1
- package/dist/src/utils/research-parser.js.map +0 -1
- package/dist/src/utils/retry.js.map +0 -1
- package/dist/src/utils/rules-loader.js.map +0 -1
- package/dist/src/utils/strings.js.map +0 -1
- package/dist/src/utils/test-plan-markdown.js.map +0 -1
- package/dist/src/utils/throttle.js.map +0 -1
- package/dist/src/utils/unique-names.js.map +0 -1
- package/dist/src/utils/url-matcher.js.map +0 -1
- package/dist/src/utils/web-element.js.map +0 -1
- package/dist/src/utils/xpath.js.map +0 -1
- package/prompts/audit-rules.md +0 -124
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { Test } from '../test-plan.js';
|
|
2
|
+
import { tag } from '../utils/logger.js';
|
|
3
|
+
import { BaseCommand } from './base-command.js';
|
|
4
|
+
|
|
5
|
+
export class TestCommand extends BaseCommand {
|
|
6
|
+
name = 'test';
|
|
7
|
+
description = 'Launch tester agent to execute test scenarios';
|
|
8
|
+
suggestions = ['/test - to run next test', '/plan - to create new plan'];
|
|
9
|
+
|
|
10
|
+
async execute(args: string): Promise<void> {
|
|
11
|
+
const plan = this.explorBot.getCurrentPlan();
|
|
12
|
+
const toExecute: Test[] = [];
|
|
13
|
+
|
|
14
|
+
const requirePlan = () => {
|
|
15
|
+
if (!plan) throw new Error('No plan found. Please run /plan first to create test scenarios.');
|
|
16
|
+
return plan;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
if (!args) {
|
|
20
|
+
const pending = requirePlan().getPendingTests();
|
|
21
|
+
if (pending.length === 0) {
|
|
22
|
+
throw new Error('All tests are already complete. Please run /plan to create new test scenarios.');
|
|
23
|
+
}
|
|
24
|
+
toExecute.push(pending[0]);
|
|
25
|
+
} else if (args === '*' || args === 'all') {
|
|
26
|
+
toExecute.push(...requirePlan().getPendingTests());
|
|
27
|
+
} else if (args.match(/^[\d,\-\s]+$/)) {
|
|
28
|
+
const pending = requirePlan().getPendingTests();
|
|
29
|
+
const indices = parseTestIndices(args, pending.length);
|
|
30
|
+
for (const idx of indices) {
|
|
31
|
+
toExecute.push(pending[idx]);
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
const matching = plan?.getPendingTests().filter((test) => test.scenario.toLowerCase().includes(args.toLowerCase())) || [];
|
|
35
|
+
if (matching.length > 0) {
|
|
36
|
+
toExecute.push(...matching);
|
|
37
|
+
} else {
|
|
38
|
+
const state = this.explorBot.getExplorer().getStateManager().getCurrentState();
|
|
39
|
+
if (!state) {
|
|
40
|
+
throw new Error('No page loaded. Please navigate to a page first.');
|
|
41
|
+
}
|
|
42
|
+
const newTest = new Test(args, 'unknown', [], state.url);
|
|
43
|
+
if (plan) {
|
|
44
|
+
plan.addTest(newTest);
|
|
45
|
+
tag('info').log(`Created new test: "${args}" and added to current plan.`);
|
|
46
|
+
} else {
|
|
47
|
+
tag('info').log(`Created ad-hoc test: "${args}"`);
|
|
48
|
+
}
|
|
49
|
+
toExecute.push(newTest);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (toExecute.length === 0) {
|
|
54
|
+
throw new Error('No tests to execute.');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
tag('info').log(`Launching ${toExecute.length} test scenario(s).`);
|
|
58
|
+
const tester = this.explorBot.agentTester();
|
|
59
|
+
for (const test of toExecute) {
|
|
60
|
+
await tester.test(test);
|
|
61
|
+
}
|
|
62
|
+
tag('success').log('Test execution finished');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function parseTestIndices(input: string, total: number): number[] {
|
|
67
|
+
const indices = new Set<number>();
|
|
68
|
+
|
|
69
|
+
const addIndex = (n: number) => {
|
|
70
|
+
if (n < 1 || n > total) throw new Error(`Test #${n} not found. Available: 1-${total}`);
|
|
71
|
+
indices.add(n - 1);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
for (const part of input.split(',')) {
|
|
75
|
+
const trimmed = part.trim();
|
|
76
|
+
const range = trimmed.match(/^(\d+)-(\d+)$/);
|
|
77
|
+
if (range) {
|
|
78
|
+
for (let i = Number.parseInt(range[1]); i <= Number.parseInt(range[2]); i++) addIndex(i);
|
|
79
|
+
} else {
|
|
80
|
+
addIndex(Number.parseInt(trimmed));
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return [...indices].sort((a, b) => a - b);
|
|
84
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Box, Text } from 'ink';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { type ActivityEntry, addActivityListener, removeActivityListener } from '../activity.ts';
|
|
5
|
+
|
|
6
|
+
interface ActivityPaneProps {
|
|
7
|
+
isInputVisible?: boolean;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const ActivityPane: React.FC<ActivityPaneProps> = React.memo(({ isInputVisible = false }) => {
|
|
11
|
+
const [activity, setActivity] = useState<ActivityEntry | null>(null);
|
|
12
|
+
const [animationState, setAnimationState] = useState(0);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const listener = (newActivity: ActivityEntry | null) => {
|
|
16
|
+
setActivity(newActivity);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
addActivityListener(listener);
|
|
20
|
+
|
|
21
|
+
return () => {
|
|
22
|
+
removeActivityListener(listener);
|
|
23
|
+
};
|
|
24
|
+
}, []);
|
|
25
|
+
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!activity) return;
|
|
28
|
+
|
|
29
|
+
const interval = setInterval(() => {
|
|
30
|
+
setAnimationState((prev) => (prev + 1) % 4);
|
|
31
|
+
}, 1200);
|
|
32
|
+
|
|
33
|
+
return () => clearInterval(interval);
|
|
34
|
+
}, [activity]);
|
|
35
|
+
|
|
36
|
+
if (!activity) {
|
|
37
|
+
if (isInputVisible) {
|
|
38
|
+
return (
|
|
39
|
+
<Box height={1} paddingX={1}>
|
|
40
|
+
<Text dimColor>Enter command or press Enter to continue</Text>
|
|
41
|
+
</Box>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
return (
|
|
45
|
+
<Box height={1} paddingX={1}>
|
|
46
|
+
<Text dimColor>Done. Press [ESC] to enable input. Press [CTRL + t] to toggle session timer.</Text>
|
|
47
|
+
</Box>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const getActivityColor = (type: ActivityEntry['type']) => {
|
|
52
|
+
switch (type) {
|
|
53
|
+
case 'ai':
|
|
54
|
+
return 'cyan';
|
|
55
|
+
case 'action':
|
|
56
|
+
return 'green';
|
|
57
|
+
case 'navigation':
|
|
58
|
+
return 'blue';
|
|
59
|
+
default:
|
|
60
|
+
return 'yellow';
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const getDots = () => {
|
|
65
|
+
return '.'.repeat(animationState);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const isDimmed = animationState % 2 === 0;
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<Box height={1} marginY={1} paddingX={1}>
|
|
72
|
+
<Text color={getActivityColor(activity.type)} dimColor={isDimmed}>
|
|
73
|
+
{activity.message}
|
|
74
|
+
{getDots()}
|
|
75
|
+
</Text>
|
|
76
|
+
</Box>
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
export default ActivityPane;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { Box, Text, useInput } from 'ink';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { KnowledgeTracker } from '../knowledge-tracker.js';
|
|
4
|
+
import InputReadline from './InputReadline.js';
|
|
5
|
+
|
|
6
|
+
interface AddKnowledgeProps {
|
|
7
|
+
initialUrl?: string;
|
|
8
|
+
onComplete?: () => void;
|
|
9
|
+
onCancel?: () => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const AddKnowledge: React.FC<AddKnowledgeProps> = ({ initialUrl = '', onComplete, onCancel }) => {
|
|
13
|
+
const [urlPattern, setUrlPattern] = useState(initialUrl);
|
|
14
|
+
const [description, setDescription] = useState('');
|
|
15
|
+
const [activeField, setActiveField] = useState<'url' | 'description'>(initialUrl ? 'description' : 'url');
|
|
16
|
+
const [suggestedUrls, setSuggestedUrls] = useState<string[]>([]);
|
|
17
|
+
const [existingKnowledge, setExistingKnowledge] = useState<string[]>([]);
|
|
18
|
+
|
|
19
|
+
const isStandalone = !onComplete;
|
|
20
|
+
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
try {
|
|
23
|
+
const knowledgeTracker = new KnowledgeTracker();
|
|
24
|
+
const urls = knowledgeTracker.getExistingUrls();
|
|
25
|
+
setSuggestedUrls(urls);
|
|
26
|
+
} catch (error) {
|
|
27
|
+
console.error('Failed to load suggestions:', error);
|
|
28
|
+
}
|
|
29
|
+
}, []);
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (urlPattern.trim()) {
|
|
33
|
+
try {
|
|
34
|
+
const knowledgeTracker = new KnowledgeTracker();
|
|
35
|
+
const knowledge = knowledgeTracker.getKnowledgeForUrl(urlPattern);
|
|
36
|
+
setExistingKnowledge(knowledge);
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('Failed to load existing knowledge:', error);
|
|
39
|
+
setExistingKnowledge([]);
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
setExistingKnowledge([]);
|
|
43
|
+
}
|
|
44
|
+
}, [urlPattern]);
|
|
45
|
+
|
|
46
|
+
const handleSave = () => {
|
|
47
|
+
if (!urlPattern.trim() || !description.trim()) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
const knowledgeTracker = new KnowledgeTracker();
|
|
53
|
+
const result = knowledgeTracker.addKnowledge(urlPattern.trim(), description.trim());
|
|
54
|
+
const action = result.isNewFile ? 'Created' : 'Updated';
|
|
55
|
+
console.log(`\nKnowledge ${action} in: ${result.filename}`);
|
|
56
|
+
|
|
57
|
+
if (isStandalone) {
|
|
58
|
+
process.exit(0);
|
|
59
|
+
} else {
|
|
60
|
+
onComplete?.();
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error(`\nFailed to save knowledge: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
64
|
+
if (isStandalone) {
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const handleUrlSubmit = () => {
|
|
71
|
+
if (urlPattern.trim()) {
|
|
72
|
+
setActiveField('description');
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const handleDescriptionSubmit = () => {
|
|
77
|
+
if (description.trim()) {
|
|
78
|
+
handleSave();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
useInput((input, key) => {
|
|
83
|
+
if (key.ctrl && input === 'c') {
|
|
84
|
+
if (isStandalone) {
|
|
85
|
+
process.exit(0);
|
|
86
|
+
} else {
|
|
87
|
+
onCancel?.();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (key.escape) {
|
|
92
|
+
if (!isStandalone) {
|
|
93
|
+
onCancel?.();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (key.tab) {
|
|
98
|
+
if (activeField === 'url' && urlPattern.trim()) {
|
|
99
|
+
setActiveField('description');
|
|
100
|
+
} else if (activeField === 'description') {
|
|
101
|
+
setActiveField('url');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<Box flexDirection="column" padding={1}>
|
|
108
|
+
<Box marginBottom={1}>
|
|
109
|
+
<Text color="cyan" bold>
|
|
110
|
+
Add Knowledge
|
|
111
|
+
</Text>
|
|
112
|
+
</Box>
|
|
113
|
+
|
|
114
|
+
<Box marginBottom={1} flexDirection="column">
|
|
115
|
+
<Box marginBottom={1}>
|
|
116
|
+
<Text color={activeField === 'url' ? 'blue' : 'gray'}>URL Pattern:</Text>
|
|
117
|
+
</Box>
|
|
118
|
+
<Box borderStyle="single" borderColor={activeField === 'url' ? 'blue' : 'gray'} paddingX={1}>
|
|
119
|
+
<InputReadline value={urlPattern} onChange={setUrlPattern} onSubmit={handleUrlSubmit} placeholder={suggestedUrls.length > 0 ? suggestedUrls[0] : '/login, *, ^/admin'} isActive={activeField === 'url'} showPrompt={false} />
|
|
120
|
+
</Box>
|
|
121
|
+
<Text color="gray" dimColor>
|
|
122
|
+
Wildcards (*) or regexes (^pattern, ~pattern)
|
|
123
|
+
</Text>
|
|
124
|
+
</Box>
|
|
125
|
+
|
|
126
|
+
{existingKnowledge.length > 0 && (
|
|
127
|
+
<Box marginBottom={1} flexDirection="column">
|
|
128
|
+
<Box marginBottom={1}>
|
|
129
|
+
<Text color="yellow" bold>
|
|
130
|
+
Existing Knowledge:
|
|
131
|
+
</Text>
|
|
132
|
+
</Box>
|
|
133
|
+
<Box borderStyle="single" borderColor="gray" paddingX={1} flexDirection="column">
|
|
134
|
+
{existingKnowledge.map((knowledge, index) => (
|
|
135
|
+
<Box key={index} flexDirection="column" marginBottom={index < existingKnowledge.length - 1 ? 1 : 0}>
|
|
136
|
+
<Text color="gray">{knowledge}</Text>
|
|
137
|
+
{index < existingKnowledge.length - 1 && (
|
|
138
|
+
<Text color="gray" dimColor>
|
|
139
|
+
---
|
|
140
|
+
</Text>
|
|
141
|
+
)}
|
|
142
|
+
</Box>
|
|
143
|
+
))}
|
|
144
|
+
</Box>
|
|
145
|
+
</Box>
|
|
146
|
+
)}
|
|
147
|
+
|
|
148
|
+
<Box marginBottom={1} flexDirection="column">
|
|
149
|
+
<Box marginBottom={1}>
|
|
150
|
+
<Text color={activeField === 'description' ? 'blue' : 'gray'}>Description:</Text>
|
|
151
|
+
</Box>
|
|
152
|
+
<Box borderStyle="single" borderColor={activeField === 'description' ? 'blue' : 'gray'} paddingX={1}>
|
|
153
|
+
<InputReadline value={description} onChange={setDescription} onSubmit={handleDescriptionSubmit} placeholder="Describe actions, locators, or page behavior..." isActive={activeField === 'description'} showPrompt={false} />
|
|
154
|
+
</Box>
|
|
155
|
+
<Text color="gray" dimColor>
|
|
156
|
+
Actions, locators, validation rules
|
|
157
|
+
</Text>
|
|
158
|
+
</Box>
|
|
159
|
+
|
|
160
|
+
<Box marginTop={1}>
|
|
161
|
+
<Text color="gray" dimColor>
|
|
162
|
+
Tab: Switch | Enter: Next/Save | {isStandalone ? 'Ctrl+C' : 'Esc'}: Exit
|
|
163
|
+
</Text>
|
|
164
|
+
</Box>
|
|
165
|
+
</Box>
|
|
166
|
+
);
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export default AddKnowledge;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { Box, Text, useInput } from 'ink';
|
|
4
|
+
import React, { useEffect, useState } from 'react';
|
|
5
|
+
import { AddRuleCommand } from '../commands/add-rule-command.js';
|
|
6
|
+
import InputReadline from './InputReadline.js';
|
|
7
|
+
|
|
8
|
+
const KNOWN_AGENTS = ['researcher', 'tester', 'planner', 'pilot', 'captain', 'bosun', 'navigator'];
|
|
9
|
+
|
|
10
|
+
interface AddRuleProps {
|
|
11
|
+
initialAgent?: string;
|
|
12
|
+
initialName?: string;
|
|
13
|
+
onComplete?: () => void;
|
|
14
|
+
onCancel?: () => void;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const AddRule: React.FC<AddRuleProps> = ({ initialAgent = '', initialName = '', onComplete, onCancel }) => {
|
|
18
|
+
const [agent, setAgent] = useState(initialAgent);
|
|
19
|
+
const [ruleName, setRuleName] = useState(initialName);
|
|
20
|
+
const [urlPattern, setUrlPattern] = useState('');
|
|
21
|
+
const [content, setContent] = useState('');
|
|
22
|
+
const [activeField, setActiveField] = useState<'agent' | 'name' | 'url' | 'content'>(initialAgent ? (initialName ? 'url' : 'name') : 'agent');
|
|
23
|
+
const [existingRules, setExistingRules] = useState<string[]>([]);
|
|
24
|
+
|
|
25
|
+
const isStandalone = !onComplete;
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!agent.trim()) {
|
|
29
|
+
setExistingRules([]);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const rulesDir = join(process.cwd(), 'rules', agent);
|
|
33
|
+
if (!existsSync(rulesDir)) {
|
|
34
|
+
setExistingRules([]);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const files = readdirSync(rulesDir)
|
|
38
|
+
.filter((f) => f.endsWith('.md'))
|
|
39
|
+
.map((f) => f.replace(/\.md$/, ''));
|
|
40
|
+
setExistingRules(files);
|
|
41
|
+
}, [agent]);
|
|
42
|
+
|
|
43
|
+
const handleSave = () => {
|
|
44
|
+
if (!agent.trim() || !ruleName.trim() || !content.trim()) return;
|
|
45
|
+
|
|
46
|
+
const result = AddRuleCommand.createRuleFile(agent.trim(), ruleName.trim(), {
|
|
47
|
+
content: content.trim(),
|
|
48
|
+
urlPattern: urlPattern.trim() || undefined,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
if (isStandalone) {
|
|
52
|
+
process.exit(result ? 0 : 1);
|
|
53
|
+
} else {
|
|
54
|
+
onComplete?.();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const fields: Array<'agent' | 'name' | 'url' | 'content'> = ['agent', 'name', 'url', 'content'];
|
|
59
|
+
|
|
60
|
+
const advanceField = () => {
|
|
61
|
+
const idx = fields.indexOf(activeField);
|
|
62
|
+
if (idx < fields.length - 1) {
|
|
63
|
+
setActiveField(fields[idx + 1]);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
useInput((input, key) => {
|
|
68
|
+
if (key.ctrl && input === 'c') {
|
|
69
|
+
if (isStandalone) {
|
|
70
|
+
process.exit(0);
|
|
71
|
+
} else {
|
|
72
|
+
onCancel?.();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (key.escape && !isStandalone) {
|
|
77
|
+
onCancel?.();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (key.tab) {
|
|
81
|
+
advanceField();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Box flexDirection="column" padding={1}>
|
|
87
|
+
<Box marginBottom={1}>
|
|
88
|
+
<Text color="cyan" bold>
|
|
89
|
+
Add Rule
|
|
90
|
+
</Text>
|
|
91
|
+
</Box>
|
|
92
|
+
|
|
93
|
+
<Box marginBottom={1} flexDirection="column">
|
|
94
|
+
<Box marginBottom={1}>
|
|
95
|
+
<Text color={activeField === 'agent' ? 'blue' : 'gray'}>Agent:</Text>
|
|
96
|
+
</Box>
|
|
97
|
+
<Box borderStyle="single" borderColor={activeField === 'agent' ? 'blue' : 'gray'} paddingX={1}>
|
|
98
|
+
<InputReadline
|
|
99
|
+
value={agent}
|
|
100
|
+
onChange={setAgent}
|
|
101
|
+
onSubmit={() => {
|
|
102
|
+
if (agent.trim()) advanceField();
|
|
103
|
+
}}
|
|
104
|
+
placeholder={KNOWN_AGENTS.join(', ')}
|
|
105
|
+
isActive={activeField === 'agent'}
|
|
106
|
+
showPrompt={false}
|
|
107
|
+
/>
|
|
108
|
+
</Box>
|
|
109
|
+
</Box>
|
|
110
|
+
|
|
111
|
+
{existingRules.length > 0 && (
|
|
112
|
+
<Box marginBottom={1} flexDirection="column">
|
|
113
|
+
<Text color="yellow">Existing rules: {existingRules.join(', ')}</Text>
|
|
114
|
+
</Box>
|
|
115
|
+
)}
|
|
116
|
+
|
|
117
|
+
<Box marginBottom={1} flexDirection="column">
|
|
118
|
+
<Box marginBottom={1}>
|
|
119
|
+
<Text color={activeField === 'name' ? 'blue' : 'gray'}>Rule name:</Text>
|
|
120
|
+
</Box>
|
|
121
|
+
<Box borderStyle="single" borderColor={activeField === 'name' ? 'blue' : 'gray'} paddingX={1}>
|
|
122
|
+
<InputReadline
|
|
123
|
+
value={ruleName}
|
|
124
|
+
onChange={setRuleName}
|
|
125
|
+
onSubmit={() => {
|
|
126
|
+
if (ruleName.trim()) advanceField();
|
|
127
|
+
}}
|
|
128
|
+
placeholder="e.g. check-tooltips, wait-for-toasts"
|
|
129
|
+
isActive={activeField === 'name'}
|
|
130
|
+
showPrompt={false}
|
|
131
|
+
/>
|
|
132
|
+
</Box>
|
|
133
|
+
<Text color="gray" dimColor>
|
|
134
|
+
Saved as rules/{agent || '<agent>'}/{ruleName || '<name>'}.md
|
|
135
|
+
</Text>
|
|
136
|
+
</Box>
|
|
137
|
+
|
|
138
|
+
<Box marginBottom={1} flexDirection="column">
|
|
139
|
+
<Box marginBottom={1}>
|
|
140
|
+
<Text color={activeField === 'url' ? 'blue' : 'gray'}>URL pattern (optional):</Text>
|
|
141
|
+
</Box>
|
|
142
|
+
<Box borderStyle="single" borderColor={activeField === 'url' ? 'blue' : 'gray'} paddingX={1}>
|
|
143
|
+
<InputReadline value={urlPattern} onChange={setUrlPattern} onSubmit={advanceField} placeholder="Leave empty for all URLs, or /admin/*, /checkout, etc." isActive={activeField === 'url'} showPrompt={false} />
|
|
144
|
+
</Box>
|
|
145
|
+
</Box>
|
|
146
|
+
|
|
147
|
+
<Box marginBottom={1} flexDirection="column">
|
|
148
|
+
<Box marginBottom={1}>
|
|
149
|
+
<Text color={activeField === 'content' ? 'blue' : 'gray'}>Rule content:</Text>
|
|
150
|
+
</Box>
|
|
151
|
+
<Box borderStyle="single" borderColor={activeField === 'content' ? 'blue' : 'gray'} paddingX={1}>
|
|
152
|
+
<InputReadline
|
|
153
|
+
value={content}
|
|
154
|
+
onChange={setContent}
|
|
155
|
+
onSubmit={() => {
|
|
156
|
+
if (content.trim()) handleSave();
|
|
157
|
+
}}
|
|
158
|
+
placeholder="Instructions for the agent..."
|
|
159
|
+
isActive={activeField === 'content'}
|
|
160
|
+
showPrompt={false}
|
|
161
|
+
/>
|
|
162
|
+
</Box>
|
|
163
|
+
</Box>
|
|
164
|
+
|
|
165
|
+
<Box marginTop={1}>
|
|
166
|
+
<Text color="gray" dimColor>
|
|
167
|
+
Tab: Next field | Enter: Next/Save | {isStandalone ? 'Ctrl+C' : 'Esc'}: Exit
|
|
168
|
+
</Text>
|
|
169
|
+
</Box>
|
|
170
|
+
</Box>
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export default AddRule;
|