@echomem/mcp 1.4.19 → 1.4.21

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,9 +1,22 @@
1
1
  export const SETUP_PREVIEW_STATES = [
2
2
  "consent",
3
3
  "consent-required",
4
+ "scan",
4
5
  "report",
5
6
  "extract-counting",
6
7
  "extract-ready",
8
+ "extract-free-selected",
9
+ "extract-free-trial-used",
10
+ "extract-limit",
11
+ "extract-pro-trial",
12
+ "extract-pro-active",
13
+ "extract-power-active",
14
+ "extract-team-active",
15
+ "extract-enterprise-active",
16
+ "extract-unknown",
17
+ "auth-login",
18
+ "auth-unlock",
19
+ "auth-setup",
7
20
  "extract-run",
8
21
  "extract-overdue",
9
22
  "extract-done",
@@ -200,6 +213,62 @@ function previewWatermarkScript() {
200
213
  document.body.appendChild(previewWatermark);
201
214
  `;
202
215
  }
216
+ function extractionPreviewBootstrap(options) {
217
+ const candidateCount = options.candidateCount ?? 520;
218
+ const quotaLimit = options.quotaLimit;
219
+ const quotaRemaining = options.quotaRemaining;
220
+ const historicalConversationQuota = quotaLimit == null || quotaRemaining == null
221
+ ? null
222
+ : {
223
+ used: Math.max(0, quotaLimit - quotaRemaining),
224
+ limit: quotaLimit,
225
+ remaining: quotaRemaining,
226
+ };
227
+ const billingStatus = {
228
+ plan: options.plan,
229
+ paid: options.paid,
230
+ trialAvailable: options.trialAvailable,
231
+ trialUsed: options.trialUsed,
232
+ subscriptionStatus: options.subscriptionStatus ?? null,
233
+ trialEndedAt: options.trialEndedAt ?? null,
234
+ pricingUrl: "https://echoknows.com/pricing?source=mcp_onboarding",
235
+ account: {
236
+ displayName: "Preview User",
237
+ email: "preview@example.com",
238
+ avatarUrl: "/hud-assets/echo-face-cutout.png",
239
+ },
240
+ historicalConversationQuota,
241
+ };
242
+ return `
243
+ connected = true;
244
+ billingStatus = ${JSON.stringify(billingStatus)};
245
+ setupPlanChoice = ${JSON.stringify(options.selectFree ? "free" : "")};
246
+ stats = {
247
+ sessions: { total: ${candidateCount}, codex: ${Math.ceil(candidateCount * 0.68)}, claudeCode: ${Math.floor(candidateCount * 0.32)} },
248
+ migratable: {
249
+ pending: ${candidateCount}, pendingTotal: ${candidateCount}, pendingCodex: ${Math.ceil(candidateCount * 0.68)}, pendingClaudeCode: ${Math.floor(candidateCount * 0.32)},
250
+ alreadyMigrated: 108, skippedActive: 0,
251
+ eta: { estimatedLabel: "under 2 minutes" }, estimatedLabel: "under 2 minutes"
252
+ },
253
+ candidateSessions: Array.from({ length: ${candidateCount} }, function (_, index) {
254
+ var codex = index < ${Math.ceil(candidateCount * 0.68)};
255
+ return {
256
+ key: (codex ? "codex:" : "claude-code:") + "preview-" + index,
257
+ source: codex ? "codex" : "claude-code",
258
+ title: ["Plan the onboarding flow", "Repair memory extraction", "Review pricing limits", "Polish the EchoMem HUD"][index % 4] + " · " + (index + 1),
259
+ project: ["EchoMem Chrome", "MCP Server", "Memory Platform"][index % 3],
260
+ date: new Date(Date.UTC(2026, 6, 18 - (index % 12))).toISOString(),
261
+ characters: 42000 + index * 2700,
262
+ approxInputTokens: 10500 + index * 675,
263
+ turns: 18 + index
264
+ };
265
+ }),
266
+ discovery: { phase: "account", exact: false }
267
+ };
268
+ renderDashboard();
269
+ ${options.showUnknownStatus ? 'setSetupPlanStatus("Plan check unavailable. Free still works.");' : ""}
270
+ ${options.openSessionPicker ? "window.setTimeout(function () { openSessionPicker(); }, 0);" : ""}`;
271
+ }
203
272
  export function renderSetupPreviewBootstrap(state) {
204
273
  const watermark = previewWatermarkScript();
205
274
  if (state === "consent") {
@@ -211,6 +280,17 @@ export function renderSetupPreviewBootstrap(state) {
211
280
  renderLocalScanConsent();
212
281
  setConsentStatus("Local history access is required to continue setup. Nothing will be scanned or uploaded unless you allow it.", "required");`;
213
282
  }
283
+ if (state === "scan") {
284
+ return `${watermark}
285
+ reportEnvelope = {
286
+ schemaVersion: 1,
287
+ kind: "scanning",
288
+ mode: "preview",
289
+ scanId: "design-preview",
290
+ progress: { stage: "classifying-sessions", label: "Classifying repeated context", scanned: 116, total: 180, stageElapsedMs: 3000 }
291
+ };
292
+ renderLoading();`;
293
+ }
214
294
  if (state === "report") {
215
295
  const reportJson = JSON.stringify(previewReport);
216
296
  return `${watermark}
@@ -223,43 +303,66 @@ export function renderSetupPreviewBootstrap(state) {
223
303
  stats = null;
224
304
  renderDashboard();`;
225
305
  }
226
- if (state === "extract-ready") {
227
- return `${watermark}
228
- connected = true;
229
- billingStatus = {
230
- plan: "free", paid: false, trialAvailable: true,
231
- pricingUrl: "https://echoknows.com/pricing?source=mcp_onboarding",
232
- account: {
233
- displayName: "Erik Hein",
234
- email: "erik@example.com",
235
- avatarUrl: "/hud-assets/echo-face-cutout.png"
236
- },
237
- historicalConversationQuota: { used: 72, limit: 100, remaining: 28 }
238
- };
239
- stats = {
240
- sessions: { total: 136, codex: 82, claudeCode: 54 },
241
- migratable: {
242
- pending: 28, pendingTotal: 28, pendingCodex: 19, pendingClaudeCode: 9,
243
- alreadyMigrated: 108, skippedActive: 0,
244
- eta: { estimatedLabel: "under 2 minutes" }, estimatedLabel: "under 2 minutes"
245
- },
246
- candidateSessions: Array.from({ length: 28 }, function (_, index) {
247
- var codex = index < 19;
248
- return {
249
- key: (codex ? "codex:" : "claude-code:") + "preview-" + index,
250
- source: codex ? "codex" : "claude-code",
251
- title: ["Plan the onboarding flow", "Repair memory extraction", "Review pricing limits", "Polish the EchoMem HUD"][index % 4] + " · " + (index + 1),
252
- project: ["EchoMem Chrome", "MCP Server", "Memory Platform"][index % 3],
253
- date: new Date(Date.UTC(2026, 6, 18 - (index % 12))).toISOString(),
254
- characters: 42000 + index * 2700,
255
- approxInputTokens: 10500 + index * 675,
256
- turns: 18 + index
257
- };
258
- }),
259
- discovery: { phase: "account", exact: false }
260
- };
261
- renderDashboard();`;
262
- }
306
+ if (state === "extract-ready")
307
+ return `${watermark}${extractionPreviewBootstrap({
308
+ plan: "free", paid: false, trialAvailable: true, trialUsed: false,
309
+ quotaLimit: 100, quotaRemaining: 28, candidateCount: 28,
310
+ })}`;
311
+ if (state === "extract-free-selected")
312
+ return `${watermark}${extractionPreviewBootstrap({
313
+ plan: "free", paid: false, trialAvailable: true, trialUsed: false,
314
+ quotaLimit: 100, quotaRemaining: 100, selectFree: true,
315
+ })}`;
316
+ if (state === "extract-free-trial-used")
317
+ return `${watermark}${extractionPreviewBootstrap({
318
+ plan: "free", paid: false, trialAvailable: false, trialUsed: true,
319
+ subscriptionStatus: "expired", trialEndedAt: "2026-07-20T00:00:00.000Z",
320
+ quotaLimit: 100, quotaRemaining: 100,
321
+ })}`;
322
+ if (state === "extract-limit")
323
+ return `${watermark}${extractionPreviewBootstrap({
324
+ plan: "free", paid: false, trialAvailable: false, trialUsed: true,
325
+ quotaLimit: 100, quotaRemaining: 0, selectFree: true, openSessionPicker: true,
326
+ })}`;
327
+ if (state === "extract-pro-trial")
328
+ return `${watermark}${extractionPreviewBootstrap({
329
+ plan: "pro", paid: true, trialAvailable: false, trialUsed: true,
330
+ subscriptionStatus: "trialing", trialEndedAt: "2026-08-04T00:00:00.000Z",
331
+ // The server currently grants trialing users Free's lifetime history allowance,
332
+ // even though recurring processing/search allowances resolve to Pro.
333
+ quotaLimit: 100, quotaRemaining: 100,
334
+ })}`;
335
+ if (state === "extract-pro-active")
336
+ return `${watermark}${extractionPreviewBootstrap({
337
+ plan: "pro", paid: true, trialAvailable: false, trialUsed: true,
338
+ subscriptionStatus: "active", quotaLimit: 250, quotaRemaining: 250,
339
+ })}`;
340
+ if (state === "extract-power-active")
341
+ return `${watermark}${extractionPreviewBootstrap({
342
+ plan: "power", paid: true, trialAvailable: false, trialUsed: true,
343
+ subscriptionStatus: "active", quotaLimit: 500, quotaRemaining: 500,
344
+ })}`;
345
+ if (state === "extract-team-active")
346
+ return `${watermark}${extractionPreviewBootstrap({
347
+ plan: "team", paid: true, trialAvailable: false, trialUsed: true,
348
+ subscriptionStatus: "active", quotaLimit: 250, quotaRemaining: 250,
349
+ })}`;
350
+ if (state === "extract-enterprise-active")
351
+ return `${watermark}${extractionPreviewBootstrap({
352
+ plan: "enterprise", paid: true, trialAvailable: false, trialUsed: true,
353
+ subscriptionStatus: "active", quotaLimit: 500, quotaRemaining: 500,
354
+ })}`;
355
+ if (state === "extract-unknown")
356
+ return `${watermark}${extractionPreviewBootstrap({
357
+ plan: "unknown", paid: false, trialAvailable: true, trialUsed: false,
358
+ showUnknownStatus: true,
359
+ })}`;
360
+ if (state === "auth-login")
361
+ return `${watermark}\n renderLocalLogin("");`;
362
+ if (state === "auth-unlock")
363
+ return `${watermark}\n renderLocalPassphrase("unlock", "preview@example.com");`;
364
+ if (state === "auth-setup")
365
+ return `${watermark}\n renderLocalPassphrase("setup", "preview@example.com");`;
263
366
  if (state === "extract-run") {
264
367
  return `${watermark}
265
368
  renderProgress({ status: "running", total: 28, completed: 4, extracted: 19, failed: 1, latest: "preview session", latestRepo: "Preview Workspace" });`;