@ours.network/sdk 1.3.0 → 1.4.0
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/README.md +26 -0
- package/dist/api/contacts.js +1 -1
- package/dist/api/conversations.js +1 -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.js +1 -1
- package/dist/book.js +1 -1
- package/dist/boot.js +1 -1
- package/dist/{chunk-POZQQIY6.js → chunk-27I3P5QL.js} +1 -1
- package/dist/{chunk-BRVWXTBV.js → chunk-3RD3QQJ4.js} +1 -1
- package/dist/chunk-5WAHPQR4.js +2 -0
- package/dist/chunk-BL54LJNA.js +2 -0
- package/dist/{chunk-3GV4HJDR.js → chunk-BLI2K72H.js} +1 -1
- package/dist/{chunk-NR4BKEX7.js → chunk-BTPUV6I4.js} +1 -1
- package/dist/{chunk-PR5I52YC.js → chunk-BV7B7EOB.js} +1 -1
- package/dist/{chunk-KXSCALOD.js → chunk-CNRQI6PX.js} +1 -1
- package/dist/{chunk-V3DEZ3QC.js → chunk-DVSULKQM.js} +1 -1
- package/dist/{chunk-TJCOHSZK.js → chunk-EO6MBMHC.js} +1 -1
- package/dist/{chunk-QU4JXFWK.js → chunk-FHYNXFUQ.js} +1 -1
- package/dist/{chunk-5UCCZQKJ.js → chunk-FZVAUVTP.js} +1 -1
- package/dist/{chunk-XKUHQAZT.js → chunk-G42GGINF.js} +1 -1
- package/dist/{chunk-76IUB6EU.js → chunk-GFVCYM7M.js} +1 -1
- package/dist/{chunk-JYS5TDXB.js → chunk-GJKW5UGA.js} +1 -1
- package/dist/chunk-IQZXY4GI.js +2 -0
- package/dist/{chunk-Z6RV2H3U.js → chunk-LOKOJPRM.js} +1 -1
- package/dist/chunk-NBEWKZG4.js +2 -0
- package/dist/{chunk-KKNLSG4Z.js → chunk-NFQ7V7VN.js} +1 -1
- package/dist/{chunk-3SALLTXZ.js → chunk-NWFAMEGF.js} +1 -1
- package/dist/{chunk-VDLSQVR6.js → chunk-O6F7UFK2.js} +1 -1
- package/dist/{chunk-XTYFZQI6.js → chunk-OS7QJTVD.js} +1 -1
- package/dist/{chunk-WQUMJSH5.js → chunk-Q72S27KT.js} +1 -1
- package/dist/chunk-VXVW4KJU.js +2 -0
- package/dist/client/http.js +1 -1
- package/dist/client.js +1 -1
- 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/errors.d.ts +10 -2
- package/dist/errors.js +1 -1
- package/dist/gc.js +1 -1
- package/dist/http/api-routes.js +1 -1
- package/dist/http/server.d.ts +6 -0
- 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/file-limit.d.ts +156 -0
- package/dist/messaging/file-limit.js +2 -0
- 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/7962BB01B1D3E782A1F80B083A900AEC30BAC8F8CE79282B31821802B94A39B6.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/runtime/sdk-signal-ownership.d.ts +9 -0
- package/dist/runtime/sdk-signal-ownership.js +2 -0
- package/dist/state.js +1 -1
- package/dist/sweeps.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-CWOJDHLH.js +0 -2
- package/dist/chunk-D25WNFJF.js +0 -2
- package/dist/chunk-UM73BGFH.js +0 -2
|
@@ -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-BV7B7EOB.js";import{F as f,J as c,N as g,P as l,t as u}from"./chunk-DVSULKQM.js";import{c as d,d as a}from"./chunk-NFQ7V7VN.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{F as m,J as s,r as c,s as l,u as f}from"./chunk-
|
|
2
|
+
import{F as m,J as s,r as c,s as l,u as f}from"./chunk-DVSULKQM.js";import{c as o}from"./chunk-NFQ7V7VN.js";import{f as i,i as a}from"./chunk-GFVCYM7M.js";var e=null,n=!1;function v(){e||(e=setInterval(()=>{n||(n=!0,(async()=>{try{for(let t of o.values()){try{await m(async r=>{await s(t,"::actor::gc",{},r)})}catch(r){a(`gc(${t.name}) failed:`,String(r))}await c(t),await l(t),await f(t)}}finally{n=!1}})())},i),e.unref?.(),a(`message GC timer armed (every ${i}ms)`))}function w(){e&&(clearInterval(e),e=null)}export{v as a,w as b};
|
|
@@ -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-BL54LJNA.js";import{a as n}from"./chunk-XYU2DSWR.js";var p=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:y,message:d}=r;throw new a(y,d)}let c=o?r.message:String(r);throw new Error(`${e}: ${c} (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)}getConversation(e){return this.post("getConversation",e)}getReceipts(e){return this.post("getReceipts",e)}markRead(e){return this.post("markRead",e)}setConversationPolicy(e){return this.post("setConversationPolicy",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 n(o&&typeof o=="object"?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{p as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import{e as d}from"./chunk-
|
|
2
|
+
import{e as d}from"./chunk-BV7B7EOB.js";import{E as a,G as c}from"./chunk-DVSULKQM.js";import{c as s}from"./chunk-NFQ7V7VN.js";function y(e){try{return a(n=>{let i=c(e,"::a2a_capabilities::get_manifest",n).Reduce("capabilities");return i.IsNil()?[]:[...i.GetKeys()].map(t=>typeof t=="string"?t:t.Visualize())})}catch{return[]}}function R(e){let n="",i="",t="",u="",l=[];try{a(g=>{let p=c(e,"::a2a_capabilities::get_manifest",g),r=o=>{let f=p.Reduce(o);return f.IsNil()?"":f.Visualize()};n=r("app_id"),i=r("name"),t=r("description"),u=r("version");let m=p.Reduce("capabilities");m.IsNil()||(l=[...m.GetKeys()].map(o=>typeof o=="string"?o:o.Visualize()))})}catch{}return{app_id:n,name:i,description:t,version:u,capabilities:l,monitoring_status:"unbound"}}function h(e){let n=[];for(let i of s.values()){if(i.name===e.name)continue;let t=d(i);t.rootCid===e.cid&&n.push({name:i.name,cid:i.cid,role_id:t.roleId,bio:t.bio,monitoring:t.monitoringEnabled,capabilities:y(i)})}return n}function v(e,n){let i=s.get(n)??[...s.values()].find(t=>t.cid===n);return!i||i.name===e.name?null:d(i).rootCid===e.cid?i:null}export{y as a,R as b,h as c,v as d};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{object_to_adapt_value as m}from"@adapt-toolkit/sdk/wrapper";var i="w".repeat(64),y=9,c=2097152;function f(){return c}var a=e=>Buffer.byteLength(e,"utf8");function u(e){let r=e.replyTo?a(e.replyTo.wire_id)+32:0;return 2048+2*(a(e.filename)+a(e.mime)+r)}function s(e){return e.bytes+u(e)>e.cap}function l(e){let r=e.packet.NewBinaryFromBuffer(e.payload).Attach(e.lifetime),t=m({filename:e.filename,mime:e.mime,data:r,wire_id:i,...e.replyTo?{reply_to:e.replyTo}:{},pv:y});return t.Attach(e.lifetime),t.Serialize().length}var b=8;function d(e){let r=n=>l({...e,payload:e.payload.subarray(0,n)}),t=e.payload.length;for(let n=0;n<b;n++){let o=r(t);if(o<=e.cap)break;let p=t-(o-e.cap);if(p<=0)return 0;t=p}if(r(t)>e.cap)return 0;for(;t<e.payload.length&&r(t+1)<=e.cap;)t++;return t}function g(e){let r=e.cap??f(),t=e.payload.length;if(!s({bytes:t,filename:e.filename,mime:e.mime,replyTo:e.replyTo,cap:r}))return{ok:!0};let n=l(e);return n<=r?{ok:!0}:{ok:!1,bytes:t,cap:r,envelopeBytes:n,maxPayloadBytes:d({...e,cap:r})}}export{c as a,f as b,u as c,s as d,l as e,d as f,g};
|
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-OS7QJTVD.js";import"../chunk-BL54LJNA.js";import"../chunk-XYU2DSWR.js";export{a as OursClient};
|
package/dist/client.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 F}from"./chunk-OS7QJTVD.js";import{a as G,b as H,c as I,d as J,e as L,f as O}from"./chunk-IDH22QWU.js";import{A as K,B as S,C as U,D as b,E as h,F as l,G as z,H as A,I as B,J as C,K as D,a as e,b as o,c as t,d as i,e as n,f as r,g as c,h as R,i as d,j as f,k as p,l as s,m as v,n as a,o as m,p as x,q as E,r as N,s as g,t as y,u as M,v as j,w as k,x as q,y as u,z as w}from"./chunk-BL54LJNA.js";import"./chunk-XYU2DSWR.js";import"./chunk-IB2U7K6Y.js";export{I as DAEMON_TOKEN_FILE,H as DEFAULT_DAEMON_PORT,G as DaemonSelectionError,F as OursClient,e as OursError,O as assertDaemonStateDir,L as describeDaemonConfig,t as errBindingReassigned,y as errBoundElsewhere,i as errBoundIdentityGone,B as errDuplicateId,b as errFileTooLarge,U as errFileUnreadable,j as errIdentityClosedWithError,q as errIdentityPartiallyRemoved,z as errInvalidSelection,A as errMalformedId,r as errNameTaken,c as errNoLeaseHeaders,x as errNoLeaseToken,w as errNoPolicyArgs,l as errNoRoot,m as errNoSuchIdentity,o as errNotBound,f as errNotBoundNoName,p as errNotTemporary,a as errPathNotAbsolute,u as errPublicInviteNamed,R as errRandomNameExhausted,d as errRootExists,k as errRootHasRoles,h as errSaveFileFallback,K as errSendFileArgs,S as errSendFileFilenameRequired,v as errTempClosedWithError,n as errTempClosingBound,E as errTempClosingChoose,s as errTempOwnedElsewhereClose,M as errTempOwnedElsewhereRemove,N as errTempOwnedLive,g as errTempStale,D as errTool,C as errUnknownOrStaleId,J 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-G42GGINF.js";import"../chunk-Q72S27KT.js";import"../chunk-BV7B7EOB.js";import"../chunk-DVSULKQM.js";import"../chunk-YRPUM6JG.js";import"../chunk-LOKOJPRM.js";import"../chunk-DIRW7I4S.js";import"../chunk-27I3P5QL.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.js";import"../chunk-ZHH3PWEW.js";import"../chunk-LKFYUCN7.js";import"../chunk-P55RJGZU.js";import"../chunk-XYU2DSWR.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-Q72S27KT.js";import"../chunk-BV7B7EOB.js";import"../chunk-DVSULKQM.js";import"../chunk-YRPUM6JG.js";import"../chunk-LOKOJPRM.js";import"../chunk-DIRW7I4S.js";import"../chunk-27I3P5QL.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.js";import"../chunk-ZHH3PWEW.js";import"../chunk-LKFYUCN7.js";import"../chunk-P55RJGZU.js";import"../chunk-XYU2DSWR.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="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="1.4.0",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-IQZXY4GI.js";import"./chunk-NBEWKZG4.js";import"./chunk-V64IUVSS.js";import"./chunk-37D5PCFY.js";import"./chunk-O6F7UFK2.js";import"./chunk-BLI2K72H.js";import{b as t}from"./chunk-GJKW5UGA.js";import"./chunk-IU6MOFTJ.js";import"./chunk-FZVAUVTP.js";import"./chunk-BTPUV6I4.js";import"./chunk-EO6MBMHC.js";import"./chunk-5WAHPQR4.js";import"./chunk-VXVW4KJU.js";import"./chunk-NWFAMEGF.js";import"./chunk-3RD3QQJ4.js";import"./chunk-CNRQI6PX.js";import"./chunk-FHYNXFUQ.js";import"./chunk-BL54LJNA.js";import"./chunk-G42GGINF.js";import"./chunk-Q72S27KT.js";import"./chunk-BV7B7EOB.js";import"./chunk-DVSULKQM.js";import"./chunk-YRPUM6JG.js";import"./chunk-LOKOJPRM.js";import"./chunk-DIRW7I4S.js";import"./chunk-27I3P5QL.js";import"./chunk-NFQ7V7VN.js";import{h as r}from"./chunk-GFVCYM7M.js";import"./chunk-ZHH3PWEW.js";import"./chunk-LKFYUCN7.js";import"./chunk-P55RJGZU.js";import"./chunk-XYU2DSWR.js";import"./chunk-IB2U7K6Y.js";export{t as bootWrapper,e as startDaemon,r as startupProgress};
|
package/dist/errors.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export type OursErrorCode = 'NOT_BOUND' | 'BINDING_REASSIGNED' | 'BOUND_IDENTITY_GONE' | 'TEMP_CLOSING' | 'NAME_INVALID' | 'NAME_TAKEN' | 'PROVISION_FAILED' | 'NO_LEASE_HEADERS' | 'NO_LEASE_TOKEN' | 'RANDOM_NAME_EXHAUSTED' | 'NOT_BOUND_NO_NAME' | 'NOT_TEMPORARY' | 'TEMP_OWNED_ELSEWHERE' | 'TEMP_STALE' | 'BOUND_ELSEWHERE' | 'DELETE_PARTIAL' | 'CLOSE_FAILED' | 'ROOT_EXISTS' | 'ROOT_HAS_ROLES' | 'NO_SUCH_IDENTITY' | 'PATH_NOT_ABSOLUTE' | 'WRITE_FAILED' | 'PUBLIC_INVITE_NAMED' | 'INVITE_MALFORMED' | 'NO_POLICY_ARGS' | 'SEND_ARGS' | 'FILE_UNREADABLE' | 'FALLBACK_FAILED' | 'CONNECTOR_TOO_OLD' | 'NO_ROOT' | 'TX_FAILED' | 'INVALID_SELECTION' | 'MALFORMED_ID' | 'DUPLICATE_ID' | 'UNKNOWN_OR_STALE_ID';
|
|
1
|
+
export type OursErrorCode = 'NOT_BOUND' | 'BINDING_REASSIGNED' | 'BOUND_IDENTITY_GONE' | 'TEMP_CLOSING' | 'NAME_INVALID' | 'NAME_TAKEN' | 'PROVISION_FAILED' | 'NO_LEASE_HEADERS' | 'NO_LEASE_TOKEN' | 'RANDOM_NAME_EXHAUSTED' | 'NOT_BOUND_NO_NAME' | 'NOT_TEMPORARY' | 'TEMP_OWNED_ELSEWHERE' | 'TEMP_STALE' | 'BOUND_ELSEWHERE' | 'DELETE_PARTIAL' | 'CLOSE_FAILED' | 'ROOT_EXISTS' | 'ROOT_HAS_ROLES' | 'NO_SUCH_IDENTITY' | 'PATH_NOT_ABSOLUTE' | 'WRITE_FAILED' | 'PUBLIC_INVITE_NAMED' | 'INVITE_MALFORMED' | 'NO_POLICY_ARGS' | 'SEND_ARGS' | 'FILE_UNREADABLE' | 'FILE_TOO_LARGE' | 'FALLBACK_FAILED' | 'CONNECTOR_TOO_OLD' | 'NO_ROOT' | 'TX_FAILED' | 'INVALID_SELECTION' | 'MALFORMED_ID' | 'DUPLICATE_ID' | 'UNKNOWN_OR_STALE_ID';
|
|
2
2
|
export declare class OursError extends Error {
|
|
3
3
|
readonly code: OursErrorCode;
|
|
4
|
-
|
|
4
|
+
readonly details?: Readonly<Record<string, unknown>> | undefined;
|
|
5
|
+
constructor(code: OursErrorCode, message: string, details?: Readonly<Record<string, unknown>> | undefined);
|
|
5
6
|
}
|
|
6
7
|
export declare const errNotBound: () => OursError;
|
|
7
8
|
export declare const errBindingReassigned: () => OursError;
|
|
@@ -31,6 +32,13 @@ export declare const errNoPolicyArgs: () => OursError;
|
|
|
31
32
|
export declare const errSendFileArgs: () => OursError;
|
|
32
33
|
export declare const errSendFileFilenameRequired: () => OursError;
|
|
33
34
|
export declare const errFileUnreadable: (detail: string) => OursError;
|
|
35
|
+
export declare const errFileTooLarge: (i: {
|
|
36
|
+
filename: string;
|
|
37
|
+
bytes: number;
|
|
38
|
+
limit: number;
|
|
39
|
+
envelopeBytes: number;
|
|
40
|
+
maxPayloadBytes: number;
|
|
41
|
+
}) => OursError;
|
|
34
42
|
export declare const errSaveFileFallback: (wireId: string, existsOnDisk: boolean) => OursError;
|
|
35
43
|
export declare const errNoRoot: () => OursError;
|
|
36
44
|
export declare const errInvalidSelection: (cap: number) => OursError;
|
package/dist/errors.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,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-
|
|
2
|
+
import{A,B,C,D,E,F,G,H,I,J,K,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-BL54LJNA.js";export{a as OursError,c as errBindingReassigned,t as errBoundElsewhere,d as errBoundIdentityGone,I as errDuplicateId,D as errFileTooLarge,C as errFileUnreadable,v as errIdentityClosedWithError,x as errIdentityPartiallyRemoved,G as errInvalidSelection,H as errMalformedId,f as errNameTaken,g as errNoLeaseHeaders,p as errNoLeaseToken,z as errNoPolicyArgs,F as errNoRoot,o as errNoSuchIdentity,b as errNotBound,j as errNotBoundNoName,k as errNotTemporary,n as errPathNotAbsolute,y as errPublicInviteNamed,h as errRandomNameExhausted,i as errRootExists,w as errRootHasRoles,E as errSaveFileFallback,A as errSendFileArgs,B as errSendFileFilenameRequired,m as errTempClosedWithError,e as errTempClosingBound,q as errTempClosingChoose,l as errTempOwnedElsewhereClose,u as errTempOwnedElsewhereRemove,r as errTempOwnedLive,s as errTempStale,K as errTool,J as errUnknownOrStaleId};
|
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-O6F7UFK2.js";import"./chunk-DVSULKQM.js";import"./chunk-YRPUM6JG.js";import"./chunk-LOKOJPRM.js";import"./chunk-DIRW7I4S.js";import"./chunk-27I3P5QL.js";import"./chunk-NFQ7V7VN.js";import"./chunk-GFVCYM7M.js";import"./chunk-ZHH3PWEW.js";import"./chunk-LKFYUCN7.js";import"./chunk-P55RJGZU.js";import"./chunk-XYU2DSWR.js";import"./chunk-IB2U7K6Y.js";export{a as startGcTimer,b as stopGcTimer};
|
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-BLI2K72H.js";import"../chunk-FZVAUVTP.js";import"../chunk-BTPUV6I4.js";import"../chunk-EO6MBMHC.js";import"../chunk-5WAHPQR4.js";import"../chunk-VXVW4KJU.js";import"../chunk-NWFAMEGF.js";import"../chunk-3RD3QQJ4.js";import"../chunk-CNRQI6PX.js";import"../chunk-FHYNXFUQ.js";import"../chunk-BL54LJNA.js";import"../chunk-G42GGINF.js";import"../chunk-Q72S27KT.js";import"../chunk-BV7B7EOB.js";import"../chunk-DVSULKQM.js";import"../chunk-YRPUM6JG.js";import"../chunk-LOKOJPRM.js";import"../chunk-DIRW7I4S.js";import"../chunk-27I3P5QL.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.js";import"../chunk-ZHH3PWEW.js";import"../chunk-LKFYUCN7.js";import"../chunk-P55RJGZU.js";import"../chunk-XYU2DSWR.js";import"../chunk-IB2U7K6Y.js";export{b as API_OPERATIONS,a as API_PREFIX,c as enterApiSession,d as serveApiOperation};
|
package/dist/http/server.d.ts
CHANGED
|
@@ -106,6 +106,12 @@ export interface DaemonOptions {
|
|
|
106
106
|
* announces the SDK's version, which is not the number a user installed.
|
|
107
107
|
*/
|
|
108
108
|
version?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Whether the daemon owns process SIGINT/SIGTERM handling. Defaults to true
|
|
111
|
+
* for standalone compatibility. Embedded hosts should pass false and own
|
|
112
|
+
* both signal policy and process termination themselves.
|
|
113
|
+
*/
|
|
114
|
+
handleSignals?: boolean;
|
|
109
115
|
/**
|
|
110
116
|
* Notification sink. Wired into src/notify.ts's `setNotifyHook`; the third
|
|
111
117
|
* argument is `leases.get(identityName)?.sid ?? null`, RESOLVED WHEN THE
|
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-IQZXY4GI.js";import"../chunk-NBEWKZG4.js";import"../chunk-V64IUVSS.js";import"../chunk-37D5PCFY.js";import"../chunk-O6F7UFK2.js";import"../chunk-BLI2K72H.js";import"../chunk-GJKW5UGA.js";import"../chunk-IU6MOFTJ.js";import"../chunk-FZVAUVTP.js";import"../chunk-BTPUV6I4.js";import"../chunk-EO6MBMHC.js";import"../chunk-5WAHPQR4.js";import"../chunk-VXVW4KJU.js";import"../chunk-NWFAMEGF.js";import"../chunk-3RD3QQJ4.js";import"../chunk-CNRQI6PX.js";import"../chunk-FHYNXFUQ.js";import"../chunk-BL54LJNA.js";import"../chunk-G42GGINF.js";import"../chunk-Q72S27KT.js";import"../chunk-BV7B7EOB.js";import"../chunk-DVSULKQM.js";import"../chunk-YRPUM6JG.js";import"../chunk-LOKOJPRM.js";import"../chunk-DIRW7I4S.js";import"../chunk-27I3P5QL.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.js";import"../chunk-ZHH3PWEW.js";import"../chunk-LKFYUCN7.js";import"../chunk-P55RJGZU.js";import"../chunk-XYU2DSWR.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-BV7B7EOB.js";import"../chunk-DVSULKQM.js";import"../chunk-YRPUM6JG.js";import"../chunk-LOKOJPRM.js";import"../chunk-DIRW7I4S.js";import"../chunk-27I3P5QL.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.js";import"../chunk-ZHH3PWEW.js";import"../chunk-LKFYUCN7.js";import"../chunk-P55RJGZU.js";import"../chunk-XYU2DSWR.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-27I3P5QL.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.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-FHYNXFUQ.js";import"../chunk-BV7B7EOB.js";import"../chunk-DVSULKQM.js";import"../chunk-YRPUM6JG.js";import"../chunk-LOKOJPRM.js";import"../chunk-DIRW7I4S.js";import"../chunk-27I3P5QL.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.js";import"../chunk-ZHH3PWEW.js";import"../chunk-LKFYUCN7.js";import"../chunk-P55RJGZU.js";import"../chunk-XYU2DSWR.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-NFQ7V7VN.js";import"../chunk-GFVCYM7M.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-DVSULKQM.js";import"../chunk-YRPUM6JG.js";import"../chunk-LOKOJPRM.js";import"../chunk-DIRW7I4S.js";import"../chunk-27I3P5QL.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.js";import"../chunk-ZHH3PWEW.js";import"../chunk-LKFYUCN7.js";import"../chunk-P55RJGZU.js";import"../chunk-XYU2DSWR.js";import"../chunk-IB2U7K6Y.js";export{a as createPacket,c as provisionIdentity,b as reservedNames,d as restoreIdentity};
|
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,5 @@ export * from './client/http.js';
|
|
|
10
10
|
export * from './version-advisory.js';
|
|
11
11
|
export { FILE_SELECTION_CAP } from './identity/model.js';
|
|
12
12
|
export * from './events.js';
|
|
13
|
+
export { PINNED_FILE_ENVELOPE_CAP, resolveFileEnvelopeCap, envelopeSkipMargin, needsEnvelopeMeasurement, measureFileEnvelope, maxFilePayloadBytes, checkFileEnvelope, type BinarySource, type ReplyRef, type FileEnvelopeCheck, } from './messaging/file-limit.js';
|
|
13
14
|
export * from './client/select.js';
|
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 De}from"./chunk-OS7QJTVD.js";import{a as Te,b as Ve,c as be,d as qe,e as we,f as ze}from"./chunk-IDH22QWU.js";import{a as Ge}from"./chunk-5EWCIQH6.js";import{a as Ee,b as ne,c as ae,d as ie,e as ye,f as se,g as ve,h as Fe,i as Ce,j as Pe}from"./chunk-FZVAUVTP.js";import{a as _e,b as ce,c as Ie,d as Le}from"./chunk-BTPUV6I4.js";import{a as Ne,b as ke,c as ue,d as Se}from"./chunk-EO6MBMHC.js";import{a as de,b as he,c as Ae,d as Be,e as Me}from"./chunk-5WAHPQR4.js";import{a as o,b as r,c as p,d as t,e as m,f,g as x}from"./chunk-VXVW4KJU.js";import"./chunk-NWFAMEGF.js";import{a as Oe,b as Re,c as ge,d as je}from"./chunk-3RD3QQJ4.js";import{a as Z,b as $,c as ee,d as oe,e as re,f as pe,g as te,h as me,i as fe,j as xe,k as le}from"./chunk-CNRQI6PX.js";import"./chunk-FHYNXFUQ.js";import{A as w,B as z,C as G,D as H,E as J,F as K,G as Q,H as U,I as W,J as X,K as Y,a as v,b as F,c as C,d as P,e as _,f as c,g as I,h as L,i as N,j as k,k as u,l as S,m as d,n as h,o as A,p as B,q as M,r as O,s as R,t as g,u as j,v as D,w as T,x as V,y as b,z as q}from"./chunk-BL54LJNA.js";import"./chunk-G42GGINF.js";import"./chunk-Q72S27KT.js";import"./chunk-BV7B7EOB.js";import"./chunk-DVSULKQM.js";import"./chunk-YRPUM6JG.js";import"./chunk-LOKOJPRM.js";import"./chunk-DIRW7I4S.js";import"./chunk-27I3P5QL.js";import{u as e}from"./chunk-NFQ7V7VN.js";import"./chunk-GFVCYM7M.js";import"./chunk-ZHH3PWEW.js";import"./chunk-LKFYUCN7.js";import"./chunk-P55RJGZU.js";import{a as l,b as E,c as n,d as a,e as i,f as y,g as s}from"./chunk-XYU2DSWR.js";import"./chunk-IB2U7K6Y.js";export{be as DAEMON_TOKEN_FILE,Ve as DEFAULT_DAEMON_PORT,Te as DaemonSelectionError,e as FILE_SELECTION_CAP,De as OursClient,v as OursError,o as PINNED_FILE_ENVELOPE_CAP,E as VETOABLE_EVENTS,ie as addContact,Re as advertiseMigrate,ze as assertDaemonStateDir,x as checkFileEnvelope,te as chooseIdentity,oe as closeTemporaryIdentityOp,$ as createIdentity,re as createRootIdentity,ee as createTemporaryIdentity,fe as currentIdentity,Se as deferFiles,Me as deferMessages,pe as defineLocalIdentityFile,we as describeDaemonConfig,y as emitDaemonEvent,s as emitDaemonNotification,p as envelopeSkipMargin,C as errBindingReassigned,g as errBoundElsewhere,P as errBoundIdentityGone,W as errDuplicateId,H as errFileTooLarge,G as errFileUnreadable,D as errIdentityClosedWithError,V as errIdentityPartiallyRemoved,Q as errInvalidSelection,U as errMalformedId,c as errNameTaken,I as errNoLeaseHeaders,B as errNoLeaseToken,q as errNoPolicyArgs,K as errNoRoot,A as errNoSuchIdentity,F as errNotBound,k as errNotBoundNoName,u as errNotTemporary,h as errPathNotAbsolute,b as errPublicInviteNamed,L as errRandomNameExhausted,N as errRootExists,T as errRootHasRoles,J as errSaveFileFallback,w as errSendFileArgs,z as errSendFileFilenameRequired,d as errTempClosedWithError,_ as errTempClosingBound,M as errTempClosingChoose,S as errTempOwnedElsewhereClose,j as errTempOwnedElsewhereRemove,O as errTempOwnedLive,R as errTempStale,Y as errTool,X as errUnknownOrStaleId,Ge as formatVersionAdvisory,Ee as generateInvite,_e as getConversation,ke as getFiles,Be as getMessages,ce as getReceipts,i as isDefaultHandler,ye as listContacts,me as listIdentities,Ne as listIncomingFiles,Ae as listIncomingMessages,ne as listInvites,se as listLocalContactBook,Ie as markRead,f as maxFilePayloadBytes,m as measureFileEnvelope,t as needsEnvelopeMeasurement,l as normalizeNotificationEvent,je as readvertiseOnUpgrade,le as releaseLease,Fe as removeContact,xe as removeIdentity,Ce as renameContact,Z as requireBound,a as resetDaemonEventHandlers,qe as resolveDaemonConfig,r as resolveFileEnvelopeCap,Pe as respondToIntroduction,ae as revokeInvite,ue as saveFileFallbackNotice,he as sendFile,de as sendMessage,Oe as setBio,Le as setConversationPolicy,n as setDaemonEventHandler,ve as setLocalBookPolicy,ge as setPersona};
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import type { AdaptValue } from '@adapt-toolkit/sdk/backend';
|
|
2
|
+
import type { AdaptObjectLifetime } from '@adapt-toolkit/sdk/common';
|
|
3
|
+
/**
|
|
4
|
+
* Just enough of `AdaptPacketContext` to build a binary leaf.
|
|
5
|
+
*
|
|
6
|
+
* Deliberately structural rather than the concrete type: it lets the regression
|
|
7
|
+
* drive these helpers against `AdaptEnvironment.EmptyPacket()` — no identity, no
|
|
8
|
+
* compiled .muflo, no state dir, no daemon, no broker — which is what makes the
|
|
9
|
+
* flip-point assertions cheap enough to keep in CI forever.
|
|
10
|
+
*/
|
|
11
|
+
export interface BinarySource {
|
|
12
|
+
NewBinaryFromBuffer(buffer: Uint8Array): AdaptValue;
|
|
13
|
+
}
|
|
14
|
+
/** `$reply_to` as the core's `a2a_protocol::reply_ref_t` sees it. */
|
|
15
|
+
export interface ReplyRef {
|
|
16
|
+
wire_id: string;
|
|
17
|
+
sentence?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Compatibility FALLBACK for the cap — not the source of truth.
|
|
21
|
+
* `unacked_file_entry_max_bytes` (a2a_messaging.mm:162).
|
|
22
|
+
*/
|
|
23
|
+
export declare const PINNED_FILE_ENVELOPE_CAP = 2097152;
|
|
24
|
+
/**
|
|
25
|
+
* The cap this SDK enforces, behind ONE accessor so the proposed core
|
|
26
|
+
* `trn readonly get_limits` is a drop-in later (query once per identity at bind,
|
|
27
|
+
* cache, fall back to the pin). No core exposes such a transaction today — the
|
|
28
|
+
* only introspection trn is `get_version` (a2a_messaging.mm:2927) — so this
|
|
29
|
+
* returns the pin unconditionally, and behaviour against EVERY shipped core is
|
|
30
|
+
* the pinned path.
|
|
31
|
+
*
|
|
32
|
+
* Skew, both directions, stated plainly:
|
|
33
|
+
*
|
|
34
|
+
* - Core cap HIGHER than the pin → we refuse sends the core would have
|
|
35
|
+
* retained. A false refusal: conservative, visible, fixed by an SDK bump.
|
|
36
|
+
* - Core cap LOWER than the pin → we admit a send the core will not retain,
|
|
37
|
+
* i.e. exactly today's behaviour. Pre-flight CANNOT catch this direction,
|
|
38
|
+
* which is the whole reason `notRetained` must stay on the success result
|
|
39
|
+
* (see api/messaging.ts sendFile). It is the only detector left for it.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveFileEnvelopeCap(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Bytes of headroom below the cap within which a send MUST be measured rather
|
|
44
|
+
* than assumed to fit.
|
|
45
|
+
*
|
|
46
|
+
* A FIXED threshold here is unsound, and that is a correctness bug rather than a
|
|
47
|
+
* tuning preference: overhead grows with metadata, and nothing bounds
|
|
48
|
+
* `filename`, `mime` or `reply_to.wire_id` at the call site. MEASURED overheads
|
|
49
|
+
* (payload 1,000 bytes; reproduced by test/file-limit.test.mjs):
|
|
50
|
+
*
|
|
51
|
+
* filename 5ch, mime 24ch, no reply_to → 814
|
|
52
|
+
* filename 204ch → 1,047 (+233 for +199 chars)
|
|
53
|
+
* filename 1,000ch → 1,843
|
|
54
|
+
* filename 8,000ch → 8,846 ← past a fixed 8,192
|
|
55
|
+
* filename 60,000ch → 60,846
|
|
56
|
+
* mime 8,000ch → 8,825
|
|
57
|
+
* reply_to {wire_id: 64} → 1,144
|
|
58
|
+
* reply_to {wire_id: 64, sentence} → 1,235
|
|
59
|
+
* reply_to {wire_id: 4,000, sentence} → 5,171
|
|
60
|
+
*
|
|
61
|
+
* A fixed 8,192-byte skip band therefore ADMITS an over-cap send as soon as the
|
|
62
|
+
* filename passes ~8,000 bytes — silently reproducing the very defect this
|
|
63
|
+
* module exists to fix, in the one case a caller cannot see. So the margin is
|
|
64
|
+
* DERIVED per send: a 2,048-byte floor (dominates the 781–820 metadata-free
|
|
65
|
+
* overhead at every payload size) plus 2× the metadata bytes (dominates the
|
|
66
|
+
* measured ~1.0–1.42 bytes of envelope per metadata byte, with room for
|
|
67
|
+
* length-prefix growth).
|
|
68
|
+
*
|
|
69
|
+
* ⚠ UTF-8 BYTES, NOT CHARACTERS. MEASURED: 100 accented characters cost 1,043
|
|
70
|
+
* where 100 ASCII characters cost 943 — the envelope tracks ENCODED bytes.
|
|
71
|
+
* Switching this to `.length` would quietly reintroduce the bug for every
|
|
72
|
+
* non-ASCII filename.
|
|
73
|
+
*
|
|
74
|
+
* Ordinary sends (short name, no reply reference) keep a ~2 KiB skip band, so
|
|
75
|
+
* the hot path never pays for a Serialize(); only sends genuinely near the cap do.
|
|
76
|
+
*/
|
|
77
|
+
export declare function envelopeSkipMargin(i: {
|
|
78
|
+
filename: string;
|
|
79
|
+
mime: string;
|
|
80
|
+
replyTo?: ReplyRef;
|
|
81
|
+
}): number;
|
|
82
|
+
/** True when this send is close enough to the cap that it must be measured. */
|
|
83
|
+
export declare function needsEnvelopeMeasurement(i: {
|
|
84
|
+
bytes: number;
|
|
85
|
+
filename: string;
|
|
86
|
+
mime: string;
|
|
87
|
+
replyTo?: ReplyRef;
|
|
88
|
+
cap: number;
|
|
89
|
+
}): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Serialized length of the EXACT envelope the core will build for this send —
|
|
92
|
+
* the SDK's reproduction of `_binlen (_write $filename,$mime,$data,$wire_id,$reply_to,$pv)`.
|
|
93
|
+
*
|
|
94
|
+
* Two details that are load-bearing:
|
|
95
|
+
* - `payload` is used AS-IS. Callers pass a subarray of the buffer they already
|
|
96
|
+
* hold, so solving for the ceiling never allocates a second multi-MiB copy.
|
|
97
|
+
* - `reply_to` is OMITTED when absent. The core writes `$reply_to -> reply_to`
|
|
98
|
+
* unconditionally with a NIL value there, and a NIL field contributes
|
|
99
|
+
* nothing — MEASURED: omitting it agrees exactly with all four live flip points.
|
|
100
|
+
*/
|
|
101
|
+
export declare function measureFileEnvelope(i: {
|
|
102
|
+
packet: BinarySource;
|
|
103
|
+
lifetime: AdaptObjectLifetime;
|
|
104
|
+
filename: string;
|
|
105
|
+
mime: string;
|
|
106
|
+
payload: Uint8Array;
|
|
107
|
+
replyTo?: ReplyRef;
|
|
108
|
+
}): number;
|
|
109
|
+
/**
|
|
110
|
+
* Largest payload THIS exact envelope — same filename, same mime, same reply
|
|
111
|
+
* reference — can carry under `cap`.
|
|
112
|
+
*
|
|
113
|
+
* This is the number a caller can act on ("trim 1,844 bytes" or "shorten the
|
|
114
|
+
* filename"), which a global constant can never be.
|
|
115
|
+
*
|
|
116
|
+
* Newton-style: subtract the overshoot, re-measure, then walk up while the next
|
|
117
|
+
* byte still fits (overhead SHRINKS as the payload does — 820 → 814 → 781 across
|
|
118
|
+
* the range — so a byte or two of slack is left behind otherwise). Every
|
|
119
|
+
* measurement reuses a subarray of `payload`, so the solve allocates no new
|
|
120
|
+
* payload buffers. Returns the last value proven to fit.
|
|
121
|
+
*/
|
|
122
|
+
export declare function maxFilePayloadBytes(i: {
|
|
123
|
+
packet: BinarySource;
|
|
124
|
+
lifetime: AdaptObjectLifetime;
|
|
125
|
+
filename: string;
|
|
126
|
+
mime: string;
|
|
127
|
+
payload: Uint8Array;
|
|
128
|
+
replyTo?: ReplyRef;
|
|
129
|
+
cap: number;
|
|
130
|
+
}): number;
|
|
131
|
+
export type FileEnvelopeCheck = {
|
|
132
|
+
ok: true;
|
|
133
|
+
} | {
|
|
134
|
+
ok: false;
|
|
135
|
+
bytes: number;
|
|
136
|
+
cap: number;
|
|
137
|
+
envelopeBytes: number;
|
|
138
|
+
maxPayloadBytes: number;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Pre-flight one sendFile payload: fast-path anything comfortably small, measure
|
|
142
|
+
* the rest, and report the actionable ceiling when it does not fit.
|
|
143
|
+
*
|
|
144
|
+
* The refusal happens before any transaction is emitted, so "nothing was sent"
|
|
145
|
+
* is a real guarantee here — unlike `notRetained`, where the core has already
|
|
146
|
+
* sent by the time it reports the verdict.
|
|
147
|
+
*/
|
|
148
|
+
export declare function checkFileEnvelope(i: {
|
|
149
|
+
packet: BinarySource;
|
|
150
|
+
lifetime: AdaptObjectLifetime;
|
|
151
|
+
filename: string;
|
|
152
|
+
mime: string;
|
|
153
|
+
payload: Uint8Array;
|
|
154
|
+
replyTo?: ReplyRef;
|
|
155
|
+
cap?: number;
|
|
156
|
+
}): FileEnvelopeCheck;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f,g}from"../chunk-VXVW4KJU.js";export{a as PINNED_FILE_ENVELOPE_CAP,g as checkFileEnvelope,c as envelopeSkipMargin,f as maxFilePayloadBytes,e as measureFileEnvelope,d as needsEnvelopeMeasurement,b as resolveFileEnvelopeCap};
|
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-NWFAMEGF.js";import"../chunk-BV7B7EOB.js";import"../chunk-DVSULKQM.js";import"../chunk-YRPUM6JG.js";import"../chunk-LOKOJPRM.js";import"../chunk-DIRW7I4S.js";import"../chunk-27I3P5QL.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.js";import"../chunk-ZHH3PWEW.js";import"../chunk-LKFYUCN7.js";import"../chunk-P55RJGZU.js";import"../chunk-XYU2DSWR.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-DVSULKQM.js";import"../chunk-YRPUM6JG.js";import"../chunk-LOKOJPRM.js";import"../chunk-DIRW7I4S.js";import"../chunk-27I3P5QL.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.js";import"../chunk-ZHH3PWEW.js";import"../chunk-LKFYUCN7.js";import"../chunk-P55RJGZU.js";import"../chunk-XYU2DSWR.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-DVSULKQM.js";import"../chunk-YRPUM6JG.js";import"../chunk-LOKOJPRM.js";import"../chunk-DIRW7I4S.js";import"../chunk-27I3P5QL.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.js";import"../chunk-ZHH3PWEW.js";import"../chunk-LKFYUCN7.js";import"../chunk-P55RJGZU.js";import"../chunk-XYU2DSWR.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/7962BB01B1D3E782A1F80B083A900AEC30BAC8F8CE79282B31821802B94A39B6.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-DVSULKQM.js";import"./chunk-YRPUM6JG.js";import"./chunk-LOKOJPRM.js";import"./chunk-DIRW7I4S.js";import"./chunk-27I3P5QL.js";import"./chunk-NFQ7V7VN.js";import"./chunk-GFVCYM7M.js";import"./chunk-ZHH3PWEW.js";import"./chunk-LKFYUCN7.js";import"./chunk-P55RJGZU.js";import"./chunk-XYU2DSWR.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-LOKOJPRM.js";import"../chunk-DIRW7I4S.js";import"../chunk-NFQ7V7VN.js";import"../chunk-GFVCYM7M.js";import"../chunk-ZHH3PWEW.js";import"../chunk-P55RJGZU.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-GFVCYM7M.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};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SdkSignalOwnershipAudit {
|
|
2
|
+
sdkVersion: string;
|
|
3
|
+
outcome: 'neutralized' | 'ambiguous';
|
|
4
|
+
exitListenerCount: number;
|
|
5
|
+
exitListenerReferencesPreserved: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function neutralizePinnedSdkSignalHandlers(): void;
|
|
8
|
+
/** Test/diagnostic view: contains counts and identity checks, never listeners. */
|
|
9
|
+
export declare function sdkSignalOwnershipAudit(): SdkSignalOwnershipAudit | null;
|
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-DVSULKQM.js";import"./chunk-YRPUM6JG.js";import"./chunk-LOKOJPRM.js";import"./chunk-DIRW7I4S.js";import"./chunk-27I3P5QL.js";import"./chunk-NFQ7V7VN.js";import"./chunk-GFVCYM7M.js";import"./chunk-ZHH3PWEW.js";import"./chunk-LKFYUCN7.js";import"./chunk-P55RJGZU.js";import"./chunk-XYU2DSWR.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-DVSULKQM.js";import"./chunk-YRPUM6JG.js";import"./chunk-LOKOJPRM.js";import"./chunk-DIRW7I4S.js";import"./chunk-27I3P5QL.js";import"./chunk-NFQ7V7VN.js";import"./chunk-GFVCYM7M.js";import"./chunk-ZHH3PWEW.js";import"./chunk-LKFYUCN7.js";import"./chunk-P55RJGZU.js";import"./chunk-XYU2DSWR.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": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "FSL-1.1-Apache-2.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"pretest": "npm run build --workspace @ours.network/cli",
|
|
44
44
|
"test:cli": "node build.mjs && npm run build --workspace @ours.network/cli && node test/cli-operations.test.mjs && node test/cli-lifecycle.test.mjs && node test/cli-command.test.mjs && node test/cli-help.test.mjs",
|
|
45
45
|
"//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.",
|
|
46
|
-
"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/bump-version.test.mjs && node test/cli-publish-workflow.test.mjs && 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/notification-events.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/cli-operations.test.mjs && node test/cli-lifecycle.test.mjs && node test/cli-command.test.mjs && node test/cli-help.test.mjs && node test/mig1867-verify.test.mjs && node test/boot-smoke.test.mjs && node test/boot-guards.test.mjs && node test/api-identity.test.mjs && node test/api-contacts.test.mjs && node test/api-messaging.test.mjs && node test/conversations.test.mjs && node test/conversation-restart.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"
|
|
46
|
+
"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/bump-version.test.mjs && node test/cli-publish-workflow.test.mjs && node test/mufl-integrity.test.mjs && node test/verbatim-moves.test.mjs && node test/errors.test.mjs && node test/file-limit.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/notification-events.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/cli-operations.test.mjs && node test/cli-lifecycle.test.mjs && node test/cli-command.test.mjs && node test/cli-help.test.mjs && node test/mig1867-verify.test.mjs && node test/boot-smoke.test.mjs && node test/boot-guards.test.mjs && node test/api-identity.test.mjs && node test/api-contacts.test.mjs && node test/api-messaging.test.mjs && node test/conversations.test.mjs && node test/conversation-restart.test.mjs && node test/api-files.test.mjs && node test/defer-files.test.mjs && node test/daemon-routes.test.mjs && node test/daemon-lifecycle.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"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"@adapt-toolkit/sdk": "0.10.12",
|