@aarwitz/tapp 0.29.2 → 0.30.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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tapp",
|
|
3
3
|
"description": "Give Claude hands and eyes on iOS, Android, and web apps, with exploration, replayable flows, evidence, and deterministic CI gates.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.30.1",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Aaron Horowitz",
|
|
7
7
|
"url": "https://github.com/aarwitz"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"command": "npx",
|
|
25
25
|
"args": [
|
|
26
26
|
"-y",
|
|
27
|
-
"@aarwitz/tapp@0.
|
|
27
|
+
"@aarwitz/tapp@0.30.1",
|
|
28
28
|
"mcp"
|
|
29
29
|
],
|
|
30
30
|
"cwd": "${CLAUDE_PROJECT_DIR}"
|
package/browser/app.css
CHANGED
|
@@ -604,3 +604,5 @@ dialog::backdrop { background:rgba(0,0,0,.6); }
|
|
|
604
604
|
.signin-provider.google { background:#fff; color:#1f2328; border-color:#dadce0; }
|
|
605
605
|
.signin-or { display:flex; align-items:center; gap:10px; color:var(--muted); font-size:12px; margin:4px 0 2px; }
|
|
606
606
|
.signin-or::before, .signin-or::after { content:""; flex:1; height:1px; background:var(--line); }
|
|
607
|
+
.run-stats .bad strong { color:#f87171; }
|
|
608
|
+
#admin-body .actor-row { grid-template-columns: 1.5fr 1fr 1fr; }
|
package/browser/app.js
CHANGED
|
@@ -174,6 +174,7 @@ function applyAccessMode() {
|
|
|
174
174
|
$("#actors-panel")?.classList.toggle("hidden", !signedIn);
|
|
175
175
|
$("#journeys-panel")?.classList.toggle("hidden", !signedIn);
|
|
176
176
|
$("#agent-panel")?.classList.toggle("hidden", !signedIn);
|
|
177
|
+
$("#admin-nav")?.classList.toggle("hidden", !state.session?.admin);
|
|
177
178
|
}
|
|
178
179
|
|
|
179
180
|
// The test accounts tapp holds, by application — names and what is held, never a value.
|
|
@@ -209,6 +210,42 @@ export TAPP_TOKEN=${esc(state.newToken.token)}</code>
|
|
|
209
210
|
node.innerHTML = reveal + rows;
|
|
210
211
|
}
|
|
211
212
|
|
|
213
|
+
// The owner's view of their own deployment: who signed up, what is failing, how it is being used.
|
|
214
|
+
async function loadAdmin() {
|
|
215
|
+
if (!state.session?.admin) { state.admin = null; return; }
|
|
216
|
+
state.admin = await api("/api/admin/overview").catch(() => null);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function renderAdmin() {
|
|
220
|
+
$("#admin-nav")?.classList.toggle("hidden", !state.session?.admin);
|
|
221
|
+
const node = $("#admin-body");
|
|
222
|
+
if (!node) return;
|
|
223
|
+
const data = state.admin;
|
|
224
|
+
if (!data) { node.innerHTML = '<div class="empty">Nothing to show yet.</div>'; return; }
|
|
225
|
+
const totals = data.accounts.reduce((sum, account) => ({
|
|
226
|
+
journeys: sum.journeys + account.journeys, failing: sum.failing + account.failing,
|
|
227
|
+
}), { journeys: 0, failing: 0 });
|
|
228
|
+
const stat = (value, label, tone = "") => `<div class="${esc(tone)}"><strong>${esc(String(value))}</strong><small>${esc(label)}</small></div>`;
|
|
229
|
+
const owner = (email) => (data.admins || []).includes(String(email).toLowerCase());
|
|
230
|
+
node.innerHTML = `
|
|
231
|
+
<section class="panel section">
|
|
232
|
+
<div class="section-heading compact"><div><p class="eyebrow">Right now</p><h2>How tapp is being used</h2><p>Since this release started. A visitor is counted only when they ask for something the Studio offers — scanners are not people.</p></div></div>
|
|
233
|
+
<div class="run-stats">
|
|
234
|
+
${stat(data.accounts.length, "accounts")}
|
|
235
|
+
${stat(totals.journeys, "journeys")}
|
|
236
|
+
${stat(totals.failing, "failing", totals.failing ? "bad" : "")}
|
|
237
|
+
${stat(data.usage.distinctVisitors, "visitors")}
|
|
238
|
+
${stat(data.usage.audits, "audits")}
|
|
239
|
+
${stat(data.runs.captures, "runs kept")}
|
|
240
|
+
</div>
|
|
241
|
+
<p class="muted">Release <code>${esc(data.release)}</code> · up since ${esc(compactDate(data.startedAt))} · sign-in via <b>${esc(data.signInProvider)}</b> · kept journeys re-checked every ${esc(String(data.journeyCheckHours))}h · ${esc(String(data.usage.refusals))} refused requests, mostly automated probes.</p>
|
|
242
|
+
</section>
|
|
243
|
+
<section class="panel section">
|
|
244
|
+
<div class="section-heading compact"><div><p class="eyebrow">People</p><h2>Accounts <i class="zero">${data.accounts.length}</i></h2><p>What each person has set up. Test accounts are counted, never shown — tapp cannot show them.</p></div></div>
|
|
245
|
+
${data.accounts.length ? data.accounts.map((account) => `<div class="actor-row"><span><strong>${esc(account.email)}</strong>${owner(account.email) ? ' <small class="journey-status passing">owner</small>' : ""}<br><small>joined ${esc(compactDate(account.createdAt))}${account.lastSeenAt ? ` · last seen ${esc(compactDate(account.lastSeenAt))}` : ""}</small></span><span><small>${account.journeys} journey${account.journeys === 1 ? "" : "s"}${account.failing ? ` · <b class="journey-status failing">${account.failing} failing</b>` : ""}${account.neverRun ? ` · ${account.neverRun} never run` : ""}</small></span><span><small>${account.testAccounts} test account${account.testAccounts === 1 ? "" : "s"} · ${account.tokens} token${account.tokens === 1 ? "" : "s"}</small></span></div>`).join("") : '<div class="empty">Nobody has signed in yet.</div>'}
|
|
246
|
+
</section>`;
|
|
247
|
+
}
|
|
248
|
+
|
|
212
249
|
async function loadTokens() {
|
|
213
250
|
if (state.session?.access !== "account") { state.tokens = []; return; }
|
|
214
251
|
state.tokens = (await api("/api/tokens").catch(() => ({ tokens: [] }))).tokens || [];
|
|
@@ -527,6 +564,7 @@ function renderObservations(audit) {
|
|
|
527
564
|
}
|
|
528
565
|
|
|
529
566
|
function renderRuns() {
|
|
567
|
+
renderAdmin();
|
|
530
568
|
renderJourneys();
|
|
531
569
|
renderActors();
|
|
532
570
|
renderTokens();
|
|
@@ -811,7 +849,8 @@ async function refresh() {
|
|
|
811
849
|
state.audits = runs.audits || [];
|
|
812
850
|
state.explores = runs.explores || [];
|
|
813
851
|
state.actors = actors.apps || [];
|
|
814
|
-
await Promise.all([loadJourneys(), loadTokens()]);
|
|
852
|
+
await Promise.all([loadJourneys(), loadTokens(), loadAdmin()]);
|
|
853
|
+
renderAdmin();
|
|
815
854
|
renderProject();
|
|
816
855
|
return;
|
|
817
856
|
}
|
|
@@ -1083,6 +1122,12 @@ try {
|
|
|
1083
1122
|
if (window.location.hash === "#runs" && (state.journeys?.length || state.audits?.length || state.explores?.length)) {
|
|
1084
1123
|
showProduct(); activateView("runs"); renderRuns();
|
|
1085
1124
|
}
|
|
1125
|
+
// admin.runtapp.com redirects to /admin: open the owner's view, or say plainly why it is not here.
|
|
1126
|
+
if (window.location.pathname === "/admin") {
|
|
1127
|
+
if (state.session?.admin) { showProduct(); activateView("admin"); renderAdmin(); }
|
|
1128
|
+
else if (state.session?.access === "anonymous") { state.signInOpen = true; renderAccount(); showPrompt(); }
|
|
1129
|
+
else toast("That account is not an owner of this deployment.", true);
|
|
1130
|
+
}
|
|
1086
1131
|
|
|
1087
1132
|
const handoff = handoffTarget();
|
|
1088
1133
|
if (handoff) {
|
package/browser/index.html
CHANGED
|
@@ -89,6 +89,7 @@
|
|
|
89
89
|
<nav class="primary-nav" aria-label="Product navigation">
|
|
90
90
|
<button data-view="overview" class="active"><span><svg><use href="#i-grid"/></svg></span>Overview</button>
|
|
91
91
|
<button data-view="runs"><span><svg><use href="#i-play"/></svg></span>Runs <i id="run-count" class="zero">0</i></button>
|
|
92
|
+
<button data-view="admin" id="admin-nav" class="hidden"><span><svg><use href="#i-grid"/></svg></span>Admin</button>
|
|
92
93
|
</nav>
|
|
93
94
|
<div class="sidebar-project">
|
|
94
95
|
<p class="eyebrow">Project</p>
|
|
@@ -165,6 +166,10 @@
|
|
|
165
166
|
</section>
|
|
166
167
|
</section>
|
|
167
168
|
|
|
169
|
+
<section class="workspace-view" data-view-panel="admin">
|
|
170
|
+
<div class="command-bar"><div><h1>Admin</h1><p>Everything this deployment knows about itself. Never a credential — those are encrypted and are not decrypted to be looked at.</p></div></div>
|
|
171
|
+
<div id="admin-body"><div class="empty">Loading…</div></div>
|
|
172
|
+
</section>
|
|
168
173
|
<section class="workspace-view" data-view-panel="runs">
|
|
169
174
|
<div class="view-heading simple"><div><p class="eyebrow">Runs</p><h1>Every run, with its evidence</h1><p>Release checks, explorations and read-only website audits. Each opens the report page the engine wrote.</p></div><button class="primary" id="run-gate" data-repo-only>Run release gate</button></div>
|
|
170
175
|
<section class="panel section audit-panel">
|
|
@@ -13,6 +13,9 @@ export const customerProductContract = Object.freeze({
|
|
|
13
13
|
views: [
|
|
14
14
|
{ id: "overview", label: "Overview", capabilities: ["target-selection", "release-check", "live-feed", "progress-transcript", "live-session", "flow-recording", "latest-evidence"] },
|
|
15
15
|
{ id: "runs", label: "Runs", capabilities: ["run-history", "run-detail", "evidence-page", "website-audit"] },
|
|
16
|
+
// Only an owner of this deployment ever sees this one (TAPP_ADMIN_EMAILS); to anybody else
|
|
17
|
+
// the nav item is absent and the route is a 404.
|
|
18
|
+
{ id: "admin", label: "Admin", capabilities: ["deployment-usage", "account-list"] },
|
|
16
19
|
],
|
|
17
20
|
operations: ["initialize", "session-start", "session-act", "session-save-flow", "session-end", "gate", "audit"],
|
|
18
21
|
invariants: [
|
|
@@ -21,5 +24,6 @@ export const customerProductContract = Object.freeze({
|
|
|
21
24
|
"A website audit is read-only: nothing is clicked, typed, submitted, or hovered.",
|
|
22
25
|
"Repositories are opened from the machine the Studio runs on; nothing is uploaded or cloned by the Studio.",
|
|
23
26
|
"Deterministic replay and ordinary merge decisions are keyless.",
|
|
27
|
+
"The admin view reports counts about this deployment; credentials are encrypted and are never decrypted to be shown.",
|
|
24
28
|
],
|
|
25
29
|
});
|
|
@@ -132,7 +132,7 @@ const OAUTH_STATE_COOKIE = "tapp_oauth_state";
|
|
|
132
132
|
// refused, so a new route is private until someone deliberately opens it.
|
|
133
133
|
function anonymousAllows(method, pathname) {
|
|
134
134
|
if (method === "GET") {
|
|
135
|
-
if (pathname === "/" || pathname === "/api/version" || pathname === "/api/session" || pathname === "/api/audits") return true;
|
|
135
|
+
if (pathname === "/" || pathname === "/admin" || pathname === "/api/version" || pathname === "/api/session" || pathname === "/api/audits") return true;
|
|
136
136
|
if (pathname.startsWith("/assets/")) return true;
|
|
137
137
|
if (/^\/api\/captures\/[A-Za-z0-9._-]{1,128}\/files$/.test(pathname)) return true;
|
|
138
138
|
if (/^\/evidence\/captures\//.test(pathname)) return true;
|
|
@@ -158,7 +158,7 @@ function anonymousAllows(method, pathname) {
|
|
|
158
158
|
function accountAllows(method, pathname) {
|
|
159
159
|
if (anonymousAllows(method, pathname)) return true;
|
|
160
160
|
if (method === "POST" && (pathname === "/api/auth/signout" || /^\/api\/jobs\/[a-f0-9]{20}\/input$/.test(pathname))) return true;
|
|
161
|
-
if (method === "GET" && (pathname === "/api/actors" || pathname === "/api/journeys" || pathname === "/api/tokens")) return true;
|
|
161
|
+
if (method === "GET" && (pathname === "/api/actors" || pathname === "/api/journeys" || pathname === "/api/tokens" || pathname === "/api/admin/overview")) return true;
|
|
162
162
|
// Personal access tokens: the owner's coding agent acting as them (ADR-0009 slice 4).
|
|
163
163
|
if (method === "POST" && pathname === "/api/tokens") return true;
|
|
164
164
|
if (method === "DELETE" && /^\/api\/tokens\/[a-f0-9]{12}$/.test(pathname)) return true;
|
|
@@ -583,6 +583,10 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
583
583
|
// What this deployment can actually offer, in the order the sign-in card shows them. A button
|
|
584
584
|
// with no client id behind it is never rendered.
|
|
585
585
|
const oauth = publicAccess ? oauthProviders() : [];
|
|
586
|
+
// Who owns this deployment. An admin is an ordinary account whose address is on this list —
|
|
587
|
+
// there is no second login, no separate site, and no password anywhere.
|
|
588
|
+
const adminEmails = new Set(String(process.env.TAPP_ADMIN_EMAILS || "").split(",").map((value) => value.trim().toLowerCase()).filter(Boolean));
|
|
589
|
+
const isAdmin = (account) => !!account && adminEmails.has(String(account.email || "").toLowerCase());
|
|
586
590
|
const signInProvider = oauth.length ? "oauth" : access ? "cloudflare" : "email";
|
|
587
591
|
// Cloudflare Access was the stopgap before "Continue with Google" existed. Where a provider is
|
|
588
592
|
// configured it stops being offered — two doors into the same account only invites the question
|
|
@@ -845,7 +849,9 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
845
849
|
}
|
|
846
850
|
if (!authenticated && !anonymous && !account) { response.writeHead(401, { "content-type": "text/plain; charset=utf-8" }); response.end(directLogin ? "Sign in at /login to continue." : "Open Tapp from the authenticated launch URL printed by the CLI."); return; }
|
|
847
851
|
|
|
848
|
-
|
|
852
|
+
// /admin is the owner's bookmark (admin.runtapp.com redirects here). It serves the same
|
|
853
|
+
// page; the Studio opens the Admin view, and the view only exists for an owner.
|
|
854
|
+
if (request.method === "GET" && (url.pathname === "/" || url.pathname === "/admin")) {
|
|
849
855
|
// Without a sign-in page there is nowhere to bounce an anonymous visitor to, and a
|
|
850
856
|
// loginUrl would send them in a loop on their first privileged 401.
|
|
851
857
|
serveBrowserIndex(response, hosted
|
|
@@ -1062,6 +1068,57 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
1062
1068
|
}
|
|
1063
1069
|
// Agent access. A token is issued only to a person at the keyboard: an agent holding a
|
|
1064
1070
|
// token cannot mint itself another one, so a leaked token cannot outlive its revocation.
|
|
1071
|
+
// What the owner of this deployment can see: how it is being used, who has an account, and
|
|
1072
|
+
// which journeys are failing. Never a credential — they are encrypted and never decrypted
|
|
1073
|
+
// for display — and never anyone's evidence.
|
|
1074
|
+
if (account && isAdmin(account) && request.method === "GET" && url.pathname === "/api/admin/overview") {
|
|
1075
|
+
const accountsRoot = accounts.root;
|
|
1076
|
+
const listAccounts = () => {
|
|
1077
|
+
let files = [];
|
|
1078
|
+
try { files = fs.readdirSync(path.join(accountsRoot, "accounts")).filter((name) => name.endsWith(".json")); } catch { return []; }
|
|
1079
|
+
return files.map((name) => {
|
|
1080
|
+
let record = null;
|
|
1081
|
+
try { record = JSON.parse(fs.readFileSync(path.join(accountsRoot, "accounts", name), "utf8")); } catch { return null; }
|
|
1082
|
+
if (!record) return null;
|
|
1083
|
+
const journeys = JourneyStore.forAccount(record.id).list();
|
|
1084
|
+
let actors = 0;
|
|
1085
|
+
try {
|
|
1086
|
+
const actorRoot = accounts.actorRoot(record.id);
|
|
1087
|
+
for (const host of fs.readdirSync(actorRoot, { withFileTypes: true }).filter((d) => d.isDirectory())) {
|
|
1088
|
+
actors += fs.readdirSync(path.join(actorRoot, host.name)).filter((f) => f.endsWith(".json")).length;
|
|
1089
|
+
}
|
|
1090
|
+
} catch { /* none yet */ }
|
|
1091
|
+
return {
|
|
1092
|
+
email: record.email, createdAt: record.createdAt, lastSeenAt: record.lastSeenAt || null,
|
|
1093
|
+
journeys: journeys.length,
|
|
1094
|
+
failing: journeys.filter((j) => j.status && !j.status.passed).length,
|
|
1095
|
+
neverRun: journeys.filter((j) => !j.status).length,
|
|
1096
|
+
testAccounts: actors,
|
|
1097
|
+
tokens: accounts.listTokens(record.id).length,
|
|
1098
|
+
};
|
|
1099
|
+
}).filter(Boolean).sort((a, b) => String(b.lastSeenAt || "").localeCompare(String(a.lastSeenAt || "")));
|
|
1100
|
+
};
|
|
1101
|
+
let captureCount = 0;
|
|
1102
|
+
let auditCount = 0;
|
|
1103
|
+
try {
|
|
1104
|
+
for (const name of fs.readdirSync(captureRoot())) {
|
|
1105
|
+
captureCount += 1;
|
|
1106
|
+
if (name.startsWith("web-audit-")) auditCount += 1;
|
|
1107
|
+
}
|
|
1108
|
+
} catch { /* none yet */ }
|
|
1109
|
+
const owners = listAccounts();
|
|
1110
|
+
json(response, 200, {
|
|
1111
|
+
release: process.env.TAPP_RELEASE || "dev",
|
|
1112
|
+
startedAt: serverStartedAt,
|
|
1113
|
+
signInProvider,
|
|
1114
|
+
usage: { sinceStart: usage.startedAt, distinctVisitors: usage.visitors.size, audits: usage.audits, refusals: usage.refusals },
|
|
1115
|
+
runs: { captures: captureCount, audits: auditCount, explorations: captureCount - auditCount },
|
|
1116
|
+
accounts: owners,
|
|
1117
|
+
journeyCheckHours: Math.max(1, Number(process.env.TAPP_JOURNEY_CHECK_HOURS) || 24),
|
|
1118
|
+
admins: [...adminEmails],
|
|
1119
|
+
});
|
|
1120
|
+
return;
|
|
1121
|
+
}
|
|
1065
1122
|
if (account && url.pathname === "/api/tokens" && request.method === "GET") {
|
|
1066
1123
|
json(response, 200, { tokens: accounts.listTokens(account.id) });
|
|
1067
1124
|
return;
|
|
@@ -1088,7 +1145,7 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
1088
1145
|
json(response, 200, {
|
|
1089
1146
|
csrfToken, mode: "public", product: "Tapp", root: null, repository: null, repositories: [],
|
|
1090
1147
|
contract: customerProductContract, supportedPlatforms: ["web"], runners: [],
|
|
1091
|
-
access: "account", email: account.email, signInProvider, signInOptions, viaToken,
|
|
1148
|
+
access: "account", email: account.email, signInProvider, signInOptions, viaToken, admin: isAdmin(account),
|
|
1092
1149
|
accepts: ["url"],
|
|
1093
1150
|
selfHostOnly: ["path", "github", "bundle", "app", "apk"],
|
|
1094
1151
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aarwitz/tapp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.1",
|
|
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",
|