visor-ai 0.2.6 → 0.2.8
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/dist/adapters.js +18 -8
- package/dist/appMap.js +721 -0
- package/dist/cli.js +158 -13
- package/dist/daemon.js +87 -11
- package/dist/localRuntime.js +116 -0
- package/dist/main.js +9 -0
- package/dist/runner.js +25 -2
- package/package.json +4 -1
package/dist/runner.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { performance } from 'node:perf_hooks';
|
|
4
|
+
import { createAppMapContext, createMapSummary, persistAppMapContext, runMappedCommand } from './appMap.js';
|
|
4
5
|
import { makeError } from './errors.js';
|
|
5
6
|
import { makeId, signatureFor, utcNowIso } from './utils.js';
|
|
6
7
|
async function runStep(adapter, command, args) {
|
|
@@ -59,15 +60,32 @@ function signatureSafeDetails(details) {
|
|
|
59
60
|
if (args && typeof args === 'object' && !Array.isArray(args)) {
|
|
60
61
|
delete args.path;
|
|
61
62
|
}
|
|
63
|
+
const map = safe.map;
|
|
64
|
+
if (map && typeof map === 'object' && !Array.isArray(map)) {
|
|
65
|
+
const mapDetails = map;
|
|
66
|
+
const route = Array.isArray(mapDetails.route)
|
|
67
|
+
? mapDetails.route
|
|
68
|
+
.filter((step) => Boolean(step) && typeof step === 'object' && !Array.isArray(step))
|
|
69
|
+
.map((step) => ({
|
|
70
|
+
command: step.command,
|
|
71
|
+
target: step.target
|
|
72
|
+
}))
|
|
73
|
+
: [];
|
|
74
|
+
safe.map = {
|
|
75
|
+
route
|
|
76
|
+
};
|
|
77
|
+
}
|
|
62
78
|
return safe;
|
|
63
79
|
}
|
|
64
|
-
export async function runScenario(scenario, adapter, device = 'local', timeoutMs, artifactBaseDir, closeAdapter = true) {
|
|
80
|
+
export async function runScenario(scenario, adapter, device = 'local', timeoutMs, artifactBaseDir, closeAdapter = true, mapOptions) {
|
|
65
81
|
const started_at = utcNowIso();
|
|
66
82
|
const run_id = makeId('run');
|
|
67
83
|
const platform = adapter.capability().platform;
|
|
68
84
|
const stepResults = [];
|
|
69
85
|
const artifacts = [];
|
|
70
86
|
let topError;
|
|
87
|
+
const mapContext = createAppMapContext(adapter, mapOptions);
|
|
88
|
+
const disabledMapSummary = mapContext ? undefined : createMapSummary(adapter, mapOptions);
|
|
71
89
|
let screenshotDir;
|
|
72
90
|
let sourceDir;
|
|
73
91
|
if (artifactBaseDir) {
|
|
@@ -89,7 +107,9 @@ export async function runScenario(scenario, adapter, device = 'local', timeoutMs
|
|
|
89
107
|
const label = String(stepArgs.label ?? step.id);
|
|
90
108
|
stepArgs.path = path.join(sourceDir, `${label}.xml`);
|
|
91
109
|
}
|
|
92
|
-
const details =
|
|
110
|
+
const details = mapContext
|
|
111
|
+
? await runMappedCommand(mapContext, step.command, stepArgs)
|
|
112
|
+
: await runStep(adapter, step.command, stepArgs);
|
|
93
113
|
const durationMs = Math.round(performance.now() - started);
|
|
94
114
|
const result = {
|
|
95
115
|
id: step.id,
|
|
@@ -140,6 +160,7 @@ export async function runScenario(scenario, adapter, device = 'local', timeoutMs
|
|
|
140
160
|
}
|
|
141
161
|
const allPass = stepsOk && assertionEvaluation.ok;
|
|
142
162
|
const ended_at = utcNowIso();
|
|
163
|
+
const mapSummary = persistAppMapContext(mapContext) ?? disabledMapSummary;
|
|
143
164
|
const signatureInput = {
|
|
144
165
|
platform,
|
|
145
166
|
steps: stepResults.map((step) => ({
|
|
@@ -162,10 +183,12 @@ export async function runScenario(scenario, adapter, device = 'local', timeoutMs
|
|
|
162
183
|
artifacts,
|
|
163
184
|
determinism_signature: signatureFor(signatureInput),
|
|
164
185
|
seed: typeof scenario.config.seed === 'number' ? scenario.config.seed : undefined,
|
|
186
|
+
map: mapSummary,
|
|
165
187
|
error: topError
|
|
166
188
|
};
|
|
167
189
|
}
|
|
168
190
|
finally {
|
|
191
|
+
persistAppMapContext(mapContext);
|
|
169
192
|
if (closeAdapter) {
|
|
170
193
|
await adapter.close();
|
|
171
194
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "visor-ai",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "Visor CLI for LLM-driven mobile app interaction and artifact capture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,9 @@
|
|
|
30
30
|
"build": "rm -rf dist && tsc -p tsconfig.json",
|
|
31
31
|
"dev": "tsx src/main.ts",
|
|
32
32
|
"test": "vitest run",
|
|
33
|
+
"test:e2e:local": "node scripts/local-e2e.mjs",
|
|
33
34
|
"check": "npm run build && npm run test",
|
|
35
|
+
"verify": "npm run build && npm run test && npm run test:e2e:local",
|
|
34
36
|
"release": "node scripts/release.mjs",
|
|
35
37
|
"release:patch": "node scripts/release.mjs patch",
|
|
36
38
|
"release:minor": "node scripts/release.mjs minor",
|
|
@@ -51,6 +53,7 @@
|
|
|
51
53
|
},
|
|
52
54
|
"devDependencies": {
|
|
53
55
|
"@types/node": "^22.13.10",
|
|
56
|
+
"appium-uiautomator2-driver": "^4.2.9",
|
|
54
57
|
"appium-xcuitest-driver": "^9.10.5",
|
|
55
58
|
"tsx": "^4.19.3",
|
|
56
59
|
"typescript": "^5.8.2",
|