agents-relay 2.0.187 → 2.0.188
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 +3 -4
- package/package.json +1 -1
package/dist/usage.js
CHANGED
|
@@ -9,7 +9,7 @@ export class BrowserWorkspaceUsageReader {
|
|
|
9
9
|
timeoutMs;
|
|
10
10
|
now;
|
|
11
11
|
staleAfterMs;
|
|
12
|
-
constructor(command = '
|
|
12
|
+
constructor(command = join(homedir(), '.local', 'bin', 'webhelm'), timeoutMs = 10_000, now = () => new Date(), staleAfterMs = 15 * 60_000) {
|
|
13
13
|
this.command = command;
|
|
14
14
|
this.timeoutMs = timeoutMs;
|
|
15
15
|
this.now = now;
|
|
@@ -18,7 +18,7 @@ export class BrowserWorkspaceUsageReader {
|
|
|
18
18
|
async read() {
|
|
19
19
|
const observedAt = this.now().toISOString();
|
|
20
20
|
return await new Promise(resolve => {
|
|
21
|
-
const child = spawnOwnedProcess(this.command, [], { invocation: 'usage.browser-workspace', timeoutMs: this.timeoutMs, spawn: { stdio: ['
|
|
21
|
+
const child = spawnOwnedProcess(this.command, ['capacity'], { invocation: 'usage.browser-workspace', timeoutMs: this.timeoutMs, spawn: { stdio: ['ignore', 'pipe', 'ignore'] } });
|
|
22
22
|
let output = '';
|
|
23
23
|
let settled = false;
|
|
24
24
|
const finish = (capacity) => {
|
|
@@ -61,11 +61,10 @@ export class BrowserWorkspaceUsageReader {
|
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
catch { /*
|
|
64
|
+
catch { /* Keep accepting the last valid JSON line from WebHelm. */ }
|
|
65
65
|
}
|
|
66
66
|
finish(unavailable(code === 0 ? 'Browser Workspace capacity probe returned no usable capacity.' : `Browser Workspace capacity probe exited with code ${code ?? 'unknown'}.`));
|
|
67
67
|
});
|
|
68
|
-
child.stdin?.end('import json\nprint(json.dumps(workspace_capacity()))\n');
|
|
69
68
|
});
|
|
70
69
|
}
|
|
71
70
|
}
|