@lapxo/bound 0.2.5 → 0.2.6
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/CITATION.cff +1 -1
- package/README.md +20 -3
- package/TARGET.bound +75 -42
- package/dist/cli/accept.js +59 -70
- package/dist/cli/act-result.js +3 -3
- package/dist/cli/args.js +1 -1
- package/dist/cli/host.js +1 -1
- package/dist/cli/native.js +1 -1
- package/dist/cli/pass.js +22 -21
- package/dist/cli/place.js +6 -6
- package/dist/cli/release-result.js +3 -3
- package/dist/cli/retained-judgment.js +1 -1
- package/dist/cli/standing-result.js +3 -3
- package/dist/cli/takes.js +10 -10
- package/dist/cli/verb.js +79 -77
- package/dist/engine/computation.js +1 -1
- package/dist/engine/index.js +1 -1
- package/dist/engine/object.js +1 -1
- package/dist/engine/ports.js +1 -1
- package/dist/fold/admission-history.js +1 -1
- package/dist/fold/ceilings.js +1 -1
- package/dist/fold/claims.js +2 -2
- package/dist/fold/closed.js +1 -1
- package/dist/fold/configures.js +1 -1
- package/dist/fold/digests.js +10 -10
- package/dist/fold/evidence.js +1 -1
- package/dist/fold/keys.js +3 -3
- package/dist/fold/laid.js +1 -1
- package/dist/fold/observed.js +27 -26
- package/dist/fold/opened.js +1 -1
- package/dist/fold/own.js +3 -3
- package/dist/fold/paid.js +1 -1
- package/dist/fold/place-inputs.js +1 -1
- package/dist/fold/places.js +1 -1
- package/dist/fold/reach.js +1 -1
- package/dist/fold/readers.js +1 -1
- package/dist/fold/region.js +1 -1
- package/dist/fold/release-policy.js +1 -1
- package/dist/fold/resolved.js +1 -1
- package/dist/fold/roles.js +1 -1
- package/dist/fold/shards.js +8 -8
- package/dist/fold/signed.js +3 -3
- package/dist/fold/signers.js +1 -1
- package/dist/fold/stranger.js +6 -6
- package/dist/fold/wire.js +1 -1
- package/dist/fold/zoom.js +1 -1
- package/dist/host/act-cost.js +1 -1
- package/dist/host/adapters/keys/ed25519.js +1 -1
- package/dist/host/adapters/transport/http.js +1 -1
- package/dist/host/admitted-place.js +1 -1
- package/dist/host/call-context.js +1 -1
- package/dist/host/capsule-process.js +1 -1
- package/dist/host/capsule.js +1 -1
- package/dist/host/cell-receipts.js +1 -1
- package/dist/host/command-server.js +4 -0
- package/dist/host/content-store.js +1 -1
- package/dist/host/contextual-place.js +1 -1
- package/dist/host/digest.js +1 -1
- package/dist/host/host-controls.js +1 -1
- package/dist/host/in-process-act.js +1 -1
- package/dist/host/in-process-context.js +1 -1
- package/dist/host/in-process-root.js +1 -1
- package/dist/host/in-process.js +1 -1
- package/dist/host/index.d.ts +1 -1
- package/dist/host/index.js +1 -1
- package/dist/host/located.js +6 -6
- package/dist/host/native/authority-card-view.js +5 -0
- package/dist/host/native/authority-card.js +1 -0
- package/dist/host/native/command.js +1 -1
- package/dist/host/native/custody.js +1 -1
- package/dist/host/native/generated-custodian.js +1 -1
- package/dist/host/native/installed-package.d.ts +1 -0
- package/dist/host/native/installed-package.js +5 -0
- package/dist/host/native/module-delivery.d.ts +1 -1
- package/dist/host/native/module-delivery.js +1 -1
- package/dist/host/native/module-inventory.js +2 -0
- package/dist/host/native/module-syntax.js +1 -1
- package/dist/host/native/native-binary.js +1 -1
- package/dist/host/native/probes.js +1 -0
- package/dist/host/native/reading-witness-admission.js +5 -0
- package/dist/host/native/reading.js +1 -1
- package/dist/host/native/route.js +1 -1
- package/dist/host/native-place-state.js +1 -0
- package/dist/host/native-receiver.js +1 -1
- package/dist/host/objects.js +1 -1
- package/dist/host/persistent-host.js +1 -0
- package/dist/host/physical-lines.d.ts +1 -0
- package/dist/host/physical-lines.js +1 -0
- package/dist/host/place-act-transaction.js +1 -1
- package/dist/host/place-clock-selection.js +1 -1
- package/dist/host/ports/local-act.js +1 -1
- package/dist/host/ports/place-act.js +1 -1
- package/dist/host/ports/store.js +1 -1
- package/dist/host/ports/transport.js +1 -1
- package/dist/host/profile-composition.d.ts +1 -0
- package/dist/host/profile-composition.js +2 -0
- package/dist/host/reading-closures.js +6 -6
- package/dist/host/reading-context.js +1 -1
- package/dist/host/reading-identity.js +2 -2
- package/dist/host/reading-preparation.js +1 -1
- package/dist/host/reference-authenticated.d.ts +1 -1
- package/dist/host/reference-authenticated.js +1 -1
- package/dist/host/reference-export.js +1 -1
- package/dist/host/reference-native-api.d.ts +1 -1
- package/dist/host/reference-native-api.js +1 -1
- package/dist/host/reference-native.js +1 -1
- package/dist/host/reference-standing.js +1 -1
- package/dist/host/reference.js +1 -1
- package/dist/host/refusals.js +2 -2
- package/dist/host/release.js +1 -1
- package/dist/host/root-clock-source.js +1 -1
- package/dist/host/selected-capsules.js +1 -1
- package/dist/host/selected-topos.js +1 -1
- package/dist/host/signing.js +2 -2
- package/dist/host/source-content.js +1 -1
- package/dist/host/standing-carrier.js +1 -1
- package/dist/host/standing-projection.js +1 -1
- package/dist/host/timing.js +1 -1
- package/dist/host/walk.js +1 -1
- package/dist/host/work-trace.js +1 -0
- package/dist/judge/late.js +1 -1
- package/dist/judge/take.js +1 -1
- package/dist/judge/widening.js +1 -1
- package/dist/land/act.js +6 -6
- package/dist/land/alias.js +1 -1
- package/dist/land/held.js +1 -1
- package/dist/land/ledger.js +5 -6
- package/dist/land/sign.js +1 -1
- package/dist/land/standing-pin.js +1 -1
- package/dist/land/vouched.js +1 -1
- package/dist/land/withdraw.js +1 -1
- package/dist/observe/files.js +1 -1
- package/dist/observe/identity.js +1 -1
- package/dist/observe/match.js +1 -1
- package/dist/observe/regions.js +1 -1
- package/dist/observe/run.js +1 -2
- package/dist/observe/runner.js +1 -1
- package/dist/public-types.d.ts +945 -40
- package/dist/render/capsule.js +1 -1
- package/dist/render/field.js +1 -1
- package/dist/render/open.js +1 -1
- package/dist/render/page.js +1 -1
- package/dist/render/receipt-projection.js +1 -0
- package/dist/render/receipts.js +1 -1
- package/dist/render/shape.js +1 -1
- package/dist/render/target.js +4 -4
- package/dist/render/view.js +5 -5
- package/dist/vendor/bundle.json +1 -1
- package/dist/vendor/library14.js +1 -0
- package/dist/vendor/runtime.js +53 -30
- package/dist/wasm/adapter.d.ts +1 -1
- package/docs/contracts/authenticated-reference.publication.json +1 -1
- package/docs/contracts/authority-preflight.md +17 -0
- package/docs/contracts/authority-preflight.publication.json +25 -0
- package/docs/contracts/installed-package.md +21 -0
- package/docs/contracts/installed-package.publication.json +25 -0
- package/docs/contracts/materialized-leaf-sequence.md +15 -0
- package/docs/contracts/materialized-leaf-sequence.publication.json +25 -0
- package/docs/contracts/module-inventory.md +15 -0
- package/docs/contracts/module-inventory.publication.json +25 -0
- package/docs/contracts/native-host.md +29 -1
- package/docs/contracts/native-host.publication.json +4 -4
- package/docs/contracts/native-probes.md +13 -0
- package/docs/contracts/native-probes.publication.json +25 -0
- package/docs/contracts/native-publication.inventory.json +9 -1
- package/docs/contracts/native-view-batch.md +17 -0
- package/docs/contracts/native-view-batch.publication.json +25 -0
- package/docs/contracts/physical-lines.md +19 -0
- package/docs/contracts/physical-lines.publication.json +25 -0
- package/docs/contracts/profile-composition.md +17 -0
- package/docs/contracts/profile-composition.publication.json +25 -0
- package/docs/contracts/profile-preparation-native-meaning.md +9 -0
- package/docs/contracts/publication.md +12 -0
- package/docs/contracts/reading-identity.md +26 -2
- package/docs/contracts/reading-identity.publication.json +4 -4
- package/docs/contracts/reading-witness-admission.md +49 -0
- package/docs/contracts/readme.publication.json +1 -1
- package/docs/contracts/reference-port.md +11 -0
- package/docs/contracts/reference-port.publication.json +1 -1
- package/docs/contracts/refusals.bound +346 -145
- package/docs/contracts/refusals.md +119 -54
- package/docs/contracts/refusals.publication.json +2 -2
- package/docs/reference.md +8 -0
- package/licenses/wasm/{fast-text-encoding.txt → NOTICE.txt} +111 -0
- package/package.json +69 -8
- package/receipts.bound +12921 -11722
- package/samples/authority-preflight/no.json +6 -0
- package/samples/authority-preflight/yes.json +30 -0
- package/samples/engine-alphabet/reader.js +3 -1457
- package/samples/engine-alphabet/receipts.bound +7 -7
- package/samples/engine-interval/reader.js +3 -1457
- package/samples/engine-interval/receipts.bound +7 -7
- package/samples/installed-package/consumer.mjs +29 -0
- package/samples/installed-package/fixture.json +48 -0
- package/samples/installed-package/no.json +10 -0
- package/samples/installed-package/yes.json +52 -0
- package/samples/materialized-leaf-sequence/no.json +11 -0
- package/samples/materialized-leaf-sequence/yes.json +10 -0
- package/samples/module-inventory/yes.json +28 -0
- package/samples/native/physical-line-reader.mjs +1 -0
- package/samples/native/physical-line-reader.source.mjs +13 -0
- package/samples/native-host/no.json +6 -1
- package/samples/native-host/yes.json +18 -1
- package/samples/native-probes/inputs/inspection.json +28 -0
- package/samples/native-probes/no.json +7 -0
- package/samples/native-probes/yes.json +28 -0
- package/samples/native-view-batch/no.json +14 -0
- package/samples/native-view-batch/yes.json +10 -0
- package/samples/no/engine-order/reader.js +3 -1457
- package/samples/no/module-inventory/no.json +10 -0
- package/samples/physical-lines/no.json +5 -0
- package/samples/physical-lines/yes.json +9 -0
- package/samples/profile-composition/no.json +6 -0
- package/samples/profile-composition/yes.json +14 -0
- package/samples/reading-identity/no.json +7 -1
- package/samples/reading-identity/yes.json +24 -1
- package/vectors/native/authority-preflight.vector.json +55 -0
- package/vectors/native/installed-package.vector.json +31 -0
- package/vectors/native/materialized-leaf-sequence.vector.json +31 -0
- package/vectors/native/module-inventory.vector.json +56 -0
- package/vectors/native/native-host.vector.json +214 -0
- package/vectors/native/native-probes.vector.json +31 -0
- package/vectors/native/native-view-batch.vector.json +31 -0
- package/vectors/native/physical-lines.vector.json +105 -0
- package/vectors/native/profile-composition.vector.json +53 -0
- package/vectors/native/reading-identity.vector.json +38 -0
- package/vectors/native/refusals.vector.json +36 -2
- package/dist/vendor/library11.js +0 -1
- package/dist/vendor/sources.json +0 -1
- package/licenses/wasm/bound.txt +0 -21
- package/licenses/wasm/jitl-quickjs-ffi-types.txt +0 -21
- package/licenses/wasm/jitl-quickjs-wasmfile-release-sync.txt +0 -47
- package/licenses/wasm/obligations.txt +0 -21
- package/licenses/wasm/quickjs-emscripten-core.txt +0 -21
- package/licenses/wasm/topos.txt +0 -21
- /package/dist/vendor/{50086958553b9376d600583f7dff354196bfeb41170fc6d1482ca7bea7c493e2.LICENSE → 28cba430228db1c04f446c93f81b09a2705d6bf3e222d35adbe5a4cee4061884.LICENSE} +0 -0
- /package/dist/vendor/{b3e938d28f88a1851af303a40c749e12ebd5a686daac4f0b343b5cdd2e040419.LICENSE → 7aca161279d14bc0e054dcc281cd110aeb95be2e026b42fdf527a260e58b2aae.LICENSE} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var x=Object.defineProperty;var c=(t,i)=>x(t,"name",{value:i,configurable:!0});import{
|
|
1
|
+
var x=Object.defineProperty;var c=(t,i)=>x(t,"name",{value:i,configurable:!0});import{library5_readingIdentityBytes as w,library5_readingReceiptBytes as U}from"../vendor/runtime.js";import{encodeUTF8 as B}from"./encoding.js";import{invokeByteComputationPort as q,invokeFrameSigningPort as v,invokeSignatureVerificationPort as p}from"./ports.js";import{BoundRefusal as A}from"../host/refusals.js";const a=c(t=>{throw new A("computation/"+t,"REFUSE\xB7computation/"+t)},"refuse"),f=c(t=>{(typeof t!="string"||!/^sha256:[a-f0-9]{64}$/.test(t))&&a("context")},"pin"),d=c(async(t,i)=>{const n=await t(new Uint8Array(i));return f(n),n},"hash"),b="computation/request";async function k(t,i,n){(!t||!t.reading||!(i instanceof Uint8Array)||typeof t.keyId!="string"||!t.keyId||typeof t.algorithm!="string"||!t.algorithm)&&a("context");let e;try{e=structuredClone(t)}catch{return a("context")}f(e.contract),f(e.numericPolicy);try{w(e.reading)}catch{return a("context")}for(const r of[e.reading.instrument,e.reading.implementation,e.reading.policy])f(r);e.reading.inputs.some(([r])=>r===b)&&a("context");const s={...e.reading,inputs:[...e.reading.inputs,[b,await d(n,i)]]};let o;try{o=w(s)}catch{return a("context")}const g=JSON.parse(new TextDecoder().decode(o)),y=await d(n,B(JSON.stringify(["computation-request@1",e.contract,e.numericPolicy,g[3],g[4],g[5]])));return{held:e,question:y,reading:await d(n,o)}}c(k,"prepare");function m(t){return JSON.stringify([t.profile,t.question,t.reading,t.origin,t.result,t.commitment,t.keyId,t.algorithm])+`
|
|
2
2
|
`}c(m,"frame");async function I(t,i,n){const e=await d(n,i);return{profile:"bound-computation@1",question:t.question,reading:t.reading,origin:t.held.reading.implementation,result:e,commitment:await d(n,U(t.reading,e)),keyId:t.held.keyId,algorithm:t.held.algorithm}}c(I,"statement");async function R(t,i,n,e,s){(!(i instanceof Uint8Array)||i.byteLength>e.maxBytes)&&a("budget");const o=new Uint8Array(i),g=await k(t,o,n.digest),y=await q(o,n.evaluate,e,s),r=await I(g,y,n.digest),u=m(r),h=await v({bytes:[u],keyId:r.keyId,algorithm:r.algorithm},n.sign,e,s),l=h[0];return await p(u,l,r.algorithm,n.verify,e,s)||a("signature"),{statement:Object.freeze({...r,signature:l.signature}),output:y}}c(R,"executeComputation");async function z(t,i,n,e,s,o,g){(!(i instanceof Uint8Array)||!(n instanceof Uint8Array)||i.byteLength>o.maxBytes||n.byteLength>o.maxBytes)&&a("budget"),(!e||Object.keys(e).sort().join(",")!=="algorithm,commitment,keyId,origin,profile,question,reading,result,signature"||typeof e.signature!="string")&&a("signature");const y=await k(t,new Uint8Array(i),s.digest),r=await I(y,new Uint8Array(n),s.digest),{signature:u,...h}=e;return m(h)!==m(r)&&a("context"),await p(m(r),{keyId:r.keyId,signature:u},r.algorithm,s.verify,o,g)||a("signature"),Object.freeze({...r,signature:u})}c(z,"verifyComputation");export{R as executeComputation,z as verifyComputation};
|
package/dist/engine/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var a=Object.defineProperty;var i=(n,t)=>a(n,"name",{value:t,configurable:!0});import{objectFold as b}from"./object.js";import{readContent as C,retainContent as E,invokeSigningPort as h}from"./ports.js";import{executeComputation as S,verifyComputation as R}from"./computation.js";import{runConformance as v}from"./conformance.js";import{readRefusalCatalog as O}from"../host/refusals.js";import{
|
|
1
|
+
var a=Object.defineProperty;var i=(n,t)=>a(n,"name",{value:t,configurable:!0});import{objectFold as b}from"./object.js";import{readContent as C,retainContent as E,invokeSigningPort as h}from"./ports.js";import{executeComputation as S,verifyComputation as R}from"./computation.js";import{runConformance as v}from"./conformance.js";import{readRefusalCatalog as O}from"../host/refusals.js";import{library14_validateObjectContext as c}from"../vendor/runtime.js";import{objectFold as f}from"./object.js";import{BoundRefusal as o}from"../host/refusals.js";import{encodeUTF8 as p,decodeUTF8 as u}from"./encoding.js";function x(n,t){let e;try{e=JSON.parse(u(n))}catch{throw new o("engine/input","REFUSE\xB7engine/input")}if(!Array.isArray(e)||e.length!==2||e[0]!=="bound-object-request@1"||!Array.isArray(e[1]))throw new o("engine/input","REFUSE\xB7engine/input");let r;try{r=c(e[1],t)}catch{throw new o("engine/context","REFUSE\xB7engine/context")}if(r.kind!=="fact")throw new o("engine/context","REFUSE\xB7engine/context");return p(JSON.stringify(["fact",f(r.value,t)])+`
|
|
2
2
|
`)}i(x,"objectFoldBytes");export{S as executeComputation,h as invokeSigningPort,b as objectFold,x as objectFoldBytes,C as readContent,O as readRefusalCatalog,E as retainContent,v as runConformance,R as verifyComputation};
|
package/dist/engine/object.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var w=Object.defineProperty;var k=(l,m)=>w(l,"name",{value:m,configurable:!0});import{
|
|
1
|
+
var w=Object.defineProperty;var k=(l,m)=>w(l,"name",{value:m,configurable:!0});import{library2_cell as y,library2_sign as _,library2_join as h,library2_require as v,library2_observe as M,library2_mark as j,library2_parts as C,library2_state as N,library2_live as c,library2_restOf as O}from"../vendor/runtime.js";import{library14_restCoordinates as q}from"../vendor/runtime.js";function z(l,m){let a=new Map;const u=new Map(l.filter(s=>s.record==="cell").map(s=>[s.fields.scope,s])),g=new Map([...u].map(([s,e])=>[s,m.resolve(e)])),b=new Map(l.map(s=>[s.fields.id,s]));for(const s of[...l].sort((e,i)=>Number(e.fields.epoch)-Number(i.fields.epoch))){const e=s.fields,i=e.scope,o=Number(e.epoch);if(s.record==="cell"){a=new Map([...a,[i,y(i,o,[],q(e.restsOn))]]);continue}const r=g.get(i),f=r.form.lattice(r.params),d=a.get(i);if(s.record==="claim"){const t=e.sign==="-1"?b.get(e.takes).fields:e,n=M(d,{id:e.id,at:o,origin:t.origin,span:r.form.parse(r.params,t.value),...e.takes?{takes:e.takes}:{}},e.sign==="-1"?-1:1),p=[...n.seen];p[p.length-1]={...p.at(-1),id:e.id},a=new Map([...a,[i,{...n,seen:p}]])}else if(e.sign==="-1"){const t=b.get(e.takes).fields;a=new Map([...a,[i,{...d,marks:[...d.marks??[],j({id:e.id,at:o,takes:e.takes,pole:t.pole,reach:"local",span:r.form.parse(r.params,t.value)})]}]])}else if(e.widens!==void 0){const t=h(f,d,r.form.parse(r.params,e.value),e.widens,o),n=[...t.marks??[]];n[n.length-1]={...n.at(-1),id:e.id},a=new Map([...a,[i,{...t,marks:n}]])}else{const t=r.form.parse(r.params,e.value);a=e.pole==="floor"?v(f,a,i,t,{id:e.id,at:o}):_(f,a,i,t,{id:e.id,at:o})}}return[...a].map(([s,e])=>{const i=g.get(s),o=i.form.lattice(i.params);return{cell:s,state:N(o,e,a),parts:C(o,e,a),rest:O(e,a),ownMarks:c(e.marks??[]).map(r=>r.id),ownClaims:c(e.seen).map(r=>({id:r.id,origin:r.origin})),marks:c(e.marks??[]),claims:c(e.seen)}})}k(z,"objectFold");export{z as objectFold};
|
package/dist/engine/ports.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var v=Object.defineProperty;var s=(e,t)=>v(e,"name",{value:t,configurable:!0});import{
|
|
1
|
+
var v=Object.defineProperty;var s=(e,t)=>v(e,"name",{value:t,configurable:!0});import{library14_signerRequestBytes as A,library14_signerResponseBytes as O,library14_signerResponseOf as R}from"../vendor/runtime.js";import{BoundRefusal as B}from"../host/refusals.js";import{encodeUTF8 as b}from"./encoding.js";function j(e,t,n,r){g(n);const a=h(e,n.maxBytes);return p(n,r,async i=>h(await t(a,i),n.maxBytes))}s(j,"invokeByteComputationPort");function E(e,t,n,r,a,i){return g(a),b(e).length+b(t.signature).length>a.maxBytes&&o("budget"),p(a,i,async f=>{const c=await r(e,Object.freeze({...t}),n,f);return typeof c!="boolean"&&o("response"),c})}s(E,"invokeSignatureVerificationPort");class x extends B{static{s(this,"PortFault")}}const o=s(e=>{throw new x("host-port/"+e,"REFUSE\xB7host-port/"+e)},"fail");function g(e){(!e||!Number.isSafeInteger(e.timeoutMs)||e.timeoutMs<1||e.timeoutMs>2147483647||!Number.isSafeInteger(e.maxBytes)||e.maxBytes<1)&&o("budget")}s(g,"limitsOf");async function p(e,t,n){return g(e),t?.aborted&&o("cancelled"),new Promise((r,a)=>{const i=new AbortController;let f=!1;const c=s((u,S)=>{f||(f=!0,clearTimeout(d),t?.removeEventListener("abort",y),u?(i.abort(),a(new B("host-port/"+u,"REFUSE\xB7host-port/"+u))):r(S))},"finish"),y=s(()=>c("cancelled"),"abort"),d=setTimeout(()=>c("timeout"),e.timeoutMs);if(t?.addEventListener("abort",y,{once:!0}),t?.aborted){y();return}Promise.resolve().then(()=>(f&&o("cancelled"),n(i.signal))).then(u=>c(void 0,u),u=>c(u instanceof x?u.code.slice(10):"failed"))})}s(p,"bounded");function h(e,t){return e instanceof Uint8Array||o("response"),e.byteLength>t&&o("budget"),typeof SharedArrayBuffer<"u"&&e.buffer instanceof SharedArrayBuffer&&o("response"),new Uint8Array(e)}s(h,"owned");const l=s(e=>{/^sha256:[a-f0-9]{64}$/.test(e)||o("integrity")},"identity");async function F(e,t,n,r,a){return g(r),l(t),p(r,a,async i=>{const f=h(await n.read(e,t,i),r.maxBytes);return i.aborted&&o("cancelled"),await n.digestBytes(new Uint8Array(f))!==t&&o("integrity"),i.aborted&&o("cancelled"),f})}s(F,"readContent");async function L(e,t,n,r,a){g(r),l(e),a?.aborted&&o("cancelled");const i=h(t,r.maxBytes);return p(r,a,async f=>(await n.digestBytes(new Uint8Array(i))!==e&&o("integrity"),f.aborted&&o("cancelled"),await n.retain(e,i,f)!==void 0&&o("response"),Object.freeze({digest:e,bytes:i.byteLength})))}s(L,"retainContent");async function C(e,t,n,r){m(e,n);let a;try{a=A(e)}catch{return o("response")}return w(e,a,t,n,r)}s(C,"invokeSigningPort");async function I(e,t,n,r){return m(e,n),w(e,JSON.stringify(e)+`
|
|
2
2
|
`,t,n,r)}s(I,"invokeFrameSigningPort");function m(e,t){g(t),(!e||!Array.isArray(e.bytes)||!e.bytes.length||typeof e.keyId!="string"||!e.keyId||typeof e.algorithm!="string"||!e.algorithm)&&o("budget");let n=0;for(const r of e.bytes)(typeof r!="string"||r.length>t.maxBytes-n)&&o("budget"),n+=b(r).length+1,n>t.maxBytes&&o("budget")}s(m,"validateSigningLot");function w(e,t,n,r,a){b(t).length>r.maxBytes&&o("budget");const i=Object.freeze({...e,bytes:Object.freeze([...e.bytes])});return p(r,a,async f=>{const c=await n(i,f);(!Array.isArray(c)||c.length!==e.bytes.length||c.some(d=>!d||typeof d.signature!="string"||d.signature.length>r.maxBytes))&&o("response");let y;try{y=O(c)}catch{return o("response")}b(y).length>r.maxBytes&&o("budget");try{return Object.freeze(R(y,e).map(d=>Object.freeze({...d})))}catch{return o("response")}})}s(w,"invokeDeclaredSignatures");export{j as invokeByteComputationPort,I as invokeFrameSigningPort,E as invokeSignatureVerificationPort,C as invokeSigningPort,F as readContent,L as retainContent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var f=Object.defineProperty;var i=(o,e)=>f(o,"name",{value:e,configurable:!0});import{bootstrapAnchor as d}from"./bootstrap-anchor.js";import{rootLedgerLines as u,storeOf as h}from"../land/ledger.js";import{fieldOf as c,isConfig as m}from"./claims.js";const a=new WeakMap;function y(o,e){const r=u(h(o)),s=Object.isFrozen(r)?a.get(r):void 0;if(s?.epoch===e)return s.lines;const n=Object.freeze([...new Set(r)].filter(t=>c(t,"sig")!==""&&(!m(t)||Number(c(t,"epoch"))<=e)));return Object.isFrozen(r)&&a.set(r,{epoch:e,lines:n}),n}i(y,"admissionHistoryAt");function O(o){const e=d(o);if(!e)throw Error("REFUSE\xB7act historical admission requires one bootstrap anchor");return{id:e.id,keyClass:"authorize",publicKey:e.publicKey,coverage:e.coverage,depth:{lo:1,hi:16},admittedBy:[]}}i(O,"admissionAnchor");export{O as admissionAnchor,y as admissionHistoryAt};
|
package/dist/fold/ceilings.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var V=Object.defineProperty;var f=(o,a)=>V(o,"name",{value:a,configurable:!0});import{
|
|
1
|
+
var V=Object.defineProperty;var f=(o,a)=>V(o,"name",{value:a,configurable:!0});import{library0_point as I,library0_region as q,library0_within as $}from"../vendor/runtime.js";import{fieldOf as n}from"./claims.js";import{wordOf as W,wordsOf as z}from"./wire.js";import{lockStanding as C}from"./keys.js";import{ownLock as D,ownStore as Q}from"../observe/runner.js";import{library7_ALPHABETS as U,library7_idsOf as x,library7_INTERVALS as L,library7_spanOf as S}from"../vendor/runtime.js";import{placedReadings as F}from"./observed.js";import{library14_combine as G,library14_matches as N}from"../vendor/runtime.js";function R(o){const a=q(o),s=o.split("/"),r=s.slice(1).map((i,u)=>({head:q(s.slice(0,u+1).join("/")),tail:q(s.slice(u+1).join("/"))})),p=s.some(i=>i.includes("*")&&i!=="*"&&i!=="**");return i=>$(i.asked,a)||r.some(({head:u,tail:h})=>$(i.asked,u)&&$(i.where,h)||$(i.where,u)&&$(i.asked,h))||p&&s.slice(1).some((u,h)=>N(s.slice(0,h+1).join("/"),i.question)&&N(s.slice(h+1).join("/"),i.where.at.join("/")))}f(R,"meeting");const J=f((o,a,s,r)=>{const p=n(o,"measure"),i=n(o,"scope").split("/")[0]??"",u=s?.split("/")[0];return u!==void 0&&i!==u&&(r?.has(i)??!1)&&(a[p]??(p==="count"?a[n(o,"scope")]:void 0))!==void 0},"answersElsewhere");function ie(o){const a=new Map;for(const e of F(o.observed)){const t=a.get(e.measure)??[];t.push({question:e.question,measure:e.measure,value:e.value,asked:I(e.question),where:I(e.place)}),a.set(e.measure,t)}const s=f(e=>z(e,"states").includes("unread")?W(e,"states","unread"):void 0,"unreadOf"),r=s(o.standing)??s(D())??s(C(Q())),p=[],i=[],u=[],h=new Map;for(const e of a.get("line")??[])h.set(`${e.question} ${e.where.at.join("/")}`,new Map(e.value.split("|").filter(Boolean).map(t=>[t.slice(0,t.lastIndexOf(":")),t.slice(t.lastIndexOf(":")+1)])));const O=new Map,_=f((e,t,w,g)=>{const m=n(e,"scope"),y=n(e,"value"),j=f(l=>{O.set(m,[...O.get(m)??[],t===m?l:`${t} ${l}`])},"heard");if(n(e,"form")==="interval"){const l=S(y);if(!l)return;const v=w.map(P=>S(P)?.lo??0);let d;try{d=G(n(e,"measure"),v)}catch{i.push({ceiling:m,question:t,got:`no combination for ${n(e,"measure")}, read ${v.length} times`,side:"over"});return}const E={lo:d,hi:d};j(String(d)),L.leq(E,{lo:l.lo,hi:1/0})||i.push({ceiling:m,question:t,got:String(d),side:"short"}),L.leq(E,{lo:-1/0,hi:l.hi})||i.push({ceiling:m,question:t,got:String(d),side:"over"});return}const b=new Set(w.flatMap(l=>[...x(l).values]));j([...b].sort().join("|")||"none");const c=x(y);if(!U.leq({polarity:"permit",values:b},c)){const l=[...b].filter(d=>c.values.has(d)===(c.polarity==="forbid")).sort(),v=f(d=>g===void 0||h.get(g)?.get(d)===void 0?d:`${d}:${h.get(g).get(d)}`,"line");i.push({ceiling:m,question:t,got:l.map(v).join("|"),side:"over"})}},"bound"),B=f(e=>e===r?void 0:o.own[e],"own"),H=f(e=>o.under&&e.startsWith(o.under)?e.slice(o.under.length):e,"localScope"),M=f(e=>H(e).split("/").filter(t=>!t.includes("*")).length,"literal"),A=[];for(const e of o.ceilings){const t=n(e,"measure");if(t===r){A.push(e);continue}const w=B(t)??(t==="count"?o.own[n(e,"scope")]:void 0);if(J(e,o.own,o.under,o.places))continue;if(w!==void 0){p.push(e),_(e,n(e,"scope"),[`${w}..${w}`]);continue}const g=new Map,m=new Map,y=R(n(e,"scope")),j=t==="per-file"||n(e,"scope").endsWith("/*")||n(e,"form")==="alphabet",b=S(n(e,"value"))?o.ceilings.filter(c=>n(c,"measure")===t&&S(n(c,"value"))&&M(n(c,"scope"))>M(n(e,"scope"))).map(c=>R(n(c,"scope"))):[];for(const c of a.get(t)??[]){if(!y(c)||b.some(v=>v(c)))continue;const l=j?c.where.at.join("/"):c.question;g.set(l,[...g.get(l)??[],c.value]),m.set(l,`${c.question} ${c.where.at.join("/")}`)}if(!g.size){u.push(e);continue}p.push(e);for(const[c,l]of g)_(e,c,l,m.get(c))}for(const e of A)p.push(e),_(e,n(e,"scope"),[`${u.length}..${u.length}`]);const k=f(e=>Number(n(e,"epoch"))||0,"epochOf");return{read:p,over:i,unread:u.filter(e=>k(e)>o.epoch-3),vacuous:u.filter(e=>k(e)<=o.epoch-3),readings:O}}f(ie,"foldCeilings");function T(o){const a=new Map;for(const s of o)a.set(s.ceiling,[...a.get(s.ceiling)??[],s.question===s.ceiling?s.got:`${s.question}=${s.got}`]);return[...a].map(([s,r])=>`${s} \xB7 ${r.length>4?`${r.slice(0,4).join(" ")} +${r.length-4}`:r.join(" ")}`)}f(T,"listed");function re(o,a,s=new Set){return{read:o.read.length,total:a,unread:o.unread.map(r=>n(r,"scope")),vacuous:o.vacuous.map(r=>n(r,"scope")),short:T(o.over.filter(r=>r.side==="short"&&!s.has(r.question))),over:T(o.over.filter(r=>r.side==="over"))}}f(re,"ceilingSummary");export{J as answersElsewhere,re as ceilingSummary,ie as foldCeilings};
|
package/dist/fold/claims.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`).filter(
|
|
1
|
+
var V=Object.defineProperty;var r=(e,t)=>V(e,"name",{value:t,configurable:!0});import{createHash as D}from"node:crypto";import{basename as H}from"../host/io.js";import{library0_contracts as J,library0_exclusive as X,library0_point as Y,library0_region as q}from"../vendor/runtime.js";import{library14_ENVELOPE as k,library14_PROTOCOL as G,library14_recordKind as Q,library14_signedBytes as Z,library14_parse as ee}from"../vendor/runtime.js";import{CAPSULE as xe,EXTENSION as Ee,LOCK as Se,RECEIPTS as _e}from"../vendor/library14.js";import{ownRoot as te}from"../observe/runner.js";import{hostInstrumentName as ne}from"../host/call-context.js";const z=new Map,F=new Map,R=new Map;function T(e){const t=F.get(e);if(t!==void 0)return t;const s=ee(e);return s.kind==="fact"&&(Object.freeze(s.value.fields),s.value.keys&&Object.freeze(s.value.keys),Object.freeze(s.value)),Object.freeze(s),F.set(e,s),s}r(T,"parsedLine");function L(e){const t=z.get(e);if(t!==void 0)return t;const s=T(e),o=s.kind==="fact"?s.value.fields:{};return z.set(e,o),o}r(L,"wireFields");const ge=r((e,t)=>L(e)[t]??"","fieldOf"),v=r(e=>({...L(e)}),"fieldsOf");function ye(){return ne()??H(te())}r(ye,"selfName");function se(e){return e.startsWith(G)}r(se,"isWire");const we=r(e=>(e??"").split(`
|
|
2
|
+
`).filter(se),"wireLinesOf"),M=r(e=>{const t=R.get(e);if(t!==void 0)return t;const s=Q(e),o=s.kind==="fact"&&s.value==="config";return R.set(e,o),o},"isConfig"),re=r(e=>M(e)?Object.entries(v(e)).filter(([t])=>!k.has(t)).sort(([t],[s])=>t<s?-1:1).map(([t,s])=>`${t}=${s}`).join(" "):(t=>t.kind==="fact"?Z(t.value.fields):e)(T(e)),"sayingOf");function oe(e){const t=L(e);return`${t.scope??""} ${t.role??""} ${t.measure??""}`}r(oe,"claimKey");function K(e,t=!0){return Object.keys(e).filter(s=>!k.has(s)&&s!=="value"&&(t||s!=="at")).sort().map(s=>`${s}=${e[s]}`).join(" ")}r(K,"contentOf");function U(e){return(v(e).needs??"").split("|").filter(Boolean).map(t=>q(t))}r(U,"regionsOf");function ie(e,t,s){const o=v(e).scope??"",a=U(e);if(a.length===0)return!1;const f=X(a,t.filter(i=>i!==e).map(U)),l=s.filter(i=>i.scope===o).flatMap(i=>i.moved.map(u=>Y(u)));return J(f,l)}r(ie,"contracted");function ae(e,t){return Object.keys(e).filter(s=>!k.has(s)&&s!=="value").every(s=>t[s]===e[s])}r(ae,"retracts");function ce(e,t,s=!1){const o=new Map;for(const p of e.filter(M)){const y=oe(p),m=o.get(y)??[];m.includes(p)||m.push(p),o.set(y,m)}const a=[...new Set(e.filter(p=>!M(p)))],f=[],l=[],i=[],u=[];for(const[p,y]of o){const m=y.map(n=>({line:n,fields:v(n)})),w=m.filter(n=>n.fields.value==="withdraw"),E=m.filter(n=>n.fields.value!=="withdraw"),$=new Set(E.flatMap((n,d)=>w.some(c=>ae(c.fields,n.fields))?[]:[String(d)]));f.push(...E.filter((n,d)=>!$.has(String(d))).map(n=>n.line));const b=E.filter((n,d)=>$.has(String(d)));if(!b.length){const n=new Map;for(const c of w)n.set(K(c.fields),c.line);const d=[...n.values()];a.push(...d),l.push(...w.map(c=>c.line).filter(c=>!d.includes(c)));continue}l.push(...w.map(n=>n.line));const j=r(n=>Number(n.fields.epoch)||0,"epochOf"),S=new Map,O=r(n=>`${n.fields.by??""} ${K(n.fields)}`,"who");for(const n of b)S.set(O(n),Math.max(S.get(O(n))??0,j(n)));const B=b.filter(n=>j(n)<(S.get(O(n))??0));l.push(...B.map(n=>n.line));const C=b.filter(n=>!B.includes(n)),N=new Map;for(const n of C){const d=n.fields.by??"",c=O(n),_=N.get(c)??new Set;if(_.add(re(n.line)),N.set(c,_),_.size>1)throw Error(`REFUSE\xB7document ${p} \xB7 ${d} has two live inscriptions without withdrawal`)}const g=[...new Set(C.map(n=>n.line))],P=t&&g.length>1?g.filter(n=>!ie(n,g,t)):g;i.push(...g.filter(n=>!P.includes(n))),a.push(...P)}const W=new Set([...a,...f,...l,...i]);return{standing:a,superseded:[...new Set([...l,...e.filter(p=>!W.has(p))])],retracted:f,forks:u,vacuous:i}}r(ce,"foldClaimsUncached");const h=new Map;let x=0;const A=32*1024*1024;function I(e){return{...e,standing:[...e.standing],superseded:[...e.superseded],retracted:[...e.retracted],vacuous:[...e.vacuous],forks:e.forks.map(t=>({...t,lines:[...t.lines]}))}}r(I,"copyFold");function be(e,t,s=!1){const o=JSON.stringify([Array.from(e),t===void 0?null:t.map(u=>[u.scope,Array.from(u.moved)]),s]),a=D("sha256").update(o).digest("hex"),f=h.get(a);if(f?.input===o)return I(f.result);const l=ce(e,t,s),i=Buffer.byteLength(o);if(i<=A){for(f&&(x-=Buffer.byteLength(f.input),h.delete(a));h.size>=8||x+i>A;){const u=h.keys().next().value;if(u===void 0)break;x-=Buffer.byteLength(h.get(u).input),h.delete(u)}h.set(a,{input:o,result:I(l)}),x+=i}return l}r(be,"foldClaims");export{xe as CAPSULE,Ee as EXTENSION,Se as LOCK,_e as RECEIPTS,oe as claimKey,ge as fieldOf,v as fieldsOf,be as foldClaims,M as isConfig,se as isWire,T as parsedLine,re as sayingOf,ye as selfName,we as wireLinesOf};
|
package/dist/fold/closed.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ce=Object.defineProperty;var c=(e,t)=>ce(e,"name",{value:t,configurable:!0});import{hostOutput as ae}from"../host/call-context.js";import{actCosts as fe}from"../host/act-cost.js";import{verifiedReadingReceipts as H}from"../host/reading-closures.js";import{readingProfile as le}from"../host/reading-context.js";import{currentReadingEnvironment as ue}from"../host/native/receipt-environment.js";import{childFlags as pe}from"../host/capsule.js";import{dirname as de,existsSync as I,join as f,mkdirSync as me,relative as j,resolve as F,statSync as J,writeFileSync as N}from"../host/io.js";import{
|
|
1
|
+
var ce=Object.defineProperty;var c=(e,t)=>ce(e,"name",{value:t,configurable:!0});import{hostOutput as ae}from"../host/call-context.js";import{actCosts as fe}from"../host/act-cost.js";import{verifiedReadingReceipts as H}from"../host/reading-closures.js";import{readingProfile as le}from"../host/reading-context.js";import{currentReadingEnvironment as ue}from"../host/native/receipt-environment.js";import{childFlags as pe}from"../host/capsule.js";import{dirname as de,existsSync as I,join as f,mkdirSync as me,relative as j,resolve as F,statSync as J,writeFileSync as N}from"../host/io.js";import{library14_byBytes as he,library14_canonical as ge,library14_LOCK as w,library14_parse as ye,library14_publicationOf as be,library14_roleAt as we,library14_roleClaimsOf as $e}from"../vendor/runtime.js";import{RECEIPTS as $,fieldOf as a,foldClaims as ve,isConfig as Q,isWire as h}from"./claims.js";import{bytesDigest as T,fullDigest as V}from"../host/digest.js";import{mountedCoordinatesIn as P,worldAt as xe}from"./places.js";import{ownLockOf as Se}from"./signed.js";import{viewsOf as Ce}from"./views.js";import{keptPlace as Oe}from"./kept.js";import{storeAt as ke,storeOf as X}from"../land/ledger.js";import{coordinatesUnder as Ee,observeFile as z,observeText as g}from"../observe/files.js";import{bytesOnly as Re,carriedFrom as W}from"./resolved.js";import{takenFor as je}from"../fold/place-inputs.js";let Y=0,Z={count:0,ms:0};const st=c(()=>Y,"idleCount"),it=c(()=>{Y+=1},"noteIdle"),rt=c(()=>fe.seconds(),"actSeconds"),ot=c(()=>Z,"receiptsSeen"),_=c(e=>e.match(/(?:value=|place:)([a-z0-9]+):[0-9a-f]{64}/)?.[1]??"","algorithmIn"),Fe=c((e,t)=>{const s=t.replace(/\/$/,"");try{const r=J(f(e,s,w));return`${r.mtimeMs}:${r.size}`}catch{return"none"}},"lockStamp"),ee=c(e=>P(e,(g(f(e,w))??"").split(`
|
|
2
2
|
`).filter(h)),"publishedMounts");function Me(e,t,s,r){const i=s.replace(/^receipts\//,"").replace(/\/$/,""),n=f(e,t),l=t.replace(/\/$/,""),p=I(f(n,w))?[l?`${l}/${w}`:w]:[],o=`${l?`${l}/`:""}${$}`,d=$e((g(f(n,w))??"").split(`
|
|
3
3
|
`).filter(h).flatMap(u=>{const m=ye(u);return m.kind==="fact"?[m.value.fields]:[]})),b=[...P(n),...ee(n)],v=[...new Set([...P(e),...ee(e),...b.map(u=>j(e,f(n,u)))])],S=Ee(f(n,i),e).filter(u=>we(j(n,f(e,u)),d)!=="foreign"&&!v.some(m=>u===m||u.startsWith(`${m}/`))),R=r.filter(u=>a(u,"measure")==="observed").flatMap(u=>{const m=a(u,"scope"),x=F(n,m),y=j(n,x);return y===".."||y.startsWith("../")||F(x)===F(n)?[]:i!=="."&&i!==""&&y!==i&&!y.startsWith(`${i}/`)?[]:I(x)&&J(x).isFile()?[j(e,x)]:[]});return[...new Set([...S,...R,...p])].filter(u=>u!==o&&!u.split("/").some(m=>m===".bound"||m===".cache"||m===".git"))}c(Me,"filesOf");const te=new Map;let B;function ne(e){const t=e.join(`
|
|
4
4
|
`);if(B?.input===t)return B.output;if(!e.length||!e.every(Q))return e;const s=ve(e);if(s.forks.length)throw Error("REFUSE\xB7receipt disputed configuration standing");const r=be(s.standing.filter(i=>a(i,"value")!=="withdraw"));return B={input:t,output:r},r}c(ne,"publicConfiguration");function De(e,t){const s=t.replace(/\/$/,"");if(!s)return[];const r=`${e}\0${s}\0${Fe(e,"")}`,i=te.get(r);if(i!==void 0)return i;const n=ne((g(f(e,w))??"").split(`
|
package/dist/fold/configures.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var s=Object.defineProperty;var i=(r,o)=>s(r,"name",{value:o,configurable:!0});import{
|
|
1
|
+
var s=Object.defineProperty;var i=(r,o)=>s(r,"name",{value:o,configurable:!0});import{library14_isWireClaim as f,library14_parse as t}from"../vendor/runtime.js";import{fieldOf as e,isConfig as a}from"./claims.js";import{isReaderLock as m}from"./observed.js";import{isRoleLock as c}from"./roles.js";import{isSignerLock as n}from"./signers.js";import{isReleaseBinding as u}from"../host/release.js";import{isRegionDeclaration as d}from"./region-declarations.js";import{ownLock as p}from"../observe/runner.js";function g(r){const o=t(r);return o.kind==="fact"&&o.value.fields.measure==="effect"}i(g,"isEffectLock");function k(r){const o=t(r);return u(r)||g(r)||m(r)||c(r)||n(r)||o.kind==="fact"&&f(o.value.fields)||d(r,p())}i(k,"configures");function y(r){return a(r)&&e(r,"role")==="reads"&&e(r,"value")!=="withdraw"&&!k(r)}i(y,"isCeiling");function W(r){return e(r,"role")==="demands"&&e(r,"needs")!==""}i(W,"asksThePlace");export{W as asksThePlace,y as isCeiling};
|
package/dist/fold/digests.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
`).filter(
|
|
3
|
-
`);let
|
|
4
|
-
`,
|
|
5
|
-
`,
|
|
6
|
-
`).flatMap(e=>e.indexOf(" ")>0?[[e.slice(0,e.indexOf(" ")),e.slice(e.indexOf(" ")+1)]]:[]))).get(n),"memoOf");function
|
|
7
|
-
`)),
|
|
8
|
-
`)),
|
|
9
|
-
`),
|
|
10
|
-
`)))}l(
|
|
1
|
+
var I=Object.defineProperty;var l=(n,e)=>I(n,"name",{value:e,configurable:!0});import{preparingView as D}from"../host/reading-context.js";import{BoundRefusal as z}from"../host/refusals.js";import{signatureEraOf as K}from"../host/signature-era.js";import{ledgerLines as _,ledgerWriters as q}from"../land/ledger.js";import{readOnly as E}from"../host/read-only.js";import{appendFileSync as S,dirname as k,join as x,mkdirSync as U,readdirSync as V,realpathSync as X,relative as j,resolve as h}from"../host/io.js";import{bytesDigest as G,fullDigest as H}from"../host/digest.js";import{coordinatesUnder as J,observeFile as $,observeText as A,stampOf as P}from"../observe/files.js";import{releaseOf as Q,signedLockLines as Y}from"./keys.js";import{EXTENSION as W,fieldOf as o,foldClaims as Z,selfName as B}from"./claims.js";import{wireLine as ee}from"./wire.js";import{library14_publicLock as ne,library14_LOCK as te}from"../vendor/runtime.js";import{builtinModules as ie,createRequire as re}from"node:module";import{moduleImports as N}from"../host/adapters/modules/javascript.js";const T=new Map;let se=0;const Se=l(()=>se,"algorithmCost");function oe(n){const e="scope=wire/digest-algorithms",r="scope=audit/wire/digest-algorithms";let i=-1,a="";const d=Q(n);if(d){const f=d.find(c=>(o(c,"scope")==="wire/digest-algorithms"||o(c,"scope")==="audit/wire/digest-algorithms")&&o(c,"value")!=="withdraw");return f===void 0?void 0:o(f,"value").split("|").filter(Boolean)[0]?.split(":")[0]}if(!ce(n)){const c=A(x(k(n),te))?.split(`
|
|
2
|
+
`).filter(w=>w.startsWith("bound-lock/")),u=c===void 0?void 0:ne(c),g=u===void 0?void 0:ee(u,"digest-algorithms");return g===void 0?void 0:o(g,"value").split("|")[0]?.split(":")[0]}for(const f of q(n)){const c=_(n,f).join(`
|
|
3
|
+
`);let u=0;for(;u<c.length;){const g=(()=>{const m=c.indexOf(e,u),p=c.indexOf(r,u);return m<0?p:p<0?m:Math.min(m,p)})();if(g<0)break;const w=c.lastIndexOf(`
|
|
4
|
+
`,g)+1,O=c.indexOf(`
|
|
5
|
+
`,g),b=c.slice(w,O<0?void 0:O);if(u=O<0?c.length:O+1,!b.includes(" sig="))continue;const t=Number(o(b,"epoch"))||0;if(t<i)continue;i=t;const s=o(b,"value");a=s==="withdraw"?"":s.split("|").filter(Boolean)[0]?.split(":")[0]??""}}return a||void 0}l(oe,"namedAlgorithm");function ce(n){try{return V(x(n,"ledger")).length>0}catch(e){if(e.code==="ENOENT")return!1;throw e}}l(ce,"existsLedger");function C(n){const e=T.get(n);if(e!==void 0)return e;const r=oe(n);if(r===void 0)throw new Error(`${B()}: REFUSE\xB7runtime the lock names no \`wire/digest-algorithms\`: nothing can be digested here`);return T.set(n,r),r}l(C,"algorithmOf");function Le(n,e=[]){return de(Z([...Y(n,e),...e]).standing)}l(Le,"signaturesOf");function de(n){try{return K(n)}catch(e){throw new Error(`${B()}: ${e instanceof Error?e.message:String(e)}`)}}l(de,"eraOf");const v=l((n,e)=>G(e,C(n)),"bytesDigest"),fe=l((n,e)=>H(e,C(n)),"fullDigest"),F=new Map,L=l(n=>F.get(n)??F.set(n,new Map((A(x(n,"cas",`stamps${W}`))??"").split(`
|
|
6
|
+
`).flatMap(e=>e.indexOf(" ")>0?[[e.slice(0,e.indexOf(" ")),e.slice(e.indexOf(" ")+1)]]:[]))).get(n),"memoOf");function ae(n,e){const r=P(e);if(r?.kind!=="file")return r===void 0?void 0:v(n,$(e)??new Uint8Array);if(E())return v(n,$(e)??new Uint8Array);const i=`${e} ${r.stamp}`,a=L(n),d=a.get(i);if(d!==void 0)return d;const f=v(n,$(e)??new Uint8Array);return a.set(i,f),E()||(U(x(n,"cas"),{recursive:!0}),S(x(n,"cas",`stamps${W}`),`${i} ${f}
|
|
7
|
+
`)),f}l(ae,"coordinateDigest");function De(n,e,r){if(D())return r();const i=L(n),a=i.get(e);if(a!==void 0)return a;const d=r();return i.set(e,d),E()||(U(x(n,"cas"),{recursive:!0}),S(x(n,"cas",`stamps${W}`),`${e} ${d}
|
|
8
|
+
`)),d}l(De,"memoized");const M=new Map,R=l((n,e,r)=>{if(D()){const c=$(e)??new Uint8Array;if(v(n,c)!==r)throw new z("reading-identity/context","REFUSE\xB7reading-identity/context module bytes changed during capture");const u=`view imports ${e}\0${r}`,g=M.get(u);if(g!==void 0)return g;const w=Object.freeze([...N(new TextDecoder().decode(c),e)]);return M.set(u,w),w}const i=`imports ${fe(n,R.toString())} ${r}`,a=L(n),d=M.get(r)??(E()?void 0:a.get(i)?.split("|").filter(Boolean));if(d!==void 0)return d;const f=N(new TextDecoder().decode($(e)??new Uint8Array),e);return M.set(r,f),a.set(i,f.join("|")),E()||S(x(n,"cas",`stamps${W}`),`${i} ${f.join("|")}
|
|
9
|
+
`),f},"importsOf");function Ue(n,e,r=[],i,a=[]){const d=i===void 0?h(e):h(i,e);return le(n,d,r,i??k(d),a).replace(/^[^:]*:/,"").slice(0,12)}l(Ue,"instrumentOf");function le(n,e,r=[],i=k(h(e)),a=[]){const d=ue(n,e,r,i,a);return v(n,new TextEncoder().encode([...d.values()].sort().join(`
|
|
10
|
+
`)))}l(le,"instrumentDigest");function ue(n,e,r=[],i=k(h(e)),a=[],d=!1){const f=new Map,c=l(t=>{if(f.has(t))return;const s=d?$(t):void 0,m=d?s===void 0?void 0:v(n,s):ae(n,t);if(m===void 0)return;const p=X(t);if(!f.has(p)){f.set(p,m);for(const y of R(n,p,m))y.startsWith("node:")||ie.includes(y)||(y.startsWith(".")?c(h(k(p),y)):c(re(p).resolve(y)))}},"walk");c(h(e));const u=r.filter(t=>o(t,"scope").startsWith("dep/")&&o(t,"value")!=="withdraw").map(t=>({region:o(t,"scope").slice(4).replace(/\*+$/,""),on:o(t,"value").split("|").filter(s=>s&&s!=="none")})),g=new Map(a.filter(t=>o(t,"scope").startsWith("dep/")&&o(t,"role")==="reads"&&o(t,"needs")&&o(t,"value")!=="withdraw").map(t=>[o(t,"scope").slice(4),o(t,"value")])),w=new Set,O=l(t=>{for(const s of u.find(m=>m.region===t)?.on??[]){if(g.has(s)){f.set(`release:${s}`,g.get(s));continue}for(const m of u.filter(p=>p.region.startsWith(`${s}/`)&&!w.has(p.region))){w.add(m.region);for(const p of J(h(i,m.region),i))c(h(i,p));O(m.region)}}},"follow");O(u.find(t=>j(i,h(e)).startsWith(t.region))?.region);const b=j(i,h(e)).split("/")[0]??"";for(const t of r.filter(s=>o(s,"scope").startsWith(`${b}/process/`)&&o(s,"kind")==="process"&&o(s,"value")!=="withdraw"))for(const s of o(t,"needs").split("|").filter(Boolean))c(h(i,s));for(const t of a.filter(s=>o(s,"scope").startsWith("process/")&&o(s,"kind")==="process"&&o(s,"value")!=="withdraw"))for(const s of o(t,"needs").split("|").filter(Boolean))c(h(i,s));return f}l(ue,"instrumentCoordinates");export{Se as algorithmCost,v as bytesDigest,ae as coordinateDigest,de as eraOf,fe as fullDigest,ue as instrumentCoordinates,le as instrumentDigest,Ue as instrumentOf,De as memoized,Le as signaturesOf};
|
package/dist/fold/evidence.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var o=Object.defineProperty;var n=(r,a)=>o(r,"name",{value:a,configurable:!0});import{
|
|
1
|
+
var o=Object.defineProperty;var n=(r,a)=>o(r,"name",{value:a,configurable:!0});import{library3_compareEvidence as s}from"../vendor/runtime.js";function l(r){const a=r.declared?r.statement:void 0,e=r.comparison,t=s({expected:{reference:r.expected.set,value:r.expected.standing},...a?{statement:{admitted:a.admitted,reference:a.set,value:a.standing}}:{},...e?{comparison:{admitted:e.admitted,reference:e.set,equal:e.verdict==="agrees"}}:{}});return{verdict:{absent:"none",unadmitted:"grey",unresolved:"stale",stale:"stale",equal:"agrees",different:"forks"}[t.relation],external:t.relation!=="absent"&&(r.priorDisagreement===!0||t.relation==="different"),epoch:t.source==="comparison"?e.epoch:a?.epoch??0}}n(l,"snapshotVerdict");function u(r,a){const e=[...new Set(r.filter(t=>["wire/attestation-result","audit/wire/attestation-result"].includes(t.scope??"")&&t.value!=="withdraw").map(t=>t.value))];if(!e.length)return[];if(e.length!==1||!e[0]||/[|=\s\\*]/.test(e[0])||e[0].startsWith("/")||e[0].split("/").some(t=>!t||t==="."||t===".."))throw Error("REFUSE\xB7authority conflicting or invalid attestation result coordinate");return[{coordinate:e[0],value:a.verdict}]}n(u,"attestationObservations");export{u as attestationObservations,l as snapshotVerdict};
|
package/dist/fold/keys.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var E=Object.defineProperty;var
|
|
2
|
-
`),i=s.length?
|
|
3
|
-
`).filter(
|
|
1
|
+
var E=Object.defineProperty;var o=(e,s)=>E(e,"name",{value:s,configurable:!0});import{hostRequiresFreshBytes as F}from"../host/call-context.js";import{viewInput as h}from"../host/reading-context.js";import{dirname as N,existsSync as $,join as j}from"../host/io.js";import{ledgerLines as k,ledgerWriters as C,signedLines as I}from"../land/ledger.js";import{fieldOf as a,foldClaims as y,isWire as K,LOCK as R,selfName as q}from"./claims.js";import{observeText as B}from"../observe/files.js";import{library14_publicLock as w}from"../vendor/runtime.js";const b=new Map,x=new Map,L=new Map,T=o((e,s,t=[])=>S(e,t).classes.get(s)?.[0],"keyOf");function V(e,s,t=[]){const i=T(e,s,t);if(i===void 0)throw new Error(`${q()}: REFUSE\xB7keys the lock admits no key of class \`${s}\`: name one as \`keys/<id> measure=class value=${s}\``);return i}o(V,"keyFor");function v(e,s=[]){const t=S(e,s),i=new Set(t.classes.get("attest")??[]);return t.signers.filter(c=>!i.has(c))}o(v,"lockSigners");function U(e){const s=m(e);if(s)return s;const t=v(e).map(r=>h("authority-ledger:"+e+":"+r,()=>k(e,r))).filter(r=>r.length>0),i=L.get(e);if(i!==void 0&&i.parts.length===t.length&&i.parts.every((r,l)=>r===t[l]))return i.lines;const c=t.length===1?t[0]:t.flat();return L.set(e,{parts:t,lines:c}),c}o(U,"lockLines");const M=new WeakMap;function X(e){const s=U(e);return M.get(s)??M.set(s,y(_(e)).standing).get(s)}o(X,"lockStanding");function _(e,s=[]){const t=m(e);return t?[...t]:v(e,s).flatMap(i=>I(e,i))}o(_,"signedLockLines");function S(e,s){const t=p(e).join(`
|
|
2
|
+
`),i=s.length?d(e,s):x.get(e)===t?b.get(e)??d(e):d(e);return s.length||x.set(e,t),s.length||b.set(e,i),i}o(S,"keysOf");const p=o(e=>h("key-claims:"+e,()=>C(e).flatMap(s=>k(e,s)).filter(s=>/\bsig=/.test(s)&&/(?:^|\s)scope=keys\/[^/\s]+\s/.test(s))),"ledgerKeyLines"),g=new Map;function m(e){if(!F()&&g.has(e))return g.get(e);const s=j(N(e),R),t=p(e).length||!$(s)?[]:(B(s)??"").split(`
|
|
3
|
+
`).filter(K),c=t.some(r=>a(r,"scope").startsWith("keys/")&&a(r,"measure")==="public-key"&&a(r,"sig"))&&w(t)!==void 0||t.some(r=>a(r,"scope")==="publish/bootstrap"&&a(r,"value")!=="withdraw")?t:void 0;return g.set(e,c),c}o(m,"releaseOf");function d(e,s=[]){const t=m(e)??[],i=w(t)===void 0?[]:t,c=[...p(e),...t,...s].filter(n=>(/\bsig=/.test(n)||i.includes(n))&&/(?:^|\s)scope=keys\/[^/\s]+\s/.test(n)),r=y(c).standing.filter(n=>a(n,"value")!=="withdraw").sort((n,u)=>(Number(a(n,"epoch"))||0)-(Number(a(u,"epoch"))||0)),l=o(n=>a(n,"scope").slice(5),"idOf"),f=new Map;for(const n of r.filter(u=>a(u,"measure")==="class"))f.set(a(n,"value"),[...f.get(a(n,"value"))??[],l(n)]);const O=new Set(r.filter(n=>a(n,"measure")==="public-key").map(l)),W=[...new Set(r.filter(n=>a(n,"measure")==="class").map(l))].filter(n=>O.has(n));return{classes:f,signers:W}}o(d,"read");export{V as keyFor,T as keyOf,U as lockLines,v as lockSigners,X as lockStanding,m as releaseOf,_ as signedLockLines};
|
package/dist/fold/laid.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var v=Object.defineProperty;var o=(t,s)=>v(t,"name",{value:s,configurable:!0});import{createHash as h,gzipSync as S,join as u}from"../host/io.js";import{
|
|
1
|
+
var v=Object.defineProperty;var o=(t,s)=>v(t,"name",{value:s,configurable:!0});import{createHash as h,gzipSync as S,join as u}from"../host/io.js";import{library14_canonical as y,library14_LOCK as B}from"../vendor/runtime.js";import{fieldOf as l,isWire as L}from"./claims.js";import{memoized as W}from"./digests.js";import{rolesOf as C}from"./roles.js";import{said as D}from"./wire.js";import{releasesOf as g}from"../host/release.js";import{land as E,landBlob as I,ledgerLines as T}from"../land/ledger.js";import{coordinatesUnder as _,observeFile as j,observeText as z,stampOf as K}from"../observe/files.js";import{ownLock as U}from"../observe/runner.js";const m="laid/",w="{digest}",A=o(t=>D(U(),"release/asset"),"assetsOf"),F=o((t,s)=>s.some(r=>{const n=r.indexOf(w);if(n<0)return!r.includes("{")&&t===r;const i=r.slice(0,n),e=r.slice(n+w.length);return t.startsWith(i)&&t.endsWith(e)&&t.length===i.length+e.length+64&&/^[0-9a-f]{64}$/.test(t.slice(i.length,t.length-e.length))}),"marked"),$=o((t,s)=>{const r=C(t),n=new Set((z(u(s,B))??"").split(`
|
|
2
2
|
`).filter(L).map(a=>l(a,"shape").split("/")[0]??"")),i=o(a=>!a||r(a)!=="foreign"&&(!a.startsWith(".")||n.has(a.split("/")[0]??"")),"held"),e=A(t);return _(s,s,i).filter(a=>i(a)&&!F(a,e)).sort()},"coordinatesOf"),O=o((t,s)=>h("sha256").update(s.map(r=>`${r} ${K(u(t,r))?.stamp??""}`).join(`
|
|
3
3
|
`)).digest("hex"),"stateOf");function G(t,s){const r=$(t,s),n=O(s,r);return{state:n,digest:W(t,`laid ${n}`,()=>{const i=[];for(const c of r){const d=Buffer.from(j(u(s,c))??new Uint8Array),f=Buffer.alloc(512),p=c.length<=100?-1:c.lastIndexOf("/");f.write(p<0?c:c.slice(p+1),0,100,"utf8"),f.write("0000644\0",100,8,"utf8"),f.write("0000000\0",108,8,"utf8"),f.write("0000000\0",116,8,"utf8"),f.write(`${d.length.toString(8).padStart(11,"0")}\0`,124,12,"utf8"),f.write("00000000000\0",136,12,"utf8"),f.write(" ",148,8,"utf8"),f.write("0",156,1,"utf8"),f.write("ustar\0",257,6,"utf8"),f.write("00",263,2,"utf8"),f.write(p<0?"":c.slice(0,p),345,155,"utf8"),f.write(`${f.reduce((b,x)=>b+x,0).toString(8).padStart(6,"0")}\0 `,148,8,"utf8"),i.push(f,d,Buffer.alloc((512-d.length%512)%512))}i.push(Buffer.alloc(1024));const e=S(Buffer.concat(i),{level:9}),a=`sha256:${h("sha256").update(e).digest("hex")}`;return I(t,a,e),a})}}o(G,"releaseDigest");function Y(t,s,r,n){n!==void 0&&E(t,n,g(r).filter(i=>l(i,"needs")).map(i=>(e=>y({scope:`${m}${l(i,"scope").slice(4)}/digest`,role:"writes",form:"alphabet",measure:"digest",value:e.digest,by:n,at:`place:${e.state}`}))(G(t,u(s,l(i,"needs"))))))}o(Y,"landLaid");const Z=o((t,s,r,n)=>{const i=new Map((n===void 0?[]:T(t,n)).filter(e=>l(e,"scope").startsWith(m)).map(e=>[`${l(e,"scope")} ${l(e,"at")}`,l(e,"value")]));return g(r).filter(e=>l(e,"needs")).filter(e=>{const a=u(s,l(e,"needs"));return i.get(`${m}${l(e,"scope").slice(4)}/digest place:${O(a,$(t,a))}`)!==l(e,"value")}).length},"laidDiffers");export{Z as laidDiffers,Y as landLaid,G as releaseDigest};
|
package/dist/fold/observed.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
var
|
|
2
|
-
`).filter(
|
|
3
|
-
`)}}c(
|
|
4
|
-
`)).filter(i=>
|
|
5
|
-
${t.capsule.region}`)}`,"readerScope"),
|
|
6
|
-
`).filter(
|
|
7
|
-
`))):void 0,
|
|
8
|
-
`),"emit")};if(i.preparation){const{limits:h,used:k,results:
|
|
9
|
-
${e.capsule.region}${
|
|
10
|
-
`+JSON.stringify(
|
|
11
|
-
`)):void 0,
|
|
12
|
-
`).filter(
|
|
13
|
-
`+JSON.stringify(
|
|
14
|
-
${e.capsule.region}${
|
|
15
|
-
`+JSON.stringify(
|
|
16
|
-
`)[1]),
|
|
1
|
+
var kn=Object.defineProperty;var c=(t,n)=>kn(t,"name",{value:n,configurable:!0});import{hostOutput as ee}from"../host/call-context.js";import{authenticatedStanding as En}from"../host/admitted-place.js";import{actCosts as Sn}from"../host/act-cost.js";import{readingClosures as On}from"../host/reading-closures.js";import{prepareReadingIdentities as Rn}from"../host/reading-preparation.js";import{BoundRefusal as ne}from"../host/refusals.js";import{readingExecution as Mn,readingProfile as xn}from"../host/reading-context.js";import{withNativeReaderRoute as Xe}from"../host/native-reader-context.js";import{prepareNativeReaderRoute as jn,assertNativeRouteCurrent as Fn,materializeNativeRoute as Dn}from"../host/native/route.js";import{verifiedContent as Un}from"../host/content-store.js";import{ownLock as Te,ownRoot as _e,ownStore as Nn}from"../observe/runner.js";import{library14_readerLifetime as An,library14_readerAllowsEmpty as Ze,library14_assertReaderInputs as Ln,library14_parse as ve}from"../vendor/runtime.js";import{readOnly as Bn}from"../host/read-only.js";import{basename as Cn,dirname as Je,relative as Tn,existsSync as qe,mkdirSync as en,resolve as te,rmSync as _n,spawn as Jn,statSync as nn,writeFileSync as tn}from"../host/io.js";import{bundleOf as qn,processOf as ke}from"../observe/runner.js";import{library14_canonical as Ee,library14_parse as sn,library14_PROTOCOL as In}from"../vendor/runtime.js";import{bytesDigest as H,memoized as Wn,instrumentCoordinates as on}from"./digests.js";import{land as Pn,landMemo as zn,landShard as G,memoAt as Vn,shardLines as Ie,storeAt as We}from"../land/ledger.js";import{fieldOf as r,isWire as Se}from"./claims.js";import{rolesOf as Hn}from"./roles.js";import{keyFor as Pe,lockStanding as ze}from"./keys.js";import{spoken as Gn}from"./places.js";import{capsuleAt as Yn,childFlags as an}from"../host/capsule.js";import{wordOf as rn}from"./wire.js";import{observeFile as Kn,observeText as Y}from"../observe/files.js";import{identityOf as Qn,vectorsOf as Xn}from"../observe/identity.js";import{capsuleReadersOf as ln,handedAt as cn,lookOf as Zn,offersOf as et}from"./readers.js";import{runReader as nt,runs as tt}from"../observe/run.js";import{LEVEL as st,OBSERVED as ae,keepObservation as Oe,keyOf as Re,legacyOf as it,observation as dn,observed as ot,opened as at,pointer as Me,readerOf as J,regionIn as xe,setAside as rt,sha as se,trimmed as me}from"./shards.js";import{saidDigest as un}from"./kept.js";import{carriedIn as fn,carriedFrom as lt}from"./resolved.js";const ct=c(t=>/^(?:vector|sample)\//.test(t),"cased");function Kt(t){const n=sn(t);return n.kind==="fact"&&n.value.fields.measure==="reader"}c(Kt,"isReaderLock");function Qt(t){return je(t).map(n=>n.module)}c(Qt,"readerModules");function je(t){const n=ze(t),i=`${rn(n,"families","reader")}/`,m=Gn(Je(t)).map(a=>a.line).filter(a=>r(a,"scope").startsWith(i)),g=new Set(m.map(a=>r(a,"scope")));return[...m,...n.filter(a=>!g.has(r(a,"scope")))].map(a=>sn(a)).flatMap(a=>a.kind==="fact"?[a.value.fields]:[]).filter(a=>(a.scope??"").startsWith(i)&&a.measure==="reader"&&a.value!=="withdraw").flatMap(a=>{const B=a.kind||((a.shape??"").split("|").includes(rn(n,"shapes","run"))?"process":"js");return tt(B)?[{id:(a.scope??"").slice(i.length),shape:(a.shape??"").split("|").filter(Boolean),where:(a.needs??"").split("|").filter(Boolean),module:a.value??"",kind:B}]:[]}).filter(a=>a.id!==""&&a.shape.length>0&&a.where.length>0&&a.module!=="")}c(je,"readersOf");function dt(t,n,i,m){const g=t.bound.kind==="interval";return Ee({scope:t.scope,role:t.role,form:g?"interval":"alphabet",measure:t.measure,value:g?`${t.bound.lo??0}..${t.bound.hi??0}`:(t.bound.values??[]).join("|"),by:`${m}:${i}`,at:`place:${n}`})}c(dt,"lineOf");const pn=new WeakMap;function ut(t){const n=pn.get(t);if(n!==void 0)return n;const i=ft(t);return pn.set(t,i),i}c(ut,"placedReadings");function Xt(t){return new Set(ut(t).filter(n=>n.measure==="pass"&&n.value==="pass"&&ct(n.question)).map(n=>n.question)).size}c(Xt,"casesHeld");function ft(t){const n=new Map;for(const i of t){if(!ae.test(i))continue;const m=`${J(i)??""} ${r(i,"at")}`;n.set(m,(n.get(m)??new Set).add(r(i,"scope")))}return t.flatMap(i=>{if(ae.test(i))return[];const m={question:r(i,"scope"),measure:r(i,"measure"),value:r(i,"value"),by:r(i,"by"),at:r(i,"at")};return[...n.get(`${J(i)??""} ${r(i,"at")}`)??[]].map(g=>({...m,place:g}))})}c(ft,"takeReadings");const Ve=[],Zt=c(()=>Ve,"readersBehind"),q=[],es=c(()=>q,"readerRefusals"),pt=c(t=>{try{return process.kill(t,0)}catch{return!1}},"alive");function mt(t,n){for(const i of fn(t)){const m=Y(i);if(m===void 0)continue;const g=We(t,"cas","travelled",se(m));if(qe(g))continue;const a=new Map;for(const O of m.split(`
|
|
2
|
+
`).filter(Se)){const R=O.replace(/ sig="[^"]*"/,"");(!a.has(R)||/ sig=/.test(O))&&a.set(R,O)}const B=new Map;for(const O of a.values()){const R=(r(O,"by").split(":")[0]??"").trim();R&&B.set(R,[...B.get(R)??[],O])}for(const[O,R]of B){if(O!==n){Pn(t,O,R);continue}const A=new Map;for(const F of R.filter(u=>!ae.test(u)))A.set(`${J(F)??""} ${r(F,"at")}`,[...A.get(`${J(F)??""} ${r(F,"at")}`)??[],F]);const re=new Map;for(const F of R.filter(u=>ae.test(u))){const u=`${J(F)??""}\0`;re.set(u,[...re.get(u)??[],F])}for(const[F,u]of re){const[K="",le=""]=F.split("\0");G(t,n,le,u);const ie=u.map(C=>`${r(C,"scope")} ${r(C,"at")}`);Oe(t,Re(K,le,ie,"receipt"),[...new Set(u.map(C=>r(C,"at")))].flatMap(C=>A.get(`${K} ${C}`)??[]))}}en(Je(g),{recursive:!0}),tn(g,`${Cn(i)}
|
|
3
|
+
`)}}c(mt,"travelled");function gt(t){const n=(()=>{try{return Pe(t,"read")}catch{return}})();return mt(t,n??""),fn(t).flatMap(i=>(Y(i)??"").split(`
|
|
4
|
+
`)).filter(i=>Se(i)&&n!==void 0&&r(i,"by").split(":")[0]===n)}c(gt,"carried");const Fe=c(t=>t.capsule?.selected?.selection===void 0?void 0:"sha256:"+se(JSON.stringify([t.capsule.selected.selection,t.capsule.region,t.module,t.where,[...t.capsule.globs]])),"readerSelection"),He=c(t=>t.capsule?.selected?.selection===void 0?`reader/${t.module}`:`reader/${t.module}/${se(`${t.capsule.selected.selection}
|
|
5
|
+
${t.capsule.region}`)}`,"readerScope"),ht=c((t,n,i,m)=>new Set(i.flatMap(g=>Ie(t,n,xe(m,g.module)).filter(a=>r(a,"scope")===He(g)&&/(?:^|\s)measure=(?:identity|extension)\s/.test(a)).map(a=>r(a,"value")))),"lineagesOf");function ns(t){const n=je(t),i=[...new Set(n.flatMap(g=>g.where.map(me)))],m=Pe(t,"read");return[...new Set(n.map(g=>xe(i,g.module)))].flatMap(g=>Ie(t,m,g).filter(a=>st.test(a)))}c(ns,"readerLines");const ts=c((t,n)=>(i=>!i.length&&!ln(t,n,ze(n),i).length)(je(n)),"carriesOnly");function mn(t,n){if(t===void 0)return!0;const i=c(m=>t.map(me).some(g=>g===""||m===g||m.startsWith(`${g}/`)||g.startsWith(`${m}/`)),"reached");return n.some(m=>i(me(m)))}c(mn,"readerReaches");function $t(t,n,i={}){q.length=0;const m=[];if(Bn()){const e=(Y(te(t,"receipts.bound"))??"").split(`
|
|
6
|
+
`).filter(Se),l=lt(n,e);if(l===void 0)throw Error("REFUSE\xB7preview native receipt bytes unavailable; fold the declared inputs first");return l}const g=i.wait??!0,a=ze(n),B=je(n),O=[...B,...ln(t,n,a,B)];if(i.selected!==void 0){if(!/^sha256:[a-f0-9]{64}$/.test(i.selected)||i.only===void 0)throw Error("REFUSE\xB7reader invalid internal background selector");if(O.filter(e=>e.module===i.only&&Fe(e)===i.selected).length!==1)throw Error("REFUSE\xB7reader internal background selector is not uniquely adopted")}if(i.preparation&&i.only!==void 0&&!O.some(e=>e.module===i.only))throw new ne("reading-identity/selection","REFUSE\xB7reading preparation selector is not adopted");if(!O.length)return i.preparation?[]:gt(n);const R=xn(a,r),A=R?on(n,ke("verb"),[],_e(),Te(),!0):void 0;if(A)for(const e of[ke("host"),ke("lifetime","host")])for(const[l,f]of on(n,e,[],_e(),Te(),!0))A.set(l,f);const re=A?H(n,new TextEncoder().encode([...A.values()].sort().join(`
|
|
7
|
+
`))):void 0,F=A?[...A].map(([e,l])=>[Tn(_e(),e),l]):[];if(R)for(const e of Te().filter(l=>r(l,"scope").startsWith("dep/")&&r(l,"role")==="reads"&&r(l,"value")!=="withdraw")){const l=r(e,"value");Un(l,n,Nn()),F.push([r(e,"scope"),l])}const u=Pe(n,"read"),K=[...new Set(O.flatMap(e=>e.where.map(me)))],le=i.only===void 0&&i.reach===void 0,ie=le&&!i.preparation?it(n,u,K):void 0,C=c(e=>mn(i.reach,[e]),"reached"),Ge=new Map,gn=ht(n,u,O,K),Ye=c(e=>Ge.get(e)??Ge.set(e,at(n,u,e,gn)).get(e),"open"),De=new Map,ge=c(e=>{if(e!==void 0){if(!De.has(e)){const l=dn(n,e),f=new Map;for(const w of l??[])f.set(r(w,"at"),[...f.get(r(w,"at"))??[],w]);De.set(e,l===void 0?void 0:f)}return De.get(e)}},"byAt"),he=c((e,l,f)=>{if(e.keys.has(l))return ge(e.keys.get(l));const w=f.flatMap(L=>e.places.get(`${l} ${L}`)??[]);if(!w.length)return;const M=w.map(L=>`${r(L.line,"scope")} ${L.at}`);if(ie===void 0)return ge(Re(l,e.region,M,"receipt"));const I=Re(l,e.region,M);return Oe(n,I,[...new Set(w.map(L=>L.at))].flatMap(L=>ie.get(`${l} ${L}`)??[])),G(n,u,e.region,[Me(u,l,e.region,I,M)]),e.keys.set(l,I),ge(I)},"lastOf"),Ue=c((e,l,f,w)=>{const M=e.places.get(`${l} ${f}`);return M===void 0?[]:[M.line,...w?.get(M.at)??[]]},"servedAt"),U=[],ce=i.answered,hn=c(e=>Object.entries(JSON.parse(Wn(n,`said ${e}`,()=>{const l=new Map;for(const f of dn(n,e)??[])l.set(r(f,"at"),[...l.get(r(f,"at"))??[],f]);return JSON.stringify(Object.fromEntries([...l].map(([f,w])=>[f,un(n,w)])))}))),"digestsAt"),$n=c(e=>{const l=new Map;for(const f of e)ae.test(f)||l.set(`${J(f)??""} ${r(f,"at")}`,[...l.get(`${J(f)??""} ${r(f,"at")}`)??[],f]);for(const f of e)ae.test(f)&&ce?.set(`${J(f)??""} ${r(f,"at")}`,un(n,l.get(`${J(f)??""} ${r(f,"at")}`)??[]))},"heard"),wn=Date.now();let Ne=0,de=0,Ae=0;const $e=Hn(n),Le=Zn(t,$e);Ve.length=0;const we=[];for(const e of O){if(i.only!==void 0&&e.module!==i.only||i.selected!==void 0&&Fe(e)!==i.selected||!mn(i.reach,e.where))continue;const l=Date.now(),f=U.length;!yn(e,l)&&ce!==void 0&&$n(U.slice(f))}function yn(e,l){const f=te(t,e.module),w=An(a.flatMap(E=>{const W=ve(E);return W.kind==="fact"?[W.value.fields]:[]}),{id:e.id,module:e.module}),M=e.capsule===void 0?void 0:e.capsule.selected??Yn(e.capsule.digest,e.capsule.entry),I=e.capsule===void 0?[]:(M?.lines??[]).filter(E=>r(E,"scope")===`region/${e.capsule.region}`&&r(E,"measure")==="input-projection"&&r(E,"value")!=="withdraw");if(I.length){if(I.length!==1||!M)throw Error("REFUSE\xB7input projection is ambiguous "+e.module);const E=[...new Set(e.where.flatMap(h=>cn(t,e,$e,Le,h)))].sort();if(i.preparation){const{limits:h,used:k}=i.preparation;if(h.signal?.aborted)throw new ne("host/cancelled","REFUSE\xB7host/cancelled");if(E.length>h.files-k.files||E.reduce((fe,X)=>fe+(qe(te(t,X))?nn(te(t,X)).size:0),0)>h.bytes-k.bytes||k.probes>=h.probes)throw new ne("host/budget","REFUSE\xB7host/budget")}const W=E.map(h=>({place:h,text:Y(te(t,h))??""})),Q=c(h=>H(n,Buffer.from(h)),"hash"),ue=Ze(a.flatMap(h=>{const k=ve(h);return k.kind==="fact"?[k.value.fields]:[]}),e.module),x=jn(n,{id:e.id,module:e.module});if(x&&!R)throw Error("REFUSE\xB7native reader requires complete reading identity "+e.module);if(x&&M.digest!==x.profile.selection.archive)throw Error("REFUSE\xB7native reader implementation differs "+e.module);const P=x?Dn(x):void 0,oe=R?Mn({instrument:re,implementation:M.digest,policy:Q(JSON.stringify([e.id,e.module,e.kind,e.shape,e.where,w??null,ue])),inputs:[...F,...x?.inputs??[],...P?[["native/mount",P.mountIdentity]]:[]]},Q,{env:process.env,cwd:P?.cwd??t,flags:x?[]:an()}):void 0,ye={root:t,store:n,...oe?{context:oe.context,execution:oe}:{},reader:e.module,speaker:u,digest:c(h=>H(n,Buffer.from(h)),"digest"),capsule:M,...x?{assertCurrent:c(()=>Fn(x),"assertCurrent")}:{},region:e.capsule.region,projection:r(I[0],"value"),livePlace:c(()=>En(t),"livePlace"),readerReference:{id:e.id,module:e.module},lifetime:w,allowsEmpty:ue,files:W,emit:c(h=>ee("error",h+`
|
|
8
|
+
`),"emit")};if(i.preparation){const{limits:h,used:k,results:fe}=i.preparation,X={...h,bytes:h.bytes-k.bytes,files:h.files-k.files,readings:h.readings-k.readings,probes:h.probes-k.probes},p=Xe(x,()=>Rn({...ye,preparationLimits:X}));if(fe.push(p),p.kind==="fact"&&(k.bytes+=p.verifiedBytes,k.files+=W.length,k.readings+=p.readings.length,k.probes+=p.probes),p.kind==="refuse")throw new ne(p.code,p.diagnostic);return!1}const T=Xe(x,()=>On(ye));return U.push(...T.lines),Ne+=T.executed,de+=T.read-T.opened,!1}if(i.preparation)throw new ne("reading-identity/projection","REFUSE\xB7reading identity requires a declared input projection "+e.module);if(R)throw Error("REFUSE\xB7reader "+e.module+" complete reading identity requires a declared input projection");const L=Sn.begin();try{const E=e.capsule===void 0?Kn(f):M===void 0?void 0:new Uint8Array,W=E&&e.capsule===void 0?qn(f)??H(n,E):"none",Q=et(t,n,e,$e,Le,s=>C(me(s)));Ln(a.flatMap(s=>{const d=ve(s);return d.kind==="fact"?[d.value.fields]:[]}),e.module,Q.length);const ue=e.capsule===void 0?Y(te(t,Xn(e.module,a))):void 0,x=e.capsule?.selected?.selection===void 0?void 0:se(`${e.capsule.selected.selection}
|
|
9
|
+
${e.capsule.region}${w===void 0?"":`
|
|
10
|
+
`+JSON.stringify(w)}`),P=le&&ie===void 0&&ce===void 0&&E?se([u,e.module,JSON.stringify(w),e.kind,e.shape.join("|"),e.where.join("|"),W,ue===void 0?"no vectors":se(ue),e.capsule===void 0?"":`${e.capsule.selected?.selection??e.capsule.digest} ${e.capsule.region} ${e.capsule.reads.join("|")} ${[...e.capsule.globs].map(([s,d])=>`${s}${d.join("|")}`).join(" ")}`,...x===void 0?[]:[x],...Q.map(s=>`${s.place} ${s.digest?.()??H(n,s.bytes())}`)].join(`
|
|
11
|
+
`)):void 0,oe=P===void 0?void 0:Y(Vn(n,`observed/${P}`));if(oe!==void 0)return U.push(...oe.split(`
|
|
12
|
+
`).filter(Se)),de+=Q.length,Ae+=1,!1;const ye=U.length,T=xe(K,e.module),h=Ie(n,u,T).filter(s=>r(s,"scope")===He(e)),k=h.filter(s=>r(s,"measure")==="identity").map(s=>r(s,"value")).filter(s=>x===void 0||/^[a-f0-9]{64}$/.test(s)),fe=E&&e.capsule===void 0?H(n,new TextEncoder().encode(`${e.module} ${W}${w===void 0?"":`
|
|
13
|
+
`+JSON.stringify(w)}`)).replace(/^sha256:/,"").slice(0,12):"none",X=e.capsule!==void 0?{by:E?x??se(`${e.capsule.digest}
|
|
14
|
+
${e.capsule.region}${w===void 0?"":`
|
|
15
|
+
`+JSON.stringify(w)}`).slice(0,12):"none",lines:[]}:E?Qn({store:n,root:t,speaker:u,module:e.module,kind:e.kind,code:fe,lineage:k,lifetime:w,kept:h.filter(s=>/(?:^|\s)measure=(?:extension|emits)\s/.test(s))}):{by:"none",lines:[]},p=X.by,z=[...X.lines],Ke=Date.now(),bn=[...k,p],pe=[...k].reverse().find(s=>s!==p),Be=new Map;for(const s of Q){const d=xe(K,s.place);C(d)&&Be.set(d,[...Be.get(d)??[],s])}const Ce=[...Be].map(([s,d])=>{const S=Ye(s),y=d.map($=>$.place),j=[],o=[],b=[],_=[];for(const $ of d){const v=S.places.get(`${p} ${$.place}`);if(v&&r(v.line,"value")===$.seen){j.push(`${$.place} ${v.at}`),o.push(v.line),_.push({...$,digest:v.at.slice(6)}),de+=1;continue}const Z=$.digest?void 0:$.bytes(),V=$.digest?.()??H(n,Z);j.push(`${$.place} place:${V}`),o.push(Ee({scope:$.place,role:"writes",form:"alphabet",measure:"observed",value:$.seen,by:`${u}:${p}`,at:`place:${V}`})),_.push({...$,digest:V,bytes:c(()=>Z??$.bytes(),"bytes")}),v?.at===`place:${V}`?de+=1:b.push({place:$.place,seen:$.seen,digest:V,bytes:Z??$.bytes()})}return{region:s,shard:S,places:y,pairs:j,kept:o,moved:b,all:_,key:Re(p,s,j)}});if(ce!==void 0&&Ce.every(s=>!s.moved.length&&ot(n,s.key))){for(const s of Ce){for(const[d,S]of hn(s.key))ce.set(`${p} ${d}`,S);(s.shard.keys.get(p)!==s.key||s.kept.some(d=>s.shard.places.get(`${p} ${r(d,"scope")}`)?.line!==d))&&G(n,u,s.region,[...s.kept,Me(u,p,s.region,s.key,s.pairs)]),U.push(...s.kept)}return z.length&&G(n,u,T,z),!0}const be=Ce.map(({region:s,shard:d,places:S,pairs:y,kept:j,moved:o,all:b,key:_})=>{const $=he(d,p,S);pe!==void 0&&he(d,pe,S);const v=[...new Set(y.map(N=>N.slice(N.indexOf(" ")+1)))],Z=ge(_),V=Z!==void 0?v.flatMap(N=>Z.get(N)??[]):o.length||$===void 0?void 0:v.flatMap(N=>$.get(N)??[]),vn=V===void 0&&!o.length?b.map(N=>({place:N.place,seen:N.seen,digest:N.digest,bytes:N.bytes()})):o;return{region:s,shard:d,places:S,pairs:y,kept:j,due:vn,key:_,said:V,prior:$,found:Z!==void 0}}),D=be.flatMap(s=>s.said===void 0?s.due.map(d=>({...d,region:s.region})):[]),Qe=c((s,d)=>{for(const S of[...bn].reverse()){const y=Ye(d),j=Ue(y,S,s,he(y,S,[s])).slice(1);if(j.length)return j.map(o=>[r(o,"scope"),r(o,"value")])}return[]},"heldOf");if(D.length&&!E)return q.push(`REFUSE\xB7reader ${e.module} unavailable \xB7 ${D.length} readings remain due`),!1;if(D.length&&!g){for(const y of be){if(y.said!==void 0){U.push(...y.kept,...y.said);continue}for(const j of y.places){const o=Ue(y.shard,p,j,y.prior);U.push(...o.length||pe===void 0?o:Ue(y.shard,pe,j,he(y.shard,pe,y.places)))}}const s=We(n,"pending",p),d=Number((Y(s)??"").split(`
|
|
16
|
+
`)[1]),S=qe(s)&&Date.now()-nn(s).mtimeMs<1800*1e3&&Number.isInteger(d)&&d>0&&pt(d);if(!S){en(Je(s),{recursive:!0});const y=Jn(process.execPath,[...an(),ke("observe"),t,e.module,...Fe(e)===void 0?[]:[Fe(e)]],{cwd:t,detached:!0,stdio:"ignore"});y.unref(),tn(s,`${e.module}
|
|
17
17
|
${y.pid??""}
|
|
18
|
-
`)}return
|
|
19
|
-
`),
|
|
20
|
-
`),!1}if(d.every(o=>!o.length)&&!
|
|
21
|
-
`),!1}
|
|
22
|
-
`);const
|
|
23
|
-
`))).replace(/^sha256:/,"");
|
|
24
|
-
`))),!1}finally{L()}}if(c(
|
|
25
|
-
`),
|
|
26
|
-
`),g&&
|
|
27
|
-
`))
|
|
18
|
+
`)}return Ve.push({module:e.module,places:D.length}),ee("error",`GREY reading: ${e.module} \xB7 ${D.length} places \xB7 runs behind${S?", already running":""}
|
|
19
|
+
`),z.length&&G(n,u,T,z),Date.now()-l>250&&we.push(`${e.module.split("/").pop()} behind ${Date.now()-l}`),!1}if(D.length){const s=Date.now();let d;try{d=e.capsule!==void 0&&M!==void 0?M.ask(D.map(o=>({protocol:In,verb:"read",rootScope:o.place,region:e.capsule.region,held:Qe(o.place,o.region),files:(e.capsule.reads.some(b=>b.includes("@"))?cn(t,e,$e,Le,o.place):[o.place]).map(b=>({place:b,text:Y(te(t,b))??""}))})),{id:e.id,module:e.module}).map(o=>{if(o?.kind!=="fact")throw new Error(`REFUSE\xB7reader ${e.module} \xB7 ${o?.why??"no capsule answer"}`);return o.claims??[]}):nt(f,t,D.map(o=>({place:o.place,...e.kind==="js"?{text:new TextDecoder().decode(o.bytes)}:{},held:Qe(o.place,o.region)})),w)}catch(o){const b=`REFUSE\xB7reader ${e.module} \xB7 ${o instanceof Error?o.message:String(o)}`;return q.push(b),o instanceof ne&&m.push(o),ee("error",`${b}
|
|
20
|
+
`),!1}if(d.every(o=>!o.length)&&!Ze(a.flatMap(o=>{const b=ve(o);return b.kind==="fact"?[b.value.fields]:[]}),e.module)){const o=`REFUSE\xB7reader ${e.module} \xB7 answered none of ${D.length} places \xB7 nothing landed, they stay due`;return q.push(o),ee("error",`${o}
|
|
21
|
+
`),!1}Ne+=D.length,ee("error",`READER ${e.module} \xB7 ${D.length} run \xB7 ${Date.now()-s} ms
|
|
22
|
+
`);const S=new Map;D.forEach((o,b)=>S.set(o.place,(d[b]??[]).map(_=>dt(_,o.digest,p,u))));for(const o of be.filter(b=>b.said===void 0)){const b=new Set(o.due.map(v=>v.place)),$=[...[...new Set(o.pairs.filter(v=>!b.has(v.slice(0,v.indexOf(" ")))).map(v=>v.slice(v.indexOf(" ")+1)))].flatMap(v=>o.prior?.get(v)??[]),...[...b].flatMap(v=>S.get(v)??[])];Oe(n,o.key,$),G(n,u,o.region,[...o.kept,Me(u,p,o.region,o.key,o.pairs)]),U.push(...o.kept,...$)}const y=Date.now()-s,j=H(n,new TextEncoder().encode(D.map(o=>o.digest).sort().join(`
|
|
23
|
+
`))).replace(/^sha256:/,"");z.push(Ee({scope:`cost/reader/${e.module}`,role:"writes",form:"interval",measure:"ms",value:`${y}..${y}`,by:`${u}:${p}`,at:`place:${j}`})),k.at(-1)!==p&&z.push(Ee({scope:He(e),role:"writes",form:"alphabet",measure:"identity",value:p,by:`${u}:${p}`,at:`place:${p}`})),_n(We(n,"pending",p),{force:!0})}for(const s of be.filter(d=>d.said!==void 0))s.found||Oe(n,s.key,s.said),(s.shard.keys.get(p)!==s.key||s.kept.some(d=>s.shard.places.get(`${p} ${r(d,"scope")}`)?.line!==d))&&G(n,u,s.region,[...s.kept,Me(u,p,s.region,s.key,s.pairs)]),U.push(...s.kept,...s.said);return z.length&&G(n,u,T,z),Date.now()-l>250&&we.push(`${e.module.split("/").pop()} ${Ke-l}+${Date.now()-Ke}`),P!==void 0&&zn(n,`observed/${P}`,new TextEncoder().encode(U.slice(ye).join(`
|
|
24
|
+
`))),!1}finally{L()}}if(c(yn,"observeOne"),i.preparation)return[];if(we.length&&ee("error",`SPENT observe ${we.join(" \xB7 ")} ms
|
|
25
|
+
`),ie&&rt(n,u),ee("error",`OBSERVE ${Ne} run \xB7 ${de} read by key${Ae?` \xB7 ${Ae} readers kept whole`:""} \xB7 ${Date.now()-wn} ms
|
|
26
|
+
`),g&&q.length){const e=new Set(m.map(l=>l.code));throw m.length===q.length&&e.size===1?new ne(m[0].code,q.join(`
|
|
27
|
+
`)):new Error(q.join(`
|
|
28
|
+
`))}return[...new Set(U)].sort()}c($t,"observedClaims");function ss(t,n,i,m){const g=[];return $t(t,n,{...m?{only:m}:{},preparation:{limits:i,results:g,used:{bytes:0,files:0,readings:0,probes:0}}}),g}c(ss,"prepareObservedReadings");export{ts as carriesOnly,ct as cased,Xt as casesHeld,Kt as isReaderLock,$t as observedClaims,ut as placedReadings,ss as prepareObservedReadings,ns as readerLines,Qt as readerModules,mn as readerReaches,es as readerRefusals,Zt as readersBehind};
|
package/dist/fold/opened.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var $=Object.defineProperty;var a=(o,e)=>$(o,"name",{value:e,configurable:!0});import{
|
|
1
|
+
var $=Object.defineProperty;var a=(o,e)=>$(o,"name",{value:e,configurable:!0});import{library14_matches as d}from"../vendor/runtime.js";import{fieldOf as t}from"./claims.js";import{viewsOf as y}from"./views.js";const O=a(o=>o.split("/").every(e=>e===""||e==="*"||e==="**"),"wild"),m=a((o,e,f)=>!O(o)&&(d(o,f)||d(o,e)),"covers");function x(o,e,f){const l=new Set(o),w=e.filter(n=>t(n,"scope").startsWith("region/")&&t(n,"measure")==="reads"&&t(n,"value")!=="withdraw"),h=[...y(e).values()],r=new Set;for(const n of f){const p=t(n,"scope"),[c="",...v]=p.split("/");if(!l.has(c))continue;const i=v.join("/");i&&r.add(`${c}/${i}`);for(const s of w){const u=t(s,"scope").slice(7);m(t(s,"value"),p,i)&&r.add(`${c}/${u}`)}for(const s of h)s.shape&&m(s.shape,p,i)&&r.add(`${c}/${s.name}`)}return[...r].sort()}a(x,"openedBy");export{x as openedBy};
|