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
package/src/test-plan.ts
ADDED
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import figures from 'figures';
|
|
3
|
+
import { WebPageState } from './state-manager.ts';
|
|
4
|
+
import { parsePlanFromMarkdown, planToAiContext, savePlanToMarkdown, savePlansToMarkdown } from './utils/test-plan-markdown.ts';
|
|
5
|
+
import { uniqSessionName } from './utils/unique-names.ts';
|
|
6
|
+
|
|
7
|
+
export const TestResult = {
|
|
8
|
+
PASSED: 'passed',
|
|
9
|
+
FAILED: 'failed',
|
|
10
|
+
SKIPPED: 'skipped',
|
|
11
|
+
} as const;
|
|
12
|
+
|
|
13
|
+
export type TestResultType = (typeof TestResult)[keyof typeof TestResult] | null;
|
|
14
|
+
|
|
15
|
+
export const TestStatus = {
|
|
16
|
+
PENDING: 'pending',
|
|
17
|
+
IN_PROGRESS: 'in_progress',
|
|
18
|
+
DONE: 'done',
|
|
19
|
+
} as const;
|
|
20
|
+
|
|
21
|
+
export type TestStatusType = (typeof TestStatus)[keyof typeof TestStatus];
|
|
22
|
+
|
|
23
|
+
export interface Note {
|
|
24
|
+
message: string;
|
|
25
|
+
status?: TestResultType;
|
|
26
|
+
startTime: number;
|
|
27
|
+
endTime: number;
|
|
28
|
+
screenshot?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class ActiveNote {
|
|
32
|
+
private task: Task;
|
|
33
|
+
startTime: number;
|
|
34
|
+
message: string;
|
|
35
|
+
status?: TestResultType;
|
|
36
|
+
screenshot?: string;
|
|
37
|
+
|
|
38
|
+
constructor(task: Task, message: string, status?: TestResultType) {
|
|
39
|
+
this.task = task;
|
|
40
|
+
this.startTime = performance.now();
|
|
41
|
+
this.message = message;
|
|
42
|
+
this.status = status;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
commit(finalStatus?: TestResultType): void {
|
|
46
|
+
const endTime = performance.now();
|
|
47
|
+
this.task.finishNote(this, endTime, finalStatus);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
getMessage(): string {
|
|
51
|
+
return this.message;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
getStartTime(): number {
|
|
55
|
+
return this.startTime;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface StepData {
|
|
60
|
+
text: string;
|
|
61
|
+
duration?: number;
|
|
62
|
+
status?: string;
|
|
63
|
+
error?: string;
|
|
64
|
+
log?: string;
|
|
65
|
+
artifacts?: string[];
|
|
66
|
+
noteStartTime?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export class Task {
|
|
70
|
+
id: string;
|
|
71
|
+
description: string;
|
|
72
|
+
notes: Record<string, Note>;
|
|
73
|
+
steps: Record<string, StepData>;
|
|
74
|
+
states: WebPageState[];
|
|
75
|
+
startUrl: string;
|
|
76
|
+
protected timestampCounter = 0;
|
|
77
|
+
private activeNote?: ActiveNote;
|
|
78
|
+
|
|
79
|
+
constructor(description: string, startUrl = '') {
|
|
80
|
+
this.id = `${createHash('md5').update(description).digest('hex').slice(0, 8)}_${Date.now().toString(36)}`;
|
|
81
|
+
this.description = description;
|
|
82
|
+
this.notes = {};
|
|
83
|
+
this.steps = {};
|
|
84
|
+
this.states = [];
|
|
85
|
+
this.startUrl = startUrl;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
startNote(message: string, status?: TestResultType): ActiveNote {
|
|
89
|
+
if (this.activeNote) {
|
|
90
|
+
this.activeNote.commit();
|
|
91
|
+
}
|
|
92
|
+
const note = new ActiveNote(this, message, status);
|
|
93
|
+
this.activeNote = note;
|
|
94
|
+
return note;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
finishNote(activeNote: ActiveNote, endTime: number, finalStatus?: TestResultType): void {
|
|
98
|
+
const timestamp = `${activeNote.getStartTime()}_${this.timestampCounter++}`;
|
|
99
|
+
this.notes[timestamp] = {
|
|
100
|
+
message: activeNote.getMessage(),
|
|
101
|
+
status: finalStatus || activeNote.status,
|
|
102
|
+
startTime: activeNote.getStartTime(),
|
|
103
|
+
endTime,
|
|
104
|
+
screenshot: activeNote.screenshot,
|
|
105
|
+
};
|
|
106
|
+
this.activeNote = undefined;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
getPrintableNotes(): string[] {
|
|
110
|
+
return Object.values(this.notes).map((n) => {
|
|
111
|
+
return `${n.status?.toUpperCase() || ''} ${n.message}`.trim();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
notesToString(): string {
|
|
116
|
+
return this.getPrintableNotes()
|
|
117
|
+
.map((n) => `- ${n}`)
|
|
118
|
+
.join('\n');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
addNote(message: string, status: TestResultType = null, screenshot?: string): void {
|
|
122
|
+
const isDuplicate = Object.values(this.notes).some((note) => note.message === message && note.status === status);
|
|
123
|
+
if (isDuplicate) return;
|
|
124
|
+
|
|
125
|
+
const now = performance.now();
|
|
126
|
+
const timestamp = `${now}_${this.timestampCounter++}`;
|
|
127
|
+
this.notes[timestamp] = { message, status, startTime: now, endTime: now, screenshot };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
addState(state: WebPageState): void {
|
|
131
|
+
this.states.push(state);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
addStep(text: string, duration?: number, status?: string, error?: string, log?: string, artifacts?: string[]): void {
|
|
135
|
+
const timestamp = `${performance.now()}_${this.timestampCounter++}`;
|
|
136
|
+
this.steps[timestamp] = { text, duration, status, error, log, artifacts, noteStartTime: this.activeNote?.getStartTime() };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
getLog(): Array<{ type: 'step' | 'note' | 'artifact'; content: string; timestamp: number }> {
|
|
140
|
+
const merged: Record<string, { type: 'step' | 'note' | 'artifact'; content: string }> = {};
|
|
141
|
+
|
|
142
|
+
for (const [key, stepData] of Object.entries(this.steps)) {
|
|
143
|
+
merged[key] = { type: 'step', content: stepData.text };
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
for (const [key, note] of Object.entries(this.notes)) {
|
|
147
|
+
merged[key] = { type: 'note', content: note.message };
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
return Object.entries(merged)
|
|
151
|
+
.map(([timestampKey, item]) => ({
|
|
152
|
+
...item,
|
|
153
|
+
timestamp: Number.parseFloat(timestampKey.split('_')[0]),
|
|
154
|
+
}))
|
|
155
|
+
.sort((a, b) => a.timestamp - b.timestamp);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
getLogString(): string {
|
|
159
|
+
return this.getLog()
|
|
160
|
+
.map((item) => `${item.type === 'step' ? ' ' : ''}${item.content}`)
|
|
161
|
+
.join('\n');
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export class Test extends Task {
|
|
166
|
+
scenario: string;
|
|
167
|
+
sessionName?: string;
|
|
168
|
+
status: TestStatusType;
|
|
169
|
+
result: TestResultType;
|
|
170
|
+
priority: 'critical' | 'important' | 'high' | 'normal' | 'low';
|
|
171
|
+
expected: string[];
|
|
172
|
+
plannedSteps: string[];
|
|
173
|
+
plan?: Plan;
|
|
174
|
+
summary: string;
|
|
175
|
+
artifacts: Record<string, string>;
|
|
176
|
+
generatedCode?: string;
|
|
177
|
+
style?: string;
|
|
178
|
+
planIteration = 0;
|
|
179
|
+
enabled = true;
|
|
180
|
+
startTime?: number;
|
|
181
|
+
endTime?: number;
|
|
182
|
+
|
|
183
|
+
constructor(scenario: string, priority: 'critical' | 'important' | 'high' | 'normal' | 'low', expectedOutcome: string | string[], startUrl: string, plannedSteps: string[] = []) {
|
|
184
|
+
super(scenario, startUrl);
|
|
185
|
+
this.scenario = scenario;
|
|
186
|
+
this.status = TestStatus.PENDING;
|
|
187
|
+
this.result = null;
|
|
188
|
+
this.sessionName = uniqSessionName();
|
|
189
|
+
this.priority = priority;
|
|
190
|
+
this.expected = Array.isArray(expectedOutcome) ? expectedOutcome : [expectedOutcome];
|
|
191
|
+
this.plannedSteps = plannedSteps;
|
|
192
|
+
this.artifacts = {};
|
|
193
|
+
this.summary = '';
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
getVisitedUrls({ localOnly = false }: { localOnly?: boolean } = {}): string[] {
|
|
197
|
+
if (this.plan && !localOnly) {
|
|
198
|
+
return this.plan.tests.flatMap((t) => t.getVisitedUrls({ localOnly: true }));
|
|
199
|
+
}
|
|
200
|
+
return [...new Set([this.startUrl, ...this.states.map((s) => s.url)].filter((value): value is string => Boolean(value) && value.trim() !== ''))];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
addArtifact(artifact?: string): void {
|
|
204
|
+
if (!artifact) return;
|
|
205
|
+
const timestamp = `${performance.now()}_${this.timestampCounter++}`;
|
|
206
|
+
this.artifacts[timestamp] = artifact;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
get hasFinished(): boolean {
|
|
210
|
+
return this.status === TestStatus.DONE || this.isComplete();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
get isSuccessful(): boolean {
|
|
214
|
+
return this.hasFinished && this.result === TestResult.PASSED;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
get hasFailed(): boolean {
|
|
218
|
+
return this.hasFinished && this.result === TestResult.FAILED;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
get isSkipped(): boolean {
|
|
222
|
+
return this.hasFinished && this.result === TestResult.SKIPPED;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
getCheckedNotes(): Note[] {
|
|
226
|
+
return Object.values(this.notes).filter((n) => !!n.status);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
getCheckedExpectations(): string[] {
|
|
230
|
+
return this.expected.filter((expectation) => {
|
|
231
|
+
return Object.values(this.notes).some((note) => note.message === expectation && !!note.status);
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
hasAchievedAny(): boolean {
|
|
236
|
+
return this.expected.some((expectation) => {
|
|
237
|
+
return Object.values(this.notes).some((note) => note.message === expectation && note.status === TestResult.PASSED);
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
hasAchievedAll(): boolean {
|
|
242
|
+
return this.expected.every((expectation) => {
|
|
243
|
+
return Object.values(this.notes).some((note) => note.message === expectation && note.status === TestResult.PASSED);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
isComplete(): boolean {
|
|
248
|
+
return this.expected.every((expectation) => {
|
|
249
|
+
return Object.values(this.notes).some((note) => note.message === expectation && !!note.status);
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
start(): void {
|
|
254
|
+
this.status = TestStatus.IN_PROGRESS;
|
|
255
|
+
this.startTime = performance.now();
|
|
256
|
+
this.addNote(`Test started. Session name: ${this.sessionName}`);
|
|
257
|
+
this.plan?.notifyChange();
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
finish(result: TestResultType = TestResult.FAILED): void {
|
|
261
|
+
this.status = TestStatus.DONE;
|
|
262
|
+
this.result = result;
|
|
263
|
+
this.endTime = performance.now();
|
|
264
|
+
this.plan?.notifyChange();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
getDurationMs(): number | null {
|
|
268
|
+
if (this.startTime != null && this.endTime != null) return this.endTime - this.startTime;
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
getRemainingExpectations(): string[] {
|
|
273
|
+
const achieved = this.getCheckedExpectations();
|
|
274
|
+
return this.expected.filter((e) => !achieved.includes(e));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
override getLog(): Array<{ type: 'step' | 'note' | 'artifact'; content: string; timestamp: number }> {
|
|
278
|
+
const merged: Record<string, { type: 'step' | 'note' | 'artifact'; content: string }> = {};
|
|
279
|
+
|
|
280
|
+
for (const [key, stepData] of Object.entries(this.steps)) {
|
|
281
|
+
merged[key] = { type: 'step', content: stepData.text };
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
for (const [key, note] of Object.entries(this.notes)) {
|
|
285
|
+
merged[key] = { type: 'note', content: note.message };
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
for (const [key, artifact] of Object.entries(this.artifacts)) {
|
|
289
|
+
merged[key] = { type: 'artifact', content: artifact };
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return Object.entries(merged)
|
|
293
|
+
.map(([timestampKey, item]) => ({
|
|
294
|
+
...item,
|
|
295
|
+
timestamp: Number.parseFloat(timestampKey.split('_')[0]),
|
|
296
|
+
}))
|
|
297
|
+
.sort((a, b) => a.timestamp - b.timestamp);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
type PlanChangeListener = (tests: Test[]) => void;
|
|
302
|
+
|
|
303
|
+
export class Plan {
|
|
304
|
+
title: string;
|
|
305
|
+
tests: Test[] = [];
|
|
306
|
+
url?: string;
|
|
307
|
+
iteration = 0;
|
|
308
|
+
parentPlan?: Plan;
|
|
309
|
+
private changeListeners: PlanChangeListener[] = [];
|
|
310
|
+
|
|
311
|
+
constructor(title: string) {
|
|
312
|
+
this.title = title;
|
|
313
|
+
if (title.startsWith('/')) this.url = title;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
nextIteration(): void {
|
|
317
|
+
this.iteration++;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
addTest(test: Test): void {
|
|
321
|
+
if (this.tests.some((t) => t.scenario.toLowerCase() === test.scenario.toLowerCase())) return;
|
|
322
|
+
test.plan = this;
|
|
323
|
+
test.planIteration = this.iteration;
|
|
324
|
+
this.tests.push(test);
|
|
325
|
+
this.notifyChange();
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
removeTest(test: Test): void {
|
|
329
|
+
const idx = this.tests.indexOf(test);
|
|
330
|
+
if (idx === -1) return;
|
|
331
|
+
this.tests.splice(idx, 1);
|
|
332
|
+
test.plan = undefined;
|
|
333
|
+
this.notifyChange();
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
onTestsChange(listener: PlanChangeListener): () => void {
|
|
337
|
+
this.changeListeners.push(listener);
|
|
338
|
+
return () => {
|
|
339
|
+
const index = this.changeListeners.indexOf(listener);
|
|
340
|
+
if (index > -1) this.changeListeners.splice(index, 1);
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
notifyChange(): void {
|
|
345
|
+
for (const listener of this.changeListeners) {
|
|
346
|
+
listener(this.tests);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
getAllTests(): Test[] {
|
|
351
|
+
if (!this.parentPlan) return this.tests;
|
|
352
|
+
return [...this.parentPlan.tests, ...this.tests];
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
listTests(): Test[] {
|
|
356
|
+
return [...this.tests];
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
getPendingTests(): Test[] {
|
|
360
|
+
return this.tests.filter((test) => test.status === 'pending' && test.enabled);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
get isComplete(): boolean {
|
|
364
|
+
return this.tests.length > 0 && this.tests.every((test) => test.hasFinished);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
get allSuccessful(): boolean {
|
|
368
|
+
return this.tests.length > 0 && this.tests.every((test) => test.isSuccessful);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
get allFailed(): boolean {
|
|
372
|
+
return this.tests.length > 0 && this.tests.every((test) => test.hasFailed);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
updateStatus(): void {}
|
|
376
|
+
|
|
377
|
+
static fromMarkdown(filePath: string): Plan {
|
|
378
|
+
return parsePlanFromMarkdown(filePath);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
saveToMarkdown(filePath: string): void {
|
|
382
|
+
savePlanToMarkdown(this, filePath);
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
static saveMultipleToMarkdown(plans: Plan[], filePath: string): void {
|
|
386
|
+
savePlansToMarkdown(plans, filePath);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
getVisitedPages(): WebPageState[] {
|
|
390
|
+
const visitedStates = this.tests.flatMap((test) => test.states).filter((state) => state.url !== this.url);
|
|
391
|
+
const uniqueStates = new Map<string, WebPageState>();
|
|
392
|
+
|
|
393
|
+
for (const state of visitedStates) {
|
|
394
|
+
if (!uniqueStates.has(state.url)) {
|
|
395
|
+
uniqueStates.set(state.url, state);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return Array.from(uniqueStates.values());
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
merge(otherPlan: Plan): Plan {
|
|
403
|
+
const mergedTitle = this.title && otherPlan.title ? `${this.title} + ${otherPlan.title}` : this.title || otherPlan.title || 'Merged Plan';
|
|
404
|
+
|
|
405
|
+
const mergedUrl = this.url || otherPlan.url;
|
|
406
|
+
|
|
407
|
+
const mergedTests = [...this.tests];
|
|
408
|
+
|
|
409
|
+
// Add tests from other plan, avoiding duplicates based on scenario
|
|
410
|
+
for (const otherTest of otherPlan.tests) {
|
|
411
|
+
const isDuplicate = mergedTests.some((test) => test.scenario === otherTest.scenario && test.startUrl === otherTest.startUrl);
|
|
412
|
+
|
|
413
|
+
if (!isDuplicate) {
|
|
414
|
+
mergedTests.push(otherTest);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const mergedPlan = new Plan(mergedTitle);
|
|
419
|
+
for (const test of mergedTests) {
|
|
420
|
+
mergedPlan.addTest(test);
|
|
421
|
+
}
|
|
422
|
+
if (mergedUrl) {
|
|
423
|
+
mergedPlan.url = mergedUrl;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
return mergedPlan;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
toAiContext(options?: { skipSteps?: boolean }): string {
|
|
430
|
+
return planToAiContext(this, options);
|
|
431
|
+
}
|
|
432
|
+
}
|