@c4t4/heyamigo 0.8.13 → 0.8.15
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 +28 -19
- package/dist/config.js +5 -5
- package/package.json +1 -1
package/dist/ai/codex.js
CHANGED
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
//
|
|
13
13
|
// Configurable via config.codex:
|
|
14
14
|
// - model: optional `-m <model>` override. Default = Codex's default.
|
|
15
|
-
// - yolo (default true): emits --
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
// mode-driven sandbox.
|
|
15
|
+
// - yolo (default true): emits --yolo, which bundles no-approvals +
|
|
16
|
+
// full sandbox + skip-trust-check. The narrower verbose flag
|
|
17
|
+
// (--dangerously-bypass-approvals-and-sandbox) does NOT skip the
|
|
18
|
+
// trust check on all versions and can hang the process — use --yolo.
|
|
19
|
+
// Set false to honor runTask's mode-driven sandbox.
|
|
20
20
|
// - skipGitRepoCheck (default true): adds --skip-git-repo-check when
|
|
21
21
|
// yolo is off. Codex refuses to run in untrusted cwds without it.
|
|
22
22
|
// - extraArgs: appended verbatim. Escape hatch for version drift.
|
|
@@ -65,6 +65,9 @@ function sandboxFor(mode) {
|
|
|
65
65
|
function laneTimeoutMs(lane) {
|
|
66
66
|
return TIMEOUT_MS[lane];
|
|
67
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.
|
|
68
71
|
function buildExecArgs(params) {
|
|
69
72
|
const cfg = config.codex;
|
|
70
73
|
const args = ['exec', '--json'];
|
|
@@ -72,11 +75,12 @@ function buildExecArgs(params) {
|
|
|
72
75
|
args.push('-m', cfg.model);
|
|
73
76
|
}
|
|
74
77
|
if (cfg.yolo) {
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
|
|
78
|
+
// --yolo bundles all three bypasses: no approvals, full sandbox,
|
|
79
|
+
// and skip-trust-check. Empirically the right switch — the more
|
|
80
|
+
// narrowly-scoped --dangerously-bypass-approvals-and-sandbox does
|
|
81
|
+
// NOT subsume the trust-directory gate on some Codex versions and
|
|
82
|
+
// causes the process to hang waiting for stdin.
|
|
83
|
+
args.push('--yolo');
|
|
80
84
|
}
|
|
81
85
|
else {
|
|
82
86
|
if (cfg.skipGitRepoCheck)
|
|
@@ -103,10 +107,12 @@ function buildExecArgs(params) {
|
|
|
103
107
|
params.prompt = `${systemPrompt()}\n\n---\n\n${params.prompt}`;
|
|
104
108
|
}
|
|
105
109
|
}
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
// Pass prompt via stdin (positional `-` is the documented way). Large
|
|
111
|
+
// prompts — system prompt + memory preamble + history — can blow past
|
|
112
|
+
// Linux's ARG_MAX when shoved into argv, causing the spawn to hang
|
|
113
|
+
// silently. stdin has no such cap.
|
|
114
|
+
args.push('-');
|
|
115
|
+
return { args, prompt: params.prompt };
|
|
110
116
|
}
|
|
111
117
|
function extractReply(ev) {
|
|
112
118
|
// Primary shape: item.completed with item.type === 'agent_message'
|
|
@@ -192,19 +198,22 @@ function parseCodexOutput(stdout) {
|
|
|
192
198
|
};
|
|
193
199
|
}
|
|
194
200
|
async function runCodexTask(params) {
|
|
195
|
-
const args = buildExecArgs({
|
|
201
|
+
const { args, prompt } = buildExecArgs({
|
|
196
202
|
mode: params.mode,
|
|
197
203
|
addDirs: params.addDirs,
|
|
198
204
|
sessionId: params.sessionId,
|
|
199
205
|
includeSystemPrompt: params.includeSystemPrompt,
|
|
200
206
|
prompt: params.input,
|
|
201
207
|
});
|
|
202
|
-
logger.
|
|
203
|
-
|
|
204
|
-
|
|
208
|
+
logger.info({
|
|
209
|
+
caller: params.caller,
|
|
210
|
+
resume: !!params.sessionId,
|
|
211
|
+
argv: args,
|
|
212
|
+
promptChars: prompt.length,
|
|
213
|
+
}, 'spawning codex exec');
|
|
205
214
|
const { stdout, stderr, durationMs } = await runClaude({
|
|
206
215
|
args,
|
|
207
|
-
input:
|
|
216
|
+
input: prompt,
|
|
208
217
|
timeoutMs: laneTimeoutMs(params.lane),
|
|
209
218
|
caller: params.caller,
|
|
210
219
|
bin: 'codex',
|
package/dist/config.js
CHANGED
|
@@ -41,11 +41,11 @@ const ConfigSchema = z.object({
|
|
|
41
41
|
// Optional model override. If unset, Codex uses its default. Passed
|
|
42
42
|
// as `-m <model>` to `codex exec`.
|
|
43
43
|
model: z.string().optional(),
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
44
|
+
// Emits --yolo, which bundles no-approvals + full sandbox + skip-
|
|
45
|
+
// trust-check. The narrower verbose flag does not subsume the trust
|
|
46
|
+
// gate on all versions and hangs the process, so --yolo is the safe
|
|
47
|
+
// default. Right setting for a headless owner-bot. Set to false to
|
|
48
|
+
// honor runTask's mode-driven sandbox.
|
|
49
49
|
yolo: z.boolean().default(true),
|
|
50
50
|
// When yolo=false, still bypass the trust-directory prompt. Codex
|
|
51
51
|
// refuses to run in an "untrusted" cwd otherwise.
|