Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
TypeScript aiai-agentsai-memoryanthropicartificial-intelligencechromadbclaudeclaude-agent-sdkclaude-agentsclaude-codeclaude-code-pluginclaude-skillsembeddingslong-term-memorymem0memory-engineopenmemoryragsqlitesupermemory
import { afterAll, describe, expect, it, mock } from 'bun:test';
import { stripVTControlCharacters } from 'util';
import * as realMCodeInstallerModule from '../../src/services/integrations/MCodeHooksInstaller.js';
import type { MCodeStatus } from '../../src/services/integrations/MCodeHooksInstaller.js';
// MiniMax Code has one switch for all hooks ("enabled" in hooks.json). With it
// off, the install succeeds and MiniMax Code runs nothing, so the install task
// has to say so. A run without a terminal (CI, a script, this test) buffers no
// installer output, so the task must ask the status function instead of
// matching the printed text.
// bun test runs every file in one process, and mock.restore() does not undo a
// module mock: put the real installer back after this file.
const realMCodeInstallerSnapshot = { ...realMCodeInstallerModule };
let statusAfterInstall: MCodeStatus = 'installed';
// The mocked install writes nothing, so the real ~/.minimax is never touched.
mock.module('../../src/services/integrations/MCodeHooksInstaller.js', () => ({
...realMCodeInstallerSnapshot,
installMCode: () => 0,
readMCodeStatus: () => ({ status: statusAfterInstall }),
}));
// Dynamic imports keep the module mock registered before install.ts (and its
// lazy MCodeHooksInstaller import) is evaluated.
const { makeIDETask } = await import('../../src/npx-cli/commands/install.js');
const { createInstallSummary } = await import('../../src/npx-cli/install/error-reporter.js');
describe('MiniMax Code install task', () => {
afterAll(() => {
mock.module('../../src/services/integrations/MCodeHooksInstaller.js', () => realMCodeInstallerSnapshot);
});
it('warns that MiniMax Code will run nothing when the status after install is disabled', async () => {
statusAfterInstall = 'disabled';
const summary = createInstallSummary();
const descriptor = makeIDETask('mcode', summary);
expect(descriptor).not.toBeNull();
const line = stripVTControlCharacters(await descriptor!.task(() => {}));
expect(line).toContain('hooks are disabled');
expect(line).not.toContain('OK');
expect(summary.failedIDEs).toEqual([]);
expect(summary.warnings).toHaveLength(1);
expect(summary.warnings[0]!.component).toBe('mcode');
expect(summary.warnings[0]!.remediation).toContain('"enabled": true');
});
it('reports OK with no warning when the status after install is installed', async () => {
statusAfterInstall = 'installed';
const summary = createInstallSummary();
const descriptor = makeIDETask('mcode', summary);
expect(descriptor).not.toBeNull();
const line = stripVTControlCharacters(await descriptor!.task(() => {}));
expect(line).toContain('OK');
expect(line).not.toContain('disabled');
expect(summary.failedIDEs).toEqual([]);
expect(summary.warnings).toEqual([]);
});
});