b208c4d2bd
Memind CI / Test, build, and release guards (push) Failing after 3m47s
Add CONTEXT_RUNTIME_ACTIVE_ENV bundle and zero-LLM active probe covering MCP compact, zvec, and headroom proxy readiness while keeping memory injection on shadow. Co-authored-by: Cursor <cursoragent@cursor.com>
85 lines
2.5 KiB
JavaScript
85 lines
2.5 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Verify Context Runtime active profile on this machine (no LLM).
|
|
*/
|
|
import { spawnSync } from 'node:child_process';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
import {
|
|
CONTEXT_RUNTIME_ACTIVE_ENV,
|
|
describeContextRuntimeProfile,
|
|
} from '../context-runtime-profile.mjs';
|
|
import {
|
|
ensureHeadroomProxyRunning,
|
|
probeHeadroomProxyReachable,
|
|
resolveHeadroomMode,
|
|
} from '../memind-headroom-policy.mjs';
|
|
|
|
const root = path.join(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
|
|
for (const [key, value] of Object.entries(CONTEXT_RUNTIME_ACTIVE_ENV)) {
|
|
process.env[key] = process.env[key] ?? value;
|
|
}
|
|
|
|
const profile = describeContextRuntimeProfile(process.env);
|
|
console.log('CONTEXT_RUNTIME_ACTIVE_PROBE:');
|
|
console.log(` profile=${JSON.stringify(profile)}`);
|
|
|
|
const issues = [];
|
|
for (const [key, expected] of Object.entries(CONTEXT_RUNTIME_ACTIVE_ENV)) {
|
|
if (key === 'HEADROOM_OUTPUT_SHAPER') continue;
|
|
const actual = profile[
|
|
key === 'MEMIND_HEADROOM_MODE' ? 'headroom'
|
|
: key === 'MEMIND_CONTEXT_BUDGET_MODE' ? 'contextBudget'
|
|
: key === 'MEMIND_RECALL_FUSION_MODE' ? 'recallFusion'
|
|
: key === 'MEMIND_MCP_COMPACT_MODE' ? 'mcpCompact'
|
|
: 'zvecWorkspace'
|
|
];
|
|
if (actual !== expected) {
|
|
issues.push(`${key}=${actual} (expected ${expected})`);
|
|
}
|
|
}
|
|
|
|
function runScript(name) {
|
|
const result = spawnSync(process.execPath, [path.join(root, 'scripts', name)], {
|
|
cwd: root,
|
|
env: process.env,
|
|
encoding: 'utf8',
|
|
});
|
|
return {
|
|
ok: result.status === 0,
|
|
stdout: (result.stdout ?? '').trim(),
|
|
stderr: (result.stderr ?? '').trim(),
|
|
};
|
|
}
|
|
|
|
for (const script of [
|
|
'check-mcp-compact-active-local.mjs',
|
|
'check-mcp-compactor-local.mjs',
|
|
'check-zvec-workspace-local.mjs',
|
|
]) {
|
|
const result = runScript(script);
|
|
console.log(` ${script}=${result.ok ? 'OK' : 'FAIL'}`);
|
|
if (!result.ok) {
|
|
issues.push(`${script} failed`);
|
|
if (result.stderr) console.error(result.stderr.slice(0, 400));
|
|
}
|
|
}
|
|
|
|
if (resolveHeadroomMode(process.env) === 'active') {
|
|
const boot = await ensureHeadroomProxyRunning({ env: process.env });
|
|
const reachable = boot.reachable || await probeHeadroomProxyReachable({ env: process.env });
|
|
console.log(` headroom_proxy=${reachable ? 'reachable' : 'unreachable'} started=${boot.started}`);
|
|
if (!reachable) {
|
|
issues.push('headroom active but proxy unreachable');
|
|
}
|
|
}
|
|
|
|
if (issues.length) {
|
|
console.error(`CONTEXT_RUNTIME_ACTIVE_FAIL: ${issues.join('; ')}`);
|
|
process.exit(1);
|
|
}
|
|
|
|
console.log('CONTEXT_RUNTIME_ACTIVE_OK');
|