@aarwitz/tapp 0.18.2 → 0.18.4
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 +289 -60
- package/browser/app.js +209 -106
- package/browser/index.html +53 -54
- package/browser/product-contract.js +1 -1
- package/browser/view-model.js +87 -0
- package/docs/BROWSER-PRODUCT.md +28 -11
- package/mcp-server/src/browser-product.js +115 -2
- package/mcp-server/src/html-report.js +1 -1
- package/mcp-server/src/index.js +4 -0
- package/package.json +2 -2
package/browser/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { customerProductContract } from "./product-contract.js";
|
|
2
|
-
import { operationIsPending } from "./view-model.js";
|
|
2
|
+
import { classifyPrompt, narrate, narrateFinding, operationIsPending, summarize } from "./view-model.js";
|
|
3
3
|
|
|
4
4
|
const API_BASE = String(document.querySelector('meta[name="tapp-api-base"]')?.content || "").replace(/\/$/, "");
|
|
5
5
|
const LOGIN_URL = String(document.querySelector('meta[name="tapp-login-url"]')?.content || "");
|
|
@@ -11,14 +11,16 @@ function apiRoute(route) {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
const state = {
|
|
14
|
-
csrf: "", session: null, project: null, audits: [], activeJob: null, activeView: "overview",
|
|
14
|
+
csrf: "", session: null, project: null, audits: [], explores: [], activeJob: null, activeView: "overview",
|
|
15
15
|
selectedTargetId: "", selectedRunId: "", live: { active:false }, transcript: [], transcriptSource: "", frameTimer: null,
|
|
16
|
+
chatCollapsed: false, shotScreens: new Set(), lastShotAt: 0,
|
|
16
17
|
};
|
|
17
18
|
const $ = (selector) => document.querySelector(selector);
|
|
18
19
|
const $$ = (selector) => [...document.querySelectorAll(selector)];
|
|
19
20
|
const esc = (value) => String(value ?? "").replace(/[&<>"']/g, (character) => ({ "&":"&", "<":"<", ">":">", '"':""", "'":"'" }[character]));
|
|
20
21
|
const pretty = (value) => String(value || "").replaceAll("_", " ").replaceAll("-", " ").replace(/\b\w/g, (letter) => letter.toUpperCase());
|
|
21
22
|
const compactDate = (value) => value ? new Intl.DateTimeFormat(undefined, { month:"short", day:"numeric", hour:"numeric", minute:"2-digit" }).format(new Date(value)) : "—";
|
|
23
|
+
const chatTime = (value) => new Intl.DateTimeFormat(undefined, { hour:"numeric", minute:"2-digit" }).format(new Date(value));
|
|
22
24
|
|
|
23
25
|
function toast(message, error = false) {
|
|
24
26
|
const node = $("#toast");
|
|
@@ -49,14 +51,16 @@ function captureId(report) {
|
|
|
49
51
|
}
|
|
50
52
|
return report?.capture?.id || "";
|
|
51
53
|
}
|
|
52
|
-
|
|
54
|
+
const captureUrl = (id, file = "report.html") => apiRoute(`/evidence/captures/${encodeURIComponent(id)}/${file}`);
|
|
53
55
|
function evidenceLink(id, label = "Open visual evidence") {
|
|
54
|
-
return id ? `<a class="button-link" href="${esc(
|
|
56
|
+
return id ? `<a class="button-link" href="${esc(captureUrl(id))}" target="_blank" rel="noreferrer">${esc(label)}</a>` : "";
|
|
55
57
|
}
|
|
56
58
|
function reportLink(report, label) { return evidenceLink(captureId(report), label); }
|
|
57
59
|
|
|
58
60
|
function currentTarget() { return (state.project?.targets || []).find((target) => target.id === state.selectedTargetId) || null; }
|
|
59
61
|
function targetStorageKey() { return `tapp:selected-target:${state.project?.repository?.id || "none"}`; }
|
|
62
|
+
// A run started from the prompt is on its own platform, whatever repository happens to be open.
|
|
63
|
+
function currentPlatform() { return state.live?.active ? state.live.platform : (state.promptRun && state.promptPlatform) || currentTarget()?.platform || state.promptPlatform || ""; }
|
|
60
64
|
|
|
61
65
|
function chooseDefaultTarget() {
|
|
62
66
|
const targets = state.project?.targets || [];
|
|
@@ -84,9 +88,10 @@ function activateView(view) {
|
|
|
84
88
|
window.scrollTo({ top:0, behavior:"instant" });
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
function
|
|
91
|
+
function showPrompt() {
|
|
88
92
|
$("#source-onboarding").classList.remove("hidden");
|
|
89
93
|
$("#product-shell").classList.add("hidden");
|
|
94
|
+
setTimeout(() => $("#prompt-input")?.focus(), 50);
|
|
90
95
|
}
|
|
91
96
|
|
|
92
97
|
function showProduct() {
|
|
@@ -133,7 +138,7 @@ function renderTargets() {
|
|
|
133
138
|
const appId = target?.runtime?.bundleId || target?.runtime?.applicationId || target?.build?.bundleId || "";
|
|
134
139
|
$("#sidebar-app-row").classList.toggle("hidden", !appId);
|
|
135
140
|
$("#sidebar-app-id").textContent = appId;
|
|
136
|
-
renderDeviceChrome(
|
|
141
|
+
renderDeviceChrome();
|
|
137
142
|
$("#runtime-row").classList.toggle("hidden", !targets.length);
|
|
138
143
|
$("#serial-field").classList.toggle("hidden", target?.platform !== "android");
|
|
139
144
|
$("#explore").disabled = !target;
|
|
@@ -147,14 +152,17 @@ function renderTargets() {
|
|
|
147
152
|
: "Builds and starts the selected repository web application, then explores it in Chromium.";
|
|
148
153
|
}
|
|
149
154
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
$("#device-
|
|
155
|
+
// The device frame takes the platform's real shape: a phone is tall, a browser is wide. The stage
|
|
156
|
+
// gives it every pixel it can, so the frame class drives the aspect ratio and the stage the size.
|
|
157
|
+
function renderDeviceChrome() {
|
|
158
|
+
const platform = currentPlatform();
|
|
159
|
+
const target = currentTarget();
|
|
160
|
+
$("#device-frame").className = `device-frame ${platform || "ios"}`;
|
|
161
|
+
$("#stage").className = `stage ${platform || "ios"}`;
|
|
162
|
+
$("#device-feed-label").textContent = platform === "android" ? "Android" : platform === "web" ? "Chromium" : "iPhone";
|
|
163
|
+
$("#device-meta-device").textContent = platform === "ios" ? ((!state.promptRun && target?.runtime?.surface) || "iOS Simulator")
|
|
156
164
|
: platform === "android" ? (target?.runtime?.serial || "Android emulator / device")
|
|
157
|
-
: platform === "web" ? "Chromium" : "—";
|
|
165
|
+
: platform === "web" ? "Local Chromium" : "—";
|
|
158
166
|
}
|
|
159
167
|
|
|
160
168
|
// The device panel shows whichever real surface exists right now: an interactive session's frame,
|
|
@@ -165,8 +173,6 @@ function frameSource() {
|
|
|
165
173
|
return "";
|
|
166
174
|
}
|
|
167
175
|
|
|
168
|
-
// One in-flight capture at a time; the next request waits for the previous image to land so a
|
|
169
|
-
// slow simulator does not pile up frame requests.
|
|
170
176
|
function refreshLiveFrame() {
|
|
171
177
|
clearTimeout(state.frameTimer);
|
|
172
178
|
const source = frameSource();
|
|
@@ -179,31 +185,22 @@ function refreshLiveFrame() {
|
|
|
179
185
|
image.onerror = () => { loading.textContent = "Live frame could not be captured. The semantic controls remain available."; scheduleLiveFrame(); };
|
|
180
186
|
image.src = apiRoute(`${source}?at=${Date.now()}`);
|
|
181
187
|
}
|
|
182
|
-
|
|
183
|
-
function
|
|
184
|
-
clearTimeout(state.frameTimer);
|
|
185
|
-
if (frameSource()) state.frameTimer = setTimeout(refreshLiveFrame, 1500);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function stopLiveFrames() {
|
|
189
|
-
clearTimeout(state.frameTimer);
|
|
190
|
-
state.frameTimer = null;
|
|
191
|
-
}
|
|
188
|
+
function scheduleLiveFrame() { clearTimeout(state.frameTimer); if (frameSource()) state.frameTimer = setTimeout(refreshLiveFrame, 1500); }
|
|
189
|
+
function stopLiveFrames() { clearTimeout(state.frameTimer); state.frameTimer = null; }
|
|
192
190
|
|
|
193
191
|
function renderLiveSession() {
|
|
194
192
|
const live = state.live || { active:false };
|
|
195
193
|
$("#live-session-panel").classList.toggle("hidden", !live.active);
|
|
196
194
|
if (!live.active) {
|
|
197
|
-
// Keep the last real frame on screen after a run; only show the placeholder when nothing was ever captured.
|
|
198
195
|
if (!frameSource()) stopLiveFrames();
|
|
199
196
|
const hasFrame = !!$("#live-frame-image").getAttribute("src");
|
|
200
197
|
$("#live-frame-loading").classList.toggle("hidden", hasFrame || !frameSource());
|
|
201
198
|
$("#device-placeholder").classList.toggle("hidden", hasFrame);
|
|
202
199
|
if (!state.activeJob) $("#live-screen-title").textContent = hasFrame ? $("#live-screen-title").textContent : "—";
|
|
203
|
-
renderDeviceChrome(
|
|
200
|
+
renderDeviceChrome();
|
|
204
201
|
return;
|
|
205
202
|
}
|
|
206
|
-
renderDeviceChrome(
|
|
203
|
+
renderDeviceChrome();
|
|
207
204
|
$("#live-screen-title").textContent = live.screenTitle || live.targetName || "Running target";
|
|
208
205
|
$("#live-platform").textContent = `${pretty(live.platform)} · ${live.targetName || "live target"}`;
|
|
209
206
|
$("#live-recorded-steps").textContent = `${live.recordedSteps || 0} recorded step${live.recordedSteps === 1 ? "" : "s"}`;
|
|
@@ -236,8 +233,6 @@ function renderDecision(run) {
|
|
|
236
233
|
return;
|
|
237
234
|
}
|
|
238
235
|
const report = latest.report;
|
|
239
|
-
// The decision reflects the GATE outcome (pass/fail/inconclusive), not a ship verdict — exploration
|
|
240
|
-
// only observes (ADR-0005). Without a gate, it's an observation, not a merge decision.
|
|
241
236
|
const outcome = report.gate?.outcome || (report.gate?.failed === true ? "fail" : report.inconclusive ? "inconclusive" : report.gate ? "pass" : null);
|
|
242
237
|
const cssClass = { pass: "ready", fail: "blocked", inconclusive: "caution" }[outcome] || "caution";
|
|
243
238
|
card.className = `decision-card ${cssClass}`;
|
|
@@ -246,23 +241,30 @@ function renderDecision(run) {
|
|
|
246
241
|
$("#overview-evidence").innerHTML = `<div class="latest-run-line"><span class="verdict-dot ${esc(cssClass)}"></span><div><strong>${esc(report.headline || pretty(cssClass))}</strong><small>${esc(pretty(report.platform || "unknown"))} · ${compactDate(latest.createdAt)} · ${(report.contracts || []).filter((item) => item.passed).length}/${(report.contracts || []).length} contracts passed</small></div></div><p>${esc((report.gate?.reasons || ["No blocking release-gate reason reported."])[0])}</p>${reportLink(report)}`;
|
|
247
242
|
}
|
|
248
243
|
|
|
249
|
-
// Runs are
|
|
250
|
-
// audits
|
|
244
|
+
// Runs are three kinds in one list: gate runs on the repository, explorations started from the
|
|
245
|
+
// prompt, and read-only website audits. Each opens the report page the engine wrote.
|
|
251
246
|
function allRuns() {
|
|
252
247
|
const gates = (state.project?.evidence || []).map((run) => ({ ...run, kind:"gate" }));
|
|
248
|
+
const explores = (state.explores || []).map((run) => ({ id:run.id, createdAt:run.createdAt, kind:"explore", explore:run }));
|
|
253
249
|
const audits = (state.audits || []).map((audit) => ({ id:audit.id, createdAt:audit.createdAt, kind:"audit", audit }));
|
|
254
|
-
return [...gates, ...audits].sort((a, b) => String(b.createdAt || "").localeCompare(String(a.createdAt || "")));
|
|
250
|
+
return [...gates, ...explores, ...audits].sort((a, b) => String(b.createdAt || "").localeCompare(String(a.createdAt || "")));
|
|
255
251
|
}
|
|
256
252
|
|
|
257
253
|
function renderRuns() {
|
|
258
254
|
const runs = allRuns();
|
|
259
255
|
setCount("#run-count", runs.length);
|
|
260
256
|
$("#runs-list").innerHTML = runs.length ? runs.map((run) => {
|
|
257
|
+
const selected = run.id === state.selectedRunId ? "selected" : "";
|
|
261
258
|
if (run.kind === "audit") {
|
|
262
259
|
const audit = run.audit;
|
|
263
260
|
const issues = audit.issueCount || 0;
|
|
264
261
|
const host = (() => { try { return new URL(audit.url).host; } catch { return audit.url; } })();
|
|
265
|
-
return `<button class="run-row ${
|
|
262
|
+
return `<button class="run-row ${selected}" data-run-id="${esc(run.id)}"><span class="run-status ${issues ? "inconclusive" : "ready"}">${issues ? "!" : "✓"}</span><span><strong>Audit · ${esc(host)}</strong><small>${compactDate(run.createdAt)} · ${audit.pagesAudited || 0} page${audit.pagesAudited === 1 ? "" : "s"} · read-only</small></span><em>${issues ? `${issues} issue${issues === 1 ? "" : "s"}` : "Nothing broken"}</em></button>`;
|
|
263
|
+
}
|
|
264
|
+
if (run.kind === "explore") {
|
|
265
|
+
const e = run.explore;
|
|
266
|
+
const findings = e.report?.findingCounts?.total ?? (e.report?.findings || []).length;
|
|
267
|
+
return `<button class="run-row ${selected}" data-run-id="${esc(run.id)}"><span class="run-status ${e.report?.inconclusive ? "inconclusive" : "completed"}">${e.report?.inconclusive ? "◐" : "✓"}</span><span><strong>Explore · ${esc(e.target || e.platform)}</strong><small>${compactDate(run.createdAt)} · ${esc(pretty(e.platform))}</small></span><em>${findings} finding${findings === 1 ? "" : "s"}</em></button>`;
|
|
266
268
|
}
|
|
267
269
|
const report = run.report;
|
|
268
270
|
const failed = report?.gate?.failed === true;
|
|
@@ -270,65 +272,138 @@ function renderRuns() {
|
|
|
270
272
|
: report.gate?.outcome === "fail" || failed ? "blocked"
|
|
271
273
|
: report.gate?.outcome === "inconclusive" || report.inconclusive ? "inconclusive"
|
|
272
274
|
: report.gate?.outcome === "pass" ? "ready" : "completed";
|
|
273
|
-
return `<button class="run-row ${
|
|
275
|
+
return `<button class="run-row ${selected}" data-run-id="${esc(run.id)}"><span class="run-status ${esc(status)}">${failed ? "×" : report ? "✓" : "…"}</span><span><strong>${esc(report?.headline || `Release run ${run.id.slice(-8)}`)}</strong><small>${compactDate(run.createdAt)} · ${esc(pretty(report?.platform || "unknown"))}</small></span><em>${esc(pretty(status))}</em></button>`;
|
|
274
276
|
}).join("") : '<div class="empty">No runs yet. Run a release check, or audit a website above.</div>';
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
277
|
-
renderRunDetail(
|
|
277
|
+
const chosen = runs.find((run) => run.id === state.selectedRunId) || runs[0];
|
|
278
|
+
if (chosen) state.selectedRunId = chosen.id;
|
|
279
|
+
renderRunDetail(chosen);
|
|
278
280
|
}
|
|
279
281
|
|
|
280
|
-
function
|
|
281
|
-
|
|
282
|
-
const issues = audit.issues || [];
|
|
283
|
-
$("#run-detail").innerHTML = `<div class="run-detail-head"><div><p class="eyebrow">READ-ONLY AUDIT</p><h2>${esc(audit.url)}</h2><small><code>${esc(audit.id)}</code> · ${compactDate(audit.createdAt)} · nothing was clicked</small></div>${evidenceLink(audit.id, "Visual report")}</div><div class="run-stats"><div><strong>${audit.pagesAudited || 0}</strong><small>pages</small></div><div><strong>${issues.length}</strong><small>distinct issues</small></div><div><strong>${counts.high || 0}</strong><small>high</small></div><div><strong>${counts.medium || 0}</strong><small>medium</small></div></div><h3>Issues</h3>${issues.length ? `<ul class="detail-list">${issues.slice(0, 40).map((issue) => `<li><b>${esc(issue.severity)}</b> · ${esc(issue.title)}${issue.pages?.length > 1 ? ` <small>(${issue.pages.length} pages)</small>` : ""}</li>`).join("")}</ul>` : '<p class="muted">Nothing broken was observed. This says the pages are served without structural defects, not that the site works.</p>'}<h3>Not checked</h3><ul class="detail-list boundary">${(audit.notChecked || []).slice(0, 6).map((item) => `<li>${esc(item)}</li>`).join("")}</ul>`;
|
|
282
|
+
function detailLists(report) {
|
|
283
|
+
return `<h3>What Tapp checked</h3><ul class="detail-list">${(report.checkedFor || []).slice(0, 8).map((item) => `<li>${esc(item)}</li>`).join("")}</ul><h3>Not checked</h3><ul class="detail-list boundary">${(report.notChecked || []).slice(0, 8).map((item) => `<li>${esc(item)}</li>`).join("")}</ul>`;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
function renderRunDetail(run) {
|
|
287
|
-
if (run
|
|
288
|
-
if (
|
|
287
|
+
if (!run) { $("#run-detail").innerHTML = '<div class="empty">Select a run to inspect its evidence.</div>'; return; }
|
|
288
|
+
if (run.kind === "audit") {
|
|
289
|
+
const audit = run.audit;
|
|
290
|
+
const counts = audit.findingCounts || {};
|
|
291
|
+
const issues = audit.issues || [];
|
|
292
|
+
$("#run-detail").innerHTML = `<div class="run-detail-head"><div><p class="eyebrow">READ-ONLY AUDIT</p><h2>${esc(audit.url)}</h2><small><code>${esc(audit.id)}</code> · ${compactDate(audit.createdAt)} · nothing was clicked</small></div>${evidenceLink(audit.id, "Visual report")}</div><div class="run-stats"><div><strong>${audit.pagesAudited || 0}</strong><small>pages</small></div><div><strong>${issues.length}</strong><small>distinct issues</small></div><div><strong>${counts.high || 0}</strong><small>high</small></div><div><strong>${counts.medium || 0}</strong><small>medium</small></div></div><h3>Issues</h3>${issues.length ? `<ul class="detail-list">${issues.slice(0, 40).map((issue) => `<li><b>${esc(issue.severity)}</b> · ${esc(issue.title)}${issue.pages?.length > 1 ? ` <small>(${issue.pages.length} pages)</small>` : ""}</li>`).join("")}</ul>` : '<p class="muted">Nothing broken was observed. This says the pages are served without structural defects, not that the site works.</p>'}${detailLists(audit)}`;
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (run.kind === "explore") {
|
|
296
|
+
const e = run.explore;
|
|
297
|
+
const report = e.report || {};
|
|
298
|
+
$("#run-detail").innerHTML = `<div class="run-detail-head"><div><p class="eyebrow">${esc(report.inconclusive ? "INCONCLUSIVE" : "EXPLORATION")}</p><h2>${esc(report.headline || `Explored ${e.target || e.platform}`)}</h2><small><code>${esc(e.id)}</code> · ${compactDate(e.createdAt)} · an observation, not a release decision</small></div>${evidenceLink(e.id, "Visual report")}</div><div class="run-stats"><div><strong>${report.screensExplored || 0}</strong><small>screens</small></div><div><strong>${report.actionsPerformed || 0}</strong><small>actions</small></div><div><strong>${report.findingCounts?.total ?? (report.findings || []).length}</strong><small>findings</small></div></div><h3>Findings</h3>${(report.findings || []).length ? `<ul class="detail-list">${report.findings.slice(0, 40).map((f) => `<li><b>${esc(f.severity)}</b> · ${esc(f.title)}${f.screen ? ` <small>on ${esc(f.screen)}</small>` : ""}</li>`).join("")}</ul>` : '<p class="muted">No findings surfaced in the exercised surfaces.</p>'}${detailLists(report)}`;
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (!run.report) { $("#run-detail").innerHTML = '<div class="empty">Select a completed run to inspect its evidence.</div>'; return; }
|
|
289
302
|
const report = run.report;
|
|
290
303
|
const contracts = report.contracts || [];
|
|
291
|
-
$("#run-detail").innerHTML = `<div class="run-detail-head"><div><p class="eyebrow">${esc(report.gate?.failed ? "BLOCKED" : report.inconclusive ? "INCONCLUSIVE" : "RELEASE RUN")}</p><h2>${esc(report.headline || "Release gate completed")}</h2><small><code>${esc(run.id)}</code> · ${compactDate(run.createdAt)}</small></div>${reportLink(report, "Visual report")}</div><div class="run-stats"><div><strong>${report.screensExplored || 0}</strong><small>states</small></div><div><strong>${report.actionsPerformed || 0}</strong><small>actions</small></div><div><strong>${contracts.filter((item) => item.passed).length}/${contracts.length}</strong><small>contracts</small></div><div><strong>${report.findingCounts?.total ?? (report.findings || []).length}</strong><small>findings</small></div></div><h3>Decision rationale</h3><ul class="detail-list">${(report.gate?.reasons || ["No blocking gate reason reported."]).map((item) => `<li>${esc(item)}</li>`).join("")}</ul><h3>Deterministic contracts</h3>${contracts.length ? contracts.map((contract) => `<div class="contract-result"><span class="${contract.passed ? "pass" : "fail"}">${contract.passed ? "✓" : "×"}</span><div><strong>${esc(contract.title || contract.name || contract.path)}</strong><small>${esc(contract.detail || contract.path || "Deterministic replay")}</small></div></div>`).join("") : '<p class="muted">No committed release contracts applied to this target.</p>'}
|
|
304
|
+
$("#run-detail").innerHTML = `<div class="run-detail-head"><div><p class="eyebrow">${esc(report.gate?.failed ? "BLOCKED" : report.inconclusive ? "INCONCLUSIVE" : "RELEASE RUN")}</p><h2>${esc(report.headline || "Release gate completed")}</h2><small><code>${esc(run.id)}</code> · ${compactDate(run.createdAt)}</small></div>${reportLink(report, "Visual report")}</div><div class="run-stats"><div><strong>${report.screensExplored || 0}</strong><small>states</small></div><div><strong>${report.actionsPerformed || 0}</strong><small>actions</small></div><div><strong>${contracts.filter((item) => item.passed).length}/${contracts.length}</strong><small>contracts</small></div><div><strong>${report.findingCounts?.total ?? (report.findings || []).length}</strong><small>findings</small></div></div><h3>Decision rationale</h3><ul class="detail-list">${(report.gate?.reasons || ["No blocking gate reason reported."]).map((item) => `<li>${esc(item)}</li>`).join("")}</ul><h3>Deterministic contracts</h3>${contracts.length ? contracts.map((contract) => `<div class="contract-result"><span class="${contract.passed ? "pass" : "fail"}">${contract.passed ? "✓" : "×"}</span><div><strong>${esc(contract.title || contract.name || contract.path)}</strong><small>${esc(contract.detail || contract.path || "Deterministic replay")}</small></div></div>`).join("") : '<p class="muted">No committed release contracts applied to this target.</p>'}${detailLists(report)}`;
|
|
292
305
|
}
|
|
293
306
|
|
|
294
|
-
|
|
295
|
-
|
|
307
|
+
// ---- tapp chat: the engine's progress log, rendered as a transcript -------------------------
|
|
296
308
|
function renderChat() {
|
|
297
309
|
const node = $("#chat-transcript");
|
|
298
310
|
const stickToBottom = node.scrollTop + node.clientHeight >= node.scrollHeight - 24;
|
|
299
|
-
|
|
300
|
-
|
|
311
|
+
const lines = state.transcript.map((entry) => {
|
|
312
|
+
if (entry.kind === "shots") return `<div class="chat-shots">${entry.shots.map((shot) => `<a href="${esc(shot.href)}" target="_blank" rel="noreferrer" title="${esc(shot.caption)}"><img src="${esc(shot.src)}" alt="${esc(shot.caption)}"></a>`).join("")}</div>`;
|
|
313
|
+
if (entry.kind === "attachments") return `<div class="chat-attachments">${entry.items.map((item) => `<a href="${esc(item.href)}" target="_blank" rel="noreferrer"><span>${item.icon}</span>${esc(item.label)}</a>`).join("")}</div>`;
|
|
314
|
+
if (entry.kind === "summary") return `<div class="chat-summary ${esc(entry.tone)}"><span class="chat-pill">${esc(entry.pill)}</span><p>${esc(entry.text)}</p></div>`;
|
|
315
|
+
if (entry.kind === "finding") return `<div class="chat-line finding ${esc(entry.severity)}"><span class="chat-icon">${entry.icon}</span><span>${esc(entry.text)}</span></div>`;
|
|
316
|
+
if (entry.kind === "progress") return "";
|
|
317
|
+
return `<div class="chat-line ${esc(entry.kind || "")}"><span class="chat-icon">${entry.icon || "•"}</span><span>${esc(entry.text)}${entry.detail ? ` <em>— ${esc(entry.detail)}</em>` : ""}</span></div>`;
|
|
318
|
+
}).join("") + (state.activeJob ? '<div class="chat-line typing"><span class="chat-icon">✨</span><span>tapp is working<i>…</i></span></div>' : "");
|
|
319
|
+
node.innerHTML = lines;
|
|
301
320
|
if (stickToBottom) node.scrollTop = node.scrollHeight;
|
|
321
|
+
const progress = [...state.transcript].reverse().find((entry) => entry.kind === "progress");
|
|
322
|
+
$("#chat-status").textContent = state.activeJob ? (progress ? `${progress.current}/${progress.total} actions${progress.states != null ? ` · ${progress.states} screens` : ""}` : "working…") : state.transcript.length > 1 ? "done" : "ready";
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function setChatCollapsed(collapsed) {
|
|
326
|
+
state.chatCollapsed = collapsed;
|
|
327
|
+
$("#chat-float").classList.toggle("collapsed", collapsed);
|
|
328
|
+
$("#chat-toggle").setAttribute("aria-expanded", String(!collapsed));
|
|
329
|
+
try { localStorage.setItem("tapp:chat-collapsed", collapsed ? "1" : "0"); } catch { /* storage may be unavailable */ }
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function pushLine(entry) { state.transcript.push({ at: new Date().toISOString(), ...entry }); }
|
|
333
|
+
|
|
334
|
+
// A screenshot the engine wrote during the run, kept as a thumbnail in the transcript. Captured
|
|
335
|
+
// once per screen name the engine reports, and never more often than every few seconds.
|
|
336
|
+
async function keepShot(screen) {
|
|
337
|
+
const key = screen || `t${Math.floor(Date.now() / 4000)}`;
|
|
338
|
+
if (state.shotScreens.has(key) || Date.now() - state.lastShotAt < 2500 || !state.activeJob) return;
|
|
339
|
+
state.shotScreens.add(key);
|
|
340
|
+
state.lastShotAt = Date.now();
|
|
341
|
+
try {
|
|
342
|
+
const response = await fetch(apiRoute(`/api/jobs/${state.activeJob}/frame?at=${Date.now()}`));
|
|
343
|
+
if (!response.ok) return;
|
|
344
|
+
const blob = await response.blob();
|
|
345
|
+
const src = URL.createObjectURL(blob);
|
|
346
|
+
const last = state.transcript.at(-1);
|
|
347
|
+
if (last?.kind === "shots" && last.shots.length < 3) last.shots.push({ src, href: src, caption: screen || "screen" });
|
|
348
|
+
else pushLine({ kind: "shots", shots: [{ src, href: src, caption: screen || "screen" }] });
|
|
349
|
+
renderChat();
|
|
350
|
+
} catch { /* a missed thumbnail is not an error */ }
|
|
302
351
|
}
|
|
303
352
|
|
|
304
|
-
// The transcript is the engine's own progress log, bubble per entry. Phase changes get the
|
|
305
|
-
// `phase` style; everything else is narration of what actually happened.
|
|
306
353
|
function syncTranscriptFromJob(name, job) {
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
354
|
+
if (state.transcriptSource !== job.id) {
|
|
355
|
+
state.transcript = [{ at: job.createdAt, kind: "phase", icon: "🚀", text: startLine(name, job) }];
|
|
356
|
+
state.transcriptSource = job.id;
|
|
357
|
+
state.shotScreens = new Set();
|
|
358
|
+
state.lastShotAt = 0;
|
|
359
|
+
}
|
|
360
|
+
const seen = state.transcript.filter((entry) => entry.source === "job").length;
|
|
310
361
|
for (const entry of job.progress.slice(seen)) {
|
|
311
|
-
const
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
362
|
+
const line = narrate(entry, { platform: currentPlatform() });
|
|
363
|
+
state.transcript.push({ ...(line || { kind: "step", icon: "•", text: "" }), at: entry.at, source: "job" });
|
|
364
|
+
if (line && line.kind !== "progress") {
|
|
365
|
+
const last = state.transcript.at(-2);
|
|
366
|
+
if (last && last.text === line.text && last.kind !== "shots") state.transcript.splice(-1, 1);
|
|
367
|
+
}
|
|
368
|
+
if (entry.screen) keepShot(entry.screen);
|
|
316
369
|
}
|
|
317
370
|
}
|
|
318
371
|
|
|
319
|
-
function
|
|
320
|
-
|
|
321
|
-
const
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
372
|
+
function startLine(name, job) {
|
|
373
|
+
const raw = job.input || "";
|
|
374
|
+
const input = /\.(app|apk)$/i.test(raw) ? raw.split("/").filter(Boolean).at(-1) : raw;
|
|
375
|
+
return { initialize: "Starting a release check — build, launch and explore the real app", gate: "Running the release gate", audit: `Opening ${input} read-only — nothing will be clicked`, "explore-build": `Exploring ${input} on the booted device`, open: `Opening ${input}`, "session-start": "Opening a live session", "session-act": "Acting in the live session", "session-save-flow": "Saving the journey as a Flow", "session-end": "Ending the live session" }[name] || `${pretty(name)} started`;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
async function finishTranscript(name, job) {
|
|
379
|
+
state.transcript = state.transcript.filter((entry) => entry.kind !== "progress" || true);
|
|
380
|
+
if (job.status === "failed") { pushLine({ kind: "warning", icon: "⚠️", text: job.error?.message || `${pretty(name)} failed` }); return; }
|
|
381
|
+
const result = job.result || {};
|
|
382
|
+
// initialize carries its exploration beside the project; the gate carries a report.
|
|
383
|
+
const report = result.exploration || result.report || result;
|
|
384
|
+
for (const finding of (report.findings || result.issues || []).slice(0, 12)) pushLine(narrateFinding(finding));
|
|
385
|
+
const id = result.capture?.id || captureId(report);
|
|
386
|
+
if (id) {
|
|
387
|
+
try {
|
|
388
|
+
const files = await api(`/api/captures/${encodeURIComponent(id)}/files`);
|
|
389
|
+
if (files.shots?.length) {
|
|
390
|
+
pushLine({ kind: "shots", shots: files.shots.slice(0, 3).map((shot) => ({ src: captureUrl(id, shot.src), href: captureUrl(id, shot.src), caption: shot.caption })) });
|
|
391
|
+
// The stage keeps the run's final screen until something newer replaces it.
|
|
392
|
+
if (!state.live?.active) {
|
|
393
|
+
const last = files.shots.at(-1);
|
|
394
|
+
const image = $("#live-frame-image");
|
|
395
|
+
image.onload = () => { $("#live-frame-loading").classList.add("hidden"); $("#device-placeholder").classList.add("hidden"); };
|
|
396
|
+
image.src = captureUrl(id, last.src);
|
|
397
|
+
$("#live-screen-title").textContent = last.caption || "";
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
const items = [];
|
|
401
|
+
if (files.recording) items.push({ icon: "🎬", label: files.recording, href: captureUrl(id, files.recording) });
|
|
402
|
+
if (files.report) items.push({ icon: "📄", label: "report.html", href: captureUrl(id, files.report) });
|
|
403
|
+
if (items.length) pushLine({ kind: "attachments", items });
|
|
404
|
+
} catch { /* the summary still renders */ }
|
|
326
405
|
}
|
|
327
|
-
|
|
328
|
-
|| (name === "gate" ? (job.result?.passed === false ? "Release gate blocked this revision." : "Release gate completed.")
|
|
329
|
-
: name === "audit" ? `Audit complete — ${job.result?.pagesAudited || 0} page(s), ${job.result?.issueCount || 0} distinct issue(s), nothing clicked.`
|
|
330
|
-
: `${pretty(name)} completed`);
|
|
331
|
-
state.transcript.push({ at: job.completedAt || new Date().toISOString(), kind: "summary", text: summary });
|
|
406
|
+
pushLine({ kind: "summary", ...summarize(name, result.exploration ? { ...result, report } : result) });
|
|
332
407
|
}
|
|
333
408
|
|
|
334
409
|
function seedIdleTranscript() {
|
|
@@ -336,8 +411,8 @@ function seedIdleTranscript() {
|
|
|
336
411
|
const latest = latestRun();
|
|
337
412
|
const report = latest?.report;
|
|
338
413
|
state.transcript = report
|
|
339
|
-
? [{ at: latest.createdAt, kind: "summary",
|
|
340
|
-
: [{ at: new Date().toISOString(), kind: "phase", text: state.project?.state?.inspected ? "Ready. Run a release check
|
|
414
|
+
? [{ at: latest.createdAt, kind: "summary", ...summarize("gate", report) }]
|
|
415
|
+
: [{ at: new Date().toISOString(), kind: "phase", icon: "👋", text: state.project?.state?.inspected ? "Ready. Run a release check and I'll narrate what the app does while you watch it." : "Inspecting the project…" }];
|
|
341
416
|
}
|
|
342
417
|
|
|
343
418
|
function renderCommandState(job = null, name = "") {
|
|
@@ -361,9 +436,8 @@ function renderCommandState(job = null, name = "") {
|
|
|
361
436
|
const target = currentTarget();
|
|
362
437
|
const runner = target ? state.session?.runners?.find((item) => item.platform === target.platform) : null;
|
|
363
438
|
$("#idle-badges").innerHTML = [
|
|
364
|
-
target ? `<span><b>${esc(pretty(target.platform))}</b> · ${esc(target.name)}</span>` : "
|
|
365
|
-
runner ? `<span>${esc(runner.label)}
|
|
366
|
-
`<span>Idle · ${target ? "Ready for the next release check" : "Choose a target to run"}</span>`,
|
|
439
|
+
target ? `<span><b>${esc(pretty(target.platform))}</b> · ${esc(target.name)}</span>` : "",
|
|
440
|
+
runner ? `<span>${esc(runner.label)}</span>` : "",
|
|
367
441
|
].filter(Boolean).join("");
|
|
368
442
|
}
|
|
369
443
|
|
|
@@ -371,9 +445,9 @@ function renderProject() {
|
|
|
371
445
|
const project = state.project;
|
|
372
446
|
renderRepositoryChrome();
|
|
373
447
|
if (!project?.connected) {
|
|
374
|
-
|
|
375
|
-
if (state.
|
|
376
|
-
|
|
448
|
+
if ((state.audits.length || state.explores.length) && state.activeView === "runs") { showProduct(); renderRuns(); return; }
|
|
449
|
+
if (state.promptRun) { showProduct(); renderRuns(); renderDeviceChrome(); renderChat(); return; }
|
|
450
|
+
showPrompt();
|
|
377
451
|
renderRuns();
|
|
378
452
|
return;
|
|
379
453
|
}
|
|
@@ -397,25 +471,30 @@ async function refreshSession() {
|
|
|
397
471
|
const local = state.session.mode === "local";
|
|
398
472
|
$("#mode-pill").textContent = local ? "Self-host · this machine" : "Cloud · outbound runner";
|
|
399
473
|
$("#onboarding-mode-pill").textContent = local ? "Self-host · this machine" : "Cloud";
|
|
400
|
-
$("#privacy-note-
|
|
474
|
+
$("#privacy-note-detail").textContent = local ? "Everything runs on this machine. Exploration, replay and merge decisions are deterministic and need no API key." : "Your repository stays in your private Tapp workspace.";
|
|
401
475
|
}
|
|
402
476
|
|
|
403
477
|
async function refresh() {
|
|
404
|
-
[
|
|
478
|
+
const [project, live, runs] = await Promise.all([api("/api/project"), api("/api/live-session"), api("/api/audits").catch(() => ({ audits: [], explores: [] }))]);
|
|
479
|
+
state.project = project;
|
|
480
|
+
state.live = live;
|
|
481
|
+
state.audits = runs.audits || [];
|
|
482
|
+
state.explores = runs.explores || [];
|
|
405
483
|
renderProject();
|
|
406
484
|
}
|
|
407
485
|
|
|
408
|
-
async function runOperation(name, body = {}) {
|
|
486
|
+
async function runOperation(name, body = {}, { input = "" } = {}) {
|
|
409
487
|
if (state.activeJob) throw new Error("Another operation is still running");
|
|
410
488
|
const started = await api(`/api/operations/${name}`, { method:"POST", body:JSON.stringify(body) });
|
|
489
|
+
if (!started.job) return started; // synchronous answers (open a path, a business name)
|
|
411
490
|
state.activeJob = started.job.id;
|
|
412
491
|
const drawer = $("#operation-drawer");
|
|
413
492
|
drawer.classList.remove("hidden");
|
|
414
493
|
$("#operation-title").textContent = name === "audit" ? "Read-only audit" : pretty(name);
|
|
415
494
|
$("#operation-progress").textContent = "Starting";
|
|
416
495
|
$("#operation-progress-bar").style.width = "6%";
|
|
417
|
-
syncTranscriptFromJob(name, started.job);
|
|
418
|
-
if (
|
|
496
|
+
syncTranscriptFromJob(name, { ...started.job, input });
|
|
497
|
+
if (!$("#product-shell").classList.contains("hidden")) { renderCommandState(started.job, name); renderChat(); }
|
|
419
498
|
try {
|
|
420
499
|
while (true) {
|
|
421
500
|
await new Promise((resolve) => setTimeout(resolve, 650));
|
|
@@ -424,13 +503,13 @@ async function runOperation(name, body = {}) {
|
|
|
424
503
|
$("#operation-progress").textContent = progress?.text || "Working…";
|
|
425
504
|
const ratio = progress?.current && progress?.total ? Math.min(92, Math.round(progress.current / progress.total * 100)) : Math.min(88, 8 + job.progress.length * 4);
|
|
426
505
|
$("#operation-progress-bar").style.width = `${ratio}%`;
|
|
427
|
-
syncTranscriptFromJob(name, job);
|
|
428
|
-
if (
|
|
506
|
+
syncTranscriptFromJob(name, { ...job, input });
|
|
507
|
+
if (!$("#product-shell").classList.contains("hidden")) { renderCommandState(job, name); renderChat(); }
|
|
429
508
|
const screen = [...job.progress].reverse().find((entry) => entry.screen)?.screen;
|
|
430
509
|
if (screen && !state.live?.active) $("#live-screen-title").textContent = screen;
|
|
431
510
|
if (job.frame && !state.jobHasFrame) { state.jobHasFrame = true; refreshLiveFrame(); }
|
|
432
511
|
if (operationIsPending(job.status)) continue;
|
|
433
|
-
finishTranscript(name, job);
|
|
512
|
+
await finishTranscript(name, job);
|
|
434
513
|
if (job.status === "failed") throw new Error(job.error?.message || "Operation failed");
|
|
435
514
|
if (job.status !== "completed") throw new Error(`Operation ended in an unknown '${job.status}' state`);
|
|
436
515
|
$("#operation-progress-bar").style.width = "100%";
|
|
@@ -438,7 +517,6 @@ async function runOperation(name, body = {}) {
|
|
|
438
517
|
else if (name === "session-save-flow") toast(`Saved ${job.result.path} as a reviewable deterministic Flow`);
|
|
439
518
|
else if (name === "gate" && job.result.passed === false) toast("The release gate blocked this revision. Tapp did not soften the result.", true);
|
|
440
519
|
else if (name === "audit") toast(`Audited ${job.result.pagesAudited} page(s) — ${job.result.issueCount} distinct issue(s)`);
|
|
441
|
-
else toast(`${pretty(name)} completed`);
|
|
442
520
|
return job.result;
|
|
443
521
|
}
|
|
444
522
|
} finally {
|
|
@@ -448,18 +526,44 @@ async function runOperation(name, body = {}) {
|
|
|
448
526
|
await refreshSession();
|
|
449
527
|
await refresh();
|
|
450
528
|
} finally {
|
|
451
|
-
|
|
529
|
+
renderChat();
|
|
452
530
|
drawer.classList.add("hidden");
|
|
453
531
|
}
|
|
454
532
|
}
|
|
455
533
|
}
|
|
456
534
|
|
|
535
|
+
// "What should tapp test?" — route by what was typed. The server classifies again and refuses
|
|
536
|
+
// what the mode cannot do (a hosted Studio cannot open a path on your machine).
|
|
537
|
+
async function startFromPrompt(raw) {
|
|
538
|
+
const prompt = classifyPrompt(raw);
|
|
539
|
+
if (prompt.kind === "empty") return;
|
|
540
|
+
if (prompt.kind === "url") {
|
|
541
|
+
state.promptRun = true; state.promptPlatform = "web";
|
|
542
|
+
showProduct(); activateView("overview"); renderDeviceChrome(); renderChat();
|
|
543
|
+
const result = await runOperation("audit", { url: prompt.value }, { input: prompt.value });
|
|
544
|
+
state.selectedRunId = result?.capture?.id || state.selectedRunId;
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
if (["bundle", "app", "apk"].includes(prompt.kind)) {
|
|
548
|
+
state.promptRun = true; state.promptPlatform = prompt.kind === "apk" ? "android" : "ios";
|
|
549
|
+
showProduct(); activateView("overview"); renderDeviceChrome(); renderChat();
|
|
550
|
+
const result = await runOperation("explore-build", { input: prompt.value }, { input: prompt.value });
|
|
551
|
+
state.selectedRunId = result?.capture?.id || state.selectedRunId;
|
|
552
|
+
return;
|
|
553
|
+
}
|
|
554
|
+
const answer = await runOperation("open", { input: prompt.value }, { input: prompt.value });
|
|
555
|
+
if (answer?.kind === "business") { toast(answer.message, true); return; }
|
|
556
|
+
await refreshSession();
|
|
557
|
+
await refresh();
|
|
558
|
+
state.selectedTargetId = "";
|
|
559
|
+
if (state.project?.connected && !state.project?.state?.inspected) await runOperation("initialize", { write:true });
|
|
560
|
+
}
|
|
561
|
+
|
|
457
562
|
async function auditWebsite(url) {
|
|
458
563
|
const trimmed = String(url || "").trim();
|
|
459
564
|
if (!/^https?:\/\//i.test(trimmed)) { toast("Enter an http(s) URL to audit", true); return; }
|
|
460
|
-
const result = await runOperation("audit", { url: trimmed });
|
|
565
|
+
const result = await runOperation("audit", { url: trimmed }, { input: trimmed });
|
|
461
566
|
state.selectedRunId = result?.capture?.id || state.selectedRunId;
|
|
462
|
-
showProduct();
|
|
463
567
|
activateView("runs");
|
|
464
568
|
renderRuns();
|
|
465
569
|
}
|
|
@@ -476,33 +580,33 @@ document.addEventListener("click", (event) => {
|
|
|
476
580
|
}
|
|
477
581
|
const runButton = event.target.closest("[data-run-id]");
|
|
478
582
|
if (runButton) { state.selectedRunId = runButton.dataset.runId; renderRuns(); }
|
|
583
|
+
const suggestion = event.target.closest("[data-prompt]");
|
|
584
|
+
if (suggestion) { const input = $("#prompt-input"); input.value = suggestion.dataset.prompt; input.focus(); input.select(); }
|
|
479
585
|
const liveControl = event.target.closest("[data-live-control]");
|
|
480
586
|
if (liveControl) {
|
|
481
587
|
const target = liveControl.dataset.liveTarget;
|
|
482
588
|
$("#live-action-target").value = target;
|
|
483
|
-
if (liveControl.dataset.liveInput === "true")
|
|
484
|
-
|
|
485
|
-
} else {
|
|
486
|
-
runOperation("session-act", { action:"tap", id:target }).catch((error) => toast(error.message, true));
|
|
487
|
-
}
|
|
589
|
+
if (liveControl.dataset.liveInput === "true") $("#live-action-text").focus();
|
|
590
|
+
else runOperation("session-act", { action:"tap", id:target }).catch((error) => toast(error.message, true));
|
|
488
591
|
}
|
|
489
592
|
});
|
|
490
593
|
|
|
491
594
|
document.addEventListener("submit", (event) => {
|
|
492
|
-
const
|
|
493
|
-
if (
|
|
494
|
-
event.
|
|
495
|
-
|
|
595
|
+
const audit = event.target.closest("form.audit-form");
|
|
596
|
+
if (audit) { event.preventDefault(); auditWebsite(audit.elements.url.value).catch((error) => toast(error.message, true)); return; }
|
|
597
|
+
const prompt = event.target.closest("#prompt-form");
|
|
598
|
+
if (prompt) { event.preventDefault(); startFromPrompt(prompt.elements.input.value).catch((error) => toast(error.message, true)); }
|
|
496
599
|
});
|
|
497
600
|
|
|
498
|
-
$$("[data-brand-home]").forEach((button) => button.addEventListener("click", () => state.project?.connected ? (showProduct(), activateView("overview")) :
|
|
499
|
-
$("#command-run").addEventListener("click", () => runOperation("initialize", operationPayload({ explore:true })).catch((error) => toast(error.message, true)));
|
|
601
|
+
$$("[data-brand-home]").forEach((button) => button.addEventListener("click", () => state.project?.connected ? (showProduct(), activateView("overview")) : showPrompt()));
|
|
602
|
+
$("#command-run").addEventListener("click", () => { state.promptRun = false; runOperation("initialize", operationPayload({ explore:true })).catch((error) => toast(error.message, true)); });
|
|
500
603
|
$("#refresh-project").addEventListener("click", () => refresh().catch((error) => toast(error.message, true)));
|
|
501
|
-
$("#change-source").addEventListener("click",
|
|
604
|
+
$("#change-source").addEventListener("click", showPrompt);
|
|
605
|
+
$("#chat-toggle").addEventListener("click", () => setChatCollapsed(!state.chatCollapsed));
|
|
502
606
|
$("#repository-switcher").addEventListener("change", async (event) => {
|
|
503
607
|
try { await api("/api/repositories/select", { method:"POST", body:JSON.stringify({ id:event.target.value }) }); state.selectedTargetId = ""; await refreshSession(); await refresh(); } catch (error) { toast(error.message, true); }
|
|
504
608
|
});
|
|
505
|
-
$("#explore").addEventListener("click", () => runOperation("initialize", operationPayload({ explore:true })).catch((error) => toast(error.message, true)));
|
|
609
|
+
$("#explore").addEventListener("click", () => { state.promptRun = false; runOperation("initialize", operationPayload({ explore:true })).catch((error) => toast(error.message, true)); });
|
|
506
610
|
$("#start-session").addEventListener("click", () => runOperation("session-start", operationPayload()).catch((error) => toast(error.message, true)));
|
|
507
611
|
$("#refresh-live-session").addEventListener("click", () => runOperation("session-act", { action:"tree" }).catch((error) => toast(error.message, true)));
|
|
508
612
|
$("#end-session").addEventListener("click", () => runOperation("session-end").catch((error) => toast(error.message, true)));
|
|
@@ -514,9 +618,8 @@ $("#live-swipe").addEventListener("click", () => runOperation("session-act", { a
|
|
|
514
618
|
$("#run-gate").addEventListener("click", () => runOperation("gate", operationPayload()).catch((error) => toast(error.message, true)));
|
|
515
619
|
|
|
516
620
|
try {
|
|
621
|
+
try { setChatCollapsed(localStorage.getItem("tapp:chat-collapsed") === "1"); } catch { /* storage may be unavailable */ }
|
|
517
622
|
await refreshSession();
|
|
518
623
|
await refresh();
|
|
519
|
-
// A repository supplied by `tapp app /path` is inspected immediately, then stops for an
|
|
520
|
-
// explicit target choice when detection is ambiguous.
|
|
521
624
|
if (state.project?.connected && !state.project?.state?.inspected) await runOperation("initialize", { write:true });
|
|
522
625
|
} catch (error) { toast(error.message, true); }
|