@aarwitz/tapp 0.18.1 → 0.18.3
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/browser/app.css +420 -141
- package/browser/app.js +238 -459
- package/browser/index.html +67 -149
- package/browser/product-contract.js +16 -16
- package/browser/view-model.js +85 -0
- package/docs/BROWSER-PRODUCT.md +64 -70
- package/docs/PRODUCT-ENGINE.md +1 -1
- package/mcp-server/src/browser-product.js +142 -70
- package/mcp-server/src/html-report.js +1 -1
- package/mcp-server/src/index.js +4 -0
- package/package.json +2 -2
package/docs/BROWSER-PRODUCT.md
CHANGED
|
@@ -1,83 +1,77 @@
|
|
|
1
|
-
# Browser
|
|
2
|
-
|
|
3
|
-
Status: current product contract as of 2026-10-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
Settings, a project block, and an Overview that pairs a device feed with "tapp chat". The feed shows
|
|
12
|
-
a live session frame or the newest screenshot the running exploration wrote; the chat is the
|
|
13
|
-
engine's own progress log (phase changes, per-action narratives such as `Tapped "Place order"`,
|
|
14
|
-
`Reached Checkout`, findings, completion). Nothing in either panel is generated after the fact, and
|
|
15
|
-
there is no message input because no chat backend exists in the package. Web is one application
|
|
16
|
-
target beside iOS and Android; it is not a separate QA product. CLI, MCP, VS Code, the Action,
|
|
17
|
-
desktop, and the hosted Studio all adapt the shared product operations described in
|
|
18
|
-
[`PRODUCT-ENGINE.md`](PRODUCT-ENGINE.md).
|
|
1
|
+
# Browser Studio
|
|
2
|
+
|
|
3
|
+
Status: current product contract as of 2026-10-19 (ADR-0006, owner decision, amended). Supersedes
|
|
4
|
+
the "desktop-parity Command Center" framing of 2026-10-14.
|
|
5
|
+
|
|
6
|
+
The Studio in `browser/` is the one browser surface. It is a **run viewer**: point Tapp at a
|
|
7
|
+
repository target or a website, watch the run live, open its evidence. It never scores or judges
|
|
8
|
+
a run — only the deterministic gate decides — and it never re-renders evidence: every run opens
|
|
9
|
+
the `report.html` the engine wrote into the capture. The hosted control plane (`saas/`, frozen)
|
|
10
|
+
embeds these same assets at build time.
|
|
19
11
|
|
|
20
12
|
## Start locally
|
|
21
13
|
|
|
22
14
|
```bash
|
|
23
|
-
npx -y @aarwitz/tapp@latest app
|
|
15
|
+
npx -y @aarwitz/tapp@latest app # opens on the prompt
|
|
16
|
+
npx -y @aarwitz/tapp@latest app /path/to/repo # opens straight onto that repository
|
|
24
17
|
```
|
|
25
18
|
|
|
26
|
-
Tapp prints an authenticated one-time launch URL and opens it in the default browser
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
`tapp app /path/to/repo` intentionally works directly in that checkout.
|
|
31
|
-
|
|
32
|
-
The local server binds to `127.0.0.1`. It owns workspace paths; browser requests cannot submit an
|
|
33
|
-
arbitrary server path. Mutations require an `HttpOnly` same-site session cookie, the exact local
|
|
34
|
-
Origin, and an in-memory CSRF token. Application runtimes, repository credentials, and evidence stay
|
|
35
|
-
in the local process/filesystem. This is a local trust boundary, not hosted multi-tenancy.
|
|
36
|
-
|
|
37
|
-
## Product journey
|
|
38
|
-
|
|
39
|
-
1. **Connect** a copied folder, an explicit checkout, or a repository authorized by local `gh`.
|
|
40
|
-
2. **Detect and choose** an iOS, Android, or web target. Continue automatically only when the target
|
|
41
|
-
and configuration are conclusive.
|
|
42
|
-
3. **Build, launch, and explore** the real simulator, emulator/device, or browser surface.
|
|
43
|
-
4. **Understand the UI Map** through observed states, transitions, controls, provenance, and gaps.
|
|
44
|
-
5. **Review intent** by approving, rejecting, deferring, or constraining a compact release plan.
|
|
45
|
-
6. **Generate drafts** of Tasks and contracts. Drafts remain visibly untrusted.
|
|
46
|
-
7. **Validate** approved drafts deterministically against the real target.
|
|
47
|
-
8. **Promote** only validated artifacts into the canonical suite and refreshed Application Model.
|
|
48
|
-
9. **Gate** with autonomous evidence plus the promoted deterministic suite.
|
|
49
|
-
10. **Baseline** only a passing, conclusive, target-scoped gate.
|
|
50
|
-
11. **Install CI** by previewing and writing a reviewable repository patch. Tapp does not commit,
|
|
51
|
-
push, create GitHub secrets, or enable branch protection.
|
|
52
|
-
|
|
53
|
-
Successful semantic actions can be saved in `.tapp/flows/`; credential values are templated to
|
|
54
|
-
environment references. Long-lived repository artifacts store binding names, not resolved secret
|
|
55
|
-
values.
|
|
19
|
+
Tapp prints an authenticated one-time launch URL and opens it in the default browser (`--no-open`
|
|
20
|
+
to copy it by hand, `--port 4317` for a fixed loopback port). Everything runs on this machine
|
|
21
|
+
with its own toolchain (Xcode for iOS, JDK/SDK + `adb` for Android, Playwright Chromium for
|
|
22
|
+
web), which must stay open while a run is in progress. Nothing is uploaded anywhere.
|
|
56
23
|
|
|
57
|
-
##
|
|
24
|
+
## The prompt
|
|
58
25
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
and replay, proposal review, generation, deterministic validation, promotion, a first gate,
|
|
62
|
-
baseline-aware rerun, and CI preview.
|
|
26
|
+
With nothing open, the Studio shows one field — **What should tapp test?** — above a short
|
|
27
|
+
looping animation of a device being driven (launch, tap, tap, screenshot, ✓). It accepts:
|
|
63
28
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
29
|
+
| You type | What happens |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `https://example.com` (or `example.com`) | A read-only website audit; the stage takes a browser's shape. |
|
|
32
|
+
| `~/code/my-app`, `/path/to/repo` | That folder becomes the project: targets are detected, nothing builds until one is chosen. Local Studio only. |
|
|
33
|
+
| `owner/repo`, `github.com/owner/repo` | Cloned with `gh` into an isolated workspace under `TAPP_HOME`, then the same. |
|
|
34
|
+
| `com.company.app` | Explored on the booted iOS simulator as it is (no build). |
|
|
35
|
+
| `/path/to/Demo.app`, `~/Downloads/app.apk` | Installed on the booted simulator / connected device, then explored. |
|
|
36
|
+
| a business name | Answered honestly: nothing discovers surfaces from a name yet; paste its URL. |
|
|
69
37
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
intent.
|
|
38
|
+
The server classifies the input again (`classifyPrompt` in `browser/view-model.js` is shared) and
|
|
39
|
+
refuses what the mode cannot do: a hosted Studio cannot open a path or a build on your machine.
|
|
73
40
|
|
|
74
|
-
##
|
|
41
|
+
## What is on the page
|
|
42
|
+
|
|
43
|
+
| View | What it shows | Operations |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| Overview | The **stage**: the device as large as the window allows, in its platform's aspect ratio (phone portrait for iOS and Android, browser landscape for web), showing the live frame or the newest screenshot the run wrote. The **chat** floats over its corner on a translucent ground, collapses to a pill, and narrates the engine's own progress log one emoji-led line at a time (👆 Tapped, ⌨️ Typed, 🔐 Signed in, 📍 Opened, 🧭 Reached, 📸 screenshots inline), then attaches the recording and `report.html` and ends with a pill — `✓ Ready to merge`, `× Do not merge`, `◐ Inconclusive`, or for an exploration its counts — and the headline. Nothing is generated after the fact and nothing is a score. Below the stage: the detected targets (an explicit choice when there are several), the live-session controls, and the current decision from the last gate. | `open`, `initialize` (inspect, then build + explore), `explore-build`, live session `start / act / save-flow / end`, release check |
|
|
46
|
+
| Runs | Every run on this repository, every exploration started from the prompt, and every read-only website audit, newest first; each opens its evidence page. A URL field runs an audit from here. | `gate`, `audit` |
|
|
47
|
+
|
|
48
|
+
A **website audit** is `explore --read-only`: up to six same-origin pages are rendered and read —
|
|
49
|
+
dead controls, broken images/assets/links, failed requests, JS exceptions, mixed content,
|
|
50
|
+
horizontal overflow — and nothing is clicked, typed, submitted or hovered, so it is safe on
|
|
51
|
+
production or a site you do not own. A website has no source revision, so it has no release
|
|
52
|
+
verdict; the audit says what it checked and what it could not (its detectors were qualified on 25
|
|
53
|
+
real small-business sites in October 2026; the remaining findings were verified by hand).
|
|
75
54
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
55
|
+
## What was removed, and where it lives instead
|
|
56
|
+
|
|
57
|
+
The Contracts, Coverage and Settings views, the six-step journey stepper, and the folder-upload,
|
|
58
|
+
GitHub-clone and remote-runner onboarding were removed on 2026-10-15. Reviewing and promoting
|
|
59
|
+
contracts is `tapp plan` / `tapp validate` in the repository; coverage is on every run's
|
|
60
|
+
`report.html`; actors and credentials live in `.tapp/project.json`; CI installation is `tapp ci`.
|
|
61
|
+
The Studio keeps only what a browser does better than a terminal: watching a real device while a
|
|
62
|
+
run happens, driving it by hand, and reading evidence.
|
|
63
|
+
|
|
64
|
+
## Verified reference journey
|
|
65
|
+
|
|
66
|
+
`tests/browser-journey.test.js` drives the CommerceDemo fixture end to end in a real browser:
|
|
67
|
+
target choice, exploration, a live session that records a Flow, the gate, and the runs list.
|
|
68
|
+
`tests/browser-onboarding.test.js` covers the no-repository start and a read-only website audit;
|
|
69
|
+
`tests/browser-product.test.js` covers authentication, CSRF, the audit operation and the removed
|
|
70
|
+
endpoints answering 404. `tests/browser-chat-narration.test.js` covers prompt classification and
|
|
71
|
+
the chat's narration and summary without a browser.
|
|
72
|
+
|
|
73
|
+
## Hosted relationship
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
`saas/` serves the same `browser/` assets through `/api/studio` with an API base and login URL
|
|
76
|
+
injected. It is frozen at its current commit (ADR-0006, owner decision) and will embed the
|
|
77
|
+
simplified Studio when it is next deployed. Nothing in the Studio depends on it.
|
package/docs/PRODUCT-ENGINE.md
CHANGED
|
@@ -58,7 +58,7 @@ Current convergence:
|
|
|
58
58
|
- VS Code remains a thin MCP client;
|
|
59
59
|
- desktop reads the same `.tapp` artifacts but still has legacy import/build orchestration. It is
|
|
60
60
|
retained, not the launch UX, until that orchestration is removed;
|
|
61
|
-
- `cloud/runner`
|
|
61
|
+
- The former `cloud/runner` prototype (removed 2026-10-15) was the evidence for exact checkout, versioned operation envelopes,
|
|
62
62
|
leases, and cleanup. It is not the production hosted adapter or an adequate arbitrary-customer
|
|
63
63
|
isolation boundary. The new SaaS must call these shared operations only through a tenant-aware,
|
|
64
64
|
queued worker contract (defined in the private source repository's SaaS architecture doc).
|
|
@@ -12,19 +12,10 @@ import { fileURLToPath } from "node:url";
|
|
|
12
12
|
import { customerProductContract } from "../../browser/product-contract.js";
|
|
13
13
|
import { BrowserWorkspaceRegistry } from "./browser-workspaces.js";
|
|
14
14
|
import { selectApplicationTarget } from "./ci-setup.js";
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
installProductCi,
|
|
20
|
-
prepareProductCi,
|
|
21
|
-
prepareProductTarget,
|
|
22
|
-
promoteProductPlan,
|
|
23
|
-
readProductProject,
|
|
24
|
-
reviewProductPlan,
|
|
25
|
-
runProductGate,
|
|
26
|
-
validateProductPlan,
|
|
27
|
-
} from "./product-operations.js";
|
|
15
|
+
import { initializeProductProject, prepareProductTarget, readProductProject, runProductGate } from "./product-operations.js";
|
|
16
|
+
import { readCaptureProvenance } from "./capture-provenance.js";
|
|
17
|
+
import { collectShots } from "./html-report.js";
|
|
18
|
+
import { classifyPrompt } from "../../browser/view-model.js";
|
|
28
19
|
|
|
29
20
|
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
30
21
|
const assetRoot = path.join(packageRoot, "browser");
|
|
@@ -119,6 +110,55 @@ function capturePath(captureId, relative = "report.html") {
|
|
|
119
110
|
return candidate === root || candidate.startsWith(root + path.sep) ? candidate : null;
|
|
120
111
|
}
|
|
121
112
|
|
|
113
|
+
// Read-only website audits live in the captures directory like every other run; the Studio
|
|
114
|
+
// lists the ones with a summary file. Newest first, bounded.
|
|
115
|
+
function listAudits(limit = 50) {
|
|
116
|
+
const root = captureRoot();
|
|
117
|
+
let names;
|
|
118
|
+
try { names = fs.readdirSync(root); } catch { return []; }
|
|
119
|
+
const audits = [];
|
|
120
|
+
for (const name of names) {
|
|
121
|
+
if (!name.startsWith("web-audit-")) continue;
|
|
122
|
+
const summaryPath = path.join(root, name, "audit.json");
|
|
123
|
+
let summary;
|
|
124
|
+
try { summary = JSON.parse(fs.readFileSync(summaryPath, "utf8")); } catch { continue; }
|
|
125
|
+
const provenance = readCaptureProvenance(path.join(root, name));
|
|
126
|
+
audits.push({
|
|
127
|
+
id: name, createdAt: provenance?.createdAt || fs.statSync(summaryPath).mtime.toISOString(),
|
|
128
|
+
url: summary.url, pagesAudited: summary.pagesAudited || 0, pagesWithUnverifiableWiring: summary.pagesWithUnverifiableWiring || 0,
|
|
129
|
+
findingCounts: summary.findingCounts || {}, issueCount: summary.issueCount ?? (summary.issues || []).length,
|
|
130
|
+
issues: (summary.issues || []).slice(0, 60), checkedFor: summary.checkedFor || [], notChecked: summary.notChecked || [],
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return audits.sort((a, b) => b.createdAt.localeCompare(a.createdAt)).slice(0, limit);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Everything the Studio can show for one capture, as paths relative to /evidence/captures/<id>/.
|
|
137
|
+
function captureFiles(captureId) {
|
|
138
|
+
const root = capturePath(captureId, ".");
|
|
139
|
+
if (!root || !fs.existsSync(root)) return null;
|
|
140
|
+
const shots = collectShots(root).slice(0, 24);
|
|
141
|
+
const recording = ["exploration.webm", "exploration.mov", "exploration.mp4"].find((name) => fs.existsSync(path.join(root, name))) || null;
|
|
142
|
+
return { id: captureId, shots, recording, report: fs.existsSync(path.join(root, "report.html")) ? "report.html" : null, provenance: readCaptureProvenance(root) };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Explorations started from the prompt (a bundle id, an .app or .apk) have no repository to list
|
|
146
|
+
// them under; they are listed from their captures like audits are.
|
|
147
|
+
function listBuildExplores(limit = 50) {
|
|
148
|
+
const root = captureRoot();
|
|
149
|
+
let names;
|
|
150
|
+
try { names = fs.readdirSync(root); } catch { return []; }
|
|
151
|
+
const runs = [];
|
|
152
|
+
for (const name of names) {
|
|
153
|
+
const provenance = readCaptureProvenance(path.join(root, name));
|
|
154
|
+
if (!provenance || provenance.kind !== "explore" || provenance.origin !== "studio-prompt") continue;
|
|
155
|
+
let report = null;
|
|
156
|
+
try { report = JSON.parse(fs.readFileSync(path.join(root, name, "report.json"), "utf8")); } catch { /* older capture */ }
|
|
157
|
+
runs.push({ id: name, createdAt: provenance.createdAt, platform: provenance.platform, target: provenance.target, report });
|
|
158
|
+
}
|
|
159
|
+
return runs.sort((a, b) => b.createdAt.localeCompare(a.createdAt)).slice(0, limit);
|
|
160
|
+
}
|
|
161
|
+
|
|
122
162
|
function openBrowser(url) {
|
|
123
163
|
const invocation = process.platform === "darwin" ? ["open", [url]]
|
|
124
164
|
: process.platform === "win32" ? ["cmd", ["/c", "start", "", url]]
|
|
@@ -418,7 +458,14 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
418
458
|
return;
|
|
419
459
|
}
|
|
420
460
|
if (request.method === "GET" && url.pathname === "/api/repositories") { json(response, 200, hosted ? { current:hostedRepository(registry.current()), repositories:registry.list().map(hostedRepository) } : { current: registry.current(), repositories: registry.list() }); return; }
|
|
421
|
-
if (request.method === "GET" && url.pathname === "/api/
|
|
461
|
+
if (request.method === "GET" && url.pathname === "/api/audits") { json(response, 200, { audits: hosted ? hostedPayload(listAudits()) : listAudits(), explores: hosted ? hostedPayload(listBuildExplores()) : listBuildExplores() }); return; }
|
|
462
|
+
const filesMatch = url.pathname.match(/^\/api\/captures\/([A-Za-z0-9._-]{1,128})\/files$/);
|
|
463
|
+
if (request.method === "GET" && filesMatch) {
|
|
464
|
+
const files = captureFiles(filesMatch[1]);
|
|
465
|
+
if (!files) { json(response, 404, { error: "No such capture" }); return; }
|
|
466
|
+
json(response, 200, files);
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
422
469
|
if (request.method === "GET" && url.pathname === "/api/project") { json(response, 200, hosted ? hostedPayload(projectSnapshot(registry)) : projectSnapshot(registry)); return; }
|
|
423
470
|
if (request.method === "GET" && url.pathname === "/api/live-session") { json(response, 200, liveSession || { active:false }); return; }
|
|
424
471
|
if (request.method === "GET" && url.pathname === "/api/live-session/frame") {
|
|
@@ -456,35 +503,6 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
456
503
|
return;
|
|
457
504
|
}
|
|
458
505
|
|
|
459
|
-
const uploadFileMatch = url.pathname.match(/^\/api\/repositories\/uploads\/(upload_[a-f0-9]{20})\/files$/);
|
|
460
|
-
if (request.method === "PUT" && uploadFileMatch) {
|
|
461
|
-
requireMutationAuth(request, hosted ? publicOrigins : origin, csrfToken);
|
|
462
|
-
let relativePath;
|
|
463
|
-
try { relativePath = decodeURIComponent(String(request.headers["x-tapp-relative-path"] || "")); }
|
|
464
|
-
catch { throw Object.assign(new Error("Repository file path header is invalid"), { statusCode: 400 }); }
|
|
465
|
-
const result = await registry.writeUploadFile(uploadFileMatch[1], relativePath, request, request.headers["content-length"]);
|
|
466
|
-
json(response, 200, result);
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
if (request.method === "POST" && url.pathname === "/api/repositories/uploads") {
|
|
470
|
-
requireMutationAuth(request, hosted ? publicOrigins : origin, csrfToken);
|
|
471
|
-
json(response, 201, registry.createUpload(await readJsonBody(request)));
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
const uploadCompleteMatch = url.pathname.match(/^\/api\/repositories\/uploads\/(upload_[a-f0-9]{20})\/complete$/);
|
|
475
|
-
if (request.method === "POST" && uploadCompleteMatch) {
|
|
476
|
-
requireMutationAuth(request, hosted ? publicOrigins : origin, csrfToken);
|
|
477
|
-
if (liveSession?.active) throw Object.assign(new Error("End the active live session before changing repositories"), { statusCode:409 });
|
|
478
|
-
const repository = registry.finishUpload(uploadCompleteMatch[1]);
|
|
479
|
-
json(response, 200, { repository: hosted ? hostedRepository(repository) : repository });
|
|
480
|
-
return;
|
|
481
|
-
}
|
|
482
|
-
const uploadAbortMatch = url.pathname.match(/^\/api\/repositories\/uploads\/(upload_[a-f0-9]{20})$/);
|
|
483
|
-
if (request.method === "DELETE" && uploadAbortMatch) {
|
|
484
|
-
requireMutationAuth(request, hosted ? publicOrigins : origin, csrfToken);
|
|
485
|
-
json(response, 200, { aborted: registry.abortUpload(uploadAbortMatch[1]) });
|
|
486
|
-
return;
|
|
487
|
-
}
|
|
488
506
|
if (request.method === "POST" && url.pathname === "/api/repositories/select") {
|
|
489
507
|
requireMutationAuth(request, hosted ? publicOrigins : origin, csrfToken);
|
|
490
508
|
if (activeMutation) throw Object.assign(new Error(`Operation '${activeMutation.operation}' is still running`), { statusCode: 409 });
|
|
@@ -499,14 +517,91 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
499
517
|
requireMutationAuth(request, hosted ? publicOrigins : origin, csrfToken);
|
|
500
518
|
const body = await readJsonBody(request);
|
|
501
519
|
const operation = url.pathname.slice("/api/operations/".length);
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
520
|
+
// "What should tapp test?" — a repository on this machine or on GitHub becomes the current
|
|
521
|
+
// project; a build is explored directly; a URL goes to `audit`; a business name is not
|
|
522
|
+
// something Tapp can resolve yet, and says so instead of guessing.
|
|
523
|
+
if (operation === "open") {
|
|
524
|
+
const prompt = classifyPrompt(body.input);
|
|
525
|
+
if (liveSession?.active) throw Object.assign(new Error("End the active live session before opening another project"), { statusCode: 409 });
|
|
526
|
+
if (prompt.kind === "path") {
|
|
527
|
+
if (hosted) throw Object.assign(new Error("A hosted Studio cannot open a path on your machine; run `tapp app /path/to/repo` locally"), { statusCode: 400 });
|
|
528
|
+
const resolved = prompt.value.startsWith("~") ? path.join(os.homedir(), prompt.value.slice(1)) : path.resolve(prompt.value);
|
|
529
|
+
if (!fs.existsSync(resolved) || !fs.statSync(resolved).isDirectory()) throw Object.assign(new Error(`No folder at ${resolved}`), { statusCode: 400 });
|
|
530
|
+
const repository = registry.addExisting(resolved);
|
|
531
|
+
json(response, 200, { kind: "repository", repository: hosted ? hostedRepository(repository) : repository });
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
if (prompt.kind === "github") {
|
|
535
|
+
const job = startJob(operation, async (progress) => ({ kind: "repository", repository: await registry.cloneGithub(prompt.value, progress) }), null);
|
|
536
|
+
json(response, 202, { job: publicJob(job, { hosted }) });
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
if (prompt.kind === "business") {
|
|
540
|
+
json(response, 200, { kind: "business", message: `I can't find a business's website or app from a name yet — paste its URL and I'll audit it read-only, or open its repository.` });
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
json(response, 200, { kind: prompt.kind, value: prompt.value });
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
if (operation === "explore-build") {
|
|
547
|
+
if (hosted) throw Object.assign(new Error("Builds are explored on the machine that has the simulator; run the Studio locally"), { statusCode: 400 });
|
|
548
|
+
const prompt = classifyPrompt(body.input);
|
|
549
|
+
if (!["bundle", "app", "apk"].includes(prompt.kind)) throw Object.assign(new Error("Give a bundle id (com.company.app), a simulator .app, or an .apk"), { statusCode: 400 });
|
|
550
|
+
const job = startJob(operation, async (progress) => {
|
|
551
|
+
const engine = await import("./index.js");
|
|
552
|
+
const forward = (entry) => progress({ phase: "explore", text: entry.narrative || `${entry.action || 0}/${entry.max || 0} actions · ${entry.states || 0} states`, ...(entry.action ? { current: entry.action, total: entry.max } : {}), ...(entry.screen ? { screen: entry.screen } : {}), ...(entry.screenshot ? { screenshot: entry.screenshot } : {}) });
|
|
553
|
+
let result;
|
|
554
|
+
if (prompt.kind === "apk") {
|
|
555
|
+
progress({ phase: "runtime", text: `Installing ${path.basename(prompt.value)} on the connected Android device` });
|
|
556
|
+
result = await engine.runQaAndroid({ apkPath: prompt.value, appId: String(body.appId || ""), maxActions: Number(body.maxActions) || 40, timeout: Number(body.timeout) || 600, onProgress: forward });
|
|
557
|
+
} else {
|
|
558
|
+
let bundleId = prompt.value;
|
|
559
|
+
if (prompt.kind === "app") {
|
|
560
|
+
progress({ phase: "runtime", text: `Installing ${path.basename(prompt.value)} on the booted simulator` });
|
|
561
|
+
const installed = await engine.installAppOnBootedSim(prompt.value, { onStatus: (text) => progress({ phase: "runtime", text }) });
|
|
562
|
+
if (installed?.error) throw new Error(installed.error);
|
|
563
|
+
bundleId = installed.bundleId;
|
|
564
|
+
}
|
|
565
|
+
progress({ phase: "runtime", text: `Launching ${bundleId} on the booted simulator` });
|
|
566
|
+
result = await engine.runQaIos({ bundleId, maxActions: Number(body.maxActions) || 40, timeout: Number(body.timeout) || 600, device: String(body.device || ""), onProgress: forward });
|
|
567
|
+
}
|
|
568
|
+
if (result?.error) throw Object.assign(new Error(result.error), { details: result.details || {} });
|
|
569
|
+
const structured = result.structured;
|
|
570
|
+
// Mark the capture as prompt-started so the Studio lists it without a repository.
|
|
571
|
+
try {
|
|
572
|
+
const captureDir = structured?.capture?.path;
|
|
573
|
+
if (captureDir) {
|
|
574
|
+
const provenancePath = path.join(captureDir, "provenance.json");
|
|
575
|
+
const provenance = JSON.parse(fs.readFileSync(provenancePath, "utf8"));
|
|
576
|
+
fs.writeFileSync(provenancePath, JSON.stringify({ ...provenance, origin: "studio-prompt" }, null, 2));
|
|
577
|
+
fs.writeFileSync(path.join(captureDir, "report.json"), JSON.stringify({ headline: structured.headline, inconclusive: structured.inconclusive, screensExplored: structured.screensExplored, actionsPerformed: structured.actionsPerformed, findingCounts: structured.findingCounts, findings: structured.findings, checkedFor: structured.checkedFor, notChecked: structured.notChecked, platform: structured.platform, target: structured.target }, null, 2));
|
|
578
|
+
}
|
|
579
|
+
} catch { /* listing is a convenience; the capture is the evidence */ }
|
|
580
|
+
return structured;
|
|
581
|
+
}, null);
|
|
582
|
+
json(response, 202, { job: publicJob(job, { hosted }) });
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
// A website audit needs no repository: it is read-only against a URL and writes a capture.
|
|
586
|
+
if (operation === "audit") {
|
|
587
|
+
let target;
|
|
588
|
+
try { target = new URL(String(body.url || "")); } catch { throw Object.assign(new Error("Audit needs a valid http(s) URL"), { statusCode: 400 }); }
|
|
589
|
+
if (!/^https?:$/.test(target.protocol)) throw Object.assign(new Error("Audit needs a valid http(s) URL"), { statusCode: 400 });
|
|
590
|
+
const pages = Math.max(1, Math.min(20, Number(body.pages) || 6));
|
|
591
|
+
const job = startJob(operation, async (progress) => {
|
|
592
|
+
const { auditWebSite } = await import("./web-audit.js");
|
|
593
|
+
progress({ phase: "runtime", text: `Opening ${target.href} read-only (up to ${pages} pages, nothing will be clicked)` });
|
|
594
|
+
const summary = await auditWebSite({
|
|
595
|
+
url: target.href, pages, delayMs: 750, capturesDir: captureRoot(),
|
|
596
|
+
onPage: (page, n) => progress({ phase: "explore", text: `Audited ${page.url} — ${page.findings.length} finding(s)`, current: n, total: pages }),
|
|
597
|
+
});
|
|
598
|
+
return hosted ? hostedPayload(summary) : summary;
|
|
599
|
+
}, null);
|
|
505
600
|
json(response, 202, { job: publicJob(job, { hosted }) });
|
|
506
601
|
return;
|
|
507
602
|
}
|
|
508
603
|
const root = registry.currentRoot();
|
|
509
|
-
if (!root) throw Object.assign(new Error("
|
|
604
|
+
if (!root) throw Object.assign(new Error("Open a repository first: tapp app /path/to/repo"), { statusCode: 409 });
|
|
510
605
|
const repositoryId = registry.current().id;
|
|
511
606
|
const job = startJob(operation, async (progress) => {
|
|
512
607
|
const engine = await import("./index.js");
|
|
@@ -608,21 +703,6 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
608
703
|
onStatus: (text) => progress({ phase: "runtime", text }),
|
|
609
704
|
});
|
|
610
705
|
}
|
|
611
|
-
if (operation === "review") return reviewProductPlan({ projectDir: root, approve: body.approve || [], reject: body.reject || [], defer: body.defer || [] });
|
|
612
|
-
if (operation === "generate") return generateProductPlan({ projectDir: root });
|
|
613
|
-
if (operation === "validate") {
|
|
614
|
-
const selected = selectedTarget(root, body);
|
|
615
|
-
const prepared = await prepareProductTarget({ projectDir: root, platform: selected.platform, target: selected.id, buildIos: engine.buildAppForSim, installIos: engine.installAppOnBootedSim, buildAndroid: engine.buildAndroidApp, onProgress: progress });
|
|
616
|
-
return validateProductPlan({
|
|
617
|
-
projectDir: root, items: body.items || [], platform: selected.platform, target: selected.id,
|
|
618
|
-
url: prepared.runtime.url || "", bundleId: prepared.runtime.bundleId || "", appId: prepared.runtime.appId || "", apkPath: prepared.runtime.apkPath || "", serial: runtime.serial,
|
|
619
|
-
timeout: runtime.timeout, testEmail: runtime.testEmail, testPassword: runtime.testPassword,
|
|
620
|
-
startWebTarget: engine.startManagedWebTarget, stopWebTarget: engine.stopManagedWebTarget, onProgress: progress,
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
if (operation === "promote") return promoteProductPlan({ projectDir: root, items: body.items || [] });
|
|
624
|
-
if (operation === "ci-preview") return prepareProductCi({ projectDir: root, actionRef: body.actionRef, defaultBranch: body.defaultBranch || "main" });
|
|
625
|
-
if (operation === "ci-install") return installProductCi({ projectDir: root, actionRef: body.actionRef, defaultBranch: body.defaultBranch || "main", replace: body.replace === true, allowUnresolved: body.allowUnresolved === true });
|
|
626
706
|
if (operation === "gate") {
|
|
627
707
|
const selected = selectedTarget(root, body);
|
|
628
708
|
const prepared = await prepareProductTarget({ projectDir: root, platform: selected.platform, target: selected.id, buildIos: engine.buildAppForSim, buildAndroid: engine.buildAndroidApp, onProgress: progress });
|
|
@@ -632,14 +712,6 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
632
712
|
actions: runtime.maxActions, timeout: runtime.timeout, baseline: body.baseline || "", testEmail: runtime.testEmail, testPassword: runtime.testPassword, onProgress: progress,
|
|
633
713
|
});
|
|
634
714
|
}
|
|
635
|
-
if (operation === "baseline") {
|
|
636
|
-
const project = readProductProject({ projectDir: root });
|
|
637
|
-
const run = project.evidence.find((item) => item.id === body.runId);
|
|
638
|
-
if (!run?.reportPath) throw new Error("Select a completed local gate run before creating a baseline");
|
|
639
|
-
const platform = run.report?.platform || String(body.platform || "").toLowerCase();
|
|
640
|
-
const target = run.report?.targetKey || body.target || "";
|
|
641
|
-
return createProductBaseline({ projectDir: root, reportPath: run.reportPath, platform, target, replace: body.replace === true });
|
|
642
|
-
}
|
|
643
715
|
throw new Error(`Unsupported product operation '${operation}'`);
|
|
644
716
|
}, repositoryId);
|
|
645
717
|
json(response, 202, { job: publicJob(job, { hosted }) });
|
|
@@ -33,7 +33,7 @@ export function capturePlatform(captureDir) {
|
|
|
33
33
|
// Two capture layouts exist: web runs write state_*.png at the capture root; iOS runs
|
|
34
34
|
// export XCUITest attachments into screenshots/ as UUID files with a manifest carrying
|
|
35
35
|
// the human-readable state_N_<Screen> names.
|
|
36
|
-
function collectShots(captureDir) {
|
|
36
|
+
export function collectShots(captureDir) {
|
|
37
37
|
const root = fs
|
|
38
38
|
.readdirSync(captureDir)
|
|
39
39
|
.filter((f) => f.endsWith(".png") && f.startsWith("state_"))
|
package/mcp-server/src/index.js
CHANGED
|
@@ -2274,6 +2274,10 @@ export async function runInitExploration({
|
|
|
2274
2274
|
},
|
|
2275
2275
|
mapDiff: previous ? diffUiMaps(previous, observed, { comparableFullSweep: false }) : null,
|
|
2276
2276
|
inconclusive: qa.structured.inconclusive === true,
|
|
2277
|
+
headline: qa.structured.headline || "",
|
|
2278
|
+
screensExplored: qa.structured.screensExplored ?? 0,
|
|
2279
|
+
actionsPerformed: qa.structured.actionsPerformed ?? 0,
|
|
2280
|
+
findingCounts: qa.structured.findingCounts || null,
|
|
2277
2281
|
findings: qa.structured.findings || [],
|
|
2278
2282
|
capture: qa.structured.capture,
|
|
2279
2283
|
reportHtml: qa.structured.reportHtml || null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aarwitz/tapp",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.3",
|
|
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/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/browser-product.test.js tests/browser-
|
|
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/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/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
|
}
|