@aarwitz/tapp 0.31.0 → 0.32.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/browser/app.js +44 -1
- package/browser/index.html +4 -0
- package/docs/BROWSER-PRODUCT.md +19 -0
- package/mcp-server/src/alerts.js +97 -0
- package/mcp-server/src/browser-product.js +47 -5
- package/package.json +2 -2
|
@@ -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.32.0",
|
|
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.32.0",
|
|
28
28
|
"mcp"
|
|
29
29
|
],
|
|
30
30
|
"cwd": "${CLAUDE_PROJECT_DIR}"
|
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
|
+
$("#alerts-panel")?.classList.toggle("hidden", !signedIn);
|
|
177
178
|
$("#admin-nav")?.classList.toggle("hidden", !state.session?.admin);
|
|
178
179
|
}
|
|
179
180
|
|
|
@@ -286,6 +287,43 @@ function renderAdmin() {
|
|
|
286
287
|
</section>`;
|
|
287
288
|
}
|
|
288
289
|
|
|
290
|
+
// Being told, rather than having to look. The URL is write-only: once set, the Studio shows
|
|
291
|
+
// which host it points at and when it last delivered, never the URL — anyone holding it can post
|
|
292
|
+
// into that channel.
|
|
293
|
+
async function loadAlerts() {
|
|
294
|
+
if (state.session?.access !== "account") { state.alerts = null; return; }
|
|
295
|
+
state.alerts = await api("/api/alerts").catch(() => null);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function renderAlerts() {
|
|
299
|
+
const node = $("#alerts-body");
|
|
300
|
+
if (!node) return;
|
|
301
|
+
const alerts = state.alerts;
|
|
302
|
+
const delivery = alerts?.lastDelivery;
|
|
303
|
+
const last = delivery
|
|
304
|
+
? `<p class="muted">Last post: ${esc(compactDate(delivery.at))} · ${esc(delivery.journey || "")} · ${delivery.delivered ? "delivered" : `not delivered — ${esc(delivery.reason || "")}`}</p>`
|
|
305
|
+
: "";
|
|
306
|
+
node.innerHTML = alerts?.configured
|
|
307
|
+
? `<div class="actor-row"><span><strong>Posting to ${esc(alerts.host)}</strong><br><small>set ${esc(compactDate(alerts.updatedAt))}</small></span><span></span><span class="journey-actions"><button class="quiet" type="button" data-alert-test>Send a test</button><button class="quiet" type="button" data-alert-clear>Stop</button></span></div>${last}`
|
|
308
|
+
: `<form id="alerts-form" class="signin-row"><input id="alert-webhook" type="url" placeholder="https://hooks.slack.com/services/…" required><button class="primary" type="submit">Save</button></form><p class="muted">tapp posts a test message when you save, so you know it works before anything breaks.</p>${last}`;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
async function saveAlerts(webhook) {
|
|
312
|
+
try {
|
|
313
|
+
state.alerts = await api("/api/alerts", { method: "POST", body: JSON.stringify({ webhook }) });
|
|
314
|
+
renderAlerts();
|
|
315
|
+
toast(webhook ? "Saved — check the channel for the test message." : "Stopped posting.");
|
|
316
|
+
} catch (error) { toast(error.message, true); }
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
async function testAlerts() {
|
|
320
|
+
try {
|
|
321
|
+
state.alerts = await api("/api/alerts/test", { method: "POST", body: "{}" });
|
|
322
|
+
renderAlerts();
|
|
323
|
+
toast("Posted. Check the channel.");
|
|
324
|
+
} catch (error) { toast(error.message, true); }
|
|
325
|
+
}
|
|
326
|
+
|
|
289
327
|
async function loadTokens() {
|
|
290
328
|
if (state.session?.access !== "account") { state.tokens = []; return; }
|
|
291
329
|
state.tokens = (await api("/api/tokens").catch(() => ({ tokens: [] }))).tokens || [];
|
|
@@ -605,6 +643,7 @@ function renderObservations(audit) {
|
|
|
605
643
|
|
|
606
644
|
function renderRuns() {
|
|
607
645
|
renderAdmin();
|
|
646
|
+
renderAlerts();
|
|
608
647
|
renderJourneys();
|
|
609
648
|
renderActors();
|
|
610
649
|
renderTokens();
|
|
@@ -889,7 +928,7 @@ async function refresh() {
|
|
|
889
928
|
state.audits = runs.audits || [];
|
|
890
929
|
state.explores = runs.explores || [];
|
|
891
930
|
state.actors = actors.apps || [];
|
|
892
|
-
await Promise.all([loadJourneys(), loadTokens(), loadAdmin()]);
|
|
931
|
+
await Promise.all([loadJourneys(), loadTokens(), loadAdmin(), loadAlerts()]);
|
|
893
932
|
renderAdmin();
|
|
894
933
|
renderProject();
|
|
895
934
|
return;
|
|
@@ -1074,6 +1113,8 @@ document.addEventListener("submit", (event) => {
|
|
|
1074
1113
|
if (prompt) { event.preventDefault(); startFromPrompt(prompt.elements.input.value).catch((error) => toast(error.message, true)); }
|
|
1075
1114
|
const ask = event.target.closest("#chat-ask");
|
|
1076
1115
|
if (ask) { event.preventDefault(); answerAsk(ask, "submit"); }
|
|
1116
|
+
const alertsForm = event.target.closest("#alerts-form");
|
|
1117
|
+
if (alertsForm) { event.preventDefault(); saveAlerts(alertsForm.elements.webhook?.value || $("#alert-webhook")?.value || ""); }
|
|
1077
1118
|
const signin = event.target.closest("#signin-form");
|
|
1078
1119
|
if (signin) { event.preventDefault(); requestSignInLink(signin.elements.email.value.trim()); }
|
|
1079
1120
|
const keep = event.target.closest("#chat-keep");
|
|
@@ -1096,6 +1137,8 @@ document.addEventListener("click", (event) => {
|
|
|
1096
1137
|
const forgetJ = event.target.closest("[data-forget-journey]");
|
|
1097
1138
|
if (forgetJ) { event.preventDefault(); forgetJourney(forgetJ.dataset.forgetJourney).catch((error) => toast(error.message, true)); }
|
|
1098
1139
|
if (event.target.closest("[data-open-owned]")) { event.preventDefault(); showProduct(); activateView("runs"); renderRuns(); }
|
|
1140
|
+
if (event.target.closest("[data-alert-test]")) { event.preventDefault(); testAlerts(); }
|
|
1141
|
+
if (event.target.closest("[data-alert-clear]")) { event.preventDefault(); saveAlerts(""); }
|
|
1099
1142
|
if (event.target.closest("#create-token")) { event.preventDefault(); createToken(); }
|
|
1100
1143
|
const revoke = event.target.closest("[data-revoke-token]");
|
|
1101
1144
|
if (revoke) { event.preventDefault(); revokeToken(revoke.dataset.revokeToken).catch((error) => toast(error.message, true)); }
|
package/browser/index.html
CHANGED
|
@@ -183,6 +183,10 @@
|
|
|
183
183
|
<div class="section-heading compact"><div><p class="eyebrow">Test accounts</p><h2>What tapp can sign in as <i id="actor-count" class="zero">0</i></h2><p>Kept encrypted. Shown here is only the name and whether a password or a signed-in session is held — never the values. Forget one and tapp will ask again next time.</p></div></div>
|
|
184
184
|
<div id="actors-list"><div class="empty">None yet. Explore a site with a sign-in and tapp will ask.</div></div>
|
|
185
185
|
</section>
|
|
186
|
+
<section class="panel section hidden" id="alerts-panel">
|
|
187
|
+
<div class="section-heading compact"><div><p class="eyebrow">When something breaks</p><h2>Tell me, don't make me look</h2><p>Paste a Slack or Discord webhook (anything that accepts a POST works). tapp posts when a journey <b>stops working</b>, and again when it <b>works again</b> — never on every check.</p></div></div>
|
|
188
|
+
<div id="alerts-body"></div>
|
|
189
|
+
</section>
|
|
186
190
|
<section class="panel section hidden" id="agent-panel">
|
|
187
191
|
<div class="section-heading compact">
|
|
188
192
|
<div><p class="eyebrow">Your coding agent</p><h2>Let your agent check these journeys <i id="token-count" class="zero">0</i></h2><p>A token lets your coding agent ask “is everything still passing?” and replay a journey — as you, without a browser. It is shown once and can be revoked at any time.</p></div>
|
package/docs/BROWSER-PRODUCT.md
CHANGED
|
@@ -181,3 +181,22 @@ committed Flows (subfolders and all) or this machine's kept journeys. The MCP to
|
|
|
181
181
|
two abilities on the existing tools — `tapp_report { journeys: true }` and
|
|
182
182
|
`tapp_run { journey }` — never new tools (ADR-0007). Both are implemented by
|
|
183
183
|
`mcp-server/src/studio-client.js`.
|
|
184
|
+
|
|
185
|
+
## Alerts
|
|
186
|
+
|
|
187
|
+
A kept journey that goes red is only news if someone hears about it. `alerts.js` posts to a
|
|
188
|
+
webhook the owner pastes in (`POST /api/alerts`, `GET` returns a summary, `POST /api/alerts/test`
|
|
189
|
+
sends one on demand) — Slack and Discord both accept the body, which carries `text` and `content`
|
|
190
|
+
plus the journey, state and step counts.
|
|
191
|
+
|
|
192
|
+
Rules that keep it worth reading:
|
|
193
|
+
|
|
194
|
+
- **Only on a change.** `alertForChange` compares the previous result with the new one; a journey
|
|
195
|
+
that has been failing for a week does not produce a message every day, and a first run produces
|
|
196
|
+
none at all because nothing has changed yet.
|
|
197
|
+
- **Proved before promised.** Saving a webhook posts a message to it; if that fails the webhook is
|
|
198
|
+
not saved and the error says why.
|
|
199
|
+
- **Write-only.** The stored URL never leaves the store: the summary gives the host and the last
|
|
200
|
+
delivery. Anyone holding the URL can post into that channel.
|
|
201
|
+
- **Public https only.** The post comes from the server, so a webhook on localhost or a private
|
|
202
|
+
range is refused, the same rule the egress proxy enforces for exploration.
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Telling someone their journey stopped working, without tapp sending email.
|
|
2
|
+
//
|
|
3
|
+
// A monitoring product that only shows you a failure when you happen to open the page is not one.
|
|
4
|
+
// tapp has no mail provider by design (see ADR-0009 slice 2b), so the way out is a webhook: the
|
|
5
|
+
// owner pastes a URL — Slack and Discord both give you one, and so does anything else that can
|
|
6
|
+
// receive a POST — and tapp posts to it when a journey changes state.
|
|
7
|
+
//
|
|
8
|
+
// Only on a CHANGE. A journey that has been failing for a week does not deserve a message every
|
|
9
|
+
// day; what is news is "this used to pass and now it does not", and "it is working again".
|
|
10
|
+
import fs from "node:fs";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
|
|
13
|
+
export const ALERT_EVENTS = Object.freeze(["broke", "recovered"]);
|
|
14
|
+
|
|
15
|
+
/** Did this result change anything worth telling someone about? */
|
|
16
|
+
export function alertForChange({ previous, current }) {
|
|
17
|
+
if (!current) return null;
|
|
18
|
+
// A journey's first run is not news: nothing has changed yet, it has only started.
|
|
19
|
+
if (!previous) return null;
|
|
20
|
+
if (previous.passed === current.passed) return null;
|
|
21
|
+
return current.passed ? "recovered" : "broke";
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** What the message says. Plain words, and never a credential — a journey holds none. */
|
|
25
|
+
export function alertMessage({ kind, journey, status, origin = "" }) {
|
|
26
|
+
const where = origin ? `${origin.replace(/\/$/, "")}/#runs` : "";
|
|
27
|
+
if (kind === "broke") {
|
|
28
|
+
const detail = status.total ? ` It got ${status.executed} of ${status.total} steps in.` : "";
|
|
29
|
+
return {
|
|
30
|
+
text: `❌ “${journey}” stopped working.${detail}${where ? ` Evidence: ${where}` : ""}`,
|
|
31
|
+
journey, state: "failing", at: status.at, executed: status.executed, total: status.total,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
text: `✅ “${journey}” is working again.${where ? ` ${where}` : ""}`,
|
|
36
|
+
journey, state: "passing", at: status.at, executed: status.executed, total: status.total,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Post one message. Slack and Discord both accept a JSON body with `text`/`content`, so send
|
|
42
|
+
* both keys and let the receiver pick; anything else gets the whole thing as JSON anyway.
|
|
43
|
+
*/
|
|
44
|
+
export async function deliverAlert({ webhook, message, fetchImpl = fetch, timeoutMs = 8000 }) {
|
|
45
|
+
if (!webhook) return { delivered: false, reason: "no webhook configured" };
|
|
46
|
+
let url;
|
|
47
|
+
try { url = new URL(webhook); } catch { return { delivered: false, reason: "that is not a URL" }; }
|
|
48
|
+
if (url.protocol !== "https:") return { delivered: false, reason: "a webhook must be https" };
|
|
49
|
+
// The Studio posts this from the server, so the same rule as every other outbound call applies:
|
|
50
|
+
// public addresses only. A webhook pointing at localhost would reach this machine's own services.
|
|
51
|
+
if (/^(localhost|127\.|0\.|10\.|192\.168\.|169\.254\.|\[?::1)/i.test(url.hostname) || /\.local$/i.test(url.hostname)) {
|
|
52
|
+
return { delivered: false, reason: "a webhook must be a public address" };
|
|
53
|
+
}
|
|
54
|
+
const controller = new AbortController();
|
|
55
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
56
|
+
try {
|
|
57
|
+
const response = await fetchImpl(url.href, {
|
|
58
|
+
method: "POST",
|
|
59
|
+
headers: { "content-type": "application/json" },
|
|
60
|
+
body: JSON.stringify({ text: message.text, content: message.text, ...message }),
|
|
61
|
+
signal: controller.signal,
|
|
62
|
+
});
|
|
63
|
+
return response.ok ? { delivered: true, status: response.status } : { delivered: false, reason: `the webhook answered ${response.status}` };
|
|
64
|
+
} catch (error) {
|
|
65
|
+
return { delivered: false, reason: String(error?.name === "AbortError" ? "the webhook did not answer in time" : error.message || error).slice(0, 120) };
|
|
66
|
+
} finally { clearTimeout(timer); }
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Where an account's alert settings live: beside its journeys, 0600, no secret but its own URL. */
|
|
70
|
+
export class AlertStore {
|
|
71
|
+
constructor({ file }) { this.file = file; }
|
|
72
|
+
|
|
73
|
+
static forAccount(accountsRoot, accountId) {
|
|
74
|
+
if (!/^[a-f0-9]{24}$/.test(String(accountId || ""))) throw new Error("Not an account id");
|
|
75
|
+
return new AlertStore({ file: path.join(accountsRoot, "alerts", `${accountId}.json`) });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
read() {
|
|
79
|
+
try { return JSON.parse(fs.readFileSync(this.file, "utf8")); } catch { return { webhook: "", updatedAt: null, lastDelivery: null }; }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
write(settings) {
|
|
83
|
+
const next = { ...this.read(), ...settings, updatedAt: new Date().toISOString() };
|
|
84
|
+
fs.mkdirSync(path.dirname(this.file), { recursive: true, mode: 0o700 });
|
|
85
|
+
fs.writeFileSync(this.file, JSON.stringify(next), { mode: 0o600 });
|
|
86
|
+
return next;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The URL is a secret of sorts — anyone holding it can post into that channel. Show its shape. */
|
|
90
|
+
summary() {
|
|
91
|
+
const settings = this.read();
|
|
92
|
+
if (!settings.webhook) return { configured: false, host: null, updatedAt: null, lastDelivery: settings.lastDelivery || null };
|
|
93
|
+
let host = "a webhook";
|
|
94
|
+
try { host = new URL(settings.webhook).host; } catch { /* keep the generic word */ }
|
|
95
|
+
return { configured: true, host, updatedAt: settings.updatedAt || null, lastDelivery: settings.lastDelivery || null };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -23,6 +23,7 @@ import { createMailer, signInMessage } from "./mailer.js";
|
|
|
23
23
|
import { accessConfig, createAccessVerifier } from "./access-jwt.js";
|
|
24
24
|
import { oauthProviders, oauthAuthorizeUrl, oauthEmailFromCode, isOauthProvider } from "./oauth.js";
|
|
25
25
|
import { journeyFromCapture, JourneyStore, slugify } from "./journeys.js";
|
|
26
|
+
import { AlertStore, alertForChange, alertMessage, deliverAlert } from "./alerts.js";
|
|
26
27
|
|
|
27
28
|
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
28
29
|
const assetRoot = path.join(packageRoot, "browser");
|
|
@@ -158,7 +159,9 @@ function anonymousAllows(method, pathname) {
|
|
|
158
159
|
function accountAllows(method, pathname) {
|
|
159
160
|
if (anonymousAllows(method, pathname)) return true;
|
|
160
161
|
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" || pathname === "/api/admin/overview")) return true;
|
|
162
|
+
if (method === "GET" && (pathname === "/api/actors" || pathname === "/api/journeys" || pathname === "/api/tokens" || pathname === "/api/admin/overview" || pathname === "/api/alerts")) return true;
|
|
163
|
+
// Where to be told that a journey stopped working.
|
|
164
|
+
if (method === "POST" && (pathname === "/api/alerts" || pathname === "/api/alerts/test")) return true;
|
|
162
165
|
// Personal access tokens: the owner's coding agent acting as them (ADR-0009 slice 4).
|
|
163
166
|
if (method === "POST" && pathname === "/api/tokens") return true;
|
|
164
167
|
if (method === "DELETE" && /^\/api\/tokens\/[a-f0-9]{12}$/.test(pathname)) return true;
|
|
@@ -281,7 +284,7 @@ export function journeySignInPlan(flow = {}) {
|
|
|
281
284
|
|
|
282
285
|
// Replay one web journey and record how it went. Shared by the Studio's Run button and the
|
|
283
286
|
// daily check, so both leave the same status and the same evidence behind.
|
|
284
|
-
async function replayJourney({ store, slug, flow, actorRoot = "", ownerKey = null, progress = () => {} }) {
|
|
287
|
+
async function replayJourney({ store, slug, flow, actorRoot = "", ownerKey = null, progress = () => {}, alerts = null, origin = "" }) {
|
|
285
288
|
// A journey that signs in does so as the test account tapp was told about for that site: the
|
|
286
289
|
// values come from the encrypted actor store at replay and never from the file.
|
|
287
290
|
const variables = {};
|
|
@@ -329,8 +332,19 @@ async function replayJourney({ store, slug, flow, actorRoot = "", ownerKey = nul
|
|
|
329
332
|
if (/^OCQA_(FLOW_RESULT|ISSUE):/.test(raw)) continue;
|
|
330
333
|
if (raw) progress({ phase: "replay", text: raw });
|
|
331
334
|
}
|
|
335
|
+
// Read the old result before writing the new one: the news is the change, not the state.
|
|
336
|
+
const previous = store.status(slug);
|
|
332
337
|
const status = store.recordRun(slug, { passed: result.passed, captureId, executed: result.executed, total: result.total, failed: result.failed });
|
|
333
|
-
|
|
338
|
+
const change = alertForChange({ previous, current: status });
|
|
339
|
+
let alert = null;
|
|
340
|
+
if (change && alerts) {
|
|
341
|
+
const settings = alerts.read();
|
|
342
|
+
if (settings.webhook) {
|
|
343
|
+
alert = await deliverAlert({ webhook: settings.webhook, message: alertMessage({ kind: change, journey: flow.name || slug, status, origin }) });
|
|
344
|
+
alerts.write({ lastDelivery: { at: new Date().toISOString(), journey: flow.name || slug, change, ...alert } });
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return { kind: "journey", name: flow.name || slug, slug, passed: result.passed, executed: result.executed, total: result.total, failed: result.failed, status, change, ...(alert ? { alert } : {}), capture: { id: captureId, path: evidenceDir } };
|
|
334
348
|
}
|
|
335
349
|
|
|
336
350
|
// "Make sure this always works": kept journeys on a public Studio are replayed on a schedule,
|
|
@@ -719,7 +733,7 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
719
733
|
try { const { loadFlowFile } = await import("./flow-runtime.js"); flow = loadFlowFile(flowPath); } catch { continue; }
|
|
720
734
|
let job;
|
|
721
735
|
try {
|
|
722
|
-
job = startJob("check-journey", (progress) => replayJourney({ store, slug: journey.slug, flow, actorRoot: accounts.actorRoot(accountId), ownerKey, progress }), null, { lane: ownerKey });
|
|
736
|
+
job = startJob("check-journey", (progress) => replayJourney({ store, slug: journey.slug, flow, actorRoot: accounts.actorRoot(accountId), ownerKey, progress, alerts: AlertStore.forAccount(accounts.root, accountId), origin: publicOrigins[0] || "" }), null, { lane: ownerKey });
|
|
723
737
|
} catch { continue; /* the owner is busy; next tick */ }
|
|
724
738
|
job.ownerKey = ownerKey;
|
|
725
739
|
// One at a time per owner: wait for this check before starting the next.
|
|
@@ -1183,6 +1197,34 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
1183
1197
|
});
|
|
1184
1198
|
return;
|
|
1185
1199
|
}
|
|
1200
|
+
// Where to be told when something breaks. The URL is write-only here: the summary says
|
|
1201
|
+
// which host it points at and when it last delivered, never the URL itself, because anyone
|
|
1202
|
+
// holding it can post into that channel.
|
|
1203
|
+
if (account && url.pathname === "/api/alerts") {
|
|
1204
|
+
const alerts = AlertStore.forAccount(accounts.root, account.id);
|
|
1205
|
+
if (request.method === "GET") { json(response, 200, alerts.summary()); return; }
|
|
1206
|
+
guardMutation(request);
|
|
1207
|
+
const body = await readJsonBody(request);
|
|
1208
|
+
const webhook = String(body.webhook || "").trim();
|
|
1209
|
+
if (webhook) {
|
|
1210
|
+
const probe = await deliverAlert({ webhook, message: alertMessage({ kind: "recovered", journey: "tapp alerts", status: { at: new Date().toISOString(), executed: 0, total: 0 }, origin: publicOrigins[0] || "" }) });
|
|
1211
|
+
if (!probe.delivered) { json(response, 400, { error: `tapp could not post there — ${probe.reason}.` }); return; }
|
|
1212
|
+
}
|
|
1213
|
+
alerts.write({ webhook });
|
|
1214
|
+
logUsage("alerts.set", { account: account.id.slice(0, 8), configured: !!webhook });
|
|
1215
|
+
json(response, 200, alerts.summary());
|
|
1216
|
+
return;
|
|
1217
|
+
}
|
|
1218
|
+
if (account && url.pathname === "/api/alerts/test" && request.method === "POST") {
|
|
1219
|
+
guardMutation(request);
|
|
1220
|
+
const alerts = AlertStore.forAccount(accounts.root, account.id);
|
|
1221
|
+
const settings = alerts.read();
|
|
1222
|
+
if (!settings.webhook) { json(response, 400, { error: "There is nowhere to send it yet." }); return; }
|
|
1223
|
+
const sent = await deliverAlert({ webhook: settings.webhook, message: alertMessage({ kind: "broke", journey: "a test from tapp", status: { at: new Date().toISOString(), executed: 3, total: 7 }, origin: publicOrigins[0] || "" }) });
|
|
1224
|
+
alerts.write({ lastDelivery: { at: new Date().toISOString(), journey: "a test from tapp", change: "test", ...sent } });
|
|
1225
|
+
json(response, sent.delivered ? 200 : 400, sent.delivered ? alerts.summary() : { error: `tapp could not post there — ${sent.reason}.` });
|
|
1226
|
+
return;
|
|
1227
|
+
}
|
|
1186
1228
|
if (account && url.pathname === "/api/tokens" && request.method === "GET") {
|
|
1187
1229
|
json(response, 200, { tokens: accounts.listTokens(account.id) });
|
|
1188
1230
|
return;
|
|
@@ -1468,7 +1510,7 @@ export async function startBrowserProduct({ projectDir, port = 0, launch = false
|
|
|
1468
1510
|
}
|
|
1469
1511
|
const slug = root ? name : slugify(name);
|
|
1470
1512
|
const job = startJob(operation, async (progress) => {
|
|
1471
|
-
const result = await replayJourney({ store, slug, flow, actorRoot: actorRootFor() || "", ownerKey, progress });
|
|
1513
|
+
const result = await replayJourney({ store, slug, flow, actorRoot: actorRootFor() || "", ownerKey, progress, alerts: account ? AlertStore.forAccount(accounts.root, account.id) : null, origin: publicOrigins[0] || "" });
|
|
1472
1514
|
logUsage("journey.run", { owner: (ownerKey || "operator").slice(0, 13), passed: result.passed });
|
|
1473
1515
|
return result;
|
|
1474
1516
|
}, null, { lane: ownerKey || OPERATOR_LANE });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aarwitz/tapp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.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-overlay.test.js tests/web-audit.test.js tests/page-observations.test.js tests/capture-provenance.test.js tests/capture-frames.test.js tests/actor-store.test.js tests/account-store.test.js tests/access-jwt.test.js tests/oauth.test.js tests/studio-client.test.js tests/journeys.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-overlay.test.js tests/web-audit.test.js tests/page-observations.test.js tests/capture-provenance.test.js tests/capture-frames.test.js tests/actor-store.test.js tests/account-store.test.js tests/alerts.test.js tests/access-jwt.test.js tests/oauth.test.js tests/studio-client.test.js tests/journeys.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
|
}
|