memorix 1.8.6 → 1.8.8

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +2 -1
  3. package/README.zh-CN.md +2 -1
  4. package/dist/cli/index.js +2209 -1161
  5. package/dist/cli/memcode.js +0 -0
  6. package/dist/dashboard/static/app.js +51 -3
  7. package/dist/dashboard/static/style.css +88 -0
  8. package/dist/index.js +1726 -736
  9. package/dist/maintenance-runner.js +855 -218
  10. package/dist/media-audio-runner.js +856 -219
  11. package/dist/media-video-runner.js +854 -217
  12. package/dist/memcode-runtime/CHANGELOG.md +41 -0
  13. package/dist/sdk.js +1716 -726
  14. package/dist/vector-backfill-runner.js +853 -216
  15. package/docs/1.8.7-CODEGRAPH.md +166 -0
  16. package/docs/API_REFERENCE.md +23 -2
  17. package/docs/ARCHITECTURE.md +13 -0
  18. package/docs/README.md +4 -1
  19. package/package.json +4 -3
  20. package/plugins/antigravity/memorix/plugin.json +1 -1
  21. package/plugins/claude/memorix/.claude-plugin/plugin.json +2 -2
  22. package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +2 -2
  23. package/plugins/codex/memorix/.codex-plugin/plugin.json +3 -3
  24. package/plugins/copilot/memorix/plugin.json +2 -2
  25. package/plugins/gemini/memorix/gemini-extension.json +1 -1
  26. package/plugins/hermes/memorix/plugin.yaml +1 -1
  27. package/plugins/omp/memorix/package.json +1 -1
  28. package/plugins/openclaw/memorix/.codex-plugin/plugin.json +3 -3
  29. package/plugins/pi/memorix/package.json +1 -1
  30. package/server.json +3 -3
  31. package/src/cli/commands/codegraph.ts +25 -11
  32. package/src/cli/commands/doctor.ts +11 -2
  33. package/src/cli/commands/serve-http.ts +27 -1
  34. package/src/cli/commands/setup.ts +1 -1
  35. package/src/codegraph/auto-context.ts +19 -10
  36. package/src/codegraph/context-pack.ts +20 -6
  37. package/src/codegraph/dashboard.ts +82 -0
  38. package/src/codegraph/external-provider.ts +10 -1
  39. package/src/codegraph/freshness.ts +1 -1
  40. package/src/codegraph/lite-provider.ts +81 -0
  41. package/src/codegraph/project-context.ts +18 -5
  42. package/src/codegraph/scip-provider.ts +181 -0
  43. package/src/codegraph/semantic-context.ts +139 -0
  44. package/src/codegraph/semantic-provider.ts +404 -0
  45. package/src/codegraph/store.ts +253 -18
  46. package/src/codegraph/types.ts +25 -3
  47. package/src/dashboard/server.ts +6 -0
  48. package/src/dashboard/static/style.css +88 -0
  49. package/src/knowledge/workset.ts +46 -44
  50. package/src/server/mcp-binding-store.ts +17 -0
  51. package/src/store/sqlite-db.ts +13 -0
@@ -19,7 +19,7 @@ import type {
19
19
  ContextReceiptOmission,
20
20
  ContextReceiptSelection,
21
21
  } from './context-assembly.js';
22
- import type { CodeGraphProviderQuality, ExternalCodeGraphOutline } from '../codegraph/types.js';
22
+ import type { CodeGraphOutline, CodeGraphProviderQuality } from '../codegraph/types.js';
23
23
  import type { KnowledgeClaim, ClaimEvidenceRef } from './types.js';
24
24
  import type { KnowledgePageRecord, KnowledgeWorkspace } from './workspace-types.js';
25
25
  import type { WorkflowSelection } from './workflow-types.js';
@@ -161,7 +161,7 @@ export interface TaskWorkset {
161
161
  codeEvolution?: WorksetCodeEvolution;
162
162
  startHere: string[];
163
163
  /** Bounded task-specific relations from a validated local semantic graph. */
164
- semanticCode?: ExternalCodeGraphOutline;
164
+ semanticCode?: CodeGraphOutline;
165
165
  reliableMemory: WorksetMemorySource[];
166
166
  cautionMemory: WorksetMemorySource[];
167
167
  hiddenCautionMemoryCount: number;
@@ -201,7 +201,7 @@ export interface BuildTaskWorksetInput {
201
201
  codeState?: string;
202
202
  codeEvolution?: WorksetCodeEvolution;
203
203
  startHere: string[];
204
- semanticCode?: ExternalCodeGraphOutline;
204
+ semanticCode?: CodeGraphOutline;
205
205
  providerQuality?: CodeGraphProviderQuality;
206
206
  reliableMemory?: WorksetMemorySource[];
207
207
  cautionMemory?: WorksetMemorySource[];
@@ -732,47 +732,6 @@ export function renderTaskWorksetPrompt(input: Omit<TaskWorkset, 'prompt' | 'bud
732
732
  }
733
733
  }
734
734
 
735
- if (input.semanticCode && (input.semanticCode.entryPoints.length > 0 || input.semanticCode.relations.length > 0)) {
736
- appendLine(lines, '', maxTokens, omitted, 'semantic-code-heading');
737
- appendLine(lines, 'Semantic code outline', maxTokens, omitted, 'semantic-code-heading');
738
- for (const relation of input.semanticCode.relations.slice(0, 2)) {
739
- const location = relation.from.path + (relation.line ? ':' + relation.line : '');
740
- appendLine(
741
- lines,
742
- '- ' + location + ': ' + short(relation.from.name, 12) + ' ' + short(relation.kind, 8) + ' ' + short(relation.to.name, 12),
743
- maxTokens,
744
- omitted,
745
- 'semantic-relation',
746
- selected,
747
- {
748
- kind: 'semantic-code',
749
- id: 'code:' + location,
750
- reason: 'validated optional semantic code relation',
751
- trust: 'derived',
752
- },
753
- );
754
- }
755
- if (input.semanticCode.relations.length === 0) {
756
- for (const entry of input.semanticCode.entryPoints.slice(0, 2)) {
757
- const location = entry.path + (entry.startLine ? ':' + entry.startLine : '');
758
- appendLine(
759
- lines,
760
- '- ' + location + ': ' + short(entry.name, 16) + ' (' + short(entry.kind, 8) + ')',
761
- maxTokens,
762
- omitted,
763
- 'semantic-entry',
764
- selected,
765
- {
766
- kind: 'semantic-code',
767
- id: 'code:' + location,
768
- reason: 'validated optional semantic code entry point',
769
- trust: 'derived',
770
- },
771
- );
772
- }
773
- }
774
- }
775
-
776
735
  if (input.startHere.length > 0) {
777
736
  appendLine(lines, '', maxTokens, omitted, 'start-heading');
778
737
  appendLine(lines, 'Start here', maxTokens, omitted, 'start-heading');
@@ -910,6 +869,49 @@ export function renderTaskWorksetPrompt(input: Omit<TaskWorkset, 'prompt' | 'bud
910
869
  }
911
870
  }
912
871
 
872
+ // Semantic structure is useful, but it must never evict the task, current
873
+ // facts, warnings, or reliable memory from a small Agent budget.
874
+ if (input.semanticCode && (input.semanticCode.entryPoints.length > 0 || input.semanticCode.relations.length > 0)) {
875
+ appendLine(lines, '', maxTokens, omitted, 'semantic-code-heading');
876
+ appendLine(lines, 'Semantic code outline', maxTokens, omitted, 'semantic-code-heading');
877
+ for (const relation of input.semanticCode.relations.slice(0, 2)) {
878
+ const location = relation.from.path + (relation.line ? ':' + relation.line : '');
879
+ appendLine(
880
+ lines,
881
+ '- ' + location + ': ' + short(relation.from.name, 12) + ' ' + short(relation.kind, 8) + ' ' + short(relation.to.name, 12),
882
+ maxTokens,
883
+ omitted,
884
+ 'semantic-relation',
885
+ selected,
886
+ {
887
+ kind: 'semantic-code',
888
+ id: 'code:' + location,
889
+ reason: 'validated semantic code relation',
890
+ trust: 'derived',
891
+ },
892
+ );
893
+ }
894
+ if (input.semanticCode.relations.length === 0) {
895
+ for (const entry of input.semanticCode.entryPoints.slice(0, 2)) {
896
+ const location = entry.path + (entry.startLine ? ':' + entry.startLine : '');
897
+ appendLine(
898
+ lines,
899
+ '- ' + location + ': ' + short(entry.name, 16) + ' (' + short(entry.kind, 8) + ')',
900
+ maxTokens,
901
+ omitted,
902
+ 'semantic-entry',
903
+ selected,
904
+ {
905
+ kind: 'semantic-code',
906
+ id: 'code:' + location,
907
+ reason: 'validated semantic code entry point',
908
+ trust: 'derived',
909
+ },
910
+ );
911
+ }
912
+ }
913
+ }
914
+
913
915
  return {
914
916
  prompt: lines.join('\n'),
915
917
  tokenCount: countTextTokens(lines.join('\n')),
@@ -73,6 +73,23 @@ export class McpBindingStore {
73
73
  return { ...binding, lastUsedAt };
74
74
  }
75
75
 
76
+ /** Reuse the most recent valid extension handle for a verified project root. */
77
+ findByProjectRoot(projectRoot: string): McpProjectBinding | undefined {
78
+ const row = this.requireDb().prepare(`
79
+ SELECT * FROM mcp_bindings
80
+ WHERE project_root = ?
81
+ ORDER BY last_used_at DESC
82
+ LIMIT 1
83
+ `).get(projectRoot);
84
+ if (!row) return undefined;
85
+ const binding = rowToBinding(row);
86
+ if (binding.expiresAt && Date.parse(binding.expiresAt) <= Date.now()) {
87
+ this.delete(binding.handleId);
88
+ return undefined;
89
+ }
90
+ return binding;
91
+ }
92
+
76
93
  delete(handleId: string): void {
77
94
  this.requireDb().prepare(`DELETE FROM mcp_bindings WHERE handle_id = ?`).run(handleId);
78
95
  }
@@ -244,6 +244,8 @@ CREATE TABLE IF NOT EXISTS code_files (
244
244
  sizeBytes INTEGER,
245
245
  indexedAt TEXT NOT NULL,
246
246
  gitCommit TEXT,
247
+ source TEXT,
248
+ parserError TEXT,
247
249
  UNIQUE(projectId, path)
248
250
  );
249
251
  `;
@@ -263,6 +265,7 @@ CREATE TABLE IF NOT EXISTS code_symbols (
263
265
  contentHash TEXT,
264
266
  indexedAt TEXT NOT NULL,
265
267
  stale INTEGER NOT NULL DEFAULT 0,
268
+ source TEXT,
266
269
  UNIQUE(projectId, fileId, qualifiedName, kind)
267
270
  );
268
271
  `;
@@ -278,6 +281,7 @@ CREATE TABLE IF NOT EXISTS code_edges (
278
281
  type TEXT NOT NULL,
279
282
  confidence REAL NOT NULL DEFAULT 1.0,
280
283
  evidence TEXT,
284
+ source TEXT,
281
285
  indexedAt TEXT NOT NULL
282
286
  );
283
287
  `;
@@ -1071,6 +1075,15 @@ const SCHEMA_MIGRATIONS: SchemaMigration[] = [
1071
1075
  db.exec('CREATE INDEX IF NOT EXISTS idx_mcp_bindings_project ON mcp_bindings(project_id, last_used_at DESC)');
1072
1076
  },
1073
1077
  },
1078
+ {
1079
+ id: '1.8.7-codegraph-evidence',
1080
+ apply: (db) => {
1081
+ addColumnIfMissing(db, 'code_files', 'source', 'source TEXT');
1082
+ addColumnIfMissing(db, 'code_files', 'parserError', 'parserError TEXT');
1083
+ addColumnIfMissing(db, 'code_symbols', 'source', 'source TEXT');
1084
+ addColumnIfMissing(db, 'code_edges', 'source', 'source TEXT');
1085
+ },
1086
+ },
1074
1087
  ];
1075
1088
 
1076
1089
  function applySchemaMigrations(db: any): void {