cawdex 1.35.75 → 1.35.77
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 +5 -5
- package/bin/anycode.js +2 -2
- package/bin/cawdex.js +408 -408
- package/bin/ecc-hooks.cjs +11 -11
- package/dist/agents-md.d.ts +31 -0
- package/dist/agents-md.js +340 -0
- package/dist/agents-md.js.map +1 -0
- package/dist/agents.js +1424 -1424
- package/dist/api.d.ts +1 -0
- package/dist/api.js +19 -14
- package/dist/api.js.map +1 -1
- package/dist/autonomous-loops.js +287 -287
- package/dist/benchmark-repos.d.ts +31 -0
- package/dist/benchmark-repos.js +234 -8
- package/dist/benchmark-repos.js.map +1 -1
- package/dist/command-palette.js +5 -2
- package/dist/command-palette.js.map +1 -1
- package/dist/compaction.js +8 -8
- package/dist/config.js +57 -36
- package/dist/config.js.map +1 -1
- package/dist/content-engine.js +543 -543
- package/dist/context-brief.d.ts +4 -0
- package/dist/context-brief.js +230 -0
- package/dist/context-brief.js.map +1 -0
- package/dist/cost-tracker.d.ts +33 -14
- package/dist/cost-tracker.js +81 -19
- package/dist/cost-tracker.js.map +1 -1
- package/dist/coverage.js +39 -39
- package/dist/docs-sync.js +98 -98
- package/dist/evaluation.js +452 -452
- package/dist/fixed-footer.d.ts +11 -2
- package/dist/fixed-footer.js +115 -26
- package/dist/fixed-footer.js.map +1 -1
- package/dist/git-workflow.js +49 -49
- package/dist/imports.d.ts +126 -0
- package/dist/imports.js +611 -0
- package/dist/imports.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +367 -66
- package/dist/index.js.map +1 -1
- package/dist/inline-suggest.js +136 -12
- package/dist/inline-suggest.js.map +1 -1
- package/dist/live-queue.js +1 -1
- package/dist/live-queue.js.map +1 -1
- package/dist/model-aliases.d.ts +37 -0
- package/dist/model-aliases.js +203 -0
- package/dist/model-aliases.js.map +1 -0
- package/dist/orchestration.js +15 -15
- package/dist/permissions.d.ts +6 -0
- package/dist/permissions.js +53 -0
- package/dist/permissions.js.map +1 -1
- package/dist/pm2-manager.js +26 -26
- package/dist/query.d.ts +0 -1
- package/dist/query.js +105 -41
- package/dist/query.js.map +1 -1
- package/dist/refactor.js +87 -87
- package/dist/repo-command.js +7 -1
- package/dist/repo-command.js.map +1 -1
- package/dist/search-first.js +92 -92
- package/dist/skill-create.js +100 -100
- package/dist/stitch.js +1 -1
- package/dist/system-prompt.d.ts +2 -1
- package/dist/system-prompt.js +10 -5
- package/dist/system-prompt.js.map +1 -1
- package/dist/tools/github-repo-digest.d.ts +1 -1
- package/dist/tools/github-repo-digest.js +38 -6
- package/dist/tools/github-repo-digest.js.map +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.js.map +1 -1
- package/dist/verification.js +55 -55
- package/package.json +1 -1
- package/resources/__init__.py +1 -1
- package/resources/exgentic/cawdex_agent/README.md +114 -114
- package/resources/exgentic/cawdex_agent/__init__.py +5 -5
- package/resources/exgentic/cawdex_agent/agent.py +605 -605
- package/resources/exgentic/cawdex_agent/requirements.txt +2 -2
- package/resources/exgentic/cawdex_agent/setup.sh +21 -21
- package/resources/exgentic/cawdex_agent/utils.py +1061 -1061
- package/resources/hal/cawdex_agent/README.md +24 -24
- package/resources/hal/cawdex_agent/__init__.py +1 -1
- package/resources/hal/cawdex_agent/main.py +550 -550
- package/resources/hal/cawdex_agent/requirements.txt +2 -2
- package/resources/kbench/cawdex_agent/README.md +107 -107
- package/resources/kbench/cawdex_agent/adapter.manifest.json +19 -19
- package/resources/kbench/cawdex_agent/runner.mjs +753 -753
- package/resources/open_agent_leaderboard/cawdex-agent-card.md +119 -119
- package/resources/terminal_bench/__init__.py +1 -1
- package/resources/terminal_bench/cawdex_agent.py +174 -174
- package/resources/terminal_bench/setup.sh +121 -121
package/bin/cawdex.js
CHANGED
|
@@ -1,408 +1,408 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// In-process best-effort: override process.emitWarning to drop DEP0040.
|
|
3
|
-
// Catches the warning when it's emitted late (after this runs), but does NOT
|
|
4
|
-
// catch warnings fired during Node's ESM bootstrap (before any user code).
|
|
5
|
-
// For a fully clean stderr, invoke Cawdex via:
|
|
6
|
-
// node --no-deprecation bin/cawdex.js
|
|
7
|
-
// NODE_OPTIONS=--no-deprecation cawdex
|
|
8
|
-
(() => {
|
|
9
|
-
const orig = process.emitWarning;
|
|
10
|
-
process.emitWarning = function patched(warning, ...rest) {
|
|
11
|
-
let code;
|
|
12
|
-
if (rest[0] && typeof rest[0] === 'object') code = rest[0].code;
|
|
13
|
-
else code = rest[1];
|
|
14
|
-
if (code === 'DEP0040') return;
|
|
15
|
-
return orig.call(this, warning, ...rest);
|
|
16
|
-
};
|
|
17
|
-
})();
|
|
18
|
-
|
|
19
|
-
// ── --debug [level] flag ───────────────────────────────────
|
|
20
|
-
// Parse here at the entry point so that the env var is set BEFORE
|
|
21
|
-
// any module-level code in dist/index.js reads it. The debug
|
|
22
|
-
// instrumentation in src/debug.ts checks $CAWDEX_DEBUG at
|
|
23
|
-
// init time; setting it from argv keeps the implementation in one
|
|
24
|
-
// place (env var as single source of truth).
|
|
25
|
-
//
|
|
26
|
-
// Accepted forms:
|
|
27
|
-
// --debug → info
|
|
28
|
-
// --debug=trace → trace
|
|
29
|
-
// --debug trace → trace
|
|
30
|
-
// --debug=on → info (alias)
|
|
31
|
-
// --debug=off → off
|
|
32
|
-
//
|
|
33
|
-
// Invalid levels fall back to 'info' with a one-line stderr notice.
|
|
34
|
-
(() => {
|
|
35
|
-
const argv = process.argv;
|
|
36
|
-
const VALID = new Set(['off', 'info', 'debug', 'trace', 'on']);
|
|
37
|
-
for (let i = 2; i < argv.length; i++) {
|
|
38
|
-
const a = argv[i];
|
|
39
|
-
if (a === '--debug') {
|
|
40
|
-
const next = argv[i + 1];
|
|
41
|
-
if (next && VALID.has(next.toLowerCase())) {
|
|
42
|
-
process.env.CAWDEX_DEBUG = next.toLowerCase() === 'on' ? 'info' : next.toLowerCase();
|
|
43
|
-
argv.splice(i, 2);
|
|
44
|
-
} else {
|
|
45
|
-
process.env.CAWDEX_DEBUG = 'info';
|
|
46
|
-
argv.splice(i, 1);
|
|
47
|
-
}
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
if (a && a.startsWith('--debug=')) {
|
|
51
|
-
const lvl = a.slice('--debug='.length).toLowerCase();
|
|
52
|
-
if (VALID.has(lvl)) {
|
|
53
|
-
process.env.CAWDEX_DEBUG = lvl === 'on' ? 'info' : lvl;
|
|
54
|
-
} else {
|
|
55
|
-
process.stderr.write(`[cawdex] unknown --debug level "${lvl}"; defaulting to 'info'.\n`);
|
|
56
|
-
process.env.CAWDEX_DEBUG = 'info';
|
|
57
|
-
}
|
|
58
|
-
argv.splice(i, 1);
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
})();
|
|
63
|
-
|
|
64
|
-
// ── --prompt / --prompt-file (non-interactive single-chain mode) ──
|
|
65
|
-
//
|
|
66
|
-
// When this CLI is being driven by an external harness (Terminal-Bench,
|
|
67
|
-
// CI scripts, etc.) we need a way to:
|
|
68
|
-
// 1. accept a prompt without opening the REPL
|
|
69
|
-
// 2. run one runQuery chain to completion
|
|
70
|
-
// 3. exit with a meaningful code (0 = success, 1 = error)
|
|
71
|
-
//
|
|
72
|
-
// Two surface forms:
|
|
73
|
-
// --prompt "do the thing" — inline text
|
|
74
|
-
// --prompt-file path/to/task.txt — read from disk; useful for long
|
|
75
|
-
// or multi-line task descriptions
|
|
76
|
-
// that would otherwise need careful
|
|
77
|
-
// shell quoting.
|
|
78
|
-
//
|
|
79
|
-
// We export the resolved prompt via CAWDEX_PROMPT (or
|
|
80
|
-
// CAWDEX_PROMPT_FILE, which the loader reads with fs.readFile).
|
|
81
|
-
// src/index.ts branches on these env vars near the top of main() and
|
|
82
|
-
// skips the REPL entirely.
|
|
83
|
-
//
|
|
84
|
-
// A bare `--non-interactive` flag is also accepted as a no-prompt
|
|
85
|
-
// signal — useful when paired with a config that already has
|
|
86
|
-
// `__cawdexQueuedInput` set, but mostly an alias for the same path.
|
|
87
|
-
// ESM-safe sync FS load. import() is async (returns a promise) and the
|
|
88
|
-
// flag parser MUST run synchronously before the dynamic import of
|
|
89
|
-
// dist/index.js below. createRequire gives us a real CommonJS require
|
|
90
|
-
// inside ESM — same path Node recommends for sync fs in ESM scripts.
|
|
91
|
-
const { createRequire } = await import('node:module');
|
|
92
|
-
const __require = createRequire(import.meta.url);
|
|
93
|
-
|
|
94
|
-
function printCliHelp() {
|
|
95
|
-
const pkg = __require('../package.json');
|
|
96
|
-
process.stdout.write(`Cawdex — terminal coding agents with a mind for the whole repo
|
|
97
|
-
version ${pkg.version}
|
|
98
|
-
|
|
99
|
-
Usage:
|
|
100
|
-
cawdex [options]
|
|
101
|
-
cawdex doctor [--json] [--no-registry]
|
|
102
|
-
cawdex --prompt "fix the failing test" [options]
|
|
103
|
-
cawdex --prompt-file task.txt [options]
|
|
104
|
-
|
|
105
|
-
Options:
|
|
106
|
-
-h, --help Show this help and exit.
|
|
107
|
-
-v, --version Print the installed version and exit.
|
|
108
|
-
--provider <name> Use a provider for this run.
|
|
109
|
-
--model <model> Override the configured model.
|
|
110
|
-
--fallback-model <model> Override the fallback model.
|
|
111
|
-
--base-url <url> Override the OpenAI-compatible base URL.
|
|
112
|
-
--api-key <key> Use an API key for this run.
|
|
113
|
-
--api-key-env <name> Read the API key from an environment variable.
|
|
114
|
-
--perm <ask|auto|yolo> Override permission mode.
|
|
115
|
-
--prompt <text> Run one non-interactive task.
|
|
116
|
-
--prompt-file <path> Run one task read from a file.
|
|
117
|
-
--non-interactive Disable the interactive REPL path.
|
|
118
|
-
--max-turns <n> Limit non-interactive agent turns.
|
|
119
|
-
--max-tokens <n> Override max output tokens.
|
|
120
|
-
--context-window-tokens <n> Override context window estimate.
|
|
121
|
-
--temperature <n> Override model temperature.
|
|
122
|
-
--output-format <text|json> Set non-interactive output format.
|
|
123
|
-
--benchmark-trace-dir <path> Write benchmark trace artifacts.
|
|
124
|
-
--openai-oauth-smoke Test Codex OAuth auth, request, and stream parsing.
|
|
125
|
-
--doctor Run install/config/benchmark readiness checks.
|
|
126
|
-
--doctor-json Run readiness checks and print JSON.
|
|
127
|
-
--doctor-no-registry Skip the npm registry check in doctor mode.
|
|
128
|
-
--debug[=<off|info|debug|trace>] Enable wrapper debug logging.
|
|
129
|
-
|
|
130
|
-
Packaged paths:
|
|
131
|
-
--print-terminal-bench-adapter
|
|
132
|
-
--print-kbench-adapter
|
|
133
|
-
--print-hal-agent
|
|
134
|
-
--print-exgentic-agent
|
|
135
|
-
--print-open-agent-card
|
|
136
|
-
`);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
(() => {
|
|
140
|
-
const argv = process.argv.slice(2);
|
|
141
|
-
if (argv.includes('--help') || argv.includes('-h') || argv[0] === 'help') {
|
|
142
|
-
printCliHelp();
|
|
143
|
-
process.exit(0);
|
|
144
|
-
}
|
|
145
|
-
if (argv.includes('--version') || argv.includes('-v')) {
|
|
146
|
-
const pkg = __require('../package.json');
|
|
147
|
-
process.stdout.write(`${pkg.version}\n`);
|
|
148
|
-
process.exit(0);
|
|
149
|
-
}
|
|
150
|
-
})();
|
|
151
|
-
|
|
152
|
-
(() => {
|
|
153
|
-
const argv = process.argv;
|
|
154
|
-
const wantsDoctor = argv.slice(2).some((a) => a === 'doctor' || a === '--doctor' || a === '--doctor-json');
|
|
155
|
-
if (!wantsDoctor) return;
|
|
156
|
-
|
|
157
|
-
process.env.CAWDEX_DOCTOR = '1';
|
|
158
|
-
for (let i = 2; i < argv.length; i++) {
|
|
159
|
-
const a = argv[i];
|
|
160
|
-
if (a === 'doctor' || a === '--doctor') {
|
|
161
|
-
argv.splice(i, 1);
|
|
162
|
-
i--;
|
|
163
|
-
continue;
|
|
164
|
-
}
|
|
165
|
-
if (a === '--doctor-json' || a === '--json') {
|
|
166
|
-
process.env.CAWDEX_DOCTOR_JSON = '1';
|
|
167
|
-
argv.splice(i, 1);
|
|
168
|
-
i--;
|
|
169
|
-
continue;
|
|
170
|
-
}
|
|
171
|
-
if (a === '--doctor-no-registry' || a === '--no-registry') {
|
|
172
|
-
process.env.CAWDEX_DOCTOR_REGISTRY = '0';
|
|
173
|
-
argv.splice(i, 1);
|
|
174
|
-
i--;
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
})();
|
|
179
|
-
|
|
180
|
-
function readFlagValue(argv, index, flag) {
|
|
181
|
-
const current = argv[index];
|
|
182
|
-
const prefix = `${flag}=`;
|
|
183
|
-
if (current && current.startsWith(prefix)) {
|
|
184
|
-
return { value: current.slice(prefix.length), removeCount: 1 };
|
|
185
|
-
}
|
|
186
|
-
const next = argv[index + 1];
|
|
187
|
-
if (typeof next !== 'string' || next.startsWith('--')) {
|
|
188
|
-
process.stderr.write(`[cawdex] ${flag} requires an argument.\n`);
|
|
189
|
-
process.exit(2);
|
|
190
|
-
}
|
|
191
|
-
return { value: next, removeCount: 2 };
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
(() => {
|
|
195
|
-
const fs = __require('node:fs');
|
|
196
|
-
const argv = process.argv;
|
|
197
|
-
for (let i = 2; i < argv.length; i++) {
|
|
198
|
-
const a = argv[i];
|
|
199
|
-
if (a === '--prompt') {
|
|
200
|
-
const next = argv[i + 1];
|
|
201
|
-
if (typeof next !== 'string') {
|
|
202
|
-
process.stderr.write('[cawdex] --prompt requires an argument.\n');
|
|
203
|
-
process.exit(2);
|
|
204
|
-
}
|
|
205
|
-
process.env.CAWDEX_PROMPT = next;
|
|
206
|
-
process.env.CAWDEX_NON_INTERACTIVE = '1';
|
|
207
|
-
argv.splice(i, 2);
|
|
208
|
-
i--;
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
if (a && a.startsWith('--prompt=')) {
|
|
212
|
-
process.env.CAWDEX_PROMPT = a.slice('--prompt='.length);
|
|
213
|
-
process.env.CAWDEX_NON_INTERACTIVE = '1';
|
|
214
|
-
argv.splice(i, 1);
|
|
215
|
-
i--;
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
if (a === '--prompt-file') {
|
|
219
|
-
const next = argv[i + 1];
|
|
220
|
-
if (typeof next !== 'string') {
|
|
221
|
-
process.stderr.write('[cawdex] --prompt-file requires a path.\n');
|
|
222
|
-
process.exit(2);
|
|
223
|
-
}
|
|
224
|
-
try {
|
|
225
|
-
process.env.CAWDEX_PROMPT = fs.readFileSync(next, 'utf8');
|
|
226
|
-
} catch (err) {
|
|
227
|
-
process.stderr.write(`[cawdex] could not read --prompt-file: ${err && err.message ? err.message : err}\n`);
|
|
228
|
-
process.exit(2);
|
|
229
|
-
}
|
|
230
|
-
process.env.CAWDEX_NON_INTERACTIVE = '1';
|
|
231
|
-
argv.splice(i, 2);
|
|
232
|
-
i--;
|
|
233
|
-
continue;
|
|
234
|
-
}
|
|
235
|
-
if (a === '--non-interactive') {
|
|
236
|
-
process.env.CAWDEX_NON_INTERACTIVE = '1';
|
|
237
|
-
argv.splice(i, 1);
|
|
238
|
-
i--;
|
|
239
|
-
continue;
|
|
240
|
-
}
|
|
241
|
-
if (a === '--openai-oauth-smoke') {
|
|
242
|
-
process.env.CAWDEX_OPENAI_OAUTH_SMOKE = '1';
|
|
243
|
-
process.env.CAWDEX_NON_INTERACTIVE = '1';
|
|
244
|
-
process.env.CAWDEX_PROVIDER = process.env.CAWDEX_PROVIDER || 'openai-codex';
|
|
245
|
-
process.env.CAWDEX_ENV_CONFIG = '1';
|
|
246
|
-
argv.splice(i, 1);
|
|
247
|
-
i--;
|
|
248
|
-
continue;
|
|
249
|
-
}
|
|
250
|
-
// --perm <mode>: override permission mode without touching saved
|
|
251
|
-
// config. Critical for harness runs that want yolo without
|
|
252
|
-
// mutating the user's interactive config file.
|
|
253
|
-
if (a === '--perm') {
|
|
254
|
-
const next = argv[i + 1];
|
|
255
|
-
if (next && /^(ask|auto|yolo)$/.test(next)) {
|
|
256
|
-
process.env.CAWDEX_PERM_OVERRIDE = next;
|
|
257
|
-
argv.splice(i, 2);
|
|
258
|
-
i--;
|
|
259
|
-
continue;
|
|
260
|
-
}
|
|
261
|
-
process.stderr.write('[cawdex] --perm requires ask|auto|yolo.\n');
|
|
262
|
-
process.exit(2);
|
|
263
|
-
}
|
|
264
|
-
if (a === '--model' || (a && a.startsWith('--model='))) {
|
|
265
|
-
const { value, removeCount } = readFlagValue(argv, i, '--model');
|
|
266
|
-
process.env.CAWDEX_MODEL = value;
|
|
267
|
-
process.env.CAWDEX_MODEL_OVERRIDE = value;
|
|
268
|
-
argv.splice(i, removeCount);
|
|
269
|
-
i--;
|
|
270
|
-
continue;
|
|
271
|
-
}
|
|
272
|
-
if (a === '--fallback-model' || (a && a.startsWith('--fallback-model='))) {
|
|
273
|
-
const { value, removeCount } = readFlagValue(argv, i, '--fallback-model');
|
|
274
|
-
process.env.CAWDEX_FALLBACK_MODEL = value;
|
|
275
|
-
process.env.CAWDEX_FALLBACK_MODEL_OVERRIDE = value;
|
|
276
|
-
argv.splice(i, removeCount);
|
|
277
|
-
i--;
|
|
278
|
-
continue;
|
|
279
|
-
}
|
|
280
|
-
if (a === '--provider' || (a && a.startsWith('--provider='))) {
|
|
281
|
-
const { value, removeCount } = readFlagValue(argv, i, '--provider');
|
|
282
|
-
process.env.CAWDEX_PROVIDER = value;
|
|
283
|
-
process.env.CAWDEX_ENV_CONFIG = '1';
|
|
284
|
-
argv.splice(i, removeCount);
|
|
285
|
-
i--;
|
|
286
|
-
continue;
|
|
287
|
-
}
|
|
288
|
-
if (a === '--base-url' || (a && a.startsWith('--base-url='))) {
|
|
289
|
-
const { value, removeCount } = readFlagValue(argv, i, '--base-url');
|
|
290
|
-
process.env.CAWDEX_BASE_URL = value;
|
|
291
|
-
process.env.CAWDEX_BASE_URL_OVERRIDE = value;
|
|
292
|
-
argv.splice(i, removeCount);
|
|
293
|
-
i--;
|
|
294
|
-
continue;
|
|
295
|
-
}
|
|
296
|
-
if (a === '--api-key' || (a && a.startsWith('--api-key='))) {
|
|
297
|
-
const { value, removeCount } = readFlagValue(argv, i, '--api-key');
|
|
298
|
-
process.env.CAWDEX_API_KEY = value;
|
|
299
|
-
process.env.CAWDEX_API_KEY_OVERRIDE = value;
|
|
300
|
-
argv.splice(i, removeCount);
|
|
301
|
-
i--;
|
|
302
|
-
continue;
|
|
303
|
-
}
|
|
304
|
-
if (a === '--api-key-env' || (a && a.startsWith('--api-key-env='))) {
|
|
305
|
-
const { value, removeCount } = readFlagValue(argv, i, '--api-key-env');
|
|
306
|
-
process.env.CAWDEX_API_KEY_ENV = value;
|
|
307
|
-
if (process.env[value]) {
|
|
308
|
-
process.env.CAWDEX_API_KEY = process.env[value];
|
|
309
|
-
process.env.CAWDEX_API_KEY_OVERRIDE = process.env[value];
|
|
310
|
-
}
|
|
311
|
-
argv.splice(i, removeCount);
|
|
312
|
-
i--;
|
|
313
|
-
continue;
|
|
314
|
-
}
|
|
315
|
-
if (a === '--max-turns' || (a && a.startsWith('--max-turns='))) {
|
|
316
|
-
const { value, removeCount } = readFlagValue(argv, i, '--max-turns');
|
|
317
|
-
process.env.CAWDEX_MAX_TURNS = value;
|
|
318
|
-
process.env.CAWDEX_MAX_TURNS_OVERRIDE = value;
|
|
319
|
-
argv.splice(i, removeCount);
|
|
320
|
-
i--;
|
|
321
|
-
continue;
|
|
322
|
-
}
|
|
323
|
-
if (a === '--max-tokens' || (a && a.startsWith('--max-tokens='))) {
|
|
324
|
-
const { value, removeCount } = readFlagValue(argv, i, '--max-tokens');
|
|
325
|
-
process.env.CAWDEX_MAX_TOKENS = value;
|
|
326
|
-
process.env.CAWDEX_MAX_TOKENS_OVERRIDE = value;
|
|
327
|
-
argv.splice(i, removeCount);
|
|
328
|
-
i--;
|
|
329
|
-
continue;
|
|
330
|
-
}
|
|
331
|
-
if (a === '--context-window-tokens' || (a && a.startsWith('--context-window-tokens='))) {
|
|
332
|
-
const { value, removeCount } = readFlagValue(argv, i, '--context-window-tokens');
|
|
333
|
-
process.env.CAWDEX_CONTEXT_WINDOW_TOKENS = value;
|
|
334
|
-
process.env.CAWDEX_CONTEXT_WINDOW_TOKENS_OVERRIDE = value;
|
|
335
|
-
argv.splice(i, removeCount);
|
|
336
|
-
i--;
|
|
337
|
-
continue;
|
|
338
|
-
}
|
|
339
|
-
if (a === '--temperature' || (a && a.startsWith('--temperature='))) {
|
|
340
|
-
const { value, removeCount } = readFlagValue(argv, i, '--temperature');
|
|
341
|
-
process.env.CAWDEX_TEMPERATURE = value;
|
|
342
|
-
process.env.CAWDEX_TEMPERATURE_OVERRIDE = value;
|
|
343
|
-
argv.splice(i, removeCount);
|
|
344
|
-
i--;
|
|
345
|
-
continue;
|
|
346
|
-
}
|
|
347
|
-
if (a === '--output-format' || (a && a.startsWith('--output-format='))) {
|
|
348
|
-
const { value, removeCount } = readFlagValue(argv, i, '--output-format');
|
|
349
|
-
process.env.CAWDEX_OUTPUT_FORMAT = value;
|
|
350
|
-
argv.splice(i, removeCount);
|
|
351
|
-
i--;
|
|
352
|
-
continue;
|
|
353
|
-
}
|
|
354
|
-
if (a === '--benchmark-trace-dir' || (a && a.startsWith('--benchmark-trace-dir='))) {
|
|
355
|
-
const { value, removeCount } = readFlagValue(argv, i, '--benchmark-trace-dir');
|
|
356
|
-
process.env.CAWDEX_BENCHMARK_TRACE_DIR = value;
|
|
357
|
-
argv.splice(i, removeCount);
|
|
358
|
-
i--;
|
|
359
|
-
continue;
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
})();
|
|
363
|
-
|
|
364
|
-
(() => {
|
|
365
|
-
const argv = process.argv;
|
|
366
|
-
const idx = argv.indexOf('--print-terminal-bench-adapter');
|
|
367
|
-
if (idx !== -1) {
|
|
368
|
-
const path = __require('node:path');
|
|
369
|
-
const { fileURLToPath } = __require('node:url');
|
|
370
|
-
const binDir = path.dirname(fileURLToPath(import.meta.url));
|
|
371
|
-
process.stdout.write(path.resolve(binDir, '..', 'resources', 'terminal_bench', 'cawdex_agent.py') + '\n');
|
|
372
|
-
process.exit(0);
|
|
373
|
-
}
|
|
374
|
-
const kbenchIdx = argv.indexOf('--print-kbench-adapter');
|
|
375
|
-
if (kbenchIdx !== -1) {
|
|
376
|
-
const path = __require('node:path');
|
|
377
|
-
const { fileURLToPath } = __require('node:url');
|
|
378
|
-
const binDir = path.dirname(fileURLToPath(import.meta.url));
|
|
379
|
-
process.stdout.write(path.resolve(binDir, '..', 'resources', 'kbench', 'cawdex_agent') + '\n');
|
|
380
|
-
process.exit(0);
|
|
381
|
-
}
|
|
382
|
-
const halIdx = argv.indexOf('--print-hal-agent');
|
|
383
|
-
if (halIdx !== -1) {
|
|
384
|
-
const path = __require('node:path');
|
|
385
|
-
const { fileURLToPath } = __require('node:url');
|
|
386
|
-
const binDir = path.dirname(fileURLToPath(import.meta.url));
|
|
387
|
-
process.stdout.write(path.resolve(binDir, '..', 'resources', 'hal', 'cawdex_agent') + '\n');
|
|
388
|
-
process.exit(0);
|
|
389
|
-
}
|
|
390
|
-
const exgenticIdx = argv.indexOf('--print-exgentic-agent');
|
|
391
|
-
if (exgenticIdx !== -1) {
|
|
392
|
-
const path = __require('node:path');
|
|
393
|
-
const { fileURLToPath } = __require('node:url');
|
|
394
|
-
const binDir = path.dirname(fileURLToPath(import.meta.url));
|
|
395
|
-
process.stdout.write(path.resolve(binDir, '..', 'resources', 'exgentic', 'cawdex_agent') + '\n');
|
|
396
|
-
process.exit(0);
|
|
397
|
-
}
|
|
398
|
-
const agentCardIdx = argv.indexOf('--print-open-agent-card');
|
|
399
|
-
if (agentCardIdx !== -1) {
|
|
400
|
-
const path = __require('node:path');
|
|
401
|
-
const { fileURLToPath } = __require('node:url');
|
|
402
|
-
const binDir = path.dirname(fileURLToPath(import.meta.url));
|
|
403
|
-
process.stdout.write(path.resolve(binDir, '..', 'resources', 'open_agent_leaderboard', 'cawdex-agent-card.md') + '\n');
|
|
404
|
-
process.exit(0);
|
|
405
|
-
}
|
|
406
|
-
})();
|
|
407
|
-
|
|
408
|
-
import('../dist/index.js');
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// In-process best-effort: override process.emitWarning to drop DEP0040.
|
|
3
|
+
// Catches the warning when it's emitted late (after this runs), but does NOT
|
|
4
|
+
// catch warnings fired during Node's ESM bootstrap (before any user code).
|
|
5
|
+
// For a fully clean stderr, invoke Cawdex via:
|
|
6
|
+
// node --no-deprecation bin/cawdex.js
|
|
7
|
+
// NODE_OPTIONS=--no-deprecation cawdex
|
|
8
|
+
(() => {
|
|
9
|
+
const orig = process.emitWarning;
|
|
10
|
+
process.emitWarning = function patched(warning, ...rest) {
|
|
11
|
+
let code;
|
|
12
|
+
if (rest[0] && typeof rest[0] === 'object') code = rest[0].code;
|
|
13
|
+
else code = rest[1];
|
|
14
|
+
if (code === 'DEP0040') return;
|
|
15
|
+
return orig.call(this, warning, ...rest);
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
|
|
19
|
+
// ── --debug [level] flag ───────────────────────────────────
|
|
20
|
+
// Parse here at the entry point so that the env var is set BEFORE
|
|
21
|
+
// any module-level code in dist/index.js reads it. The debug
|
|
22
|
+
// instrumentation in src/debug.ts checks $CAWDEX_DEBUG at
|
|
23
|
+
// init time; setting it from argv keeps the implementation in one
|
|
24
|
+
// place (env var as single source of truth).
|
|
25
|
+
//
|
|
26
|
+
// Accepted forms:
|
|
27
|
+
// --debug → info
|
|
28
|
+
// --debug=trace → trace
|
|
29
|
+
// --debug trace → trace
|
|
30
|
+
// --debug=on → info (alias)
|
|
31
|
+
// --debug=off → off
|
|
32
|
+
//
|
|
33
|
+
// Invalid levels fall back to 'info' with a one-line stderr notice.
|
|
34
|
+
(() => {
|
|
35
|
+
const argv = process.argv;
|
|
36
|
+
const VALID = new Set(['off', 'info', 'debug', 'trace', 'on']);
|
|
37
|
+
for (let i = 2; i < argv.length; i++) {
|
|
38
|
+
const a = argv[i];
|
|
39
|
+
if (a === '--debug') {
|
|
40
|
+
const next = argv[i + 1];
|
|
41
|
+
if (next && VALID.has(next.toLowerCase())) {
|
|
42
|
+
process.env.CAWDEX_DEBUG = next.toLowerCase() === 'on' ? 'info' : next.toLowerCase();
|
|
43
|
+
argv.splice(i, 2);
|
|
44
|
+
} else {
|
|
45
|
+
process.env.CAWDEX_DEBUG = 'info';
|
|
46
|
+
argv.splice(i, 1);
|
|
47
|
+
}
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
if (a && a.startsWith('--debug=')) {
|
|
51
|
+
const lvl = a.slice('--debug='.length).toLowerCase();
|
|
52
|
+
if (VALID.has(lvl)) {
|
|
53
|
+
process.env.CAWDEX_DEBUG = lvl === 'on' ? 'info' : lvl;
|
|
54
|
+
} else {
|
|
55
|
+
process.stderr.write(`[cawdex] unknown --debug level "${lvl}"; defaulting to 'info'.\n`);
|
|
56
|
+
process.env.CAWDEX_DEBUG = 'info';
|
|
57
|
+
}
|
|
58
|
+
argv.splice(i, 1);
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
})();
|
|
63
|
+
|
|
64
|
+
// ── --prompt / --prompt-file (non-interactive single-chain mode) ──
|
|
65
|
+
//
|
|
66
|
+
// When this CLI is being driven by an external harness (Terminal-Bench,
|
|
67
|
+
// CI scripts, etc.) we need a way to:
|
|
68
|
+
// 1. accept a prompt without opening the REPL
|
|
69
|
+
// 2. run one runQuery chain to completion
|
|
70
|
+
// 3. exit with a meaningful code (0 = success, 1 = error)
|
|
71
|
+
//
|
|
72
|
+
// Two surface forms:
|
|
73
|
+
// --prompt "do the thing" — inline text
|
|
74
|
+
// --prompt-file path/to/task.txt — read from disk; useful for long
|
|
75
|
+
// or multi-line task descriptions
|
|
76
|
+
// that would otherwise need careful
|
|
77
|
+
// shell quoting.
|
|
78
|
+
//
|
|
79
|
+
// We export the resolved prompt via CAWDEX_PROMPT (or
|
|
80
|
+
// CAWDEX_PROMPT_FILE, which the loader reads with fs.readFile).
|
|
81
|
+
// src/index.ts branches on these env vars near the top of main() and
|
|
82
|
+
// skips the REPL entirely.
|
|
83
|
+
//
|
|
84
|
+
// A bare `--non-interactive` flag is also accepted as a no-prompt
|
|
85
|
+
// signal — useful when paired with a config that already has
|
|
86
|
+
// `__cawdexQueuedInput` set, but mostly an alias for the same path.
|
|
87
|
+
// ESM-safe sync FS load. import() is async (returns a promise) and the
|
|
88
|
+
// flag parser MUST run synchronously before the dynamic import of
|
|
89
|
+
// dist/index.js below. createRequire gives us a real CommonJS require
|
|
90
|
+
// inside ESM — same path Node recommends for sync fs in ESM scripts.
|
|
91
|
+
const { createRequire } = await import('node:module');
|
|
92
|
+
const __require = createRequire(import.meta.url);
|
|
93
|
+
|
|
94
|
+
function printCliHelp() {
|
|
95
|
+
const pkg = __require('../package.json');
|
|
96
|
+
process.stdout.write(`Cawdex — terminal coding agents with a mind for the whole repo
|
|
97
|
+
version ${pkg.version}
|
|
98
|
+
|
|
99
|
+
Usage:
|
|
100
|
+
cawdex [options]
|
|
101
|
+
cawdex doctor [--json] [--no-registry]
|
|
102
|
+
cawdex --prompt "fix the failing test" [options]
|
|
103
|
+
cawdex --prompt-file task.txt [options]
|
|
104
|
+
|
|
105
|
+
Options:
|
|
106
|
+
-h, --help Show this help and exit.
|
|
107
|
+
-v, --version Print the installed version and exit.
|
|
108
|
+
--provider <name> Use a provider for this run.
|
|
109
|
+
--model <model> Override the configured model.
|
|
110
|
+
--fallback-model <model> Override the fallback model.
|
|
111
|
+
--base-url <url> Override the OpenAI-compatible base URL.
|
|
112
|
+
--api-key <key> Use an API key for this run.
|
|
113
|
+
--api-key-env <name> Read the API key from an environment variable.
|
|
114
|
+
--perm <ask|auto|yolo> Override permission mode.
|
|
115
|
+
--prompt <text> Run one non-interactive task.
|
|
116
|
+
--prompt-file <path> Run one task read from a file.
|
|
117
|
+
--non-interactive Disable the interactive REPL path.
|
|
118
|
+
--max-turns <n> Limit non-interactive agent turns.
|
|
119
|
+
--max-tokens <n> Override max output tokens.
|
|
120
|
+
--context-window-tokens <n> Override context window estimate.
|
|
121
|
+
--temperature <n> Override model temperature.
|
|
122
|
+
--output-format <text|json> Set non-interactive output format.
|
|
123
|
+
--benchmark-trace-dir <path> Write benchmark trace artifacts.
|
|
124
|
+
--openai-oauth-smoke Test Codex OAuth auth, request, and stream parsing.
|
|
125
|
+
--doctor Run install/config/benchmark readiness checks.
|
|
126
|
+
--doctor-json Run readiness checks and print JSON.
|
|
127
|
+
--doctor-no-registry Skip the npm registry check in doctor mode.
|
|
128
|
+
--debug[=<off|info|debug|trace>] Enable wrapper debug logging.
|
|
129
|
+
|
|
130
|
+
Packaged paths:
|
|
131
|
+
--print-terminal-bench-adapter
|
|
132
|
+
--print-kbench-adapter
|
|
133
|
+
--print-hal-agent
|
|
134
|
+
--print-exgentic-agent
|
|
135
|
+
--print-open-agent-card
|
|
136
|
+
`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
(() => {
|
|
140
|
+
const argv = process.argv.slice(2);
|
|
141
|
+
if (argv.includes('--help') || argv.includes('-h') || argv[0] === 'help') {
|
|
142
|
+
printCliHelp();
|
|
143
|
+
process.exit(0);
|
|
144
|
+
}
|
|
145
|
+
if (argv.includes('--version') || argv.includes('-v')) {
|
|
146
|
+
const pkg = __require('../package.json');
|
|
147
|
+
process.stdout.write(`${pkg.version}\n`);
|
|
148
|
+
process.exit(0);
|
|
149
|
+
}
|
|
150
|
+
})();
|
|
151
|
+
|
|
152
|
+
(() => {
|
|
153
|
+
const argv = process.argv;
|
|
154
|
+
const wantsDoctor = argv.slice(2).some((a) => a === 'doctor' || a === '--doctor' || a === '--doctor-json');
|
|
155
|
+
if (!wantsDoctor) return;
|
|
156
|
+
|
|
157
|
+
process.env.CAWDEX_DOCTOR = '1';
|
|
158
|
+
for (let i = 2; i < argv.length; i++) {
|
|
159
|
+
const a = argv[i];
|
|
160
|
+
if (a === 'doctor' || a === '--doctor') {
|
|
161
|
+
argv.splice(i, 1);
|
|
162
|
+
i--;
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
if (a === '--doctor-json' || a === '--json') {
|
|
166
|
+
process.env.CAWDEX_DOCTOR_JSON = '1';
|
|
167
|
+
argv.splice(i, 1);
|
|
168
|
+
i--;
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (a === '--doctor-no-registry' || a === '--no-registry') {
|
|
172
|
+
process.env.CAWDEX_DOCTOR_REGISTRY = '0';
|
|
173
|
+
argv.splice(i, 1);
|
|
174
|
+
i--;
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
})();
|
|
179
|
+
|
|
180
|
+
function readFlagValue(argv, index, flag) {
|
|
181
|
+
const current = argv[index];
|
|
182
|
+
const prefix = `${flag}=`;
|
|
183
|
+
if (current && current.startsWith(prefix)) {
|
|
184
|
+
return { value: current.slice(prefix.length), removeCount: 1 };
|
|
185
|
+
}
|
|
186
|
+
const next = argv[index + 1];
|
|
187
|
+
if (typeof next !== 'string' || next.startsWith('--')) {
|
|
188
|
+
process.stderr.write(`[cawdex] ${flag} requires an argument.\n`);
|
|
189
|
+
process.exit(2);
|
|
190
|
+
}
|
|
191
|
+
return { value: next, removeCount: 2 };
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
(() => {
|
|
195
|
+
const fs = __require('node:fs');
|
|
196
|
+
const argv = process.argv;
|
|
197
|
+
for (let i = 2; i < argv.length; i++) {
|
|
198
|
+
const a = argv[i];
|
|
199
|
+
if (a === '--prompt') {
|
|
200
|
+
const next = argv[i + 1];
|
|
201
|
+
if (typeof next !== 'string') {
|
|
202
|
+
process.stderr.write('[cawdex] --prompt requires an argument.\n');
|
|
203
|
+
process.exit(2);
|
|
204
|
+
}
|
|
205
|
+
process.env.CAWDEX_PROMPT = next;
|
|
206
|
+
process.env.CAWDEX_NON_INTERACTIVE = '1';
|
|
207
|
+
argv.splice(i, 2);
|
|
208
|
+
i--;
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (a && a.startsWith('--prompt=')) {
|
|
212
|
+
process.env.CAWDEX_PROMPT = a.slice('--prompt='.length);
|
|
213
|
+
process.env.CAWDEX_NON_INTERACTIVE = '1';
|
|
214
|
+
argv.splice(i, 1);
|
|
215
|
+
i--;
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
if (a === '--prompt-file') {
|
|
219
|
+
const next = argv[i + 1];
|
|
220
|
+
if (typeof next !== 'string') {
|
|
221
|
+
process.stderr.write('[cawdex] --prompt-file requires a path.\n');
|
|
222
|
+
process.exit(2);
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
process.env.CAWDEX_PROMPT = fs.readFileSync(next, 'utf8');
|
|
226
|
+
} catch (err) {
|
|
227
|
+
process.stderr.write(`[cawdex] could not read --prompt-file: ${err && err.message ? err.message : err}\n`);
|
|
228
|
+
process.exit(2);
|
|
229
|
+
}
|
|
230
|
+
process.env.CAWDEX_NON_INTERACTIVE = '1';
|
|
231
|
+
argv.splice(i, 2);
|
|
232
|
+
i--;
|
|
233
|
+
continue;
|
|
234
|
+
}
|
|
235
|
+
if (a === '--non-interactive') {
|
|
236
|
+
process.env.CAWDEX_NON_INTERACTIVE = '1';
|
|
237
|
+
argv.splice(i, 1);
|
|
238
|
+
i--;
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
if (a === '--openai-oauth-smoke') {
|
|
242
|
+
process.env.CAWDEX_OPENAI_OAUTH_SMOKE = '1';
|
|
243
|
+
process.env.CAWDEX_NON_INTERACTIVE = '1';
|
|
244
|
+
process.env.CAWDEX_PROVIDER = process.env.CAWDEX_PROVIDER || 'openai-codex';
|
|
245
|
+
process.env.CAWDEX_ENV_CONFIG = '1';
|
|
246
|
+
argv.splice(i, 1);
|
|
247
|
+
i--;
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
// --perm <mode>: override permission mode without touching saved
|
|
251
|
+
// config. Critical for harness runs that want yolo without
|
|
252
|
+
// mutating the user's interactive config file.
|
|
253
|
+
if (a === '--perm') {
|
|
254
|
+
const next = argv[i + 1];
|
|
255
|
+
if (next && /^(ask|auto|yolo)$/.test(next)) {
|
|
256
|
+
process.env.CAWDEX_PERM_OVERRIDE = next;
|
|
257
|
+
argv.splice(i, 2);
|
|
258
|
+
i--;
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
process.stderr.write('[cawdex] --perm requires ask|auto|yolo.\n');
|
|
262
|
+
process.exit(2);
|
|
263
|
+
}
|
|
264
|
+
if (a === '--model' || (a && a.startsWith('--model='))) {
|
|
265
|
+
const { value, removeCount } = readFlagValue(argv, i, '--model');
|
|
266
|
+
process.env.CAWDEX_MODEL = value;
|
|
267
|
+
process.env.CAWDEX_MODEL_OVERRIDE = value;
|
|
268
|
+
argv.splice(i, removeCount);
|
|
269
|
+
i--;
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
if (a === '--fallback-model' || (a && a.startsWith('--fallback-model='))) {
|
|
273
|
+
const { value, removeCount } = readFlagValue(argv, i, '--fallback-model');
|
|
274
|
+
process.env.CAWDEX_FALLBACK_MODEL = value;
|
|
275
|
+
process.env.CAWDEX_FALLBACK_MODEL_OVERRIDE = value;
|
|
276
|
+
argv.splice(i, removeCount);
|
|
277
|
+
i--;
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
if (a === '--provider' || (a && a.startsWith('--provider='))) {
|
|
281
|
+
const { value, removeCount } = readFlagValue(argv, i, '--provider');
|
|
282
|
+
process.env.CAWDEX_PROVIDER = value;
|
|
283
|
+
process.env.CAWDEX_ENV_CONFIG = '1';
|
|
284
|
+
argv.splice(i, removeCount);
|
|
285
|
+
i--;
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
if (a === '--base-url' || (a && a.startsWith('--base-url='))) {
|
|
289
|
+
const { value, removeCount } = readFlagValue(argv, i, '--base-url');
|
|
290
|
+
process.env.CAWDEX_BASE_URL = value;
|
|
291
|
+
process.env.CAWDEX_BASE_URL_OVERRIDE = value;
|
|
292
|
+
argv.splice(i, removeCount);
|
|
293
|
+
i--;
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
if (a === '--api-key' || (a && a.startsWith('--api-key='))) {
|
|
297
|
+
const { value, removeCount } = readFlagValue(argv, i, '--api-key');
|
|
298
|
+
process.env.CAWDEX_API_KEY = value;
|
|
299
|
+
process.env.CAWDEX_API_KEY_OVERRIDE = value;
|
|
300
|
+
argv.splice(i, removeCount);
|
|
301
|
+
i--;
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
if (a === '--api-key-env' || (a && a.startsWith('--api-key-env='))) {
|
|
305
|
+
const { value, removeCount } = readFlagValue(argv, i, '--api-key-env');
|
|
306
|
+
process.env.CAWDEX_API_KEY_ENV = value;
|
|
307
|
+
if (process.env[value]) {
|
|
308
|
+
process.env.CAWDEX_API_KEY = process.env[value];
|
|
309
|
+
process.env.CAWDEX_API_KEY_OVERRIDE = process.env[value];
|
|
310
|
+
}
|
|
311
|
+
argv.splice(i, removeCount);
|
|
312
|
+
i--;
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
if (a === '--max-turns' || (a && a.startsWith('--max-turns='))) {
|
|
316
|
+
const { value, removeCount } = readFlagValue(argv, i, '--max-turns');
|
|
317
|
+
process.env.CAWDEX_MAX_TURNS = value;
|
|
318
|
+
process.env.CAWDEX_MAX_TURNS_OVERRIDE = value;
|
|
319
|
+
argv.splice(i, removeCount);
|
|
320
|
+
i--;
|
|
321
|
+
continue;
|
|
322
|
+
}
|
|
323
|
+
if (a === '--max-tokens' || (a && a.startsWith('--max-tokens='))) {
|
|
324
|
+
const { value, removeCount } = readFlagValue(argv, i, '--max-tokens');
|
|
325
|
+
process.env.CAWDEX_MAX_TOKENS = value;
|
|
326
|
+
process.env.CAWDEX_MAX_TOKENS_OVERRIDE = value;
|
|
327
|
+
argv.splice(i, removeCount);
|
|
328
|
+
i--;
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
if (a === '--context-window-tokens' || (a && a.startsWith('--context-window-tokens='))) {
|
|
332
|
+
const { value, removeCount } = readFlagValue(argv, i, '--context-window-tokens');
|
|
333
|
+
process.env.CAWDEX_CONTEXT_WINDOW_TOKENS = value;
|
|
334
|
+
process.env.CAWDEX_CONTEXT_WINDOW_TOKENS_OVERRIDE = value;
|
|
335
|
+
argv.splice(i, removeCount);
|
|
336
|
+
i--;
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
if (a === '--temperature' || (a && a.startsWith('--temperature='))) {
|
|
340
|
+
const { value, removeCount } = readFlagValue(argv, i, '--temperature');
|
|
341
|
+
process.env.CAWDEX_TEMPERATURE = value;
|
|
342
|
+
process.env.CAWDEX_TEMPERATURE_OVERRIDE = value;
|
|
343
|
+
argv.splice(i, removeCount);
|
|
344
|
+
i--;
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
if (a === '--output-format' || (a && a.startsWith('--output-format='))) {
|
|
348
|
+
const { value, removeCount } = readFlagValue(argv, i, '--output-format');
|
|
349
|
+
process.env.CAWDEX_OUTPUT_FORMAT = value;
|
|
350
|
+
argv.splice(i, removeCount);
|
|
351
|
+
i--;
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
if (a === '--benchmark-trace-dir' || (a && a.startsWith('--benchmark-trace-dir='))) {
|
|
355
|
+
const { value, removeCount } = readFlagValue(argv, i, '--benchmark-trace-dir');
|
|
356
|
+
process.env.CAWDEX_BENCHMARK_TRACE_DIR = value;
|
|
357
|
+
argv.splice(i, removeCount);
|
|
358
|
+
i--;
|
|
359
|
+
continue;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
})();
|
|
363
|
+
|
|
364
|
+
(() => {
|
|
365
|
+
const argv = process.argv;
|
|
366
|
+
const idx = argv.indexOf('--print-terminal-bench-adapter');
|
|
367
|
+
if (idx !== -1) {
|
|
368
|
+
const path = __require('node:path');
|
|
369
|
+
const { fileURLToPath } = __require('node:url');
|
|
370
|
+
const binDir = path.dirname(fileURLToPath(import.meta.url));
|
|
371
|
+
process.stdout.write(path.resolve(binDir, '..', 'resources', 'terminal_bench', 'cawdex_agent.py') + '\n');
|
|
372
|
+
process.exit(0);
|
|
373
|
+
}
|
|
374
|
+
const kbenchIdx = argv.indexOf('--print-kbench-adapter');
|
|
375
|
+
if (kbenchIdx !== -1) {
|
|
376
|
+
const path = __require('node:path');
|
|
377
|
+
const { fileURLToPath } = __require('node:url');
|
|
378
|
+
const binDir = path.dirname(fileURLToPath(import.meta.url));
|
|
379
|
+
process.stdout.write(path.resolve(binDir, '..', 'resources', 'kbench', 'cawdex_agent') + '\n');
|
|
380
|
+
process.exit(0);
|
|
381
|
+
}
|
|
382
|
+
const halIdx = argv.indexOf('--print-hal-agent');
|
|
383
|
+
if (halIdx !== -1) {
|
|
384
|
+
const path = __require('node:path');
|
|
385
|
+
const { fileURLToPath } = __require('node:url');
|
|
386
|
+
const binDir = path.dirname(fileURLToPath(import.meta.url));
|
|
387
|
+
process.stdout.write(path.resolve(binDir, '..', 'resources', 'hal', 'cawdex_agent') + '\n');
|
|
388
|
+
process.exit(0);
|
|
389
|
+
}
|
|
390
|
+
const exgenticIdx = argv.indexOf('--print-exgentic-agent');
|
|
391
|
+
if (exgenticIdx !== -1) {
|
|
392
|
+
const path = __require('node:path');
|
|
393
|
+
const { fileURLToPath } = __require('node:url');
|
|
394
|
+
const binDir = path.dirname(fileURLToPath(import.meta.url));
|
|
395
|
+
process.stdout.write(path.resolve(binDir, '..', 'resources', 'exgentic', 'cawdex_agent') + '\n');
|
|
396
|
+
process.exit(0);
|
|
397
|
+
}
|
|
398
|
+
const agentCardIdx = argv.indexOf('--print-open-agent-card');
|
|
399
|
+
if (agentCardIdx !== -1) {
|
|
400
|
+
const path = __require('node:path');
|
|
401
|
+
const { fileURLToPath } = __require('node:url');
|
|
402
|
+
const binDir = path.dirname(fileURLToPath(import.meta.url));
|
|
403
|
+
process.stdout.write(path.resolve(binDir, '..', 'resources', 'open_agent_leaderboard', 'cawdex-agent-card.md') + '\n');
|
|
404
|
+
process.exit(0);
|
|
405
|
+
}
|
|
406
|
+
})();
|
|
407
|
+
|
|
408
|
+
import('../dist/index.js');
|