@codex-ultra/cxu 0.2.13 → 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" | "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" | "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";
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 = {
@@ -100,6 +101,13 @@ export type SaVmRunInput = {
100
101
  lines?: number;
101
102
  tail?: boolean;
102
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;
103
111
  url?: string;
104
112
  method?: string;
105
113
  headers?: Record<string, string>;
@@ -131,17 +139,36 @@ export type SaVmRunInput = {
131
139
  policy?: SaVmPolicyConfig;
132
140
  parallel?: Array<Omit<SaVmRunInput, "parallel">>;
133
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;
134
153
  };
135
154
  export declare function expandSaVmActionInput(input: SaVmRunInput): SaVmRunInput;
136
155
  export type SaVmRunResult = {
137
156
  ok: boolean;
138
- 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";
139
158
  exitCode: number | null;
140
159
  stdout: string;
141
160
  stderr: string;
142
161
  saVmEvents: Array<Record<string, unknown>>;
143
162
  saVmViolation: Record<string, unknown> | null;
144
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;
145
172
  };
146
173
  declare const DEFAULT_LIMITS: {
147
174
  fuel: number;
@@ -380,13 +407,62 @@ export declare function nativeApplyPatch(patchText: string, policy: SaVmPolicyCo
380
407
  export declare function nativeCopyFile(fromPath: string, toPath: string, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
381
408
  export declare function nativeFileInfo(filePath: string, policy: SaVmPolicyConfig | undefined, cwd: string, startedAt: number): Promise<SaVmRunResult>;
382
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>;
383
440
  export declare function nativeHttpFetch(url: string, method?: string, headers?: Record<string, string>, body?: string, policy?: SaVmPolicyConfig, cwd?: string, startedAt?: number, timeoutOpts?: {
384
441
  timeout_ms?: number;
385
442
  timeout?: number;
386
443
  }): Promise<SaVmRunResult>;
387
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>;
388
447
  export declare const FORBIDDEN_HOST_SUBCOMMANDS: Set<string>;
389
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>;
390
466
  interface RunHostCacheEntry {
391
467
  stdout: string;
392
468
  stderr: string;
@@ -414,6 +490,12 @@ export declare function sliceAndFilterOutput(rawStdout: string, options: {
414
490
  max_token?: number;
415
491
  }): string;
416
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;
417
499
  export declare function detectBatchDependencyViolation(tasks: SaVmRunInput[], cwd: string): {
418
500
  conflictedPath: string;
419
501
  writeTaskIndex: number;
package/package.json CHANGED
@@ -1,68 +1,68 @@
1
- {
2
- "name": "@codex-ultra/cxu",
3
- "version": "0.2.13",
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
+ }