@aarwitz/tapp 0.35.8 → 0.35.10
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 +15 -2
- package/browser/app.css +40 -0
- package/browser/app.js +340 -27
- package/browser/index.html +39 -3
- package/browser/product-contract.js +1 -1
- package/browser/view-model.js +24 -0
- package/docs/BROWSER-PRODUCT.md +61 -1
- package/mcp-server/src/app-store-discovery.js +42 -0
- package/mcp-server/src/browser-product.js +351 -18
- package/mcp-server/src/engines.js +212 -0
- package/mcp-server/src/flow-runtime.js +9 -1
- package/mcp-server/src/platforms.js +18 -3
- package/mcp-server/src/web-explorer.js +24 -1
- package/mcp-server/src/web-flow.js +51 -2
- package/package.json +2 -2
package/browser/index.html
CHANGED
|
@@ -52,12 +52,27 @@
|
|
|
52
52
|
</div>
|
|
53
53
|
</section>
|
|
54
54
|
|
|
55
|
+
<!-- Setting this machine up (ADR-0012's journey): the runtime, the agent on your own plan,
|
|
56
|
+
what each target needs with the exact fix, and the account. Local only; collapses to one
|
|
57
|
+
line once this machine is ready. -->
|
|
58
|
+
<section class="setup-card hidden" id="setup-card" aria-live="polite">
|
|
59
|
+
<div class="setup-head">
|
|
60
|
+
<div><p class="eyebrow">This machine</p><h2 id="setup-title">Set up tapp here</h2><p id="setup-sub">Everything runs on this machine. Four things to check, once.</p></div>
|
|
61
|
+
<div class="button-row"><button class="quiet" type="button" id="setup-toggle">Hide</button><button class="quiet" type="button" id="setup-refresh">Check again</button></div>
|
|
62
|
+
</div>
|
|
63
|
+
<ol class="setup-steps" id="setup-steps"><li class="empty">Checking this machine…</li></ol>
|
|
64
|
+
</section>
|
|
55
65
|
<section class="prompt-block">
|
|
66
|
+
<!-- The hosted page reaching the runtime on this person's machine (ADR-0011 §4): said while
|
|
67
|
+
it happens, because Chrome may be asking for permission and a blank page says nothing. -->
|
|
68
|
+
<p class="prompt-note connecting-note hidden" id="connecting-note"></p>
|
|
56
69
|
<h1>What should tapp test?</h1>
|
|
57
70
|
<form class="prompt-form" id="prompt-form" autocomplete="off">
|
|
58
71
|
<label class="prompt-field"><span class="sr-only">Website, repository, folder, or build</span><input id="prompt-input" name="input" placeholder="A website URL, a GitHub repo, a folder on this Mac, a bundle id, an .app or .apk…" spellcheck="false" required></label>
|
|
59
72
|
<button class="primary prompt-go" type="submit" id="prompt-start" aria-label="Start">→</button>
|
|
60
73
|
</form>
|
|
74
|
+
<small id="business-hint" class="prompt-note hidden">Search this name in Apple’s US App Store, or enter the website directly.</small>
|
|
75
|
+
<section id="business-results" class="hidden" aria-live="polite" aria-label="Matching apps"></section>
|
|
61
76
|
<div class="platform-strip" id="platform-strip" hidden></div>
|
|
62
77
|
<ul class="prompt-suggestions" aria-label="Examples">
|
|
63
78
|
<li><button type="button" data-kind="url" data-prompt="https://example.com"><span>⌁</span><b>https://example.com</b><small>audit a website read-only — safe on production, nothing is clicked</small></button></li>
|
|
@@ -69,9 +84,16 @@
|
|
|
69
84
|
person's own machine, and the page says so — with the command — before anyone types
|
|
70
85
|
one. Hidden on a local Studio, which is that machine. -->
|
|
71
86
|
<section class="selfhost-card hidden" id="selfhost-card">
|
|
72
|
-
<p class="selfhost-lead"><strong>Everything else runs on your own machine.</strong>
|
|
73
|
-
<div class="selfhost-row"><code id="selfhost-command">npx -y @aarwitz/tapp@latest app</code><button class="quiet" type="button" id="selfhost-copy">Copy</button></div>
|
|
74
|
-
<small>Needs Node.js 20 or newer.
|
|
87
|
+
<p class="selfhost-lead" id="selfhost-lead"><strong>Everything else runs on your own machine — connect it.</strong> Run this once in a terminal: it opens this page connected to your Mac or PC, and everything — your repositories, iOS and Android builds, macOS apps, staging and localhost — runs there. Nothing leaves it.</p>
|
|
88
|
+
<div class="selfhost-row"><code id="selfhost-command">npx -y @aarwitz/tapp@latest app --connect</code><button class="quiet" type="button" id="selfhost-copy">Copy</button></div>
|
|
89
|
+
<small id="selfhost-note">Needs Node.js 20 or newer. No account needed. If your browser refuses to reach your machine, the same Studio opens at the address the command prints.</small>
|
|
90
|
+
</section>
|
|
91
|
+
<!-- The cloud — tapp running it for you — is coming, not sold (ADR-0011 §3). An address to
|
|
92
|
+
tell, and a way in for an account that already exists. -->
|
|
93
|
+
<section class="selfhost-card hidden" id="cloud-card">
|
|
94
|
+
<p class="selfhost-lead"><strong>Cloud — tapp runs it for you — coming soon.</strong> Leave an address and we will tell you when it opens. <button type="button" class="linklike" data-signin>Have an account? Sign in</button></p>
|
|
95
|
+
<form class="selfhost-row" id="cloud-interest" autocomplete="email"><input name="email" type="email" placeholder="you@company.com" aria-label="Email" required><button class="quiet" type="submit">Tell me</button></form>
|
|
96
|
+
<p class="cloud-sent hidden" id="cloud-sent"></p>
|
|
75
97
|
</section>
|
|
76
98
|
<!-- Signing in to a public Studio: an email address and a link, nothing else. Hidden on a
|
|
77
99
|
local Studio, where the one person at the keyboard is the operator already. -->
|
|
@@ -153,6 +175,13 @@
|
|
|
153
175
|
<span class="chat-caret" aria-hidden="true">▾</span>
|
|
154
176
|
</button>
|
|
155
177
|
<div class="chat-transcript" id="chat-transcript"></div>
|
|
178
|
+
<!-- The person's own agent, driving tapp from here (ADR-0012). Local only, and only when
|
|
179
|
+
an engine on this machine is signed in. -->
|
|
180
|
+
<form class="chat-prompt hidden" id="chat-prompt" autocomplete="off">
|
|
181
|
+
<input id="chat-prompt-input" name="prompt" placeholder="Ask tapp to test something…" aria-label="Ask tapp" maxlength="4000" required>
|
|
182
|
+
<button class="primary" type="submit" id="chat-prompt-send">Send</button>
|
|
183
|
+
<button class="quiet hidden" type="button" id="chat-prompt-stop">Stop</button>
|
|
184
|
+
</form>
|
|
156
185
|
</aside>
|
|
157
186
|
</section>
|
|
158
187
|
|
|
@@ -235,6 +264,13 @@
|
|
|
235
264
|
</div>
|
|
236
265
|
<div id="link-body"></div>
|
|
237
266
|
</section>
|
|
267
|
+
<!-- Which agent drives tapp from the chat, on whose plan (ADR-0012). Local only. -->
|
|
268
|
+
<section class="panel section hidden" id="engines-panel">
|
|
269
|
+
<div class="section-heading compact">
|
|
270
|
+
<div><p class="eyebrow">Your agent</p><h2>Who drives tapp from the chat</h2><p>tapp signs you in to nothing and holds no token: it finds the coding agent you already signed in to on this machine and drives it on your own plan. In the chat it gets tapp's tools and reading the project — never a shell, never an edit.</p></div>
|
|
271
|
+
</div>
|
|
272
|
+
<div id="engines-list"><div class="empty">Checking this machine…</div></div>
|
|
273
|
+
</section>
|
|
238
274
|
<section class="panel section" id="journeys-panel">
|
|
239
275
|
<div class="section-heading compact"><div><p class="eyebrow">Journeys</p><h2>What this app has proven <i id="journey-count" class="zero">0</i></h2><p id="journeys-note">Each replays exactly as written — no model, no key. Keep one from any run that got somewhere; run it any time to prove it still works.</p></div></div>
|
|
240
276
|
<div id="journeys-list"><div class="empty">No journeys yet.</div></div>
|
|
@@ -31,7 +31,7 @@ export const customerProductContract = Object.freeze({
|
|
|
31
31
|
{ id: "platforms", label: "Platforms", capabilities: ["platform-matrix", "self-host-command", "platform-interest"] },
|
|
32
32
|
{ id: "admin", label: "Admin", capabilities: ["deployment-usage", "account-list", "platform-demand"] },
|
|
33
33
|
],
|
|
34
|
-
operations: ["initialize", "session-start", "session-act", "session-save-flow", "session-end", "gate", "audit"],
|
|
34
|
+
operations: ["initialize", "session-start", "session-act", "session-save-flow", "session-end", "gate", "audit", "agent", "agent-stop"],
|
|
35
35
|
invariants: [
|
|
36
36
|
"The Studio shows runs; it never scores or judges them. Only the deterministic gate decides.",
|
|
37
37
|
"Every run's evidence is the report.html the engine wrote; the Studio links to it rather than re-rendering it.",
|
package/browser/view-model.js
CHANGED
|
@@ -64,6 +64,12 @@ const RULES = [
|
|
|
64
64
|
export function narrate(entry = {}, { platform = "" } = {}) {
|
|
65
65
|
const text = String(entry.text || "").trim().replace(/\s+/g, " ");
|
|
66
66
|
if (!text) return null;
|
|
67
|
+
// The person's own agent talking (ADR-0012): its words, the tapp tool it reached for, a tool
|
|
68
|
+
// that answered with an error, and its final answer — each told apart at a glance.
|
|
69
|
+
if (entry.phase === "agent") return { kind: "agent", icon: "🤖", text };
|
|
70
|
+
if (entry.phase === "agent-tool") return { kind: "step", icon: "🛠️", text };
|
|
71
|
+
if (entry.phase === "agent-warning") return { kind: "warning", icon: "⚠️", text };
|
|
72
|
+
if (entry.phase === "agent-done") return { kind: "agent", icon: "✅", text };
|
|
67
73
|
const progress = text.match(/^(\d+)\/(\d+) actions(?: · (\d+) (?:states?|pages?|screens?)[^·]*)?/i);
|
|
68
74
|
if (progress) return { kind: "progress", icon: "⏳", text, current: Number(progress[1]), total: Number(progress[2]), states: progress[3] ? Number(progress[3]) : null };
|
|
69
75
|
for (const [pattern, icon] of RULES) {
|
|
@@ -99,6 +105,11 @@ export function summarize(name, result = {}, { access = "" } = {}) {
|
|
|
99
105
|
const noticedText = noticed ? ` It also found ${noticed} thing${noticed === 1 ? "" : "s"} a person would notice — faint text, controls too small to tap on a phone, copy nobody finished — listed under “Worth a look”.` : "";
|
|
100
106
|
return { tone: issues ? "caution" : noticed ? "caution" : "ready", pill, text: `${result.pagesAudited || 0} page(s) rendered read-only — nothing was clicked. ${issues ? "Each issue is listed in the run detail with the pages it appears on." : "Nothing is broken."}${noticedText}${next}` };
|
|
101
107
|
}
|
|
108
|
+
// A chat turn with the agent: what it said last, and how many turns it took. Never a verdict.
|
|
109
|
+
if (name === "agent") {
|
|
110
|
+
const turns = Number(result?.turns) || 0;
|
|
111
|
+
return { tone: result?.isError ? "caution" : "ready", pill: result?.isError ? "Stopped" : `✓ ${turns} turn${turns === 1 ? "" : "s"}`, text: String(result?.text || "Done.").slice(0, 600) };
|
|
112
|
+
}
|
|
102
113
|
if (gateOutcome) {
|
|
103
114
|
const tone = { pass: "ready", fail: "blocked", inconclusive: "caution" }[gateOutcome] || "caution";
|
|
104
115
|
const pill = { pass: "✓ Ready to merge", fail: "× Do not merge", inconclusive: "◐ Inconclusive" }[gateOutcome];
|
|
@@ -293,3 +304,16 @@ export function coverageGraph(uiMap, shots = [], { platform = "" } = {}) {
|
|
|
293
304
|
unreachable,
|
|
294
305
|
};
|
|
295
306
|
}
|
|
307
|
+
|
|
308
|
+
// app.runtapp.com driving the runtime on this person's machine (ADR-0011 §4, join B). The
|
|
309
|
+
// runtime opens the hosted page with its own address and the launch secret in the URL FRAGMENT,
|
|
310
|
+
// which a browser never sends to the server — so the hosted Studio learns where the machine is
|
|
311
|
+
// without the cloud ever seeing the secret.
|
|
312
|
+
export function parseConnectFragment(hash = "") {
|
|
313
|
+
const params = new URLSearchParams(String(hash || "").replace(/^#/, ""));
|
|
314
|
+
const origin = String(params.get("connect") || "").trim().replace(/\/$/, "");
|
|
315
|
+
const token = String(params.get("token") || "").trim();
|
|
316
|
+
if (!/^http:\/\/(?:127\.0\.0\.1|localhost|\[::1\])(?::\d{1,5})?$/.test(origin)) return null;
|
|
317
|
+
if (!/^[A-Za-z0-9_-]{20,}$/.test(token)) return null;
|
|
318
|
+
return { origin, token };
|
|
319
|
+
}
|
package/docs/BROWSER-PRODUCT.md
CHANGED
|
@@ -35,7 +35,7 @@ looping animation of a device being driven (launch, tap, tap, screenshot, ✓).
|
|
|
35
35
|
| `owner/repo`, `github.com/owner/repo` | Cloned with `gh` into an isolated workspace under `TAPP_HOME`, then the same. |
|
|
36
36
|
| `com.company.app` | Explored on the booted iOS simulator as it is (no build). |
|
|
37
37
|
| `/path/to/Demo.app`, `~/Downloads/app.apk` | Installed on the booted simulator / connected device, then explored. |
|
|
38
|
-
| a business name |
|
|
38
|
+
| a business name | Searches Apple's US App Store. Choose a matching publisher's website to start a run, or supply a URL directly. The App Store link opens the listing. |
|
|
39
39
|
|
|
40
40
|
The server classifies the input again (`classifyPrompt` in `browser/view-model.js` is shared) and
|
|
41
41
|
refuses what the mode cannot do: a hosted Studio cannot open a path or a build on your machine.
|
|
@@ -120,6 +120,53 @@ owner (`TAPP_ADMIN_EMAILS`) is never gated and marks an account paid or extends
|
|
|
120
120
|
Admin view (`POST /api/admin/plan`). There is no payment step yet: "paid" is the owner's word.
|
|
121
121
|
Nothing a local Studio does needs an account.
|
|
122
122
|
|
|
123
|
+
**Driven from app.runtapp.com (ADR-0011 §2/§4, join B).** `tapp app --connect` starts the runtime
|
|
124
|
+
on this machine and opens the hosted page with `#connect=<loopback origin>&token=<launch secret>`
|
|
125
|
+
— a fragment, so the hosted server never sees it. The page keeps the pair in this browser only
|
|
126
|
+
(`localStorage`, `tapp.connect`), takes it off the address bar, and from then on every `/api/*`
|
|
127
|
+
call goes to that origin with `Authorization: Bearer <secret>`; images and reports carry
|
|
128
|
+
`?token=` because an `<img>` cannot send a header. The runtime, started with `connectOrigin`,
|
|
129
|
+
answers CORS for exactly that origin (`Access-Control-Allow-Origin`, the preflight with
|
|
130
|
+
`Access-Control-Allow-Private-Network: true` for Chrome's local-network check), accepts the
|
|
131
|
+
bearer or the query token as the operator, still requires the CSRF token on mutations, and tells
|
|
132
|
+
every other origin nothing. The hosted page's CSP allows `http://127.0.0.1:*` and
|
|
133
|
+
`http://localhost:*` for `connect-src`, `img-src` and `media-src`; a local Studio's does not. The
|
|
134
|
+
header shows *Connected · your machine* with Disconnect, which forgets the pair. A runtime that
|
|
135
|
+
stops answering is said on the first screen, the pair is dropped, and the page carries on as a
|
|
136
|
+
visitor. A browser that refuses loopback from an https page (some do) is sent to the runtime's
|
|
137
|
+
own address, the same UI. For a visitor the cloud card says *coming soon* and takes an address
|
|
138
|
+
(`POST /api/cloud/interest` → `TAPP_HOME/cloud-interest.jsonl`, an address and a date, nothing
|
|
139
|
+
else); an existing account signs in from that card.
|
|
140
|
+
|
|
141
|
+
**Setting this machine up (ADR-0012's journey).** On a local Studio the first screen carries a
|
|
142
|
+
setup card above the prompt — *This machine* — with four steps, from one answer
|
|
143
|
+
(`GET /api/setup`): the **runtime** (tapp and Node versions, python3 and PyYAML for Flow replay,
|
|
144
|
+
disk); **your agent** (every engine found, how it is signed in, Use to choose which drives the
|
|
145
|
+
chat; a *Sign in with ChatGPT* button that runs `codex login --device-auth` and shows the link and
|
|
146
|
+
one-time code until Codex reports a plan, `POST/DELETE /api/engines/codex/sign-in`; and a field for
|
|
147
|
+
an Anthropic API key as the fallback brain, checked against Anthropic's models endpoint, kept 0600
|
|
148
|
+
under `TAPP_HOME/agent/`, shown by its last four characters, handed to Claude Code only when no
|
|
149
|
+
plan is signed in, `POST/DELETE /api/engines/api-key`); **what you'll test** (per target, what
|
|
150
|
+
`tapp doctor --json` found and the exact fix — "Install Xcode from the App Store and open it
|
|
151
|
+
once", "System Settings → Privacy & Security → Accessibility", "Install Android Studio…"); and
|
|
152
|
+
**your account** (the link, optional). It collapses to one line once an agent drives and more
|
|
153
|
+
than one target is ready, and *Check again* re-reads the machine (doctor's answer is reused for
|
|
154
|
+
30 s). The Platforms view says the same thing per platform, and on the right kind of machine
|
|
155
|
+
missing one thing it names the thing — a Mac without Xcode is told to install Xcode, not to
|
|
156
|
+
find a Mac (`platforms.js`). Claude Code's own sign-in opens a browser from a terminal, so the
|
|
157
|
+
card says to run `claude` and sign in, then Check again.
|
|
158
|
+
|
|
159
|
+
**The chat drives the person's own agent (ADR-0012).** On a local Studio, *Your agent* lists the
|
|
160
|
+
coding agents found on this machine — Claude Code, Codex, Gemini CLI — and how each is signed in:
|
|
161
|
+
a plan, an API key that bills per use, or not at all, with the fix (`mcp-server/src/engines.js`;
|
|
162
|
+
`GET/POST /api/engines`). tapp signs nobody in and holds no token. With Claude Code signed in, the
|
|
163
|
+
chat grows an input: a prompt is one `agent` operation on the operator's lane that runs
|
|
164
|
+
`claude -p … --output-format stream-json` with tapp's own MCP server attached and the tapp skill
|
|
165
|
+
appended, allowed `mcp__tapp,Read,Glob,Grep` and nothing that touches the machine; its events
|
|
166
|
+
arrive as chat lines (🤖 its words, 🛠️ the tool it reached for, ⚠️ a tool error, ✅ its answer) and
|
|
167
|
+
the thread continues with `--resume`. Stop (`agent-stop`) sends `SIGINT`. Codex and Gemini are
|
|
168
|
+
reported but do not drive the chat yet. A hosted Studio answers 401 to all of it.
|
|
169
|
+
|
|
123
170
|
**A self-hosted Studio can report to an account (ADR-0011 §4).** Results flow up; the browser
|
|
124
171
|
never reaches down. Under *Your tapp account* on a local Studio, the owner pastes a token created
|
|
125
172
|
on the hosted one (under *Your coding agent*); the local Studio checks it against that Studio,
|
|
@@ -246,3 +293,16 @@ Rules that keep it worth reading:
|
|
|
246
293
|
delivery. Anyone holding the URL can post into that channel.
|
|
247
294
|
- **Public https only.** The post comes from the server, so a webhook on localhost or a private
|
|
248
295
|
range is refused, the same rule the egress proxy enforces for exploration.
|
|
296
|
+
|
|
297
|
+
## Restricted runners: an approved browser (TM-1023)
|
|
298
|
+
|
|
299
|
+
Where the sandbox stops tapp starting Chromium itself (macOS: `bootstrap_check_in …
|
|
300
|
+
MachPortRendezvousServer: Permission denied (1100)`, SIGTRAP), use a browser started outside the
|
|
301
|
+
restriction:
|
|
302
|
+
|
|
303
|
+
- `TAPP_BROWSER_ENDPOINT=http://127.0.0.1:<port>` — tapp attaches to a Chromium already running with
|
|
304
|
+
`--remote-debugging-port=<port>`. Loopback only; refused under `TAPP_ENFORCE_PUBLIC_EGRESS=1`,
|
|
305
|
+
because tapp cannot enforce its proxy on a browser it did not start.
|
|
306
|
+
- `TAPP_BROWSER_EXECUTABLE=/path/to/chrome` — tapp starts that approved binary instead of its own.
|
|
307
|
+
|
|
308
|
+
Both apply to `tapp run`, `tapp look`, explore and audits.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Search Apple's public US software catalog. A listing identifies a possible app.
|
|
2
|
+
// The visitor chooses a publisher's website before the existing audit starts.
|
|
3
|
+
const cache = new Map();
|
|
4
|
+
let searches = [];
|
|
5
|
+
|
|
6
|
+
function website(value) {
|
|
7
|
+
try {
|
|
8
|
+
const url = new URL(value);
|
|
9
|
+
if (["https:", "http:"].includes(url.protocol) && !url.username && !url.password) return url.href;
|
|
10
|
+
} catch { /* Some publishers omit their website. */ }
|
|
11
|
+
return "";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export async function discoverApps(input) {
|
|
15
|
+
const term = String(input).normalize("NFKC").trim();
|
|
16
|
+
if (!term || term.length > 80) return { matches: [], message: "Enter a shorter business name, or enter its website." };
|
|
17
|
+
const key = term.toLowerCase();
|
|
18
|
+
const now = Date.now();
|
|
19
|
+
const cached = cache.get(key);
|
|
20
|
+
if (cached?.until > now) return cached.result;
|
|
21
|
+
searches = searches.filter(time => now - time < 60_000);
|
|
22
|
+
if (searches.length >= 18) return { matches: [], message: "App Store search is busy. Enter the website or try again in a minute." };
|
|
23
|
+
searches.push(now);
|
|
24
|
+
try {
|
|
25
|
+
const url = new URL("https://itunes.apple.com/search");
|
|
26
|
+
url.search = new URLSearchParams({ country: "us", entity: "software", limit: "12", term });
|
|
27
|
+
const response = await fetch(url, { redirect: "error", signal: AbortSignal.timeout(6000) });
|
|
28
|
+
if (!response.ok) throw new Error("Catalog unavailable");
|
|
29
|
+
const { results } = await response.json();
|
|
30
|
+
const matches = results.filter(app => Number.isSafeInteger(app.trackId) && app.trackName &&
|
|
31
|
+
(app.trackName + " " + (app.sellerName || "")).toLowerCase().includes(key)).slice(0, 5).map(app => ({
|
|
32
|
+
name: String(app.trackName), publisher: String(app.sellerName || ""),
|
|
33
|
+
listing: "https://apps.apple.com/us/app/id" + app.trackId, website: website(app.sellerUrl),
|
|
34
|
+
}));
|
|
35
|
+
const result = { matches, message: matches.length ? "Which business did you mean?" : "No matching US App Store listing. Enter the business’s website to continue." };
|
|
36
|
+
if (cache.size >= 200) cache.delete(cache.keys().next().value);
|
|
37
|
+
cache.set(key, { until: now + 600_000, result });
|
|
38
|
+
return result;
|
|
39
|
+
} catch {
|
|
40
|
+
return { matches: [], message: "The App Store search is unavailable. You can still enter the business’s website." };
|
|
41
|
+
}
|
|
42
|
+
}
|