@echomem/mcp 1.4.68 → 1.4.70
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/README.md +7 -0
- package/dist/durable-entry.js +55 -1
- package/dist/headless-runtime.js +11 -2
- package/dist/hud/hooks.js +90 -3
- package/dist/hud/server.js +1 -1
- package/dist/hud/web.js +1 -1
- package/dist/index.js +73 -13
- package/dist/package-metadata.js +21 -2
- package/dist/save-checkpoint-hook.js +8 -3
- package/dist/setup-page/client-extraction.js +27 -46
- package/dist/setup-preview.js +24 -24
- package/dist/setup.js +7 -5
- package/dist/source-session-hook.js +2 -0
- package/dist/v1-contract.js +8 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -134,6 +134,13 @@ Both hook entries are merged idempotently into `~/.codex/hooks.json` and
|
|
|
134
134
|
`~/.claude/settings.json`; unrelated user hooks and settings are preserved. Hooks fail open when
|
|
135
135
|
their local input is missing so they cannot prevent a conversation from starting or finishing.
|
|
136
136
|
|
|
137
|
+
When setup runs from Echo Desktop or the standalone runtime, hook commands point at a path that
|
|
138
|
+
follows runtime updates: Desktop's `current` folder, or `~/.echomem/mcp-runtime/hud-launcher.mjs`,
|
|
139
|
+
which runs whichever standalone version is active. Each MCP server those runtimes start also
|
|
140
|
+
repoints EchoMem hooks that older installers pinned to a version folder or the npx cache, and any
|
|
141
|
+
that name a missing file. A working Codex hook is left for the next setup run, since Codex asks
|
|
142
|
+
users to re-trust changed hooks. A checkout, global install, or npx copy never repoints hooks.
|
|
143
|
+
|
|
137
144
|
### Cloud Cowork through `remote-devices`
|
|
138
145
|
|
|
139
146
|
Cloud Cowork inference cannot use the local hook or transcript-verification path. The shared local
|
package/dist/durable-entry.js
CHANGED
|
@@ -2,7 +2,7 @@ import { spawnSync } from "node:child_process";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { installHeadlessRuntimeSync, readHeadlessRuntimeInstallation } from "./headless-runtime.js";
|
|
5
|
+
import { ensureHudLauncher, installHeadlessRuntimeSync, readHeadlessRuntimeInstallation } from "./headless-runtime.js";
|
|
6
6
|
import { MCP_PACKAGE_NAME, MCP_PACKAGE_VERSION } from "./package-metadata.js";
|
|
7
7
|
/**
|
|
8
8
|
* Resolving a DURABLE path to this package's own files.
|
|
@@ -70,6 +70,60 @@ export function resolveDurableDistPath(relative) {
|
|
|
70
70
|
}
|
|
71
71
|
return { path: local, ephemeral: localIsEphemeral };
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Echo Desktop runs this package from `<root>/versions/<v>/dist` and moves the `<root>/current` link
|
|
75
|
+
* to each new version. When `current` points at this copy, return the running node and dist
|
|
76
|
+
* directory as seen through that link, so a persisted path follows Desktop updates. Node resolves
|
|
77
|
+
* links when it loads a module, so the running paths alone always name the version folder. Null for
|
|
78
|
+
* any other layout, and for a superseded copy that `current` no longer points at.
|
|
79
|
+
*/
|
|
80
|
+
export function desktopCurrentPaths(distDir = runningDistDir(), execPath = process.execPath) {
|
|
81
|
+
try {
|
|
82
|
+
const dist = fs.realpathSync(distDir);
|
|
83
|
+
const versionDir = path.dirname(dist);
|
|
84
|
+
if (path.basename(path.dirname(versionDir)) !== "versions")
|
|
85
|
+
return null;
|
|
86
|
+
const current = path.join(path.dirname(path.dirname(versionDir)), "current");
|
|
87
|
+
if (fs.realpathSync(current) !== versionDir)
|
|
88
|
+
return null;
|
|
89
|
+
const bundledNode = path.relative(versionDir, fs.realpathSync(execPath));
|
|
90
|
+
const node = bundledNode && !bundledNode.startsWith("..") && !path.isAbsolute(bundledNode)
|
|
91
|
+
? path.join(current, bundledNode)
|
|
92
|
+
: execPath;
|
|
93
|
+
return { node, dist: path.join(current, path.basename(dist)) };
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Where a lifecycle hook should point so it keeps following runtime updates: Echo Desktop's
|
|
101
|
+
* `current` link, else the standalone runtime's hud launcher. Only the copy a runtime currently runs
|
|
102
|
+
* gets one. A checkout, global install, npx copy, or superseded version gets null, so it never
|
|
103
|
+
* points hooks at a runtime other than itself.
|
|
104
|
+
*/
|
|
105
|
+
export function stableHudCommandTarget() {
|
|
106
|
+
const desktop = desktopCurrentPaths();
|
|
107
|
+
if (desktop)
|
|
108
|
+
return { node: desktop.node, cli: path.join(desktop.dist, "hud", "cli.js") };
|
|
109
|
+
const standalone = readHeadlessRuntimeInstallation();
|
|
110
|
+
if (!standalone || !isSamePath(runningDistDir(), path.dirname(standalone.entry)))
|
|
111
|
+
return null;
|
|
112
|
+
try {
|
|
113
|
+
return { node: process.execPath, cli: ensureHudLauncher() };
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function isSamePath(a, b) {
|
|
120
|
+
try {
|
|
121
|
+
return fs.realpathSync(a) === fs.realpathSync(b);
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
73
127
|
/** Set on the child so a re-exec can never recurse. */
|
|
74
128
|
const REEXEC_GUARD = "ECHO_DURABLE_REEXEC";
|
|
75
129
|
/**
|
package/dist/headless-runtime.js
CHANGED
|
@@ -19,6 +19,9 @@ function activeRuntimePath() {
|
|
|
19
19
|
export function headlessLauncherPath() {
|
|
20
20
|
return path.join(headlessRuntimeRoot(), "launcher.mjs");
|
|
21
21
|
}
|
|
22
|
+
export function headlessHudLauncherPath() {
|
|
23
|
+
return path.join(headlessRuntimeRoot(), "hud-launcher.mjs");
|
|
24
|
+
}
|
|
22
25
|
function packageEntryForPrefix(prefix) {
|
|
23
26
|
return path.join(prefix, "node_modules", ...MCP_PACKAGE_NAME.split("/"), "dist", "index.js");
|
|
24
27
|
}
|
|
@@ -48,8 +51,14 @@ function atomicWriteJson(file, value) {
|
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
function ensureLauncher() {
|
|
54
|
+
return ensureLauncherFile(headlessLauncherPath(), "path.resolve(root, active.entry)");
|
|
55
|
+
}
|
|
56
|
+
/** Like launcher.mjs, but runs the active runtime's hud CLI, so lifecycle hooks follow updates too. */
|
|
57
|
+
export function ensureHudLauncher() {
|
|
58
|
+
return ensureLauncherFile(headlessHudLauncherPath(), 'path.join(path.dirname(path.resolve(root, active.entry)), "hud", "cli.js")');
|
|
59
|
+
}
|
|
60
|
+
function ensureLauncherFile(launcher, entryExpression) {
|
|
51
61
|
const root = headlessRuntimeRoot();
|
|
52
|
-
const launcher = headlessLauncherPath();
|
|
53
62
|
fs.mkdirSync(root, { recursive: true, mode: 0o700 });
|
|
54
63
|
const source = [
|
|
55
64
|
"#!/usr/bin/env node",
|
|
@@ -61,7 +70,7 @@ function ensureLauncher() {
|
|
|
61
70
|
'if (active.layout !== 1 || typeof active.entry !== "string" || path.isAbsolute(active.entry) || active.entry.split(/[\\\\/]/).includes("..")) {',
|
|
62
71
|
' throw new Error("EchoMem MCP runtime pointer is invalid; run `npx -y @echomem/mcp@latest update --all`.");',
|
|
63
72
|
"}",
|
|
64
|
-
|
|
73
|
+
`const entry = ${entryExpression};`,
|
|
65
74
|
'if (!fs.existsSync(entry)) throw new Error("EchoMem MCP runtime is missing; run `npx -y @echomem/mcp@latest update --all`.");',
|
|
66
75
|
"await import(pathToFileURL(entry).href);",
|
|
67
76
|
"",
|
package/dist/hud/hooks.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { atomicWriteJsonObject, readJsonObjectFile } from "../config-files.js";
|
|
5
|
-
import { resolveDurableDistPath } from "../durable-entry.js";
|
|
5
|
+
import { isEphemeralNpxPath, resolveDurableDistPath, stableHudCommandTarget } from "../durable-entry.js";
|
|
6
6
|
/**
|
|
7
7
|
* Hook commands are persisted into another program's settings and must keep working long after this
|
|
8
8
|
* process exits. Resolving them from `import.meta.url` pins them to whatever copy happens to be
|
|
@@ -88,6 +88,86 @@ export function removeLifecycleHooks(mode) {
|
|
|
88
88
|
}
|
|
89
89
|
return { files, removedGroups };
|
|
90
90
|
}
|
|
91
|
+
const LIFECYCLE_COMMAND = /^"((?:[^"\\]|\\.)*)" "((?:[^"\\]|\\.)*)" (save-checkpoint|bind-source-session)$/;
|
|
92
|
+
/**
|
|
93
|
+
* Repoint installed EchoMem lifecycle hooks that are pinned to a runtime version folder or the npx
|
|
94
|
+
* cache, or that name a file that no longer exists. Runtime updates never rerun setup, so such a
|
|
95
|
+
* hook keeps running whichever version wrote it. Only the copy Echo Desktop or the standalone
|
|
96
|
+
* runtime currently runs does this; see stableHudCommandTarget. Only EchoMem's own commands change
|
|
97
|
+
* and no hook is ever added. Working Codex hooks are kept, because Codex makes the user re-trust
|
|
98
|
+
* every changed hook. Returns the files written; any failure leaves that file untouched.
|
|
99
|
+
*/
|
|
100
|
+
export function refreshInstalledLifecycleHooks() {
|
|
101
|
+
const target = stableHudCommandTarget();
|
|
102
|
+
if (!target)
|
|
103
|
+
return [];
|
|
104
|
+
const files = [];
|
|
105
|
+
for (const [envKey, fallbackName, fileName, repairPinned] of [
|
|
106
|
+
["CLAUDE_CONFIG_DIR", ".claude", "settings.json", true],
|
|
107
|
+
["CODEX_HOME", ".codex", "hooks.json", false],
|
|
108
|
+
]) {
|
|
109
|
+
try {
|
|
110
|
+
const file = path.join(profileDirectory(envKey, fallbackName), fileName);
|
|
111
|
+
if (fs.lstatSync(file).isSymbolicLink())
|
|
112
|
+
continue;
|
|
113
|
+
const content = readHooksFile(file);
|
|
114
|
+
if (!refreshLifecycleCommands(content.hooks, target, repairPinned))
|
|
115
|
+
continue;
|
|
116
|
+
atomicWriteJsonObject(file, content);
|
|
117
|
+
files.push(file);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
/* Missing, unreadable, or invalid settings stay exactly as they are. */
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return files;
|
|
124
|
+
}
|
|
125
|
+
function refreshLifecycleCommands(hooks, target, repairPinned) {
|
|
126
|
+
if (!hooks || typeof hooks !== "object" || Array.isArray(hooks))
|
|
127
|
+
return false;
|
|
128
|
+
let changed = false;
|
|
129
|
+
for (const groups of Object.values(hooks)) {
|
|
130
|
+
if (!Array.isArray(groups))
|
|
131
|
+
continue;
|
|
132
|
+
for (const group of groups.filter(isEchoLifecycleGroup)) {
|
|
133
|
+
const entries = group.hooks;
|
|
134
|
+
if (!Array.isArray(entries))
|
|
135
|
+
continue;
|
|
136
|
+
for (const entry of entries) {
|
|
137
|
+
if (typeof entry !== "object" || entry === null)
|
|
138
|
+
continue;
|
|
139
|
+
const hook = entry;
|
|
140
|
+
// Codex runs commandWindows on Windows, and the two can drift apart, so judge each on its own.
|
|
141
|
+
for (const field of ["command", "commandWindows"]) {
|
|
142
|
+
const replacement = refreshedLifecycleCommand(hook[field], target, repairPinned);
|
|
143
|
+
if (!replacement)
|
|
144
|
+
continue;
|
|
145
|
+
hook[field] = replacement;
|
|
146
|
+
changed = true;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return changed;
|
|
152
|
+
}
|
|
153
|
+
function refreshedLifecycleCommand(command, target, repairPinned) {
|
|
154
|
+
const match = typeof command === "string" ? LIFECYCLE_COMMAND.exec(command) : null;
|
|
155
|
+
if (!match)
|
|
156
|
+
return null;
|
|
157
|
+
const replacement = `${JSON.stringify(target.node)} ${JSON.stringify(target.cli)} ${match[3]}`;
|
|
158
|
+
if (replacement === command)
|
|
159
|
+
return null;
|
|
160
|
+
const [node, script] = [match[1], match[2]].map((quoted) => JSON.parse(`"${quoted}"`));
|
|
161
|
+
if (!fs.existsSync(node) || !fs.existsSync(script))
|
|
162
|
+
return replacement;
|
|
163
|
+
return repairPinned && isPinnedRuntimePath(script) ? replacement : null;
|
|
164
|
+
}
|
|
165
|
+
/** Inside a `versions/<semver>` folder or the npx cache: correct only until the next update. */
|
|
166
|
+
function isPinnedRuntimePath(file) {
|
|
167
|
+
const parts = file.split(/[\\/]/);
|
|
168
|
+
return isEphemeralNpxPath(file)
|
|
169
|
+
|| parts.some((part, index) => part === "versions" && /^\d+\.\d+\.\d+/.test(parts[index + 1] ?? ""));
|
|
170
|
+
}
|
|
91
171
|
function installCodexHooks() {
|
|
92
172
|
const dir = profileDirectory("CODEX_HOME", ".codex");
|
|
93
173
|
const file = path.join(dir, "hooks.json");
|
|
@@ -102,10 +182,17 @@ function installCodexHooks() {
|
|
|
102
182
|
return file;
|
|
103
183
|
}
|
|
104
184
|
function saveCheckpointCommand() {
|
|
105
|
-
return
|
|
185
|
+
return lifecycleHookCommand("save-checkpoint");
|
|
106
186
|
}
|
|
107
187
|
function sourceSessionCommand() {
|
|
108
|
-
return
|
|
188
|
+
return lifecycleHookCommand("bind-source-session");
|
|
189
|
+
}
|
|
190
|
+
/** Prefer a target that follows runtime updates: a hook pinned to one version keeps running it. */
|
|
191
|
+
function lifecycleHookCommand(subcommand) {
|
|
192
|
+
const target = stableHudCommandTarget();
|
|
193
|
+
if (!target)
|
|
194
|
+
return hookCommandFor(path.join("hud", "cli.js"), subcommand);
|
|
195
|
+
return `${JSON.stringify(target.node)} ${JSON.stringify(target.cli)} ${subcommand}`;
|
|
109
196
|
}
|
|
110
197
|
function installCodexSourceSessionHook() {
|
|
111
198
|
const dir = profileDirectory("CODEX_HOME", ".codex");
|
package/dist/hud/server.js
CHANGED
|
@@ -13,7 +13,7 @@ import { assembleCodex, assembleClaude } from "../migrate.js";
|
|
|
13
13
|
import { readBillingAlert } from "../billing-alert.js";
|
|
14
14
|
import { readSessionWorkingDirectory, } from "./session-launcher.js";
|
|
15
15
|
const API_BASE = (process.env.ECHO_API_BASE_URL || "https://echo-mem-chrome.vercel.app").replace(/\/$/, "");
|
|
16
|
-
const PRICING_URL = (process.env.ECHO_PRICING_URL || "https://echoknows.com/account").replace(/\/$/, "");
|
|
16
|
+
const PRICING_URL = (process.env.ECHO_PRICING_URL || "https://echoknows.com/dashboard/account").replace(/\/$/, "");
|
|
17
17
|
export async function createHudServer(opts = {}) {
|
|
18
18
|
const mode = opts.mode || "auto";
|
|
19
19
|
const port = opts.port ?? 17377;
|
package/dist/hud/web.js
CHANGED
|
@@ -1729,7 +1729,7 @@ export const HUD_HTML = String.raw `<!doctype html>
|
|
|
1729
1729
|
state: "ok",
|
|
1730
1730
|
plan: "pro",
|
|
1731
1731
|
paid: true,
|
|
1732
|
-
pricingUrl: "https://echoknows.com/account?source=hud_preview",
|
|
1732
|
+
pricingUrl: "https://echoknows.com/dashboard/account?source=hud_preview",
|
|
1733
1733
|
memoryProcessingQuota: { used: previewProcessingUsed, limit: 200000, remaining: 200000 - previewProcessingUsed, resetAt: new Date(Date.now() + 31 * 60 * 60 * 1000).toISOString() },
|
|
1734
1734
|
memorySearchQuota: { used: previewSearchUsed, limit: 500, remaining: 500 - previewSearchUsed, resetAt: new Date(Date.now() + 31 * 60 * 60 * 1000).toISOString() },
|
|
1735
1735
|
historicalConversationQuota: { used: 191, limit: 500, remaining: 309 },
|
package/dist/index.js
CHANGED
|
@@ -8,18 +8,19 @@ import { acknowledgeWorkspaceTicketReviewSchema, applyWorkspaceTicketActionSchem
|
|
|
8
8
|
import { KeyStore } from "./keystore.js";
|
|
9
9
|
import { EventLogger, hashText } from "./events.js";
|
|
10
10
|
import { contextHealthMarkdown, recomposeCapsuleMarkdown } from "./hud/api.js";
|
|
11
|
+
import { refreshInstalledLifecycleHooks } from "./hud/hooks.js";
|
|
11
12
|
import { createHash, randomUUID } from "node:crypto";
|
|
12
13
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
13
14
|
import { fetchEncryptionConfig, decryptMemoryFields, verifyKeyB64, } from "./encryption.js";
|
|
14
15
|
import { refreshInstalledMemoryGuidance, runCli } from "./setup.js";
|
|
15
|
-
import { MCP_PACKAGE_VERSION, MCP_SERVER_INSTRUCTIONS, MEMORY_CITATION_INSTRUCTION, SAVED_MEMORY_RECEIPT_INSTRUCTION, } from "./package-metadata.js";
|
|
16
|
+
import { MCP_PACKAGE_VERSION, MCP_SERVER_INSTRUCTIONS, MEMORY_CITATION_INSTRUCTION, SAVED_MEMORY_RECEIPT_INSTRUCTION, GROUP_SESSION_SHARING_DISABLED_NOTE, GROUP_SESSION_SHARING_PROMPTS_ENABLED, } from "./package-metadata.js";
|
|
16
17
|
import { clearBillingAlert, writeBillingAlert } from "./billing-alert.js";
|
|
17
18
|
import { checkLatestUpdateStatus, formatUpdateNotice, formatUpdateStatusText, startBackgroundUpdateCheck, } from "./update-check.js";
|
|
18
19
|
import { autoUpdateHeadlessRuntime } from "./headless-runtime.js";
|
|
19
20
|
import { formatTicketFilingPacket, formatWorkspaceTicketOverview, ticketAddressById, } from "./ticket-review-format.js";
|
|
20
21
|
import { SOURCE_SESSION_CLOUD_TOOL_ARGUMENT_EVIDENCE, resolveCloudCoworkSessionFromToolArguments, resolveSourceSessionRequestContext, resolveSourceSessionFromBindingToken, resolveSourceSessionFromBindingTokenWithRetry, } from "./source-session.js";
|
|
21
22
|
const ECHO_API_BASE_URL = process.env.ECHO_API_BASE_URL || "https://echo-mem-chrome.vercel.app";
|
|
22
|
-
const ECHO_PRICING_URL = process.env.ECHO_PRICING_URL || "https://echoknows.com/account";
|
|
23
|
+
const ECHO_PRICING_URL = process.env.ECHO_PRICING_URL || "https://echoknows.com/dashboard/account";
|
|
23
24
|
const ECHO_MEMORY_WEB_URL = (process.env.ECHO_MEMORY_WEB_URL || "https://echoknows.com/memory").replace(/\/$/, "");
|
|
24
25
|
const DESKTOP_MANAGED = process.env.ECHO_DESKTOP_MANAGED === "1";
|
|
25
26
|
const CONNECT_DEVICE_INSTRUCTION = DESKTOP_MANAGED
|
|
@@ -125,6 +126,25 @@ function appendPricingSource(url, source) {
|
|
|
125
126
|
return url;
|
|
126
127
|
}
|
|
127
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* A browser cannot tell whether Echo Desktop is installed, but a desktop-managed
|
|
131
|
+
* runtime knows it is. The hint lets the account page offer to open the app
|
|
132
|
+
* instead of guessing with a timed redirect.
|
|
133
|
+
*/
|
|
134
|
+
function appendDesktopClientHint(url) {
|
|
135
|
+
if (!DESKTOP_MANAGED)
|
|
136
|
+
return url;
|
|
137
|
+
try {
|
|
138
|
+
const parsed = new URL(url);
|
|
139
|
+
if (!parsed.searchParams.has("client")) {
|
|
140
|
+
parsed.searchParams.set("client", "desktop");
|
|
141
|
+
}
|
|
142
|
+
return parsed.toString();
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return url;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
128
148
|
function formatUpgradeRequiredResult(error) {
|
|
129
149
|
if (!axios.isAxiosError(error))
|
|
130
150
|
return null;
|
|
@@ -142,7 +162,7 @@ function formatUpgradeRequiredResult(error) {
|
|
|
142
162
|
?? "Memory search and recall require an Echo Pro or Power plan.";
|
|
143
163
|
const code = readString(data, "error") ?? readString(data, "code");
|
|
144
164
|
const plan = readString(data, "plan");
|
|
145
|
-
const pricingUrl = appendPricingSource(upgradeUrl, "mcp_search");
|
|
165
|
+
const pricingUrl = appendDesktopClientHint(appendPricingSource(upgradeUrl, "mcp_search"));
|
|
146
166
|
const normalizedCode = String(code || "").toUpperCase();
|
|
147
167
|
const kind = status === 429 || normalizedCode.includes("QUOTA") || normalizedCode.includes("LIMIT")
|
|
148
168
|
? "quota_exceeded"
|
|
@@ -157,7 +177,7 @@ function formatUpgradeRequiredResult(error) {
|
|
|
157
177
|
pricingUrl,
|
|
158
178
|
});
|
|
159
179
|
return [
|
|
160
|
-
"ACTION REQUIRED: tell the user to
|
|
180
|
+
"ACTION REQUIRED: tell the user to choose a subscription at this exact URL:",
|
|
161
181
|
pricingUrl,
|
|
162
182
|
"When replying, include the exact URL above. Do not reply only with \"connect\" or \"upgrade\".",
|
|
163
183
|
"",
|
|
@@ -689,6 +709,10 @@ function inputAnalyticsForTool(canonicalName, args) {
|
|
|
689
709
|
function toolEventName(canonicalName, status) {
|
|
690
710
|
return `[MCP] ${canonicalName} ${status}`;
|
|
691
711
|
}
|
|
712
|
+
const GROUP_SESSION_SHARING_DISABLED_MESSAGE = [
|
|
713
|
+
"Agent-driven group sharing is disabled. This conversation's memories stay private.",
|
|
714
|
+
GROUP_SESSION_SHARING_DISABLED_NOTE,
|
|
715
|
+
].join(" ");
|
|
692
716
|
const SUBAGENT_DURABLE_WRITE_MESSAGE = [
|
|
693
717
|
"Codex subagents cannot save EchoMem memories or manage conversation sharing.",
|
|
694
718
|
"Return durable findings to the root agent; the root agent must consolidate them and call save_conversation once.",
|
|
@@ -802,6 +826,7 @@ class EchoMemApiClient {
|
|
|
802
826
|
providerSessionId: identity.providerSessionId,
|
|
803
827
|
providerSessionAliases: identity.providerSessionAliases,
|
|
804
828
|
evidence: identity.evidence,
|
|
829
|
+
runtime_version: MCP_PACKAGE_VERSION,
|
|
805
830
|
}, { headers: { "X-EchoMem-Origin-Channel": "local_mcp" } });
|
|
806
831
|
const contextId = readString(response.data, "contextId");
|
|
807
832
|
const canonicalKey = readString(response.data, "canonicalKey");
|
|
@@ -979,7 +1004,13 @@ class EchoMemApiClient {
|
|
|
979
1004
|
if (!this.hasToken())
|
|
980
1005
|
return;
|
|
981
1006
|
try {
|
|
982
|
-
await this.axios.post("/api/extension/mcp/events", {
|
|
1007
|
+
await this.axios.post("/api/extension/mcp/events", {
|
|
1008
|
+
eventType,
|
|
1009
|
+
// Stamp at the transport boundary so every emitted lifecycle event
|
|
1010
|
+
// uses this installed package, never caller-supplied metadata.
|
|
1011
|
+
eventProperties: { ...eventProperties, runtime_version: MCP_PACKAGE_VERSION },
|
|
1012
|
+
insertId,
|
|
1013
|
+
}, { timeout: 1500 });
|
|
983
1014
|
}
|
|
984
1015
|
catch {
|
|
985
1016
|
// Remote analytics is best-effort and must never change MCP behavior.
|
|
@@ -2313,7 +2344,9 @@ Details: ${m.details || "N/A"}`)
|
|
|
2313
2344
|
syncedGroupNames.length
|
|
2314
2345
|
? `Saved privately first and synced to approved groups: ${syncedGroupNames.join(", ")}.`
|
|
2315
2346
|
: "Saved to your private memory.",
|
|
2316
|
-
|
|
2347
|
+
GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
2348
|
+
? `This user has multiple groups: ${availableGroups.map((group) => `${readString(group, "name") ?? "Unnamed group"} (${readString(group, "id") ?? "unknown id"})`).join(", ")}. Call request_group_session_sharing with this conversation scope and one groupId at a time to obtain a separate text confirmation question for each group.`
|
|
2349
|
+
: "",
|
|
2317
2350
|
failedSyncs.length
|
|
2318
2351
|
? `${failedSyncs.length} approved group sync(s) failed; private memories were preserved.`
|
|
2319
2352
|
: "",
|
|
@@ -2322,7 +2355,9 @@ Details: ${m.details || "N/A"}`)
|
|
|
2322
2355
|
: "",
|
|
2323
2356
|
].filter(Boolean).join(" ")
|
|
2324
2357
|
: sharing?.decision === null || sharing?.decision === undefined
|
|
2325
|
-
?
|
|
2358
|
+
? GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
2359
|
+
? `Saved to your private memory. Call request_group_session_sharing with this conversation scope${readString(sharingGroup, "id") ? ` and groupId ${readString(sharingGroup, "id")}` : ""}, relay its exact text question for ${readString(sharingGroup, "name") ?? "your current group"}, and call set_group_session_sharing only after an explicit Yes or No. Silence leaves the state unset.`
|
|
2360
|
+
: "Saved to your private memory."
|
|
2326
2361
|
: sharing.decision === "private"
|
|
2327
2362
|
? "Saved to your private memory."
|
|
2328
2363
|
: syncedGroupNames.length
|
|
@@ -2351,7 +2386,7 @@ Details: ${m.details || "N/A"}`)
|
|
|
2351
2386
|
const text = [
|
|
2352
2387
|
`Successfully ingested conversation. Extracted ${memoriesExtracted} memory distinct events.`,
|
|
2353
2388
|
receipt,
|
|
2354
|
-
typeof groupSharingScopeId === "string" && groupSharingScopeId
|
|
2389
|
+
GROUP_SESSION_SHARING_PROMPTS_ENABLED && typeof groupSharingScopeId === "string" && groupSharingScopeId
|
|
2355
2390
|
? `Conversation sharing scope: ${groupSharingScopeId}\nReuse this exact groupSharingScopeId only for request_group_session_sharing, set_group_session_sharing, and save_conversation calls in this conversation. Never reuse it in another conversation or save it as memory.`
|
|
2356
2391
|
: "",
|
|
2357
2392
|
typeof memoriesDiscarded === "number" && memoriesDiscarded > 0
|
|
@@ -3321,7 +3356,9 @@ Details: ${m.details || "N/A"}`;
|
|
|
3321
3356
|
participantText,
|
|
3322
3357
|
"",
|
|
3323
3358
|
"Declared titles and responsibilities are directory facts. Use search_memories with scope=workspace for current work evidence, and label suggested contribution areas as inference that should be confirmed with the team.",
|
|
3324
|
-
|
|
3359
|
+
GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
3360
|
+
? "Use request_group_session_sharing to mint or read this conversation's sharing scope; never infer sharing from the member's role, memories, or MCP transport session."
|
|
3361
|
+
: GROUP_SESSION_SHARING_DISABLED_NOTE,
|
|
3325
3362
|
currentParticipant
|
|
3326
3363
|
&& (!readString(currentParticipant, "title") || !readString(currentParticipant, "responsibilitySummary"))
|
|
3327
3364
|
? "Your group profile is incomplete. Use prepare_group_publication to review your memory evidence, propose the missing fields, and pass them only after confirmation to complete_group_publication."
|
|
@@ -3354,7 +3391,9 @@ Details: ${m.details || "N/A"}`;
|
|
|
3354
3391
|
return {
|
|
3355
3392
|
content: [{
|
|
3356
3393
|
type: "text",
|
|
3357
|
-
text:
|
|
3394
|
+
text: GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
3395
|
+
? `${scopeText}\n\nThis user belongs to multiple groups: ${choices}. Reuse this same conversation scope and call request_group_session_sharing once per groupId to obtain a separate text confirmation question for each group.`
|
|
3396
|
+
: GROUP_SESSION_SHARING_DISABLED_MESSAGE,
|
|
3358
3397
|
}],
|
|
3359
3398
|
};
|
|
3360
3399
|
}
|
|
@@ -3364,7 +3403,9 @@ Details: ${m.details || "N/A"}`;
|
|
|
3364
3403
|
return {
|
|
3365
3404
|
content: [{
|
|
3366
3405
|
type: "text",
|
|
3367
|
-
text:
|
|
3406
|
+
text: GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
3407
|
+
? `${scopeText}\n\nNo sharing decision exists for this conversation. Call request_group_session_sharing with the scope above${readString(group, "id") ? ` and groupId ${readString(group, "id")}` : ""}, relay its exact text question, and call set_group_session_sharing only after an explicit Yes or No. Silence leaves the state unset.`
|
|
3408
|
+
: GROUP_SESSION_SHARING_DISABLED_MESSAGE,
|
|
3368
3409
|
}],
|
|
3369
3410
|
};
|
|
3370
3411
|
}
|
|
@@ -3412,6 +3453,14 @@ Details: ${m.details || "N/A"}`;
|
|
|
3412
3453
|
};
|
|
3413
3454
|
}
|
|
3414
3455
|
async handleRequestGroupSessionSharing(args) {
|
|
3456
|
+
if (!GROUP_SESSION_SHARING_PROMPTS_ENABLED) {
|
|
3457
|
+
return {
|
|
3458
|
+
content: [{
|
|
3459
|
+
type: "text",
|
|
3460
|
+
text: GROUP_SESSION_SHARING_DISABLED_MESSAGE,
|
|
3461
|
+
}],
|
|
3462
|
+
};
|
|
3463
|
+
}
|
|
3415
3464
|
const parsed = requestGroupSessionSharingSchema.parse(args ?? {});
|
|
3416
3465
|
const payload = await this.client.getGroupSessionSharing(parsed);
|
|
3417
3466
|
const groupSharingScopeId = readString(payload ?? {}, "groupSharingScopeId");
|
|
@@ -3467,6 +3516,14 @@ Details: ${m.details || "N/A"}`;
|
|
|
3467
3516
|
};
|
|
3468
3517
|
}
|
|
3469
3518
|
async handleSetGroupSessionSharing(args) {
|
|
3519
|
+
if (!GROUP_SESSION_SHARING_PROMPTS_ENABLED) {
|
|
3520
|
+
return {
|
|
3521
|
+
content: [{
|
|
3522
|
+
type: "text",
|
|
3523
|
+
text: GROUP_SESSION_SHARING_DISABLED_MESSAGE,
|
|
3524
|
+
}],
|
|
3525
|
+
};
|
|
3526
|
+
}
|
|
3470
3527
|
const parsed = setGroupSessionSharingSchema.parse(args ?? {});
|
|
3471
3528
|
const payload = await this.client.setGroupSessionSharing(parsed);
|
|
3472
3529
|
return this.formatGroupSessionSharingUpdate(parsed.share, payload);
|
|
@@ -3519,8 +3576,8 @@ Details: ${m.details || "N/A"}`;
|
|
|
3519
3576
|
content: [{
|
|
3520
3577
|
type: "text",
|
|
3521
3578
|
text: payload?.alreadyMember
|
|
3522
|
-
? `You are already a member of ${payload?.group?.name ?? "this group"}. No memories were published. Use prepare_group_publication to review memories and propose any missing title or responsibility fields
|
|
3523
|
-
: `Joined ${payload?.group?.name ?? "the company group"}. No memories were published. Next use prepare_group_publication to review candidates, infer a proposed title and responsibility summary, and ask the user to confirm that profile together with the publication preview
|
|
3579
|
+
? `You are already a member of ${payload?.group?.name ?? "this group"}. No memories were published. Use prepare_group_publication to review memories and propose any missing title or responsibility fields.${GROUP_SESSION_SHARING_PROMPTS_ENABLED ? " Then call request_group_session_sharing and relay its exact text question. Silence stays unset for a later checkpoint." : ` ${GROUP_SESSION_SHARING_DISABLED_NOTE}`}`
|
|
3580
|
+
: `Joined ${payload?.group?.name ?? "the company group"}. No memories were published. Next use prepare_group_publication to review candidates, infer a proposed title and responsibility summary, and ask the user to confirm that profile together with the publication preview.${GROUP_SESSION_SHARING_PROMPTS_ENABLED ? " Also call request_group_session_sharing without a scope and relay its exact text question. Silence leaves consent unset for a later checkpoint." : ` ${GROUP_SESSION_SHARING_DISABLED_NOTE}`}`,
|
|
3524
3581
|
}],
|
|
3525
3582
|
};
|
|
3526
3583
|
}
|
|
@@ -3743,6 +3800,9 @@ async function main() {
|
|
|
3743
3800
|
// Existing standalone users may receive a new runtime without re-running setup. Refresh only
|
|
3744
3801
|
// EchoMem's marker-owned block so stale Desktop-era instructions disappear automatically.
|
|
3745
3802
|
refreshInstalledMemoryGuidance();
|
|
3803
|
+
// Lifecycle hooks go stale the same way, Desktop installs included: each keeps running the
|
|
3804
|
+
// runtime version that wrote it until something repoints it.
|
|
3805
|
+
refreshInstalledLifecycleHooks();
|
|
3746
3806
|
const store = new KeyStore();
|
|
3747
3807
|
// Serve mode is meant to be SPAWNED by the MCP client (editor), which drives us over a piped stdin.
|
|
3748
3808
|
// A human who runs the bare server in a terminal instead gets a process that blocks forever on stdio
|
package/dist/package-metadata.js
CHANGED
|
@@ -22,6 +22,12 @@ export const MCP_PACKAGE_VERSION = stringOrFallback(packageJson.version, FALLBAC
|
|
|
22
22
|
export const MCP_PACKAGE_DESCRIPTION = stringOrFallback(packageJson.description, FALLBACK_PACKAGE.description);
|
|
23
23
|
export const MCP_PACKAGE_LABEL = `${MCP_PACKAGE_NAME}@${MCP_PACKAGE_VERSION}`;
|
|
24
24
|
export const MCP_DESKTOP_MANAGED = process.env.ECHO_DESKTOP_MANAGED === "1";
|
|
25
|
+
/**
|
|
26
|
+
* Agent-driven group sharing prompts. Disabled: the user manages group sharing on their
|
|
27
|
+
* own surface, not by being asked through the agent. Flip to true to restore the ask —
|
|
28
|
+
* the tools, handlers and prompt text are all still here.
|
|
29
|
+
*/
|
|
30
|
+
export const GROUP_SESSION_SHARING_PROMPTS_ENABLED = false;
|
|
25
31
|
export const MCP_UPDATE_COMMAND = `npx -y ${MCP_PACKAGE_NAME}@latest update`;
|
|
26
32
|
export const MCP_UPDATE_ALL_COMMAND = `${MCP_UPDATE_COMMAND} --all`;
|
|
27
33
|
export const MCP_VAULT_UNLOCK_INSTRUCTION = MCP_DESKTOP_MANAGED
|
|
@@ -32,6 +38,17 @@ const MCP_UPDATE_INSTRUCTION = MCP_DESKTOP_MANAGED
|
|
|
32
38
|
: `updates auto-install in the background; on failure run \`${MCP_UPDATE_ALL_COMMAND}\``;
|
|
33
39
|
export const MEMORY_CITATION_INSTRUCTION = 'If the user-facing answer materially relies on one or more EchoMem memories, end it with a compact "EchoMem sources:" list containing only the memories actually used. For memories owned by teammates or accepted friends, call record_memory_citations immediately before the final answer with those exact Memory IDs. Do not cite memories that were merely retrieved. Use each memory key as the Markdown label and its canonical https://echoknows.com/memory/<memory-id> URL. Omit the sources section and citation receipt when no memory informed the answer.';
|
|
34
40
|
export const SAVED_MEMORY_RECEIPT_INSTRUCTION = 'After save_conversation succeeds and returns one or more saved memory IDs, make the save visible in the final user-facing answer with a compact "EchoMem saved:" list containing every memory created by that call. Use each memory key as the Markdown label and its canonical https://echoknows.com/memory/<memory-id> URL. This save receipt is separate from "EchoMem sources:" and does not imply that the newly saved memories informed the answer.';
|
|
41
|
+
const GROUP_SHARING_SURFACE = MCP_DESKTOP_MANAGED ? "in Echo Desktop" : "at echoknows.com";
|
|
42
|
+
export const GROUP_SESSION_SHARING_DISABLED_NOTE = `Never ask the user whether to share memories with a company group; the user manages group sharing ${GROUP_SHARING_SURFACE}.`;
|
|
43
|
+
export const GROUP_SESSION_SHARING_SAVE_INSTRUCTION = GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
44
|
+
? " For group sharing, reuse the exact groupSharingScopeId returned by request_group_session_sharing or an earlier save in this conversation. Never reuse it in another conversation or save it as memory. Each group has an independent decision under the same conversation scope; eligible memories sync automatically to every approved group, while flagged memories stay private. If a selected group has no decision yet, call request_group_session_sharing, relay its exact text question, and call set_group_session_sharing only after an explicit Yes or No. Silence leaves consent unset; never infer the answer."
|
|
45
|
+
: ` Saves are always private. ${GROUP_SESSION_SHARING_DISABLED_NOTE}`;
|
|
46
|
+
export const GROUP_SESSION_SHARING_CONTEXT_INSTRUCTION = GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
47
|
+
? " Conversation sharing is separate; call request_group_session_sharing instead of inferring it."
|
|
48
|
+
: "";
|
|
49
|
+
export const GROUP_SESSION_SHARING_JOIN_INSTRUCTION = GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
50
|
+
? " Also call request_group_session_sharing without a scope and relay its exact text question. Silence stays unset and should be prompted again at a later qualifying checkpoint."
|
|
51
|
+
: ` ${GROUP_SESSION_SHARING_DISABLED_NOTE}`;
|
|
35
52
|
export const MCP_SERVER_INSTRUCTIONS = [
|
|
36
53
|
`${MCP_PACKAGE_DESCRIPTION} (${MCP_PACKAGE_LABEL}).`,
|
|
37
54
|
`If stale, ${MCP_UPDATE_INSTRUCTION}; restart afterward.`,
|
|
@@ -40,11 +57,13 @@ export const MCP_SERVER_INSTRUCTIONS = [
|
|
|
40
57
|
"Before re-deriving prior decisions or preferences, use search_memories.",
|
|
41
58
|
`Before a final response for a durable decision, implementation, fix, commit, passing verification, release, or milestone, call save_conversation; skip secrets and trivial work. If locked, tell the user to ${MCP_VAULT_UNLOCK_INSTRUCTION}.`,
|
|
42
59
|
"After a successful save, show every memory created by that call in a compact EchoMem saved: list with canonical links; this is separate from \"EchoMem sources:\".",
|
|
43
|
-
|
|
60
|
+
GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
61
|
+
? "For company groups, request sharing near start or after a save; relay its exact question and set only after explicit Yes/No. Reuse its scope only in this conversation; each group needs a choice, silence means unset, and flagged memories stay private."
|
|
62
|
+
: `Saves stay private. ${GROUP_SESSION_SHARING_DISABLED_NOTE}`,
|
|
44
63
|
"EchoMem credential identity overrides profiles, hosts, git identity, and inference. Use get_group_context for workspace orientation and search_memories with scope=workspace for shared work.",
|
|
45
64
|
"For memory-informed final answers, record exact used teammate/friend IDs with a unique receiptId, then end with an EchoMem sources: list using memory keys and canonical https://echoknows.com/memory/<memory-id> links.",
|
|
46
65
|
"Group profiles, sharing, publication, sensitive flags, and deletion require explicit confirmation. Never store or log an echo_grp_ invite code.",
|
|
47
|
-
].join(" ");
|
|
66
|
+
].filter(Boolean).join(" ");
|
|
48
67
|
export function withMcpVersion(description) {
|
|
49
68
|
return `${description}\n\nEchoMem MCP bridge: ${MCP_PACKAGE_LABEL}.`;
|
|
50
69
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
+
import { GROUP_SESSION_SHARING_DISABLED_NOTE, GROUP_SESSION_SHARING_PROMPTS_ENABLED } from "./package-metadata.js";
|
|
2
3
|
const SAVE_TOOL_RE = /^(?:mcp__[\w.-]+__)?save_conversation$/i;
|
|
3
4
|
const MUTATION_TOOL_RE = /(?:^|[._])(?:apply_patch|Edit|Write)$/i;
|
|
4
5
|
const DURABLE_COMMAND_RE = /\b(?:git\s+commit|npm\s+(?:run\s+)?(?:test|build|lint)|pnpm\s+(?:test|build|lint)|yarn\s+(?:test|build|lint)|pytest|cargo\s+test|go\s+test|deploy|publish)\b/i;
|
|
@@ -7,9 +8,13 @@ const CHECKPOINT_REASON = [
|
|
|
7
8
|
"Run EchoMem's private completion checkpoint before finishing this turn.",
|
|
8
9
|
"Review the work that just completed. If it produced a durable decision, confirmed preference, implementation, resolved bug, commit, passing verification, release, or project milestone, call `save_conversation` now. Prefer the `messages` field and omit `conversation`: copy the smallest relevant contiguous set of user and assistant turns verbatim, preserving role and order. Exclude system instructions, tool calls, and hidden content. Use at most six messages and 12,000 total characters; drop whole older turns instead of truncating or rewriting them. If exact source text is unavailable, use `conversation` with a concise structured summary prefixed `Summary (source excerpt unavailable):`.",
|
|
9
10
|
"Do not save secrets or incidental chatter. If the work was not durable, do not call the tool and finish normally.",
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
...(GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
12
|
+
? [
|
|
13
|
+
"Private persistence happens first. For a user with a company group, call `request_group_session_sharing` near conversation start or after a qualifying private save.",
|
|
14
|
+
"On the first request_group_session_sharing call in a conversation, omit groupSharingScopeId so EchoMem mints a fresh opaque scope. Reuse that exact scope only in this conversation for later get/request/set/save calls, and never persist it as memory. If multiple groups are returned, reuse the same scope and call once per groupId. Relay the tool's exact text question and call set_group_session_sharing only after an explicit Yes/No. Silence leaves that group's state unset. A Share decision syncs eligible memories from later saves carrying the same scope to that group; saves automatically sync to every approved group. Keep private keeps them private for that group.",
|
|
15
|
+
"Flagged memories are withheld from automatic conversation sync and remain private.",
|
|
16
|
+
]
|
|
17
|
+
: [`Saves are always private. ${GROUP_SESSION_SHARING_DISABLED_NOTE}`]),
|
|
13
18
|
"If EchoMem reports that the encrypted vault is locked, relay its local unlock instruction; for a standalone installation, use `echomem-mcp unlock`. Never silently skip a qualifying checkpoint.",
|
|
14
19
|
].join(" ");
|
|
15
20
|
function currentTurnSlice(transcript) {
|
|
@@ -658,13 +658,11 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
658
658
|
function historicalSelectionLimit() {
|
|
659
659
|
if (!setupPlanConfirmed()) return 0;
|
|
660
660
|
var quota = billingStatus && billingStatus.historicalConversationQuota;
|
|
661
|
+
if (quota && (quota.limit === -1 || quota.remaining === -1)) return candidateSessions().length;
|
|
661
662
|
if (quota && typeof quota.remaining === "number" && isFinite(quota.remaining)) {
|
|
662
663
|
return Math.max(0, Math.floor(quota.remaining));
|
|
663
664
|
}
|
|
664
|
-
|
|
665
|
-
if (plan === "power" || plan === "enterprise") return 2000;
|
|
666
|
-
if (paidRecallPlan(plan)) return 500;
|
|
667
|
-
return 100;
|
|
665
|
+
return candidateSessions().length;
|
|
668
666
|
}
|
|
669
667
|
function selectedSessionKeyList() {
|
|
670
668
|
var valid = Object.create(null);
|
|
@@ -785,7 +783,7 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
785
783
|
setSessionPickerStatus("Opening secure Stripe checkout…");
|
|
786
784
|
var checkout = await openHostedBilling(
|
|
787
785
|
"/billing-checkout",
|
|
788
|
-
{ plan: targetPlan, trial:
|
|
786
|
+
{ plan: targetPlan, trial: false },
|
|
789
787
|
"Creating your secure checkout…",
|
|
790
788
|
"Checkout opened in Stripe. Keep this local page open; Echo will confirm here automatically."
|
|
791
789
|
);
|
|
@@ -1067,18 +1065,6 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
1067
1065
|
return parsed.toISOString().slice(0, 10);
|
|
1068
1066
|
}
|
|
1069
1067
|
}
|
|
1070
|
-
function trialChargeDateText() {
|
|
1071
|
-
var chargeAt = new Date(Date.now() + 14 * 24 * 60 * 60 * 1000);
|
|
1072
|
-
try {
|
|
1073
|
-
return new Intl.DateTimeFormat(undefined, {
|
|
1074
|
-
year: "numeric",
|
|
1075
|
-
month: "long",
|
|
1076
|
-
day: "numeric"
|
|
1077
|
-
}).format(chargeAt);
|
|
1078
|
-
} catch (_) {
|
|
1079
|
-
return chargeAt.toISOString().slice(0, 10);
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
1068
|
function paidPlanLifecycleText(plan) {
|
|
1083
1069
|
var state = String(billingStatus && billingStatus.subscriptionStatus || "").toLowerCase();
|
|
1084
1070
|
var trialEnd = formatBillingDate(billingStatus && billingStatus.trialEndedAt);
|
|
@@ -1114,13 +1100,13 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
1114
1100
|
var limit = quota && typeof quota.limit === "number" ? quota.limit : null;
|
|
1115
1101
|
var moneyFact = canceled
|
|
1116
1102
|
? "No future charge"
|
|
1117
|
-
: (state === "trialing" ? setupPlanPrice(plan) + "/month after trial" :
|
|
1103
|
+
: (state === "trialing" ? setupPlanPrice(plan) + "/month after trial" : "Billed monthly");
|
|
1118
1104
|
slot.classList.add("is-visible");
|
|
1119
1105
|
slot.innerHTML =
|
|
1120
1106
|
'<section class="billingCommitment' + (canceled ? ' is-canceled' : '') + '" aria-label="Current plan commitment">' +
|
|
1121
1107
|
'<div class="billingCommitmentIdentity"><span>' + esc(statusLabel) + '</span><strong>' + esc(planLabel) + '</strong></div>' +
|
|
1122
1108
|
'<div class="billingCommitmentFacts">' +
|
|
1123
|
-
'<span><b>' + esc(limit === null ? "Plan import allowance" : quotaNumber(limit)) + '</b>' + (limit === null ? "" : " coding-session imports") + '</span>' +
|
|
1109
|
+
'<span><b>' + esc(limit === -1 ? "Unlimited" : limit === null ? "Plan import allowance" : quotaNumber(limit)) + '</b>' + (limit === null ? "" : " coding-session imports") + '</span>' +
|
|
1124
1110
|
'<span><b>' + esc(moneyFact) + '</b></span>' +
|
|
1125
1111
|
'</div>' +
|
|
1126
1112
|
'<p>' + esc(lifecycle || "Your paid plan is active.") + '</p>' +
|
|
@@ -1140,16 +1126,15 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
1140
1126
|
return true;
|
|
1141
1127
|
}
|
|
1142
1128
|
function setupPlanDefinition(plan) {
|
|
1143
|
-
var trialAvailable = !billingStatus || billingStatus.trialAvailable !== false;
|
|
1144
1129
|
var limits = quotaLimitsForPlan(plan);
|
|
1145
1130
|
var fallbackFeatures = plan === "power"
|
|
1146
|
-
? ["
|
|
1131
|
+
? ["Unlimited past chats", "agent-heavy memory", "2,000 memory recalls / week"]
|
|
1147
1132
|
: plan === "pro"
|
|
1148
|
-
? ["
|
|
1149
|
-
: ["
|
|
1133
|
+
? ["Unlimited past chats", "daily memory updates", "500 memory recalls / week"]
|
|
1134
|
+
: ["Unlimited past chats", "a few new sessions / week", "100 memory recalls / week"];
|
|
1150
1135
|
var features = limits
|
|
1151
1136
|
? [
|
|
1152
|
-
|
|
1137
|
+
"Unlimited past chats",
|
|
1153
1138
|
quotaTokens(limits.memoryProcessingInputTokensWeeklyLimit) + " new-chat tokens / week",
|
|
1154
1139
|
quotaNumber(limits.memorySearchWeeklyLimit) + " memory recalls / week"
|
|
1155
1140
|
]
|
|
@@ -1158,16 +1143,16 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
1158
1143
|
id: "power",
|
|
1159
1144
|
name: "Power",
|
|
1160
1145
|
homeName: "Power",
|
|
1161
|
-
price: "$
|
|
1162
|
-
cadence:
|
|
1146
|
+
price: "$20",
|
|
1147
|
+
cadence: "per month for 12 months, then $100",
|
|
1163
1148
|
features: features
|
|
1164
1149
|
};
|
|
1165
1150
|
if (plan === "pro") return {
|
|
1166
1151
|
id: "pro",
|
|
1167
1152
|
name: "Pro",
|
|
1168
1153
|
homeName: "Pro",
|
|
1169
|
-
price: "$
|
|
1170
|
-
cadence:
|
|
1154
|
+
price: "$4",
|
|
1155
|
+
cadence: "per month for 12 months, then $20",
|
|
1171
1156
|
features: features
|
|
1172
1157
|
};
|
|
1173
1158
|
return {
|
|
@@ -1182,12 +1167,11 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
1182
1167
|
function renderPlanHabitat() {
|
|
1183
1168
|
setupPlanPreview = setupPlanPreview === "pro" || setupPlanPreview === "power" ? setupPlanPreview : "free";
|
|
1184
1169
|
var plan = setupPlanDefinition(setupPlanPreview);
|
|
1185
|
-
var trialOn = !billingStatus || billingStatus.trialAvailable !== false;
|
|
1186
1170
|
// The desktop app's plan grid: three ruled columns, the chosen one inverted, one action below.
|
|
1187
1171
|
var columns = ["free", "pro", "power"].map(function (id) {
|
|
1188
1172
|
var column = setupPlanDefinition(id);
|
|
1189
1173
|
var selected = id === plan.id;
|
|
1190
|
-
var billingNote = id === "free" ? "" :
|
|
1174
|
+
var billingNote = id === "free" ? "" : "80% off for 12 months";
|
|
1191
1175
|
var accessibleName = column.homeName + " " + column.price + " " + (id === "free" ? "forever" : "/ month") + (billingNote ? " · " + billingNote : "");
|
|
1192
1176
|
var facts = column.features.map(function (feature) {
|
|
1193
1177
|
return '<li>' + setupIcon("check") + '<span>' + esc(feature) + '</span></li>';
|
|
@@ -1196,18 +1180,16 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
1196
1180
|
'<span class="planColumnHead"><span class="planColumnState">' + (selected ? "Selected" : "") + '</span><span class="planColumnMark" aria-hidden="true">' + (selected ? setupIcon("check") : "") + '</span></span>' +
|
|
1197
1181
|
'<span class="planColumnName">' + esc(column.homeName) + '</span>' +
|
|
1198
1182
|
'<span class="planColumnPrice"><strong>' + esc(column.price) + '</strong><span>' + (id === "free" ? "forever" : "/ month") + '</span></span>' +
|
|
1199
|
-
'<span class="planColumnTrial' + (billingNote ? "" : " is-hidden") + '"' + (billingNote ? "" : ' aria-hidden="true"') + '>' + (billingNote || "
|
|
1183
|
+
'<span class="planColumnTrial' + (billingNote ? "" : " is-hidden") + '"' + (billingNote ? "" : ' aria-hidden="true"') + '>' + (billingNote || " ") + '</span>' +
|
|
1200
1184
|
'<ul class="planColumnFacts">' + facts + '</ul>' +
|
|
1201
1185
|
'</div>';
|
|
1202
1186
|
}).join("");
|
|
1203
1187
|
var chooseId = plan.id === "free" ? "chooseFreePlan" : (plan.id === "power" ? "choosePowerPlan" : "chooseProPlan");
|
|
1204
1188
|
var chooseLabel = plan.id === "free"
|
|
1205
1189
|
? "Continue with " + plan.homeName
|
|
1206
|
-
:
|
|
1207
|
-
? "Start " + plan.homeName + " trial — $0 today"
|
|
1208
|
-
: "Subscribe to " + plan.homeName);
|
|
1190
|
+
: "Subscribe to " + plan.homeName;
|
|
1209
1191
|
return '<section class="mvpPricing" aria-labelledby="setupPlanHeading">' +
|
|
1210
|
-
'<header class="mvpPricingIntro"><h2 id="setupPlanHeading">Choose your <strong>Echo.</strong></h2><p>
|
|
1192
|
+
'<header class="mvpPricingIntro"><h2 id="setupPlanHeading">Choose your <strong>Echo.</strong></h2><p>Past-chat imports are unlimited on every plan. Choose your weekly recall capacity.</p></header>' +
|
|
1211
1193
|
'<div class="planGrid" role="radiogroup" aria-label="Choose an Echo plan">' + columns + '</div>' +
|
|
1212
1194
|
'<div class="planGridAction"><button type="button" class="primary mvpPlanCta" id="' + chooseId + '">' + esc(chooseLabel) + ' <span aria-hidden="true">→</span></button></div>' +
|
|
1213
1195
|
'<p class="mvpPlanStatus" id="setupPlanStatus" role="status"></p>' +
|
|
@@ -1288,8 +1270,8 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
1288
1270
|
rememberCheckoutSessionId("");
|
|
1289
1271
|
billingSyncAttempts = 0;
|
|
1290
1272
|
var paidHistory = billingStatus && billingStatus.historicalConversationQuota;
|
|
1291
|
-
var paidUsage = paidHistory && typeof paidHistory.used === "number"
|
|
1292
|
-
? paidHistory.used + "
|
|
1273
|
+
var paidUsage = paidHistory && typeof paidHistory.used === "number"
|
|
1274
|
+
? paidHistory.used + " coding sessions imported, with no limit."
|
|
1293
1275
|
: "Your coding-session import and weekly memory allowance are ready.";
|
|
1294
1276
|
var lifecycleText = paidPlanLifecycleText(plan);
|
|
1295
1277
|
var paidDetail = lifecycleText
|
|
@@ -1309,7 +1291,7 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
1309
1291
|
if (planGateDecision) planGateDecision.classList.remove("is-checkout-pending");
|
|
1310
1292
|
var freeLimits = quotaLimitsForPlan("free");
|
|
1311
1293
|
var freePlanCopy = freeLimits
|
|
1312
|
-
?
|
|
1294
|
+
? "Unlimited coding sessions and " + quotaNumber(freeLimits.memorySearchWeeklyLimit) + " memory recalls each week."
|
|
1313
1295
|
: "Your managed import and weekly memory allowances are ready.";
|
|
1314
1296
|
slot.innerHTML = '<div class="setupPlanConfirmed"><span class="setupPlanConfirmedIcon" aria-hidden="true">' + setupIcon("check") + '</span><span class="setupPlanConfirmedCopy"><strong>Free Echo</strong><span>' + esc(freePlanCopy) + '</span></span><button type="button" class="textButton" id="changeSetupPlan">Change</button></div>';
|
|
1315
1297
|
renderBillingCommitment("");
|
|
@@ -1336,19 +1318,18 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
1336
1318
|
}
|
|
1337
1319
|
if (planGateDecision) planGateDecision.classList.add("is-checkout-pending");
|
|
1338
1320
|
var selectedPaidPlan = pendingPaidPlan === "power" ? "Power" : "Pro";
|
|
1339
|
-
var
|
|
1340
|
-
var
|
|
1341
|
-
var pendingLimit = pendingPaidPlan === "power" ? "2,000" : "500";
|
|
1321
|
+
var pendingPrice = pendingPaidPlan === "power" ? "$20" : "$4";
|
|
1322
|
+
var standardPrice = pendingPaidPlan === "power" ? "$100" : "$20";
|
|
1342
1323
|
var pendingStatus = billingCheckMessage || (billingLastCheckedAt
|
|
1343
1324
|
? "Checking automatically every few seconds · Last checked just now"
|
|
1344
1325
|
: "Checking automatically every few seconds");
|
|
1345
1326
|
slot.innerHTML =
|
|
1346
1327
|
'<section class="setupPlanChoice setupPlanCheckout" aria-labelledby="setupPlanHeading">' +
|
|
1347
|
-
'<div class="setupPlanIntro"><h3 id="setupPlanHeading">' + esc(
|
|
1328
|
+
'<div class="setupPlanIntro"><h3 id="setupPlanHeading">' + esc(selectedPaidPlan + " subscription") + '</h3><p>Complete checkout in Stripe, then return here. This page updates automatically.</p></div>' +
|
|
1348
1329
|
'<dl class="checkoutCommitment">' +
|
|
1349
|
-
'<div><dt>Today</dt><dd>' + esc(
|
|
1350
|
-
'<div><dt>History import</dt><dd>
|
|
1351
|
-
'<div><dt>
|
|
1330
|
+
'<div><dt>Today</dt><dd>' + esc(pendingPrice) + '</dd></div>' +
|
|
1331
|
+
'<div><dt>History import</dt><dd>Unlimited sessions</dd></div>' +
|
|
1332
|
+
'<div><dt>Billing</dt><dd>' + esc(pendingPrice + "/month for 12 months, then " + standardPrice + "/month") + '</dd></div>' +
|
|
1352
1333
|
'</dl>' +
|
|
1353
1334
|
'<div class="checkoutActions"><button type="button" class="primary" id="continueSelectedPaidPlan">Reopen Stripe checkout</button></div>' +
|
|
1354
1335
|
'<p class="checkoutPollStatus" id="setupPlanStatus" role="status" aria-live="polite">' + esc(pendingStatus) + '</p>' +
|
|
@@ -1482,7 +1463,7 @@ export const SETUP_PAGE_CLIENT_EXTRACTION = String.raw ` /* ---------- dash
|
|
|
1482
1463
|
setSetupPlanStatus("Opening secure checkout…");
|
|
1483
1464
|
var checkout = await openHostedBilling(
|
|
1484
1465
|
"/billing-checkout",
|
|
1485
|
-
{ plan: plan, trial:
|
|
1466
|
+
{ plan: plan, trial: false },
|
|
1486
1467
|
"Creating your secure checkout…",
|
|
1487
1468
|
"Checkout opened in a secure tab. Keep this local page open; Echo will confirm here automatically."
|
|
1488
1469
|
);
|
package/dist/setup-preview.js
CHANGED
|
@@ -51,7 +51,7 @@ function extractionPreviewBootstrap(options) {
|
|
|
51
51
|
const historicalConversationQuota = quotaLimit == null || quotaRemaining == null
|
|
52
52
|
? null
|
|
53
53
|
: {
|
|
54
|
-
used: Math.max(0, quotaLimit - quotaRemaining),
|
|
54
|
+
used: quotaLimit === -1 ? 0 : Math.max(0, quotaLimit - quotaRemaining),
|
|
55
55
|
limit: quotaLimit,
|
|
56
56
|
remaining: quotaRemaining,
|
|
57
57
|
};
|
|
@@ -64,7 +64,7 @@ function extractionPreviewBootstrap(options) {
|
|
|
64
64
|
trialEndedAt: options.trialEndedAt ?? null,
|
|
65
65
|
cancelAtPeriodEnd: options.cancelAtPeriodEnd ?? false,
|
|
66
66
|
currentPeriodEnd: options.currentPeriodEnd ?? null,
|
|
67
|
-
pricingUrl: "https://echoknows.com/account?source=mcp_onboarding",
|
|
67
|
+
pricingUrl: "https://echoknows.com/dashboard/account?source=mcp_onboarding",
|
|
68
68
|
account: {
|
|
69
69
|
displayName: "Preview User",
|
|
70
70
|
email: "preview@example.com",
|
|
@@ -121,35 +121,35 @@ export function renderSetupPreviewBootstrap(state) {
|
|
|
121
121
|
}
|
|
122
122
|
if (state === "extract-degraded")
|
|
123
123
|
return `${watermark}${extractionPreviewBootstrap({
|
|
124
|
-
plan: "free", paid: false, trialAvailable:
|
|
125
|
-
quotaLimit:
|
|
124
|
+
plan: "free", paid: false, trialAvailable: false, trialUsed: false,
|
|
125
|
+
quotaLimit: -1, quotaRemaining: -1, candidateCount: 7, selectFree: true,
|
|
126
126
|
})}
|
|
127
127
|
stats.discovery = { phase: "quick", exact: false };
|
|
128
128
|
stats.optionalDiagnostics = { degraded: true, reason: "EXACT_DISCOVERY_FAILED", countsTrusted: false };
|
|
129
129
|
renderDashboard();`;
|
|
130
130
|
if (state === "extract-degraded-exact")
|
|
131
131
|
return `${watermark}${extractionPreviewBootstrap({
|
|
132
|
-
plan: "free", paid: false, trialAvailable:
|
|
133
|
-
quotaLimit:
|
|
132
|
+
plan: "free", paid: false, trialAvailable: false, trialUsed: false,
|
|
133
|
+
quotaLimit: -1, quotaRemaining: -1, candidateCount: 7, selectFree: true,
|
|
134
134
|
})}
|
|
135
135
|
stats.discovery = { phase: "exact", exact: true };
|
|
136
136
|
stats.optionalDiagnostics = { degraded: true, reason: "ACCOUNT_RECONCILIATION_FAILED", countsTrusted: true };
|
|
137
137
|
renderDashboard();`;
|
|
138
138
|
if (state === "extract-ready")
|
|
139
139
|
return `${watermark}${extractionPreviewBootstrap({
|
|
140
|
-
plan: "free", paid: false, trialAvailable:
|
|
141
|
-
quotaLimit:
|
|
140
|
+
plan: "free", paid: false, trialAvailable: false, trialUsed: false,
|
|
141
|
+
quotaLimit: -1, quotaRemaining: -1, candidateCount: 28,
|
|
142
142
|
})}`;
|
|
143
143
|
if (state === "extract-free-selected")
|
|
144
144
|
return `${watermark}${extractionPreviewBootstrap({
|
|
145
|
-
plan: "free", paid: false, trialAvailable:
|
|
146
|
-
quotaLimit:
|
|
145
|
+
plan: "free", paid: false, trialAvailable: false, trialUsed: false,
|
|
146
|
+
quotaLimit: -1, quotaRemaining: -1, selectFree: true,
|
|
147
147
|
})}`;
|
|
148
148
|
if (state === "extract-free-trial-used")
|
|
149
149
|
return `${watermark}${extractionPreviewBootstrap({
|
|
150
150
|
plan: "free", paid: false, trialAvailable: false, trialUsed: true,
|
|
151
151
|
subscriptionStatus: "expired", trialEndedAt: "2026-07-20T00:00:00.000Z",
|
|
152
|
-
quotaLimit:
|
|
152
|
+
quotaLimit: -1, quotaRemaining: -1,
|
|
153
153
|
})}`;
|
|
154
154
|
if (state === "extract-limit")
|
|
155
155
|
return `${watermark}${extractionPreviewBootstrap({
|
|
@@ -160,7 +160,7 @@ export function renderSetupPreviewBootstrap(state) {
|
|
|
160
160
|
return `${watermark}${extractionPreviewBootstrap({
|
|
161
161
|
plan: "pro", paid: true, trialAvailable: false, trialUsed: true,
|
|
162
162
|
subscriptionStatus: "trialing", trialEndedAt: "2026-08-04T12:00:00.000Z",
|
|
163
|
-
quotaLimit:
|
|
163
|
+
quotaLimit: -1, quotaRemaining: -1,
|
|
164
164
|
})}`;
|
|
165
165
|
if (state === "extract-pro-trial-canceling")
|
|
166
166
|
return `${watermark}${extractionPreviewBootstrap({
|
|
@@ -168,45 +168,45 @@ export function renderSetupPreviewBootstrap(state) {
|
|
|
168
168
|
subscriptionStatus: "trialing", cancelAtPeriodEnd: true,
|
|
169
169
|
trialEndedAt: "2026-08-04T12:00:00.000Z",
|
|
170
170
|
currentPeriodEnd: "2026-08-04T12:00:00.000Z",
|
|
171
|
-
quotaLimit:
|
|
171
|
+
quotaLimit: -1, quotaRemaining: -1,
|
|
172
172
|
})}`;
|
|
173
173
|
if (state === "extract-pro-active")
|
|
174
174
|
return `${watermark}${extractionPreviewBootstrap({
|
|
175
175
|
plan: "pro", paid: true, trialAvailable: false, trialUsed: true,
|
|
176
|
-
subscriptionStatus: "active", quotaLimit:
|
|
176
|
+
subscriptionStatus: "active", quotaLimit: -1, quotaRemaining: -1,
|
|
177
177
|
})}`;
|
|
178
178
|
if (state === "extract-pro-canceling")
|
|
179
179
|
return `${watermark}${extractionPreviewBootstrap({
|
|
180
180
|
plan: "pro", paid: true, trialAvailable: false, trialUsed: true,
|
|
181
181
|
subscriptionStatus: "active", cancelAtPeriodEnd: true,
|
|
182
182
|
currentPeriodEnd: "2026-08-28T12:00:00.000Z",
|
|
183
|
-
quotaLimit:
|
|
183
|
+
quotaLimit: -1, quotaRemaining: -1,
|
|
184
184
|
})}`;
|
|
185
185
|
if (state === "extract-power-trial")
|
|
186
186
|
return `${watermark}${extractionPreviewBootstrap({
|
|
187
187
|
plan: "power", paid: true, trialAvailable: false, trialUsed: true,
|
|
188
188
|
subscriptionStatus: "trialing", trialEndedAt: "2026-08-04T12:00:00.000Z",
|
|
189
189
|
currentPeriodEnd: "2026-08-04T12:00:00.000Z",
|
|
190
|
-
quotaLimit:
|
|
190
|
+
quotaLimit: -1, quotaRemaining: -1,
|
|
191
191
|
})}`;
|
|
192
192
|
if (state === "extract-power-active")
|
|
193
193
|
return `${watermark}${extractionPreviewBootstrap({
|
|
194
194
|
plan: "power", paid: true, trialAvailable: false, trialUsed: true,
|
|
195
|
-
subscriptionStatus: "active", quotaLimit:
|
|
195
|
+
subscriptionStatus: "active", quotaLimit: -1, quotaRemaining: -1,
|
|
196
196
|
})}`;
|
|
197
197
|
if (state === "extract-team-active")
|
|
198
198
|
return `${watermark}${extractionPreviewBootstrap({
|
|
199
199
|
plan: "team", paid: true, trialAvailable: false, trialUsed: true,
|
|
200
|
-
subscriptionStatus: "active", quotaLimit:
|
|
200
|
+
subscriptionStatus: "active", quotaLimit: -1, quotaRemaining: -1,
|
|
201
201
|
})}`;
|
|
202
202
|
if (state === "extract-enterprise-active")
|
|
203
203
|
return `${watermark}${extractionPreviewBootstrap({
|
|
204
204
|
plan: "enterprise", paid: true, trialAvailable: false, trialUsed: true,
|
|
205
|
-
subscriptionStatus: "active", quotaLimit:
|
|
205
|
+
subscriptionStatus: "active", quotaLimit: -1, quotaRemaining: -1,
|
|
206
206
|
})}`;
|
|
207
207
|
if (state === "extract-unknown")
|
|
208
208
|
return `${watermark}${extractionPreviewBootstrap({
|
|
209
|
-
plan: "unknown", paid: false, trialAvailable:
|
|
209
|
+
plan: "unknown", paid: false, trialAvailable: false, trialUsed: false,
|
|
210
210
|
showUnknownStatus: true,
|
|
211
211
|
})}`;
|
|
212
212
|
if (state === "auth-login")
|
|
@@ -223,13 +223,13 @@ export function renderSetupPreviewBootstrap(state) {
|
|
|
223
223
|
renderLocalLoginComplete();`;
|
|
224
224
|
if (state === "checkout-pro-selected")
|
|
225
225
|
return `${watermark}${extractionPreviewBootstrap({
|
|
226
|
-
plan: "free", paid: false, trialAvailable:
|
|
227
|
-
quotaLimit:
|
|
226
|
+
plan: "free", paid: false, trialAvailable: false, trialUsed: false,
|
|
227
|
+
quotaLimit: -1, quotaRemaining: -1, selectedPlanChoice: "pro", checkoutPending: true,
|
|
228
228
|
})}`;
|
|
229
229
|
if (state === "checkout-pro-stale")
|
|
230
230
|
return `${watermark}${extractionPreviewBootstrap({
|
|
231
|
-
plan: "free", paid: false, trialAvailable:
|
|
232
|
-
quotaLimit:
|
|
231
|
+
plan: "free", paid: false, trialAvailable: false, trialUsed: false,
|
|
232
|
+
quotaLimit: -1, quotaRemaining: -1, selectedPlanChoice: "pro",
|
|
233
233
|
})}`;
|
|
234
234
|
if (state === "auth-unlock")
|
|
235
235
|
return `${watermark}\n renderLocalPassphrase("unlock", "preview@example.com");`;
|
package/dist/setup.js
CHANGED
|
@@ -34,7 +34,7 @@ import { resolveClaudeCoworkSessionRoots, resolveClaudeDesktopSupportRoots, reso
|
|
|
34
34
|
import { isEphemeralNpxPath, reexecFromDurableRuntime, resolveDurableDistPath, resolveGlobalEntry } from "./durable-entry.js";
|
|
35
35
|
import { installSaveCheckpointHooks, installSourceSessionHooks, removeLifecycleHooks } from "./hud/hooks.js";
|
|
36
36
|
import { atomicWriteJsonObject, atomicWriteTextFile, readJsonObjectFile } from "./config-files.js";
|
|
37
|
-
import { MCP_PACKAGE_LABEL, MCP_PACKAGE_NAME, MCP_PACKAGE_VERSION, MCP_UPDATE_ALL_COMMAND, MCP_UPDATE_COMMAND } from "./package-metadata.js";
|
|
37
|
+
import { GROUP_SESSION_SHARING_DISABLED_NOTE, GROUP_SESSION_SHARING_PROMPTS_ENABLED, MCP_PACKAGE_LABEL, MCP_PACKAGE_NAME, MCP_PACKAGE_VERSION, MCP_UPDATE_ALL_COMMAND, MCP_UPDATE_COMMAND } from "./package-metadata.js";
|
|
38
38
|
import { checkLatestUpdateStatus, compareSemver, readCachedUpdateStatus } from "./update-check.js";
|
|
39
39
|
import { startMcpControlServer } from "./mcp-control.js";
|
|
40
40
|
import { analyticsErrorCode, productAnalytics, trackCliCommandRun, } from "./product-analytics.js";
|
|
@@ -43,7 +43,7 @@ import { installHeadlessRuntimeSync, readHeadlessRuntimeInstallation, removeHead
|
|
|
43
43
|
// The setup dashboard, account login, and encryption passphrase entry are all served by this
|
|
44
44
|
// localhost bridge. The hosted API only sends OTP email, verifies the code, and mints a device token.
|
|
45
45
|
const API_BASE_URL = (process.env.ECHO_API_BASE_URL || "https://echo-mem-chrome.vercel.app").replace(/\/$/, "");
|
|
46
|
-
const PRICING_URL = (process.env.ECHO_PRICING_URL || "https://echoknows.com/account").replace(/\/$/, "");
|
|
46
|
+
const PRICING_URL = (process.env.ECHO_PRICING_URL || "https://echoknows.com/dashboard/account").replace(/\/$/, "");
|
|
47
47
|
function hostedBillingEndpoint(pathname) {
|
|
48
48
|
const url = new URL(PRICING_URL);
|
|
49
49
|
url.pathname = pathname;
|
|
@@ -465,7 +465,9 @@ function echomemGuidanceBlock() {
|
|
|
465
465
|
"- Before the final response for a task that produced a durable decision, confirmed preference, implementation, resolved bug, commit, passing verification, release, or project milestone: call `save_conversation`. This private checkpoint does not require a separate user request. Do not save secrets, credentials, incidental chatter, or trivial read-only work. If a qualifying save fails because the encrypted vault is locked, relay the bridge's unlock instruction; for this standalone runtime, use `echomem-mcp unlock`. Never silently skip it.",
|
|
466
466
|
"- For `save_conversation`, prefer `messages` and omit `conversation`: copy the smallest relevant contiguous set of user and assistant turns verbatim, preserving role and order. Exclude system instructions, tool calls, and hidden content. Use at most six messages and 12,000 total characters; drop whole older turns instead of truncating or rewriting them. If exact source text is unavailable, use `conversation` with a concise structured summary prefixed `Summary (source excerpt unavailable):`.",
|
|
467
467
|
'- After `save_conversation` succeeds and returns one or more saved memory IDs, make the save visible in the final user-facing answer with a compact `EchoMem saved:` list containing every memory created by that call. Link each memory key to its canonical `https://echoknows.com/memory/<memory-id>` URL. This save receipt is separate from `EchoMem sources:` and does not imply the newly saved memories informed the answer.',
|
|
468
|
-
|
|
468
|
+
GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
469
|
+
? "- For a user with a company group, call `request_group_session_sharing` near conversation start or after a qualifying private save. On the first call in a conversation, omit `groupSharingScopeId` so EchoMem mints a fresh opaque scope. Reuse that exact scope only in this conversation for later get/request/set/save calls, and never persist it as memory. If multiple groups are returned, reuse the same scope and call once per `groupId`. Relay the tool's exact text question and call `set_group_session_sharing` only after an explicit Yes/No. Silence leaves that group's state unset; never infer an answer. Saves sync eligible memories to every approved group; a No keeps them private for that group."
|
|
470
|
+
: `- Saves are always private. ${GROUP_SESSION_SHARING_DISABLED_NOTE}`,
|
|
469
471
|
"- If the user pastes a session carryover/checkpoint: it may reference `get_checkpoint_by_context` — use it to pull the checkpoint/decision trail when you need more than the snapshot.",
|
|
470
472
|
"",
|
|
471
473
|
"### Ticket stewardship",
|
|
@@ -2360,7 +2362,7 @@ export function startCallbackServer(opts = {}) {
|
|
|
2360
2362
|
json(res, 200, {
|
|
2361
2363
|
plan: "free",
|
|
2362
2364
|
paid: false,
|
|
2363
|
-
trialAvailable:
|
|
2365
|
+
trialAvailable: false,
|
|
2364
2366
|
trialUsed: false,
|
|
2365
2367
|
subscriptionStatus: null,
|
|
2366
2368
|
trialStartedAt: null,
|
|
@@ -2379,7 +2381,7 @@ export function startCallbackServer(opts = {}) {
|
|
|
2379
2381
|
]);
|
|
2380
2382
|
const plan = (asString(response.data?.plan) || "free").toLowerCase();
|
|
2381
2383
|
const trialUsed = response.data?.billing?.trialUsed === true;
|
|
2382
|
-
const trialAvailable = response.data?.billing?.trialAvailable
|
|
2384
|
+
const trialAvailable = response.data?.billing?.trialAvailable === true;
|
|
2383
2385
|
const accountEmail = asString(profileResponse?.data?.email) || activeAccountEmail;
|
|
2384
2386
|
if (accountEmail)
|
|
2385
2387
|
activeAccountEmail = accountEmail;
|
|
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import axios from "axios";
|
|
4
4
|
import { KeyStore } from "./keystore.js";
|
|
5
|
+
import { MCP_PACKAGE_VERSION } from "./package-metadata.js";
|
|
5
6
|
import { SOURCE_SESSION_HOOK_EVIDENCE, verifiedClaudeDesktopSession, verifiedSourceSession, } from "./source-session.js";
|
|
6
7
|
const API_BASE = (process.env.ECHO_API_BASE_URL || "https://echo-mem-chrome.vercel.app").replace(/\/$/, "");
|
|
7
8
|
const MAX_HEAD_BYTES = 256 * 1024;
|
|
@@ -170,6 +171,7 @@ async function bindSourceSession(identity) {
|
|
|
170
171
|
providerSessionId: identity.providerSessionId,
|
|
171
172
|
providerSessionAliases: identity.providerSessionAliases,
|
|
172
173
|
evidence: identity.evidence,
|
|
174
|
+
runtime_version: MCP_PACKAGE_VERSION,
|
|
173
175
|
}, {
|
|
174
176
|
headers: {
|
|
175
177
|
Authorization: `Bearer ${token}`,
|
package/dist/v1-contract.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { MCP_DESKTOP_MANAGED, MCP_VAULT_UNLOCK_INSTRUCTION, MEMORY_CITATION_INSTRUCTION, SAVED_MEMORY_RECEIPT_INSTRUCTION, withMcpVersion, } from "./package-metadata.js";
|
|
2
|
+
import { MCP_DESKTOP_MANAGED, MCP_VAULT_UNLOCK_INSTRUCTION, MEMORY_CITATION_INSTRUCTION, SAVED_MEMORY_RECEIPT_INSTRUCTION, withMcpVersion, GROUP_SESSION_SHARING_CONTEXT_INSTRUCTION, GROUP_SESSION_SHARING_JOIN_INSTRUCTION, GROUP_SESSION_SHARING_PROMPTS_ENABLED, GROUP_SESSION_SHARING_SAVE_INSTRUCTION, } from "./package-metadata.js";
|
|
3
3
|
import { ATOMIC_TICKET_DESCRIPTION_MAX, ATOMIC_TICKET_DESCRIPTION_RULE } from "./ticket-review-format.js";
|
|
4
4
|
export const canonicalToolNames = {
|
|
5
5
|
bindSourceSession: "bind_source_session",
|
|
@@ -59,6 +59,9 @@ export const hiddenCompatibilityToolNames = new Set([
|
|
|
59
59
|
canonicalToolNames.recordWorkspaceTicketProposal,
|
|
60
60
|
canonicalToolNames.acknowledgeWorkspaceTicketReview,
|
|
61
61
|
canonicalToolNames.getGroupSessionSharing,
|
|
62
|
+
...(GROUP_SESSION_SHARING_PROMPTS_ENABLED
|
|
63
|
+
? []
|
|
64
|
+
: [canonicalToolNames.requestGroupSessionSharing, canonicalToolNames.setGroupSessionSharing]),
|
|
62
65
|
canonicalToolNames.updateGroupProfile,
|
|
63
66
|
canonicalToolNames.publishToGroup,
|
|
64
67
|
canonicalToolNames.publishBatchToGroup,
|
|
@@ -810,7 +813,7 @@ export function listToolSpecs(opts = {}) {
|
|
|
810
813
|
const groupMap = opts.groupMap?.trim();
|
|
811
814
|
const updateNotice = opts.updateNotice?.trim();
|
|
812
815
|
const recallPlanNote = "Available on every plan: Free includes 100 searches each week, Pro includes 500, and Power includes 2,000.";
|
|
813
|
-
const searchBillingReplyInstruction = "If search returns an ACTION REQUIRED subscription message, tell the user to start their
|
|
816
|
+
const searchBillingReplyInstruction = "If search returns an ACTION REQUIRED subscription message, tell the user to start their subscription and include the exact URL from that result verbatim. Do not respond only with \"connect\" or \"upgrade\".";
|
|
814
817
|
const memoryCitationInstruction = MEMORY_CITATION_INSTRUCTION;
|
|
815
818
|
const updateSection = updateNotice ? `\n\nUPDATE NOTICE: ${updateNotice}` : "";
|
|
816
819
|
const mapSection = map
|
|
@@ -1261,7 +1264,7 @@ export function listToolSpecs(opts = {}) {
|
|
|
1261
1264
|
},
|
|
1262
1265
|
{
|
|
1263
1266
|
name: canonicalToolNames.save,
|
|
1264
|
-
description: `Save durable knowledge from this conversation into the user's private EchoMem (durable memories are extracted automatically). Call before the final response when work produced a durable decision, confirmed preference, implementation, resolved bug, commit, passing verification, release, or project milestone; this private checkpoint does not require a separate user request. Omit secrets, incidental chatter, and trivial read-only work. If the encrypted vault is locked, tell the user to ${MCP_VAULT_UNLOCK_INSTRUCTION} and never silently skip a qualifying checkpoint. Private persistence happens first
|
|
1267
|
+
description: `Save durable knowledge from this conversation into the user's private EchoMem (durable memories are extracted automatically). Call before the final response when work produced a durable decision, confirmed preference, implementation, resolved bug, commit, passing verification, release, or project milestone; this private checkpoint does not require a separate user request. Omit secrets, incidental chatter, and trivial read-only work. If the encrypted vault is locked, tell the user to ${MCP_VAULT_UNLOCK_INSTRUCTION} and never silently skip a qualifying checkpoint. Private persistence happens first.${GROUP_SESSION_SHARING_SAVE_INSTRUCTION} New extraction input uses the plan's weekly processing allowance; if the limit is reached, nothing is saved. passthrough=true stores the text verbatim as a session capsule. ${SAVED_MEMORY_RECEIPT_INSTRUCTION}`,
|
|
1265
1268
|
inputSchema: {
|
|
1266
1269
|
type: "object",
|
|
1267
1270
|
properties: {
|
|
@@ -1497,7 +1500,7 @@ export function listToolSpecs(opts = {}) {
|
|
|
1497
1500
|
},
|
|
1498
1501
|
{
|
|
1499
1502
|
name: canonicalToolNames.groupContext,
|
|
1500
|
-
description: `Get your current company workspace, its participant directory, declared titles and responsibilities, published-memory coverage, and the current member authenticated by the EchoMem credential. That authenticated EchoMem identity is authoritative over any conflicting host identity or inference. Use this before answering who works on what; use search_memories with scope=workspace for shared work retrieval. Treat declared profile fields as facts and memory-derived work as evidence or inference
|
|
1503
|
+
description: `Get your current company workspace, its participant directory, declared titles and responsibilities, published-memory coverage, and the current member authenticated by the EchoMem credential. That authenticated EchoMem identity is authoritative over any conflicting host identity or inference. Use this before answering who works on what; use search_memories with scope=workspace for shared work retrieval. Treat declared profile fields as facts and memory-derived work as evidence or inference.${GROUP_SESSION_SHARING_CONTEXT_INSTRUCTION}${groupMapSection}`,
|
|
1501
1504
|
inputSchema: {
|
|
1502
1505
|
type: "object",
|
|
1503
1506
|
properties: {
|
|
@@ -1592,7 +1595,7 @@ export function listToolSpecs(opts = {}) {
|
|
|
1592
1595
|
},
|
|
1593
1596
|
{
|
|
1594
1597
|
name: canonicalToolNames.joinGroup,
|
|
1595
|
-
description:
|
|
1598
|
+
description: `Join a company memory group using an invite code after the user explicitly asks to join. Joining never publishes memories. Next call prepare_group_publication, infer a proposed title and responsibility summary from the user's own candidate memories, and ask the user to confirm the profile together with the publication preview.${GROUP_SESSION_SHARING_JOIN_INSTRUCTION}`,
|
|
1596
1599
|
inputSchema: {
|
|
1597
1600
|
type: "object",
|
|
1598
1601
|
properties: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@echomem/mcp",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.70",
|
|
4
4
|
"description": "EchoMem MCP bridge for cross-agent memory, local history import, and recall",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"test:config-safety": "npm run build && node test/config-safety.test.mjs",
|
|
37
37
|
"test:billing-ui": "npm run build && node test/setup-ui.test.mjs billing",
|
|
38
38
|
"test:mcp-control": "npm run build && node test/mcp-control.test.mjs",
|
|
39
|
-
"test": "npm run build && node test/source-session.test.mjs && node test/source-session-stress.test.mjs && node test/cowork-ticket-session.test.mjs && node test/ticket-review-format.test.mjs && node test/schema-parity.test.mjs && node test/ticket-overview.test.mjs && node test/ticket-stewardship-contract.test.mjs && node test/stewardship-integration.test.mjs && node test/source-session-hook.test.mjs && node test/local-data-paths.test.mjs && node test/crypto.test.mjs && node test/integration.test.mjs && node test/onboarding-resilience.test.mjs && node test/local-auth.test.mjs && node test/product-analytics.test.mjs && node test/retrieval-only.test.mjs && node test/no-restart.test.mjs && node test/canonical-golden.test.mjs && node test/tools.test.mjs && node test/workspace-selector.test.mjs && node test/group-map.test.mjs && node test/update-check.test.mjs && node test/headless-runtime.test.mjs && node test/claude-code-config.test.mjs && node test/config-safety.test.mjs && node test/mcp-control.test.mjs && node test/delete.test.mjs && node test/low-touch-tools.test.mjs && node test/migrate.test.mjs && node test/restart-recovery.test.mjs && node test/save-checkpoint-hook.test.mjs && node test/durable-entry.test.mjs && node test/durable-reexec.test.mjs && node test/doctor.test.mjs && node test/environment-matrix.test.mjs",
|
|
39
|
+
"test": "npm run build && node test/source-session.test.mjs && node test/source-session-stress.test.mjs && node test/cowork-ticket-session.test.mjs && node test/ticket-review-format.test.mjs && node test/schema-parity.test.mjs && node test/ticket-overview.test.mjs && node test/ticket-stewardship-contract.test.mjs && node test/stewardship-integration.test.mjs && node test/source-session-hook.test.mjs && node test/local-data-paths.test.mjs && node test/crypto.test.mjs && node test/integration.test.mjs && node test/onboarding-resilience.test.mjs && node test/local-auth.test.mjs && node test/product-analytics.test.mjs && node test/retrieval-only.test.mjs && node test/no-restart.test.mjs && node test/canonical-golden.test.mjs && node test/tools.test.mjs && node test/workspace-selector.test.mjs && node test/group-map.test.mjs && node test/update-check.test.mjs && node test/headless-runtime.test.mjs && node test/claude-code-config.test.mjs && node test/config-safety.test.mjs && node test/mcp-control.test.mjs && node test/delete.test.mjs && node test/low-touch-tools.test.mjs && node test/migrate.test.mjs && node test/restart-recovery.test.mjs && node test/save-checkpoint-hook.test.mjs && node test/durable-entry.test.mjs && node test/lifecycle-hook-refresh.test.mjs && node test/durable-reexec.test.mjs && node test/doctor.test.mjs && node test/environment-matrix.test.mjs",
|
|
40
40
|
"prepack": "npm run build"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|