@c4t4/heyamigo 0.8.12 → 0.8.14
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/dist/ai/codex.js +31 -15
- package/dist/config.js +10 -4
- package/package.json +1 -1
package/dist/ai/codex.js
CHANGED
|
@@ -11,9 +11,12 @@
|
|
|
11
11
|
// - prompt passed as positional arg
|
|
12
12
|
//
|
|
13
13
|
// Configurable via config.codex:
|
|
14
|
-
// -
|
|
15
|
-
//
|
|
16
|
-
//
|
|
14
|
+
// - model: optional `-m <model>` override. Default = Codex's default.
|
|
15
|
+
// - yolo (default true): emits --dangerously-bypass-approvals-and-sandbox
|
|
16
|
+
// (the documented canonical flag; --yolo is an alias in newer builds).
|
|
17
|
+
// Bundles no-approvals + full sandbox + skip-trust-check. Right
|
|
18
|
+
// default for a headless owner-bot; set false to honor runTask's
|
|
19
|
+
// mode-driven sandbox.
|
|
17
20
|
// - skipGitRepoCheck (default true): adds --skip-git-repo-check when
|
|
18
21
|
// yolo is off. Codex refuses to run in untrusted cwds without it.
|
|
19
22
|
// - extraArgs: appended verbatim. Escape hatch for version drift.
|
|
@@ -62,13 +65,21 @@ function sandboxFor(mode) {
|
|
|
62
65
|
function laneTimeoutMs(lane) {
|
|
63
66
|
return TIMEOUT_MS[lane];
|
|
64
67
|
}
|
|
68
|
+
// Returns { args, prompt }. The prompt is the final text that should be
|
|
69
|
+
// piped to stdin (system prompt prepended when applicable). args ends with
|
|
70
|
+
// `-` so codex reads from stdin.
|
|
65
71
|
function buildExecArgs(params) {
|
|
66
72
|
const cfg = config.codex;
|
|
67
73
|
const args = ['exec', '--json'];
|
|
74
|
+
if (cfg.model) {
|
|
75
|
+
args.push('-m', cfg.model);
|
|
76
|
+
}
|
|
68
77
|
if (cfg.yolo) {
|
|
69
|
-
//
|
|
70
|
-
//
|
|
71
|
-
|
|
78
|
+
// Canonical "no approvals + full sandbox + no trust check" switch.
|
|
79
|
+
// Some newer Codex builds expose --yolo as an alias for the same
|
|
80
|
+
// behavior; we use the documented name to stay portable. mode is
|
|
81
|
+
// ignored on this path.
|
|
82
|
+
args.push('--dangerously-bypass-approvals-and-sandbox');
|
|
72
83
|
}
|
|
73
84
|
else {
|
|
74
85
|
if (cfg.skipGitRepoCheck)
|
|
@@ -95,10 +106,12 @@ function buildExecArgs(params) {
|
|
|
95
106
|
params.prompt = `${systemPrompt()}\n\n---\n\n${params.prompt}`;
|
|
96
107
|
}
|
|
97
108
|
}
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
|
|
101
|
-
|
|
109
|
+
// Pass prompt via stdin (positional `-` is the documented way). Large
|
|
110
|
+
// prompts — system prompt + memory preamble + history — can blow past
|
|
111
|
+
// Linux's ARG_MAX when shoved into argv, causing the spawn to hang
|
|
112
|
+
// silently. stdin has no such cap.
|
|
113
|
+
args.push('-');
|
|
114
|
+
return { args, prompt: params.prompt };
|
|
102
115
|
}
|
|
103
116
|
function extractReply(ev) {
|
|
104
117
|
// Primary shape: item.completed with item.type === 'agent_message'
|
|
@@ -184,19 +197,22 @@ function parseCodexOutput(stdout) {
|
|
|
184
197
|
};
|
|
185
198
|
}
|
|
186
199
|
async function runCodexTask(params) {
|
|
187
|
-
const args = buildExecArgs({
|
|
200
|
+
const { args, prompt } = buildExecArgs({
|
|
188
201
|
mode: params.mode,
|
|
189
202
|
addDirs: params.addDirs,
|
|
190
203
|
sessionId: params.sessionId,
|
|
191
204
|
includeSystemPrompt: params.includeSystemPrompt,
|
|
192
205
|
prompt: params.input,
|
|
193
206
|
});
|
|
194
|
-
logger.
|
|
195
|
-
|
|
196
|
-
|
|
207
|
+
logger.info({
|
|
208
|
+
caller: params.caller,
|
|
209
|
+
resume: !!params.sessionId,
|
|
210
|
+
argv: args,
|
|
211
|
+
promptChars: prompt.length,
|
|
212
|
+
}, 'spawning codex exec');
|
|
197
213
|
const { stdout, stderr, durationMs } = await runClaude({
|
|
198
214
|
args,
|
|
199
|
-
input:
|
|
215
|
+
input: prompt,
|
|
200
216
|
timeoutMs: laneTimeoutMs(params.lane),
|
|
201
217
|
caller: params.caller,
|
|
202
218
|
bin: 'codex',
|
package/dist/config.js
CHANGED
|
@@ -38,15 +38,21 @@ const ConfigSchema = z.object({
|
|
|
38
38
|
}),
|
|
39
39
|
codex: z
|
|
40
40
|
.object({
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
|
|
41
|
+
// Optional model override. If unset, Codex uses its default. Passed
|
|
42
|
+
// as `-m <model>` to `codex exec`.
|
|
43
|
+
model: z.string().optional(),
|
|
44
|
+
// Field name kept catchy, but the actual flag emitted is the
|
|
45
|
+
// documented one: --dangerously-bypass-approvals-and-sandbox. Some
|
|
46
|
+
// newer Codex builds also accept --yolo as an alias; we use the
|
|
47
|
+
// canonical name for portability. Right default for a headless
|
|
48
|
+
// owner-bot. Set to false to honor runTask's mode-driven sandbox.
|
|
44
49
|
yolo: z.boolean().default(true),
|
|
45
50
|
// When yolo=false, still bypass the trust-directory prompt. Codex
|
|
46
51
|
// refuses to run in an "untrusted" cwd otherwise.
|
|
47
52
|
skipGitRepoCheck: z.boolean().default(true),
|
|
48
53
|
// Appended verbatim to every `codex exec` invocation. Escape hatch
|
|
49
|
-
// for version-specific flags we haven't first-classed.
|
|
54
|
+
// for version-specific flags we haven't first-classed (e.g. flip
|
|
55
|
+
// back to --yolo if the canonical name ever goes away).
|
|
50
56
|
extraArgs: z.array(z.string()).default([]),
|
|
51
57
|
})
|
|
52
58
|
.default({}),
|