opencode-autognosis 2.0.4 → 2.2.0

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.
@@ -1,3 +1,31 @@
1
+ interface ActiveSet {
2
+ id: string;
3
+ name: string;
4
+ chunks: string[];
5
+ context_window: number;
6
+ priority: "high" | "medium" | "low";
7
+ created_at: string;
8
+ last_accessed: string;
9
+ metadata: {
10
+ description?: string;
11
+ tags?: string[];
12
+ session_id?: string;
13
+ agent_id?: string;
14
+ };
15
+ }
16
+ interface WorkingMemory {
17
+ current_set: string | null;
18
+ history: Array<{
19
+ set_id: string;
20
+ action: "created" | "loaded" | "updated" | "closed";
21
+ timestamp: string;
22
+ }>;
23
+ capacity: number;
24
+ usage: number;
25
+ }
26
+ export declare function loadActiveSet(setId: string): Promise<ActiveSet | null>;
27
+ export declare function loadWorkingMemory(): Promise<WorkingMemory>;
1
28
  export declare function activeSetTools(): {
2
29
  [key: string]: any;
3
30
  };
31
+ export {};
package/dist/activeset.js CHANGED
@@ -24,7 +24,7 @@ function calculateContextUsage(chunks) {
24
24
  // Simple calculation - in real implementation this would consider actual chunk sizes
25
25
  return chunks.length * 100; // Assume 100 tokens per chunk
26
26
  }
27
- async function loadActiveSet(setId) {
27
+ export async function loadActiveSet(setId) {
28
28
  try {
29
29
  const setPath = path.join(ACTIVESET_DIR, `${setId}.json`);
30
30
  if (!fsSync.existsSync(setPath)) {
@@ -41,7 +41,7 @@ async function saveActiveSet(activeSet) {
41
41
  const setPath = path.join(ACTIVESET_DIR, `${activeSet.id}.json`);
42
42
  await fs.writeFile(setPath, JSON.stringify(activeSet, null, 2));
43
43
  }
44
- async function loadWorkingMemory() {
44
+ export async function loadWorkingMemory() {
45
45
  const memoryPath = path.join(ACTIVESET_DIR, "working-memory.json");
46
46
  try {
47
47
  if (fsSync.existsSync(memoryPath)) {
@@ -11,6 +11,10 @@ export interface ChunkCard {
11
11
  hash: string;
12
12
  dependencies: string[];
13
13
  symbols: string[];
14
+ calls?: Array<{
15
+ name: string;
16
+ line: number;
17
+ }>;
14
18
  complexity_score: number;
15
19
  };
16
20
  }
@@ -155,6 +155,7 @@ export function chunkCardsTools() {
155
155
  hash: calculateHash(chunkContent),
156
156
  dependencies: await extractDependencies(sourceContent, ast, file_path),
157
157
  symbols: extractSymbolsFromAST(ast, sourceContent) || extractSymbols(sourceContent, file_path),
158
+ calls: ast ? extractCallsFromAST(ast, sourceContent) : extractCalls(sourceContent, file_path),
158
159
  complexity_score: calculateComplexity(sourceContent)
159
160
  }
160
161
  };
@@ -884,6 +885,45 @@ function getJSDocDescription(node, sourceFile) {
884
885
  }
885
886
  return "No documentation found";
886
887
  }
888
+ function extractCallsFromAST(sourceFile, content) {
889
+ const calls = [];
890
+ function visit(node) {
891
+ if (ts.isCallExpression(node)) {
892
+ const expression = node.expression;
893
+ let name = "";
894
+ if (ts.isIdentifier(expression)) {
895
+ name = expression.text;
896
+ }
897
+ else if (ts.isPropertyAccessExpression(expression)) {
898
+ name = expression.name.text;
899
+ }
900
+ if (name) {
901
+ const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart());
902
+ calls.push({ name, line: line + 1 });
903
+ }
904
+ }
905
+ ts.forEachChild(node, visit);
906
+ }
907
+ visit(sourceFile);
908
+ return calls;
909
+ }
910
+ function extractCalls(content, filePath) {
911
+ const calls = [];
912
+ // Basic regex fallback for non-TS languages: matches word(...)
913
+ const regex = /\b(\w+)\s*\(/g;
914
+ let match;
915
+ const lines = content.split('\n');
916
+ while ((match = regex.exec(content)) !== null) {
917
+ const name = match[1];
918
+ if (['if', 'for', 'while', 'switch', 'catch', 'return'].includes(name))
919
+ continue;
920
+ // Find line number
921
+ const offset = match.index;
922
+ const lineNumber = content.substring(0, offset).split('\n').length;
923
+ calls.push({ name, line: lineNumber });
924
+ }
925
+ return calls;
926
+ }
887
927
  // =============================================================================
888
928
  // C++ EXTRACTION HELPERS
889
929
  // =============================================================================
@@ -4,9 +4,6 @@ export declare class CodeGraphDB {
4
4
  private workerRunning;
5
5
  constructor();
6
6
  private initialize;
7
- /**
8
- * Background Job Management
9
- */
10
7
  createJob(id: string, type: string, metadata?: any): void;
11
8
  updateJob(id: string, updates: {
12
9
  status?: string;
@@ -14,16 +11,27 @@ export declare class CodeGraphDB {
14
11
  result?: string;
15
12
  error?: string;
16
13
  }): void;
17
- getJob(id: string): unknown;
18
- listJobs(type?: string, limit?: number): unknown[];
14
+ getJob(id: string): any;
15
+ listJobs(type?: string, limit?: number): any;
16
+ postToBlackboard(author: string, message: string, topic?: string): void;
17
+ readBlackboard(topic?: string, limit?: number): any;
18
+ storeIntent(patchId: string, reasoning: string, planId: string): void;
19
+ getIntent(patchId: string): any;
20
+ addArchRule(source: string, target: string): void;
21
+ checkArchViolation(sourcePath: string, targetPath: string): any;
19
22
  private startWorker;
20
23
  private processEmbeddingQueue;
21
- /**
22
- * Syncs a ChunkCard (JSON) into the SQLite Index.
23
- */
24
24
  ingestChunkCard(card: ChunkCard): void;
25
+ findCallers(functionName: string): {
26
+ path: string;
27
+ line_number: number;
28
+ }[];
25
29
  deleteChunkCard(cardId: string): void;
26
30
  recordExecution(planId: string | undefined, toolName: string, args: any, isOnPlan: boolean): void;
31
+ logAccess(chunkId: string, planId?: string): void;
32
+ getLruChunks(limit?: number): {
33
+ chunk_id: string;
34
+ }[];
27
35
  ingestCommits(commits: any[]): void;
28
36
  getHotFiles(pathPrefix?: string, limit?: number): {
29
37
  path: string;