@aarwitz/tapp 0.21.2 → 0.23.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/.claude-plugin/plugin.json +2 -2
- package/bin/tapp.js +60 -4
- package/browser/app.css +44 -0
- package/browser/app.js +194 -9
- package/browser/index.html +21 -1
- package/docs/BROWSER-PRODUCT.md +31 -1
- package/mcp-server/src/account-store.js +131 -0
- package/mcp-server/src/actor-store.js +149 -0
- package/mcp-server/src/browser-product.js +234 -24
- package/mcp-server/src/index.js +26 -3
- package/mcp-server/src/mailer.js +70 -0
- package/mcp-server/src/product-operations.js +26 -11
- package/mcp-server/src/web-explorer.js +57 -3
- package/package.json +2 -2
|
@@ -775,7 +775,7 @@ export function normalizeWebSeedTargets(seedTargets = [], limit = 5) {
|
|
|
775
775
|
return result;
|
|
776
776
|
}
|
|
777
777
|
|
|
778
|
-
export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDir, testEmail = "", testPassword = "", seedRoutes = [], seedTargets = [], watch = false, onProgress, device = "", viewport = "" }) {
|
|
778
|
+
export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDir, testEmail = "", testPassword = "", seedRoutes = [], seedTargets = [], watch = false, onProgress, device = "", viewport = "", interactive = false, inputResponsePath = "", inputWaitSec = 120, storageStatePath = "", onSessionSaved = null }) {
|
|
779
779
|
const start = new URL(url);
|
|
780
780
|
if (!/^https?:$/.test(start.protocol)) throw new Error("url must be http(s)");
|
|
781
781
|
fs.mkdirSync(outDir, { recursive: true });
|
|
@@ -807,7 +807,17 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
|
|
|
807
807
|
// searching the whole recording. Record where the capture begins relative to the marker
|
|
808
808
|
// timebase; every STATE below carries the same `t`, so a frame is a seek.
|
|
809
809
|
const recordingStartedMs = Date.now() - startedAtMs;
|
|
810
|
-
|
|
810
|
+
// A stored session means the run starts inside the application instead of at its door. The
|
|
811
|
+
// file is a temp copy written by the actor store; remove it as soon as the context has it.
|
|
812
|
+
const storageState = storageStatePath && fs.existsSync(storageStatePath) ? storageStatePath : undefined;
|
|
813
|
+
const context = await browser.newContext({ ...captureProfile, ...(storageState ? { storageState } : {}), recordVideo: { dir: outDir, size: captureProfile.viewport } });
|
|
814
|
+
const startedSignedIn = !!storageState;
|
|
815
|
+
if (storageState) { try { fs.rmSync(storageState, { force: true }); } catch { /* best effort */ } }
|
|
816
|
+
// After a sign-in works, hand the session back so it can be kept for next time.
|
|
817
|
+
const keepSession = async (why) => {
|
|
818
|
+
if (!onSessionSaved) return;
|
|
819
|
+
try { await onSessionSaved(await context.storageState(), why); } catch { /* keeping the session is never allowed to fail the run */ }
|
|
820
|
+
};
|
|
811
821
|
emit("RECORDING", { file: "exploration.webm", startsAtMs: recordingStartedMs, fps: 25 });
|
|
812
822
|
await installWebListenerTracking(context);
|
|
813
823
|
if (watch) await installWebWatchUi(context);
|
|
@@ -869,6 +879,7 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
|
|
|
869
879
|
let probeCapHit = false;
|
|
870
880
|
let actions = 0;
|
|
871
881
|
let screenCount = 0;
|
|
882
|
+
if (startedSignedIn) narrate("Starting signed in from the saved session");
|
|
872
883
|
// Which distinct on-screen states each route has produced, so one route cannot mint states
|
|
873
884
|
// without limit when something on it never settles.
|
|
874
885
|
const signaturesByRoute = new Map();
|
|
@@ -1057,10 +1068,52 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
|
|
|
1057
1068
|
|
|
1058
1069
|
// Login preamble parity with iOS: if creds were given and a password field is present,
|
|
1059
1070
|
// fill + submit once, and flag auth_failed if we clearly bounced.
|
|
1071
|
+
// The same protocol the iOS harness and the desktop app speak: emit OCQA_AWAIT_INPUT with the
|
|
1072
|
+
// fields, poll the response path, honour only a response for this request, and say how it was
|
|
1073
|
+
// resolved. Secure fields never carry a default over stdout. A host that never answers turns
|
|
1074
|
+
// interactivity off for the rest of the run rather than freezing it.
|
|
1075
|
+
let interactiveEnabled = interactive && !!inputResponsePath;
|
|
1076
|
+
async function askForInput(screen, fields) {
|
|
1077
|
+
if (!interactiveEnabled) return null;
|
|
1078
|
+
const requestId = `in-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
1079
|
+
const request = { requestId, screen, fields: fields.map((f) => ({ key: f.key, label: f.label, secure: !!f.secure, placeholder: f.placeholder || "", default: f.secure ? "" : (f.default || "") })) };
|
|
1080
|
+
emit("AWAIT_INPUT", request);
|
|
1081
|
+
narrate(`Waiting for ${fields.map((f) => f.label).join(" and ")}`, { screen, awaitInput: request });
|
|
1082
|
+
const started = Date.now();
|
|
1083
|
+
let resolved = { action: "timeout", values: {} };
|
|
1084
|
+
try { fs.rmSync(inputResponsePath, { force: true }); } catch {}
|
|
1085
|
+
while (Date.now() - started < inputWaitSec * 1000) {
|
|
1086
|
+
await page.waitForTimeout(500);
|
|
1087
|
+
let reply;
|
|
1088
|
+
try { reply = JSON.parse(fs.readFileSync(inputResponsePath, "utf8")); } catch { continue; }
|
|
1089
|
+
if (reply?.requestId !== requestId) { try { fs.rmSync(inputResponsePath, { force: true }); } catch {} continue; }
|
|
1090
|
+
resolved = { action: String(reply.action || "defaults"), values: reply.action === "submit" && reply.values && typeof reply.values === "object" ? reply.values : {} };
|
|
1091
|
+
try { fs.rmSync(inputResponsePath, { force: true }); } catch {}
|
|
1092
|
+
break;
|
|
1093
|
+
}
|
|
1094
|
+
if (resolved.action === "timeout") interactiveEnabled = false;
|
|
1095
|
+
if (resolved.action === "dont_ask") interactiveEnabled = false;
|
|
1096
|
+
emit("INPUT_RESOLVED", { requestId, action: resolved.action });
|
|
1097
|
+
narrate(resolved.action === "submit" ? "Received the sign-in details" : `Sign-in request ${resolved.action === "timeout" ? "went unanswered" : resolved.action.replace("_", " ")}`, { screen, inputResolved: { requestId, action: resolved.action } });
|
|
1098
|
+
return resolved;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1060
1101
|
async function tryLogin(screen) {
|
|
1061
|
-
if (loginTried
|
|
1102
|
+
if (loginTried) return null;
|
|
1062
1103
|
const pw = page.locator("input[type=password]").first();
|
|
1063
1104
|
if (!(await pw.isVisible().catch(() => false))) return null;
|
|
1105
|
+
if (!testPassword) {
|
|
1106
|
+
// No credentials. Ask, if someone is there to answer; otherwise this is where the run ends
|
|
1107
|
+
// its view of the application, and the report says so.
|
|
1108
|
+
const answer = await askForInput(screen, [
|
|
1109
|
+
{ key: "email", label: "Email", placeholder: "you@example.com" },
|
|
1110
|
+
{ key: "password", label: "Password", secure: true },
|
|
1111
|
+
]);
|
|
1112
|
+
if (!answer || answer.action !== "submit") return null;
|
|
1113
|
+
testEmail = String(answer.values.email || testEmail || "");
|
|
1114
|
+
testPassword = String(answer.values.password || "");
|
|
1115
|
+
if (!testPassword) return null;
|
|
1116
|
+
}
|
|
1064
1117
|
loginTried = true;
|
|
1065
1118
|
const emailSel = "input[type=email], input[name*=mail i], input[name*=user i], input[id*=mail i], input[id*=user i]";
|
|
1066
1119
|
if (testEmail) {
|
|
@@ -1095,6 +1148,7 @@ export async function exploreWeb({ url, maxActions = 40, timeoutSec = 300, outDi
|
|
|
1095
1148
|
"login form"
|
|
1096
1149
|
);
|
|
1097
1150
|
} else {
|
|
1151
|
+
await keepSession("signed-in");
|
|
1098
1152
|
// SPAs commonly replace the login view without changing URL. Capture the
|
|
1099
1153
|
// authenticated state immediately so coverage does not remain stuck at 1.
|
|
1100
1154
|
return await observe();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aarwitz/tapp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"mcpName": "io.github.aarwitz/tapp",
|
|
5
5
|
"description": "Let coding agents verify UI changes on real iOS, Android, and web surfaces, then enforce reviewed proof in deterministic CI.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"mobile"
|
|
97
97
|
],
|
|
98
98
|
"scripts": {
|
|
99
|
-
"test": "node --test tests/report.test.js tests/regression.test.js tests/engine.test.js tests/project-config.test.js tests/application-model.test.js tests/ui-map.test.js tests/focused-navigation.test.js tests/task-runtime.test.js tests/release-contract.test.js tests/pr-selection.test.js tests/flow-runtime.test.js tests/web-explorer.test.js tests/web-session.test.js tests/web-link-audit.test.js tests/web-audit.test.js tests/capture-provenance.test.js tests/capture-frames.test.js tests/ios-crash-attribution.test.js tests/ios-simulator-selection.test.js tests/ios-recording-stop.test.js tests/web-flow.test.js tests/scenario-runtime.test.js tests/android-driver.test.js tests/android-explorer.test.js tests/android-flow.test.js tests/android-primitives-protocol.test.js tests/managed-web.test.js tests/product-operations.test.js tests/job-lanes.test.js tests/browser-product.test.js tests/browser-chat-narration.test.js tests/browser-onboarding.test.js tests/managed-operation.test.js tests/ci-setup.test.js tests/ci-install.test.js tests/cli.test.js tests/mcp-workspace.test.js tests/action.test.js tests/package-surface.test.js tests/agent-surface.test.js tests/presentation-contract.test.js tests/landing-brand.test.js tests/ci-gate.test.js tests/ci-report.test.js tests/desktop-protocol.test.js tests/ios-flow-protocol.test.js tests/feedback-triage-0919.test.js vscode-extension/test/bridge.test.js",
|
|
99
|
+
"test": "node --test tests/report.test.js tests/regression.test.js tests/engine.test.js tests/project-config.test.js tests/application-model.test.js tests/ui-map.test.js tests/focused-navigation.test.js tests/task-runtime.test.js tests/release-contract.test.js tests/pr-selection.test.js tests/flow-runtime.test.js tests/web-explorer.test.js tests/web-session.test.js tests/web-link-audit.test.js tests/web-audit.test.js tests/capture-provenance.test.js tests/capture-frames.test.js tests/actor-store.test.js tests/account-store.test.js tests/ios-crash-attribution.test.js tests/ios-simulator-selection.test.js tests/ios-recording-stop.test.js tests/web-flow.test.js tests/scenario-runtime.test.js tests/android-driver.test.js tests/android-explorer.test.js tests/android-flow.test.js tests/android-primitives-protocol.test.js tests/managed-web.test.js tests/product-operations.test.js tests/job-lanes.test.js tests/browser-product.test.js tests/browser-chat-narration.test.js tests/browser-onboarding.test.js tests/managed-operation.test.js tests/ci-setup.test.js tests/ci-install.test.js tests/cli.test.js tests/mcp-workspace.test.js tests/action.test.js tests/package-surface.test.js tests/agent-surface.test.js tests/presentation-contract.test.js tests/landing-brand.test.js tests/ci-gate.test.js tests/ci-report.test.js tests/desktop-protocol.test.js tests/ios-flow-protocol.test.js tests/feedback-triage-0919.test.js vscode-extension/test/bridge.test.js",
|
|
100
100
|
"test:browser-journey": "node --test tests/browser-journey.test.js",
|
|
101
101
|
"test:browser-native": "TAPP_RUN_NATIVE_BROWSER=1 node --test tests/browser-native-journey.test.js"
|
|
102
102
|
}
|