@echomem/mcp 1.4.9 → 1.4.12
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/assets/hud/github.svg +1 -0
- package/dist/city/README.md +9 -0
- package/dist/city/echo-ai-city-only.html +54 -93
- package/dist/context-analysis/claude-native-canonical.js +35 -12
- package/dist/context-metrics/calculate.js +2 -15
- package/dist/context-metrics/estimator.js +45 -0
- package/dist/context-metrics/ledger.js +507 -0
- package/dist/context-metrics/parse-claude.js +227 -0
- package/dist/context-metrics/parse-codex.js +276 -0
- package/dist/hud/adapters.js +69 -198
- package/dist/hud/electron-main.js +3 -2
- package/dist/hud/fs.js +14 -0
- package/dist/hud/metric.js +4 -98
- package/dist/hud/monitor.js +1 -12
- package/dist/hud/render.js +4 -3
- package/dist/hud/server.js +30 -0
- package/dist/hud/web.js +409 -186
- package/dist/index.js +1 -0
- package/dist/setup-page/client-core.js +475 -0
- package/dist/setup-page/client-extraction.js +550 -0
- package/dist/setup-page/client-lifecycle.js +116 -0
- package/dist/setup-page/client-report-audit.js +818 -0
- package/dist/setup-page/client-report-city.js +204 -0
- package/dist/setup-page/client-report.js +6 -0
- package/dist/setup-page/client.js +15 -0
- package/dist/setup-page/document.js +37 -0
- package/dist/setup-page/styles-city-report.js +880 -0
- package/dist/setup-page/styles-context-audit.js +470 -0
- package/dist/setup-page/styles-extraction.js +821 -0
- package/dist/setup-page/styles-foundation.js +231 -0
- package/dist/setup-page/styles.js +11 -0
- package/dist/setup-page.js +6 -5623
- package/dist/setup.js +24 -10
- package/package.json +4 -4
- package/dist/city/10-problems-report.html +0 -649
- package/dist/city/_live.html +0 -37
- package/dist/city/_serve.mjs +0 -45
- package/dist/city/card-data.json +0 -15
- package/dist/city/chaos-to-clarity-pencil.html +0 -582
- package/dist/city/city-data.json +0 -248
- package/dist/city/echo-ai-city-only.template.html +0 -2271
- package/dist/city/generate-echo-city-only.mjs +0 -112
- package/dist/city/pencil-pie-generator.html +0 -883
- package/dist/city/pencil-webgl-landscape.html +0 -1239
- package/dist/city/spatial-fan-story.html +0 -479
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// Generated by splitting the previous inline setup page. Keep this source readable: it is emitted into one browser IIFE.
|
|
2
|
+
export const SETUP_PAGE_CLIENT_LIFECYCLE = String.raw ` /* ---------- scan-first poll for the forensic report ---------- */
|
|
3
|
+
async function showReport() {
|
|
4
|
+
if (reportPollStarted) return;
|
|
5
|
+
reportPollStarted = true;
|
|
6
|
+
if (!report) renderLoading();
|
|
7
|
+
try {
|
|
8
|
+
var fails = 0;
|
|
9
|
+
for (;;) {
|
|
10
|
+
if (decisionMade) return;
|
|
11
|
+
var res;
|
|
12
|
+
try {
|
|
13
|
+
res = await fetchWithTimeout("/report?nonce=" + encodeURIComponent(nonce), { credentials: "omit", cache: "no-store" }, 12000);
|
|
14
|
+
} catch (_) {
|
|
15
|
+
// Only a RUN of consecutive failures is a real bridge problem. A long scan that keeps
|
|
16
|
+
// answering valid 202 envelopes must never trip this.
|
|
17
|
+
fails++;
|
|
18
|
+
if (fails >= 8) { renderBridgeIssue(); return; }
|
|
19
|
+
await sleep(700);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (res.status === 403) {
|
|
23
|
+
renderReportIssue("SETUP_SESSION_INVALID", "This setup link is missing or has an invalid local session nonce.");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
var envelope;
|
|
27
|
+
try {
|
|
28
|
+
envelope = await res.json();
|
|
29
|
+
} catch (_) {
|
|
30
|
+
renderReportIssue("REPORT_RESPONSE_INVALID", "The local bridge returned a report response that could not be decoded.");
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
validateProductionReportEnvelope(envelope);
|
|
35
|
+
} catch (_) {
|
|
36
|
+
renderReportIssue("REPORT_SCHEMA_INVALID", "The local report failed its provenance or ledger consistency checks.");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (res.status === 202 && envelope.kind === "scanning") {
|
|
40
|
+
fails = 0;
|
|
41
|
+
reportEnvelope = envelope;
|
|
42
|
+
scheduleReportToCity();
|
|
43
|
+
renderLoading();
|
|
44
|
+
await sleep(700);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (res.status === 200 && envelope.kind === "empty") {
|
|
48
|
+
renderEmptyReport();
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (res.status === 200 && envelope.kind === "ready") {
|
|
52
|
+
reportEnvelope = envelope;
|
|
53
|
+
report = envelope.report;
|
|
54
|
+
try {
|
|
55
|
+
renderForensicReport();
|
|
56
|
+
} catch (_) {
|
|
57
|
+
renderReportIssue("RENDER_FAILED", "Your validated local report could not be rendered safely.");
|
|
58
|
+
}
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (envelope.kind === "failed") {
|
|
62
|
+
renderReportIssue(envelope.error.code, envelope.error.message);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
renderReportIssue("REPORT_STATE_MISMATCH", "The local bridge returned a report state that did not match its HTTP status.");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
} finally { reportPollStarted = false; }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
window.addEventListener("message", function (event) {
|
|
72
|
+
if (event.origin !== location.origin) return;
|
|
73
|
+
var data = event.data || {};
|
|
74
|
+
if (data.type === "echomem:connected" && data.nonce === nonce) {
|
|
75
|
+
connected = true;
|
|
76
|
+
closeAuthWindow();
|
|
77
|
+
void waitForStats();
|
|
78
|
+
} else if (data.type === "echomem:city-ready" && data.nonce === nonce) {
|
|
79
|
+
scheduleReportToCity();
|
|
80
|
+
} else if (data.type === "echomem:connect-click") {
|
|
81
|
+
onConnectClick();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
async function init() {
|
|
85
|
+
if (!nonce) throw new Error("Missing setup nonce. Re-run echomem-mcp init.");
|
|
86
|
+
// Older builds cached a report under the nonce. It is never an authority now; the current
|
|
87
|
+
// server envelope and scan identity are the only inputs allowed to unlock personalized UI.
|
|
88
|
+
try { sessionStorage.removeItem("echomem:setup-report:" + nonce); } catch (_) {}
|
|
89
|
+
if (params.get("connected") === "1") {
|
|
90
|
+
connected = true;
|
|
91
|
+
if (notifyOpenerConnected()) {
|
|
92
|
+
// Popup flow: hand the main tab back control, then this popup closes.
|
|
93
|
+
setHead("EchoMem connected", "Done");
|
|
94
|
+
app.className = "notice";
|
|
95
|
+
app.innerHTML = '<h2 style="color:#203820">This device is connected</h2><p style="margin-top:10px">Returning to the local setup page...</p>';
|
|
96
|
+
// Fallback: if window.close() was blocked (auth opened as a tab, or the browser refused),
|
|
97
|
+
// this window would otherwise hang on "Returning..." forever. After a beat, take over here
|
|
98
|
+
// so the user always lands on the dashboard instead of a dead page.
|
|
99
|
+
setTimeout(function () { if (!window.closed) void waitForStats(); }, 1500);
|
|
100
|
+
} else {
|
|
101
|
+
// Same-tab fallback (popup was blocked): go straight to the extraction dashboard.
|
|
102
|
+
void waitForStats();
|
|
103
|
+
}
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
// Learn the auth URL + connection state, but don't block the local scan on it.
|
|
107
|
+
getJson("/config").then(function (cfg) {
|
|
108
|
+
authUrl = cfg.authUrl || authUrl;
|
|
109
|
+
connected = !!cfg.connected;
|
|
110
|
+
workspacePath = cfg.workspacePath || workspacePath;
|
|
111
|
+
}).catch(function () {});
|
|
112
|
+
// Scan-first: show the local forensic report before asking the user to connect.
|
|
113
|
+
await showReport();
|
|
114
|
+
}
|
|
115
|
+
__ECHO_SETUP_STARTUP__;
|
|
116
|
+
`;
|