taphound 0.2.0-dev.1 → 0.2.0-dev.12
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 +49 -149
- package/README.zh-CN.md +47 -147
- package/assets/skills/taphound-case-suite/SKILL.md +363 -0
- package/assets/skills/taphound-case-suite/schemas/base-flow-record.schema.json +22 -0
- package/assets/skills/taphound-case-suite/schemas/case-catalog.schema.json +26 -0
- package/assets/skills/taphound-case-suite/schemas/case-ledger.schema.json +158 -0
- package/assets/skills/taphound-case-suite/schemas/suite-input.schema.json +41 -0
- package/assets/skills/taphound-case-suite/schemas/transition.schema.json +61 -0
- package/assets/skills/taphound-case-suite/scripts/ledger.mjs +1207 -0
- package/assets/skills/taphound-case-suite/templates/base-flow-record.example.json +20 -0
- package/assets/skills/taphound-case-suite/templates/suite-input.example.json +27 -0
- package/assets/skills/taphound-case-suite/templates/transition.example.json +8 -0
- package/assets/skills/taphound-flash/SKILL.md +115 -0
- package/assets/skills/taphound-flash/scripts/flash.mjs +585 -0
- package/assets/skills/taphound-flash/templates/flash-plan.example.json +15 -0
- package/assets/skills/taphound-journey-brief-author/CONTEXT-GUIDE.md +471 -0
- package/assets/skills/taphound-journey-brief-author/SKILL.md +494 -0
- package/assets/skills/taphound-journey-brief-author/prompts/brief-author-role.md +96 -0
- package/assets/skills/taphound-journey-brief-author/prompts/brief-author-role.zh-CN.md +80 -0
- package/assets/skills/taphound-journey-brief-author/prompts/context-analyze-project.md +309 -0
- package/assets/skills/taphound-journey-brief-author/schemas/context-refresh-result.json +123 -0
- package/assets/skills/taphound-journey-brief-author/schemas/project-context-module.json +192 -0
- package/assets/skills/taphound-journey-brief-author/schemas/project-context.json +152 -0
- package/assets/skills/taphound-journey-brief-author/templates/project-context-module.example.json +58 -0
- package/assets/skills/taphound-journey-brief-author/templates/project-context.example.json +51 -0
- package/assets/skills/taphound-journey-brief-author/templates/taphound-journey-brief.template.md +63 -0
- package/assets/skills/taphound-journey-generator/SKILL.md +507 -0
- package/assets/skills/{taphound-ai-journey → taphound-journey-generator}/prompts/check-completion.md +3 -0
- package/assets/skills/taphound-journey-generator/prompts/consume-journey-brief.md +52 -0
- package/assets/skills/taphound-journey-generator/prompts/generate-step.md +211 -0
- package/assets/skills/taphound-journey-generator/prompts/select-flow.md +91 -0
- package/assets/skills/taphound-journey-generator/references/bridge.md +35 -0
- package/assets/skills/taphound-journey-generator/references/mid-session.md +44 -0
- package/assets/skills/taphound-journey-generator/schemas/external-flow.json +37 -0
- package/assets/skills/taphound-journey-generator/schemas/flow.json +28 -0
- package/assets/skills/taphound-journey-generator/schemas/journey-source.json +25 -0
- package/assets/skills/{taphound-ai-journey → taphound-journey-generator}/schemas/observe-output.json +13 -4
- package/assets/skills/{taphound-ai-journey → taphound-journey-generator}/schemas/proposed-step-envelope.json +127 -5
- package/assets/skills/taphound-journey-generator/scripts/envelope.mjs +578 -0
- package/assets/skills/taphound-journey-generator/templates/external-flow.example.json +22 -0
- package/assets/skills/taphound-journey-generator/templates/flow.example.json +22 -0
- package/assets/skills/taphound-journey-generator/templates/journey-source.example.json +17 -0
- package/assets/skills/taphound-journey-generator/templates/taphound-journey-brief.example.md +70 -0
- package/assets/skills/taphound-verify-change/SKILL.md +91 -0
- package/assets/skills/taphound-verify-change/references/accept.md +38 -0
- package/assets/skills/taphound-verify-change/references/preserve.md +357 -0
- package/assets/skills/taphound-verify-change/schemas/workflow-manifest.schema.json +295 -0
- package/assets/skills/taphound-verify-change/scripts/handoff.mjs +482 -0
- package/assets/skills/taphound-verify-change/scripts/ui-refactor.mjs +505 -0
- package/dist/adapters/adb/adb-adapter.d.ts +16 -2
- package/dist/adapters/adb/adb-adapter.js +199 -0
- package/dist/adapters/adb/system-uiautomator-snapshot-provider.d.ts +13 -0
- package/dist/adapters/adb/system-uiautomator-snapshot-provider.js +122 -0
- package/dist/adapters/adb/ui-automator-parser.d.ts +3 -0
- package/dist/adapters/adb/ui-automator-parser.js +160 -0
- package/dist/adapters/adb/window-topology-parser.d.ts +2 -0
- package/dist/adapters/adb/window-topology-parser.js +101 -0
- package/dist/adapters/android-cli/android-cli-adapter.d.ts +16 -8
- package/dist/adapters/android-cli/android-cli-adapter.js +137 -15
- package/dist/adapters/android-cli/android-cli-snapshot-provider.d.ts +9 -0
- package/dist/adapters/android-cli/android-cli-snapshot-provider.js +99 -0
- package/dist/adapters/android-cli/layout-parser.js +12 -8
- package/dist/adapters/appium/appium-doctor.d.ts +7 -0
- package/dist/adapters/appium/appium-doctor.js +128 -0
- package/dist/adapters/appium/appium-ui-snapshot-provider.d.ts +42 -0
- package/dist/adapters/appium/appium-ui-snapshot-provider.js +309 -0
- package/dist/adapters/camera/camera-probe-adapter.d.ts +18 -0
- package/dist/adapters/camera/camera-probe-adapter.js +286 -0
- package/dist/adapters/filesystem/artifact-store.js +40 -1
- package/dist/adapters/filesystem/context-document-writer.d.ts +15 -0
- package/dist/adapters/filesystem/context-document-writer.js +112 -0
- package/dist/adapters/filesystem/diagnostics-journal.d.ts +17 -0
- package/dist/adapters/filesystem/diagnostics-journal.js +130 -0
- package/dist/adapters/filesystem/external-flow-registry.d.ts +17 -0
- package/dist/adapters/filesystem/external-flow-registry.js +325 -0
- package/dist/adapters/filesystem/generation-session-store.d.ts +17 -11
- package/dist/adapters/filesystem/generation-session-store.js +281 -855
- package/dist/adapters/filesystem/generation-store/session-lock.d.ts +29 -0
- package/dist/adapters/filesystem/generation-store/session-lock.js +202 -0
- package/dist/adapters/filesystem/generation-store/session-transitions.d.ts +24 -0
- package/dist/adapters/filesystem/generation-store/session-transitions.js +340 -0
- package/dist/adapters/filesystem/generation-store/store-files.d.ts +50 -0
- package/dist/adapters/filesystem/generation-store/store-files.js +363 -0
- package/dist/adapters/filesystem/journey-composition-store.d.ts +23 -0
- package/dist/adapters/filesystem/journey-composition-store.js +151 -0
- package/dist/adapters/filesystem/knowledge-registry.d.ts +12 -0
- package/dist/adapters/filesystem/knowledge-registry.js +223 -0
- package/dist/adapters/filesystem/project-bound-file.js +3 -5
- package/dist/adapters/filesystem/project-file-inspector.d.ts +2 -0
- package/dist/adapters/filesystem/project-file-inspector.js +57 -28
- package/dist/adapters/filesystem/project-identity-inspector.d.ts +7 -0
- package/dist/adapters/filesystem/project-identity-inspector.js +215 -0
- package/dist/adapters/filesystem/project-inventory-inspector.d.ts +8 -0
- package/dist/adapters/filesystem/project-inventory-inspector.js +93 -0
- package/dist/adapters/filesystem/project-module-discoverer.d.ts +6 -0
- package/dist/adapters/filesystem/project-module-discoverer.js +158 -0
- package/dist/adapters/filesystem/skill-installer.d.ts +7 -2
- package/dist/adapters/filesystem/skill-installer.js +40 -11
- package/dist/adapters/filesystem/workspace-layout.d.ts +7 -0
- package/dist/adapters/filesystem/workspace-layout.js +57 -0
- package/dist/adapters/git/node-git-diff.d.ts +17 -0
- package/dist/adapters/git/node-git-diff.js +114 -0
- package/dist/adapters/process/node-detached-process-launcher.d.ts +6 -0
- package/dist/adapters/process/node-detached-process-launcher.js +96 -0
- package/dist/adapters/process/node-process-runner.js +11 -2
- package/dist/adapters/prompt/inquirer-align-prompt.d.ts +27 -0
- package/dist/adapters/prompt/inquirer-align-prompt.js +65 -0
- package/dist/adapters/prompt/inquirer-generation-prompt.js +3 -0
- package/dist/adapters/prompt/inquirer-recorder-prompt.d.ts +9 -1
- package/dist/adapters/prompt/inquirer-recorder-prompt.js +63 -0
- package/dist/adapters/runtime/adb-runtime-backend.d.ts +67 -0
- package/dist/adapters/runtime/adb-runtime-backend.js +206 -0
- package/dist/adapters/runtime/fake-runtime-backend.d.ts +87 -0
- package/dist/adapters/runtime/fake-runtime-backend.js +240 -0
- package/dist/adapters/runtime/mobile-mcp/mcp-tool-client.d.ts +45 -0
- package/dist/adapters/runtime/mobile-mcp/mcp-tool-client.js +153 -0
- package/dist/adapters/runtime/mobile-mcp/mobile-mcp-errors.d.ts +23 -0
- package/dist/adapters/runtime/mobile-mcp/mobile-mcp-errors.js +39 -0
- package/dist/adapters/runtime/mobile-mcp/mobile-mcp-responses.d.ts +20 -0
- package/dist/adapters/runtime/mobile-mcp/mobile-mcp-responses.js +180 -0
- package/dist/adapters/runtime/mobile-mcp/mobile-mcp-runtime-backend.d.ts +78 -0
- package/dist/adapters/runtime/mobile-mcp/mobile-mcp-runtime-backend.js +379 -0
- package/dist/adapters/runtime/mobile-mcp/mobile-mcp-tools.d.ts +46 -0
- package/dist/adapters/runtime/session-adb-view.d.ts +53 -0
- package/dist/adapters/runtime/session-adb-view.js +193 -0
- package/dist/adapters/runtime/session-backed-ports.d.ts +21 -0
- package/dist/adapters/runtime/session-backed-ports.js +43 -0
- package/dist/adapters/runtime/shared-session-runtime-backend.d.ts +12 -0
- package/dist/adapters/runtime/shared-session-runtime-backend.js +64 -0
- package/dist/adapters/ui/auto-ui-snapshot-provider.d.ts +8 -0
- package/dist/adapters/ui/auto-ui-snapshot-provider.js +48 -0
- package/dist/adapters/ui/device-layout-temp.d.ts +6 -0
- package/dist/adapters/ui/device-layout-temp.js +18 -0
- package/dist/adapters/ui/device-ui-environment.d.ts +13 -0
- package/dist/adapters/ui/device-ui-environment.js +81 -0
- package/dist/adapters/ui/layout-normalization.d.ts +9 -0
- package/dist/adapters/ui/layout-normalization.js +44 -0
- package/dist/adapters/ui/ui-snapshot-error.d.ts +11 -0
- package/dist/adapters/ui/ui-snapshot-error.js +12 -0
- package/dist/adapters/ui/ui-snapshot-support.d.ts +15 -0
- package/dist/adapters/ui/ui-snapshot-support.js +12 -0
- package/dist/application/align/align-service.d.ts +42 -0
- package/dist/application/align/align-service.js +106 -0
- package/dist/application/assertion/expectation-evaluator.d.ts +18 -5
- package/dist/application/assertion/expectation-evaluator.js +156 -18
- package/dist/application/assertion/guarded-expectation.d.ts +45 -0
- package/dist/application/assertion/guarded-expectation.js +74 -0
- package/dist/application/checkpoint/baseline-capturer.d.ts +26 -0
- package/dist/application/checkpoint/baseline-capturer.js +163 -0
- package/dist/application/checkpoint/baseline-error.d.ts +5 -0
- package/dist/application/checkpoint/baseline-error.js +8 -0
- package/dist/application/checkpoint/baseline-service.d.ts +31 -0
- package/dist/application/checkpoint/baseline-service.js +147 -0
- package/dist/application/checkpoint/checkpoint-evaluator.d.ts +35 -0
- package/dist/application/checkpoint/checkpoint-evaluator.js +415 -0
- package/dist/application/checkpoint/regression-comparator.d.ts +18 -0
- package/dist/application/checkpoint/regression-comparator.js +192 -0
- package/dist/application/collector/logcat-collector.d.ts +22 -1
- package/dist/application/collector/logcat-collector.js +103 -15
- package/dist/application/collector/logcat-event.d.ts +8 -0
- package/dist/application/collector/logcat-event.js +79 -0
- package/dist/application/collector/logcat-stop.d.ts +2 -0
- package/dist/application/collector/logcat-stop.js +11 -0
- package/dist/application/context/context-generator.d.ts +45 -0
- package/dist/application/context/context-generator.js +228 -0
- package/dist/application/context/context-loader.d.ts +40 -0
- package/dist/application/context/context-loader.js +223 -0
- package/dist/application/context/context-refresher.d.ts +59 -0
- package/dist/application/context/context-refresher.js +349 -0
- package/dist/application/context/context-rehasher.d.ts +36 -0
- package/dist/application/context/context-rehasher.js +110 -0
- package/dist/application/context/context-validator.d.ts +23 -1
- package/dist/application/context/context-validator.js +116 -9
- package/dist/application/context/evidence-hash.d.ts +1 -0
- package/dist/application/context/evidence-hash.js +125 -0
- package/dist/application/context/evidence-match.d.ts +9 -0
- package/dist/application/context/evidence-match.js +8 -0
- package/dist/application/context/shard-identity.d.ts +2 -0
- package/dist/application/context/shard-identity.js +7 -0
- package/dist/application/contract/contract-loader.d.ts +25 -0
- package/dist/application/contract/contract-loader.js +68 -0
- package/dist/application/contract/contract-review.d.ts +25 -0
- package/dist/application/contract/contract-review.js +51 -0
- package/dist/application/contract/contract-verifier.d.ts +53 -0
- package/dist/application/contract/contract-verifier.js +645 -0
- package/dist/application/devices/resolve-device-assignments.d.ts +21 -0
- package/dist/application/devices/resolve-device-assignments.js +60 -0
- package/dist/application/diagnosis/failure-classifier.d.ts +23 -0
- package/dist/application/diagnosis/failure-classifier.js +179 -0
- package/dist/application/diagnostics/diagnostics-exporter.d.ts +29 -0
- package/dist/application/diagnostics/diagnostics-exporter.js +283 -0
- package/dist/application/diagnostics/ui-capture-telemetry.d.ts +16 -0
- package/dist/application/diagnostics/ui-capture-telemetry.js +81 -0
- package/dist/application/doctor/doctor-service.d.ts +36 -3
- package/dist/application/doctor/doctor-service.js +255 -25
- package/dist/application/generation/generation-app-preparer.d.ts +20 -0
- package/dist/application/generation/generation-app-preparer.js +28 -0
- package/dist/application/generation/generation-config-service.d.ts +21 -0
- package/dist/application/generation/generation-config-service.js +53 -0
- package/dist/application/generation/generation-confirmation-service.d.ts +14 -3
- package/dist/application/generation/generation-confirmation-service.js +109 -24
- package/dist/application/generation/generation-context-snapshot.d.ts +6 -0
- package/dist/application/generation/generation-context-snapshot.js +29 -0
- package/dist/application/generation/generation-finalizer.d.ts +15 -9
- package/dist/application/generation/generation-finalizer.js +167 -70
- package/dist/application/generation/generation-publisher.js +12 -8
- package/dist/application/generation/generation-recovery-service.d.ts +35 -0
- package/dist/application/generation/generation-recovery-service.js +144 -0
- package/dist/application/generation/generation-reopen-service.d.ts +15 -0
- package/dist/application/generation/generation-reopen-service.js +37 -0
- package/dist/application/generation/generation-replace-service.d.ts +32 -0
- package/dist/application/generation/generation-replace-service.js +116 -0
- package/dist/application/generation/generation-starter.d.ts +44 -4
- package/dist/application/generation/generation-starter.js +175 -8
- package/dist/application/generation/generation-step-executor.d.ts +67 -5
- package/dist/application/generation/generation-step-executor.js +471 -108
- package/dist/application/generation/proposed-step-validator.js +96 -30
- package/dist/application/generation/replay-policy-loader.d.ts +16 -0
- package/dist/application/generation/replay-policy-loader.js +29 -0
- package/dist/application/generation/risk-evaluator.d.ts +4 -1
- package/dist/application/generation/risk-evaluator.js +118 -3
- package/dist/application/generation/runtime-observer.d.ts +39 -7
- package/dist/application/generation/runtime-observer.js +193 -24
- package/dist/application/impact/impact-resolver.d.ts +32 -0
- package/dist/application/impact/impact-resolver.js +160 -0
- package/dist/application/init/init-service.js +26 -13
- package/dist/application/interaction/action-executor.d.ts +3 -2
- package/dist/application/interaction/action-executor.js +11 -1
- package/dist/application/interaction/action-target.d.ts +17 -0
- package/dist/application/interaction/action-target.js +40 -0
- package/dist/application/interaction/external-step-runner.d.ts +153 -0
- package/dist/application/interaction/external-step-runner.js +332 -0
- package/dist/application/interaction/fallback-resolver.d.ts +6 -3
- package/dist/application/interaction/fallback-resolver.js +7 -5
- package/dist/application/interaction/scroll-to-executor.d.ts +17 -3
- package/dist/application/interaction/scroll-to-executor.js +118 -36
- package/dist/application/journey/external-flow-resolver.d.ts +25 -0
- package/dist/application/journey/external-flow-resolver.js +22 -0
- package/dist/application/journey/journey-check-service.d.ts +54 -0
- package/dist/application/journey/journey-check-service.js +207 -0
- package/dist/application/journey/journey-promoter.d.ts +26 -0
- package/dist/application/journey/journey-promoter.js +123 -0
- package/dist/application/journey/journey-resolver.d.ts +42 -0
- package/dist/application/journey/journey-resolver.js +239 -0
- package/dist/application/journey/journey-retirer.d.ts +25 -0
- package/dist/application/journey/journey-retirer.js +87 -0
- package/dist/application/knowledge/anchor-resolver.d.ts +36 -0
- package/dist/application/knowledge/anchor-resolver.js +110 -0
- package/dist/application/knowledge/knowledge-loader.d.ts +16 -0
- package/dist/application/knowledge/knowledge-loader.js +36 -0
- package/dist/application/locator/layout-failure-summary.d.ts +2 -0
- package/dist/application/locator/layout-failure-summary.js +67 -0
- package/dist/application/locator/layout-traversal.d.ts +11 -0
- package/dist/application/locator/layout-traversal.js +18 -0
- package/dist/application/locator/locator-resolver.d.ts +13 -1
- package/dist/application/locator/locator-resolver.js +182 -18
- package/dist/application/observe/observe-service.d.ts +20 -0
- package/dist/application/observe/observe-service.js +91 -0
- package/dist/application/project/project-describer.d.ts +14 -6
- package/dist/application/project/project-describer.js +38 -5
- package/dist/application/recognition/screen-detector.d.ts +28 -0
- package/dist/application/recognition/screen-detector.js +111 -0
- package/dist/application/recorder/locator-selector.js +151 -17
- package/dist/application/recorder/recorder-service.d.ts +16 -4
- package/dist/application/recorder/recorder-service.js +420 -128
- package/dist/application/report/report-writer.d.ts +5 -0
- package/dist/application/report/report-writer.js +17 -1
- package/dist/application/runtime/cold-launch.d.ts +28 -0
- package/dist/application/runtime/cold-launch.js +59 -0
- package/dist/application/runtime/step-runner.d.ts +49 -4
- package/dist/application/runtime/step-runner.js +721 -130
- package/dist/application/runtime/verify-runtime.d.ts +57 -7
- package/dist/application/runtime/verify-runtime.js +577 -175
- package/dist/application/ui/cached-ui-snapshot-provider.d.ts +45 -0
- package/dist/application/ui/cached-ui-snapshot-provider.js +111 -0
- package/dist/application/ui/observed-ui-snapshot-provider.d.ts +15 -0
- package/dist/application/ui/observed-ui-snapshot-provider.js +66 -0
- package/dist/application/ui/ui-snapshot-lifecycle.d.ts +2 -0
- package/dist/application/ui/ui-snapshot-lifecycle.js +8 -0
- package/dist/application/ui/ui-stability-probe.d.ts +9 -0
- package/dist/application/ui/ui-stability-probe.js +24 -0
- package/dist/application/wait/idle-advice.d.ts +6 -0
- package/dist/application/wait/idle-advice.js +27 -0
- package/dist/application/wait/idle-profiles.d.ts +15 -0
- package/dist/application/wait/idle-profiles.js +75 -0
- package/dist/application/wait/idle-waiter.d.ts +28 -4
- package/dist/application/wait/idle-waiter.js +201 -15
- package/dist/cli/commands/align.d.ts +3 -0
- package/dist/cli/commands/align.js +124 -0
- package/dist/cli/commands/baseline.d.ts +3 -0
- package/dist/cli/commands/baseline.js +130 -0
- package/dist/cli/commands/context.js +300 -27
- package/dist/cli/commands/contract.d.ts +3 -0
- package/dist/cli/commands/contract.js +120 -0
- package/dist/cli/commands/diagnose.d.ts +3 -0
- package/dist/cli/commands/diagnose.js +84 -0
- package/dist/cli/commands/doctor.js +16 -9
- package/dist/cli/commands/failure.d.ts +3 -0
- package/dist/cli/commands/failure.js +63 -0
- package/dist/cli/commands/generation/lifecycle-commands.d.ts +5 -0
- package/dist/cli/commands/generation/lifecycle-commands.js +211 -0
- package/dist/cli/commands/generation/session-commands.d.ts +11 -0
- package/dist/cli/commands/generation/session-commands.js +472 -0
- package/dist/cli/commands/generation/shared.d.ts +1414 -0
- package/dist/cli/commands/generation/shared.js +291 -0
- package/dist/cli/commands/generation/step-commands.d.ts +8 -0
- package/dist/cli/commands/generation/step-commands.js +315 -0
- package/dist/cli/commands/generation.js +10 -507
- package/dist/cli/commands/impact.d.ts +3 -0
- package/dist/cli/commands/impact.js +87 -0
- package/dist/cli/commands/init.js +13 -6
- package/dist/cli/commands/journey.d.ts +3 -0
- package/dist/cli/commands/journey.js +382 -0
- package/dist/cli/commands/knowledge.d.ts +3 -0
- package/dist/cli/commands/knowledge.js +93 -0
- package/dist/cli/commands/observe.d.ts +3 -0
- package/dist/cli/commands/observe.js +127 -0
- package/dist/cli/commands/project.js +2 -1
- package/dist/cli/commands/record.js +18 -5
- package/dist/cli/commands/verify.js +326 -64
- package/dist/cli/dependencies.d.ts +136 -1
- package/dist/cli/dependencies.js +504 -52
- package/dist/cli/diagnostics-recorder.d.ts +31 -0
- package/dist/cli/diagnostics-recorder.js +82 -0
- package/dist/cli/diff-verification.d.ts +41 -0
- package/dist/cli/diff-verification.js +192 -0
- package/dist/cli/main.d.ts +1 -1
- package/dist/cli/main.js +107 -2
- package/dist/cli/output.d.ts +5 -3
- package/dist/cli/output.js +12 -0
- package/dist/cli/program.js +21 -1
- package/dist/cli/project-root.d.ts +1 -0
- package/dist/cli/project-root.js +6 -0
- package/dist/cli/runtime-selection.d.ts +22 -0
- package/dist/cli/runtime-selection.js +92 -0
- package/dist/cli/version.d.ts +1 -0
- package/dist/cli/version.js +14 -0
- package/dist/cli/workspace-guard.d.ts +2 -0
- package/dist/cli/workspace-guard.js +3 -0
- package/dist/domain/binding-reference.d.ts +4 -0
- package/dist/domain/binding-reference.js +23 -0
- package/dist/domain/checkpoint.d.ts +404 -0
- package/dist/domain/checkpoint.js +297 -0
- package/dist/domain/config.d.ts +107 -1
- package/dist/domain/config.js +52 -6
- package/dist/domain/contract.d.ts +413 -0
- package/dist/domain/contract.js +196 -0
- package/dist/domain/diagnostics.d.ts +1396 -0
- package/dist/domain/diagnostics.js +193 -0
- package/dist/domain/external-flow.d.ts +493 -0
- package/dist/domain/external-flow.js +15 -0
- package/dist/domain/failure-classification.d.ts +176 -0
- package/dist/domain/failure-classification.js +169 -0
- package/dist/domain/failure.d.ts +2 -1
- package/dist/domain/failure.js +123 -0
- package/dist/domain/generation.d.ts +1671 -132
- package/dist/domain/generation.js +202 -13
- package/dist/domain/geometry.d.ts +13 -0
- package/dist/domain/geometry.js +16 -0
- package/dist/domain/impact.d.ts +71 -0
- package/dist/domain/impact.js +76 -0
- package/dist/domain/init.d.ts +12 -4
- package/dist/domain/init.js +24 -18
- package/dist/domain/journey-composition.d.ts +2285 -0
- package/dist/domain/journey-composition.js +85 -0
- package/dist/domain/journey-lifecycle.d.ts +10 -0
- package/dist/domain/journey-lifecycle.js +9 -0
- package/dist/domain/journey.d.ts +2419 -212
- package/dist/domain/journey.js +384 -14
- package/dist/domain/knowledge.d.ts +165 -0
- package/dist/domain/knowledge.js +188 -0
- package/dist/domain/layout.d.ts +34 -5
- package/dist/domain/layout.js +64 -6
- package/dist/domain/locator-evidence.d.ts +3 -0
- package/dist/domain/locator-evidence.js +36 -0
- package/dist/domain/logcat-event.d.ts +54 -0
- package/dist/domain/logcat-event.js +40 -0
- package/dist/domain/observation.d.ts +33 -0
- package/dist/domain/observation.js +18 -0
- package/dist/domain/project-context.d.ts +219 -1
- package/dist/domain/project-context.js +209 -6
- package/dist/domain/proposed-step.d.ts +340 -60
- package/dist/domain/proposed-step.js +23 -3
- package/dist/domain/report.d.ts +1455 -28
- package/dist/domain/report.js +211 -14
- package/dist/domain/runtime-snapshot.d.ts +58 -1
- package/dist/domain/runtime-snapshot.js +14 -3
- package/dist/domain/runtime.d.ts +50 -0
- package/dist/domain/runtime.js +36 -0
- package/dist/domain/system-app-profiles.d.ts +6 -0
- package/dist/domain/system-app-profiles.js +43 -0
- package/dist/domain/ui-backend.d.ts +28 -0
- package/dist/domain/ui-backend.js +33 -0
- package/dist/domain/ui-cache.d.ts +11 -0
- package/dist/domain/ui-cache.js +10 -0
- package/dist/domain/verify-receipt.d.ts +17 -0
- package/dist/domain/verify-receipt.js +17 -0
- package/dist/domain/window-hierarchy.d.ts +84 -0
- package/dist/domain/window-hierarchy.js +172 -0
- package/dist/domain/workflow-manifest.d.ts +77 -0
- package/dist/domain/workflow-manifest.js +136 -0
- package/dist/domain/workspace.d.ts +30 -0
- package/dist/domain/workspace.js +74 -0
- package/dist/ports/adb.d.ts +34 -1
- package/dist/ports/align-prompt.d.ts +11 -0
- package/dist/ports/align-prompt.js +6 -0
- package/dist/ports/anchor-resolver.d.ts +30 -0
- package/dist/ports/anchor-resolver.js +1 -0
- package/dist/ports/annotated-screen-resolver.d.ts +4 -0
- package/dist/ports/annotated-screen-resolver.js +1 -0
- package/dist/ports/camera-probe.d.ts +23 -0
- package/dist/ports/camera-probe.js +8 -0
- package/dist/ports/context-document-writer.d.ts +24 -0
- package/dist/ports/context-document-writer.js +1 -0
- package/dist/ports/detached-process-launcher.d.ts +12 -0
- package/dist/ports/detached-process-launcher.js +1 -0
- package/dist/ports/diagnostics.d.ts +15 -0
- package/dist/ports/diagnostics.js +1 -0
- package/dist/ports/external-flow-registry.d.ts +37 -0
- package/dist/ports/external-flow-registry.js +1 -0
- package/dist/ports/generation-prompt.d.ts +2 -1
- package/dist/ports/generation-session-store.d.ts +12 -2
- package/dist/ports/git-diff.d.ts +9 -0
- package/dist/ports/git-diff.js +1 -0
- package/dist/ports/journey-composition-store.d.ts +17 -0
- package/dist/ports/journey-composition-store.js +1 -0
- package/dist/ports/knowledge-registry.d.ts +20 -0
- package/dist/ports/knowledge-registry.js +1 -0
- package/dist/ports/process-runner.d.ts +7 -0
- package/dist/ports/project-file-inspector.d.ts +1 -0
- package/dist/ports/project-identity-inspector.d.ts +24 -0
- package/dist/ports/project-identity-inspector.js +1 -0
- package/dist/ports/project-inventory-inspector.d.ts +21 -0
- package/dist/ports/project-inventory-inspector.js +1 -0
- package/dist/ports/project-module-discoverer.d.ts +26 -0
- package/dist/ports/project-module-discoverer.js +1 -0
- package/dist/ports/recorder-prompt.d.ts +10 -1
- package/dist/ports/runtime-backend.d.ts +89 -0
- package/dist/ports/runtime-backend.js +13 -0
- package/dist/ports/runtime-capability.d.ts +12 -0
- package/dist/ports/runtime-capability.js +20 -0
- package/dist/ports/runtime-session-ports.d.ts +25 -0
- package/dist/ports/runtime-session-ports.js +1 -0
- package/dist/ports/screenshot.d.ts +11 -0
- package/dist/ports/screenshot.js +1 -0
- package/dist/ports/skill-installer.d.ts +2 -2
- package/dist/ports/ui-snapshot.d.ts +35 -0
- package/dist/ports/ui-snapshot.js +1 -0
- package/dist/ports/ui-stability.d.ts +19 -0
- package/dist/ports/ui-stability.js +1 -0
- package/dist/ports/workspace-layout.d.ts +4 -0
- package/dist/ports/workspace-layout.js +1 -0
- package/dist/shared/errors.d.ts +2 -0
- package/dist/shared/errors.js +22 -0
- package/dist/shared/paths.d.ts +2 -0
- package/dist/shared/paths.js +24 -0
- package/dist/shared/strings.d.ts +2 -0
- package/dist/shared/strings.js +16 -0
- package/package.json +7 -2
- package/assets/skills/taphound-ai-journey/GUIDE.md +0 -862
- package/assets/skills/taphound-ai-journey/SKILL.md +0 -377
- package/assets/skills/taphound-ai-journey/prompts/analyze-project.md +0 -526
- package/assets/skills/taphound-ai-journey/prompts/generate-step.md +0 -109
- package/assets/skills/taphound-ai-journey/schemas/project-context.json +0 -81
- package/assets/skills/taphound-ai-journey/templates/project-context.example.json +0 -49
- package/dist/ports/android-cli.d.ts +0 -21
- /package/dist/{ports/android-cli.js → adapters/runtime/mobile-mcp/mobile-mcp-tools.js} +0 -0
|
@@ -1,862 +0,0 @@
|
|
|
1
|
-
# TapHound AI Journey Usage Guide
|
|
2
|
-
|
|
3
|
-
This guide describes how to use an AI agent (Droid, Claude Code, Cursor,
|
|
4
|
-
etc.) to drive TapHound's generation protocol for end-to-end testing on
|
|
5
|
-
a real Android device.
|
|
6
|
-
|
|
7
|
-
## Architecture Overview
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
User provides Goal (natural-language test scenario)
|
|
11
|
-
|
|
|
12
|
-
v
|
|
13
|
-
+-----------------------------+
|
|
14
|
-
| One-time setup (first run |
|
|
15
|
-
| or after major changes) |
|
|
16
|
-
| AI analyzes source -> |
|
|
17
|
-
| Project Context |
|
|
18
|
-
| taphound context validate |
|
|
19
|
-
+-------------+---------------+
|
|
20
|
-
| Context reused
|
|
21
|
-
v
|
|
22
|
-
+-----------------------------+
|
|
23
|
-
| Per-goal test run |
|
|
24
|
-
| generation start -> observe |
|
|
25
|
-
| -> AI generates step -> |
|
|
26
|
-
| execute -> repeat -> |
|
|
27
|
-
| finalize -> verified |
|
|
28
|
-
+-----------------------------+
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Project Context is generated once and reused. It only needs regeneration
|
|
32
|
-
when the project source changes significantly (see Section 5).
|
|
33
|
-
|
|
34
|
-
---
|
|
35
|
-
|
|
36
|
-
## 1. Prerequisites
|
|
37
|
-
|
|
38
|
-
### 1.1 Environment Requirements
|
|
39
|
-
|
|
40
|
-
| Item | Requirement |
|
|
41
|
-
|------|-------------|
|
|
42
|
-
| Node.js | 22+ (avoid 23) |
|
|
43
|
-
| Android SDK | ADB + `uiautomator` (Android CLI) |
|
|
44
|
-
| Device | One online Android device (emulator or USB) |
|
|
45
|
-
| App | Target APK already installed on the device |
|
|
46
|
-
| TapHound | Cloned repo with `npm ci` installed |
|
|
47
|
-
|
|
48
|
-
### 1.2 Build TapHound
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
cd /path/to/TapHound
|
|
52
|
-
npm ci
|
|
53
|
-
npm run build
|
|
54
|
-
npm link # Register global taphound command
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
`npm link` symlinks the `taphound` command to your system PATH, so you
|
|
58
|
-
can use `taphound` instead of `node dist/cli/main.js` everywhere below.
|
|
59
|
-
Verify the registration:
|
|
60
|
-
|
|
61
|
-
```bash
|
|
62
|
-
taphound --help
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
Should output `Usage: taphound` and list `doctor`, `record`, `verify`,
|
|
66
|
-
`project`, `context`, `generation` commands.
|
|
67
|
-
|
|
68
|
-
> If you prefer not to register globally, you can use `npx taphound` or
|
|
69
|
-
> `node dist/cli/main.js` in place of `taphound` throughout this guide.
|
|
70
|
-
|
|
71
|
-
### 1.3 Confirm Device is Online
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
adb devices -l
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
You should see exactly one device in `device` state. If multiple devices
|
|
78
|
-
are connected, note the serial (e.g., `emulator-5554`) and use
|
|
79
|
-
`--device <serial>` on commands that expose that option.
|
|
80
|
-
|
|
81
|
-
### 1.4 Environment Diagnostics
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
taphound doctor \
|
|
85
|
-
--project /path/to/android-project \
|
|
86
|
-
--json
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Confirm `"status": "passed"`. If you get exit code 3 /
|
|
90
|
-
`DEVICE_UNAVAILABLE`, the device is not connected or ADB is not
|
|
91
|
-
installed. Resolve the environment issue first.
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## 2. One-Time Setup: Generate Project Context
|
|
96
|
-
|
|
97
|
-
> Project Context describes the Android project's UI structure, element
|
|
98
|
-
> locators, and interaction policy. It is generated once, persisted in the
|
|
99
|
-
> project directory, and reused for every test run. Only significant source
|
|
100
|
-
> changes require regeneration (see Section 5).
|
|
101
|
-
|
|
102
|
-
### 2.1 Load the Skill in Your AI Agent
|
|
103
|
-
|
|
104
|
-
Run `taphound init` to install the Skill into each agent's expected directory,
|
|
105
|
-
then load it in your AI agent tool. The entry file is `SKILL.md`. The method
|
|
106
|
-
depends on the tool:
|
|
107
|
-
|
|
108
|
-
- **Droid**: The Skill is auto-discovered from `.factory/skills/` in the
|
|
109
|
-
TapHound repo. Run `taphound init --agent droid` in other projects.
|
|
110
|
-
Invoke it with the Skill tool using `taphound-ai-journey`.
|
|
111
|
-
- **Claude Code**: Run `taphound init --agent claude` to install to
|
|
112
|
-
`.claude/skills/`, then invoke with the Skill tool.
|
|
113
|
-
- **Codex**: Run `taphound init --agent codex` to install to `.agents/skills/`.
|
|
114
|
-
- **Cursor**: Run `taphound init --agent cursor` to install to `.cursor/skills/`.
|
|
115
|
-
- **Other tools**: Run `taphound init --agent other` to install to
|
|
116
|
-
`.agents/skills/`, or have the agent read `SKILL.md` directly.
|
|
117
|
-
|
|
118
|
-
### 2.2 Have the AI Analyze Project Source
|
|
119
|
-
|
|
120
|
-
Tell the AI agent (after the Skill is loaded, just provide the project
|
|
121
|
-
path):
|
|
122
|
-
|
|
123
|
-
```
|
|
124
|
-
Generate a TapHound Project Context for the project at /path/to/android-project.
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
The AI agent will follow SKILL.md Phase 1 instructions and automatically
|
|
128
|
-
perform these steps:
|
|
129
|
-
|
|
130
|
-
1. Run `./gradlew projects` to discover all modules (falls back to parsing
|
|
131
|
-
`settings.gradle` if no wrapper), and identify the app module (the one
|
|
132
|
-
with `applicationId`).
|
|
133
|
-
2. Read `applicationId` from the app module's `build.gradle` or
|
|
134
|
-
`build.gradle.kts` as the package name (falls back to the `package`
|
|
135
|
-
attribute in the manifest for legacy projects).
|
|
136
|
-
3. Identify the launch Activity from the app module's `AndroidManifest.xml`
|
|
137
|
-
(library module Activities are merged in via manifest merge).
|
|
138
|
-
4. Scan Kotlin/Java source across all modules to identify Activities, click
|
|
139
|
-
handlers, Logcat tags, and Activity transitions.
|
|
140
|
-
5. Scan layout XML across all modules to extract `android:id` values,
|
|
141
|
-
recursively resolving `<include>`, `<merge>`, `<layout>` (Data Binding),
|
|
142
|
-
and `<ViewStub>` composite structures.
|
|
143
|
-
6. Compute SHA-256 for each file using shell commands (never guessed).
|
|
144
|
-
7. Generate a JSON matching `schemas/project-context.json`.
|
|
145
|
-
|
|
146
|
-
> **Multi-module note**: Activities may be distributed across library/feature
|
|
147
|
-
> modules, and layout XML may be in any module's `res/layout/`. The AI agent
|
|
148
|
-
> uses `./gradlew projects` to get the authoritative module list and scans
|
|
149
|
-
> all modules.
|
|
150
|
-
|
|
151
|
-
### 2.3 Write and Validate Context
|
|
152
|
-
|
|
153
|
-
The AI-generated Context is written to:
|
|
154
|
-
|
|
155
|
-
```
|
|
156
|
-
<project>/.taphound/context/project-context.json
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Then validate:
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
taphound context validate \
|
|
163
|
-
--project /path/to/android-project \
|
|
164
|
-
--context /path/to/android-project/.taphound/context/project-context.json \
|
|
165
|
-
--json
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
**Success**: `"status": "valid"`, exit 0. Context is ready, proceed to
|
|
169
|
-
Section 3.
|
|
170
|
-
|
|
171
|
-
**Failure**: Fix based on the error message. Common causes:
|
|
172
|
-
|
|
173
|
-
| Error | Cause | Fix |
|
|
174
|
-
|-------|-------|-----|
|
|
175
|
-
| `CONTEXT_INVALID` | Package name / Activity mismatch | Check against AndroidManifest.xml |
|
|
176
|
-
| `CONTEXT_INVALID` | Incorrect SHA-256 | Recompute hash using shell |
|
|
177
|
-
| `CONTEXT_INVALID` | Path contains `..` or starts with `/` | Use project-relative paths |
|
|
178
|
-
| `CONTEXT_STALE` | File content does not match hash | Source changed, recompute hashes |
|
|
179
|
-
|
|
180
|
-
### 2.4 Check Context Status (Optional)
|
|
181
|
-
|
|
182
|
-
You can check whether the Context is still valid at any time:
|
|
183
|
-
|
|
184
|
-
```bash
|
|
185
|
-
taphound context status \
|
|
186
|
-
--project /path/to/android-project \
|
|
187
|
-
--context /path/to/android-project/.taphound/context/project-context.json \
|
|
188
|
-
--json
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
Returns `"valid"` (still valid), `"stale"` (files changed, needs update),
|
|
192
|
-
or `"invalid"` (structural error).
|
|
193
|
-
|
|
194
|
-
### 2.5 Context Persistence
|
|
195
|
-
|
|
196
|
-
The generated `project-context.json` is saved in the project's
|
|
197
|
-
`.taphound/context/` directory. This file can be:
|
|
198
|
-
|
|
199
|
-
- **Committed to Git**: If the project source is stable, the Context can
|
|
200
|
-
be tracked as a project artifact.
|
|
201
|
-
- **Added to .gitignore**: If the project changes frequently, regenerate
|
|
202
|
-
dynamically before each run.
|
|
203
|
-
|
|
204
|
-
Recommendation: commit to Git after first generation, update per Section 5
|
|
205
|
-
when source changes.
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
## 3. Per-Goal Test: Generate a Journey
|
|
210
|
-
|
|
211
|
-
> Each Goal is an independent test scenario. The same Project Context can
|
|
212
|
-
> drive multiple different Goals.
|
|
213
|
-
|
|
214
|
-
### 3.1 Provide a Test Goal
|
|
215
|
-
|
|
216
|
-
Describe the scenario you want to test in natural language, for example:
|
|
217
|
-
|
|
218
|
-
```
|
|
219
|
-
Test the search feature: click the search button to open the search page,
|
|
220
|
-
type "hello world" in the search box, click submit, and verify the log
|
|
221
|
-
shows "submitted query=hello world".
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### 3.2 Step 1 — Start a Generation Session
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
taphound generation start \
|
|
228
|
-
--project /path/to/android-project \
|
|
229
|
-
--config taphound.config.json \
|
|
230
|
-
--context .taphound/context/project-context.json \
|
|
231
|
-
--device emulator-5554 \
|
|
232
|
-
--json
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
**Output** (`--json` mode writes exactly one JSON object to stdout):
|
|
236
|
-
|
|
237
|
-
```json
|
|
238
|
-
{
|
|
239
|
-
"status": "started",
|
|
240
|
-
"exitCode": 0,
|
|
241
|
-
"generationId": "a1b2c3d4-...",
|
|
242
|
-
"revision": 0,
|
|
243
|
-
"bindings": { "projectHash": "...", "configHash": "...", "contextHash": "...", "snapshotHash": null },
|
|
244
|
-
"variables": { "runId": "...", "timestamp": "...", "randomHex": "..." },
|
|
245
|
-
"target": { "packageName": "...", "deviceSerial": "...", "resetStrategy": "processOnly", "interactionPolicy": {...} }
|
|
246
|
-
}
|
|
247
|
-
```
|
|
248
|
-
|
|
249
|
-
**Note the `generationId`** — all subsequent commands use it. The selected
|
|
250
|
-
device is bound to the session. Session operations such as `observe`, `step`,
|
|
251
|
-
`confirm`, and `manual` use that binding and do not accept `--device`.
|
|
252
|
-
|
|
253
|
-
**Failure troubleshooting**:
|
|
254
|
-
|
|
255
|
-
| Exit code | Meaning | Action |
|
|
256
|
-
|-----------|---------|--------|
|
|
257
|
-
| 2 | `CONFIG_INVALID` / `CONTEXT_INVALID` | Check config and Context files |
|
|
258
|
-
| 1 | `CONTEXT_STALE` | Source changed, update Context per Section 5 |
|
|
259
|
-
| 3 | Environment issue | Run `doctor` first |
|
|
260
|
-
| 4 | Internal error | Check stderr output |
|
|
261
|
-
|
|
262
|
-
### 3.3 Step 2 — Observe Current Device State
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
taphound generation observe \
|
|
266
|
-
--project /path/to/android-project \
|
|
267
|
-
--session <generationId> \
|
|
268
|
-
--json
|
|
269
|
-
```
|
|
270
|
-
|
|
271
|
-
**Output**:
|
|
272
|
-
|
|
273
|
-
```json
|
|
274
|
-
{
|
|
275
|
-
"status": "observed",
|
|
276
|
-
"exitCode": 0,
|
|
277
|
-
"generationId": "a1b2c3d4-...",
|
|
278
|
-
"baseRevision": 1,
|
|
279
|
-
"snapshotHash": "e5f6...",
|
|
280
|
-
"snapshot": {
|
|
281
|
-
"version": 1,
|
|
282
|
-
"generationId": "a1b2c3d4-...",
|
|
283
|
-
"baseRevision": 1,
|
|
284
|
-
"deviceSerial": "emulator-5554",
|
|
285
|
-
"expectedPackageName": "dev.taphound.demo",
|
|
286
|
-
"foregroundPackageName": "dev.taphound.demo",
|
|
287
|
-
"activity": "dev.taphound.demo.MainActivity",
|
|
288
|
-
"pid": 12345,
|
|
289
|
-
"capturedAt": "2026-07-24T...",
|
|
290
|
-
"layout": [
|
|
291
|
-
{ "id": "...", "resourceId": "open_search", "text": "Open search", "clickable": true, "enabled": true, "children": [] }
|
|
292
|
-
]
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
**Note** three binding fields: `generationId`, `baseRevision`,
|
|
298
|
-
`snapshotHash`, plus the full `snapshot` object (including the `layout`
|
|
299
|
-
array describing all UI elements on the current screen).
|
|
300
|
-
|
|
301
|
-
> Ensure the app is launched and on the expected initial screen. If the
|
|
302
|
-
> foreground is not the target app, `observe` records that state, and the
|
|
303
|
-
> next proposed step is rejected with `PACKAGE_ESCAPE`.
|
|
304
|
-
|
|
305
|
-
### 3.4 Step 3 — AI Generates Next Proposed Step
|
|
306
|
-
|
|
307
|
-
The AI agent reads `prompts/generate-step.md` and is given:
|
|
308
|
-
|
|
309
|
-
- **Goal**: the user's test scenario description
|
|
310
|
-
- **Project Context**: the JSON from Section 2
|
|
311
|
-
- **Snapshot**: the observe output from Step 2 (including layout)
|
|
312
|
-
- **Completed steps**: the list of steps already succeeded in this session
|
|
313
|
-
|
|
314
|
-
The AI agent analyzes the current screen elements, decides the next action
|
|
315
|
-
based on the Goal, and outputs a proposed step JSON (without `binding`,
|
|
316
|
-
which the caller fills in).
|
|
317
|
-
|
|
318
|
-
For example, if currently on MainActivity and the Goal is to test search,
|
|
319
|
-
the AI might generate:
|
|
320
|
-
|
|
321
|
-
```json
|
|
322
|
-
{
|
|
323
|
-
"action": "click",
|
|
324
|
-
"locator": { "resourceId": "open_search" },
|
|
325
|
-
"activity": { "before": "dev.taphound.demo.MainActivity" },
|
|
326
|
-
"expect": {
|
|
327
|
-
"type": "element",
|
|
328
|
-
"locator": { "resourceId": "search_input" },
|
|
329
|
-
"timeoutMs": 3000
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
### 3.5 Step 4 — Build Envelope and Execute
|
|
335
|
-
|
|
336
|
-
Combine the AI-generated proposed step with the binding and snapshot into
|
|
337
|
-
a complete envelope:
|
|
338
|
-
|
|
339
|
-
```json
|
|
340
|
-
{
|
|
341
|
-
"version": 1,
|
|
342
|
-
"proposal": {
|
|
343
|
-
"action": "click",
|
|
344
|
-
"locator": { "resourceId": "open_search" },
|
|
345
|
-
"activity": { "before": "dev.taphound.demo.MainActivity" },
|
|
346
|
-
"expect": {
|
|
347
|
-
"type": "element",
|
|
348
|
-
"locator": { "resourceId": "search_input" },
|
|
349
|
-
"timeoutMs": 3000
|
|
350
|
-
},
|
|
351
|
-
"binding": {
|
|
352
|
-
"generationId": "<generationId from observe>",
|
|
353
|
-
"baseRevision": "<baseRevision from observe>",
|
|
354
|
-
"snapshotHash": "<snapshotHash from observe>"
|
|
355
|
-
}
|
|
356
|
-
},
|
|
357
|
-
"snapshot": { "...full snapshot from observe..." }
|
|
358
|
-
}
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
Write to a temp file, then execute:
|
|
362
|
-
|
|
363
|
-
```bash
|
|
364
|
-
taphound generation step \
|
|
365
|
-
--project /path/to/android-project \
|
|
366
|
-
--session <generationId> \
|
|
367
|
-
--input /tmp/taphound-step.json \
|
|
368
|
-
--json
|
|
369
|
-
```
|
|
370
|
-
|
|
371
|
-
**Success**:
|
|
372
|
-
|
|
373
|
-
```json
|
|
374
|
-
{
|
|
375
|
-
"status": "succeeded",
|
|
376
|
-
"exitCode": 0,
|
|
377
|
-
"generationId": "a1b2c3d4-...",
|
|
378
|
-
"revision": 3,
|
|
379
|
-
"stepIndex": 0,
|
|
380
|
-
"step": { "action": "click", "locator": {...}, "activity": {...} },
|
|
381
|
-
"source": "planner"
|
|
382
|
-
}
|
|
383
|
-
```
|
|
384
|
-
|
|
385
|
-
**Confirmation required** (if the action is in
|
|
386
|
-
`confirmationRequiredActions`):
|
|
387
|
-
|
|
388
|
-
```json
|
|
389
|
-
{
|
|
390
|
-
"status": "confirmationRequired",
|
|
391
|
-
"exitCode": 0,
|
|
392
|
-
"challenge": {
|
|
393
|
-
"challengeId": "xYz123...",
|
|
394
|
-
"stepIndex": 0,
|
|
395
|
-
"proposalHash": "...",
|
|
396
|
-
"snapshotHash": "...",
|
|
397
|
-
"actionSummary": "click submit_search on dev.taphound.demo.SearchActivity",
|
|
398
|
-
"expiresAt": "2026-07-24T...",
|
|
399
|
-
"status": "pending"
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
```
|
|
403
|
-
|
|
404
|
-
Human confirmation is required. Run in a TTY terminal:
|
|
405
|
-
|
|
406
|
-
```bash
|
|
407
|
-
taphound generation confirm \
|
|
408
|
-
--project /path/to/android-project \
|
|
409
|
-
--session <generationId> \
|
|
410
|
-
--challenge <challengeId> \
|
|
411
|
-
--json
|
|
412
|
-
```
|
|
413
|
-
|
|
414
|
-
> **Important**: The AI agent does NOT auto-approve. The user must manually
|
|
415
|
-
> approve in a TTY terminal.
|
|
416
|
-
|
|
417
|
-
**Failure** (locator not found, activity mismatch, etc.):
|
|
418
|
-
|
|
419
|
-
```json
|
|
420
|
-
{
|
|
421
|
-
"status": "error",
|
|
422
|
-
"exitCode": 1,
|
|
423
|
-
"failure": {
|
|
424
|
-
"code": "LOCATOR_NOT_FOUND",
|
|
425
|
-
"message": "No element matched resourceId=search_button"
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
On failure, the AI agent should read the error, re-observe (Step 2),
|
|
431
|
-
re-generate the step (Step 3) with a corrected locator, and retry. Up to
|
|
432
|
-
3 retries.
|
|
433
|
-
|
|
434
|
-
### 3.6 Step 5 — Repeat Until Goal is Complete
|
|
435
|
-
|
|
436
|
-
After each successful step, return to Step 2 (observe) for the new device
|
|
437
|
-
state, then Step 3 (AI generates next step) -> Step 4 (execute).
|
|
438
|
-
|
|
439
|
-
The AI agent checks whether the Goal is complete before each step (reads
|
|
440
|
-
`prompts/check-completion.md`). If complete, it breaks out of the loop.
|
|
441
|
-
|
|
442
|
-
**Loop limit**: default maximum 30 steps. If exceeded, stop and report
|
|
443
|
-
incomplete.
|
|
444
|
-
|
|
445
|
-
### 3.7 Step 6 — Finalize and Verify
|
|
446
|
-
|
|
447
|
-
After all steps are complete, run finalize:
|
|
448
|
-
|
|
449
|
-
```bash
|
|
450
|
-
taphound generation finalize \
|
|
451
|
-
--project /path/to/android-project \
|
|
452
|
-
--session <generationId> \
|
|
453
|
-
--context .taphound/context/project-context.json \
|
|
454
|
-
--output journeys/generated-search.json \
|
|
455
|
-
--device emulator-5554 \
|
|
456
|
-
--json
|
|
457
|
-
```
|
|
458
|
-
|
|
459
|
-
**Success**:
|
|
460
|
-
|
|
461
|
-
```json
|
|
462
|
-
{
|
|
463
|
-
"status": "verified",
|
|
464
|
-
"exitCode": 0,
|
|
465
|
-
"generationId": "a1b2c3d4-...",
|
|
466
|
-
"bundlePath": "/path/to/project/.taphound/generations/a1b2c3d4-...",
|
|
467
|
-
"journeyPath": "/path/to/project/journeys/generated-search.json",
|
|
468
|
-
"metaPath": "/path/to/project/journeys/generated-search.meta.json",
|
|
469
|
-
"replayed": true
|
|
470
|
-
}
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
Finalize performs:
|
|
474
|
-
1. `forceStop` the app
|
|
475
|
-
2. Launch and replay all candidate steps in one pass
|
|
476
|
-
3. Verify no fallback, no crash, all assertions pass
|
|
477
|
-
4. Atomically publish the authoritative bundle to
|
|
478
|
-
`.taphound/generations/<id>/`
|
|
479
|
-
5. Export Journey v1 and sidecar meta to the `--output` path
|
|
480
|
-
|
|
481
|
-
**Failure**: troubleshoot by `failure.code`. Common:
|
|
482
|
-
|
|
483
|
-
| Code | Meaning |
|
|
484
|
-
|------|---------|
|
|
485
|
-
| `EXPECT_*_FAILED` | Assertion failed during replay |
|
|
486
|
-
| `APP_CRASHED` | App crashed during replay |
|
|
487
|
-
| `ACTIVITY_*_MISMATCH` | Activity mismatch |
|
|
488
|
-
| `EXPORT_FAILED` | Export failed (can retry finalize without replay) |
|
|
489
|
-
|
|
490
|
-
### 3.8 Verify Artifacts
|
|
491
|
-
|
|
492
|
-
```bash
|
|
493
|
-
# Exported Journey (standard Journey v1, can be replayed with verify)
|
|
494
|
-
cat /path/to/project/journeys/generated-search.json
|
|
495
|
-
|
|
496
|
-
# Sidecar meta (verification status, binding hashes, manual override records)
|
|
497
|
-
cat /path/to/project/journeys/generated-search.meta.json
|
|
498
|
-
|
|
499
|
-
# Authoritative bundle (full evidence: per-step proposal/snapshot/logcat/result)
|
|
500
|
-
ls /path/to/project/.taphound/generations/<id>/
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
Authoritative bundle directory structure:
|
|
504
|
-
|
|
505
|
-
```
|
|
506
|
-
.taphound/generations/<id>/
|
|
507
|
-
├── manifest.json # Content file list + hashes
|
|
508
|
-
├── meta.json # Generation meta (status: verified)
|
|
509
|
-
├── candidate/journey.json # Candidate Journey
|
|
510
|
-
├── verified/journey.json # Verified Journey
|
|
511
|
-
├── generation-report.json # Generation report (per-step provenance)
|
|
512
|
-
├── verification/
|
|
513
|
-
│ ├── report.json # Verify report
|
|
514
|
-
│ └── receipt.json # Verification receipt
|
|
515
|
-
└── evidence/
|
|
516
|
-
├── observations/<rev>/<attempt>/
|
|
517
|
-
│ ├── snapshot.json
|
|
518
|
-
│ └── screen.png
|
|
519
|
-
├── confirmations/<challengeId>/
|
|
520
|
-
│ └── envelope.json
|
|
521
|
-
└── steps/<index>-<attemptId>/
|
|
522
|
-
├── proposal.json
|
|
523
|
-
├── snapshot.json
|
|
524
|
-
├── logcat.txt
|
|
525
|
-
└── result.json
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
### 3.9 Re-verify with Standard verify (Optional)
|
|
529
|
-
|
|
530
|
-
The generated Journey is a standard Journey v1 and can be independently
|
|
531
|
-
replayed with the regular verify command:
|
|
532
|
-
|
|
533
|
-
```bash
|
|
534
|
-
taphound verify \
|
|
535
|
-
--project /path/to/android-project \
|
|
536
|
-
--journey journeys/generated-search.json \
|
|
537
|
-
--device emulator-5554 \
|
|
538
|
-
--json
|
|
539
|
-
```
|
|
540
|
-
|
|
541
|
-
This proves the AI-generated Journey behaves identically to a manually
|
|
542
|
-
recorded Journey.
|
|
543
|
-
|
|
544
|
-
---
|
|
545
|
-
|
|
546
|
-
## 4. Complete Example: Testing the Demo Search Feature
|
|
547
|
-
|
|
548
|
-
Using `examples/taphound-android-demo` as the project, with the Goal
|
|
549
|
-
"test the search feature".
|
|
550
|
-
|
|
551
|
-
### 4.1 Generate Context (One-Time)
|
|
552
|
-
|
|
553
|
-
```bash
|
|
554
|
-
# In the AI agent:
|
|
555
|
-
# "Generate a TapHound Project Context for examples/taphound-android-demo"
|
|
556
|
-
# AI analyzes source and generates:
|
|
557
|
-
# examples/taphound-android-demo/.taphound/context/project-context.json
|
|
558
|
-
|
|
559
|
-
# Validate
|
|
560
|
-
taphound context validate \
|
|
561
|
-
--project examples/taphound-android-demo \
|
|
562
|
-
--context .taphound/context/project-context.json \
|
|
563
|
-
--json
|
|
564
|
-
```
|
|
565
|
-
|
|
566
|
-
### 4.2 Start Session
|
|
567
|
-
|
|
568
|
-
```bash
|
|
569
|
-
taphound generation start \
|
|
570
|
-
--project examples/taphound-android-demo \
|
|
571
|
-
--config taphound.config.json \
|
|
572
|
-
--context .taphound/context/project-context.json \
|
|
573
|
-
--device emulator-5554 \
|
|
574
|
-
--json
|
|
575
|
-
# Note the generationId
|
|
576
|
-
```
|
|
577
|
-
|
|
578
|
-
### 4.3 Step-by-Step Generation (4 Steps)
|
|
579
|
-
|
|
580
|
-
| Step | AI decision after observe | Action | Locator | Expect |
|
|
581
|
-
|------|---------------------------|--------|---------|--------|
|
|
582
|
-
| 1 | Home screen has open_search button | click | resourceId:open_search | element search_input appears |
|
|
583
|
-
| 2 | Search screen has search_input field | click | resourceId:search_input | — |
|
|
584
|
-
| 3 | Input field is focused | inputText "hello world" | — | — |
|
|
585
|
-
| 4 | Search screen has submit_search button | click | resourceId:submit_search | logcat SearchViewModel "submitted query=hello world" |
|
|
586
|
-
|
|
587
|
-
Each step: observe -> AI generates -> build envelope ->
|
|
588
|
-
`generation step --input` -> confirm succeeded.
|
|
589
|
-
|
|
590
|
-
### 4.4 Finalize
|
|
591
|
-
|
|
592
|
-
```bash
|
|
593
|
-
taphound generation finalize \
|
|
594
|
-
--project examples/taphound-android-demo \
|
|
595
|
-
--session <generationId> \
|
|
596
|
-
--context .taphound/context/project-context.json \
|
|
597
|
-
--output journeys/generated-search.json \
|
|
598
|
-
--device emulator-5554 \
|
|
599
|
-
--json
|
|
600
|
-
```
|
|
601
|
-
|
|
602
|
-
Expect `status: "verified"`.
|
|
603
|
-
|
|
604
|
-
### 4.5 Shortcut
|
|
605
|
-
|
|
606
|
-
You can also use the automated acceptance script to run steps 4.2-4.4 in
|
|
607
|
-
one command (without AI, using hardcoded steps):
|
|
608
|
-
|
|
609
|
-
```bash
|
|
610
|
-
TAPHOUND_ACCEPTANCE_DEVICE=1 npm run acceptance:generation
|
|
611
|
-
```
|
|
612
|
-
|
|
613
|
-
> This script does not use AI. It validates that the Core protocol itself
|
|
614
|
-
> works on-device. For real AI-driven flows, follow steps 4.1-4.4
|
|
615
|
-
> manually.
|
|
616
|
-
|
|
617
|
-
---
|
|
618
|
-
|
|
619
|
-
## 5. Updating Project Context
|
|
620
|
-
|
|
621
|
-
Android projects evolve continuously: buttons are added, layouts are
|
|
622
|
-
restructured, Activities come and go. The Context needs to track these
|
|
623
|
-
changes to remain useful for staleness detection and interaction policy.
|
|
624
|
-
|
|
625
|
-
There are three levels of update, from lightest to heaviest:
|
|
626
|
-
|
|
627
|
-
### 5.1 Pre-Session Check (Before Every Test Run)
|
|
628
|
-
|
|
629
|
-
Run this before each generation session to decide which update level is
|
|
630
|
-
needed.
|
|
631
|
-
|
|
632
|
-
**Step 1: Hash staleness check**
|
|
633
|
-
|
|
634
|
-
```bash
|
|
635
|
-
taphound context status \
|
|
636
|
-
--project /path/to/android-project \
|
|
637
|
-
--context /path/to/android-project/.taphound/context/project-context.json \
|
|
638
|
-
--json
|
|
639
|
-
```
|
|
640
|
-
|
|
641
|
-
- `"valid"`: All tracked file hashes match. Proceed to Step 2.
|
|
642
|
-
- `"stale"`: Some tracked files changed. Needs at least an incremental
|
|
643
|
-
update (Section 5.2).
|
|
644
|
-
- `"invalid"`: Context structure is broken. Needs full regeneration
|
|
645
|
-
(Section 5.3).
|
|
646
|
-
|
|
647
|
-
**Step 2: Structural completeness check**
|
|
648
|
-
|
|
649
|
-
`context status` only checks files already listed in the Context. It
|
|
650
|
-
cannot detect NEW files added to the project. Run a quick structural
|
|
651
|
-
comparison:
|
|
652
|
-
|
|
653
|
-
```bash
|
|
654
|
-
# Count Activities in all manifests
|
|
655
|
-
ACTIVITY_COUNT=$(find . -name "AndroidManifest.xml" -not -path "*/build/*" \
|
|
656
|
-
-exec grep -c '<activity' {} + 2>/dev/null | \
|
|
657
|
-
awk -F: '{s+=$NF} END {print s}')
|
|
658
|
-
|
|
659
|
-
# Count Activity source files on disk
|
|
660
|
-
SRC_ACTIVITY_COUNT=$(find . \( -name "*.kt" -o -name "*.java" \) \
|
|
661
|
-
-not -path "*/build/*" \
|
|
662
|
-
-exec grep -l "extends.*Activity\|:.*Activity(" {} + 2>/dev/null | wc -l)
|
|
663
|
-
|
|
664
|
-
# Count layout files on disk
|
|
665
|
-
LAYOUT_COUNT=$(find . -path "*/res/layout/*.xml" -not -path "*/build/*" | wc -l)
|
|
666
|
-
|
|
667
|
-
echo "Activities in manifests: $ACTIVITY_COUNT"
|
|
668
|
-
echo "Activity source files: $SRC_ACTIVITY_COUNT"
|
|
669
|
-
echo "Layout files: $LAYOUT_COUNT"
|
|
670
|
-
```
|
|
671
|
-
|
|
672
|
-
Compare these counts with the number of Activity source files and layout
|
|
673
|
-
files actually listed in the Context's `manifest.files`. If the on-disk
|
|
674
|
-
counts are significantly higher than what's in the Context, new files
|
|
675
|
-
were added and a full regeneration (Section 5.3) is needed.
|
|
676
|
-
|
|
677
|
-
> **Tip**: The AI agent can automate this comparison. Tell it:
|
|
678
|
-
> "Check if the Project Context for /path/to/android-project is still
|
|
679
|
-
> complete. Compare the Activity and layout counts on disk with what's
|
|
680
|
-
> in the Context."
|
|
681
|
-
|
|
682
|
-
**Decision matrix:**
|
|
683
|
-
|
|
684
|
-
| `context status` | Structural counts match? | Action |
|
|
685
|
-
|------------------|--------------------------|--------|
|
|
686
|
-
| `valid` | Yes | Proceed to test (Section 3) |
|
|
687
|
-
| `valid` | No (new files on disk) | Full regeneration (5.3) |
|
|
688
|
-
| `stale` | Yes (same files, content changed) | Incremental update (5.2) |
|
|
689
|
-
| `stale` | No (files added/removed) | Full regeneration (5.3) |
|
|
690
|
-
| `invalid` | — | Full regeneration (5.3) |
|
|
691
|
-
|
|
692
|
-
### 5.2 Incremental Update (Content-Only Changes)
|
|
693
|
-
|
|
694
|
-
When `context status` returns `"stale"` but the structural counts match
|
|
695
|
-
(same files, just content modified — e.g., a button's text changed, a
|
|
696
|
-
layout was restructured, an Activity's click handler was updated):
|
|
697
|
-
|
|
698
|
-
1. Identify which files changed (the `context status` output lists them).
|
|
699
|
-
2. Recompute SHA-256 for each changed file.
|
|
700
|
-
3. If any changed file is an Activity source, re-read it to check for:
|
|
701
|
-
- New Logcat tags (affects `expect` candidates)
|
|
702
|
-
- New click handlers or input fields (affects `interactionPolicy`)
|
|
703
|
-
- New `startActivity` calls (affects navigation understanding)
|
|
704
|
-
4. If any changed file is a layout XML, re-read it to check for:
|
|
705
|
-
- New `android:id` elements (new locator candidates)
|
|
706
|
-
- Removed elements (locators that no longer exist)
|
|
707
|
-
- Changed `android:text` or `android:contentDescription`
|
|
708
|
-
5. Update the `manifest.files` hashes and `interactionPolicy` if needed.
|
|
709
|
-
6. Validate:
|
|
710
|
-
```bash
|
|
711
|
-
taphound context validate \
|
|
712
|
-
--project /path/to/android-project \
|
|
713
|
-
--context /path/to/android-project/.taphound/context/project-context.json \
|
|
714
|
-
--json
|
|
715
|
-
```
|
|
716
|
-
|
|
717
|
-
This is fast because it only touches changed files, not the entire
|
|
718
|
-
project.
|
|
719
|
-
|
|
720
|
-
### 5.3 Full Regeneration (Structural Changes)
|
|
721
|
-
|
|
722
|
-
When new files are added (new Activities, new layouts, new modules) or
|
|
723
|
-
the Context is `invalid`, re-run the full Section 2 flow:
|
|
724
|
-
|
|
725
|
-
1. Have the AI agent re-analyze the source (reads `prompts/analyze-project.md`)
|
|
726
|
-
2. Re-discover all modules via `./gradlew projects` or filesystem fallback
|
|
727
|
-
3. Re-enumerate all Activities and layouts across all modules
|
|
728
|
-
4. Recompute all SHA-256 hashes
|
|
729
|
-
5. Update `interactionPolicy` based on the full source analysis
|
|
730
|
-
6. Overwrite `project-context.json`
|
|
731
|
-
7. Validate with `context validate`
|
|
732
|
-
|
|
733
|
-
```bash
|
|
734
|
-
# In the AI agent:
|
|
735
|
-
# "Regenerate the TapHound Project Context for /path/to/android-project.
|
|
736
|
-
# The source has been updated with new screens and layouts.
|
|
737
|
-
# Run a full re-analysis per prompts/analyze-project.md."
|
|
738
|
-
|
|
739
|
-
taphound context validate \
|
|
740
|
-
--project /path/to/android-project \
|
|
741
|
-
--context /path/to/android-project/.taphound/context/project-context.json \
|
|
742
|
-
--json
|
|
743
|
-
```
|
|
744
|
-
|
|
745
|
-
### 5.4 Signs of Stale Context During Generation
|
|
746
|
-
|
|
747
|
-
Sometimes the pre-session check passes but the Context is still outdated
|
|
748
|
-
(e.g., a layout's content changed without changing the file count). The
|
|
749
|
-
AI agent may encounter these signs during generation:
|
|
750
|
-
|
|
751
|
-
| Sign | Likely cause | Action |
|
|
752
|
-
|------|-------------|--------|
|
|
753
|
-
| `observe` shows elements not expected from Context | Layout changed (new elements) | Continue if the element is actionable; update Context after session |
|
|
754
|
-
| `observe` shows a different Activity than expected | New Activity added or navigation changed | Re-observe and adapt; update Context after session |
|
|
755
|
-
| `LOCATOR_NOT_FOUND` for an element that should exist | Element was removed or `android:id` changed | Re-observe, try alternative locator; update Context after session |
|
|
756
|
-
| `LOCATOR_AMBIGUOUS` for a previously unique element | Duplicate ID added in another layout | Use more specific locator; update Context after session |
|
|
757
|
-
| Logcat expectation fails | Log tag or message pattern changed | Check source, update expectation; update Context after session |
|
|
758
|
-
|
|
759
|
-
> When any of these signs appear, the AI agent should note the discrepancy
|
|
760
|
-
> and recommend a Context update after the session completes. It should
|
|
761
|
-
> NOT abort the session unless the error is unrecoverable.
|
|
762
|
-
|
|
763
|
-
### 5.5 When to Update
|
|
764
|
-
|
|
765
|
-
| Change type | Update level |
|
|
766
|
-
|-------------|-------------|
|
|
767
|
-
| Modified button text or content description | Incremental (re-hash) |
|
|
768
|
-
| Modified click handler logic | Incremental (re-hash, check Logcat tags) |
|
|
769
|
-
| Added/removed `android:id` in existing layout | Incremental (re-hash) |
|
|
770
|
-
| Added new Activity | Full regeneration |
|
|
771
|
-
| Removed Activity | Full regeneration |
|
|
772
|
-
| Added/removed layout XML file | Full regeneration |
|
|
773
|
-
| New module added (`settings.gradle` changed) | Full regeneration |
|
|
774
|
-
| Changed `applicationId` | Full regeneration |
|
|
775
|
-
| Modified `<include>`/`<merge>` structure | Incremental (re-hash) |
|
|
776
|
-
| Modified business logic but UI unchanged | Incremental (re-hash only) |
|
|
777
|
-
| Modified themes/styles | No update needed |
|
|
778
|
-
| Modified Gradle dependency versions | No update needed (unless package name changed) |
|
|
779
|
-
|
|
780
|
-
---
|
|
781
|
-
|
|
782
|
-
## 6. Multi-Scenario Testing
|
|
783
|
-
|
|
784
|
-
The same Project Context can drive multiple different Goals without
|
|
785
|
-
regenerating the Context.
|
|
786
|
-
|
|
787
|
-
```bash
|
|
788
|
-
# Scenario 1: Search feature
|
|
789
|
-
# -> generation start -> observe -> step x4 -> finalize
|
|
790
|
-
# -> journeys/generated-search.json
|
|
791
|
-
|
|
792
|
-
# Scenario 2: Navigation back test
|
|
793
|
-
# -> generation start (new session) -> observe -> step xN -> finalize
|
|
794
|
-
# -> journeys/generated-back-test.json
|
|
795
|
-
|
|
796
|
-
# Scenario 3: Input boundary test
|
|
797
|
-
# -> generation start (new session) -> observe -> step xN -> finalize
|
|
798
|
-
# -> journeys/generated-input-edge.json
|
|
799
|
-
```
|
|
800
|
-
|
|
801
|
-
Each Goal is an independent generation session and does not affect others.
|
|
802
|
-
|
|
803
|
-
---
|
|
804
|
-
|
|
805
|
-
## 7. Failure Troubleshooting
|
|
806
|
-
|
|
807
|
-
### 7.1 generation step Failures
|
|
808
|
-
|
|
809
|
-
| failure.code | Meaning | AI agent response |
|
|
810
|
-
|--------------|---------|-------------------|
|
|
811
|
-
| `LOCATOR_NOT_FOUND` | Locator not found in current layout | Re-observe, try a different locator |
|
|
812
|
-
| `LOCATOR_AMBIGUOUS` | Locator matches multiple elements | Use a more specific locator |
|
|
813
|
-
| `ACTION_UNSUPPORTED` | Element does not support the action | Check element clickable/scrollable properties |
|
|
814
|
-
| `SNAPSHOT_STALE` | Device state has changed | Re-observe |
|
|
815
|
-
| `PACKAGE_ESCAPE` | Foreground switched to another app | Ensure app is in foreground, re-observe |
|
|
816
|
-
| `APP_CRASHED` | App process crashed | Check Logcat, restart app |
|
|
817
|
-
| `RISK_CONFIRMATION_REQUIRED` | Action requires user confirmation | Wait for user confirmation |
|
|
818
|
-
| `ACTION_FORBIDDEN` | Action is forbidden by policy | Use a different action or adjust policy |
|
|
819
|
-
| `RECOVERY_REQUIRED` | Session entered recovery state | Stop, report session ID |
|
|
820
|
-
|
|
821
|
-
### 7.2 generation finalize Failures
|
|
822
|
-
|
|
823
|
-
| failure.code | Meaning | Action |
|
|
824
|
-
|--------------|---------|--------|
|
|
825
|
-
| `EXPECT_*_FAILED` | Assertion failed during replay | Check verification/report.json |
|
|
826
|
-
| `APP_CRASHED` | App crashed during replay | Check app stability |
|
|
827
|
-
| `ACTIVITY_*_MISMATCH` | Activity mismatch | Check step's activity.before |
|
|
828
|
-
| `EXPORT_FAILED` | Export failed | Can retry finalize directly (no re-replay) |
|
|
829
|
-
|
|
830
|
-
### 7.3 View Session State
|
|
831
|
-
|
|
832
|
-
```bash
|
|
833
|
-
# Active session directories (dot prefix means in-progress)
|
|
834
|
-
ls /path/to/project/.taphound/generations/
|
|
835
|
-
|
|
836
|
-
# Published authoritative bundle (no dot prefix)
|
|
837
|
-
ls /path/to/project/.taphound/generations/<id>/
|
|
838
|
-
```
|
|
839
|
-
|
|
840
|
-
### 7.4 Clean Up and Rerun
|
|
841
|
-
|
|
842
|
-
```bash
|
|
843
|
-
# Remove previous session artifacts
|
|
844
|
-
rm -rf /path/to/project/.taphound/generations/
|
|
845
|
-
rm -f /path/to/project/journeys/generated-*.json
|
|
846
|
-
rm -f /path/to/project/journeys/generated-*.meta.json
|
|
847
|
-
```
|
|
848
|
-
|
|
849
|
-
---
|
|
850
|
-
|
|
851
|
-
## 8. Safety Constraints
|
|
852
|
-
|
|
853
|
-
- The AI agent does NOT auto-approve `confirmationRequired` steps; human
|
|
854
|
-
approval is mandatory.
|
|
855
|
-
- The AI agent does NOT bypass Core safety boundaries (package guard, risk
|
|
856
|
-
policy, locator uniqueness).
|
|
857
|
-
- SHA-256 hashes are ALWAYS computed via shell; the AI never guesses hash
|
|
858
|
-
values.
|
|
859
|
-
- The generated Journey is a standard Journey v1 and can be independently
|
|
860
|
-
replayed with the regular `verify` command.
|
|
861
|
-
- Real-device acceptance is fully separate from the normal test suite and
|
|
862
|
-
does NOT run in `npm test`.
|