memorix 1.10.2 → 1.10.3
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/CHANGELOG.md +20 -0
- package/README.md +3 -1
- package/README.zh-CN.md +3 -1
- package/dist/cli/index.js +397 -215
- package/dist/cli/memcode.js +0 -0
- package/dist/index.js +150 -38
- package/dist/maintenance-runner.js +108 -22
- package/dist/media-audio-runner.js +108 -22
- package/dist/media-video-runner.js +108 -22
- package/dist/memcode-runtime/CHANGELOG.md +20 -0
- package/dist/sdk.js +149 -37
- package/dist/types.d.ts +1 -1
- package/dist/vector-backfill-runner.js +108 -22
- package/docs/CONFIGURATION.md +34 -0
- package/docs/DEVELOPMENT.md +1 -1
- package/docs/INTEGRATIONS.md +1 -1
- package/docs/README.md +2 -1
- package/docs/ROADMAP-1.9.12-2.0.md +1 -1
- package/docs/SETUP.md +19 -4
- package/package.json +1 -1
- package/plugins/antigravity/memorix/plugin.json +1 -1
- package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
- package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
- package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/copilot/memorix/plugin.json +1 -1
- package/plugins/gemini/memorix/gemini-extension.json +1 -1
- package/plugins/hermes/memorix/plugin.yaml +1 -1
- package/plugins/omp/memorix/package.json +1 -1
- package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/pi/memorix/package.json +1 -1
- package/server.json +2 -2
- package/src/cli/commands/agent-integrations.ts +1 -1
- package/src/cli/commands/background.ts +1 -1
- package/src/cli/commands/context.ts +3 -2
- package/src/cli/commands/doctor.ts +9 -0
- package/src/cli/commands/explain.ts +3 -2
- package/src/cli/commands/init.ts +6 -2
- package/src/cli/commands/setup.ts +9 -6
- package/src/cli/commands/uninstall.ts +15 -0
- package/src/cli/tui/App.tsx +9 -16
- package/src/cli/tui/ConfigureView.tsx +2 -0
- package/src/codegraph/auto-context.ts +1 -1
- package/src/codegraph/store.ts +37 -0
- package/src/codegraph/types.ts +3 -0
- package/src/config/dotenv-loader.ts +1 -0
- package/src/config/resolved-config.ts +7 -2
- package/src/config/toml-loader.ts +1 -0
- package/src/config/yaml-loader.ts +4 -2
- package/src/dashboard/server.ts +5 -6
- package/src/hooks/handler.ts +0 -1
- package/src/integrations/registry.ts +2 -1
- package/src/llm/provider.ts +2 -1
- package/src/memory/observations.ts +61 -17
- package/src/multimodal/image-loader.ts +2 -2
- package/src/runtime/open-browser.ts +25 -0
- package/src/server.ts +2 -2
- package/src/store/orama-store.ts +27 -3
- package/src/types.ts +1 -1
- package/src/workspace/mcp-adapters/pi.ts +58 -0
- package/plugins/pi/memorix/skills/memorix-git-memory/SKILL.md +0 -26
- package/plugins/pi/memorix/skills/memorix-memory/SKILL.md +0 -51
- package/plugins/pi/memorix/skills/memorix-mini-skills/SKILL.md +0 -31
- package/plugins/pi/memorix/skills/memorix-orchestrate/SKILL.md +0 -28
- package/plugins/pi/memorix/skills/memorix-reasoning/SKILL.md +0 -30
- package/plugins/pi/memorix/skills/memorix-sessions/SKILL.md +0 -25
- package/plugins/pi/memorix/skills/memorix-troubleshooting/SKILL.md +0 -27
|
@@ -13,8 +13,9 @@ import type { AgentTarget } from '../../types.js';
|
|
|
13
13
|
import { emitError, emitResult, getCliProjectContext } from './operator-shared.js';
|
|
14
14
|
import { CliFallbackBudget } from '../fallback-budget.js';
|
|
15
15
|
|
|
16
|
-
function coerceRefreshMode(input?: string): AutoContextRefreshMode {
|
|
17
|
-
|
|
16
|
+
function coerceRefreshMode(input?: string): AutoContextRefreshMode | undefined {
|
|
17
|
+
if (!input?.trim()) return undefined;
|
|
18
|
+
const value = input.trim().toLowerCase();
|
|
18
19
|
if (value === 'always' || value === 'never' || value === 'auto') return value;
|
|
19
20
|
throw new Error('refresh must be one of: auto, always, never');
|
|
20
21
|
}
|
|
@@ -448,6 +448,12 @@ export default defineCommand({
|
|
|
448
448
|
lines.push(info(
|
|
449
449
|
`Code provider: ${effectiveProviderQuality.semantic.state} semantic layer (${codeStatus.semanticSymbols} symbols, ${codeStatus.semanticEdges} edges); external graph ${providerQuality.health.state}`,
|
|
450
450
|
));
|
|
451
|
+
if ((codeStatus.staleSymbols ?? 0) > 0) {
|
|
452
|
+
lines.push(warn(`CodeGraph derived storage: ${codeStatus.staleSymbols} stale symbols remain`));
|
|
453
|
+
}
|
|
454
|
+
if ((codeStatus.snapshots ?? 0) > 2) {
|
|
455
|
+
lines.push(warn(`CodeGraph snapshots: ${codeStatus.snapshots} retained; maintenance cleanup is pending`));
|
|
456
|
+
}
|
|
451
457
|
if (codeStatus.parserErrors > 0) {
|
|
452
458
|
lines.push(warn(`CodeGraph parser errors: ${codeStatus.parserErrors}; semantic context is partial until refresh succeeds.`));
|
|
453
459
|
}
|
|
@@ -478,6 +484,9 @@ export default defineCommand({
|
|
|
478
484
|
semanticSymbols: codeStatus.semanticSymbols,
|
|
479
485
|
semanticEdges: codeStatus.semanticEdges,
|
|
480
486
|
parserErrors: codeStatus.parserErrors,
|
|
487
|
+
...(codeStatus.staleSymbols !== undefined ? { staleSymbols: codeStatus.staleSymbols } : {}),
|
|
488
|
+
...(codeStatus.snapshots !== undefined ? { snapshots: codeStatus.snapshots } : {}),
|
|
489
|
+
...(codeStatus.snapshotFiles !== undefined ? { snapshotFiles: codeStatus.snapshotFiles } : {}),
|
|
481
490
|
providerQuality: effectiveProviderQuality,
|
|
482
491
|
...(overview.code.indexedAt ? { indexedAt: overview.code.indexedAt } : {}),
|
|
483
492
|
};
|
|
@@ -6,8 +6,9 @@ import { getAllObservations } from '../../memory/observations.js';
|
|
|
6
6
|
import { filterReadableObservations } from '../../memory/visibility.js';
|
|
7
7
|
import { emitError, emitResult, getCliProjectContext } from './operator-shared.js';
|
|
8
8
|
|
|
9
|
-
function coerceRefreshMode(input?: string): AutoContextRefreshMode {
|
|
10
|
-
|
|
9
|
+
function coerceRefreshMode(input?: string): AutoContextRefreshMode | undefined {
|
|
10
|
+
if (!input?.trim()) return undefined;
|
|
11
|
+
const value = input.trim().toLowerCase();
|
|
11
12
|
if (value === 'always' || value === 'never' || value === 'auto') return value;
|
|
12
13
|
throw new Error('refresh must be one of: auto, always, never');
|
|
13
14
|
}
|
package/src/cli/commands/init.ts
CHANGED
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
type InitScope,
|
|
22
22
|
} from './init-shared.js';
|
|
23
23
|
|
|
24
|
-
type InitLlmProvider = 'none' | 'openai' | 'anthropic' | 'openrouter' | 'requesty' | 'apiroute' | 'cheaperinference' | 'atlascloud' | 'custom';
|
|
24
|
+
type InitLlmProvider = 'none' | 'openai' | 'anthropic' | 'openrouter' | 'requesty' | 'apiroute' | 'cheaperinference' | 'runcrate' | 'atlascloud' | 'custom';
|
|
25
25
|
type InitEmbeddingProvider = 'off' | 'api' | 'fastembed';
|
|
26
26
|
type InitInjectMode = 'minimal' | 'full' | 'silent';
|
|
27
27
|
|
|
@@ -106,6 +106,7 @@ export default defineCommand({
|
|
|
106
106
|
{ value: 'requesty', label: 'Requesty', hint: 'multi-provider' },
|
|
107
107
|
{ value: 'apiroute', label: 'API Route', hint: 'multi-provider' },
|
|
108
108
|
{ value: 'cheaperinference', label: 'Cheaper Inference', hint: 'multi-provider' },
|
|
109
|
+
{ value: 'runcrate', label: 'Runcrate', hint: 'open-weight models' },
|
|
109
110
|
{ value: 'atlascloud', label: 'Atlas Cloud', hint: 'DeepSeek V3.2' },
|
|
110
111
|
{ value: 'custom', label: 'Custom', hint: 'OpenAI-compatible endpoint' },
|
|
111
112
|
],
|
|
@@ -166,7 +167,7 @@ export default defineCommand({
|
|
|
166
167
|
|
|
167
168
|
if (llmProvider !== 'none') {
|
|
168
169
|
envLines.push('# LLM API key');
|
|
169
|
-
if (llmProvider === 'openai' || llmProvider === 'custom' || llmProvider === 'atlascloud' || llmProvider === 'apiroute' || llmProvider === 'cheaperinference') {
|
|
170
|
+
if (llmProvider === 'openai' || llmProvider === 'custom' || llmProvider === 'atlascloud' || llmProvider === 'apiroute' || llmProvider === 'cheaperinference' || llmProvider === 'runcrate') {
|
|
170
171
|
envLines.push('MEMORIX_LLM_API_KEY=sk-your-key-here');
|
|
171
172
|
} else if (llmProvider === 'anthropic') {
|
|
172
173
|
envLines.push('MEMORIX_LLM_API_KEY=sk-ant-your-key-here');
|
|
@@ -205,6 +206,7 @@ export default defineCommand({
|
|
|
205
206
|
envLines.push('# REQUESTY_API_KEY=rqsty-...');
|
|
206
207
|
envLines.push('# API_ROUTE_API_KEY=sk-...');
|
|
207
208
|
envLines.push('# CHEAPER_INFERENCE_API_KEY=ci_live_...');
|
|
209
|
+
envLines.push('# RUNCRATE_API_KEY=...');
|
|
208
210
|
envLines.push('');
|
|
209
211
|
|
|
210
212
|
mkdirSync(targetDir, { recursive: true });
|
|
@@ -307,6 +309,8 @@ export function buildInitTomlConfig(options: {
|
|
|
307
309
|
lines.push('model = "deepseek-v4.1-flash"');
|
|
308
310
|
} else if (options.llmProvider === 'cheaperinference') {
|
|
309
311
|
lines.push('model = "gpt-5.4-mini"');
|
|
312
|
+
} else if (options.llmProvider === 'runcrate') {
|
|
313
|
+
lines.push('model = "deepseek-ai/DeepSeek-V4.1-Flash"');
|
|
310
314
|
} else if (options.llmProvider === 'atlascloud') {
|
|
311
315
|
lines.push('model = "deepseek-ai/deepseek-v3.2"');
|
|
312
316
|
}
|
|
@@ -27,6 +27,7 @@ import { GeminiCLIMCPAdapter } from '../../workspace/mcp-adapters/gemini-cli.js'
|
|
|
27
27
|
import { OpenClawMCPAdapter } from '../../workspace/mcp-adapters/openclaw.js';
|
|
28
28
|
import { HermesMCPAdapter, resolveHermesHome } from '../../workspace/mcp-adapters/hermes.js';
|
|
29
29
|
import { OmpMCPAdapter } from '../../workspace/mcp-adapters/omp.js';
|
|
30
|
+
import { PiMCPAdapter } from '../../workspace/mcp-adapters/pi.js';
|
|
30
31
|
import { KiroMCPAdapter } from '../../workspace/mcp-adapters/kiro.js';
|
|
31
32
|
import { OpenCodeMCPAdapter } from '../../workspace/mcp-adapters/opencode.js';
|
|
32
33
|
import { TraeMCPAdapter } from '../../workspace/mcp-adapters/trae.js';
|
|
@@ -378,7 +379,7 @@ function relativePosix(from: string, to: string): string {
|
|
|
378
379
|
return rel;
|
|
379
380
|
}
|
|
380
381
|
|
|
381
|
-
export type McpConfigAgent = Exclude<AgentName, '
|
|
382
|
+
export type McpConfigAgent = Exclude<AgentName, 'qwen'>;
|
|
382
383
|
|
|
383
384
|
export function getMcpAdapter(agent: McpConfigAgent): MCPConfigAdapter {
|
|
384
385
|
const adapters: Record<McpConfigAgent, MCPConfigAdapter> = {
|
|
@@ -393,6 +394,7 @@ export function getMcpAdapter(agent: McpConfigAgent): MCPConfigAdapter {
|
|
|
393
394
|
openclaw: new OpenClawMCPAdapter(),
|
|
394
395
|
hermes: new HermesMCPAdapter(),
|
|
395
396
|
omp: new OmpMCPAdapter(),
|
|
397
|
+
pi: new PiMCPAdapter(),
|
|
396
398
|
kiro: new KiroMCPAdapter(),
|
|
397
399
|
opencode: new OpenCodeMCPAdapter(),
|
|
398
400
|
trae: new TraeMCPAdapter(),
|
|
@@ -1487,7 +1489,6 @@ export async function installAgentSetup(agent: AgentName, plan: SetupPlan, globa
|
|
|
1487
1489
|
// project-local .codex/config.toml as an implicit fallback.
|
|
1488
1490
|
// Grok MCP stays host-owned unless the caller passed --mcp http.
|
|
1489
1491
|
const wantsMcpConfig = plan.mcp !== 'none'
|
|
1490
|
-
&& agent !== 'pi'
|
|
1491
1492
|
&& !(agent === 'codex' && !global)
|
|
1492
1493
|
&& !(agent === 'grok' && plan.mcp !== 'http');
|
|
1493
1494
|
const bundledMcpRoots: string[] = [];
|
|
@@ -1681,9 +1682,11 @@ export async function installAgentSetup(agent: AgentName, plan: SetupPlan, globa
|
|
|
1681
1682
|
p.log.info(`${agent}: MCP, skills, and hooks are bundled in the official CodeBuddy plugin package`);
|
|
1682
1683
|
}
|
|
1683
1684
|
|
|
1684
|
-
if (agent === 'pi') {
|
|
1685
|
-
p.log.info('pi:
|
|
1686
|
-
}
|
|
1685
|
+
if (agent === 'pi' && plan.mcp !== 'none') {
|
|
1686
|
+
p.log.info('pi: run `pi mcp list` to check connections, then `/reload` in Pi. Trust the project to load project-local MCP config.');
|
|
1687
|
+
}
|
|
1688
|
+
|
|
1689
|
+
if (agent === 'grok') {
|
|
1687
1690
|
if (plan.mcp === 'http') {
|
|
1688
1691
|
p.log.info('grok: wrote [mcp_servers.memorix] HTTP URL in Grok config.toml. Start the control plane with `memorix background start`.');
|
|
1689
1692
|
} else {
|
|
@@ -1800,7 +1803,7 @@ export default defineCommand({
|
|
|
1800
1803
|
{ value: 'openclaw', label: 'OpenClaw', hint: 'bundle + hook pack + skills + MCP' },
|
|
1801
1804
|
{ value: 'hermes', label: 'Hermes Agent', hint: 'plugin + hooks + commands + skills + MCP' },
|
|
1802
1805
|
{ value: 'omp', label: 'Oh-my-Pi', hint: 'package + extension + command + MCP' },
|
|
1803
|
-
{ value: 'pi', label: 'Pi coding agent', hint: 'package + extension +
|
|
1806
|
+
{ value: 'pi', label: 'Pi coding agent', hint: 'package + extension + skills + MCP (Pi 1.0+)' },
|
|
1804
1807
|
{ value: 'dsh', label: 'DeepSeek Harness', hint: 'MCP patch + AGENTS.md + skills' },
|
|
1805
1808
|
{ value: 'opencode', label: 'OpenCode', hint: 'local plugin + AGENTS.md + MCP' },
|
|
1806
1809
|
{ value: 'windsurf', label: 'Windsurf', hint: 'rules + hooks + MCP' },
|
|
@@ -110,6 +110,21 @@ export function getMCPConfigEntries(home: string, cwd: string): MCPConfigEntry[]
|
|
|
110
110
|
note: 'Remove the "memorix" key from mcpServers in this file.',
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
+
// Pi — native MCP is separate from the extension/skills package.
|
|
114
|
+
for (const [kind, configPath] of [
|
|
115
|
+
['global', path.join(home, '.pi', 'agent', 'mcp.json')],
|
|
116
|
+
['project', path.join(cwd, '.pi', 'mcp.json')],
|
|
117
|
+
] as const) {
|
|
118
|
+
entries.push({
|
|
119
|
+
agent: 'Pi',
|
|
120
|
+
path: configPath,
|
|
121
|
+
kind,
|
|
122
|
+
format: 'json',
|
|
123
|
+
detected: checkJSON(configPath),
|
|
124
|
+
note: 'Remove the "memorix" key from mcpServers in this file.',
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
113
128
|
// Windsurf
|
|
114
129
|
entries.push({
|
|
115
130
|
agent: 'Windsurf',
|
package/src/cli/tui/App.tsx
CHANGED
|
@@ -43,6 +43,7 @@ import { ChatView } from './ChatView.js';
|
|
|
43
43
|
import type { ChatTranscriptMessage, ChatViewRef } from './ChatView.js';
|
|
44
44
|
import { ContextRail } from './ContextRail.js';
|
|
45
45
|
import { askMemoryQuestionStream } from './chat-service.js';
|
|
46
|
+
import { openLocalBrowser } from '../../runtime/open-browser.js';
|
|
46
47
|
import type { ChatAnswer } from './chat-service.js';
|
|
47
48
|
import type {
|
|
48
49
|
ProjectInfo,
|
|
@@ -821,24 +822,20 @@ export function WorkbenchApp({ version, onExitForInteractive }: AppProps): React
|
|
|
821
822
|
const handleBackgroundAction = useCallback(async (action: string) => {
|
|
822
823
|
setStatusMsg(null);
|
|
823
824
|
try {
|
|
824
|
-
const {
|
|
825
|
+
const { doStart, doStop, doRestart } = await import('../commands/background.js');
|
|
825
826
|
if (background.running) {
|
|
826
827
|
switch (action) {
|
|
827
828
|
case 'w': if (background.dashboard) {
|
|
828
|
-
try {
|
|
829
|
-
try { execSync(`open "${background.dashboard}"`, { stdio: 'pipe', windowsHide: true }); } catch {
|
|
830
|
-
try { execSync(`xdg-open "${background.dashboard}"`, { stdio: 'pipe', windowsHide: true }); } catch { /* */ }
|
|
831
|
-
}
|
|
832
|
-
}
|
|
829
|
+
try { openLocalBrowser(background.dashboard); } catch { /* */ }
|
|
833
830
|
setStatusMsg({ text: `Opening ${background.dashboard}`, type: 'success' });
|
|
834
831
|
} break;
|
|
835
|
-
case '1': try {
|
|
836
|
-
case '2': try {
|
|
832
|
+
case '1': try { await doRestart(background.port ?? 3211); setStatusMsg({ text: 'Restarted.', type: 'success' }); } catch (e) { setStatusMsg({ text: `Restart failed: ${e}`, type: 'error' }); } break;
|
|
833
|
+
case '2': try { await doStop(); setStatusMsg({ text: 'Stopped.', type: 'success' }); } catch (e) { setStatusMsg({ text: `Stop failed: ${e}`, type: 'error' }); } break;
|
|
837
834
|
case '3': setStatusMsg({ text: 'Run: memorix background logs (separate terminal)', type: 'info' }); break;
|
|
838
835
|
}
|
|
839
836
|
} else {
|
|
840
837
|
switch (action) {
|
|
841
|
-
case '1': try {
|
|
838
|
+
case '1': try { await doStart(background.port ?? 3211); setStatusMsg({ text: 'Started.', type: 'success' }); } catch (e) { setStatusMsg({ text: `Start failed: ${e}`, type: 'error' }); } break;
|
|
842
839
|
case '2': setStatusMsg({ text: 'Run: memorix dashboard (separate terminal)', type: 'info' }); break;
|
|
843
840
|
}
|
|
844
841
|
}
|
|
@@ -849,18 +846,14 @@ export function WorkbenchApp({ version, onExitForInteractive }: AppProps): React
|
|
|
849
846
|
const handleDashboardAction = useCallback(async (action: string) => {
|
|
850
847
|
setStatusMsg(null);
|
|
851
848
|
try {
|
|
852
|
-
const {
|
|
849
|
+
const { doStart } = await import('../commands/background.js');
|
|
853
850
|
if (background.healthy && background.dashboard) {
|
|
854
851
|
if (action === '1') {
|
|
855
|
-
try {
|
|
856
|
-
try { execSync(`open "${background.dashboard}"`, { stdio: 'pipe', windowsHide: true }); } catch {
|
|
857
|
-
try { execSync(`xdg-open "${background.dashboard}"`, { stdio: 'pipe', windowsHide: true }); } catch { /* */ }
|
|
858
|
-
}
|
|
859
|
-
}
|
|
852
|
+
try { openLocalBrowser(background.dashboard); } catch { /* */ }
|
|
860
853
|
setStatusMsg({ text: `Opening ${background.dashboard}`, type: 'success' });
|
|
861
854
|
} else if (action === '2') { setStatusMsg({ text: 'Run: memorix dashboard (separate terminal)', type: 'info' }); }
|
|
862
855
|
} else {
|
|
863
|
-
if (action === '1') { try {
|
|
856
|
+
if (action === '1') { try { await doStart(background.port ?? 3211); setStatusMsg({ text: 'Started.', type: 'success' }); setBackground(await getBackgroundStatus()); } catch (e) { setStatusMsg({ text: `Start failed: ${e}`, type: 'error' }); } }
|
|
864
857
|
else if (action === '2') { setStatusMsg({ text: 'Run: memorix dashboard (separate terminal)', type: 'info' }); }
|
|
865
858
|
}
|
|
866
859
|
} catch (err) { setStatusMsg({ text: `Error: ${err instanceof Error ? err.message : String(err)}`, type: 'error' }); }
|
|
@@ -169,6 +169,7 @@ export function ConfigureView({ onBack }: ConfigureViewProps): React.ReactElemen
|
|
|
169
169
|
{ key: 'requesty', label: 'Requesty', hint: 'multi-provider' },
|
|
170
170
|
{ key: 'apiroute', label: 'API Route', hint: 'multi-provider' },
|
|
171
171
|
{ key: 'cheaperinference', label: 'Cheaper Inference', hint: 'multi-provider' },
|
|
172
|
+
{ key: 'runcrate', label: 'Runcrate', hint: 'open-weight models' },
|
|
172
173
|
{ key: 'atlascloud', label: 'Atlas Cloud', hint: 'DeepSeek V3.2' },
|
|
173
174
|
{ key: 'custom', label: 'Custom endpoint', hint: 'OpenAI-compatible' },
|
|
174
175
|
{ key: 'disable', label: 'Disable LLM', hint: 'free heuristic mode', color: COLORS.warning },
|
|
@@ -453,6 +454,7 @@ function getDefaultModel(provider: string): string {
|
|
|
453
454
|
if (provider === 'requesty') return 'openai/gpt-4o-mini';
|
|
454
455
|
if (provider === 'apiroute') return 'deepseek-v4.1-flash';
|
|
455
456
|
if (provider === 'cheaperinference') return 'gpt-5.4-mini';
|
|
457
|
+
if (provider === 'runcrate') return 'deepseek-ai/DeepSeek-V4.1-Flash';
|
|
456
458
|
if (provider === 'atlascloud') return 'deepseek-ai/deepseek-v3.2';
|
|
457
459
|
return 'gpt-4o-mini';
|
|
458
460
|
}
|
|
@@ -224,13 +224,13 @@ export async function buildAutoProjectContext(input: {
|
|
|
224
224
|
/** The caller surface is recorded in the Workset receipt, not its prompt. */
|
|
225
225
|
deliveryTarget?: ContextDeliveryTarget;
|
|
226
226
|
}): Promise<AutoProjectContext> {
|
|
227
|
-
const refreshMode = input.refresh ?? 'auto';
|
|
228
227
|
const now = input.now ?? new Date();
|
|
229
228
|
const task = input.task?.trim();
|
|
230
229
|
const lens = resolveTaskLens(task);
|
|
231
230
|
const continuationRequested = input.continuation === 'always'
|
|
232
231
|
|| (input.continuation !== 'never' && isContinuationTask(task));
|
|
233
232
|
const codegraphConfig = getResolvedConfig({ projectRoot: input.project.rootPath }).codegraph;
|
|
233
|
+
const refreshMode = input.refresh ?? codegraphConfig.autoRefresh ?? 'auto';
|
|
234
234
|
const exclude = input.exclude ?? codegraphConfig.excludePatterns;
|
|
235
235
|
const maxFileBytes = input.maxFileBytes ?? codegraphConfig.maxFileBytes;
|
|
236
236
|
const store = new CodeGraphStore();
|
package/src/codegraph/store.ts
CHANGED
|
@@ -1039,6 +1039,7 @@ export class CodeGraphStore {
|
|
|
1039
1039
|
recordCodeStateSnapshot(input: CodeStateSnapshotInput): CodeStateSnapshot {
|
|
1040
1040
|
const id = randomUUID();
|
|
1041
1041
|
let snapshot: CodeStateSnapshot | undefined;
|
|
1042
|
+
let compactNeeded = false;
|
|
1042
1043
|
const tx = this.db.transaction(() => {
|
|
1043
1044
|
const previous = this.db.prepare(
|
|
1044
1045
|
'SELECT id, sourceEpoch FROM code_state_snapshots WHERE projectId = ? ORDER BY sourceEpoch DESC LIMIT 1',
|
|
@@ -1082,6 +1083,29 @@ export class CodeGraphStore {
|
|
|
1082
1083
|
for (const file of snapshotFileRows) {
|
|
1083
1084
|
insertSnapshotFile.run(id, file.projectId, file.id, file.path, file.contentHash);
|
|
1084
1085
|
}
|
|
1086
|
+
// Codegraph facts are derived and the readers already ignore stale
|
|
1087
|
+
// symbols. Retain the latest two manifests, then remove dead symbols
|
|
1088
|
+
// and edges so repeated refreshes cannot grow the canonical SQLite file.
|
|
1089
|
+
const staleSymbolIds = this.db.prepare(
|
|
1090
|
+
'SELECT id FROM code_symbols WHERE projectId = ? AND stale = 1',
|
|
1091
|
+
).all(input.projectId).map((row: { id: string }) => row.id);
|
|
1092
|
+
if (staleSymbolIds.length > 0) {
|
|
1093
|
+
const placeholders = staleSymbolIds.map(() => '?').join(', ');
|
|
1094
|
+
this.db.prepare(
|
|
1095
|
+
`DELETE FROM code_edges WHERE projectId = ? AND (fromSymbolId IN (${placeholders}) OR toSymbolId IN (${placeholders}))`,
|
|
1096
|
+
).run(input.projectId, ...staleSymbolIds, ...staleSymbolIds);
|
|
1097
|
+
this.db.prepare('DELETE FROM code_symbols WHERE projectId = ? AND stale = 1').run(input.projectId);
|
|
1098
|
+
compactNeeded = true;
|
|
1099
|
+
}
|
|
1100
|
+
const oldSnapshots = this.db.prepare(
|
|
1101
|
+
'SELECT id FROM code_state_snapshots WHERE projectId = ? ORDER BY sourceEpoch DESC LIMIT -1 OFFSET 2',
|
|
1102
|
+
).all(input.projectId).map((row: { id: string }) => row.id);
|
|
1103
|
+
if (oldSnapshots.length > 0) {
|
|
1104
|
+
const placeholders = oldSnapshots.map(() => '?').join(', ');
|
|
1105
|
+
this.db.prepare(`DELETE FROM code_state_snapshot_files WHERE snapshotId IN (${placeholders})`).run(...oldSnapshots);
|
|
1106
|
+
this.db.prepare(`DELETE FROM code_state_snapshots WHERE id IN (${placeholders})`).run(...oldSnapshots);
|
|
1107
|
+
compactNeeded = true;
|
|
1108
|
+
}
|
|
1085
1109
|
snapshot = {
|
|
1086
1110
|
...input,
|
|
1087
1111
|
id,
|
|
@@ -1090,12 +1114,20 @@ export class CodeGraphStore {
|
|
|
1090
1114
|
};
|
|
1091
1115
|
});
|
|
1092
1116
|
tx();
|
|
1117
|
+
if (compactNeeded) this.compactStorage();
|
|
1093
1118
|
return snapshot!;
|
|
1094
1119
|
}
|
|
1095
1120
|
|
|
1121
|
+
/** Reclaim WAL/free pages after a derived codegraph sweep. */
|
|
1122
|
+
compactStorage(): void {
|
|
1123
|
+
try { this.db.pragma('wal_checkpoint(TRUNCATE)'); } catch { /* best effort */ }
|
|
1124
|
+
try { this.db.exec('VACUUM'); } catch { /* another reader may be active */ }
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1096
1127
|
status(projectId: string): CodeGraphStatus {
|
|
1097
1128
|
const files = this.db.prepare(`SELECT COUNT(*) AS count FROM code_files WHERE projectId = ?`).get(projectId).count;
|
|
1098
1129
|
const symbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 0`).get(projectId).count;
|
|
1130
|
+
const staleSymbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 1`).get(projectId).count;
|
|
1099
1131
|
const edges = this.db.prepare(`SELECT COUNT(*) AS count FROM code_edges WHERE projectId = ?`).get(projectId).count;
|
|
1100
1132
|
const refs = this.db.prepare(`SELECT COUNT(*) AS count FROM observation_code_refs WHERE projectId = ?`).get(projectId).count;
|
|
1101
1133
|
const semanticSymbols = this.db.prepare(`SELECT COUNT(*) AS count FROM code_symbols WHERE projectId = ? AND stale = 0 AND source = 'typescript-compiler'`).get(projectId).count;
|
|
@@ -1103,6 +1135,8 @@ export class CodeGraphStore {
|
|
|
1103
1135
|
const parserErrors = this.db.prepare(`SELECT COUNT(*) AS count FROM code_files WHERE projectId = ? AND parserError IS NOT NULL`).get(projectId).count;
|
|
1104
1136
|
const latest = this.db.prepare(`SELECT MAX(indexedAt) AS indexedAt FROM code_files WHERE projectId = ?`).get(projectId);
|
|
1105
1137
|
const latestSnapshot = this.latestSnapshot(projectId);
|
|
1138
|
+
const snapshots = this.db.prepare(`SELECT COUNT(*) AS count FROM code_state_snapshots WHERE projectId = ?`).get(projectId).count;
|
|
1139
|
+
const snapshotFiles = this.db.prepare(`SELECT COUNT(*) AS count FROM code_state_snapshot_files WHERE projectId = ?`).get(projectId).count;
|
|
1106
1140
|
return {
|
|
1107
1141
|
provider: 'lite',
|
|
1108
1142
|
files,
|
|
@@ -1112,6 +1146,9 @@ export class CodeGraphStore {
|
|
|
1112
1146
|
semanticSymbols,
|
|
1113
1147
|
semanticEdges,
|
|
1114
1148
|
parserErrors,
|
|
1149
|
+
staleSymbols,
|
|
1150
|
+
snapshots,
|
|
1151
|
+
snapshotFiles,
|
|
1115
1152
|
...(latest?.indexedAt ? { indexedAt: latest.indexedAt } : {}),
|
|
1116
1153
|
...(latestSnapshot ? { latestSnapshot } : {}),
|
|
1117
1154
|
};
|
package/src/codegraph/types.ts
CHANGED
|
@@ -176,6 +176,9 @@ export interface CodeGraphStatus {
|
|
|
176
176
|
semanticSymbols: number;
|
|
177
177
|
semanticEdges: number;
|
|
178
178
|
parserErrors: number;
|
|
179
|
+
staleSymbols?: number;
|
|
180
|
+
snapshots?: number;
|
|
181
|
+
snapshotFiles?: number;
|
|
179
182
|
indexedAt?: string;
|
|
180
183
|
latestSnapshot?: CodeStateSnapshot;
|
|
181
184
|
}
|
|
@@ -146,6 +146,7 @@ export function getLoadedEnvValue(key: string): string | undefined {
|
|
|
146
146
|
// REQUESTY_API_KEY - Requesty memory preset and embedding endpoint key
|
|
147
147
|
// API_ROUTE_API_KEY - API Route memory preset key (only when selected)
|
|
148
148
|
// CHEAPER_INFERENCE_API_KEY - Cheaper Inference memory preset key (only when selected)
|
|
149
|
+
// RUNCRATE_API_KEY - Runcrate memory preset key (only when selected)
|
|
149
150
|
// MINIMAX_API_KEY — MiniMax global image/video generation key
|
|
150
151
|
// MINIMAX_CN_API_KEY — MiniMax China-region image/video generation key
|
|
151
152
|
// MINIMAX_REGION — MiniMax region: global or cn
|
|
@@ -63,6 +63,7 @@ export interface ResolvedMemorixConfig {
|
|
|
63
63
|
codegraph: {
|
|
64
64
|
excludePatterns?: string[];
|
|
65
65
|
maxFileBytes?: number;
|
|
66
|
+
autoRefresh: 'auto' | 'always' | 'never';
|
|
66
67
|
externalContext: 'auto' | 'off';
|
|
67
68
|
externalCommand?: string;
|
|
68
69
|
externalTimeoutMs?: number;
|
|
@@ -122,7 +123,8 @@ export function getResolvedConfig(options: ResolvedLaneOptions = {}): ResolvedMe
|
|
|
122
123
|
const isRequesty = memoryLlmProvider === 'requesty';
|
|
123
124
|
const isApiRoute = memoryLlmProvider === 'apiroute';
|
|
124
125
|
const isCheaperInference = memoryLlmProvider === 'cheaperinference';
|
|
125
|
-
const
|
|
126
|
+
const isRuncrate = memoryLlmProvider === 'runcrate';
|
|
127
|
+
const usesPresetKeyOnly = isAtlasCloud || isRequesty || isApiRoute || isCheaperInference || isRuncrate;
|
|
126
128
|
const memoryLlmApiKey = first(
|
|
127
129
|
process.env.MEMORIX_LLM_API_KEY,
|
|
128
130
|
process.env.MEMORIX_API_KEY,
|
|
@@ -133,7 +135,8 @@ export function getResolvedConfig(options: ResolvedLaneOptions = {}): ResolvedMe
|
|
|
133
135
|
isAtlasCloud ? process.env.ATLASCLOUD_API_KEY
|
|
134
136
|
: isRequesty ? process.env.REQUESTY_API_KEY
|
|
135
137
|
: isApiRoute ? process.env.API_ROUTE_API_KEY
|
|
136
|
-
: isCheaperInference ? process.env.CHEAPER_INFERENCE_API_KEY
|
|
138
|
+
: isCheaperInference ? process.env.CHEAPER_INFERENCE_API_KEY
|
|
139
|
+
: isRuncrate ? process.env.RUNCRATE_API_KEY : process.env.OPENAI_API_KEY,
|
|
137
140
|
usesPresetKeyOnly ? undefined : process.env.ANTHROPIC_API_KEY,
|
|
138
141
|
usesPresetKeyOnly ? undefined : openRouterMemoryLlmApiKey,
|
|
139
142
|
);
|
|
@@ -205,6 +208,7 @@ export function getResolvedConfig(options: ResolvedLaneOptions = {}): ResolvedMe
|
|
|
205
208
|
codegraph: {
|
|
206
209
|
excludePatterns: firstArray(toml.codegraph?.exclude_patterns, yaml.codegraph?.excludePatterns),
|
|
207
210
|
maxFileBytes: firstNumber(toml.codegraph?.max_file_bytes, yaml.codegraph?.maxFileBytes),
|
|
211
|
+
autoRefresh: first(toml.codegraph?.auto_refresh, yaml.codegraph?.autoRefresh, 'auto')!,
|
|
208
212
|
externalContext: first(
|
|
209
213
|
normalizeExternalContext(process.env.MEMORIX_CODEGRAPH_EXTERNAL_CONTEXT),
|
|
210
214
|
toml.codegraph?.external_context,
|
|
@@ -334,6 +338,7 @@ function getEnvSourceNames(): string[] {
|
|
|
334
338
|
'REQUESTY_API_KEY',
|
|
335
339
|
'API_ROUTE_API_KEY',
|
|
336
340
|
'CHEAPER_INFERENCE_API_KEY',
|
|
341
|
+
'RUNCRATE_API_KEY',
|
|
337
342
|
'ATLASCLOUD_API_KEY',
|
|
338
343
|
].filter((name) => process.env[name]);
|
|
339
344
|
}
|
|
@@ -25,7 +25,7 @@ import { getGlobalYamlPath, getProjectYamlPath } from './config-paths.js';
|
|
|
25
25
|
export interface MemorixYamlConfig {
|
|
26
26
|
/** LLM provider configuration */
|
|
27
27
|
llm?: {
|
|
28
|
-
provider?: 'openai' | 'anthropic' | 'openrouter' | 'requesty' | 'apiroute' | 'cheaperinference' | string;
|
|
28
|
+
provider?: 'openai' | 'anthropic' | 'openrouter' | 'requesty' | 'apiroute' | 'cheaperinference' | 'runcrate' | string;
|
|
29
29
|
model?: string;
|
|
30
30
|
apiKey?: string;
|
|
31
31
|
baseUrl?: string;
|
|
@@ -33,7 +33,7 @@ export interface MemorixYamlConfig {
|
|
|
33
33
|
|
|
34
34
|
/** TUI / chat agent LLM provider configuration */
|
|
35
35
|
agent?: {
|
|
36
|
-
provider?: 'openai' | 'anthropic' | 'openrouter' | 'requesty' | 'apiroute' | 'cheaperinference' | string;
|
|
36
|
+
provider?: 'openai' | 'anthropic' | 'openrouter' | 'requesty' | 'apiroute' | 'cheaperinference' | 'runcrate' | string;
|
|
37
37
|
model?: string;
|
|
38
38
|
apiKey?: string;
|
|
39
39
|
baseUrl?: string;
|
|
@@ -78,6 +78,8 @@ export interface MemorixYamlConfig {
|
|
|
78
78
|
excludePatterns?: string[];
|
|
79
79
|
/** Maximum source file size to parse into CodeGraph Memory */
|
|
80
80
|
maxFileBytes?: number;
|
|
81
|
+
/** Automatic built-in CodeGraph refresh policy. */
|
|
82
|
+
autoRefresh?: 'auto' | 'always' | 'never';
|
|
81
83
|
/** Use a healthy pre-existing local CodeGraph index when present (default: auto). */
|
|
82
84
|
externalContext?: 'auto' | 'off';
|
|
83
85
|
/** Optional CodeGraph executable path when it is not available on PATH. */
|
package/src/dashboard/server.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
import { createServer, type IncomingMessage, type ServerResponse } from 'node:http';
|
|
12
12
|
import { promises as fs } from 'node:fs';
|
|
13
13
|
import path from 'node:path';
|
|
14
|
-
import {
|
|
14
|
+
import { openLocalBrowser } from '../runtime/open-browser.js';
|
|
15
15
|
|
|
16
16
|
import { getBaseDataDir } from '../store/persistence.js';
|
|
17
17
|
import { getObservationStore, initObservationStore } from '../store/obs-store.js';
|
|
@@ -691,6 +691,9 @@ async function handleApi(
|
|
|
691
691
|
...(resolved.memory.llm.provider === 'cheaperinference'
|
|
692
692
|
? ['CHEAPER_INFERENCE_API_KEY']
|
|
693
693
|
: []),
|
|
694
|
+
...(resolved.memory.llm.provider === 'runcrate'
|
|
695
|
+
? ['RUNCRATE_API_KEY']
|
|
696
|
+
: []),
|
|
694
697
|
];
|
|
695
698
|
if (llmKey) {
|
|
696
699
|
const src = resolveDashboardKeySource({ value: llmKey, envKeys: memoryKeyEnv, configSource });
|
|
@@ -957,11 +960,7 @@ async function serveStatic(req: IncomingMessage, res: ServerResponse, staticDir:
|
|
|
957
960
|
|
|
958
961
|
/** Cross-platform open URL in default browser */
|
|
959
962
|
function openBrowser(url: string) {
|
|
960
|
-
|
|
961
|
-
process.platform === 'win32' ? `start "" "${url}"` :
|
|
962
|
-
process.platform === 'darwin' ? `open "${url}"` :
|
|
963
|
-
`xdg-open "${url}"`;
|
|
964
|
-
exec(cmd, { windowsHide: true }, () => { /* ignore errors */ });
|
|
963
|
+
try { openLocalBrowser(url); } catch { /* best effort */ }
|
|
965
964
|
}
|
|
966
965
|
|
|
967
966
|
/** Mutable dashboard state — updated at runtime when project changes */
|
package/src/hooks/handler.ts
CHANGED
|
@@ -246,7 +246,8 @@ const integrationEntries: Array<Omit<MemorixIntegration, 'capabilities'>> = [
|
|
|
246
246
|
entry: 'official-package',
|
|
247
247
|
status: 'ready',
|
|
248
248
|
install: 'memorix setup --agent pi',
|
|
249
|
-
surfaces: ['Pi package', 'extension API', 'skills', 'hooks'],
|
|
249
|
+
surfaces: ['MCP', 'Pi package', 'extension API', 'skills', 'hooks'],
|
|
250
|
+
note: 'Requires Pi 1.0+. Uses native .pi/mcp.json or ~/.pi/agent/mcp.json alongside the extension/skills package.',
|
|
250
251
|
},
|
|
251
252
|
{
|
|
252
253
|
agent: 'any-mcp',
|
package/src/llm/provider.ts
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from '../config.js';
|
|
21
21
|
|
|
22
22
|
export interface LLMConfig {
|
|
23
|
-
provider: 'openai' | 'anthropic' | 'openrouter' | 'requesty' | 'apiroute' | 'cheaperinference' | 'atlascloud' | 'custom';
|
|
23
|
+
provider: 'openai' | 'anthropic' | 'openrouter' | 'requesty' | 'apiroute' | 'cheaperinference' | 'runcrate' | 'atlascloud' | 'custom';
|
|
24
24
|
apiKey: string;
|
|
25
25
|
model?: string;
|
|
26
26
|
baseUrl?: string;
|
|
@@ -204,6 +204,7 @@ const PROVIDER_DEFAULTS: Record<string, { baseUrl: string; model: string }> = {
|
|
|
204
204
|
requesty: { baseUrl: 'https://router.requesty.ai/v1', model: 'openai/gpt-4.1-nano' },
|
|
205
205
|
apiroute: { baseUrl: 'https://global.api-route.com/v1', model: 'deepseek-v4.1-flash' },
|
|
206
206
|
cheaperinference: { baseUrl: 'https://api.cheaperinference.com/v1', model: 'gpt-5.4-mini' },
|
|
207
|
+
runcrate: { baseUrl: 'https://api.runcrate.ai/v1', model: 'deepseek-ai/DeepSeek-V4.1-Flash' },
|
|
207
208
|
atlascloud: { baseUrl: 'https://api.atlascloud.ai/v1', model: 'deepseek-ai/deepseek-v3.2' },
|
|
208
209
|
custom: { baseUrl: 'http://localhost:11434/v1', model: 'llama3' },
|
|
209
210
|
};
|