@claw-link/gateway-host 0.3.16 → 0.3.18
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/package.json +1 -1
- package/src/bridge.js +3 -1
- package/src/worker.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claw-link/gateway-host",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18",
|
|
4
4
|
"description": "ClawLink Host Gateway — a secure, outbound-only worker that bridges a local agent CLI (OpenClaw, Hermes, Claude, Codex, Cursor) to your ClawLink agents. No inbound ports; authenticated per-agent by a Host Token.",
|
|
5
5
|
"homepage": "https://claw-link.co",
|
|
6
6
|
"bin": {
|
package/src/bridge.js
CHANGED
|
@@ -54,7 +54,9 @@ class Bridge {
|
|
|
54
54
|
claim() { return this._post('claim', { instance_id: this.instanceId }); }
|
|
55
55
|
// Multiplexed poll: ONE invocation authenticates all the host's agent tokens, refreshes their
|
|
56
56
|
// liveness (replacing per-agent heartbeats), and claims up to capacities[i] jobs per agent.
|
|
57
|
-
|
|
57
|
+
// `active` = in-flight job ids; the server bumps their keepalive so the reaper knows the
|
|
58
|
+
// difference between a long-running job and a host that died mid-job.
|
|
59
|
+
claimAll(tokens, capacities, active) { return this._post('claim_all', { tokens, capacities, active, instance_id: this.instanceId }); }
|
|
58
60
|
stream(jobId, seq, type, content) { return this._post('stream', { job_id: jobId, seq, type, content }); }
|
|
59
61
|
complete(jobId, finalContent, metadata) { return this._post('complete', { job_id: jobId, final_content: finalContent, metadata: metadata || {} }); }
|
|
60
62
|
fail(jobId, error) { return this._post('fail', { job_id: jobId, error: String(error).slice(0, 1000) }); }
|
package/src/worker.js
CHANGED
|
@@ -199,7 +199,9 @@ async function multiplexLoop(slots, cfg, p2p) {
|
|
|
199
199
|
let errored = false;
|
|
200
200
|
claimsInFlight++; // busy for the whole round-trip — preserves the graceful-drain guarantee
|
|
201
201
|
try {
|
|
202
|
-
|
|
202
|
+
// `active` = in-flight job ids: the server bumps their keepalive (touched_at) so the
|
|
203
|
+
// reaper never expires a job this host is still running (long builds are legitimate).
|
|
204
|
+
const r = await primary.claimAll(tokens, capacities, [...activeJobIds]);
|
|
203
205
|
claimFails = 0;
|
|
204
206
|
for (const job of r.jobs || []) {
|
|
205
207
|
const slot = slots.find((s) => s.agent.agent_id === job.agent_id);
|