@codex-ultra/cxu 0.2.19 → 0.2.21

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.
@@ -91,8 +91,9 @@ export interface SaVmToolsConfig {
91
91
  getDiagnostics?: boolean;
92
92
  organizeImports?: boolean;
93
93
  analyzeScope?: boolean;
94
+ codeGraph?: boolean;
94
95
  }
95
- export declare const ENHANCE_TOOLS_KEYS: readonly ["readFiles", "fastSearch", "editFiles", "applyPatch", "fileOutline", "findDefinition", "renameSymbol", "extractToFile", "moveWithImports", "addImport", "getDiagnostics", "organizeImports", "analyzeScope", "findReferences", "clearToolHistory"];
96
+ export declare const ENHANCE_TOOLS_KEYS: readonly ["readFiles", "fastSearch", "editFiles", "applyPatch", "fileOutline", "codeGraph", "findDefinition", "renameSymbol", "extractToFile", "moveWithImports", "addImport", "getDiagnostics", "organizeImports", "analyzeScope", "findReferences", "clearToolHistory"];
96
97
  export type EnhanceToolKey = typeof ENHANCE_TOOLS_KEYS[number];
97
98
  export declare function hasEnhanceToolsEnabled(tools?: SaVmToolsConfig | null): boolean;
98
99
  export declare function countActiveEnhanceTools(tools?: SaVmToolsConfig | null): number;
@@ -0,0 +1,92 @@
1
+ import type { SaVmPolicyConfig } from "../shared-types.js";
2
+ import { type NormalizedSaVmPolicy } from "./saVmPolicy.js";
3
+ import type { SaVmRunResult } from "./saVmResultKind.js";
4
+ export type CodeGraphEdgeKind = "extends" | "implements" | "owns" | "imports" | "calls";
5
+ export interface CodeGraphNode {
6
+ id: string;
7
+ label: string;
8
+ kind: "class" | "interface" | "module" | "function" | "unknown";
9
+ file?: string;
10
+ line?: number;
11
+ }
12
+ export interface CodeGraphEdge {
13
+ source: string;
14
+ target: string;
15
+ kind: CodeGraphEdgeKind;
16
+ label?: string;
17
+ }
18
+ export interface ExtractedClassInfo {
19
+ name: string;
20
+ bases: string[];
21
+ interfaces: string[];
22
+ fields: Array<{
23
+ name: string;
24
+ type?: string;
25
+ }>;
26
+ methods: Array<{
27
+ name: string;
28
+ calls: string[];
29
+ }>;
30
+ line: number;
31
+ }
32
+ export interface ExtractedImportInfo {
33
+ specifier: string;
34
+ symbols: Array<{
35
+ imported: string;
36
+ local: string;
37
+ }>;
38
+ isDefault?: boolean;
39
+ isNamespace?: boolean;
40
+ }
41
+ export interface ExtractedFileInfo {
42
+ filePath: string;
43
+ classes: ExtractedClassInfo[];
44
+ imports: ExtractedImportInfo[];
45
+ functions: Array<{
46
+ name: string;
47
+ calls: string[];
48
+ line: number;
49
+ }>;
50
+ }
51
+ export type CodeGraphMode = "symbol_hierarchy" | "module_dependency" | "module_deps" | "call_flow";
52
+ export interface CodeGraphOptions {
53
+ target: string;
54
+ mode?: CodeGraphMode;
55
+ depth?: number;
56
+ direction?: "upstream" | "downstream" | "both";
57
+ format?: "dot" | "py_stub" | "networkx";
58
+ max_nodes?: number;
59
+ max_tokens?: number;
60
+ output_file?: string;
61
+ candidate_files?: string[];
62
+ files?: string[];
63
+ timeout_ms?: number;
64
+ }
65
+ export declare function extractFileInfo(filePath: string, content: string): Promise<ExtractedFileInfo>;
66
+ export declare function resolveImportFilePath(importerAbsPath: string, specifier: string, _cwd?: string): string | null;
67
+ export declare function findProjectSourceFiles(dir: string, maxFiles?: number): string[];
68
+ export declare function buildScopedCodeGraph(options: CodeGraphOptions, policy: NormalizedSaVmPolicy, cwd: string): Promise<{
69
+ nodes: CodeGraphNode[];
70
+ edges: CodeGraphEdge[];
71
+ rootId: string;
72
+ truncated: boolean;
73
+ }>;
74
+ export declare function formatAsDot(graph: {
75
+ nodes: CodeGraphNode[];
76
+ edges: CodeGraphEdge[];
77
+ rootId: string;
78
+ truncated: boolean;
79
+ }, title?: string): string;
80
+ export declare function formatAsPyStub(graph: {
81
+ nodes: CodeGraphNode[];
82
+ edges: CodeGraphEdge[];
83
+ rootId: string;
84
+ truncated: boolean;
85
+ }): string;
86
+ export declare function formatAsNetworkX(graph: {
87
+ nodes: CodeGraphNode[];
88
+ edges: CodeGraphEdge[];
89
+ rootId: string;
90
+ truncated: boolean;
91
+ }): string;
92
+ export declare function nativeCodeGraph(rawInput: Record<string, any>, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
@@ -70,6 +70,7 @@ export type NormalizedSaVmPolicy = {
70
70
  getDiagnostics?: boolean;
71
71
  organizeImports?: boolean;
72
72
  analyzeScope?: boolean;
73
+ codeGraph?: boolean;
73
74
  };
74
75
  contextSavings?: SaVmContextSavingsConfig;
75
76
  };
@@ -9,7 +9,7 @@ export type SaVmNetCapability = {
9
9
  url: string;
10
10
  methods?: string[];
11
11
  };
12
- export type SaVmActionType = "read" | "read_file" | "read_lines" | "read_file_tail" | "tail_file" | "tail" | "read_many" | "read_files" | "find" | "find_files" | "list_files" | "write" | "write_file" | "edit" | "edit_file" | "apply_patch" | "patch" | "delete" | "delete_file" | "remove_file" | "safe_delete" | "move" | "move_file" | "rename" | "rename_file" | "copy" | "copy_file" | "stat" | "file_info" | "test_path" | "file_exists" | "exists" | "ensure_dir" | "mkdir" | "vm-read" | "vm_read" | "count_lines" | "line_count" | "list_dir" | "grep" | "grep_search" | "grep_async" | "grep_search_async" | "async_grep" | "http_fetch" | "fetch" | "run_js" | "exec_js" | "run_py" | "run_python" | "exec_py" | "clear_tool_history" | "prune_tool_history" | "find_references" | "find_all_references" | "find_implementations" | "find_impl" | "implementations" | "file_outline" | "outline" | "workspace_outline" | "outline_many" | "project_outline" | "repo_map" | "repo-map" | "rename_symbol" | "symbol_rename" | "move_file_with_imports" | "move_with_imports" | "find_definition" | "goto_definition" | "def" | "extract_to_file" | "extract_file" | "extract_module" | "add_import" | "insert_import" | "get_diagnostics" | "diagnostics" | "check_syntax" | "workspace_diagnostics" | "project_diagnostics" | "all_diagnostics" | "organize_imports" | "clean_unused_imports" | "sort_imports" | "analyze_scope" | "scope_analysis" | "verify_loop" | "verify-loop" | "verify_changed" | "git_status" | "git-status" | "git_diff" | "git-diff" | "run_bun" | "run_bun_profile" | "run_project_check" | "project_check" | "run_host" | "exec_host" | "host" | "save_note" | "add_note" | "read_notes" | "read_note" | "list_notes" | "delete_note" | "remove_note" | "clear_notes" | "write_stdin" | "stdin" | "input_stdin" | "session_status" | "read_session" | "poll_session" | "kill_session" | "kill_process" | "stop_session" | "list_sessions" | "local_checkpoint" | "checkpoint" | "git_checkpoint" | "restore_checkpoint" | "restore_git_checkpoint";
12
+ export type SaVmActionType = "read" | "read_file" | "read_lines" | "read_file_tail" | "tail_file" | "tail" | "read_many" | "read_files" | "find" | "find_files" | "list_files" | "write" | "write_file" | "edit" | "edit_file" | "apply_patch" | "patch" | "delete" | "delete_file" | "remove_file" | "safe_delete" | "move" | "move_file" | "rename" | "rename_file" | "copy" | "copy_file" | "stat" | "file_info" | "test_path" | "file_exists" | "exists" | "ensure_dir" | "mkdir" | "vm-read" | "vm_read" | "count_lines" | "line_count" | "list_dir" | "grep" | "grep_search" | "grep_async" | "grep_search_async" | "async_grep" | "http_fetch" | "fetch" | "run_js" | "exec_js" | "run_py" | "run_python" | "exec_py" | "clear_tool_history" | "prune_tool_history" | "find_references" | "find_all_references" | "find_implementations" | "find_impl" | "implementations" | "file_outline" | "outline" | "workspace_outline" | "outline_many" | "project_outline" | "repo_map" | "repo-map" | "code_graph" | "relation_graph" | "symbol_graph" | "rename_symbol" | "symbol_rename" | "move_file_with_imports" | "move_with_imports" | "find_definition" | "goto_definition" | "def" | "extract_to_file" | "extract_file" | "extract_module" | "add_import" | "insert_import" | "get_diagnostics" | "diagnostics" | "check_syntax" | "workspace_diagnostics" | "project_diagnostics" | "all_diagnostics" | "organize_imports" | "clean_unused_imports" | "sort_imports" | "analyze_scope" | "scope_analysis" | "verify_loop" | "verify-loop" | "verify_changed" | "git_status" | "git-status" | "git_diff" | "git-diff" | "run_bun" | "run_bun_profile" | "run_project_check" | "project_check" | "run_host" | "exec_host" | "host" | "save_note" | "add_note" | "read_notes" | "read_note" | "list_notes" | "delete_note" | "remove_note" | "clear_notes" | "write_stdin" | "stdin" | "input_stdin" | "session_status" | "read_session" | "poll_session" | "kill_session" | "kill_process" | "stop_session" | "list_sessions" | "local_checkpoint" | "checkpoint" | "git_checkpoint" | "restore_checkpoint" | "restore_git_checkpoint";
13
13
  export declare const SA_VM_BUN_PROFILES: readonly SaVmBunProfile[];
14
14
  export type { SaVmBunProfile };
15
15
  export type SaVmRunInput = {
@@ -19,6 +19,15 @@ export type SaVmRunInput = {
19
19
  file?: string;
20
20
  dest?: string;
21
21
  target?: string;
22
+ filePath?: string;
23
+ file_path?: string;
24
+ targetFile?: string;
25
+ target_file?: string;
26
+ filename?: string;
27
+ fileName?: string;
28
+ AbsolutePath?: string;
29
+ absolute_path?: string;
30
+ uri?: string;
22
31
  content?: string;
23
32
  profile?: string;
24
33
  subcommand?: string;
@@ -60,9 +69,15 @@ export type SaVmRunInput = {
60
69
  exclude_comments?: boolean;
61
70
  include_declarations?: boolean;
62
71
  old_text?: string;
72
+ oldText?: string;
73
+ old?: string;
63
74
  new_text?: string;
75
+ newText?: string;
76
+ new?: string;
64
77
  start_line?: number;
78
+ startLine?: number;
65
79
  end_line?: number;
80
+ endLine?: number;
66
81
  offset?: number;
67
82
  max_tokens?: number;
68
83
  max_token?: number;
@@ -71,20 +86,34 @@ export type SaVmRunInput = {
71
86
  tokens_remaining?: number;
72
87
  tokens_left?: number;
73
88
  max_lines?: number;
89
+ maxLines?: number;
74
90
  max_line_length?: number;
91
+ maxLineLength?: number;
75
92
  numbered?: boolean;
76
93
  dir?: string;
94
+ directory?: string;
95
+ folder?: string;
96
+ searchDirectory?: string;
97
+ SearchDirectory?: string;
77
98
  pattern?: string;
99
+ glob?: string;
100
+ Pattern?: string;
78
101
  type?: "all" | "file" | "directory" | string;
79
102
  max_bytes?: number;
103
+ maxBytes?: number;
80
104
  max_entries?: number;
105
+ maxEntries?: number;
81
106
  max_depth?: number;
107
+ maxDepth?: number;
82
108
  depth?: number;
83
109
  recursive?: boolean;
84
110
  patch?: string;
111
+ diff?: string;
112
+ mode?: string;
85
113
  from?: string;
86
114
  to?: string;
87
115
  query?: string;
116
+ Query?: string;
88
117
  queries?: string[];
89
118
  path_pattern?: string;
90
119
  is_regex?: boolean;
@@ -1,4 +1,4 @@
1
- import { type Node } from "web-tree-sitter";
1
+ import { Language, type Node } from "web-tree-sitter";
2
2
  export type OutlineSymbolKind = "function" | "method" | "class" | "struct" | "interface" | "enum" | "variant" | "trait" | "impl" | "type" | "module" | "constant" | "variable";
3
3
  export type OutlineSymbol = {
4
4
  name: string;
@@ -35,6 +35,7 @@ export declare function getTreeSitterWasmPath(): string | null;
35
35
  export declare function getLanguageWasmPath(langName: string): string | null;
36
36
  export declare function initTreeSitter(): Promise<boolean>;
37
37
  export declare function getLanguageNameForFile(filePath: string): string | null;
38
+ export declare function loadLanguageForFile(filePath: string): Promise<Language | null>;
38
39
  /** Check if an AST node is located inside comments or string literals. */
39
40
  export declare function isInsideCommentOrString(node: Node | null): boolean;
40
41
  /** Format symbol outline as a compact tree text for LLM. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codex-ultra/cxu",
3
- "version": "0.2.19",
3
+ "version": "0.2.21",
4
4
  "description": "codex-ultra workbench launcher: server compiled locally with Bun + web UI (cxu starts it all).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",