@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 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 --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.
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
- // Canonical "no approvals + full sandbox + no trust check" switch.
76
- // Some newer Codex builds expose --yolo as an alias for the same
77
- // behavior; we use the documented name to stay portable. mode is
78
- // ignored on this path.
79
- args.push('--dangerously-bypass-approvals-and-sandbox');
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
- // Prompt as positional arg. `codex exec` reads stdin only with `-`, and
107
- // passing it positionally avoids ambiguity with the spawn pipe.
108
- args.push(params.prompt);
109
- return args;
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.debug({ caller: params.caller, resume: !!params.sessionId }, 'spawning codex exec');
203
- // input is empty here — the prompt rides in argv (Codex exec semantics).
204
- // Empty stdin end() is harmless.
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
- // 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
+ // 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4t4/heyamigo",
3
- "version": "0.8.13",
3
+ "version": "0.8.15",
4
4
  "description": "WhatsApp AI bot powered by Claude with long-term memory, browser control, and role-based access",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",