agentlife 2.6.13 → 2.6.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.
Files changed (2) hide show
  1. package/dist/index.js +21 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1919,6 +1919,11 @@ function matchMetadata(block, key) {
1919
1919
  }
1920
1920
  return v || null;
1921
1921
  }
1922
+ function isLoadingPush(rawDsl) {
1923
+ const header = rawDsl.split(`
1924
+ `, 1)[0] ?? "";
1925
+ return /\bstate=loading\b/.test(header);
1926
+ }
1922
1927
  function hasDetailContent(rawDsl) {
1923
1928
  const lines = rawDsl.split(`
1924
1929
  `);
@@ -5512,6 +5517,8 @@ function persistTunnel(info) {
5512
5517
  }
5513
5518
  async function provisionTunnel(identity) {
5514
5519
  const url = `${API_BASE}/api/v1/devices/provision`;
5520
+ const abort = new AbortController;
5521
+ const timeoutId = setTimeout(() => abort.abort(), 20000);
5515
5522
  try {
5516
5523
  const response = await fetch(url, {
5517
5524
  method: "POST",
@@ -5519,7 +5526,8 @@ async function provisionTunnel(identity) {
5519
5526
  body: JSON.stringify({
5520
5527
  deviceId: identity.deviceId,
5521
5528
  deviceSecret: identity.deviceSecret
5522
- })
5529
+ }),
5530
+ signal: abort.signal
5523
5531
  });
5524
5532
  if (!response.ok) {
5525
5533
  const body = await response.text();
@@ -5545,8 +5553,15 @@ async function provisionTunnel(identity) {
5545
5553
  provisionedAt: Date.now()
5546
5554
  };
5547
5555
  } catch (err) {
5548
- console.warn(`[cloudflared-supervisor] provision network error: ${err?.message ?? err}`);
5556
+ const aborted = err?.name === "AbortError";
5557
+ if (aborted) {
5558
+ console.warn(`[cloudflared-supervisor] provision request timed out after 20s — ` + `will retry on next pair request`);
5559
+ } else {
5560
+ console.warn(`[cloudflared-supervisor] provision network error: ${err?.message ?? err}`);
5561
+ }
5549
5562
  return null;
5563
+ } finally {
5564
+ clearTimeout(timeoutId);
5550
5565
  }
5551
5566
  }
5552
5567
  function ensureCloudflaredBinary() {
@@ -6318,7 +6333,7 @@ function registerWidgetPushTool(api, state2) {
6318
6333
  const view = getSurface(state2, sid);
6319
6334
  if (!view)
6320
6335
  continue;
6321
- if (view.isOverlay || view.isInput || view.state === "loading")
6336
+ if (view.isOverlay || view.isInput || isLoadingPush(view.rawDsl))
6322
6337
  continue;
6323
6338
  const notifTitle = capitalize(agentId);
6324
6339
  const notifBody = extractWidgetText(view.lines) ?? "New update";
@@ -6351,13 +6366,14 @@ function registerWidgetPushTool(api, state2) {
6351
6366
  if (r.isTransient)
6352
6367
  continue;
6353
6368
  const view = getSurface(state2, r.surfaceId);
6354
- if (view && view.state !== "loading" && !view.followup && !goalChanges.includes(r.surfaceId)) {
6369
+ const isLoading = view ? isLoadingPush(view.rawDsl) : false;
6370
+ if (view && !isLoading && !view.followup && !goalChanges.includes(r.surfaceId)) {
6355
6371
  missingFollowup.push(r.surfaceId);
6356
6372
  recordActivity(state2, "quality_warning", sessionKey, agentId, {
6357
6373
  data: JSON.stringify({ issue: "missing_followup", surfaceId: r.surfaceId })
6358
6374
  });
6359
6375
  }
6360
- if (view && view.state !== "loading" && !view.isInput && !hasDetailContent(view.rawDsl) && !goalChanges.includes(r.surfaceId) && !missingFollowup.includes(r.surfaceId)) {
6376
+ if (view && !isLoading && !view.isInput && !hasDetailContent(view.rawDsl) && !goalChanges.includes(r.surfaceId) && !missingFollowup.includes(r.surfaceId)) {
6361
6377
  missingDetail.push(r.surfaceId);
6362
6378
  recordActivity(state2, "quality_warning", sessionKey, agentId, {
6363
6379
  data: JSON.stringify({ issue: "missing_detail", surfaceId: r.surfaceId })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentlife",
3
- "version": "2.6.13",
3
+ "version": "2.6.15",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "bun build index.ts --outfile dist/index.js --target node --external openclaw/plugin-sdk",