@elvatis_com/elvatis-mcp 0.6.2 → 0.7.1
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.
- package/README.md +37 -45
- package/dist/spawn.d.ts.map +1 -1
- package/dist/spawn.js +24 -2
- package/dist/spawn.js.map +1 -1
- package/dist/tools/claude.d.ts.map +1 -1
- package/dist/tools/claude.js +0 -1
- package/dist/tools/claude.js.map +1 -1
- package/dist/tools/codex.d.ts +19 -17
- package/dist/tools/codex.d.ts.map +1 -1
- package/dist/tools/codex.js +69 -19
- package/dist/tools/codex.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -219,17 +219,40 @@ Prerequisites: `.env` configured, local LLM server running, OpenClaw server reac
|
|
|
219
219
|
|
|
220
220
|
## Benchmarks
|
|
221
221
|
|
|
222
|
-
|
|
222
|
+
See [BENCHMARKS.md](BENCHMARKS.md) for the full benchmark suite, methodology, and community contribution guide.
|
|
223
223
|
|
|
224
|
-
###
|
|
224
|
+
### Reference Hardware
|
|
225
225
|
|
|
226
226
|
| Component | Spec |
|
|
227
227
|
|---|---|
|
|
228
|
-
| CPU | AMD Threadripper 3960X (24 cores / 48 threads
|
|
228
|
+
| CPU | AMD Threadripper 3960X (24 cores / 48 threads) |
|
|
229
229
|
| GPU | AMD Radeon RX 9070 XT Elite (16 GB GDDR6) |
|
|
230
|
-
| RAM | 128 GB DDR4
|
|
230
|
+
| RAM | 128 GB DDR4 |
|
|
231
231
|
| OS | Windows 11 Pro |
|
|
232
|
-
|
|
|
232
|
+
| Runtime | LM Studio + ROCm (`llama.cpp-win-x86_64-amd-rocm-avx2@2.8.0`) |
|
|
233
|
+
|
|
234
|
+
### Local LLM Inference (LM Studio, ROCm GPU, `--gpu max`)
|
|
235
|
+
|
|
236
|
+
Median of 3 runs, `max_tokens=512`. Tasks: classify (1-word sentiment), extract (JSON), reason (arithmetic), code (Python function).
|
|
237
|
+
|
|
238
|
+
| Model | Params | classify | extract | reason | code |
|
|
239
|
+
|-------|--------|----------|---------|--------|------|
|
|
240
|
+
| Phi 4 Mini Reasoning | 3B | 3.9s | 5.1s | 8.6s | 8.5s |
|
|
241
|
+
| Deepseek R1 0528 Qwen3 | 8B | 2.5s | 7.7s | 13.3s | 7.3s |
|
|
242
|
+
| Qwen 3.5 9B | 9B | 4.9s | 11.2s | 6.6s | 11.4s |
|
|
243
|
+
| Phi 4 Reasoning Plus | 15B | 0.4s | 17.4s | 4.5s | 17.3s |
|
|
244
|
+
| **GPT-OSS 20B** | **20B** | **0.6s** | **0.7s** | **0.7s** | **3.1s** |
|
|
245
|
+
|
|
246
|
+
**GPU speedup vs CPU (Deepseek R1 8B):** classify 8.4x faster, extract 3.2x faster.
|
|
247
|
+
|
|
248
|
+
### Sub-Agent Comparison (same task, different backends)
|
|
249
|
+
|
|
250
|
+
| Agent | Backend | Avg Latency | Cost | Notes |
|
|
251
|
+
|-------|---------|-------------|------|-------|
|
|
252
|
+
| **local_llm_run** | GPT-OSS 20B (ROCm GPU) | **1.3s** | Free | 3x faster than Codex, 5x faster than Claude |
|
|
253
|
+
| codex_run | OpenAI Codex CLI | 4.1s | Pay-per-use | Best for coding tasks |
|
|
254
|
+
| claude_run | Claude Sonnet 4.6 | 6.3s | Pay-per-use | Best for complex reasoning |
|
|
255
|
+
| gemini_run | Gemini 2.5 Flash | 34.0s | Free tier | CLI startup overhead, best for long context |
|
|
233
256
|
|
|
234
257
|
### Service Latency (system_status)
|
|
235
258
|
|
|
@@ -242,49 +265,18 @@ All benchmarks measured on a local development machine. Results will vary based
|
|
|
242
265
|
| Codex CLI (version check) | 131-136 ms | CLI startup overhead |
|
|
243
266
|
| Gemini CLI (version check) | 4,700-4,900 ms | CLI startup + auth check |
|
|
244
267
|
|
|
245
|
-
###
|
|
246
|
-
|
|
247
|
-
| Model | Task | Tokens | Time | Notes |
|
|
248
|
-
|---|---|---|---|---|
|
|
249
|
-
| Deepseek R1 Qwen3 8B | Sentiment classification | 343 (303 reasoning) | ~21s | Reasoning model, <think> tags stripped |
|
|
250
|
-
| Deepseek R1 Qwen3 8B | JSON extraction | ~400 | ~25s | Structured output from natural language |
|
|
251
|
-
| Deepseek R1 Qwen3 8B | Simple greeting | 151 (145 reasoning) | ~18s | Reasoning overhead even for trivial tasks |
|
|
252
|
-
|
|
253
|
-
### Prompt Splitting (prompt_split)
|
|
254
|
-
|
|
255
|
-
| Strategy | Latency | Notes |
|
|
256
|
-
|---|---|---|
|
|
257
|
-
| Heuristic (keyword) | <1 ms | Instant, no LLM call |
|
|
258
|
-
| Short-circuit (single domain) | <1 ms | Auto-detected, no LLM call |
|
|
259
|
-
| Local LLM | 60s (fallback) | Deepseek R1 struggles with structured JSON output, falls back to heuristic |
|
|
260
|
-
| Gemini | 5-15s | Best quality splitting (requires Gemini CLI) |
|
|
261
|
-
|
|
262
|
-
### Tool Operations
|
|
263
|
-
|
|
264
|
-
| Operation | Latency | Notes |
|
|
265
|
-
|---|---|---|
|
|
266
|
-
| Memory search (SSH, single call) | 208-391 ms | grep across 90 days of daily logs |
|
|
267
|
-
| Home light on/off | 48-84 ms | Direct HA REST API |
|
|
268
|
-
| Cron job listing | ~300 ms | SSH + openclaw CLI |
|
|
269
|
-
| File listing (SSH) | ~300 ms | Remote directory listing |
|
|
270
|
-
|
|
271
|
-
### Notes on Hardware
|
|
272
|
-
|
|
273
|
-
This setup runs all local inference on **CPU only** (Threadripper 3960X, 48 threads). The Radeon RX 9070 XT is not yet utilized for LLM inference because:
|
|
274
|
-
|
|
275
|
-
- LM Studio uses llama.cpp which requires ROCm or Vulkan for AMD GPUs
|
|
276
|
-
- ROCm support for RDNA 4 (RX 9070 series) is still maturing
|
|
277
|
-
- A Vulkan backend for llama.cpp is in development
|
|
268
|
+
### prompt_split Accuracy (heuristic strategy)
|
|
278
269
|
|
|
279
|
-
|
|
270
|
+
| Metric | Result |
|
|
271
|
+
|--------|--------|
|
|
272
|
+
| Pass rate | 6/10 (60%) |
|
|
273
|
+
| Task count accuracy | 7/10 (70%) |
|
|
274
|
+
| Avg agent match | 70% |
|
|
275
|
+
| Latency | <1ms (no LLM call) |
|
|
280
276
|
|
|
281
|
-
|
|
282
|
-
- NVIDIA GPUs (RTX 3090/4090) with CUDA
|
|
283
|
-
- AMD GPUs with ROCm (RDNA 3, MI300X)
|
|
284
|
-
- Intel Arc GPUs with SYCL
|
|
285
|
-
- ARM servers (Graviton, Ampere Altra)
|
|
277
|
+
The `auto` strategy (Gemini or local LLM) handles complex multi-step prompts with higher accuracy. See [BENCHMARKS.md](BENCHMARKS.md) for details.
|
|
286
278
|
|
|
287
|
-
|
|
279
|
+
> Want to contribute benchmarks from your hardware? See [BENCHMARKS.md](BENCHMARKS.md#community-contributions).
|
|
288
280
|
|
|
289
281
|
---
|
|
290
282
|
|
package/dist/spawn.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../src/spawn.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../src/spawn.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuDH;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EAAE,EACd,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAmDjB"}
|
package/dist/spawn.js
CHANGED
|
@@ -71,19 +71,41 @@ function spawnEnv() {
|
|
|
71
71
|
}
|
|
72
72
|
return env;
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* On Windows with shell:true, Node concatenates args with spaces but does NOT quote them.
|
|
76
|
+
* This causes multi-word prompts like "Write a Python function..." to be word-split
|
|
77
|
+
* by cmd.exe, each word becoming a separate positional argument.
|
|
78
|
+
*
|
|
79
|
+
* Fix: wrap every arg in double quotes and escape any inner double quotes.
|
|
80
|
+
* This converts ['-p', 'hello world'] -> ['-p', '"hello world"'] before spawn.
|
|
81
|
+
*/
|
|
82
|
+
function quoteArgsForWindowsShell(args) {
|
|
83
|
+
return args.map(arg => {
|
|
84
|
+
// Already quoted — leave as-is
|
|
85
|
+
if (arg.startsWith('"') && arg.endsWith('"'))
|
|
86
|
+
return arg;
|
|
87
|
+
// Escape inner double quotes, then wrap the whole arg
|
|
88
|
+
const escaped = arg.replace(/"/g, '\\"');
|
|
89
|
+
return `"${escaped}"`;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
74
92
|
/**
|
|
75
93
|
* Spawn a local command and return stdout as a string.
|
|
76
94
|
* Progress output on stderr is silently collected (not forwarded).
|
|
77
95
|
* Throws if the process exits with a non-zero code or times out.
|
|
78
96
|
*/
|
|
79
97
|
function spawnLocal(cmd, args, timeoutMs) {
|
|
98
|
+
const isWin = process.platform === 'win32';
|
|
80
99
|
return new Promise((resolve, reject) => {
|
|
81
|
-
const proc = (0, child_process_1.spawn)(cmd, args, {
|
|
100
|
+
const proc = (0, child_process_1.spawn)(cmd, isWin ? quoteArgsForWindowsShell(args) : args, {
|
|
82
101
|
// shell: true on Windows so cmd.exe resolves .cmd/.ps1 wrappers (e.g. gemini.cmd, codex.cmd)
|
|
83
|
-
shell:
|
|
102
|
+
shell: isWin,
|
|
84
103
|
windowsHide: true,
|
|
85
104
|
env: spawnEnv(),
|
|
86
105
|
});
|
|
106
|
+
// Close stdin immediately so CLIs that check for piped input (e.g. Claude)
|
|
107
|
+
// don't wait for data that will never come
|
|
108
|
+
proc.stdin?.end();
|
|
87
109
|
let stdout = '';
|
|
88
110
|
let stderr = '';
|
|
89
111
|
proc.stdout.on('data', (d) => { stdout += d.toString(); });
|
package/dist/spawn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../src/spawn.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3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AAC;YACL,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/tools/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,eAAe;;;;;;;;;;;;EAW1B,CAAC;AAIH,wBAAsB,eAAe,CACnC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/tools/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,eAAe;;;;;;;;;;;;EAW1B,CAAC;AAIH,wBAAsB,eAAe,CACnC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDlE"}
|
package/dist/tools/claude.js
CHANGED
package/dist/tools/claude.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/tools/claude.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAsBH,
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/tools/claude.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;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,CAAC,QAAQ,EAAE,CAAC;YACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,IAAI,+BAA+B,EAAE,CAAC;QACrF,CAAC;QAED,wCAAwC;QACxC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU;YACjC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,IAAI,SAAS;YAC9D,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,SAAS,CAAC;QAE5B,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,MAAM,CAAC,MAAM,IAAI,kBAAkB;YAC7C,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,QAAQ,EAAE,MAAM,CAAC,cAAc;YAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,0CAA0C;QAC1C,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,GAAG,CAAC,IAAI,EAAE;YACpB,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS;YAC9B,IAAI,EAAE,oCAAoC;SAC3C,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/tools/codex.d.ts
CHANGED
|
@@ -2,46 +2,48 @@
|
|
|
2
2
|
* Codex sub-agent tool.
|
|
3
3
|
*
|
|
4
4
|
* Uses the @openai/codex CLI in non-interactive mode:
|
|
5
|
-
* codex exec "<prompt>" --
|
|
5
|
+
* codex exec "<prompt>" --full-auto [--model <model>] [--json]
|
|
6
6
|
*
|
|
7
|
-
* Authentication: the CLI uses locally cached OpenAI credentials
|
|
8
|
-
*
|
|
7
|
+
* Authentication: the CLI uses locally cached OpenAI credentials.
|
|
8
|
+
* Run `codex` once interactively to authenticate.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* -
|
|
12
|
-
* -
|
|
10
|
+
* Sandbox modes:
|
|
11
|
+
* --full-auto: workspace-write sandbox, no approval prompts (default, safe)
|
|
12
|
+
* --dangerously-bypass-approvals-and-sandbox: no sandbox, no prompts (dangerous)
|
|
13
13
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
14
|
+
* Output: codex streams JSONL events to stdout with --json flag.
|
|
15
|
+
* Final assistant message is extracted from event type "message".
|
|
16
|
+
* Without --json, last line of stdout is the final response.
|
|
17
|
+
*
|
|
18
|
+
* Also supports --oss for local providers (LM Studio, Ollama) via --local-provider.
|
|
17
19
|
*
|
|
18
20
|
* Use cases vs openclaw_run / gemini_run:
|
|
19
|
-
* - Coding tasks: refactoring, debugging, code generation
|
|
21
|
+
* - Coding tasks: refactoring, debugging, code generation
|
|
20
22
|
* - OpenAI model stack (o3, gpt-5-codex, etc.)
|
|
21
|
-
* - Long agentic tasks
|
|
23
|
+
* - Long agentic tasks with file read/write and shell commands
|
|
22
24
|
*/
|
|
23
25
|
import { z } from 'zod';
|
|
24
26
|
import { Config } from '../config.js';
|
|
25
27
|
export declare const codexRunSchema: z.ZodObject<{
|
|
26
28
|
prompt: z.ZodString;
|
|
27
29
|
model: z.ZodOptional<z.ZodString>;
|
|
28
|
-
|
|
30
|
+
sandbox: z.ZodDefault<z.ZodEnum<["full-auto", "dangerous"]>>;
|
|
29
31
|
timeout_seconds: z.ZodDefault<z.ZodNumber>;
|
|
30
32
|
}, "strip", z.ZodTypeAny, {
|
|
31
33
|
prompt: string;
|
|
32
34
|
timeout_seconds: number;
|
|
33
|
-
|
|
35
|
+
sandbox: "full-auto" | "dangerous";
|
|
34
36
|
model?: string | undefined;
|
|
35
37
|
}, {
|
|
36
38
|
prompt: string;
|
|
37
39
|
model?: string | undefined;
|
|
38
40
|
timeout_seconds?: number | undefined;
|
|
39
|
-
|
|
41
|
+
sandbox?: "full-auto" | "dangerous" | undefined;
|
|
40
42
|
}>;
|
|
41
43
|
export declare function handleCodexRun(args: {
|
|
42
44
|
prompt: string;
|
|
43
45
|
model?: string;
|
|
44
|
-
|
|
46
|
+
sandbox: 'full-auto' | 'dangerous';
|
|
45
47
|
timeout_seconds: number;
|
|
46
48
|
}, config: Config): Promise<{
|
|
47
49
|
success: boolean;
|
|
@@ -49,12 +51,12 @@ export declare function handleCodexRun(args: {
|
|
|
49
51
|
hint: string;
|
|
50
52
|
response?: undefined;
|
|
51
53
|
model?: undefined;
|
|
52
|
-
|
|
54
|
+
sandbox?: undefined;
|
|
53
55
|
} | {
|
|
54
56
|
success: boolean;
|
|
55
57
|
response: string;
|
|
56
58
|
model: string;
|
|
57
|
-
|
|
59
|
+
sandbox: "full-auto" | "dangerous";
|
|
58
60
|
error?: undefined;
|
|
59
61
|
hint?: undefined;
|
|
60
62
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/tools/codex.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/tools/codex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAKtC,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAgBzB,CAAC;AAuDH,wBAAsB,cAAc,CAClC,IAAI,EAAE;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,WAAW,GAAG,WAAW,CAAC;IACnC,eAAe,EAAE,MAAM,CAAC;CACzB,EACD,MAAM,EAAE,MAAM;;;;;;;;;;;;;;GAiCf"}
|
package/dist/tools/codex.js
CHANGED
|
@@ -3,23 +3,25 @@
|
|
|
3
3
|
* Codex sub-agent tool.
|
|
4
4
|
*
|
|
5
5
|
* Uses the @openai/codex CLI in non-interactive mode:
|
|
6
|
-
* codex exec "<prompt>" --
|
|
6
|
+
* codex exec "<prompt>" --full-auto [--model <model>] [--json]
|
|
7
7
|
*
|
|
8
|
-
* Authentication: the CLI uses locally cached OpenAI credentials
|
|
9
|
-
*
|
|
8
|
+
* Authentication: the CLI uses locally cached OpenAI credentials.
|
|
9
|
+
* Run `codex` once interactively to authenticate.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
11
|
+
* Sandbox modes:
|
|
12
|
+
* --full-auto: workspace-write sandbox, no approval prompts (default, safe)
|
|
13
|
+
* --dangerously-bypass-approvals-and-sandbox: no sandbox, no prompts (dangerous)
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Output: codex streams JSONL events to stdout with --json flag.
|
|
16
|
+
* Final assistant message is extracted from event type "message".
|
|
17
|
+
* Without --json, last line of stdout is the final response.
|
|
18
|
+
*
|
|
19
|
+
* Also supports --oss for local providers (LM Studio, Ollama) via --local-provider.
|
|
18
20
|
*
|
|
19
21
|
* Use cases vs openclaw_run / gemini_run:
|
|
20
|
-
* - Coding tasks: refactoring, debugging, code generation
|
|
22
|
+
* - Coding tasks: refactoring, debugging, code generation
|
|
21
23
|
* - OpenAI model stack (o3, gpt-5-codex, etc.)
|
|
22
|
-
* - Long agentic tasks
|
|
24
|
+
* - Long agentic tasks with file read/write and shell commands
|
|
23
25
|
*/
|
|
24
26
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
27
|
exports.codexRunSchema = void 0;
|
|
@@ -32,32 +34,80 @@ exports.codexRunSchema = zod_1.z.object({
|
|
|
32
34
|
'Works best for coding tasks, file operations, and technical analysis.'),
|
|
33
35
|
model: zod_1.z.string().optional().describe('OpenAI model to use, e.g. "o3", "gpt-5-codex". ' +
|
|
34
36
|
'Omit to use the configured default (CODEX_MODEL env var or Codex default).'),
|
|
35
|
-
|
|
36
|
-
'"
|
|
37
|
+
sandbox: zod_1.z.enum(['full-auto', 'dangerous']).default('full-auto').describe('"full-auto": workspace-write sandbox, no approval prompts (default, recommended). ' +
|
|
38
|
+
'"dangerous": bypass all approvals and sandbox — only use in isolated environments.'),
|
|
37
39
|
timeout_seconds: zod_1.z.number().min(10).max(600).default(120).describe('Max seconds to wait. Codex tasks can take longer than Gemini — 120s default.'),
|
|
38
40
|
});
|
|
41
|
+
function extractResponseFromJsonl(raw) {
|
|
42
|
+
// Parse JSONL events and extract the assistant message text
|
|
43
|
+
// Codex emits: item.completed (with item.text) and turn.completed (with usage)
|
|
44
|
+
const lines = raw.trim().split('\n').filter(l => l.trim().startsWith('{'));
|
|
45
|
+
const messages = [];
|
|
46
|
+
for (const line of lines) {
|
|
47
|
+
try {
|
|
48
|
+
const event = JSON.parse(line);
|
|
49
|
+
// item.completed: { type: "item.completed", item: { type: "agent_message", text: "..." } }
|
|
50
|
+
if (event['type'] === 'item.completed') {
|
|
51
|
+
const item = event['item'];
|
|
52
|
+
if (item?.['text'] && typeof item['text'] === 'string') {
|
|
53
|
+
messages.push(item['text']);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// message event (older codex versions)
|
|
57
|
+
if (event['type'] === 'message' && event['role'] === 'assistant') {
|
|
58
|
+
const content = event['content'];
|
|
59
|
+
if (typeof content === 'string') {
|
|
60
|
+
messages.push(content);
|
|
61
|
+
}
|
|
62
|
+
else if (Array.isArray(content)) {
|
|
63
|
+
for (const block of content) {
|
|
64
|
+
if (block.type === 'text' && block.text)
|
|
65
|
+
messages.push(block.text);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
// Not valid JSON, skip
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (messages.length > 0)
|
|
75
|
+
return messages[messages.length - 1];
|
|
76
|
+
// Fallback: return last non-empty line (skip JSONL noise)
|
|
77
|
+
const nonJson = raw.trim().split('\n').filter(l => l.trim() && !l.trim().startsWith('{'));
|
|
78
|
+
if (nonJson.length > 0)
|
|
79
|
+
return nonJson[nonJson.length - 1];
|
|
80
|
+
return raw.trim();
|
|
81
|
+
}
|
|
39
82
|
// --- Handler ---
|
|
40
83
|
async function handleCodexRun(args, config) {
|
|
41
84
|
const model = args.model ?? config.codexModel;
|
|
42
|
-
const cliArgs = ['exec', args.prompt, '--
|
|
85
|
+
const cliArgs = ['exec', args.prompt, '--json', '--ephemeral'];
|
|
86
|
+
if (args.sandbox === 'dangerous') {
|
|
87
|
+
cliArgs.push('--dangerously-bypass-approvals-and-sandbox');
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
cliArgs.push('--full-auto');
|
|
91
|
+
}
|
|
43
92
|
if (model)
|
|
44
93
|
cliArgs.push('--model', model);
|
|
45
|
-
let
|
|
94
|
+
let raw;
|
|
46
95
|
try {
|
|
47
|
-
|
|
96
|
+
raw = await (0, spawn_js_1.spawnLocal)('codex', cliArgs, args.timeout_seconds * 1000);
|
|
48
97
|
}
|
|
49
98
|
catch (err) {
|
|
50
99
|
return {
|
|
51
100
|
success: false,
|
|
52
101
|
error: String(err),
|
|
53
|
-
hint: 'Run `codex
|
|
102
|
+
hint: 'Run `codex` once to authenticate, or check `codex --version` to confirm the CLI is installed.',
|
|
54
103
|
};
|
|
55
104
|
}
|
|
105
|
+
const response = extractResponseFromJsonl(raw);
|
|
56
106
|
return {
|
|
57
107
|
success: true,
|
|
58
|
-
response
|
|
108
|
+
response,
|
|
59
109
|
model: model ?? 'default',
|
|
60
|
-
|
|
110
|
+
sandbox: args.sandbox,
|
|
61
111
|
};
|
|
62
112
|
}
|
|
63
113
|
//# sourceMappingURL=codex.js.map
|
package/dist/tools/codex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/tools/codex.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"codex.js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
|
|
1
1
|
{
|
|
2
2
|
"name": "@elvatis_com/elvatis-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "MCP server for OpenClaw — expose smart home, memory, cron, and more to Claude Desktop, Cursor, Windsurf, and any MCP client",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|