chore: merge upstream v12.4.7 + keep local fixes
Major upstream changes (v12.3.9 → v12.4.7): v12.3.9 — Stop hook fire-and-forget (eliminates ~110s terminal block); hook port precedence; Telegram notifier; security_alert/security_note observation types v12.4.0/12.4.1 — worker startup streamlined; consolidated DB connections; Chroma backfill watermark cache (422% CPU → 0% on restart) v12.4.2 — context-overflow infinite loop fixed (clears memorySessionId on "Prompt is too long"); <task-notification> payload pollution blocked at hook + worker boundary v12.4.3 — one-time pollution cleanup migration (CleanupV12_4_3): purges observer-sessions rows + cascade, stuck pending chains, Chroma rebuild; auto VACUUM INTO backup. Ran successfully on this DB: - 1463 observer-sessions purged - 3682 cascade rows - 102MB backup at ~/.claude-mem/backups/ v12.4.4 — stop draining queue on /clear (removes SessionEnd shim that had been abandoning pending observations for 6 months) v12.4.5 — fix observation persistence on fresh installs (migration 28 mirror in SessionStore) v12.4.7 — cynical-deletion sweep (closes 27 issues); multi-account isolation via per-UID worker port (37700 + uid % 100, with explicit CLAUDE_MEM_WORKER_PORT override); CLAUDE_MEM_INTERNAL=1 trust boundary replaces cwd-based observer-session detection; observations.metadata column (migration 30); proxy env vars stripped from spawned subprocs Local fixes preserved: - env-sanitizer PATH extension for claude CLI lookup (auto-merged cleanly with upstream's new ENV_PROXY_VARS proxy stripping) - SessionStore stale session reset (mac sleep / 4h wall-clock) Settings: CLAUDE_MEM_WORKER_PORT=37777 explicit override preserved through the per-UID port migration. Worker restarted to v12.4.7. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -339,61 +339,6 @@ function installUv() {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add shell alias for claude-mem command
|
||||
*/
|
||||
function installCLI() {
|
||||
const WORKER_CLI = join(ROOT, 'scripts', 'worker-service.cjs');
|
||||
const bunPath = getBunPath() || 'bun';
|
||||
const aliasLine = `alias claude-mem='${bunPath} "${WORKER_CLI}"'`;
|
||||
const markerPath = join(ROOT, '.cli-installed');
|
||||
|
||||
// Skip if already installed
|
||||
if (existsSync(markerPath)) return;
|
||||
|
||||
try {
|
||||
if (IS_WINDOWS) {
|
||||
// Windows: Add to PATH via PowerShell profile
|
||||
const profilePath = join(process.env.USERPROFILE || homedir(), 'Documents', 'PowerShell', 'Microsoft.PowerShell_profile.ps1');
|
||||
const profileDir = join(process.env.USERPROFILE || homedir(), 'Documents', 'PowerShell');
|
||||
const functionDef = `function claude-mem { & "${bunPath}" "${WORKER_CLI}" $args }\n`;
|
||||
|
||||
if (!existsSync(profileDir)) {
|
||||
execSync(`mkdir "${profileDir}"`, { stdio: 'ignore', shell: true });
|
||||
}
|
||||
|
||||
const existingContent = existsSync(profilePath) ? readFileSync(profilePath, 'utf-8') : '';
|
||||
if (!existingContent.includes('function claude-mem')) {
|
||||
writeFileSync(profilePath, existingContent + '\n' + functionDef);
|
||||
console.error(`✅ PowerShell function added to profile`);
|
||||
console.error(' Restart your terminal to use: claude-mem <command>');
|
||||
}
|
||||
} else {
|
||||
// Unix: Add alias to shell configs
|
||||
const shellConfigs = [
|
||||
join(homedir(), '.bashrc'),
|
||||
join(homedir(), '.zshrc')
|
||||
];
|
||||
|
||||
for (const config of shellConfigs) {
|
||||
if (existsSync(config)) {
|
||||
const content = readFileSync(config, 'utf-8');
|
||||
if (!content.includes('alias claude-mem=')) {
|
||||
writeFileSync(config, content + '\n' + aliasLine + '\n');
|
||||
console.error(`✅ Alias added to ${config}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
console.error(' Restart your terminal to use: claude-mem <command>');
|
||||
}
|
||||
|
||||
writeFileSync(markerPath, new Date().toISOString());
|
||||
} catch (error) {
|
||||
console.error(`⚠️ Could not add shell alias: ${error.message}`);
|
||||
console.error(` Use directly: ${bunPath} "${WORKER_CLI}" <command>`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if dependencies need to be installed
|
||||
*/
|
||||
@@ -629,8 +574,8 @@ try {
|
||||
// Worker will be started fresh by next hook in chain (worker-service.cjs start)
|
||||
}
|
||||
|
||||
// Step 4: Install CLI to PATH
|
||||
installCLI();
|
||||
// Step 4 (removed in #2054): legacy `claude-mem` shell alias was deleted.
|
||||
// Users invoke the CLI via `npx claude-mem <cmd>` or `bunx claude-mem <cmd>`.
|
||||
|
||||
// Step 5: Warn if the bundled native binary is incompatible with this platform
|
||||
checkBinaryPlatformCompatibility();
|
||||
|
||||
+303
-324
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user