@ours.network/sdk 0.1.1 → 0.1.2
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/api/contacts.js +1 -1
- package/dist/api/files.d.ts +4 -1
- package/dist/api/files.js +1 -1
- package/dist/api/identity.js +1 -1
- package/dist/api/messaging.js +1 -1
- package/dist/api/profile.d.ts +2 -1
- package/dist/api/profile.js +1 -1
- package/dist/api/types.d.ts +29 -0
- package/dist/book.js +1 -1
- package/dist/boot.js +1 -1
- package/dist/{chunk-NQQ4GSVI.js → chunk-24CAAXRA.js} +1 -1
- package/dist/{chunk-ZAXRB5MO.js → chunk-2KWZSE4A.js} +1 -1
- package/dist/{chunk-VOYMK2OO.js → chunk-5KLD4UEC.js} +1 -1
- package/dist/chunk-6DWYNPOV.js +2 -0
- package/dist/{chunk-RAGUBE4Y.js → chunk-7WVDNFDY.js} +1 -1
- package/dist/{chunk-A3SXVUOC.js → chunk-7Y3J4YEY.js} +1 -1
- package/dist/{chunk-7UUFYO6G.js → chunk-ACGHUOXF.js} +1 -1
- package/dist/{chunk-NMYSFQBL.js → chunk-APFH6XJH.js} +1 -1
- package/dist/{chunk-HSVIKO4D.js → chunk-CKRHELVR.js} +1 -1
- package/dist/{chunk-T25JIPX5.js → chunk-CQHF2R3K.js} +1 -1
- package/dist/chunk-D5YFXZW5.js +2 -0
- package/dist/chunk-DOCQLFOH.js +2 -0
- package/dist/{chunk-Q3UVLSCX.js → chunk-F3A5QXT2.js} +1 -1
- package/dist/{chunk-X4RVJ5VL.js → chunk-F7XVNQTN.js} +1 -1
- package/dist/{chunk-NSPYN5TT.js → chunk-H5B5DI4B.js} +1 -1
- package/dist/{chunk-HCIVLHKC.js → chunk-I7PZGGZC.js} +1 -1
- package/dist/chunk-IDH22QWU.js +2 -0
- package/dist/{chunk-PCHN744Y.js → chunk-JBE32TUA.js} +1 -1
- package/dist/{chunk-TZBRSDND.js → chunk-Q3RMTP4Y.js} +1 -1
- package/dist/{chunk-VW2KWXSJ.js → chunk-R3G5PNQ5.js} +1 -1
- package/dist/{chunk-KZMPGVQM.js → chunk-WXLUTSLB.js} +1 -1
- package/dist/client/http.d.ts +2 -0
- package/dist/client/http.js +1 -1
- package/dist/client/select.d.ts +108 -0
- package/dist/client/select.js +2 -0
- package/dist/cluster/control.js +1 -1
- package/dist/cluster/manifest.js +1 -1
- package/dist/connector.js +1 -1
- package/dist/daemon.js +1 -1
- package/dist/gc.js +1 -1
- package/dist/http/api-routes.d.ts +2 -0
- package/dist/http/api-routes.js +1 -1
- package/dist/http/server.js +1 -1
- package/dist/identity/hierarchy.js +1 -1
- package/dist/identity/lease.js +1 -1
- package/dist/identity/lifecycle.js +1 -1
- package/dist/identity/model.js +1 -1
- package/dist/identity/provision.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/messaging/send.js +1 -1
- package/dist/mufl/handlers.js +1 -1
- package/dist/mufl/tx.js +1 -1
- package/dist/mufl_code/8ED6356B41CC689C75DA3302AD7856058131661A6ABBAC961E71BA838D8C97A3.muflo +0 -0
- package/dist/notify.js +1 -1
- package/dist/render/adapt-to-json.js +1 -1
- package/dist/runtime/env.js +1 -1
- package/dist/state.js +1 -1
- package/dist/sweeps.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-3DQSMLVZ.js +0 -2
- package/dist/chunk-AJQIWYXG.js +0 -2
- package/dist/chunk-UELGY557.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as n}from"./chunk-UM73BGFH.js";var a=class{base;leaseToken;clientPid;apiToken;fetchImpl;constructor(e){this.base=e.url.replace(/\/+$/,""),this.leaseToken=e.leaseToken,this.clientPid=e.clientPid??process.pid,this.apiToken=e.apiToken,this.fetchImpl=e.fetch??globalThis.fetch}headers(e={}){return{"x-ours-lease-token":this.leaseToken,"x-ours-client-pid":String(this.clientPid),...this.apiToken?{"x-ours-api-token":this.apiToken}:{},...e}}async post(e,s){let i=await this.fetchImpl(`${this.base}/api/v1/${e}`,{method:"POST",headers:this.headers({"content-type":"application/json"}),body:JSON.stringify(s??{})}),t;try{t=await i.json()}catch{throw new Error(`${e}: the daemon returned a non-JSON response (HTTP ${i.status})`)}if(t&&typeof t=="object"&&!Array.isArray(t)&&"error"in t){let r=t.error,o=r!==null&&typeof r=="object"&&"code"in r&&"message"in r;if(i.status===400&&o){let{code:c,message:d}=r;throw new n(c,d)}let p=o?r.message:String(r);throw new Error(`${e}: ${p} (HTTP ${i.status})`)}if(!i.ok)throw new Error(`${e}: the daemon returned HTTP ${i.status} with no error field`);return t}async get(e,s){let i=await this.fetchImpl(`${this.base}${e}`,{headers:s?this.headers():{}}),t;try{t=await i.json()}catch{throw new Error(`GET ${e}: the daemon returned a non-JSON response (HTTP ${i.status})`)}if(t&&typeof t=="object"&&"error"in t)throw new Error(`GET ${e}: ${String(t.error)} (HTTP ${i.status})`);if(!i.ok)throw new Error(`GET ${e}: the daemon returned HTTP ${i.status} with no error field`);return t}createIdentity(e){return this.post("createIdentity",e)}createTemporaryIdentity(e){return this.post("createTemporaryIdentity",e)}closeTemporaryIdentityOp(e={}){return this.post("closeTemporaryIdentityOp",e)}createRootIdentity(e){return this.post("createRootIdentity",e)}defineLocalIdentityFile(e){return this.post("defineLocalIdentityFile",e)}chooseIdentity(e){return this.post("chooseIdentity",e)}listIdentities(){return this.post("listIdentities",{})}currentIdentity(){return this.post("currentIdentity",{})}removeIdentity(e){return this.post("removeIdentity",e)}releaseLease(){return this.post("releaseLease",{})}generateInvite(e={}){return this.post("generateInvite",e)}listInvites(){return this.post("listInvites",{})}revokeInvite(e){return this.post("revokeInvite",e)}addContact(e){return this.post("addContact",e)}listContacts(){return this.post("listContacts",{})}listLocalContactBook(){return this.post("listLocalContactBook",{})}setLocalBookPolicy(e){return this.post("setLocalBookPolicy",e)}removeContact(e){return this.post("removeContact",e)}renameContact(e){return this.post("renameContact",e)}respondToIntroduction(e){return this.post("respondToIntroduction",e)}setBio(e){return this.post("setBio",e)}advertiseMigrate(){return this.post("advertiseMigrate",{})}setPersona(e){return this.post("setPersona",e)}sendMessage(e){return this.post("sendMessage",e)}sendFile(e){return this.post("sendFile",e)}listIncomingMessages(){return this.post("listIncomingMessages",{})}getMessages(){return this.post("getMessages",{})}deferMessages(e){return this.post("deferMessages",e)}listIncomingFiles(){return this.post("listIncomingFiles",{})}getFiles(e={}){return this.post("getFiles",e)}saveFileFallbackNotice(e){return this.post("saveFileFallbackNotice",e)}version(){return this.get("/version",!1)}stateDir(){return this.get("/state-dir",!1)}async identities(){return(await this.get("/identities",!0)).identities}unread(){return this.get("/unread",!0)}async*watchNotifications(e,s={}){let i=s.since??"tip",t=`/identities/${encodeURIComponent(e)}/notifications`;for(;!s.signal?.aborted;){let r;try{let o=await this.fetchImpl(`${this.base}${t}?since=${i}`,{headers:this.headers(),signal:s.signal});try{r=await o.json()}catch{throw new Error(`watchNotifications(${e}): the daemon returned a non-JSON response (HTTP ${o.status})`)}}catch(o){if(s.signal?.aborted)return;throw o}if("error"in r)throw new Error(`watchNotifications(${e}): ${r.error}`);i=r.cursor;for(let o of r.events)yield o}}async fetchFile(e){let s=await this.fetchImpl(`${this.base}/files/${encodeURIComponent(e)}`,{headers:this.headers()});if(!s.ok){let i=`HTTP ${s.status}`;try{let t=await s.json();t&&t.error!==void 0&&(i=String(t.error))}catch{}throw new Error(`fetchFile(${e}): ${i}`)}return new Uint8Array(await s.arrayBuffer())}};export{a};
|
|
2
|
+
import{a as n}from"./chunk-UM73BGFH.js";var a=class{base;leaseToken;clientPid;apiToken;fetchImpl;constructor(e){this.base=e.url.replace(/\/+$/,""),this.leaseToken=e.leaseToken,this.clientPid=e.clientPid??process.pid,this.apiToken=e.apiToken,this.fetchImpl=e.fetch??globalThis.fetch}headers(e={}){return{"x-ours-lease-token":this.leaseToken,"x-ours-client-pid":String(this.clientPid),...this.apiToken?{"x-ours-api-token":this.apiToken}:{},...e}}async post(e,s){let i=await this.fetchImpl(`${this.base}/api/v1/${e}`,{method:"POST",headers:this.headers({"content-type":"application/json"}),body:JSON.stringify(s??{})}),t;try{t=await i.json()}catch{throw new Error(`${e}: the daemon returned a non-JSON response (HTTP ${i.status})`)}if(t&&typeof t=="object"&&!Array.isArray(t)&&"error"in t){let r=t.error,o=r!==null&&typeof r=="object"&&"code"in r&&"message"in r;if(i.status===400&&o){let{code:c,message:d}=r;throw new n(c,d)}let p=o?r.message:String(r);throw new Error(`${e}: ${p} (HTTP ${i.status})`)}if(!i.ok)throw new Error(`${e}: the daemon returned HTTP ${i.status} with no error field`);return t}async get(e,s){let i=await this.fetchImpl(`${this.base}${e}`,{headers:s?this.headers():{}}),t;try{t=await i.json()}catch{throw new Error(`GET ${e}: the daemon returned a non-JSON response (HTTP ${i.status})`)}if(t&&typeof t=="object"&&"error"in t)throw new Error(`GET ${e}: ${String(t.error)} (HTTP ${i.status})`);if(!i.ok)throw new Error(`GET ${e}: the daemon returned HTTP ${i.status} with no error field`);return t}createIdentity(e){return this.post("createIdentity",e)}createTemporaryIdentity(e){return this.post("createTemporaryIdentity",e)}closeTemporaryIdentityOp(e={}){return this.post("closeTemporaryIdentityOp",e)}createRootIdentity(e){return this.post("createRootIdentity",e)}defineLocalIdentityFile(e){return this.post("defineLocalIdentityFile",e)}chooseIdentity(e){return this.post("chooseIdentity",e)}listIdentities(){return this.post("listIdentities",{})}currentIdentity(){return this.post("currentIdentity",{})}removeIdentity(e){return this.post("removeIdentity",e)}releaseLease(){return this.post("releaseLease",{})}generateInvite(e={}){return this.post("generateInvite",e)}listInvites(){return this.post("listInvites",{})}revokeInvite(e){return this.post("revokeInvite",e)}addContact(e){return this.post("addContact",e)}listContacts(){return this.post("listContacts",{})}listLocalContactBook(){return this.post("listLocalContactBook",{})}setLocalBookPolicy(e){return this.post("setLocalBookPolicy",e)}removeContact(e){return this.post("removeContact",e)}renameContact(e){return this.post("renameContact",e)}respondToIntroduction(e){return this.post("respondToIntroduction",e)}setBio(e){return this.post("setBio",e)}advertiseMigrate(){return this.post("advertiseMigrate",{})}readvertiseOnUpgrade(){return this.post("readvertiseOnUpgrade",{})}setPersona(e){return this.post("setPersona",e)}sendMessage(e){return this.post("sendMessage",e)}sendFile(e){return this.post("sendFile",e)}listIncomingMessages(){return this.post("listIncomingMessages",{})}getMessages(){return this.post("getMessages",{})}deferMessages(e){return this.post("deferMessages",e)}deferFiles(e){return this.post("deferFiles",e)}listIncomingFiles(){return this.post("listIncomingFiles",{})}getFiles(e={}){return this.post("getFiles",e)}saveFileFallbackNotice(e){return this.post("saveFileFallbackNotice",e)}version(){return this.get("/version",!1)}stateDir(){return this.get("/state-dir",!1)}async identities(){return(await this.get("/identities",!0)).identities}unread(){return this.get("/unread",!0)}async*watchNotifications(e,s={}){let i=s.since??"tip",t=`/identities/${encodeURIComponent(e)}/notifications`;for(;!s.signal?.aborted;){let r;try{let o=await this.fetchImpl(`${this.base}${t}?since=${i}`,{headers:this.headers(),signal:s.signal});try{r=await o.json()}catch{throw new Error(`watchNotifications(${e}): the daemon returned a non-JSON response (HTTP ${o.status})`)}}catch(o){if(s.signal?.aborted)return;throw o}if("error"in r)throw new Error(`watchNotifications(${e}): ${r.error}`);i=r.cursor;for(let o of r.events)yield o}}async fetchFile(e){let s=await this.fetchImpl(`${this.base}/files/${encodeURIComponent(e)}`,{headers:this.headers()});if(!s.ok){let i=`HTTP ${s.status}`;try{let t=await s.json();t&&t.error!==void 0&&(i=String(t.error))}catch{}throw new Error(`fetchFile(${e}): ${i}`)}return new Uint8Array(await s.arrayBuffer())}};export{a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{b as s,e as p}from"./chunk-
|
|
2
|
+
import{b as s,e as p}from"./chunk-I7PZGGZC.js";import{F as f,J as c,N as g,P as l,t as u}from"./chunk-24CAAXRA.js";import{c as d,d as a}from"./chunk-F3A5QXT2.js";function S(e,t){if(!s||!d.has(s))return null;let r=d.get(t)??[...d.values()].find(n=>n.cid===t);if(!r||r.name===e.name)return null;let i=n=>n.name===s||p(n).roleId!=="";return i(e)&&i(r)?r:null}async function V(e,t,r){let i=l(t);return await f(async n=>{await c(e,"::actor::connect_sibling",{name:t.name,target_ad:e.pw.packet.NewBinaryFromBuffer(i).Attach(n),text:r},n)}),u(e),`"${t.name}" was not a contact yet \u2014 connected as an intra-root sibling (delegation-cert auto-accept) and delivered the message.`}async function N(e,t,r){if(!a)throw new Error(`"${t}" is not a contact, and the local contact book is unavailable.`);let i=g(),n=i[t]??Object.values(i).find(o=>o.container_id===t);if(!n)throw new Error(`"${t}" is not a contact and has no local contact-book entry. Use generate_invite/add_contact for remote peers, or list_local_contact_book to see local ones.`);if(n.container_id===e.cid)throw new Error("that contact-book entry is this identity itself.");let m=Buffer.from(n.address_document,"base64url"),w=Buffer.from(n.registrar_sig,"base64url"),y=l(e);return await f(async o=>{let k=await c(a,"::actor::mint_introduction",{joiner_ad:a.pw.packet.NewBinaryFromBuffer(y).Attach(o),target_ad:a.pw.packet.NewBinaryFromBuffer(m).Attach(o)},o),b=Buffer.from(k.Reduce("intro").GetBinary());await c(e,"::actor::connect_local",{name:n.name,target_ad:e.pw.packet.NewBinaryFromBuffer(m).Attach(o),intro:e.pw.packet.NewBinaryFromBuffer(b).Attach(o),entry_sig:e.pw.packet.NewBinaryFromBuffer(w).Attach(o),text:r},o)}),u(e),`"${n.name}" was not a contact yet \u2014 connected via the local contact book and sent the message with the introduction. If "${n.name}" requires approval for local introductions, delivery completes once they approve.`}var R=e=>{let t=n=>!e.Reduce(n).IsNil(),r=e.Reduce("wire_id").Visualize(),i=t("sent_to")?e.Reduce("sent_to").Visualize():"";if(t("downgrade_refused"))return{kind:"refused",wireId:r,cid:i};if(t("migrating"))return{kind:"migrating",wireId:r,cid:i,queued:t("queued")?Number(e.Reduce("queued").Visualize()):0};if(t("route")){let n=t("retained")&&!e.Reduce("retained").GetBoolean();return{kind:"e2e",wireId:r,cid:i,notRetained:n}}return t("deferred")?{kind:"deferred",wireId:r,queued:t("queued")?Number(e.Reduce("queued").Visualize()):0}:{kind:"sent",wireId:r}};export{S as a,V as b,N as c,R as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as d}from"./chunk-
|
|
2
|
+
import{a as d}from"./chunk-ACGHUOXF.js";import{J as r,y as T,z as j}from"./chunk-UM73BGFH.js";import{E as y,F as u,G as p,J as l,N,R as L,S as A,m as z,o as P,t as f}from"./chunk-24CAAXRA.js";import{a as C,b as V,g as x,h as I,j as S,k as B}from"./chunk-F7XVNQTN.js";import{d as _,f as k}from"./chunk-7WVDNFDY.js";async function U(s,a={}){let e=d(s),{name:i,mode:o}=a;if(o==="public"&&i)throw T();try{return await u(async t=>{let n={};i&&(n.name=i),o&&(n.mode=o);let c=await l(e,"::a2a_messaging::generate_invite",n,t);return{blob:S(Buffer.from(c.Reduce("invite").GetBinary())),inviteId:c.Reduce("invite_id").Visualize(),mode:c.Reduce("mode").Visualize()==="public"?"public":"one_time"}})}catch(t){throw r("generate_invite",String(t))}}async function $(s){let a=d(s);try{return y(e=>{let i=p(a,"::a2a_messaging::list_invites",e),o=[];if(i.IsNil())return o;for(let t of i.GetKeys()){let n=i.Reduce(t);if(n.IsNil())continue;let c=n.Reduce("assigned").Visualize(),m=n.Reduce("created").Visualize();o.push({invite_id:typeof t=="string"?t:t.Visualize(),mode:n.Reduce("mode").Visualize(),assigned:c==="%%NIL"?"":c,created:m==="%%NIL"?"":m})}return o})}catch(e){throw r("list_invites",String(e))}}async function H(s,a){let e=d(s),{invite_id:i}=a;try{return await u(async o=>{let t=await l(e,"::a2a_messaging::revoke_invite",{invite_id:i},o),n=t.Reduce("was_public");return{revoked:t.Reduce("revoked").GetBoolean(),wasPublic:n.IsNil()?!1:n.GetBoolean()}})}catch(o){throw r("revoke_invite",String(o))}}async function J(s,a){let e=d(s),{invite:i,name:o}=a,t;try{if(t=B(i),t.length===0)throw new Error("the invite blob is empty")}catch(n){throw r("add_contact",n instanceof Error?n.message:"the invite blob is not valid.","INVITE_MALFORMED")}try{return await u(async n=>{let m={invite:e.pw.packet.NewBinaryFromBuffer(t).Attach(n)};o&&(m.name=o);let g=await l(e,"::a2a_messaging::add_contact",m,n),R=g.Reduce("container_id").Visualize(),v=g.Reduce("pending").Visualize(),h=g.Reduce("inviter_name").Visualize(),w=b=>!b||b==="%%NIL",G=w(v)?w(h)?R:h:v;return f(e),{display:G,cid:R}})}catch(n){throw r("add_contact",String(n))}}async function Q(s){let a=d(s);try{return y(e=>({contacts:C(p(a,"::a2a_messaging::list_contacts",e)),pending:x(p(a,"::actor::list_pending_introductions",e)),roots:I(p(a,"::a2a_messaging::list_contact_roots",e)),degraded:P(p(a,"::a2a_messaging::list_degraded_contacts",e)),renames:V(p(a,"::a2a_messaging::list_import_renames",e))}))}catch(e){throw r("list_contacts",String(e))}}async function X(s){let a=Object.values(N()),e=s.leaseToken(),i=e?k(e)?.identity:void 0;return a.map(o=>({name:o.name,container_id:o.container_id,published_at:o.published_at,isMine:o.name===i}))}async function Y(s,a){let e=d(s),{expose:i,auto_accept:o}=a;if(i===void 0&&o===void 0)throw j();let t=[];try{return o!==void 0&&(await u(async n=>{await l(e,"::actor::set_local_policy",{auto_accept:o},n)}),t.push(`auto_accept=${o}`)),i===!0?(await L(e),t.push("published in the local contact book")):i===!1&&(A(e),t.push("removed from the local contact book")),{identity:e.name,changes:t}}catch(n){throw r("set_local_book_policy",String(n))}}async function Z(s,a){let e=d(s),{contact:i}=a;try{return _.add(e.name),await u(async o=>{let t=await l(e,"::a2a_messaging::remove_contact",{contact:i},o),n=t.Reduce("removed").Visualize(),c=t.Reduce("container_id").Visualize(),m=t.Reduce("notified"),g=m.IsNil()?void 0:m.GetBoolean();return{name:n,cid:c,notified:g}})}catch(o){throw r("remove_contact",String(o))}finally{_.delete(e.name)}}async function ee(s,a){let e=d(s),{contact:i,name:o}=a;try{return await u(async t=>{let n=await l(e,"::a2a_messaging::rename_contact",{contact:i,name:o},t);return{from:n.Reduce("renamed").Visualize(),cid:n.Reduce("container_id").Visualize()}})}catch(t){throw r("rename_contact",String(t))}}async function te(s,a){let e=d(s),{contact:i,action:o}=a;try{if(o==="approve"){let t=await u(async n=>{let c=await l(e,"::actor::approve_introduction",{contact:i},n);return{action:"approve",name:c.Reduce("approved").Visualize(),cid:c.Reduce("container_id").Visualize(),flushed:c.Reduce("flushed").Visualize()}});return z(e),f(e),t}return await u(async t=>{let n=await l(e,"::actor::reject_introduction",{contact:i},t);return{action:"reject",name:n.Reduce("rejected").Visualize(),dropped:n.Reduce("dropped_messages").Visualize()}})}catch(t){throw r("respond_to_introduction",String(t))}}export{U as a,$ as b,H as c,J as d,Q as e,X as f,Y as g,Z as h,ee as i,te as j};
|
package/dist/client/http.d.ts
CHANGED
|
@@ -118,12 +118,14 @@ export declare class OursClient {
|
|
|
118
118
|
respondToIntroduction(a: Arg<typeof contactsApi.respondToIntroduction>): Promise<Res<typeof contactsApi.respondToIntroduction>>;
|
|
119
119
|
setBio(a: Arg<typeof profileApi.setBio>): Promise<Res<typeof profileApi.setBio>>;
|
|
120
120
|
advertiseMigrate(): Promise<Res<typeof profileApi.advertiseMigrate>>;
|
|
121
|
+
readvertiseOnUpgrade(): Promise<Res<typeof profileApi.readvertiseOnUpgrade>>;
|
|
121
122
|
setPersona(a: Arg<typeof profileApi.setPersona>): Promise<Res<typeof profileApi.setPersona>>;
|
|
122
123
|
sendMessage(a: Arg<typeof messagingApi.sendMessage>): Promise<Res<typeof messagingApi.sendMessage>>;
|
|
123
124
|
sendFile(a: Arg<typeof messagingApi.sendFile>): Promise<Res<typeof messagingApi.sendFile>>;
|
|
124
125
|
listIncomingMessages(): Promise<Res<typeof messagingApi.listIncomingMessages>>;
|
|
125
126
|
getMessages(): Promise<Res<typeof messagingApi.getMessages>>;
|
|
126
127
|
deferMessages(a: Arg<typeof messagingApi.deferMessages>): Promise<Res<typeof messagingApi.deferMessages>>;
|
|
128
|
+
deferFiles(a: Arg<typeof filesApi.deferFiles>): Promise<Res<typeof filesApi.deferFiles>>;
|
|
127
129
|
listIncomingFiles(): Promise<Res<typeof filesApi.listIncomingFiles>>;
|
|
128
130
|
getFiles(a?: Arg<typeof filesApi.getFiles>): Promise<Res<typeof filesApi.getFiles>>;
|
|
129
131
|
/**
|
package/dist/client/http.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"../chunk-
|
|
2
|
+
import{a}from"../chunk-Q3RMTP4Y.js";import"../chunk-UM73BGFH.js";export{a as OursClient};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Why a selection was refused. These are client-side configuration errors, NOT
|
|
3
|
+
* tool errors: they are deliberately outside `OursErrorCode`, whose contents are
|
|
4
|
+
* pinned to the ours-mcp baseline.
|
|
5
|
+
*/
|
|
6
|
+
export type DaemonSelectionErrorCode =
|
|
7
|
+
/** The fields were individually valid but combine into a credential hazard. */
|
|
8
|
+
'INCOHERENT_SELECTION'
|
|
9
|
+
/** A config file was named and could not be read. */
|
|
10
|
+
| 'CONFIG_UNREADABLE'
|
|
11
|
+
/** A config file was read and does not say what it must. */
|
|
12
|
+
| 'CONFIG_INVALID';
|
|
13
|
+
export declare class DaemonSelectionError extends Error {
|
|
14
|
+
readonly code: DaemonSelectionErrorCode;
|
|
15
|
+
constructor(code: DaemonSelectionErrorCode, message: string);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Where a resolved field came from. `token-file` is the daemon's own last resort:
|
|
19
|
+
* `<stateDir>/daemon-token`, written 0600 by the daemon in `owner` visibility.
|
|
20
|
+
*/
|
|
21
|
+
export type DaemonConfigSource = "explicit" | "environment" | "config-file" | "token-file" | "default";
|
|
22
|
+
export interface ResolvedValue<T> {
|
|
23
|
+
readonly value: T;
|
|
24
|
+
readonly source: DaemonConfigSource;
|
|
25
|
+
}
|
|
26
|
+
/** The subset of `~/.ours/config.json` this client understands. Every key is optional. */
|
|
27
|
+
export interface DaemonConfigFile {
|
|
28
|
+
readonly port?: number;
|
|
29
|
+
readonly stateDir?: string;
|
|
30
|
+
readonly apiToken?: string;
|
|
31
|
+
readonly apiVisibility?: "owner" | "shared" | "open";
|
|
32
|
+
}
|
|
33
|
+
export interface ResolveDaemonConfigOptions {
|
|
34
|
+
/** Full base URL of a running daemon, e.g. `http://127.0.0.1:3070`. Wins over `port`. */
|
|
35
|
+
readonly endpoint?: string;
|
|
36
|
+
readonly port?: number;
|
|
37
|
+
readonly stateDir?: string;
|
|
38
|
+
/** API token. Prefer a secret store; this value is never logged or embedded in errors. */
|
|
39
|
+
readonly token?: string;
|
|
40
|
+
/** Path to a daemon config file. Never inferred — see `configPath` in the README. */
|
|
41
|
+
readonly configPath?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The state directory the daemon must report. Counts as an intentional state-directory
|
|
44
|
+
* selection, and is what gets asserted before the first authenticated request.
|
|
45
|
+
*/
|
|
46
|
+
readonly expectStateDir?: string;
|
|
47
|
+
/** Refuse every defaulted auth-affecting field. Fails before any file read or network I/O. */
|
|
48
|
+
readonly requireExplicitSelection?: boolean;
|
|
49
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
50
|
+
/** Seam for tests. Must throw when the file is absent. */
|
|
51
|
+
readonly readTextFile?: (path: string) => string;
|
|
52
|
+
readonly homeDir?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface ResolvedDaemonConfig {
|
|
55
|
+
readonly baseUrl: ResolvedValue<string>;
|
|
56
|
+
readonly port: ResolvedValue<number>;
|
|
57
|
+
readonly stateDir: ResolvedValue<string>;
|
|
58
|
+
/**
|
|
59
|
+
* The state directory the daemon must report, asserted before the first authenticated
|
|
60
|
+
* request. Always present: a resolution that could not bind one fails instead of resolving.
|
|
61
|
+
*/
|
|
62
|
+
readonly expectStateDir: string;
|
|
63
|
+
/** Absent when the daemon runs with `apiVisibility: "open"` and no token is discoverable. */
|
|
64
|
+
readonly token?: ResolvedValue<string>;
|
|
65
|
+
readonly configPath?: ResolvedValue<string>;
|
|
66
|
+
}
|
|
67
|
+
export declare const DEFAULT_DAEMON_PORT: number;
|
|
68
|
+
export declare const DAEMON_TOKEN_FILE = "daemon-token";
|
|
69
|
+
/**
|
|
70
|
+
* Resolves how to reach an already-running daemon.
|
|
71
|
+
*
|
|
72
|
+
* Precedence per field is `explicit > environment > config file > default`, mirroring the
|
|
73
|
+
* daemon's own resolver so the client and the daemon can never disagree about which daemon
|
|
74
|
+
* a given shell selects.
|
|
75
|
+
*
|
|
76
|
+
* ## Selection must be coherent before any credential is read
|
|
77
|
+
*
|
|
78
|
+
* A daemon's API token is a real credential. Reading one selection's token and sending it to a
|
|
79
|
+
* different selection's endpoint is credential disclosure, so the two must come from the same
|
|
80
|
+
* deliberate act:
|
|
81
|
+
*
|
|
82
|
+
* - Selecting an endpoint or port **cannot** be combined with a defaulted state directory. Name
|
|
83
|
+
* the state directory too (`stateDir`, `expectStateDir`, `OURS_STATE_DIR`, or one config file).
|
|
84
|
+
* - `OURS_API_TOKEN` requires an intentional state directory as well; choosing an endpoint alone
|
|
85
|
+
* is not enough to justify sending an operator's token to it.
|
|
86
|
+
* - The token file `<stateDir>/daemon-token` is read only when that state directory was chosen,
|
|
87
|
+
* or under the wholly default selection.
|
|
88
|
+
* - Validation completes **before** any file read and before any network request, so an
|
|
89
|
+
* incoherent selection never touches `~/.ours` at all.
|
|
90
|
+
*
|
|
91
|
+
* The wholly default selection (port 3050, `~/.ours`, its token file) stays ergonomic and keeps
|
|
92
|
+
* working, and its state directory is asserted against the daemon like any other.
|
|
93
|
+
*
|
|
94
|
+
* Two further deliberate differences from the daemon's own resolver:
|
|
95
|
+
*
|
|
96
|
+
* 1. A config file is read only when `configPath` is given or `OURS_CONFIG` is set. This client
|
|
97
|
+
* never reads `~/.ours/config.json` implicitly.
|
|
98
|
+
* 2. `OURS_INSTANCE` is rejected rather than ignored. Named daemon instances are a planned
|
|
99
|
+
* daemon-side feature; silently ignoring the variable is exactly how a caller ends up
|
|
100
|
+
* talking to the wrong daemon.
|
|
101
|
+
*/
|
|
102
|
+
export declare function resolveDaemonConfig(options?: ResolveDaemonConfigOptions): ResolvedDaemonConfig;
|
|
103
|
+
/** A redacted, loggable view of a resolution. It reports token *provenance*, never the token. */
|
|
104
|
+
export declare function describeDaemonConfig(config: ResolvedDaemonConfig): Record<string, unknown>;
|
|
105
|
+
export declare function assertDaemonStateDir(config: ResolvedDaemonConfig, opts?: {
|
|
106
|
+
fetch?: typeof globalThis.fetch;
|
|
107
|
+
timeoutMs?: number;
|
|
108
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f}from"../chunk-IDH22QWU.js";import"../chunk-IB2U7K6Y.js";export{c as DAEMON_TOKEN_FILE,b as DEFAULT_DAEMON_PORT,a as DaemonSelectionError,f as assertDaemonStateDir,e as describeDaemonConfig,d as resolveDaemonConfig};
|
package/dist/cluster/control.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"../chunk-
|
|
2
|
+
import{a,b,c,d}from"../chunk-5KLD4UEC.js";import"../chunk-CQHF2R3K.js";import"../chunk-I7PZGGZC.js";import"../chunk-24CAAXRA.js";import"../chunk-F7XVNQTN.js";import"../chunk-DIRW7I4S.js";import"../chunk-YRPUM6JG.js";import"../chunk-LKFYUCN7.js";import"../chunk-UJGRFV4J.js";import"../chunk-P55RJGZU.js";import"../chunk-7WVDNFDY.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{b as PROTOCOL_VERSION,c as clusterSweep,a as envelopeDispatch,d as startClusterSweep};
|
package/dist/cluster/manifest.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"../chunk-
|
|
2
|
+
import{a,b,c,d}from"../chunk-CQHF2R3K.js";import"../chunk-I7PZGGZC.js";import"../chunk-24CAAXRA.js";import"../chunk-F7XVNQTN.js";import"../chunk-DIRW7I4S.js";import"../chunk-YRPUM6JG.js";import"../chunk-LKFYUCN7.js";import"../chunk-UJGRFV4J.js";import"../chunk-P55RJGZU.js";import"../chunk-7WVDNFDY.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{b as buildManifest,d as findAgentOf,c as listAgentsFor,a as manifestCapabilities};
|
package/dist/connector.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as ne}from"./chunk-5EWCIQH6.js";import{mkdirSync as te,writeFileSync as Te,readFileSync as ve,readdirSync as ke,statSync as j,unlinkSync as Oe,chmodSync as se,createWriteStream as Me}from"node:fs";import{join as x,dirname as Ie,resolve as Ae}from"node:path";import{homedir as Ee}from"node:os";import{Readable as xe}from"node:stream";import{pipeline as De}from"node:stream/promises";var $e="0.1.
|
|
2
|
+
import{a as ne}from"./chunk-5EWCIQH6.js";import{mkdirSync as te,writeFileSync as Te,readFileSync as ve,readdirSync as ke,statSync as j,unlinkSync as Oe,chmodSync as se,createWriteStream as Me}from"node:fs";import{join as x,dirname as Ie,resolve as Ae}from"node:path";import{homedir as Ee}from"node:os";import{Readable as xe}from"node:stream";import{pipeline as De}from"node:stream/promises";var $e="0.1.2",Ne=new Set(["choose_identity","create_identity","create_root_identity"]),Ue="save_file",Le="get_files",re=a=>new Promise(g=>setTimeout(g,a)),V=a=>typeof a?.method=="string"&&a.id!==void 0&&a.id!==null,Ce=a=>a&&typeof a=="object"&&!("method"in a)&&a.id!==void 0&&a.id!==null,oe=a=>{let g=a.result;return!!a.error||!!(g&&g.isError)},ie=Number(process.env.OURS_RESTORE_TTL_MS)>0?Number(process.env.OURS_RESTORE_TTL_MS):7*24*60*60*1e3,ae=["1","true","yes","on"].includes((process.env.OURS_NO_AUTORESTORE??"").trim().toLowerCase());async function ze(a){let g=new URL(a.url),i=(...e)=>process.stderr.write(`[ours-proxy] ${e.join(" ")}
|
|
3
3
|
`),z=e=>Number.isInteger(e)&&e>1,q=Number(process.env.OURS_CLIENT_PID),G=z(q)?q:z(process.ppid)?process.ppid:process.pid,B=(process.env.CLAUDE_CODE_SESSION_ID??"").trim()||`client:${G}`,w=null,M=null,$,f=null,I=new Map,N=new Set,_=null,S=ae?null:(process.env.CLAUDE_CODE_SESSION_ID??"").trim()||null,ce=a.stateDir??process.env.OURS_STATE_DIR??x(Ee(),".ours"),R=x(ce,"session-restore"),W=S&&/^[A-Za-z0-9._-]{1,200}$/.test(S)?S:null,y=W?x(R,`${W}.json`):null,Q=!1,U=null;function de(e){if(y)try{te(R,{recursive:!0,mode:448}),Te(y,JSON.stringify({claudeSessionId:S,identity:e,boundAt:new Date().toISOString()}),{mode:384}),se(R,448),se(y,384)}catch(t){i("restore persist failed (non-fatal):",String(t))}}function ue(){if(!y)return null;try{if(Date.now()-j(y).mtimeMs>ie)return null;let e=JSON.parse(ve(y,"utf8"));return(typeof e.identity=="string"?e.identity.trim():"")||null}catch{return null}}function le(){try{let e=Date.now();for(let t of ke(R)){if(!t.endsWith(".json"))continue;let n=x(R,t);try{e-j(n).mtimeMs>ie&&(Oe(n),i("session-restore: pruned expired record",t))}catch{}}}catch{}}let b=(()=>{let e=(process.env.OURS_REQUEST_TIMEOUT_MS??"").trim();if(e==="")return 12e4;let t=Number(e);return Number.isFinite(t)&&t>=0?t:12e4})(),p=new Map,A=new Map;function L(e,t,n){let o=p.get(e);if(!o)return;p.delete(e),o.progressToken!==void 0&&A.delete(o.progressToken);let s=Date.now()-o.sentAt;i(`FAILING BACK request id=${String(e)} method=${o.method} waited_ms=${s} reason=${n}`),m.send({jsonrpc:"2.0",id:e,error:{code:t,message:`ours proxy: no response from the ours daemon for "${o.method}" after ${s}ms (${n}). The request was NOT retried \u2014 retry it yourself if it is safe to repeat.`,data:{reason:n,method:o.method,waitedMs:s}}}).catch(r=>i("fail-back send failed:",String(r)))}b>0&&setInterval(()=>{let t=Date.now();for(let[n,o]of[...p])o.deadline<=t&&L(n,-32001,"watchdog timeout")},1e3).unref?.();let fe=6e4,X=3,C=0,h=0;function pe(e,t){m.send({jsonrpc:"2.0",method:"notifications/message",params:{level:e,logger:"ours-proxy",data:t}}).catch(n=>i("downstream notify failed:",String(n)))}let l=null,me=()=>l,E=!1,T=!1,v=!1,k=[],ge="__ours_proxy_init__",P=0,O=new Set,J=new Set,m=a.transports.createStdioServer();m.onmessage=e=>{let t=[],n=!1;for(let o of D(e)){let s=o;if(s.method==="notifications/initialized"&&(n=!0),V(s)){if(s.method==="initialize"&&(w=s,M)){i("absorbed re-initialize locally \u2014 upstream session kept stable"),m.send({jsonrpc:"2.0",id:s.id,result:M}).catch(r=>i("local initialize reply failed:",String(r)));continue}if(s.method==="tools/call"){let r=s.params;if(r&&Ne.has(r.name??"")&&typeof r.arguments?.name=="string"&&I.set(s.id,r.arguments.name),r?.name===Le&&N.add(s.id),r?.name===Ue){let c=s.params?.arguments??{};we(s.id,c);continue}}if(b>0){let r=s.id,c=s.params?._meta,d=Date.now();p.set(r,{method:typeof s.method=="string"?s.method:"unknown",sentAt:d,deadline:d+b,transport:null,progressToken:c?.progressToken}),c?.progressToken!==void 0&&A.set(c.progressToken,r)}}t.push(s)}if(t.length){let o=Array.isArray(e)?t:t[0];Y(o)}n&&ye()},m.onclose=()=>void H(0),m.onerror=e=>i("downstream error:",String(e));function ye(){if(Q||!f)return;Q=!0;let e=`__ours_proxy_restore_${++P}__`;O.add(e),U=e,i("session-restore: self-recovering bound identity",`"${f}"`),Y({jsonrpc:"2.0",id:e,method:"tools/call",params:{name:"choose_identity",arguments:{name:f}}})}function he(e,t){if(!(b<=0))for(let n of D(e)){let o=n.id;if(o===void 0)continue;let s=p.get(o);s&&(s.transport=t)}}async function we(e,t){let n=String(t.wire_id??"").trim(),o=String(t.dest_path??"").trim(),s=(r,c=!1)=>m.send({jsonrpc:"2.0",id:e,result:{content:[{type:"text",text:r}],isError:c}}).catch(d=>i("save_file reply failed:",String(d)));if(!n||!o){await s("save_file: both `wire_id` and `dest_path` are required.",!0);return}if(!/^[A-Za-z0-9]+$/.test(n)){await s("save_file: invalid wire_id.",!0);return}try{let r=new URL(g.href);r.pathname=`/files/${encodeURIComponent(n)}`,r.search="";let c={"x-ours-lease-token":B};a.apiToken&&(c["x-ours-api-token"]=a.apiToken);let d=await fetch(r,{headers:c});if(d.status===401||d.status===403){await s("save_file: ours daemon authentication failed; the monitor may be disarmed.",!0);return}if(d.status===404){await s(`save_file: no file with wire_id ${n} is available to the bound identity. Run get_files first; it may already be saved, or it belongs to another identity.`,!0);return}if(!d.ok||!d.body){await s(`save_file: ours daemon returned HTTP ${d.status}. Your ours daemon may be too old to support save_file \u2014 update it, or use get_files and copy the returned path yourself.`,!0);return}let u=Ae(o);te(Ie(u),{recursive:!0}),await De(xe.fromWeb(d.body),Me(u));let be=j(u).size;await s(`Saved file (wire_id ${n}) to ${u} (${be} bytes). The bytes were streamed daemon\u2192proxy\u2192disk and never entered this result.`)}catch(r){await s(`save_file failed: ${String(r)}`,!0)}}function Y(e){if(E&&l){let t=l;he(e,t),l.send(e).catch(n=>{i("upstream send failed:",String(n));let o=D(e),s=o.filter(r=>!V(r));s.length&&k.push(Array.isArray(e)?s:s[0]);for(let r of o){let c=r;V(c)&&p.has(c.id)&&L(c.id,-32e3,"upstream send failed")}F(t,"send failed")})}else k.push(e)}function F(e,t){if(T||v||l!==null&&e!==l)return;i(`upstream dropped (${t}) \u2014 reconnecting`),E=!1;let n=l;l=null;try{n?.close?.()}catch{}if(n)for(let[o,s]of[...p])s.transport===n&&L(o,-32e3,`upstream dropped (${t})`);Se()}function _e(e){e.onmessage=t=>{let n=[];for(let o of D(t)){let s=o;if(s.method==="notifications/progress"){let r=s.params?.progressToken;if(r!==void 0){let c=A.get(r),d=c!==void 0?p.get(c):void 0;d&&(d.deadline=Date.now()+b)}}if(Ce(s)){let r=s.id,c=p.get(r);c&&(p.delete(r),c.progressToken!==void 0&&A.delete(c.progressToken));let d=s.result?.protocolVersion;if(d&&(J.has(r)||Z(r))){$=d;try{l?.setProtocolVersion?.(d)}catch{}if(M==null&&Z(r)&&!O.has(r)){let u=s.result??null;u&&_&&(u.instructions=`${u.instructions?u.instructions+`
|
|
4
4
|
|
|
5
5
|
`:""}${_}`),M=u}J.delete(r)}if(O.has(r)){O.delete(r),r===U&&(U=null,oe(s)&&(f=null,i("session-restore: re-bind refused (identity live elsewhere) \u2014 staying unbound")));continue}if(N.has(r)&&(N.delete(r),a.annotateResult?.(s)&&i("get_files: daemon copy unreadable by this OS user \u2014 asked the agent for a destination")),I.has(r)){let u=I.get(r);I.delete(r),oe(s)||(f=u,i("bound identity tracked:",u),de(u))}}n.push(s)}if(n.length){let o=Array.isArray(t)?n:n[0];m.send(o).catch(s=>i("downstream send failed:",String(s)))}},e.onerror=t=>{let n=String(t);if(i("upstream error:",n),!/Maximum reconnection attempts \(\d+\) exceeded/.test(n))return;let o=Date.now();if(o-C<fe){i(`notification stream exhausted again within cooldown \u2014 not escalating (${Math.round((o-C)/1e3)}s since last)`);return}if(C=o,h++,h>X){i(`NOTIFICATION STREAM DEAD \u2014 ${h-1} reconnect escalations exhausted; server\u2192client notifications are NOT arriving`),pe("error",`ours proxy: the server\u2192client notification stream could not be re-established after ${h-1} attempts. Tool calls still work, but you will NOT receive new-mail or other server notifications until this session reconnects. Treat any "waiting for a message" as unreliable.`);return}i(`notification stream exhausted its retries \u2014 escalating to a full reconnect (${h}/${X})`),F(e,"notification stream exhausted")},e.onclose=()=>F(e,"closed")}let Z=e=>w!=null&&w.id===e;async function K(){a.ensureDaemon&&await a.ensureDaemon().catch(t=>i("ensureDaemon:",String(t)));let e=a.transports.createHttpClient(g,{reconnectionOptions:{initialReconnectionDelay:1e3,maxReconnectionDelay:3e4,reconnectionDelayGrowFactor:1.5,maxRetries:5},requestInit:{headers:{"x-ours-lease-token":B,"x-ours-client-pid":String(G),...a.apiToken?{"x-ours-api-token":a.apiToken}:{}}}});if(_e(e),await e.start(),$)try{e.setProtocolVersion?.($)}catch{}l=e}async function ee(e,t){t&&e.id!==void 0&&O.add(e.id),await l.send(e)}async function Se(){if(v||T)return;v=!0;let e=500;for(;;){if(T){v=!1;return}try{if(await K(),w){let n=`${ge}${P}`;J.add(n),await ee({...w,id:n},!0),await l.send({jsonrpc:"2.0",method:"notifications/initialized"})}if(f){let n=`__ours_proxy_rebind_${++P}__`;await ee({jsonrpc:"2.0",id:n,method:"tools/call",params:{name:"choose_identity",arguments:{name:f}}},!0)}E=!0;let t=k.splice(0);for(let n of t)await l.send(n).catch(o=>i("flush failed:",String(o)));i("upstream reconnected",f?`(re-bound "${f}")`:""),h=0,v=!1;return}catch(t){i("reconnect attempt failed:",String(t)),await re(e),e=Math.min(Math.floor(e*1.5),1e4)}}}async function H(e){if(!T){T=!0;try{await l?.close()}catch{}try{await m.close()}catch{}process.exit(e)}}process.on("SIGINT",()=>void H(0)),process.on("SIGTERM",()=>void H(0)),process.on("unhandledRejection",e=>{i("UNHANDLED REJECTION (proxy stays up):",e instanceof Error?e.stack??e.message:String(e))}),process.on("uncaughtException",e=>{i("UNCAUGHT EXCEPTION (proxy stays up):",e?.stack??String(e))});async function Re(){let e=new URL(g.href);e.pathname="/state-dir";let t;try{t=await(await fetch(e,{signal:AbortSignal.timeout(3e3)})).json()}catch(n){i("compat handshake: could not read daemon /state-dir, proceeding:",String(n));return}_=ne({selfVersion:$e,daemonVersion:typeof t?.version=="string"?t.version:null}),_&&i(_)}if((async()=>{a.ensureDaemon&&await a.ensureDaemon().catch(n=>i("ensureDaemon:",String(n))),await Re();let e=500;for(;;)try{await K();break}catch(n){i("initial upstream connect failed, retrying:",String(n)),await re(e),e=Math.min(Math.floor(e*1.5),1e4)}E=!0;let t=k.splice(0);for(let n=0;n<t.length;n++){let o=me();if(!o){k.unshift(...t.slice(n));break}await o.send(t[n]).catch(s=>i("flush failed:",String(s)))}i(`upstream ready \u2014 stdio \u21C4 ${g.href}`)})(),S){le();let e=ue();e&&(f=e,i("session-restore: found prior binding for this session \u2014 will self-recover",`"${e}"`))}else ae&&i("session-restore: disabled via OURS_NO_AUTORESTORE \u2014 pure in-memory binding");await m.start(),i("proxy started (stdio transport up)")}function D(a){return Array.isArray(a)?a:[a]}export{ze as runProxy};
|
package/dist/daemon.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as e}from"./chunk-
|
|
2
|
+
import{a as e}from"./chunk-JBE32TUA.js";import"./chunk-37D5PCFY.js";import"./chunk-V64IUVSS.js";import"./chunk-2KWZSE4A.js";import"./chunk-6DWYNPOV.js";import"./chunk-WXLUTSLB.js";import"./chunk-D5YFXZW5.js";import"./chunk-H5B5DI4B.js";import"./chunk-R3G5PNQ5.js";import"./chunk-DOCQLFOH.js";import"./chunk-ACGHUOXF.js";import"./chunk-UM73BGFH.js";import{a as t}from"./chunk-7Y3J4YEY.js";import"./chunk-APFH6XJH.js";import"./chunk-5KLD4UEC.js";import"./chunk-CQHF2R3K.js";import"./chunk-I7PZGGZC.js";import"./chunk-24CAAXRA.js";import"./chunk-F7XVNQTN.js";import"./chunk-DIRW7I4S.js";import"./chunk-YRPUM6JG.js";import"./chunk-LKFYUCN7.js";import"./chunk-UJGRFV4J.js";import"./chunk-P55RJGZU.js";import"./chunk-7WVDNFDY.js";import"./chunk-F3A5QXT2.js";import{h as r}from"./chunk-CKRHELVR.js";import"./chunk-ZHH3PWEW.js";import"./chunk-IB2U7K6Y.js";export{t as bootWrapper,e as startDaemon,r as startupProgress};
|
package/dist/gc.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b}from"./chunk-
|
|
2
|
+
import{a,b}from"./chunk-2KWZSE4A.js";import"./chunk-24CAAXRA.js";import"./chunk-F7XVNQTN.js";import"./chunk-DIRW7I4S.js";import"./chunk-YRPUM6JG.js";import"./chunk-LKFYUCN7.js";import"./chunk-UJGRFV4J.js";import"./chunk-P55RJGZU.js";import"./chunk-7WVDNFDY.js";import"./chunk-F3A5QXT2.js";import"./chunk-CKRHELVR.js";import"./chunk-ZHH3PWEW.js";import"./chunk-IB2U7K6Y.js";export{a as startGcTimer,b as stopGcTimer};
|
|
@@ -34,12 +34,14 @@ export declare const API_OPERATIONS: {
|
|
|
34
34
|
respondToIntroduction: ApiHandler;
|
|
35
35
|
setBio: ApiHandler;
|
|
36
36
|
advertiseMigrate: ApiHandler;
|
|
37
|
+
readvertiseOnUpgrade: ApiHandler;
|
|
37
38
|
setPersona: ApiHandler;
|
|
38
39
|
sendMessage: ApiHandler;
|
|
39
40
|
sendFile: ApiHandler;
|
|
40
41
|
listIncomingMessages: ApiHandler;
|
|
41
42
|
getMessages: ApiHandler;
|
|
42
43
|
deferMessages: ApiHandler;
|
|
44
|
+
deferFiles: ApiHandler;
|
|
43
45
|
listIncomingFiles: ApiHandler;
|
|
44
46
|
getFiles: ApiHandler;
|
|
45
47
|
saveFileFallbackNotice: ApiHandler;
|
package/dist/http/api-routes.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"../chunk-
|
|
2
|
+
import{a,b,c,d}from"../chunk-6DWYNPOV.js";import"../chunk-WXLUTSLB.js";import"../chunk-D5YFXZW5.js";import"../chunk-H5B5DI4B.js";import"../chunk-R3G5PNQ5.js";import"../chunk-DOCQLFOH.js";import"../chunk-ACGHUOXF.js";import"../chunk-UM73BGFH.js";import"../chunk-APFH6XJH.js";import"../chunk-5KLD4UEC.js";import"../chunk-CQHF2R3K.js";import"../chunk-I7PZGGZC.js";import"../chunk-24CAAXRA.js";import"../chunk-F7XVNQTN.js";import"../chunk-DIRW7I4S.js";import"../chunk-YRPUM6JG.js";import"../chunk-LKFYUCN7.js";import"../chunk-UJGRFV4J.js";import"../chunk-P55RJGZU.js";import"../chunk-7WVDNFDY.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{b as API_OPERATIONS,a as API_PREFIX,c as enterApiSession,d as serveApiOperation};
|
package/dist/http/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a}from"../chunk-
|
|
2
|
+
import{a}from"../chunk-JBE32TUA.js";import"../chunk-37D5PCFY.js";import"../chunk-V64IUVSS.js";import"../chunk-2KWZSE4A.js";import"../chunk-6DWYNPOV.js";import"../chunk-WXLUTSLB.js";import"../chunk-D5YFXZW5.js";import"../chunk-H5B5DI4B.js";import"../chunk-R3G5PNQ5.js";import"../chunk-DOCQLFOH.js";import"../chunk-ACGHUOXF.js";import"../chunk-UM73BGFH.js";import"../chunk-7Y3J4YEY.js";import"../chunk-APFH6XJH.js";import"../chunk-5KLD4UEC.js";import"../chunk-CQHF2R3K.js";import"../chunk-I7PZGGZC.js";import"../chunk-24CAAXRA.js";import"../chunk-F7XVNQTN.js";import"../chunk-DIRW7I4S.js";import"../chunk-YRPUM6JG.js";import"../chunk-LKFYUCN7.js";import"../chunk-UJGRFV4J.js";import"../chunk-P55RJGZU.js";import"../chunk-7WVDNFDY.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{a as startDaemon};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g}from"../chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g}from"../chunk-I7PZGGZC.js";import"../chunk-24CAAXRA.js";import"../chunk-F7XVNQTN.js";import"../chunk-DIRW7I4S.js";import"../chunk-YRPUM6JG.js";import"../chunk-LKFYUCN7.js";import"../chunk-UJGRFV4J.js";import"../chunk-P55RJGZU.js";import"../chunk-7WVDNFDY.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{d as clearRootMarker,f as delegateRole,e as describeIdentity,g as establishRoot,c as readRootMarker,b as rootName,a as setRootName};
|
package/dist/identity/lease.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i}from"../chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i}from"../chunk-7WVDNFDY.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{i as bindSession,f as leaseByToken,a as leases,d as outboundRemovalInFlight,g as persistBindings,e as pidAlive,h as resolveBound,c as sessionHeaders,b as tombstones};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"../chunk-
|
|
2
|
+
import{a,b,c,d}from"../chunk-APFH6XJH.js";import"../chunk-I7PZGGZC.js";import"../chunk-24CAAXRA.js";import"../chunk-F7XVNQTN.js";import"../chunk-DIRW7I4S.js";import"../chunk-YRPUM6JG.js";import"../chunk-LKFYUCN7.js";import"../chunk-UJGRFV4J.js";import"../chunk-P55RJGZU.js";import"../chunk-7WVDNFDY.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{b as closeTemporaryIdentity,a as deleteIdentityCompletely,d as sweepOrphanTempDirs,c as sweepStaleTempIdentities};
|
package/dist/identity/model.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w}from"../chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w}from"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{u as FILE_SELECTION_CAP,j as dataPath,m as filesDirFor,v as findIdentityFile,o as hashLeaseToken,c as identities,h as identityDir,t as isSelectableWireId,s as isWireId,i as keyPath,w as listPersistedNames,k as notifyLogPath,q as readTempMetaFile,d as registrar,e as registrarAdBlob,f as setRegistrar,g as setRegistrarAdBlob,b as setWrapper,n as tempMetaPath,r as tightenIdentityPerms,l as unreadPath,a as wrapper,p as writeTempMetaFile};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{w as a,x as b,y as c,z as d}from"../chunk-
|
|
2
|
+
import{w as a,x as b,y as c,z as d}from"../chunk-24CAAXRA.js";import"../chunk-F7XVNQTN.js";import"../chunk-DIRW7I4S.js";import"../chunk-YRPUM6JG.js";import"../chunk-LKFYUCN7.js";import"../chunk-UJGRFV4J.js";import"../chunk-P55RJGZU.js";import"../chunk-7WVDNFDY.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{a as createPacket,c as provisionIdentity,b as reservedNames,d as restoreIdentity};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as
|
|
2
|
+
import{a as So}from"./chunk-Q3RMTP4Y.js";import{a as To,b as bo,c as co,d as go,e as ho,f as ko}from"./chunk-IDH22QWU.js";import{a as lo}from"./chunk-5EWCIQH6.js";import{a as oo,b as ro,c as po,d as eo,e as to,f as fo,g as mo,h as xo,i as Eo,j as so}from"./chunk-WXLUTSLB.js";import{a as yo,b as Co,c as Io,d as Lo}from"./chunk-D5YFXZW5.js";import{a as _o,b as ao,c as io,d as jo,e as Ao}from"./chunk-H5B5DI4B.js";import"./chunk-R3G5PNQ5.js";import{a as Fo,b as No,c as Oo,d as Po}from"./chunk-DOCQLFOH.js";import{a as K,b as M,c as Q,d as R,e as U,f as V,g as W,h as X,i as Y,j as Z,k as $}from"./chunk-ACGHUOXF.js";import{A as q,B as u,C as v,D as w,E as z,F as B,G as D,H as G,I as H,J,a as x,b as E,c as s,d as y,e as C,f as I,g as L,h as _,i as a,j as i,k as j,l as A,m as F,n as N,o as O,p as P,q as S,r as T,s as b,t as c,u as d,v as g,w as h,x as k,y as l,z as n}from"./chunk-UM73BGFH.js";import"./chunk-APFH6XJH.js";import"./chunk-5KLD4UEC.js";import"./chunk-CQHF2R3K.js";import"./chunk-I7PZGGZC.js";import"./chunk-24CAAXRA.js";import"./chunk-F7XVNQTN.js";import"./chunk-DIRW7I4S.js";import"./chunk-YRPUM6JG.js";import"./chunk-LKFYUCN7.js";import{a as r,b as p,c as e,d as t,e as f,f as m}from"./chunk-UJGRFV4J.js";import"./chunk-P55RJGZU.js";import"./chunk-7WVDNFDY.js";import{u as o}from"./chunk-F3A5QXT2.js";import"./chunk-CKRHELVR.js";import"./chunk-ZHH3PWEW.js";import"./chunk-IB2U7K6Y.js";export{co as DAEMON_TOKEN_FILE,bo as DEFAULT_DAEMON_PORT,To as DaemonSelectionError,o as FILE_SELECTION_CAP,So as OursClient,x as OursError,r as VETOABLE_EVENTS,eo as addContact,No as advertiseMigrate,ko as assertDaemonStateDir,W as chooseIdentity,R as closeTemporaryIdentityOp,M as createIdentity,U as createRootIdentity,Q as createTemporaryIdentity,Y as currentIdentity,Lo as deferFiles,Ao as deferMessages,V as defineLocalIdentityFile,ho as describeDaemonConfig,f as emitDaemonEvent,m as emitDaemonNotification,s as errBindingReassigned,c as errBoundElsewhere,y as errBoundIdentityGone,G as errDuplicateId,v as errFileUnreadable,g as errIdentityClosedWithError,k as errIdentityPartiallyRemoved,B as errInvalidSelection,D as errMalformedId,I as errNameTaken,L as errNoLeaseHeaders,P as errNoLeaseToken,n as errNoPolicyArgs,z as errNoRoot,O as errNoSuchIdentity,E as errNotBound,i as errNotBoundNoName,j as errNotTemporary,N as errPathNotAbsolute,l as errPublicInviteNamed,_ as errRandomNameExhausted,a as errRootExists,h as errRootHasRoles,w as errSaveFileFallback,q as errSendFileArgs,u as errSendFileFilenameRequired,F as errTempClosedWithError,C as errTempClosingBound,S as errTempClosingChoose,A as errTempOwnedElsewhereClose,d as errTempOwnedElsewhereRemove,T as errTempOwnedLive,b as errTempStale,J as errTool,H as errUnknownOrStaleId,lo as formatVersionAdvisory,oo as generateInvite,Co as getFiles,jo as getMessages,t as isDefaultHandler,to as listContacts,X as listIdentities,yo as listIncomingFiles,io as listIncomingMessages,ro as listInvites,fo as listLocalContactBook,Po as readvertiseOnUpgrade,$ as releaseLease,xo as removeContact,Z as removeIdentity,Eo as renameContact,K as requireBound,e as resetDaemonEventHandlers,go as resolveDaemonConfig,so as respondToIntroduction,po as revokeInvite,Io as saveFileFallbackNotice,ao as sendFile,_o as sendMessage,Fo as setBio,p as setDaemonEventHandler,mo as setLocalBookPolicy,Oo as setPersona};
|
package/dist/messaging/send.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d}from"../chunk-
|
|
2
|
+
import{a,b,c,d}from"../chunk-R3G5PNQ5.js";import"../chunk-I7PZGGZC.js";import"../chunk-24CAAXRA.js";import"../chunk-F7XVNQTN.js";import"../chunk-DIRW7I4S.js";import"../chunk-YRPUM6JG.js";import"../chunk-LKFYUCN7.js";import"../chunk-UJGRFV4J.js";import"../chunk-P55RJGZU.js";import"../chunk-7WVDNFDY.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{a as findSibling,d as parseSendVerdict,c as sendViaLocalBook,b as sendViaSibling};
|
package/dist/mufl/handlers.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{v as a}from"../chunk-
|
|
2
|
+
import{v as a}from"../chunk-24CAAXRA.js";import"../chunk-F7XVNQTN.js";import"../chunk-DIRW7I4S.js";import"../chunk-YRPUM6JG.js";import"../chunk-LKFYUCN7.js";import"../chunk-UJGRFV4J.js";import"../chunk-P55RJGZU.js";import"../chunk-7WVDNFDY.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{a as wireHandlers};
|
package/dist/mufl/tx.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{E as a,F as b,G as c,H as d,I as e,J as f}from"../chunk-
|
|
2
|
+
import{E as a,F as b,G as c,H as d,I as e,J as f}from"../chunk-24CAAXRA.js";import"../chunk-F7XVNQTN.js";import"../chunk-DIRW7I4S.js";import"../chunk-YRPUM6JG.js";import"../chunk-LKFYUCN7.js";import"../chunk-UJGRFV4J.js";import"../chunk-P55RJGZU.js";import"../chunk-7WVDNFDY.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{e as enqueueMutation,f as mutatingTx,c as readonlyTx,d as withLock,a as withScope,b as withScopeAsync};
|
package/dist/mufl_code/8ED6356B41CC689C75DA3302AD7856058131661A6ABBAC961E71BA838D8C97A3.muflo
CHANGED
|
Binary file
|
package/dist/notify.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n}from"./chunk-24CAAXRA.js";import"./chunk-F7XVNQTN.js";import"./chunk-DIRW7I4S.js";import"./chunk-YRPUM6JG.js";import"./chunk-LKFYUCN7.js";import"./chunk-UJGRFV4J.js";import"./chunk-P55RJGZU.js";import"./chunk-7WVDNFDY.js";import"./chunk-F3A5QXT2.js";import"./chunk-CKRHELVR.js";import"./chunk-ZHH3PWEW.js";import"./chunk-IB2U7K6Y.js";export{g as appendNotifyLog,i as binHexField,b as clearNotifyHook,c as fireNotify,e as fireNotifyWaiters,d as notifyHooks,j as notifyLogSize,h as readE2eWireIds,k as readNotifyRange,m as refreshUnread,l as serveNotifications,a as setNotifyHook,n as unreadSummary,f as waitForNotify};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l}from"../chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"../chunk-F7XVNQTN.js";import"../chunk-DIRW7I4S.js";import"../chunk-P55RJGZU.js";import"../chunk-F3A5QXT2.js";import"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{l as adaptValueToJson,k as decodeWireBin,j as encodeWireBin,i as fmtContactRoot,h as renderContactRoots,a as renderContacts,d as renderFileMetadata,e as renderFiles,b as renderImportRenames,c as renderInbox,g as renderPending,f as writeIncomingFiles};
|
package/dist/runtime/env.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"../chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"../chunk-CKRHELVR.js";import"../chunk-ZHH3PWEW.js";import"../chunk-IB2U7K6Y.js";export{j as API_TOKEN,g as API_VISIBILITY,o as BOOK_DIR_NAME,d as BROKER_URL,b as CONFIG,f as GC_INTERVAL_MS,n as NAME_RE,e as PORT,c as STATE_DIR,a as VERSION,l as authOk,i as log,m as requireAuth,h as startupProgress,k as tokenFromReq,p as validateName};
|
package/dist/state.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{A as a,B as b,C as c,D as d}from"./chunk-
|
|
2
|
+
import{A as a,B as b,C as c,D as d}from"./chunk-24CAAXRA.js";import"./chunk-F7XVNQTN.js";import"./chunk-DIRW7I4S.js";import"./chunk-YRPUM6JG.js";import"./chunk-LKFYUCN7.js";import"./chunk-UJGRFV4J.js";import"./chunk-P55RJGZU.js";import"./chunk-7WVDNFDY.js";import"./chunk-F3A5QXT2.js";import"./chunk-CKRHELVR.js";import"./chunk-ZHH3PWEW.js";import"./chunk-IB2U7K6Y.js";export{a as ensureRegistrar,b as hasSavedState,c as saveState,d as saveStateFailClosed};
|
package/dist/sweeps.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{o as a,p as b,q as c,r as d,s as e,t as f,u as g}from"./chunk-
|
|
2
|
+
import{o as a,p as b,q as c,r as d,s as e,t as f,u as g}from"./chunk-24CAAXRA.js";import"./chunk-F7XVNQTN.js";import"./chunk-DIRW7I4S.js";import"./chunk-YRPUM6JG.js";import"./chunk-LKFYUCN7.js";import"./chunk-UJGRFV4J.js";import"./chunk-P55RJGZU.js";import"./chunk-7WVDNFDY.js";import"./chunk-F3A5QXT2.js";import"./chunk-CKRHELVR.js";import"./chunk-ZHH3PWEW.js";import"./chunk-IB2U7K6Y.js";export{e as capabilityReconcileSweep,d as contactRestoreSweep,g as e2eRecoverySweep,c as flushDeferredFor,b as renderDeferredQueues,a as renderDegraded,f as scheduleCapabilityReconcile};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ours.network/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "FSL-1.1-Apache-2.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"build": "node build.mjs",
|
|
33
33
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
34
34
|
"//test": "test/ux-strings.test.mjs is DELIBERATELY NOT CHAINED HERE: it is red by design until the split completes (687 of 1205 strings still missing — the test prints that number itself) and would make CI permanently red. The missing strings are MCP tool copy and CLI copy that belongs in ours-mcp; the gate only goes green in PR 2, with OURS_MCP_SPLIT pointing at the refactored ours-mcp. Please do not 'helpfully' add it before then.",
|
|
35
|
-
"test": "node build.mjs && bash scripts/test-receipts-mufl.sh && bash scripts/test-notifications-mufl.sh && bash scripts/test-contact-uniqueness-mufl.sh && bash scripts/test-temp-remove-me-mufl.sh && node test/mufl-integrity.test.mjs && node test/verbatim-moves.test.mjs && node test/errors.test.mjs && node test/validate-name.test.mjs && node test/locate-unit.test.mjs && node test/lease-unit.test.mjs && node test/tx-lock.test.mjs && node test/wire-handlers-integrity.test.mjs && node test/moved-blocks-integrity.test.mjs && node test/ux-literals.test.mjs && node test/dist-shared-state.test.mjs && node test/api-error-parity.test.mjs && node test/files-helpers.test.mjs && node test/inbox-encryption.test.mjs && node test/process-state.test.mjs && node test/startup-progress.test.mjs && node test/transcribe-detect.test.mjs && node test/transcribe-stt.test.mjs && node test/voice-setup-config.test.mjs && node test/mig1867-verify.test.mjs && node test/boot-smoke.test.mjs && node test/api-identity.test.mjs && node test/api-contacts.test.mjs && node test/api-messaging.test.mjs && node test/api-files.test.mjs && node test/daemon-routes.test.mjs && node test/notify-hook.test.mjs && node test/daemon-events.test.mjs && node test/cross-entry-singleton.test.mjs && node test/client-parity.test.mjs && node test/api-auth.test.mjs && node test/release-lease.test.mjs && node test/delegation-survives.test.mjs && node test/proxy-annotate-hook.test.mjs && node test/version-advisory.test.mjs && node test/session-restore.test.mjs && node test/loopback-bind.test.mjs && node test/port-visibility.test.mjs && node test/unread-http-api.test.mjs && node test/lease-binding.test.mjs"
|
|
35
|
+
"test": "node build.mjs && bash scripts/test-receipts-mufl.sh && bash scripts/test-notifications-mufl.sh && bash scripts/test-contact-uniqueness-mufl.sh && bash scripts/test-temp-remove-me-mufl.sh && node test/mufl-integrity.test.mjs && node test/verbatim-moves.test.mjs && node test/errors.test.mjs && node test/validate-name.test.mjs && node test/locate-unit.test.mjs && node test/lease-unit.test.mjs && node test/tx-lock.test.mjs && node test/wire-handlers-integrity.test.mjs && node test/moved-blocks-integrity.test.mjs && node test/ux-literals.test.mjs && node test/dist-shared-state.test.mjs && node test/api-error-parity.test.mjs && node test/files-helpers.test.mjs && node test/inbox-encryption.test.mjs && node test/process-state.test.mjs && node test/startup-progress.test.mjs && node test/transcribe-detect.test.mjs && node test/transcribe-stt.test.mjs && node test/voice-setup-config.test.mjs && node test/mig1867-verify.test.mjs && node test/boot-smoke.test.mjs && node test/api-identity.test.mjs && node test/api-contacts.test.mjs && node test/api-messaging.test.mjs && node test/api-files.test.mjs && node test/defer-files.test.mjs && node test/daemon-routes.test.mjs && node test/notify-hook.test.mjs && node test/daemon-events.test.mjs && node test/cross-entry-singleton.test.mjs && node test/client-parity.test.mjs && node test/daemon-selection.test.mjs && node test/api-auth.test.mjs && node test/release-lease.test.mjs && node test/delegation-survives.test.mjs && node test/proxy-annotate-hook.test.mjs && node test/version-advisory.test.mjs && node test/session-restore.test.mjs && node test/loopback-bind.test.mjs && node test/port-visibility.test.mjs && node test/unread-http-api.test.mjs && node test/lease-binding.test.mjs"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@adapt-toolkit/sdk": "0.10.12",
|
package/dist/chunk-3DQSMLVZ.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as m}from"./chunk-7UUFYO6G.js";import{J as c}from"./chunk-UM73BGFH.js";import{b as f,e as g,f as p}from"./chunk-HCIVLHKC.js";import{F as n,J as a}from"./chunk-NQQ4GSVI.js";import{c as u}from"./chunk-Q3UVLSCX.js";import{i as d}from"./chunk-HSVIKO4D.js";async function v(o,s){let e=m(o),{bio:i}=s;try{await n(async r=>{await a(e,"::a2a_messaging::set_my_bio",{bio:i},r)});let t=0;if(e.name===f){for(let r of u.values())if(r.name!==e.name&&g(r).rootCid===e.cid)try{await p(e,r),t+=1}catch(y){d(`failed to refresh root profile in role "${r.name}":`,String(y))}}return{identity:e.name,rolesRefreshed:t}}catch(t){throw c("set_bio",String(t))}}async function x(o){let s=m(o);try{return await n(async e=>{let i=await a(s,"::a2a_messaging::advertise_migrate",{},e);return{wasAdvertising:i.Reduce("was_advertising").Visualize()==="true",advertising:i.Reduce("advertising").Visualize()==="true",offers:parseInt(i.Reduce("offers_initiated").Visualize(),10)||0}})}catch(e){throw c("advertise_migrate",String(e))}}async function P(o,s){let e=m(o),{persona:i}=s;try{return await n(async t=>{await a(e,"::a2a_messaging::set_my_persona",{persona:i},t)}),{identity:e.name}}catch(t){throw c("set_persona",String(t))}}export{v as a,x as b,P as c};
|
package/dist/chunk-AJQIWYXG.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as s}from"./chunk-7UUFYO6G.js";import{F as h,G as F,H as x,I as y,J as a}from"./chunk-UM73BGFH.js";import{E as g,F as p,G as w,J as S,m as u}from"./chunk-NQQ4GSVI.js";import{d as f,f as m}from"./chunk-X4RVJ5VL.js";import{t as c,u as l,v as d}from"./chunk-Q3UVLSCX.js";async function T(n){let r=s(n);try{return g(t=>f(w(r,"::actor::list_incoming_files",t)))}catch(t){throw a("list_incoming_files",String(t))}}async function E(n,r={}){let t=s(n),{wire_ids:e}=r;if(e!==void 0){if(e.length<1||e.length>l)throw h(l);if(e.some(i=>!c(i)))throw F();if(new Set(e).size!==e.length)throw x()}try{let i=await p(async o=>{let _=await S(t,"::actor::get_files",e===void 0?{}:{wire_ids:e},o);return await m(t,_.Reduce("files"))});return u(t),{files:i.files,text:i.text,mode:e===void 0?"all_unread":"selected",requested:e??null}}catch(i){let o=String(i);throw e!==void 0&&/unknown, stale, or no longer unread/i.test(o)?y():a("get_files",o)}}function O(n,r){let t=s(n);return{existsOnDisk:d(t,r.wire_id)!==null}}export{T as a,E as b,O as c};
|
package/dist/chunk-UELGY557.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{a as O,b,c as w,d as F,e as T,f as N,g as L,h as H,i as B,j}from"./chunk-KZMPGVQM.js";import{a as E,b as J,c as _}from"./chunk-AJQIWYXG.js";import{a as $,b as V,c as X,d as q,e as z}from"./chunk-NSPYN5TT.js";import{a as D,b as G,c as K}from"./chunk-3DQSMLVZ.js";import{b as u,c as v,d as S,e as k,f as x,g as h,h as R,i as C,j as P,k as M}from"./chunk-7UUFYO6G.js";import{a as I}from"./chunk-UM73BGFH.js";import{c as d}from"./chunk-RAGUBE4Y.js";import{o as f}from"./chunk-Q3UVLSCX.js";import{i as m,m as y}from"./chunk-HSVIKO4D.js";var W="/api/v1/",t=i=>(e,n)=>i(e,n),s=i=>e=>i(e),Y=i=>(e,n)=>i(n),Q={createIdentity:t(u),createTemporaryIdentity:t(v),closeTemporaryIdentityOp:t(S),createRootIdentity:t(k),defineLocalIdentityFile:Y(x),chooseIdentity:t(h),listIdentities:s(R),currentIdentity:s(C),removeIdentity:t(P),releaseLease:s(M),generateInvite:t(O),listInvites:s(b),revokeInvite:t(w),addContact:t(F),listContacts:s(T),listLocalContactBook:s(N),setLocalBookPolicy:t(L),removeContact:t(H),renameContact:t(B),respondToIntroduction:t(j),setBio:t(D),advertiseMigrate:s(G),setPersona:t(K),sendMessage:t($),sendFile:t(V),listIncomingMessages:s(X),getMessages:s(q),deferMessages:t(z),listIncomingFiles:s(E),getFiles:t(J),saveFileFallbackNotice:t(_)},l=new Map,U=(i,e)=>{let n=i.headers[e];return typeof n=="string"&&n!==""?n:void 0};function Z(i){let e=U(i,"x-ours-lease-token"),n=U(i,"x-ours-client-pid"),A=n?parseInt(n,10):NaN,a=Number.isInteger(A)?A:void 0,o=e?`api:${f(e)}`:"api:anonymous";return d.set(o,{token:e,pid:a}),l.set(o,(l.get(o)??0)+1),{ctx:{sessionId:()=>o,leaseToken:()=>d.get(o)?.token,clientPid:()=>d.get(o)?.pid},release:()=>{let r=(l.get(o)??1)-1;if(r>0){l.set(o,r);return}l.delete(o),d.delete(o)}}}var c=(i,e,n)=>{i.writableEnded||(i.writeHead(e,{"Content-Type":"application/json"}),i.end(JSON.stringify(n??null)))};async function pe(i,e,n,A){let a=n.slice(W.length);if(!y(i,e))return;if(i.method!=="POST"){c(e,405,{error:"method not allowed: the typed API is POST-only"});return}let o=Object.prototype.hasOwnProperty.call(Q,a)?Q[a]:void 0;if(!o){c(e,404,{error:`unknown operation "${a}"`});return}let r;try{r=await A(i)}catch{c(e,400,{error:"the request body must be JSON"});return}if(r===null||typeof r!="object"||Array.isArray(r)){c(e,400,{error:"the request body must be a JSON object"});return}let g=Z(i);try{c(e,200,await o(g.ctx,r))}catch(p){if(p instanceof I){c(e,400,{error:{code:p.code,message:p.message}});return}m("api handler error:",a,String(p)),c(e,500,{error:`internal error in ${a}: ${String(p)}`})}finally{g.release()}}export{W as a,Q as b,Z as c,pe as d};
|