@c4t4/heyamigo 0.8.13 → 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.
Files changed (2) hide show
  1. package/dist/ai/codex.js +17 -9
  2. package/package.json +1 -1
package/dist/ai/codex.js CHANGED
@@ -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'];
@@ -103,10 +106,12 @@ function buildExecArgs(params) {
103
106
  params.prompt = `${systemPrompt()}\n\n---\n\n${params.prompt}`;
104
107
  }
105
108
  }
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;
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 };
110
115
  }
111
116
  function extractReply(ev) {
112
117
  // Primary shape: item.completed with item.type === 'agent_message'
@@ -192,19 +197,22 @@ function parseCodexOutput(stdout) {
192
197
  };
193
198
  }
194
199
  async function runCodexTask(params) {
195
- const args = buildExecArgs({
200
+ const { args, prompt } = buildExecArgs({
196
201
  mode: params.mode,
197
202
  addDirs: params.addDirs,
198
203
  sessionId: params.sessionId,
199
204
  includeSystemPrompt: params.includeSystemPrompt,
200
205
  prompt: params.input,
201
206
  });
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.
207
+ logger.info({
208
+ caller: params.caller,
209
+ resume: !!params.sessionId,
210
+ argv: args,
211
+ promptChars: prompt.length,
212
+ }, 'spawning codex exec');
205
213
  const { stdout, stderr, durationMs } = await runClaude({
206
214
  args,
207
- input: '',
215
+ input: prompt,
208
216
  timeoutMs: laneTimeoutMs(params.lane),
209
217
  caller: params.caller,
210
218
  bin: 'codex',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4t4/heyamigo",
3
- "version": "0.8.13",
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",