@c4t4/heyamigo 0.9.18 → 0.9.19

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/spawn.js CHANGED
@@ -180,8 +180,14 @@ export async function runClaude(opts) {
180
180
  }
181
181
  // Per-lane defaults. Individual callers can override, but these are the
182
182
  // shipped caps. Browser-heavy work lives in the async lane.
183
+ //
184
+ // Values picked to accommodate /goal-style long-running tasks (Claude
185
+ // Code / Codex CLI support multi-hour goal sessions). Matching claim
186
+ // TTLs in queue/inbound.ts and queue/browser-queue.ts MUST exceed
187
+ // these — otherwise the orchestrator reclaims live workers and the
188
+ // same task gets processed twice.
183
189
  export const TIMEOUT_MS = {
184
- main: 5 * 60 * 1000,
185
- async: 15 * 60 * 1000,
186
- background: 3 * 60 * 1000,
190
+ main: 30 * 60 * 1000, // 30 min — chat track, covers /goal
191
+ async: 60 * 60 * 1000, // 60 min — async lane, deep browser scrapes
192
+ background: 5 * 60 * 1000, // 5 min — digest / sweep / housekeeping
187
193
  };
@@ -121,8 +121,11 @@ export function markBrowserTaskRetryOrDlq(id, workerId, errorMessage) {
121
121
  return { retried: true, deadLettered: false };
122
122
  });
123
123
  }
124
- // Browser tasks take 1-15 min routinely. Generous reclaim TTL.
125
- const CLAIM_TTL_SECONDS = 20 * 60;
124
+ // MUST exceed TIMEOUT_MS.async (60min as of the /goal-friendly bump)
125
+ // so live browser workers don't get reclaimed mid-spawn. 5min headroom
126
+ // past the spawn cap so the orchestrator only catches truly dead
127
+ // workers. Browser tasks legitimately run 30-45min for deep scrapes.
128
+ const CLAIM_TTL_SECONDS = 65 * 60;
126
129
  export function reclaimStuckBrowserTasks() {
127
130
  const db = getDb();
128
131
  const cutoff = Math.floor(Date.now() / 1000) - CLAIM_TTL_SECONDS;
@@ -170,10 +170,11 @@ export function markInboundFailed(id, workerId, errorMessage) {
170
170
  .all();
171
171
  return result.length > 0;
172
172
  }
173
- // Orchestrator helper. Chat workers run longer than sender workers
174
- // (AI calls + memory writes), so the TTL is more generous. 300s
175
- // matches the typical chat-track timeout (5min).
176
- const CLAIM_TTL_SECONDS = 360;
173
+ // Orchestrator helper. MUST exceed TIMEOUT_MS.main (30min as of the
174
+ // /goal-friendly bump) so live workers don't get reclaimed mid-spawn.
175
+ // 5min headroom past the spawn cap so the orchestrator only catches
176
+ // rows whose worker actually died.
177
+ const CLAIM_TTL_SECONDS = 35 * 60;
177
178
  export function reclaimStuckInbound() {
178
179
  const db = getDb();
179
180
  const cutoff = Math.floor(Date.now() / 1000) - CLAIM_TTL_SECONDS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4t4/heyamigo",
3
- "version": "0.9.18",
3
+ "version": "0.9.19",
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",