@codex-ultra/cxu 0.2.12 → 0.2.17

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,4 @@
1
+ import { spawn } from "node:child_process";
1
2
  import type { SaVmPolicyConfig } from "../shared-types.js";
2
3
  import { type SaVmBunProfile } from "../shared-types.js";
3
4
  export type SaVmFsCapability = {
@@ -8,7 +9,7 @@ export type SaVmNetCapability = {
8
9
  url: string;
9
10
  methods?: string[];
10
11
  };
11
- 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" | "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" | "run_bun" | "run_bun_profile" | "run_project_check" | "project_check" | "run_host" | "exec_host" | "host";
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
13
  export declare const SA_VM_BUN_PROFILES: readonly SaVmBunProfile[];
13
14
  export type { SaVmBunProfile };
14
15
  export type SaVmRunInput = {
@@ -26,6 +27,11 @@ export type SaVmRunInput = {
26
27
  keep_last_n_turns?: number;
27
28
  filter_tools?: string[];
28
29
  reason?: string;
30
+ key?: string;
31
+ all?: boolean;
32
+ fact?: string;
33
+ level?: NotePriorityLevel | string;
34
+ priority?: NotePriorityLevel | string;
29
35
  symbol?: string;
30
36
  old_name?: string;
31
37
  new_name?: string;
@@ -95,12 +101,20 @@ export type SaVmRunInput = {
95
101
  lines?: number;
96
102
  tail?: boolean;
97
103
  max_matches?: number;
104
+ repo?: string;
105
+ short?: boolean;
106
+ untracked?: "normal" | "no" | "all" | string;
107
+ staged?: boolean;
108
+ stat_only?: boolean;
109
+ statOnly?: boolean;
110
+ context?: number;
98
111
  url?: string;
99
112
  method?: string;
100
113
  headers?: Record<string, string>;
101
114
  body?: string;
102
115
  timeout_ms?: number;
103
116
  timeout?: number;
117
+ format?: string;
104
118
  source?: string;
105
119
  language?: "js" | "javascript" | "bun" | "ts" | "typescript" | "node" | "py" | "python" | "sa" | "sla";
106
120
  exe?: string;
@@ -125,17 +139,36 @@ export type SaVmRunInput = {
125
139
  policy?: SaVmPolicyConfig;
126
140
  parallel?: Array<Omit<SaVmRunInput, "parallel">>;
127
141
  concurrency?: number;
142
+ yield_time_ms?: number;
143
+ yield_ms?: number;
144
+ yieldTimeMs?: number;
145
+ session_id?: string;
146
+ sessionId?: string;
147
+ session?: string;
148
+ input?: string;
149
+ close_stdin?: boolean;
150
+ drain?: boolean;
151
+ commit?: string;
152
+ message?: string;
128
153
  };
129
154
  export declare function expandSaVmActionInput(input: SaVmRunInput): SaVmRunInput;
130
155
  export type SaVmRunResult = {
131
156
  ok: boolean;
132
- kind: "success" | "sa_error" | "capability_denied" | "fuel_exhausted" | "timeout" | "mem_quota" | "policy_invalid" | "stack_overflow" | "crashed" | "unavailable";
157
+ kind: "success" | "sa_error" | "capability_denied" | "fuel_exhausted" | "timeout" | "mem_quota" | "policy_invalid" | "stack_overflow" | "crashed" | "unavailable" | "running";
133
158
  exitCode: number | null;
134
159
  stdout: string;
135
160
  stderr: string;
136
161
  saVmEvents: Array<Record<string, unknown>>;
137
162
  saVmViolation: Record<string, unknown> | null;
138
163
  durationMs: number;
164
+ session_id?: string;
165
+ sessionId?: string;
166
+ pid?: number;
167
+ status?: string;
168
+ message?: string;
169
+ commit?: string;
170
+ created?: boolean;
171
+ [key: string]: unknown;
139
172
  };
140
173
  declare const DEFAULT_LIMITS: {
141
174
  fuel: number;
@@ -257,6 +290,7 @@ export declare function nativeFindImplementations(rawSymbol: string | undefined,
257
290
  timeout_ms?: number;
258
291
  timeout?: number;
259
292
  }, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
293
+ export declare function collectWorkspaceSourceFiles(baseDir: string, maxFiles?: number, timeoutMs?: number, startedAt?: number): Promise<string[]>;
260
294
  export declare function nativeFileOutline(rawPath: string, options: {
261
295
  detail?: boolean;
262
296
  max_tokens?: number;
@@ -276,6 +310,45 @@ export declare function nativeWorkspaceOutline(rawDir: string, options: {
276
310
  timeout_ms?: number;
277
311
  timeout?: number;
278
312
  }, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
313
+ export declare function nativeRepoMap(rawDir: string, options: {
314
+ pattern?: string;
315
+ path_pattern?: string;
316
+ is_regex?: boolean;
317
+ regex?: boolean;
318
+ max_files?: number;
319
+ max_symbols_per_file?: number;
320
+ max_tokens?: number;
321
+ max_file_bytes?: number;
322
+ exclude_dirs?: string[];
323
+ include_used_by?: boolean;
324
+ timeout_ms?: number;
325
+ timeout?: number;
326
+ }, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
327
+ export declare function nativeVerifyLoop(rawTarget: string, options: {
328
+ files?: string[];
329
+ pattern?: string;
330
+ max_files?: number;
331
+ max_errors?: number;
332
+ max_tokens?: number;
333
+ timeout_ms?: number;
334
+ timeout?: number;
335
+ }, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
336
+ export type NotePriorityLevel = "low" | "normal" | "important" | "critical";
337
+ export type WorkspaceNoteItem = {
338
+ key: string;
339
+ content: string;
340
+ level: NotePriorityLevel;
341
+ updated_at: number;
342
+ };
343
+ export type WorkspaceNotesDocument = {
344
+ workspace: string;
345
+ updated_at: number;
346
+ notes: WorkspaceNoteItem[];
347
+ };
348
+ export declare function resolveWorkspaceMemoryFilePath(workspaceDir: string): string;
349
+ export declare function nativeSaveNote(keyInput: string | undefined, contentInput: string | undefined, levelInput: string | undefined, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
350
+ export declare function nativeReadNotes(keyInput: string | undefined, maxTokensInput: number | undefined, remainingTokensInput: number | undefined, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
351
+ export declare function nativeDeleteNote(keyInput: string | undefined, all: boolean | undefined, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
279
352
  export declare function nativeReadMany(files: string[], options: {
280
353
  start_line?: number;
281
354
  end_line?: number;
@@ -334,13 +407,62 @@ export declare function nativeApplyPatch(patchText: string, policy: SaVmPolicyCo
334
407
  export declare function nativeCopyFile(fromPath: string, toPath: string, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
335
408
  export declare function nativeFileInfo(filePath: string, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
336
409
  export declare function nativeCountLines(filePath: string, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
410
+ export declare function nativeGitStatus(startPath: string, opts: {
411
+ short?: boolean;
412
+ untracked?: string;
413
+ max_entries?: number;
414
+ max_bytes?: number;
415
+ max_tokens?: number;
416
+ max_token?: number;
417
+ maxtoken?: number;
418
+ remaining_tokens?: number;
419
+ tokens_remaining?: number;
420
+ tokens_left?: number;
421
+ timeout_ms?: number;
422
+ timeout?: number;
423
+ }, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
424
+ export declare function nativeGitDiff(startPath: string, opts: {
425
+ pathspec?: string;
426
+ staged?: boolean;
427
+ stat_only?: boolean;
428
+ context?: number;
429
+ max_files?: number;
430
+ max_bytes?: number;
431
+ max_tokens?: number;
432
+ max_token?: number;
433
+ maxtoken?: number;
434
+ remaining_tokens?: number;
435
+ tokens_remaining?: number;
436
+ tokens_left?: number;
437
+ timeout_ms?: number;
438
+ timeout?: number;
439
+ }, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
337
440
  export declare function nativeHttpFetch(url: string, method?: string, headers?: Record<string, string>, body?: string, policy?: SaVmPolicyConfig, cwd?: string, startedAt?: number, timeoutOpts?: {
338
441
  timeout_ms?: number;
339
442
  timeout?: number;
340
443
  }): Promise<SaVmRunResult>;
341
444
  export declare const ALLOWED_HOST_SHORT_NAMES: Set<string>;
445
+ export declare const ALLOWED_CARGO_SUBCOMMANDS: Set<string>;
446
+ export declare const ALLOWED_GO_SUBCOMMANDS: Set<string>;
342
447
  export declare const FORBIDDEN_HOST_SUBCOMMANDS: Set<string>;
343
448
  export declare const ALLOWED_HOST_ENV_KEYS: Set<string>;
449
+ export interface SaVmProcessSession {
450
+ id: string;
451
+ child: ReturnType<typeof spawn>;
452
+ pid: number | undefined;
453
+ exe: string;
454
+ args: string[];
455
+ cwd: string;
456
+ startedAt: number;
457
+ stdoutChunks: string[];
458
+ stderrChunks: string[];
459
+ exitCode: number | null;
460
+ status: "running" | "exited" | "killed" | "timed_out" | "crashed";
461
+ closed: boolean;
462
+ maxBufferBytes: number;
463
+ autoKillTimer?: ReturnType<typeof setTimeout>;
464
+ }
465
+ export declare const saVmActiveSessions: Map<string, SaVmProcessSession>;
344
466
  interface RunHostCacheEntry {
345
467
  stdout: string;
346
468
  stderr: string;
@@ -368,6 +490,12 @@ export declare function sliceAndFilterOutput(rawStdout: string, options: {
368
490
  max_token?: number;
369
491
  }): string;
370
492
  export declare function nativeRunHost(rawInput: SaVmRunInput, _policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
493
+ export declare function nativeWriteStdin(rawInput: SaVmRunInput, _cwd: string, startedAt: number): SaVmRunResult;
494
+ export declare function nativeSessionStatus(rawInput: SaVmRunInput, _cwd: string, startedAt: number): SaVmRunResult;
495
+ export declare function nativeKillSession(rawInput: SaVmRunInput, _cwd: string, startedAt: number): SaVmRunResult;
496
+ export declare function nativeListSessions(startedAt: number): SaVmRunResult;
497
+ export declare function nativeLocalCheckpoint(rawInput: SaVmRunInput, cwd: string, startedAt: number): SaVmRunResult;
498
+ export declare function nativeRestoreCheckpoint(rawInput: SaVmRunInput, cwd: string, startedAt: number): SaVmRunResult;
371
499
  export declare function detectBatchDependencyViolation(tasks: SaVmRunInput[], cwd: string): {
372
500
  conflictedPath: string;
373
501
  writeTaskIndex: number;
package/package.json CHANGED
@@ -1,68 +1,68 @@
1
- {
2
- "name": "@codex-ultra/cxu",
3
- "version": "0.2.12",
4
- "description": "codex-ultra workbench launcher: server compiled locally with Bun + web UI (cxu starts it all).",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
12
- }
13
- },
14
- "bin": {
15
- "cxu": "dist/cli.js"
16
- },
17
- "files": [
18
- "dist",
19
- "wasm",
20
- "web-dist",
21
- "server-bundle",
22
- "README.md",
23
- "LICENSE"
24
- ],
25
- "scripts": {
26
- "vendor": "node scripts/vendor-sa-vm.mjs",
27
- "build": "node scripts/build.mjs",
28
- "build:bun": "bun scripts/build.mjs",
29
- "obfuscate": "node scripts/obfuscate.mjs",
30
- "typecheck": "tsc -p tsconfig.json --noEmit",
31
- "postinstall": "node dist/postinstall.js",
32
- "prepack": "npm run build && npm run obfuscate",
33
- "test": "bun test test/ 2>/dev/null || node --test test/*.test.mjs"
34
- },
35
- "publishConfig": {
36
- "access": "public"
37
- },
38
- "dependencies": {
39
- "tree-sitter-wasms": "^0.1.13",
40
- "web-tree-sitter": "0.25.10"
41
- },
42
- "devDependencies": {
43
- "esbuild": "^0.25.12",
44
- "javascript-obfuscator": "^5.5.0",
45
- "typescript": "^5.9.3"
46
- },
47
- "engines": {
48
- "node": ">=18"
49
- },
50
- "license": "MIT",
51
- "homepage": "https://github.com/layola13/codex-ultra#readme",
52
- "bugs": {
53
- "url": "https://github.com/layola13/codex-ultra/issues"
54
- },
55
- "repository": {
56
- "type": "git",
57
- "url": "git+https://github.com/layola13/codex-ultra.git",
58
- "directory": "packages/cxu"
59
- },
60
- "keywords": [
61
- "codex",
62
- "vm-tools",
63
- "ast",
64
- "tree-sitter",
65
- "typescript",
66
- "cross-platform"
67
- ]
68
- }
1
+ {
2
+ "name": "@codex-ultra/cxu",
3
+ "version": "0.2.17",
4
+ "description": "codex-ultra workbench launcher: server compiled locally with Bun + web UI (cxu starts it all).",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "bin": {
15
+ "cxu": "dist/cli.js"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "wasm",
20
+ "web-dist",
21
+ "server-bundle",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "scripts": {
26
+ "vendor": "node scripts/vendor-sa-vm.mjs",
27
+ "build": "node scripts/build.mjs",
28
+ "build:bun": "bun scripts/build.mjs",
29
+ "obfuscate": "node scripts/obfuscate.mjs",
30
+ "typecheck": "tsc -p tsconfig.json --noEmit",
31
+ "postinstall": "node dist/postinstall.js",
32
+ "prepack": "npm run build && npm run obfuscate",
33
+ "test": "bun test test/ 2>/dev/null || node --test test/*.test.mjs"
34
+ },
35
+ "publishConfig": {
36
+ "access": "public"
37
+ },
38
+ "dependencies": {
39
+ "tree-sitter-wasms": "^0.1.13",
40
+ "web-tree-sitter": "0.25.10"
41
+ },
42
+ "devDependencies": {
43
+ "esbuild": "^0.25.12",
44
+ "javascript-obfuscator": "^5.5.0",
45
+ "typescript": "^5.9.3"
46
+ },
47
+ "engines": {
48
+ "node": ">=18"
49
+ },
50
+ "license": "MIT",
51
+ "homepage": "https://github.com/layola13/codex-ultra#readme",
52
+ "bugs": {
53
+ "url": "https://github.com/layola13/codex-ultra/issues"
54
+ },
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/layola13/codex-ultra.git",
58
+ "directory": "packages/cxu"
59
+ },
60
+ "keywords": [
61
+ "codex",
62
+ "vm-tools",
63
+ "ast",
64
+ "tree-sitter",
65
+ "typescript",
66
+ "cross-platform"
67
+ ]
68
+ }