@hydra-acp/archiver 0.1.20 → 0.1.22
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/cold-sweep.js +1 -1
- package/dist/discovery.js +1 -1
- package/package.json +1 -1
package/dist/cold-sweep.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as d}from"./util/log.js";const
|
|
1
|
+
import{logger as d}from"./util/log.js";const i=d("cold-sweep");async function l(n){const o=await a(n.daemonUrl,n.token);let s=0,r=0;for(const e of o)if(e.status!=="warm"){if(e.importedFromMachine&&!e.upstreamSessionId){r+=1;continue}s+=1,n.archive.setMeta(e.sessionId,{...e.cwd!==void 0?{cwd:e.cwd}:{},...e.agentId!==void 0?{agentId:e.agentId}:{},...e.title!==void 0?{title:e.title}:{},...e.interactive!==void 0?{interactive:e.interactive}:{}});try{await n.archive.flushNow(e.sessionId)}catch(t){i.warn(`cold sweep flush ${e.sessionId} failed: ${t.message}`)}}return i.info(`cold sweep done: scanned=${o.length} cold=${s} skipped-mirrors=${r}`),{scanned:o.length,cold:s,skippedMirrors:r}}async function a(n,o){const s=await fetch(`${n}/v1/sessions`,{headers:{Authorization:`Bearer ${o}`}});if(!s.ok)throw new Error(`daemon /v1/sessions returned ${s.status}`);return(await s.json()).sessions}export{l as runColdSweep};
|
package/dist/discovery.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{logger as d}from"./util/log.js";const o=d("discovery"),
|
|
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hydra-acp/archiver",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.22",
|
|
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",
|