@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 CHANGED
@@ -11,9 +11,12 @@
11
11
  // - prompt passed as positional arg
12
12
  //
13
13
  // Configurable via config.codex:
14
- // - yolo (default true): adds --yolo, which bundles no-approvals +
15
- // full sandbox + skip-trust-check. The right default for a headless
16
- // owner-bot; set false to honor runTask's mode-driven sandbox.
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
- // --yolo: no approvals, full sandbox, skip trust check. Single switch
70
- // that covers the owner-bot case. mode is ignored on this path.
71
- args.push('--yolo');
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
- // Prompt as positional arg. `codex exec` reads stdin only with `-`, and
99
- // passing it positionally avoids ambiguity with the spawn pipe.
100
- args.push(params.prompt);
101
- return args;
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.debug({ caller: params.caller, resume: !!params.sessionId }, 'spawning codex exec');
195
- // input is empty here — the prompt rides in argv (Codex exec semantics).
196
- // Empty stdin end() is harmless.
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
- // --yolo on the Codex CLI bundles "no approvals + full sandbox + no
42
- // trust prompts". Right default for a headless owner-bot; flip to
43
- // false if you want runTask's mode to drive the sandbox tier instead.
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({}),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4t4/heyamigo",
3
- "version": "0.8.12",
3
+ "version": "0.8.14",
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",