@owloops/browserbird 1.2.7 → 1.2.9

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/index.mjs +37 -4
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -122,8 +122,8 @@ function unknownSubcommand(subcommand, command, validCommands) {
122
122
  /** @fileoverview ASCII banner displayed on daemon startup and in help text. */
123
123
  const pkg = createRequire(import.meta.url)("../package.json");
124
124
  const buildInfo = [];
125
- buildInfo.push(`commit: ${"febb9bb9f678ef12c57880b663dcc875288f1950".substring(0, 7)}`);
126
- buildInfo.push(`built: 2026-03-06T10:34:46+04:00`);
125
+ buildInfo.push(`commit: ${"c3481c8e048a6121f0a2c6cd163cf61863ca5d9d".substring(0, 7)}`);
126
+ buildInfo.push(`built: 2026-03-09T11:42:49+04:00`);
127
127
  const buildString = buildInfo.length > 0 ? ` (${buildInfo.join(", ")})` : "";
128
128
  const VERSION = `browserbird ${pkg.version}${buildString}`;
129
129
  const BIRD = [
@@ -2552,7 +2552,9 @@ function spawnProvider(provider, options, signal) {
2552
2552
  proc.stderr.on("data", (chunk) => {
2553
2553
  stderrBuf += chunk.toString("utf-8");
2554
2554
  });
2555
+ let timedOut = false;
2555
2556
  const timeout = setTimeout(() => {
2557
+ timedOut = true;
2556
2558
  logger.warn(`${cmd.binary} timed out after ${timeoutMs}ms, killing`);
2557
2559
  gracefulKill(proc);
2558
2560
  }, timeoutMs);
@@ -2565,6 +2567,10 @@ function spawnProvider(provider, options, signal) {
2565
2567
  buffer = b;
2566
2568
  });
2567
2569
  if (buffer.trim()) yield* mod.parseStreamLine(buffer);
2570
+ if (timedOut) yield {
2571
+ type: "timeout",
2572
+ timeoutMs
2573
+ };
2568
2574
  } finally {
2569
2575
  clearTimeout(timeout);
2570
2576
  signal.removeEventListener("abort", onAbort);
@@ -2768,6 +2774,20 @@ function sessionErrorBlocks(errorMessage, opts) {
2768
2774
  if (fieldPairs.length > 0) blocks.push(fields(...fieldPairs));
2769
2775
  return blocks;
2770
2776
  }
2777
+ function sessionTimeoutBlocks(timeoutMs, opts) {
2778
+ const minutes = Math.round(timeoutMs / 6e4);
2779
+ const blocks = [header("Session Timed Out"), section(`The session was stopped after *${minutes} minute${minutes === 1 ? "" : "s"}* (the configured limit).\n\nReply to continue in a new session, or increase \`sessions.processTimeoutMs\` in your config to allow longer runs.`)];
2780
+ if (opts?.sessionUid) blocks.push({
2781
+ type: "actions",
2782
+ elements: [{
2783
+ type: "button",
2784
+ text: plain("Retry"),
2785
+ action_id: "session_retry",
2786
+ value: `retry:${opts.sessionUid}`
2787
+ }]
2788
+ });
2789
+ return blocks;
2790
+ }
2771
2791
  function busyBlocks(activeCount, maxConcurrent) {
2772
2792
  return [section("*Too many active sessions*"), context(`${activeCount}/${maxConcurrent} slots in use. Try again shortly.`)];
2773
2793
  }
@@ -3169,6 +3189,8 @@ function createHandler(client, config, signal, getTeamId) {
3169
3189
  let fullText = "";
3170
3190
  let completion;
3171
3191
  let hasError = false;
3192
+ let timedOut = false;
3193
+ let timedOutMs = 0;
3172
3194
  for await (const event of events) {
3173
3195
  if (signal.aborted) break;
3174
3196
  logger.debug(`stream event: ${event.type}`);
@@ -3204,10 +3226,21 @@ function createHandler(client, config, signal, getTeamId) {
3204
3226
  await streamer.append({ markdown_text: `\n\nError: ${safeError}` });
3205
3227
  break;
3206
3228
  }
3229
+ case "timeout":
3230
+ timedOut = true;
3231
+ timedOutMs = event.timeoutMs;
3232
+ logger.warn(`session timed out after ${event.timeoutMs}ms`);
3233
+ break;
3207
3234
  }
3208
3235
  }
3209
- const footerBlocks = completion ? completionFooterBlocks(completion, hasError, meta.birdName, userId) : void 0;
3210
- await streamer.stop(footerBlocks ? { blocks: footerBlocks } : {});
3236
+ if (timedOut) {
3237
+ await streamer.stop({});
3238
+ const blocks = sessionTimeoutBlocks(timedOutMs, { sessionUid });
3239
+ await client.postMessage(channelId, threadTs, `Session timed out after ${Math.round(timedOutMs / 6e4)} minutes.`, { blocks });
3240
+ } else {
3241
+ const footerBlocks = completion ? completionFooterBlocks(completion, hasError, meta.birdName, userId) : void 0;
3242
+ await streamer.stop(footerBlocks ? { blocks: footerBlocks } : {});
3243
+ }
3211
3244
  }
3212
3245
  async function uploadImages(images, channelId, threadTs) {
3213
3246
  for (let i = 0; i < images.length; i++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owloops/browserbird",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "Self-hosted AI agent for Slack with a real browser, a scheduler, and a web dashboard",
5
5
  "type": "module",
6
6
  "bin": {