agents-relay 1.0.136 → 1.0.137

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/usage.js CHANGED
@@ -51,7 +51,11 @@ export class BrowserWorkspaceUsageReader {
51
51
  const idle = numberOrNull(raw.idle);
52
52
  const leased = numberOrNull(raw.leased);
53
53
  const poolSize = numberOrNull(raw.poolSize);
54
- const available = typeof raw.available === 'boolean' ? raw.available : idle === null ? null : idle > 0;
54
+ // `available` is allocatable capacity, not the number of currently idle tabs.
55
+ // Keep accepting the old boolean probe shape while callers transition.
56
+ const available = typeof raw.available === 'number' && Number.isFinite(raw.available) && raw.available >= 0
57
+ ? raw.available
58
+ : typeof raw.available === 'boolean' ? (raw.available ? 1 : 0) : null;
55
59
  if (idle !== null || leased !== null || poolSize !== null || available !== null) {
56
60
  finish({ name, poolSize, idle, leased, available, observedAt: rawObservedAt, reason: null });
57
61
  return;
@@ -83,7 +83,7 @@ export function satisfiesWorker(candidate, requirements) {
83
83
  return false;
84
84
  if (requirements.runtime && candidate.runtime !== requirements.runtime)
85
85
  return false;
86
- if (candidate.adapter === 'chatgpt' && candidate.browserWorkspaceCapacity?.idle === 0)
86
+ if (candidate.adapter === 'chatgpt' && candidate.browserWorkspaceCapacity?.available === 0)
87
87
  return false;
88
88
  return true;
89
89
  }
@@ -120,8 +120,8 @@ export function selectWorker(candidates, requirements) {
120
120
  return { candidate: selected, selection: selection(selected, 'worker-router:fallback') };
121
121
  }
122
122
  function noEligibleWorkerReason(candidates) {
123
- if (candidates.some(candidate => candidate.adapter === 'chatgpt' && candidate.browserWorkspaceCapacity?.idle === 0)) {
124
- return 'No eligible worker: ChatGPT Browser Workspace has no idle capacity.';
123
+ if (candidates.some(candidate => candidate.adapter === 'chatgpt' && candidate.browserWorkspaceCapacity?.available === 0)) {
124
+ return 'No eligible worker: ChatGPT Browser Workspace has no allocatable capacity.';
125
125
  }
126
126
  return 'No eligible worker satisfies the authoritative worker constraints';
127
127
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agents-relay",
3
- "version": "1.0.136",
3
+ "version": "1.0.137",
4
4
  "description": "Durable async agent jobs coordinated through GitHub pull requests",
5
5
  "type": "module",
6
6
  "bin": {