@hydra-acp/archiver 0.1.24 → 0.1.26
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/discovery.js +1 -1
- package/package.json +3 -3
package/dist/discovery.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as d}from"./util/log.js";const o=d("discovery"),i=2e3;class h{constructor(t){this.opts=t}opts;timer;known=new Map;stopped=!1;inFlight=!1;start(){o.info(`polling ${this.opts.daemonUrl}/v1/sessions every ${this.opts.pollIntervalMs??i}ms`),this.poll(),this.timer=setInterval(()=>{this.poll()},this.opts.pollIntervalMs??i)}stop(){this.stopped=!0,this.timer&&(clearInterval(this.timer),this.timer=void 0)}async poll(){if(!(this.stopped||this.inFlight)){this.inFlight=!0;try{const t=await fetch(`${this.opts.daemonUrl}/v1/sessions`,{headers:{Authorization:`Bearer ${this.opts.token}`}});if(!t.ok){o.warn(`daemon /v1/sessions returned ${t.status}`);return}const n=await t.json(),r=new Map;for(const s of n.sessions)s.status==="warm"&&r.set(s.sessionId,s);for(const[s,e]of r)if(this.known.has(s))this.known.set(s,e);else{this.known.set(s,e);try{this.opts.onAdd(e)}catch(a){o.warn(`onAdd error for ${s}: ${a.message}`)}}for(const s of[...this.known.keys()])if(!r.has(s)){this.known.delete(s);try{this.opts.onRemove(s)}catch(e){o.warn(`onRemove error for ${s}: ${e.message}`)}}}catch(t){o.debug(`poll error: ${t.message}`)}finally{this.inFlight=!1}}}}export{h as HydraDiscovery};
|
|
1
|
+
import{logger as d}from"./util/log.js";const o=d("discovery"),i=2e3;class h{constructor(t){this.opts=t}opts;timer;known=new Map;stopped=!1;inFlight=!1;start(){o.info(`polling ${this.opts.daemonUrl}/v1/sessions every ${this.opts.pollIntervalMs??i}ms`),this.poll(),this.timer=setInterval(()=>{this.poll()},this.opts.pollIntervalMs??i)}stop(){this.stopped=!0,this.timer&&(clearInterval(this.timer),this.timer=void 0)}async poll(){if(!(this.stopped||this.inFlight)){this.inFlight=!0;try{const t=await fetch(`${this.opts.daemonUrl}/v1/sessions?status=warm`,{headers:{Authorization:`Bearer ${this.opts.token}`}});if(!t.ok){o.warn(`daemon /v1/sessions returned ${t.status}`);return}const n=await t.json(),r=new Map;for(const s of n.sessions)s.status==="warm"&&r.set(s.sessionId,s);for(const[s,e]of r)if(this.known.has(s))this.known.set(s,e);else{this.known.set(s,e);try{this.opts.onAdd(e)}catch(a){o.warn(`onAdd error for ${s}: ${a.message}`)}}for(const s of[...this.known.keys()])if(!r.has(s)){this.known.delete(s);try{this.opts.onRemove(s)}catch(e){o.warn(`onRemove error for ${s}: ${e.message}`)}}}catch(t){o.debug(`poll error: ${t.message}`)}finally{this.inFlight=!1}}}}export{h as HydraDiscovery};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydra-acp/archiver",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"description": "Session sync extension for hydra-acp — uploads session bundles to a shared backend (Google Drive, fs) and imports peers' bundles.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"watch": "tsup --watch",
|
|
23
23
|
"start": "node dist/index.js",
|
|
24
24
|
"dev": "tsup && node dist/index.js",
|
|
25
|
-
"test": "node
|
|
25
|
+
"test": "node scripts/run-tests.mjs",
|
|
26
26
|
"lint": "tsc -p . --noEmit",
|
|
27
27
|
"prepublishOnly": "npm run build && npm test"
|
|
28
28
|
},
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"googleapis": "^171.0.0",
|
|
34
|
-
"ws": "^8.
|
|
34
|
+
"ws": "^8.21.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^22.10.0",
|