taphound 0.2.0-dev.1
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/LICENSE +202 -0
- package/README.md +200 -0
- package/README.zh-CN.md +200 -0
- package/assets/brand/taphound-mark.svg +9 -0
- package/assets/skills/taphound-ai-journey/GUIDE.md +862 -0
- package/assets/skills/taphound-ai-journey/SKILL.md +377 -0
- package/assets/skills/taphound-ai-journey/prompts/analyze-project.md +526 -0
- package/assets/skills/taphound-ai-journey/prompts/check-completion.md +52 -0
- package/assets/skills/taphound-ai-journey/prompts/generate-step.md +109 -0
- package/assets/skills/taphound-ai-journey/schemas/observe-output.json +42 -0
- package/assets/skills/taphound-ai-journey/schemas/project-context.json +81 -0
- package/assets/skills/taphound-ai-journey/schemas/proposed-step-envelope.json +267 -0
- package/assets/skills/taphound-ai-journey/templates/project-context.example.json +49 -0
- package/dist/adapters/adb/adb-adapter.d.ts +23 -0
- package/dist/adapters/adb/adb-adapter.js +218 -0
- package/dist/adapters/android-cli/android-cli-adapter.d.ts +11 -0
- package/dist/adapters/android-cli/android-cli-adapter.js +64 -0
- package/dist/adapters/android-cli/layout-parser.d.ts +3 -0
- package/dist/adapters/android-cli/layout-parser.js +174 -0
- package/dist/adapters/clock/system-clock.d.ts +5 -0
- package/dist/adapters/clock/system-clock.js +13 -0
- package/dist/adapters/filesystem/artifact-store.d.ts +4 -0
- package/dist/adapters/filesystem/artifact-store.js +73 -0
- package/dist/adapters/filesystem/generation-meta-writer.d.ts +16 -0
- package/dist/adapters/filesystem/generation-meta-writer.js +34 -0
- package/dist/adapters/filesystem/generation-session-store.d.ts +68 -0
- package/dist/adapters/filesystem/generation-session-store.js +1603 -0
- package/dist/adapters/filesystem/journey-writer.d.ts +16 -0
- package/dist/adapters/filesystem/journey-writer.js +34 -0
- package/dist/adapters/filesystem/project-bound-file.d.ts +6 -0
- package/dist/adapters/filesystem/project-bound-file.js +240 -0
- package/dist/adapters/filesystem/project-file-inspector.d.ts +8 -0
- package/dist/adapters/filesystem/project-file-inspector.js +198 -0
- package/dist/adapters/filesystem/skill-installer.d.ts +10 -0
- package/dist/adapters/filesystem/skill-installer.js +39 -0
- package/dist/adapters/process/node-process-runner.d.ts +8 -0
- package/dist/adapters/process/node-process-runner.js +155 -0
- package/dist/adapters/prompt/inquirer-generation-prompt.d.ts +55 -0
- package/dist/adapters/prompt/inquirer-generation-prompt.js +213 -0
- package/dist/adapters/prompt/inquirer-init-prompt.d.ts +32 -0
- package/dist/adapters/prompt/inquirer-init-prompt.js +55 -0
- package/dist/adapters/prompt/inquirer-recorder-prompt.d.ts +47 -0
- package/dist/adapters/prompt/inquirer-recorder-prompt.js +157 -0
- package/dist/application/assertion/expectation-evaluator.d.ts +61 -0
- package/dist/application/assertion/expectation-evaluator.js +207 -0
- package/dist/application/collector/logcat-collector.d.ts +39 -0
- package/dist/application/collector/logcat-collector.js +107 -0
- package/dist/application/context/context-validator.d.ts +27 -0
- package/dist/application/context/context-validator.js +120 -0
- package/dist/application/doctor/doctor-service.d.ts +35 -0
- package/dist/application/doctor/doctor-service.js +178 -0
- package/dist/application/generation/focused-input.d.ts +2 -0
- package/dist/application/generation/focused-input.js +9 -0
- package/dist/application/generation/generation-confirmation-service.d.ts +76 -0
- package/dist/application/generation/generation-confirmation-service.js +383 -0
- package/dist/application/generation/generation-finalizer.d.ts +67 -0
- package/dist/application/generation/generation-finalizer.js +646 -0
- package/dist/application/generation/generation-publisher.d.ts +46 -0
- package/dist/application/generation/generation-publisher.js +178 -0
- package/dist/application/generation/generation-starter.d.ts +31 -0
- package/dist/application/generation/generation-starter.js +102 -0
- package/dist/application/generation/generation-step-executor.d.ts +52 -0
- package/dist/application/generation/generation-step-executor.js +668 -0
- package/dist/application/generation/proposed-step-validator.d.ts +11 -0
- package/dist/application/generation/proposed-step-validator.js +88 -0
- package/dist/application/generation/risk-evaluator.d.ts +9 -0
- package/dist/application/generation/risk-evaluator.js +14 -0
- package/dist/application/generation/runtime-observer.d.ts +39 -0
- package/dist/application/generation/runtime-observer.js +157 -0
- package/dist/application/init/init-service.d.ts +17 -0
- package/dist/application/init/init-service.js +44 -0
- package/dist/application/interaction/action-executor.d.ts +25 -0
- package/dist/application/interaction/action-executor.js +103 -0
- package/dist/application/interaction/fallback-resolver.d.ts +24 -0
- package/dist/application/interaction/fallback-resolver.js +48 -0
- package/dist/application/interaction/scroll-to-executor.d.ts +40 -0
- package/dist/application/interaction/scroll-to-executor.js +191 -0
- package/dist/application/locator/locator-resolver.d.ts +20 -0
- package/dist/application/locator/locator-resolver.js +89 -0
- package/dist/application/project/project-describer.d.ts +14 -0
- package/dist/application/project/project-describer.js +8 -0
- package/dist/application/recorder/locator-selector.d.ts +10 -0
- package/dist/application/recorder/locator-selector.js +80 -0
- package/dist/application/recorder/recorder-service.d.ts +41 -0
- package/dist/application/recorder/recorder-service.js +331 -0
- package/dist/application/report/report-writer.d.ts +10 -0
- package/dist/application/report/report-writer.js +39 -0
- package/dist/application/runtime/activity-waiter.d.ts +33 -0
- package/dist/application/runtime/activity-waiter.js +73 -0
- package/dist/application/runtime/launch-failure.d.ts +2 -0
- package/dist/application/runtime/launch-failure.js +20 -0
- package/dist/application/runtime/process-waiter.d.ts +27 -0
- package/dist/application/runtime/process-waiter.js +73 -0
- package/dist/application/runtime/step-runner.d.ts +50 -0
- package/dist/application/runtime/step-runner.js +429 -0
- package/dist/application/runtime/verify-runtime.d.ts +44 -0
- package/dist/application/runtime/verify-runtime.js +350 -0
- package/dist/application/wait/idle-waiter.d.ts +30 -0
- package/dist/application/wait/idle-waiter.js +90 -0
- package/dist/cli/commands/context.d.ts +3 -0
- package/dist/cli/commands/context.js +94 -0
- package/dist/cli/commands/doctor.d.ts +3 -0
- package/dist/cli/commands/doctor.js +51 -0
- package/dist/cli/commands/generation.d.ts +3 -0
- package/dist/cli/commands/generation.js +518 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/init.js +104 -0
- package/dist/cli/commands/project.d.ts +3 -0
- package/dist/cli/commands/project.js +58 -0
- package/dist/cli/commands/record.d.ts +3 -0
- package/dist/cli/commands/record.js +88 -0
- package/dist/cli/commands/verify.d.ts +3 -0
- package/dist/cli/commands/verify.js +106 -0
- package/dist/cli/dependencies.d.ts +66 -0
- package/dist/cli/dependencies.js +204 -0
- package/dist/cli/main.d.ts +8 -0
- package/dist/cli/main.js +73 -0
- package/dist/cli/output.d.ts +16 -0
- package/dist/cli/output.js +22 -0
- package/dist/cli/program.d.ts +3 -0
- package/dist/cli/program.js +43 -0
- package/dist/domain/activity.d.ts +7 -0
- package/dist/domain/activity.js +65 -0
- package/dist/domain/app-process.d.ts +7 -0
- package/dist/domain/app-process.js +10 -0
- package/dist/domain/config.d.ts +15 -0
- package/dist/domain/config.js +17 -0
- package/dist/domain/failure.d.ts +4 -0
- package/dist/domain/failure.js +43 -0
- package/dist/domain/generation.d.ts +912 -0
- package/dist/domain/generation.js +342 -0
- package/dist/domain/init.d.ts +42 -0
- package/dist/domain/init.js +114 -0
- package/dist/domain/journey.d.ts +673 -0
- package/dist/domain/journey.js +109 -0
- package/dist/domain/layout.d.ts +35 -0
- package/dist/domain/layout.js +33 -0
- package/dist/domain/locator.d.ts +8 -0
- package/dist/domain/locator.js +5 -0
- package/dist/domain/project-context.d.ts +101 -0
- package/dist/domain/project-context.js +64 -0
- package/dist/domain/proposed-step.d.ts +341 -0
- package/dist/domain/proposed-step.js +87 -0
- package/dist/domain/report.d.ts +349 -0
- package/dist/domain/report.js +135 -0
- package/dist/domain/runtime-snapshot.d.ts +16 -0
- package/dist/domain/runtime-snapshot.js +46 -0
- package/dist/ports/adb.d.ts +42 -0
- package/dist/ports/adb.js +1 -0
- package/dist/ports/android-cli.d.ts +21 -0
- package/dist/ports/android-cli.js +1 -0
- package/dist/ports/artifact-store.d.ts +12 -0
- package/dist/ports/artifact-store.js +1 -0
- package/dist/ports/clock.d.ts +4 -0
- package/dist/ports/clock.js +1 -0
- package/dist/ports/generation-meta-writer.d.ts +10 -0
- package/dist/ports/generation-meta-writer.js +1 -0
- package/dist/ports/generation-prompt.d.ts +19 -0
- package/dist/ports/generation-prompt.js +6 -0
- package/dist/ports/generation-session-store.d.ts +32 -0
- package/dist/ports/generation-session-store.js +26 -0
- package/dist/ports/init-prompt.d.ts +8 -0
- package/dist/ports/init-prompt.js +6 -0
- package/dist/ports/journey-writer.d.ts +10 -0
- package/dist/ports/journey-writer.js +1 -0
- package/dist/ports/process-runner.d.ts +32 -0
- package/dist/ports/process-runner.js +1 -0
- package/dist/ports/project-bound-file.d.ts +8 -0
- package/dist/ports/project-bound-file.js +1 -0
- package/dist/ports/project-file-inspector.d.ts +33 -0
- package/dist/ports/project-file-inspector.js +1 -0
- package/dist/ports/recorder-prompt.d.ts +29 -0
- package/dist/ports/recorder-prompt.js +1 -0
- package/dist/ports/skill-installer.d.ts +8 -0
- package/dist/ports/skill-installer.js +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const PACKAGE_NAME = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/;
|
|
2
|
+
const QUALIFIED_ACTIVITY = /^(?:[A-Za-z_$][\w$]*\.)+[A-Za-z_$][\w$]*$/;
|
|
3
|
+
function assertPackageName(packageName) {
|
|
4
|
+
if (!PACKAGE_NAME.test(packageName)) {
|
|
5
|
+
throw new Error(`Invalid package name: ${packageName}`);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export function normalizeActivity(packageName, activityOrComponent) {
|
|
9
|
+
assertPackageName(packageName);
|
|
10
|
+
const value = activityOrComponent.trim();
|
|
11
|
+
if (value.includes("/")) {
|
|
12
|
+
const parts = value.split("/");
|
|
13
|
+
if (parts.length !== 2) {
|
|
14
|
+
throw new Error(`Invalid Activity component: ${value}`);
|
|
15
|
+
}
|
|
16
|
+
const [componentPackage, componentActivity] = parts;
|
|
17
|
+
if (componentPackage !== packageName || componentActivity === undefined) {
|
|
18
|
+
throw new Error(`Activity component package does not match ${packageName}`);
|
|
19
|
+
}
|
|
20
|
+
const normalized = componentActivity.startsWith(".")
|
|
21
|
+
? `${componentPackage}${componentActivity}`
|
|
22
|
+
: componentActivity;
|
|
23
|
+
if (!QUALIFIED_ACTIVITY.test(normalized)) {
|
|
24
|
+
throw new Error(`Invalid Activity: ${componentActivity}`);
|
|
25
|
+
}
|
|
26
|
+
return normalized;
|
|
27
|
+
}
|
|
28
|
+
if (value.startsWith(".")) {
|
|
29
|
+
const normalized = `${packageName}${value}`;
|
|
30
|
+
if (!QUALIFIED_ACTIVITY.test(normalized)) {
|
|
31
|
+
throw new Error(`Invalid Activity: ${value}`);
|
|
32
|
+
}
|
|
33
|
+
return normalized;
|
|
34
|
+
}
|
|
35
|
+
if (!QUALIFIED_ACTIVITY.test(value)) {
|
|
36
|
+
throw new Error(`Invalid Activity: ${value}`);
|
|
37
|
+
}
|
|
38
|
+
return value;
|
|
39
|
+
}
|
|
40
|
+
export function parseObservedActivityComponent(component) {
|
|
41
|
+
const value = component.trim();
|
|
42
|
+
const parts = value.split("/");
|
|
43
|
+
if (parts.length !== 2) {
|
|
44
|
+
throw new Error(`Invalid Activity component: ${value}`);
|
|
45
|
+
}
|
|
46
|
+
const [componentPackage, componentActivity] = parts;
|
|
47
|
+
if (componentPackage === undefined
|
|
48
|
+
|| componentActivity === undefined
|
|
49
|
+
|| !PACKAGE_NAME.test(componentPackage)) {
|
|
50
|
+
throw new Error(`Invalid Activity component: ${value}`);
|
|
51
|
+
}
|
|
52
|
+
const normalized = componentActivity.startsWith(".")
|
|
53
|
+
? `${componentPackage}${componentActivity}`
|
|
54
|
+
: componentActivity;
|
|
55
|
+
if (!QUALIFIED_ACTIVITY.test(normalized)) {
|
|
56
|
+
throw new Error(`Invalid Activity component: ${value}`);
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
packageName: componentPackage,
|
|
60
|
+
activity: normalized
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export function normalizeObservedActivityComponent(component) {
|
|
64
|
+
return parseObservedActivityComponent(component).activity;
|
|
65
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface AppProcess {
|
|
2
|
+
pid: number;
|
|
3
|
+
name: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function isAppProcessName(name: string, packageName: string): boolean;
|
|
6
|
+
export declare function primaryAppPid(processes: readonly AppProcess[], packageName: string): number | null;
|
|
7
|
+
export declare function appProcessPids(processes: readonly AppProcess[]): readonly number[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function isAppProcessName(name, packageName) {
|
|
2
|
+
return name === packageName || name.startsWith(`${packageName}:`);
|
|
3
|
+
}
|
|
4
|
+
export function primaryAppPid(processes, packageName) {
|
|
5
|
+
const exact = processes.find((process) => process.name === packageName);
|
|
6
|
+
return exact?.pid ?? processes[0]?.pid ?? null;
|
|
7
|
+
}
|
|
8
|
+
export function appProcessPids(processes) {
|
|
9
|
+
return processes.map((process) => process.pid);
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const TapHoundConfigSchema: z.ZodObject<{
|
|
3
|
+
version: z.ZodLiteral<1>;
|
|
4
|
+
run: z.ZodObject<{
|
|
5
|
+
packageName: z.ZodString;
|
|
6
|
+
activity: z.ZodString;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
idle: z.ZodObject<{
|
|
9
|
+
pollIntervalMs: z.ZodNumber;
|
|
10
|
+
stablePolls: z.ZodNumber;
|
|
11
|
+
timeoutMs: z.ZodNumber;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
artifactsDir: z.ZodString;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export type TapHoundConfig = z.infer<typeof TapHoundConfigSchema>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const PackageNameSchema = z.string().regex(/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)+$/, "packageName must be a qualified Java package");
|
|
3
|
+
const ActivityNameSchema = z.string().refine((value) => (/^\.[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(value)
|
|
4
|
+
|| /^(?:[A-Za-z_$][\w$]*\.)+[A-Za-z_$][\w$]*$/.test(value)), "activity must be relative with a leading dot or fully qualified");
|
|
5
|
+
export const TapHoundConfigSchema = z.strictObject({
|
|
6
|
+
version: z.literal(1),
|
|
7
|
+
run: z.strictObject({
|
|
8
|
+
packageName: PackageNameSchema,
|
|
9
|
+
activity: ActivityNameSchema
|
|
10
|
+
}),
|
|
11
|
+
idle: z.strictObject({
|
|
12
|
+
pollIntervalMs: z.number().int().positive(),
|
|
13
|
+
stablePolls: z.number().int().positive(),
|
|
14
|
+
timeoutMs: z.number().int().positive()
|
|
15
|
+
}),
|
|
16
|
+
artifactsDir: z.string().trim().min(1)
|
|
17
|
+
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const FAILURE_CODES: readonly ["CONFIG_INVALID", "ENVIRONMENT_MISSING_TOOL", "DEVICE_UNAVAILABLE", "APP_NOT_INSTALLED", "APP_LAUNCH_FAILED", "APP_CRASHED", "LOCATOR_NOT_FOUND", "LOCATOR_AMBIGUOUS", "SCROLL_TARGET_NOT_FOUND", "ACTION_FAILED", "IDLE_TIMEOUT", "ACTIVITY_BEFORE_MISMATCH", "ACTIVITY_AFTER_MISMATCH", "EXPECT_ACTIVITY_FAILED", "EXPECT_ELEMENT_FAILED", "EXPECT_LOGCAT_FAILED", "COLLECTION_FAILED", "INTERNAL_ERROR"];
|
|
2
|
+
export type FailureCode = (typeof FAILURE_CODES)[number];
|
|
3
|
+
export type TapHoundExitCode = 1 | 2 | 3 | 4;
|
|
4
|
+
export declare function exitCodeForFailure(failure: FailureCode): TapHoundExitCode;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const FAILURE_CODES = [
|
|
2
|
+
"CONFIG_INVALID",
|
|
3
|
+
"ENVIRONMENT_MISSING_TOOL",
|
|
4
|
+
"DEVICE_UNAVAILABLE",
|
|
5
|
+
"APP_NOT_INSTALLED",
|
|
6
|
+
"APP_LAUNCH_FAILED",
|
|
7
|
+
"APP_CRASHED",
|
|
8
|
+
"LOCATOR_NOT_FOUND",
|
|
9
|
+
"LOCATOR_AMBIGUOUS",
|
|
10
|
+
"SCROLL_TARGET_NOT_FOUND",
|
|
11
|
+
"ACTION_FAILED",
|
|
12
|
+
"IDLE_TIMEOUT",
|
|
13
|
+
"ACTIVITY_BEFORE_MISMATCH",
|
|
14
|
+
"ACTIVITY_AFTER_MISMATCH",
|
|
15
|
+
"EXPECT_ACTIVITY_FAILED",
|
|
16
|
+
"EXPECT_ELEMENT_FAILED",
|
|
17
|
+
"EXPECT_LOGCAT_FAILED",
|
|
18
|
+
"COLLECTION_FAILED",
|
|
19
|
+
"INTERNAL_ERROR"
|
|
20
|
+
];
|
|
21
|
+
const EXIT_CODES = {
|
|
22
|
+
CONFIG_INVALID: 2,
|
|
23
|
+
ENVIRONMENT_MISSING_TOOL: 3,
|
|
24
|
+
DEVICE_UNAVAILABLE: 3,
|
|
25
|
+
APP_NOT_INSTALLED: 3,
|
|
26
|
+
APP_LAUNCH_FAILED: 1,
|
|
27
|
+
APP_CRASHED: 1,
|
|
28
|
+
LOCATOR_NOT_FOUND: 1,
|
|
29
|
+
LOCATOR_AMBIGUOUS: 1,
|
|
30
|
+
SCROLL_TARGET_NOT_FOUND: 1,
|
|
31
|
+
ACTION_FAILED: 1,
|
|
32
|
+
IDLE_TIMEOUT: 1,
|
|
33
|
+
ACTIVITY_BEFORE_MISMATCH: 1,
|
|
34
|
+
ACTIVITY_AFTER_MISMATCH: 1,
|
|
35
|
+
EXPECT_ACTIVITY_FAILED: 1,
|
|
36
|
+
EXPECT_ELEMENT_FAILED: 1,
|
|
37
|
+
EXPECT_LOGCAT_FAILED: 1,
|
|
38
|
+
COLLECTION_FAILED: 1,
|
|
39
|
+
INTERNAL_ERROR: 4
|
|
40
|
+
};
|
|
41
|
+
export function exitCodeForFailure(failure) {
|
|
42
|
+
return EXIT_CODES[failure];
|
|
43
|
+
}
|