@standardagents/builder 0.27.5 → 0.27.6

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.
@@ -66192,7 +66192,7 @@ var config_get_default = defineController2(async ({ config, env: env2, req }) =>
66192
66192
  });
66193
66193
 
66194
66194
  // src/version.ts
66195
- var BUILDER_VERSION = "0.27.5".length > 0 ? "0.27.5" : "dev";
66195
+ var BUILDER_VERSION = "0.27.6".length > 0 ? "0.27.6" : "dev";
66196
66196
 
66197
66197
  // src/api/diagnostics.get.ts
66198
66198
  init_LLMRequest();
package/dist/index.js CHANGED
@@ -24412,9 +24412,11 @@ var DurableThread = class _DurableThread extends DurableObject {
24412
24412
  codeExecutionBridges = /* @__PURE__ */ new Map();
24413
24413
  constructor(ctx, env) {
24414
24414
  super(ctx, env);
24415
- ctx.setWebSocketAutoResponse(
24416
- new WebSocketRequestResponsePair("stream_ping", "stream_pong")
24417
- );
24415
+ if (typeof WebSocketRequestResponsePair !== "undefined") {
24416
+ ctx.setWebSocketAutoResponse(
24417
+ new WebSocketRequestResponsePair("stream_ping", "stream_pong")
24418
+ );
24419
+ }
24418
24420
  this.alarmQueue = new AlarmQueue(ctx);
24419
24421
  this.alarmQueue.setExecutor(
24420
24422
  async (method, args, itemId) => {
@@ -27779,14 +27781,13 @@ ${resultContent}${attachmentSummary}`;
27779
27781
  async setExecutionOwner(owner) {
27780
27782
  await this.setValue(EXECUTION_OWNER_KEY, owner);
27781
27783
  }
27782
- /** Whether the given client id has a live bridge socket (excluding `except`). */
27784
+ /** Whether the given client id has an open bridge socket (excluding `except`).
27785
+ * Idle bridge heartbeats are handled by Cloudflare without waking this object,
27786
+ * so timestamp liveness is intentionally enforced only for an in-flight call. */
27783
27787
  hasLiveBridgeSocketForClient(clientId, except) {
27784
- const now = Date.now();
27785
27788
  for (const ws of this.bridgeSockets) {
27786
27789
  if (ws === except) continue;
27787
27790
  if (ws.readyState !== WebSocket.OPEN) continue;
27788
- const lastSeen = this.bridgeLastSeen.get(ws) ?? 0;
27789
- if (now - lastSeen > BRIDGE_LIVENESS_TIMEOUT_MS) continue;
27790
27791
  if ((this.bridgeClientInfo.get(ws)?.clientId ?? null) === clientId) return true;
27791
27792
  }
27792
27793
  return false;
@@ -27947,22 +27948,19 @@ ${resultContent}${attachmentSummary}`;
27947
27948
  }
27948
27949
  /**
27949
27950
  * Return the bridge socket a forwarded call should be dispatched to, pruning
27950
- * dead ones. A half-open client (idle NAT/proxy drop) keeps a
27951
- * `readyState === OPEN` socket that never fires close/error, so we also treat
27952
- * a socket we haven't heard from within {@link BRIDGE_LIVENESS_TIMEOUT_MS} as
27953
- * dead. The CLI heartbeats every few seconds, so this only trips on a truly
27954
- * gone client — and it means we won't dispatch a forwarded call into the void.
27951
+ * closed ones. Idle clients use Cloudflare's hibernation auto-response, so
27952
+ * their frames deliberately do not update `bridgeLastSeen`. Once a call is
27953
+ * dispatched, the client switches to application-visible pings and the
27954
+ * in-flight liveness timer above detects a half-open connection.
27955
27955
  *
27956
27956
  * With an execution owner recorded, only the owner's socket (or, as a
27957
27957
  * back-compat fallback, an unidentified legacy socket) is eligible; with no
27958
27958
  * owner, the first live socket wins as it always has.
27959
27959
  */
27960
27960
  getOpenBridgeSocket(ownerClientId) {
27961
- const now = Date.now();
27962
27961
  const live = [];
27963
27962
  for (const ws of Array.from(this.bridgeSockets)) {
27964
- const lastSeen = this.bridgeLastSeen.get(ws) ?? 0;
27965
- if (ws.readyState === WebSocket.OPEN && now - lastSeen <= BRIDGE_LIVENESS_TIMEOUT_MS) {
27963
+ if (ws.readyState === WebSocket.OPEN) {
27966
27964
  live.push({ socket: ws, clientId: this.bridgeClientInfo.get(ws)?.clientId ?? null });
27967
27965
  continue;
27968
27966
  }
@@ -30636,9 +30634,11 @@ var DurableAgentBuilder = class extends DurableObject {
30636
30634
  eventSockets = /* @__PURE__ */ new Set();
30637
30635
  constructor(ctx, env) {
30638
30636
  super(ctx, env);
30639
- ctx.setWebSocketAutoResponse(
30640
- new WebSocketRequestResponsePair("stream_ping", "stream_pong")
30641
- );
30637
+ if (typeof WebSocketRequestResponsePair !== "undefined") {
30638
+ ctx.setWebSocketAutoResponse(
30639
+ new WebSocketRequestResponsePair("stream_ping", "stream_pong")
30640
+ );
30641
+ }
30642
30642
  const sockets = ctx.getWebSockets();
30643
30643
  for (const ws of sockets) {
30644
30644
  const attachment = ws.deserializeAttachment();