@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
package/dist/fold/own.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var D=Object.defineProperty;var
|
|
2
|
-
`).filter(
|
|
3
|
-
`),o?k(W,o):{...k(W),unadmitted:s.unadmitted,dirs:
|
|
1
|
+
var D=Object.defineProperty;var d=(s,t)=>D(s,"name",{value:t,configurable:!0});import{hostOutput as P}from"../host/call-context.js";import{timing as V}from"../host/timing.js";import{basename as O,existsSync as X,relative as G,resolve as w}from"../host/io.js";import{library14_EXTENSION as H,library14_matches as J}from"../vendor/runtime.js";import{fieldOf as n,isWire as K}from"./claims.js";import{wordsOf as x}from"./wire.js";import{inheritedRoles as Q,stepsOutside as U}from"./roles.js";import{writerFor as y}from"./signers.js";import{isCeiling as E}from"./configures.js";import{keyOf as g}from"./keys.js";import{VERB_NAMES as Y}from"../cli/names.js";import{actSeconds as Z,idleCount as ee,receiptsSeen as te}from"./closed.js";import{foldsElsewhere as re}from"./kept.js";import{ledgerLines as R}from"../land/ledger.js";import{vouchedCoordinates as se}from"../land/vouched.js";import{placedReadings as S,readerLines as z,readerModules as I}from"./observed.js";import{storeDirs as oe}from"../host/ports/store.js";import{entriesIn as ie,observeText as B}from"../observe/files.js";import{placesOf as ne,viewsOf as T}from"./views.js";import{declaredBy as ae}from"../observe/regions.js";import{REGION_NAMES as ce}from"../render/names.js";import{ownLock as q,ownRoot as $}from"../observe/runner.js";import{namingTheirPlace as pe,zoomedOutsideThePlace as le}from"./zoom.js";import{resetsOnEqualEmits as de,withoutVectors as fe}from"../observe/identity.js";import{instrumentCoordinates as me}from"./digests.js";import{bugsWithoutANo as ue}from"./nos.js";import{writtenIn as he}from"./signed.js";import{laidDiffers as be}from"./laid.js";import{heldBytes as we}from"../land/held.js";import{capsuleAt as v,placesIn as ge,worldAt as $e}from"./places.js";function ve(s){const t=te();return k({idle:ee(),s:Z(),"walk-read":t.count,"walk-ms":t.ms,"kept-folds-read-under-another-instrument":re()},s)}d(ve,"currentActReadings");const A={foreign:0};function ke(s,t,e,i){const a=[...T(e).values()].flatMap(l=>"regions"in l&&l.shape?[l.shape]:[]).find(l=>l.endsWith(H));if(a===void 0)return 0;const r=U(t),m=i?[i]:["",...ie(w(s)).filter(l=>l.dir&&!r.has(l.name)).map(l=>`${l.name}/`)],o=d(()=>x(e,"ships"),"ships");return A.foreign=0,Math.max(0,...m.map(l=>o().includes(a)?(B(w(s,l,a))??"").split(`
|
|
2
|
+
`).filter(K).length:0))}d(ke,"shipped");function Oe(s,t,e,i){const a=[...T(e).values()].flatMap(o=>"regions"in o&&o.shape?[o]:[]),r=new Set(ce),m=new Set;for(const o of["",...ge(s).map(l=>`${l}/`)]){const l=ae({root:s,store:t,standing:e,observed:i,...o?{under:o}:{}}),f=a.filter(b=>(p=>p.length?p.includes(o):B(w(s,o,b.shape))!==void 0)(ne(e,b)));for(const b of f.flatMap(p=>p.regions))!r.has(b.name)&&!l.some(p=>J(p,b.name))&&m.add(`${o}${b.name}`)}return m.size}d(Oe,"unrenderedIn");function ye(s,t,e){return[...se(t).keys()].filter(i=>(!e||i.startsWith(e))&&!X(w(s,i))).length}d(ye,"removedByHand");function Ee(s){const t=new Map;for(const e of z(s)){const i=n(e,"scope");if(!i.startsWith("cost/reader/")||!/^place:[0-9a-f]{64}$/.test(n(e,"at")))continue;const a=`${i} ${n(e,"by")} ${n(e,"at")}`;t.set(a,[...t.get(a)??[],Number(n(e,"value").split("..")[0])])}return[...t.values()].filter(e=>e.length>1&&e[e.length-1]>e[0]).length}d(Ee,"readersOverFirstRun");function C(s,t){const e=g(s,"attest");if(e!==void 0)return u(s,t,`${e}/beat`,"folded",e)}d(C,"attestBeat");function Se(s){const t=new Map;for(const e of S(s))e.question.startsWith("concept/")&&t.set(e.question,(t.get(e.question)??new Set).add(e.place));return[...t.values()].filter(e=>e.size>1).length}d(Se,"twiceWritten");function j(s,t,e,i){const a=y(t,"fold");return a===void 0?0:R(s,a).filter(r=>n(r,"scope")===e&&/place:(folded|kept)$/.test(n(r,"at"))).slice(-10).filter(r=>n(r,"at")===`place:${i}`).length}d(j,"counted");function u(s,t,e,i,a){const r=a??y(t,"fold");if(r===void 0)return;const m=R(s,r).filter(o=>n(o,"scope")===e&&n(o,"at")===`place:${i}`).map(o=>Number(n(o,"value").split("..")[0])).filter(o=>Number.isFinite(o)).slice(-10).sort((o,l)=>o-l);return m[Math.floor(m.length/2)]}d(u,"middleBeat");function Me(s,t,e){const i=t.filter(r=>n(r,"form")==="alphabet").map(r=>n(r,"value")).filter(r=>r!=="withdraw"&&!r.startsWith("not:")).map(r=>new Set(r.split("|").filter(Boolean))).filter(r=>r.size>1),a=S(s).filter(r=>r.question==="alphabet"&&r.measure==="id"&&(!e||r.place.startsWith(e))).filter(r=>i.some(m=>r.value.split("|").every(o=>m.has(o))));return new Set(a.map(r=>`${r.place} ${r.value}`)).size}d(Me,"alphabetsInCode");const M=d((s,t)=>s.filter(e=>E(e)&&(n(e,"measure")===t||n(e,"scope").split("/").pop()===t)),"ceilingsNamed"),N=d((s,t,e)=>{if(e===void 0)return{};const i=n(s??"","scope");return{[t]:e,...i&&i!==t?{[i]:e}:{}}},"ownFrom"),F=d((s,t,e)=>new Set(S(s).filter(i=>i.place.startsWith(t)&&e.some(a=>i.question===`export/${a}`)).map(i=>i.place)).size,"exporting"),Ne=d((s,t,e)=>{const i=x(t,"families").find(a=>a==="reader"||a==="readers");return e.filter(a=>(i===void 0||n(a,"scope").startsWith(`${i}/`))&&n(a,"measure")==="reader"&&n(a,"value")!=="withdraw"&&(r=>!n(a,"value").includes("/")||v(s,r)&&!$e(s,r))(n(a,"value").split("/")[0]??""))},"outsideTheirCapsule"),We=new Set(["readers-over-their-first-run","stale-capsules","accept-line","regions-described","walks-prune-by-role","ledger-region-verdicts-served-from-a-kept-fold","kept-folds-read-under-another-instrument","accepts-that-refolded","readers-without-vectors","lines-that-name-their-place","memo-resets-on-unchanged-extension","status-for-no-effect","accept-ms","bodies-written-twice","world-lines-outside-their-capsule"]),k=d((s,t)=>Object.fromEntries(Object.entries(s).flatMap(([e,i])=>i===void 0||t&&We.has(e)?[]:[[e,i]])),"placeOnly");function nt(s,t,e){return k({"beat-kept":u(s,t,`beat/${e??"."}`,"kept"),"accept-line":u(s,t,"beat/accept","line"),"accept-ms":u(s,t,"beat/accept","total"),"accepts-that-refolded":j(s,t,"beat/accept","folded"),"test-kept":e?u(s,t,`beat/${e}`,"kept"):void 0,"programs-place":e?u(s,t,`beat/${e}`,"command-kept"):void 0,...g(s,"attest")===void 0?{}:{[`${g(s,"attest")}-ms`]:e?void 0:C(s,t)}},e)}d(nt,"costReadings");function at(s){const{root:t,store:e,entry:i,roleOf:a,standing:r,observed:m,under:o}=s,l=[],f=V(l),b=o===void 0||o===`${O($())}/`,p=d(c=>o?void 0:c(),"tree"),_=p(()=>f("imports",()=>[...me(e,w(t,i),r,t,q()).keys()].filter(c=>v(t,G(t,c).split("/")[0]??"")).length)),L=p(()=>f("bodies",()=>Se(m))),W={"orphan-samples":s.orphans,"removed-by-hand":f("removed",()=>ye(t,e,o)),"readers-over-their-first-run":p(()=>f("readers",()=>Ee(e))),"alphabet-in-code":f("alphabets",()=>Me(m,r,o)),"stale-capsules":p(()=>f("capsules",()=>Q(e).stale.length)),"beat-kept":u(e,r,`beat/${o??"."}`,"kept"),"accept-line":p(()=>u(e,r,"beat/accept","line")),"accept-ms":p(()=>u(e,r,"beat/accept","total")),"test-kept":o?u(e,r,`beat/${o}`,"kept"):void 0,"programs-place":o?u(e,r,`beat/${o}`,"command-kept"):void 0,"regions-described":p(()=>f("regions",()=>Oe(t,e,r,m))),"readers-without-vectors":p(()=>f("vectors",()=>fe(t,I(e),r))),"lines-that-name-their-place":p(()=>f("zoom",()=>pe(t))),...b?{"bugs-without-a-no":f("nos",()=>ue(t,e,r,O($()),"bugs-without-a-no")),"zoom-rewrites-outside-the-place":f("zoomed",()=>le(t,r)),"own-lines-written-in":f("applied",()=>he(t,O($()))),"laid-digest-differs":f("laid",()=>be(e,$(),q(),y(r,"fold")))}:{},"memo-resets-on-unchanged-extension":p(()=>f("resets",()=>de(z(e)))),...N(M(r,"capsules-imported").find(c=>n(c,"form")==="interval"),"capsules-imported",_),...(c=>({bytes:c,"store/bytes":c}))(f("store",()=>we(t,e,r))),"walks-prune-by-role":A.foreign,...N(M(r,"bodies-written-twice").find(c=>n(c,"form")==="interval"),"bodies-written-twice",L),...Object.fromEntries(r.filter(c=>E(c)&&(n(c,"measure")==="render-modules"||n(c,"scope").split("/").pop()==="render-modules")).flatMap(c=>(h=>h===void 0?[]:[[n(c,"scope"),p(()=>F(m,`${h}/`,["render"]))]])(n(c,"scope").split("/").find(h=>v(t,h))))),...Object.fromEntries(r.filter(c=>E(c)&&(n(c,"measure")==="reader-modules"||n(c,"scope").split("/").pop()==="reader-modules")).flatMap(c=>(h=>h===void 0?[]:[[n(c,"scope"),p(()=>F(m,`${h}/`,["observe","run"]))]])(n(c,"scope").split("/").find(h=>v(t,h))))),...N(M(r,"world-lines-outside-their-capsule").find(c=>n(c,"form")==="interval"),"world-lines-outside-their-capsule",p(()=>Ne(t,r,r).length)),...ve(),"cli-verbs":Y.length,"accepts-that-refolded":p(()=>j(e,r,"beat/accept","folded")),...g(e,"attest")===void 0?{}:{[`${g(e,"attest")}-ms`]:p(()=>C(e,r))},ship:f("ship",()=>ke(t,e,r,o))};return P("error",`OWN ${l.join(" ms \xB7 ")} ms
|
|
3
|
+
`),o?k(W,o):{...k(W),unadmitted:s.unadmitted,dirs:oe(e),"artifacts-in-loop":[i,...I(e)].filter(c=>a(c)!=="source").length}}d(at,"ownReadings");export{nt as costReadings,ve as currentActReadings,Ne as outsideTheirCapsule,at as ownReadings};
|
package/dist/fold/paid.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _=Object.defineProperty;var f=(e,r)=>_(e,"name",{value:r,configurable:!0});import{
|
|
1
|
+
var _=Object.defineProperty;var f=(e,r)=>_(e,"name",{value:r,configurable:!0});import{library0_answers as j,library0_point as O,library0_region as h,library0_within as b}from"../vendor/runtime.js";import{library1_alphabetForm as v}from"../vendor/runtime.js";import{library2_cell as S,library2_mark as $,library2_observe as y,library2_state as x}from"../vendor/runtime.js";import{fieldOf as s}from"./claims.js";import{boundOf as A,regionsNamed as F}from"./region.js";import{wordFrom as N}from"./wire.js";import{lockStanding as B}from"./keys.js";import{ledgerLines as J,storeAt as W}from"../land/ledger.js";import{observeText as E}from"../observe/files.js";import{memoized as L}from"./digests.js";const M=f(e=>{const r=e.split("/");return r.includes("yes")||r.includes("no")},"holdsCases");function z(e,r,d){if(r.value!==(s(e,"value")||"present"))return!1;const i=s(e,"needs").split("|").filter(Boolean);if(r.read&&!s(e,"scope").startsWith(d)&&!i.some(M))return!1;const c=i.map(n=>h(n));if(r.judged&&!c.every(n=>r.judged?.some(o=>b(n,h(o)))))return!1;const p=r.cone.split("|").filter(Boolean).map(n=>O(n));return p.length?j(p,c)||c.length>0&&c.every(n=>p.some(o=>b(o,n))):!0}f(z,"pays");function C(e,r,d){if(!d.startsWith("receipt:sha256:"))return;const i=L(e,`judged ${d}`,()=>{const n=E(W(e,"cas","envelopes",`${d.replace(/^receipt:sha256:/,"")}.json`)),o=n===void 0?{}:JSON.parse(n);return JSON.stringify(Array.isArray(o.cone)?[o.scope??"",...o.cone]:[])}),[c,...p]=JSON.parse(i);return c===r?p:void 0}f(C,"judgedBy");function D(e,r,d,i){const c=new Set(r.map(t=>s(t,"scope"))),p=[...J(e,"judge"),...d].filter(t=>c.has(s(t,"scope"))),n=new Map;for(const t of p)s(t,"measure")==="cone"&&n.set(`${s(t,"scope")} ${s(t,"at")}`,s(t,"value"));const o=new Map;for(const t of p){const a=s(t,"scope");if(!a||s(t,"measure")==="cone")continue;const m=C(e,a,s(t,"at"));(o.get(a)??o.set(a,[]).get(a)).push({value:s(t,"value"),cone:n.get(`${a} ${s(t,"at")}`)??"",read:s(t,"at").startsWith("cone:"),...m?{judged:m}:{}})}const l=r.filter(t=>(o.get(s(t,"scope"))??[]).some(a=>z(t,a,i)));return{paid:l,missing:r.filter(t=>!l.includes(t)),answered:new Set(o.keys())}}f(D,"paidOf");const k={tokens:["absent","present"]},g=f(e=>v.parse(k,{want:[e?"present":"absent"]}),"heldAs");function H(e,r,d,i,c){const p=F(c),n=new Set((i.apart??[]).map(l=>l==="."?"":l)),o=i.verdict==="agrees"||i.verdict==="forks";return Object.fromEntries(e.map(l=>{const t=s(l,"scope"),a=r.includes(l),m=a||d.has(t),w=i.verdict==="forks"&&(i.apart===void 0||n.has(A(p,l).region));let u={...S(t),marks:[$({pole:"floor",reach:"local",span:g(!0)})]};return m&&(u=y(u,{origin:"take",span:g(a),id:"take"})),m&&o&&(u=y(u,{origin:"second",span:g(w?!a:a),id:"second"})),[t,x(v.lattice(k),u)]}))}f(H,"verdictsOf");const Y=f(e=>H(e.demands,e.paid,D(e.store,e.demands,e.observed,`${N(e.standing,"families","view",B(e.store))}/`).answered,e.second,e.standing),"verdictsFor");export{M as holdsCases,D as paidOf,Y as verdictsFor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var y=Object.defineProperty;var c=(o,n)=>y(o,"name",{value:n,configurable:!0});import{
|
|
1
|
+
var y=Object.defineProperty;var c=(o,n)=>y(o,"name",{value:n,configurable:!0});import{library14_canonical as h,library14_matches as O}from"../vendor/runtime.js";import{fieldOf as s,fieldsOf as L}from"../fold/claims.js";import{lockStanding as W}from"../fold/keys.js";import{worldAt as B}from"../fold/places.js";import{defaulted as g,placesOf as k,viewsOf as v}from"../fold/views.js";import{zoomed as M}from"../fold/zoom.js";import{ownLockOf as b}from"../fold/signed.js";import{wordFrom as x,wireLine as F}from"../fold/wire.js";import{sourced as _}from"../land/vouched.js";import{nameOf as $}from"../render/page.js";const S=c(o=>{const n=L(o);return delete n.sig,delete n.epoch,{...n,by:"target"}},"unsigned");import{ownLock as j,ownStore as z}from"../observe/runner.js";function A(o,n,r){const p=new Map([...v(o).values()].flatMap(t=>"regions"in t?[[t.name,t]]:[])),f=c(t=>t.startsWith(n),"inside"),d=j().filter(t=>s(t,"scope")==="publish/takes").flatMap(t=>s(t,"value").split("|").filter(Boolean)),w=new Set([_(o),x(o,"families","reader",W(z())),"publish"]),m=new Set(o.map(t=>s(t,"scope").split("/")).filter(t=>t.length===3&&t[0]==="publish"&&t[2]==="bootstrap").map(t=>t[1]));return t=>{const i=s(t,"scope"),a=s(t,"needs").split("|").filter(Boolean);if(d.some(e=>O(e,i))||i.startsWith(n))return!0;if(i.startsWith("view/")){const e=p.get(i.slice(5));if(e===void 0||e.shape==="")return!1;const u=F(o,"views/world");return(u===void 0?[]:s(u,"value").split("|").filter(Boolean)).includes(e.name)?r!==void 0&&g(o,e,r.own,r.tree):r!==void 0&&g(o,e,r.own,r.tree)||(a.length?a.some(f):k(o,e).includes(n)||!k(o,e).length)}const l=i.split("/")[0]??"";return w.has(l)?!1:!m.has(l)&&i.includes(`/${n}`)||a.length>0&&a.every(f)}}c(A,"takenFor");function R(o){const n=$(o),r=`${n}/`,p=o.standing.filter(e=>s(e,"value")!=="withdraw"),f=b(o.root,n),d=A(p,r,B(o.root,n)?{own:f,tree:v(b(o.root,""))}:void 0),w=c(e=>h(S(M(e,n))),"rooted"),m=c(e=>["scope","role","measure"].map(u=>s(e,u)).join(" "),"key"),t=f.filter(e=>!s(e,"scope").startsWith("keys/")).map(e=>h(S(e))),i=new Set(t.map(m)),a=[...t,...p.filter(d).map(w).filter(e=>!i.has(m(e)))],l=new Set(a.map(e=>s(e,"scope")));return[...new Set(a.filter(e=>!s(e,"condition")||l.has(s(e,"condition"))))]}c(R,"placeLines");export{R as placeLines,A as takenFor};
|
package/dist/fold/places.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var E=Object.defineProperty;var a=(e,t)=>E(e,"name",{value:t,configurable:!0});import{join as f}from"../host/io.js";import{
|
|
1
|
+
var E=Object.defineProperty;var a=(e,t)=>E(e,"name",{value:t,configurable:!0});import{join as f}from"../host/io.js";import{library14_CAPSULE as y,library14_canonical as j,library14_EXTENSION as v,library14_LOCK as g,library14_matches as C,library14_parse as A}from"../vendor/runtime.js";import{lockLines as x}from"./keys.js";import{releasesOf as N}from"../host/release.js";import{archiveCoordinate as B}from"../host/archive.js";import{fieldOf as o}from"./claims.js";import{isCeiling as K}from"./configures.js";import{entriesIn as L,observeText as O}from"../observe/files.js";import{ownLock as b}from"../observe/runner.js";import{said as M}from"./wire.js";import{ownLockOf as h}from"./signed.js";function P(e,t=x(f(e,v))){return N(t).flatMap(n=>{const s=o(n,"needs");return s?[B(s)]:[]})}a(P,"mountedCoordinatesIn");function T(e,t=x(f(e,v))){const n=new Set(P(e,t));return L(e).filter(s=>s.dir&&!n.has(s.name)).map(s=>s.name).sort()}a(T,"localDirectoriesIn");function k(e,t=x(f(e,v))){return T(e,t).filter(n=>O(f(e,n,g))!==void 0)}a(k,"placesIn");const Z=a((e,t,n,s)=>!k(e).includes(s)&&(L(e).find(r=>r.name===s)?.dir??!1)&&t.some(r=>o(r,"scope")===`${n}/${s}`&&o(r,"measure")==="coordinates"&&o(r,"value").split("|").includes(`${s}/**`)),"foundableIn"),ee=a((e,t)=>[g,y].some(n=>(O(f(e,t,n))??"").split(`
|
|
2
2
|
`).some(s=>o(s,"scope").startsWith("capsule/"))),"capsuleAt"),S=a((e,t)=>[g,y].some(n=>(O(f(e,t,n))??"").split(`
|
|
3
3
|
`).some(s=>o(s,"scope")==="capsule/key"&&o(s,"value")!=="withdraw")),"worldAt"),se=a(e=>k(e).filter(t=>S(e,t)),"worldsIn");function te(e,t){const n=h(e,t),s=[];S(e,t)&&s.push("world");const r=n.find(l=>o(l,"scope")==="place/kind"&&o(l,"value")!=="withdraw");return r!==void 0&&s.push(...o(r,"value").split("|").filter(Boolean)),[...new Set(s)]}a(te,"kindsOf");function ne(e){return k(e).flatMap(t=>{const n=h(e,t);return n.filter(s=>o(s,"scope").startsWith("class/")&&o(s,"value")!=="withdraw").flatMap(s=>{const r=o(s,"scope").slice(6),l=new Set(o(s,"value").split("|").filter(Boolean));return n.filter(c=>l.has(o(c,"scope"))&&K(c)).map(c=>({classes:r===""?[]:[r],line:c}))})})}a(ne,"classDefaults");const W=a((e,t)=>n=>n==="./"?`${e}/`:t.some(s=>n.startsWith(`${s}/`))?n:`${e}/${n}`,"fromPlace"),_=new Map;function re(e){const t=k(e),n=[b(),...t.map(l=>h(e,l))],s=_.get(e);if(s!==void 0&&s.parts.length===n.length&&s.parts.every((l,c)=>l===n[c]))return s.got;const r=D(e,t);return _.set(e,{parts:n,got:r}),r}a(re,"spoken");function D(e,t){const n=M(b(),"place/speaks"),s=M(b(),"place/speaks-under");return!n.length&&!s.length?[]:t.flatMap(r=>h(e,r).flatMap(l=>{const c=A(l),I=o(l,"scope"),p=I.split("/"),u=s.flatMap(d=>p.map((m,$)=>$+1).filter(m=>m<p.length&&C(d,p.slice(0,m).join("/")))).sort((d,m)=>d-m)[0];if(c.kind!=="fact"||u===void 0&&!n.some(d=>C(d,I)))return[];const i={...c.value.fields},w=W(r,t);return u!==void 0&&p[u]!==r&&(i.scope=[...p.slice(0,u),r,...p.slice(u)].join("/")),i.needs?i.needs=i.needs.split("|").filter(Boolean).map(w).join("|"):i.shape&&i.role==="demands"&&(i.needs=w(i.shape)),i.measure==="reader"&&i.value&&(i.value=w(i.value)),[{place:r,line:j(i)}]}))}a(D,"speakingOf");export{ee as capsuleAt,ne as classDefaults,Z as foundableIn,W as fromPlace,te as kindsOf,T as localDirectoriesIn,P as mountedCoordinatesIn,k as placesIn,re as spoken,S as worldAt,se as worldsIn};
|
package/dist/fold/reach.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var O=Object.defineProperty;var l=(t,s)=>O(t,"name",{value:s,configurable:!0});import{selectedCapsules as W}from"../host/selected-capsules.js";import{basename as b}from"../host/io.js";import{
|
|
1
|
+
var O=Object.defineProperty;var l=(t,s)=>O(t,"name",{value:s,configurable:!0});import{selectedCapsules as W}from"../host/selected-capsules.js";import{basename as b}from"../host/io.js";import{library14_canonical as k,library14_matches as S,library14_parse as L}from"../vendor/runtime.js";import{fieldOf as o}from"./claims.js";import{spoken as g,worldsIn as R}from"./places.js";import{wordOf as B,wordsOf as E}from"./wire.js";import{ownLock as h,ownRoot as _}from"../observe/runner.js";import{ownLockOf as $}from"./signed.js";const x=".",v="\0";function j(t,s,n){const e=b(_()),i=new Set(g(t).map(c=>c.line)),u=`${B(n,"families","view")}/`,r=h().filter(c=>o(c,"scope")==="publish/takes").flatMap(c=>o(c,"value").split("|").filter(Boolean));return c=>{const a=o(c,"scope");if(i.has(c))return;const f=a.split("/");if(s.includes(f[0]??""))return f[0];const p=new Set(o(c,"needs").split("|").filter(Boolean).map(d=>d.split("/")[0]??"")),m=[...p][0]??"";if(p.size===1&&m!==e&&s.includes(m))return m;if(a.startsWith(u))return E(n,"views/world").includes(a.slice(u.length))?v:void 0;if(r.some(d=>S(d,a)))return;const w=s.filter(d=>f.slice(1).includes(d));return w.length?w.length===1?w[0]:void 0:p.size&&[...p].every(d=>d===e)?void 0:x}}l(j,"ownerIn");const U=l((t,s)=>{const[n="",e=""]=o(s,"scope").split("/");return t.includes(n)?n:t.includes(e)?e:void 0},"placedAt");function G(t,s,n,e){const i=n.map(j(t,s,e));if(i.some(r=>r===void 0))return s;const u=i.some(r=>r===v)?R(t):[];return[...new Set([...i.filter(r=>r!==void 0&&r!==x&&r!==v),...u])].sort()}l(G,"touchedBy");const q=l(t=>{const s=t.under?$(t.root,t.under.replace(/\/$/,"")).filter(e=>o(e,"scope").startsWith("uses/")):[],n=t.standing.filter(e=>o(e,"scope").startsWith(`${t.under??""}uses/`));return[...new Set([...s,...n])].filter(e=>o(e,"value")!=="withdraw")},"selectionLines"),y=l((t,s)=>t.filter(n=>o(n,"scope").startsWith(`${s}dep/`)).map(n=>{const e=L(n,{preserveKeys:!0});if(e.kind!=="fact")throw Error(`REFUSE\xB7wire ${e.why}`);const{sig:i,by:u,epoch:r,expires:c,repo:a,...f}=e.value.fields;return k({...f,scope:f.scope.slice(s.length)},e.value.version)}),"relativeProjections"),z=l(t=>{const s=t.under?.replace(/\/$/,"")??"",n=s?`${s}/`:"",e=$(t.root,s).filter(u=>o(u,"scope").startsWith("dep/")),i=y(t.standing,n);return[...new Set([...h(),...e,...i])]},"projectionLines");function H(t,s,n){const e=s?`${s}/`:"",i=n===void 0?t.filter(r=>o(r,"scope").startsWith(`${e}uses/`)&&o(r,"value")!=="withdraw"):q({root:n,standing:t,...e?{under:e}:{}}),u=n===void 0?[...h(),...y(t,e)]:z({root:n,standing:t,...e?{under:e}:{}});return W(i,void 0,void 0,u)}l(H,"capsulesFor");export{H as capsulesFor,U as placedAt,z as projectionLines,q as selectionLines,G as touchedBy};
|
package/dist/fold/readers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var I=Object.defineProperty;var p=(s,i)=>I(s,"name",{value:i,configurable:!0});import{resolve as u}from"../host/io.js";import{
|
|
1
|
+
var I=Object.defineProperty;var p=(s,i)=>I(s,"name",{value:i,configurable:!0});import{resolve as u}from"../host/io.js";import{library14_canonical as R,library14_fields as D,library14_matches as N,library14_byBytes as G}from"../vendor/runtime.js";import{namesAt as _,wordOn as j,wordsOf as X,wireLine as q}from"./wire.js";import{fits as k}from"../observe/match.js";import{bytesDigest as A,coordinateDigest as x}from"./digests.js";import{fieldOf as f}from"./claims.js";import{capsuleAt as z,placesIn as C}from"./places.js";import{capsulesFor as H}from"./reach.js";import{ownLockOf as J}from"./signed.js";import{ownLock as L}from"../observe/runner.js";import{selectedWireList as K}from"../host/selected-topos.js";import{entriesIn as P,coordinatesUnder as Q,observeFile as F,stampOf as U}from"../observe/files.js";function me(s,i){const t=new Map,o=new Map;return{under:p((n,l)=>t.get(`${l} ${n}`)??t.set(`${l} ${n}`,Q(n,s,l?a=>i(a)!=="foreign":void 0)).get(`${l} ${n}`),"under"),stamp:p(n=>o.get(n)??o.set(n,U(n)?.stamp??"").get(n),"stamp")}}p(me,"lookOf");function V(s,i,t){const o=i.replace(/\/?$/,"/"),n=u(s,o);if(U(n)?.kind!=="dir")return;const l=P(n).filter(a=>t(`${o}${a.name}`)==="source").map(a=>a.dir?`${a.name}/`:a.name).sort();return new TextEncoder().encode(l.join(`
|
|
2
2
|
`))}p(V,"entriesOf");const Y=p((s,i)=>{const[t="",...o]=s.split("/"),n=(o.at(-1)??"").replace(/\.[^.]+$/,"");return i.flatMap(l=>[`${t} ${n} ${l.replace(/\/?$/,"/")}`,`${t} ${n}s ${l.replace(/\/?$/,"/")}`])},"reachOfLine");function de(s,i,t,o,n=H){const l=p(e=>e?.selected?.selection,"origin"),a=j(t,"region-coordinate",L()),w=X(t,"region-measures"),c=t.filter(e=>f(e,"scope").startsWith("uses/")&&f(e,"value")!=="withdraw"),r=w.length||!c.length?w:K(t,Number.MAX_SAFE_INTEGER,c,"region-measures"),m=D(f(q(t,"offers/world")??"","value")).map(([e,$])=>R({scope:`region/${e}`,measure:j(t,"region-coordinate",L()),value:$})),d=new Map;for(const e of["",...C(s)]){const $=e?`${e}/`:"",O=J(s,e).filter(g=>f(g,"scope").startsWith("region/")&&r.includes(f(g,"measure"))&&f(g,"measure")===a&&f(g,"value")!=="withdraw"),T=[...O,...z(s,e)?m.filter(g=>!O.some(h=>f(h,"scope")===f(g,"scope"))):[]];if(!T.length)continue;const W=n(t,e,s);for(const g of T){const h=f(g,"scope").slice(7);for(const y of W.filter(({capsule:E})=>E.lines.some(M=>f(M,"scope")===`region/${h}`&&f(M,"measure")==="writes"))){const E=f(y.offer,"scope").split("/")[1]??"";if(o.filter(b=>Y(b.module,b.where).includes(`${E} ${h} ${$||"/"}`)).some(b=>l(b.capsule)===void 0))throw Error(`REFUSE\xB7reader ${E}/${h} existing provider origin unmeasured at ${$||"/"}`);if(y.capsule.selection!==void 0&&o.some(b=>l(b.capsule)===y.capsule.selection&&b.capsule?.region===h&&b.where.some(B=>B.replace(/\/?$/,"/")===($||"/"))))continue;const v=`${y.capsule.selection??y.capsule.digest} ${h}`;(d.get(v)??d.set(v,{module:`${E}/${h}`,digest:y.capsule.digest,entry:f(y.offer,"shape"),selected:y.capsule,region:h,reads:y.capsule.declaration.regions[h]??[],globs:new Map}).get(v)).globs.set($,f(g,"value").split("|").filter(Boolean))}}}return[...d.entries()].sort(([e],[$])=>G(e,$)).map(([,e])=>({id:e.module,shape:["run"],where:[...e.globs.keys()],module:e.module,kind:"process",capsule:{selected:e.selected,digest:e.digest,entry:e.entry,region:e.region,reads:e.reads,globs:e.globs}}))}p(de,"capsuleReadersOf");function S(s,i,t,o,n){const{reads:l,globs:a}=i.capsule,w=l.some(c=>c.includes("@"));return o.under(u(s,n),!0).filter(c=>{const r=c.slice(n.length);return(!w||t(c)==="source")&&l.some(m=>k(m,r))&&(a.get(n)??[]).some(m=>N(m,r))}).sort()}p(S,"handedAt");function $e(s,i,t,o,n,l){const a=[],w=t.where.filter(l);if(t.capsule!==void 0&&t.capsule.reads.some(c=>c.includes("@")))for(const c of w){const r=S(s,t,o,n,c),m=r.map(d=>`${d} ${n.stamp(u(s,d))}`).join(`
|
|
3
3
|
`);a.push({place:c,seen:A(i,new TextEncoder().encode(m)).replace(/^[^:]*:/,"").slice(0,16),bytes:p(()=>new TextEncoder().encode(r.map(d=>`${d} ${x(i,u(s,d))??A(i,new Uint8Array)}`).join(`
|
|
4
4
|
`)),"bytes")})}else if(t.capsule!==void 0)for(const c of[...new Set(w.flatMap(r=>S(s,t,o,n,r)))].sort())a.push({place:c,seen:n.stamp(u(s,c)),bytes:p(()=>F(u(s,c))??new Uint8Array,"bytes"),digest:p(()=>x(i,u(s,c))??A(i,new Uint8Array),"digest")});else if(t.kind==="process")for(const c of w){const r=u(s,c);if(U(r)?.kind!=="dir")continue;const m=n.under(r,!0).filter(e=>o(e)==="source"||o(e)!=="foreign"&&t.shape.some($=>_(e,$)||k($,e))).sort(),d=m.map(e=>`${e} ${n.stamp(u(s,e))}`).join(`
|
package/dist/fold/region.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var H=Object.defineProperty;var u=(s,e)=>H(s,"name",{value:e,configurable:!0});import{createHash as R}from"../host/io.js";import{
|
|
1
|
+
var H=Object.defineProperty;var u=(s,e)=>H(s,"name",{value:e,configurable:!0});import{createHash as R}from"../host/io.js";import{library1_alphabetForm as C}from"../vendor/runtime.js";import{library2_cell as L,library2_parts as B,library2_sign as G}from"../vendor/runtime.js";import{library0_point as S,library0_region as W,library0_within as q}from"../vendor/runtime.js";import{library14_matches as j,library14_parse as J,library14_roleClaimsOf as K}from"../vendor/runtime.js";import{fieldOf as $}from"./claims.js";import{library7_INTERVALS as E,library7_spanOf as P}from"../vendor/runtime.js";const I=u(s=>s.replace(/(?:\/\*\*|\/\*|\/)+$/,""),"trimmed"),O=u(s=>s.includes("*"),"globbed");function Q(s){const e=new Set([""]);for(const o of s){if($(o,"value")==="withdraw")continue;const n=$(o,"scope"),a=["role","paths"].includes($(o,"measure"))?J(o):void 0,i=a?.kind==="fact"?K([a.value.fields]).map(f=>f.name):[],r=i.length?i:n.startsWith("dir/")?[n.slice(4)]:n.startsWith("region/")&&$(o,"res")?[$(o,"value")]:[];for(const f of[...r,...$(o,"needs").split("|")].map(I))f&&!O(f)&&e.add(f)}return[...e].sort()}u(Q,"regionsNamed");function _(s,e){let o="";for(const n of s)n.length>o.length&&n!==e&&e.startsWith(`${n}/`)&&(o=n);return o}u(_,"restsOn");function U(s,e){const o=I(e);let n="";for(const a of s)a.length>n.length&&(o===a||o.startsWith(`${a}/`))&&(n=a);return n}u(U,"regionOf");const F=u((s,e)=>O(e)?s.some(o=>j(e,o)):s.includes(e),"names");function T(s,e){const o=$(e,"scope"),n=o.split("/"),a=u((i,r)=>({line:e,question:i,region:r,measure:$(e,"measure"),form:$(e,"form"),value:$(e,"value")}),"of");for(let i=1;i<n.length;i+=1){const r=I(n.slice(i).join("/"));if(r&&F(s,r))return a(n.slice(0,i).join("/"),r)}for(let i=n.length-1;i>0;i-=1){const r=n.slice(0,i).join("/");if(F(s,r))return a(n.slice(i).join("/"),r)}return a(o,"")}u(T,"boundOf");function A(s,e,o){const n=[];for(let t=e;!n.includes(t);t=_(s,t))n.push(t);const a=u((t,c)=>{let p=new Map(n.map((b,g)=>[`c${g}`,L(`c${g}`,0,[],g+1<n.length?[`c${g+1}`]:[])]));for(const[b,g]of c)p=G(t,p,`c${Math.max(0,n.indexOf(b.region))}`,g);return B(t,p.get("c0"),p).signed},"signedIn"),i=o.filter(t=>t.form==="interval").flatMap(t=>(c=>c?[[t,c]]:[])(P(t.value)));if(i.length)return a(E,i);const r=o.filter(t=>t.form==="alphabet");if(!r.length)return;const f=u(t=>(t.startsWith("not:")?t.slice(4):t).split("|").filter(c=>c&&c!=="none"),"words"),m=[...new Set(["",...r.flatMap(t=>f(t.value))])].sort(),y=u(t=>C.parse({tokens:m},{want:t.startsWith("not:")?m.filter(c=>!f(t).includes(c)):f(t)}),"mask"),h=a(C.lattice({tokens:m}),r.map(t=>[t,y(t.value)])).members(m);return h.includes("")?m.filter(t=>t!==""&&!h.includes(t)).map(t=>`not:${t}`):h}u(A,"poleAt");function ie(s,e){const o=[];for(let r=e;o.push(r),r!=="";r=_(s.named,r));const n=new Map;for(const r of s.bounds.filter(f=>o.includes(f.region))){const f=`${r.question} ${r.measure}`;n.set(f,[...n.get(f)??[],r])}const a=s.summaries.get(e),i=u((r,f)=>{const m=new Map;for(const[y,h]of a?.values??[]){const[t,c]=[y.slice(0,y.lastIndexOf(" ")),y.slice(y.lastIndexOf(" ")+1)];if(!(c!==f||!q(S(t),W(r))))for(const[p,b]of h)m.set(p,(m.get(p)??0)+b)}return m.size?m:void 0},"heldAt");return new Map([...n].map(([r,f])=>[r,{ceiling:A(s.named,e,f),held:i(f[0].question,f[0].measure)}]))}u(ie,"polesOf");function ce(s,e,o){const n=Q(s),a=e.map(t=>T(n,t)),i=new Map,r=u(t=>i.get(t)??i.set(t,{region:t,cells:0,sums:new Map,values:new Map,bounds:[]}).get(t),"at");for(const t of[...n,...a.map(c=>c.region)])r(t);for(const t of a)r(t.region).bounds.push(t);const f=new Map,m=u(t=>f.get(t)??f.set(t,t===""?[""]:[t,...m(_(n,t))]).get(t),"chainOf"),y=[...i.keys()].filter(O),h=new Map;for(const t of o){const c=`${t.question} ${t.measure}`,p=/^(-?\d+(?:\.\d+)?)\.\./.exec(t.value),b=h.get(`${t.place}\0${c}`)??h.set(`${t.place}\0${c}`,{place:t.place,key:c,ids:new Set}).get(`${t.place}\0${c}`);if(p)b.sum=(b.sum??0)+Number(p[1]);else for(const g of t.value.split("|"))g&&g!=="none"&&b.ids.add(g)}for(const{place:t,key:c,sum:p,ids:b}of h.values()){const g=U(n,t),v=[...m(g),...y.filter(M=>m(g).some(k=>k&&j(M,k)))];for(const M of new Set(v)){const k=r(M);k.cells+=1,p!==void 0&&k.sums.set(c,(k.sums.get(c)??0)+p);const l=k.values.get(c)??k.values.set(c,new Map).get(c);for(const d of p!==void 0?[String(p)]:b)l.set(d,(l.get(d)??0)+1)}}return{named:n,bounds:a,summaries:i}}u(ce,"regionsOf");function X(s,e,o={}){const n=o[e.measure]??(e.measure==="count"?o[$(e.line,"scope")]:void 0);if(n!==void 0){const l=A(s.named,e.region,[e]),d=l!==void 0&&!Array.isArray(l)&&(n<l.lo||n>l.hi)?1:0;return{bars:d,cells:0,fresh:d,met:1,sums:d}}const a=s.summaries.get(e.region);if(!a)return{bars:0,cells:0,fresh:0,met:0,sums:0};const i=s.bounds.filter(l=>l!==e&&l.measure===e.measure&&l.form===e.form&&q(S(e.question),W(l.question))&&(l.region===""||e.region===l.region||e.region.startsWith(`${l.region}/`)||O(l.region)&&j(l.region,e.region))),r=e.form==="alphabet"||e.measure==="per-file"||$(e.line,"scope").endsWith("/*"),f=u((l,d)=>{if(d===void 0)return!1;if(!Array.isArray(d)){const x=Number(l);return!E.leq({lo:x,hi:x},d)}const w=d;return w.some(x=>x.startsWith("not:"))?w.includes(`not:${l}`):!w.includes(l)},"outside"),m=A(s.named,e.region,[e]),y=A(s.named,e.region,i);let h=0,t=0,c=0,p=0;const b=W($(e.line,"scope")),g=s.summaries.get("")??a,v=new Map,M=u((l,d)=>{for(const[w,x]of l.values){const[z,D]=[w.slice(0,w.lastIndexOf(" ")),w.slice(w.lastIndexOf(" ")+1)];!v.has(w)&&D===e.measure&&d(z)&&v.set(w,{bar:x,sum:l.sums.get(w)})}},"take");M(g,l=>q(S(l),b)),M(a,l=>q(S(l),W(e.question)));for(const{bar:l}of v.values())for(const[d,w]of l)p+=w,!(!r||!f(d,m))&&(h+=1,t+=w,f(d,y)||(c+=w));const k=r?0:[...v.values()].filter(({sum:l})=>l!==void 0&&f(String(l),m)).length;return{bars:h,cells:t,fresh:c,met:p,sums:k}}u(X,"rankOf");function N(s){const e=R("sha256");e.update(`${s.region}
|
|
2
2
|
${s.cells}
|
|
3
3
|
`);for(const o of s.bounds.map(n=>n.line).sort())e.update(`${o}
|
|
4
4
|
`);for(const o of[...s.sums.keys()].sort())e.update(`${o}=${s.sums.get(o)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var L=Object.defineProperty;var d=(e,o)=>L(e,"name",{value:o,configurable:!0});import{
|
|
1
|
+
var L=Object.defineProperty;var d=(e,o)=>L(e,"name",{value:o,configurable:!0});import{library3_verdictDemand as y}from"../vendor/runtime.js";import{library14_matches as q,library14_parse as x}from"../vendor/runtime.js";const p=d(e=>{const o=x(e);return o.kind==="fact"?o.value.fields:{}},"fields"),i=d((e,o)=>p(e)[o]??"","f"),h=d(e=>[...new Set(e.split("|").filter(Boolean))],"words"),w=d(e=>i(e,"value")!=="withdraw","active"),S=d(e=>w(e)&&i(e,"role")==="writes"&&i(e,"form")==="alphabet"&&i(e,"measure")==="id","declaration");function A(e){return[...e.forks.map(o=>({kind:"fork",evidence:[o.key,...o.lines]})),...e.refused.map(o=>({kind:"refused",evidence:[o]})),...e.grey.map(o=>({kind:"grey",evidence:[o]})),...e.orphans.map(o=>({kind:"orphan",evidence:[o]})),...e.second.verdict==="forks"?[{kind:"second-fork",evidence:[e.second.verdict]}]:[]]}d(A,"releaseFaults");function B(e){const o=[...new Set(e.standing.filter(s=>i(s,"scope")==="release/blocks"&&S(s)))],t=[...new Set([...e.demands,...e.ceilings])],r=e.standing.filter(s=>w(s)&&i(s,"role")==="demands"&&i(s,"form")==="alphabet"&&i(s,"measure")==="verdict"),E=r.map(s=>y(p(s),e.verdicts??[])),m={snapshot:e.snapshot,policy:o,debt:t,gates:E};if(!o.length)return{...m,status:"absent",categories:[],unresolved:[]};const j=new Set(o.map(s=>[...h(i(s,"value"))].sort().join("|"))),c=[];for(const s of e.faults??[])(s.obligation===void 0||!t.includes(s.obligation))&&c.push(`unclassified ${s.kind}: ${s.evidence.join(" | ")}`);j.size!==1&&c.push("release/blocks has conflicting standing values");const $=h(i(o[0],"value"));$.length||c.push("release/blocks selects no category");const b=$.map(s=>{const g=[...new Set(e.standing.filter(n=>i(n,"scope")===`release/category/${s}`&&S(n)))];g.length||c.push(`release/category/${s} has no admitted link`),new Set(g.map(n=>[...h(i(n,"value"))].sort().join("|"))).size>1&&c.push(`release/category/${s} has conflicting standing values`);const v=new Set;for(const n of h(i(g[0]??"","value"))){const f=t.filter(u=>q(n,i(u,"scope")));f.length||c.push(`release/category/${s} selector ${n} names no obligation`),f.forEach(u=>v.add(u))}v.size||c.push(`release/category/${s} selects no obligation`);const l=[];for(const n of v){for(const a of e.faults??[])a.obligation===n&&l.push({line:n,reason:a.kind,evidence:[...a.evidence]});if(e.demands.includes(n)){const a=r.includes(n)?y(p(n),e.verdicts??[]):void 0;if(a){a.status!=="met"&&l.push({line:n,reason:a.status,evidence:a.evidence.map(k=>`${k.coordinate}=${k.value}`)});continue}e.paid.includes(n)||l.push({line:n,reason:"missing",evidence:[]});continue}const f=i(n,"scope"),u=e.readings.over.filter(a=>a.ceiling===f);u.length&&e.ceilings.filter(a=>i(a,"scope")===f).length!==1&&c.push(`ceiling evidence for ${f} does not identify one obligation`),u.length&&l.push({line:n,reason:"outside",evidence:u.map(a=>`${a.side} ${a.question} ${a.got}`)}),e.readings.unread.includes(n)&&l.push({line:n,reason:"unread",evidence:[]}),e.readings.vacuous.includes(n)&&l.push({line:n,reason:"vacuous",evidence:[]}),!e.readings.read.includes(n)&&!e.readings.unread.includes(n)&&!e.readings.vacuous.includes(n)&&c.push(`ceiling ${f} has no result in this fold`)}return{name:s,links:g,selected:[...v],failures:l}});return{...m,categories:b,unresolved:[...new Set(c)],status:c.length?"incomplete":b.some(s=>s.failures.length)?"blocked":"ready"}}d(B,"releasePolicy");function O(e){return e===void 0?[]:[...(e.gates??[]).map(t=>`GATE ${t.scope} ${t.status} \xB7 requires=${t.required.join("|")} \xB7 ${t.evidence.map(r=>`${r.coordinate}=${r.value}`).join(" | ")||t.reason||"no evidence"}`),`RELEASE policy ${e.status} \xB7 fold ${e.snapshot.fold} \xB7 instrument ${e.snapshot.instrument}`,...e.unresolved.map(t=>`UNRESOLVED release \xB7 ${t}`),...e.categories.flatMap(t=>t.failures.map(r=>`BLOCK ${t.name} \xB7 ${i(r.line,"scope")} \xB7 ${r.reason}${r.evidence.length?` \xB7 ${r.evidence.join(" | ")}`:""}`))]}d(O,"releasePolicyLines");export{A as releaseFaults,B as releasePolicy,O as releasePolicyLines};
|
package/dist/fold/resolved.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var A=Object.defineProperty;var u=(e,s)=>A(e,"name",{value:s,configurable:!0});import{readOnly as C}from"../host/read-only.js";import{createHash as w,dirname as I,existsSync as x,join as $,linkSync as M,mkdirSync as R,readdirSync as T,renameSync as U,writeFileSync as B}from"../host/io.js";import{
|
|
1
|
+
var A=Object.defineProperty;var u=(e,s)=>A(e,"name",{value:s,configurable:!0});import{readOnly as C}from"../host/read-only.js";import{createHash as w,dirname as I,existsSync as x,join as $,linkSync as M,mkdirSync as R,readdirSync as T,renameSync as U,writeFileSync as B}from"../host/io.js";import{library14_canonical as k,library14_parse as D}from"../vendor/runtime.js";import{RECEIPTS as H,fieldOf as r,isWire as S}from"./claims.js";import{bytesDigest as _}from"./digests.js";import{carriesOnly as z}from"./observed.js";import{writerFor as L}from"./signers.js";import{viewsOf as P}from"./views.js";import{zoomed as q}from"./zoom.js";import{ledgerLines as G,storeAt as b}from"../land/ledger.js";import{sourced as J}from"../land/vouched.js";import{entriesIn as K,observeFile as W,observeText as E}from"../observe/files.js";const N=u(e=>{const s=D(e);return s.kind==="fact"&&s.value.fields.sig?e:s.kind==="fact"&&r(e,"measure")==="observed"?k({...s.value.fields,value:r(e,"at").replace(/^.*:/,"").slice(0,16)}):e},"bytesOnly"),y=new WeakMap;function de(e){const s=y.get(e);if(s!==void 0)return s;if(!e.observed.length&&z(e.root,e.store))return y.set(e,[...new Set(X(e.store).flatMap(t=>(E(t)??"").split(`
|
|
2
2
|
`).filter(S)))]).get(e);const n=e.under??"",a=[...P(e.standing).values()].flatMap(t=>"regions"in t&&t.regions.some(o=>o.name==="receipts")?[t.shape]:[])[0]??"",c=n||!a?[]:K(e.root).filter(t=>t.dir&&E($(e.root,t.name,a))!==void 0).map(t=>`${t.name}/`).sort(),p=u(t=>t.startsWith(n)&&!c.some(o=>t.startsWith(o))&&(!a||!t.endsWith(a)),"own"),i=new Set(e.observed.filter(t=>r(t,"measure")==="observed"&&p(r(t,"scope"))).map(t=>`${r(t,"by")} ${r(t,"at")}`)),d=[...new Set(e.observed.filter(t=>r(t,"measure")!=="observed"&&i.has(`${r(t,"by")} ${r(t,"at")}`)))],m=new Set(d.map(t=>`${r(t,"by")} ${r(t,"at")}`)),f=new Set(e.observed.filter(t=>{if(r(t,"measure")!=="observed")return!1;const o=r(t,"at"),g=r(t,"by");return o.startsWith("witness:")?m.has(`${g} place:${o.slice(8)}`):p(r(t,"scope"))&&m.has(`${g} ${o}`)}).map(N)),v=G(e.store,"judge").filter(t=>e.paid.some(o=>r(o,"scope")===r(t,"scope")&&!(c.length>0&&r(o,"needs").split("|").filter(Boolean).length>0&&r(o,"needs").split("|").filter(Boolean).every(g=>c.some(j=>g.startsWith(j)))))),F=c.map(t=>{const o=_(e.store,W($(e.root,t,a))??new Uint8Array);return k({scope:`${J(e.standing)}/${t}${a}`,role:"writes",form:"alphabet",measure:"digest",value:o,by:L(e.standing,"fold")??"",at:`place:${o}`})}),O=n.replace(/\/$/,""),h=[...new Set([...F,...[...f].sort(),...[...d].sort(),...v,...e.receiptHistory??[]])].map(t=>O&&!r(t,"sig")?q(t,O):t);if(!h.length){const t=(E($(e.root,n,H))??"").split(`
|
|
3
3
|
`).filter(S),o=V(e.store,t);if(o!==void 0&&o.length)return y.set(e,o).get(e)}return y.set(e,h),Q(e.store,h),h}u(de,"receiptsOf");function Q(e,s,n){const a=s.map(i=>`${i}
|
|
4
4
|
`).join(""),c=w("sha256").update(a).digest("hex"),p=b(e,"cas","carried",c);if(x(p))l(p,c);else{if(C())return`sha256:${c}`;R(I(p),{recursive:!0});const i=n===void 0?"":b(n,"cas","carried",c);if(i&&x(i)){l(i,c);try{return M(i,p),`sha256:${c}`}catch{}}B(`${p}.${process.pid}`,a),U(`${p}.${process.pid}`,p)}return`sha256:${c}`}u(Q,"keepCarried");function V(e,s){const n=u(i=>r(i,"scope")==="receipts"&&r(i,"measure")==="digest"&&r(i,"by")==="bound"&&!r(i,"sig"),"headerOf"),a=s.find(n);if(a===void 0)return s;for(let i=1;i<s.length;i+=1){const d=s[i];if(!n(d))continue;const m=r(d,"at").replace(/^place:sha256:/,""),f=s.slice(0,i);if(/^[0-9a-f]{64}$/.test(m)&&w("sha256").update(f.map(v=>`${v}
|
package/dist/fold/roles.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var k=Object.defineProperty;var r=(n,o)=>k(n,"name",{value:o,configurable:!0});import{createHash as x,dirname as u,join as v}from"../host/io.js";import{
|
|
1
|
+
var k=Object.defineProperty;var r=(n,o)=>k(n,"name",{value:o,configurable:!0});import{createHash as x,dirname as u,join as v}from"../host/io.js";import{library14_parse as c,library14_roleClaimsOf as a}from"../vendor/runtime.js";import{namesAt as g,roleAt as w}from"./wire.js";import{lockStanding as p}from"./keys.js";import{placesIn as b}from"./places.js";import{ownLockOf as M}from"./signed.js";import{observeText as y}from"../observe/files.js";import{fieldOf as l,isWire as A}from"./claims.js";function T(n){const o=c(n);return o.kind==="fact"&&a([o.value.fields]).length>0}r(T,"isRoleLock");function h(n){const o=u(n),e=[],f=[];for(const i of p(n)){if(l(i,"measure")!=="role"||!l(i,"scope").startsWith("roles/"))continue;const s=l(i,"needs"),t=s?y(v(o,s)):void 0,m=t===void 0?"":`sha256:${x("sha256").update(t).digest("hex")}`;if(t===void 0||m!==l(i,"restsOn")){f.push(l(i,"scope"));continue}for(const d of t.split(`
|
|
2
2
|
`).filter(A).map(O=>c(O)))d.kind==="fact"&&e.push(d.value.fields)}return{claims:a(e),stale:f}}r(h,"inheritedRoles");function $(n){const o=a(p(n).map(e=>c(e)).flatMap(e=>e.kind==="fact"?[e.value.fields]:[]));return new Set([...o,...h(n).claims].filter(e=>(e.role==="foreign"||e.role==="derived")&&!e.name.includes("/")&&!e.name.includes("*")).map(e=>e.name))}r($,"stepsOutside");function q(n){const o=r(s=>s.map(t=>c(t)).flatMap(t=>t.kind==="fact"?[t.value.fields]:[]),"fields"),e=[...a(o(p(n))),...h(n).claims],f=u(n),i=new Map(b(f).map(s=>[s,a(o(M(f,s)))]));return s=>{const t=s.includes("/")?i.get(s.slice(0,s.indexOf("/")))??[]:[];return w(s,t.some(m=>g(s,m.name))?t:e)}}r(q,"rolesOf");export{h as inheritedRoles,T as isRoleLock,q as rolesOf,$ as stepsOutside};
|
package/dist/fold/shards.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var
|
|
1
|
+
var M=Object.defineProperty;var c=(e,t)=>M(e,"name",{value:t,configurable:!0});import{hostOutput as A}from"../host/call-context.js";import{dirname as x,existsSync as u,mkdirSync as h,renameSync as $,writeFileSync as v}from"../host/io.js";import{library14_canonical as E}from"../vendor/runtime.js";import{bytesDigest as y}from"./digests.js";import{blobAt as j,landShard as D,ledgerLines as F,shardFile as L,shardLines as k,storeAt as R,writerFile as g}from"../land/ledger.js";import{fieldOf as p,isWire as V}from"./claims.js";import{observeFile as W,observeText as B}from"../observe/files.js";const w=/ measure=observed /,O=/(?:^|\s)scope=(?:cost\/)?reader\//,d=c(e=>/(?:^|\s)by=reader:([0-9a-f]+)/.exec(e)?.[1],"readerOf"),G=c(e=>e.replace(/\/+$/,""),"trimmed");import{sha as m}from"../host/hash.js";import{sha as ne}from"../host/hash.js";function S(e,t){let r="";for(const n of e)n.length>r.length&&(t===n||t.startsWith(`${n}/`))&&(r=n);return r}c(S,"regionIn");const b=c((e,t)=>R(e,"cas","observations",t),"observationAt"),K=c((e,t,r,n="1")=>m(`${e}
|
|
2
2
|
${t}
|
|
3
|
-
${m([...
|
|
3
|
+
${m([...r].sort().join(`
|
|
4
4
|
`))}
|
|
5
|
-
${n}`),"keyOf"),
|
|
6
|
-
`).filter(
|
|
5
|
+
${n}`),"keyOf"),N=c((e,t)=>u(b(e,t)),"observed");function P(e,t){return B(b(e,t))?.split(`
|
|
6
|
+
`).filter(V)}c(P,"observation");function Q(e,t,r){const n=b(e,t);u(n)||(h(x(n),{recursive:!0}),v(`${n}.${process.pid}`,`${[...new Set(r)].sort().join(`
|
|
7
7
|
`)}
|
|
8
|
-
`)
|
|
8
|
+
`),$(`${n}.${process.pid}`,n))}c(Q,"keepObservation");function X(e,t,r,n){const a=new Map,f=new Map,l=new Map,s=k(e,t,r);for(const o of s)w.test(o)?a.set(`${d(o)??""} ${p(o,"scope")}`,{at:p(o,"at"),line:o}):o.includes(" measure=observation ")&&(f.set(d(o)??"",p(o,"value")),l.set(d(o)??"",o));const i=[...s.filter(o=>O.test(o)),...[...a].filter(([o])=>n.has(o.slice(0,o.indexOf(" ")))).map(([,o])=>o.line),...[...l].filter(([o])=>n.has(o)).map(([,o])=>o)];if(s.length>2*i.length+500){const o=L(e,t,r);v(`${o}.${process.pid}`,`${i.join(`
|
|
9
9
|
`)}
|
|
10
|
-
`)
|
|
11
|
-
`))}`}),"pointer");function
|
|
12
|
-
`)}c(
|
|
10
|
+
`),$(`${o}.${process.pid}`,o)}return{region:r,places:a,keys:f}}c(X,"opened");const Y=c((e,t,r,n,a)=>E({scope:r||".",role:"writes",form:"alphabet",measure:"observation",value:n,by:`${e}:${t}`,at:`place:${m([...a].sort().join(`
|
|
11
|
+
`))}`}),"pointer");function Z(e,t,r){if(!u(g(e,t)))return;const n=new Map,a=new Map,f=new Map;for(const s of F(e,t))if(w.test(s))n.set(`${d(s)??""} ${p(s,"scope")}`,s);else if(O.test(s)){const i=S(r,p(s,"scope").replace(/^(?:cost\/)?reader\//,""));f.set(i,[...f.get(i)??[],s])}else{const i=`${d(s)??""} ${p(s,"at")}`;a.set(i,[...a.get(i)??[],s])}const l=new Map(f);for(const s of n.values()){const i=S(r,p(s,"scope"));l.set(i,[...l.get(i)??[],s])}for(const[s,i]of l)D(e,t,s,i);return a}c(Z,"legacyOf");function ee(e,t){const r=g(e,t);if(!u(r))return;const n=W(r)??new Uint8Array,a=j(e,y(e,n));h(x(a),{recursive:!0}),$(r,a),A("error",`SHARDED ${t} \xB7 one file of ${n.length} bytes laid out by region \xB7 kept as ${y(e,n)}
|
|
12
|
+
`)}c(ee,"setAside");export{O as LEVEL,w as OBSERVED,Q as keepObservation,K as keyOf,Z as legacyOf,P as observation,N as observed,X as opened,Y as pointer,d as readerOf,S as regionIn,ee as setAside,ne as sha,G as trimmed};
|
package/dist/fold/signed.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`),
|
|
3
|
-
`).filter(
|
|
1
|
+
var E=Object.defineProperty;var s=(e,t)=>E(e,"name",{value:t,configurable:!0});import{AsyncLocalStorage as F}from"node:async_hooks";import{realpathSync as L}from"node:fs";import{join as K}from"../host/io.js";import{library0_region as O,library0_within as R}from"../vendor/runtime.js";import{library14_LOCK as $,library14_parse as T,library14_windowAt as q}from"../vendor/runtime.js";import{fieldOf as h,foldClaims as j,isWire as H,sayingOf as y}from"./claims.js";import{signaturesOf as N}from"./digests.js";import{lockLines as P,lockStanding as U}from"./keys.js";import{wordOf as W}from"./wire.js";import{authorityFor as z,rootSigner as B}from"./signers.js";import{ledgerLines as D,shardLines as G,storeOf as J}from"../land/ledger.js";import{verifiesFields as Q}from"../land/sign.js";import{observeText as V}from"../observe/files.js";const A=new Map,k=new Map,w=new F;function pt(e,t){const r=L(e),o=w.getStore(),i={root:r,told:new Map(o?o.root===r?o.told:[]:k)};return w.run(i,()=>{try{const n=t();if(n!==null&&(typeof n=="object"||typeof n=="function")&&"then"in n)throw Error("REFUSE\xB7own preview requires synchronous work");return n}finally{i.told.clear()}})}s(pt,"withOwnPreview");const mt=s((e,t)=>{(w.getStore()?.told??k).set(e,t)},"tellOwn");function p(e,t,r=!0){const o=J(e),i=P(o),n=V(K(e,t,$))??"",a=i.some(l=>h(l,"sig")!=="")?N(o).admitted:[],f=a.length?z(i,B(e),a).admitted:[],m=f.flatMap(l=>t?G(o,l.id,`${t}/${$}`):D(o,l.id)).filter(l=>h(l,"sig")!==""),c=w.getStore(),I=c?c.root===L(e)?c.told.get(t):void 0:k.get(t),g=[n,...m,...r?I??[]:[]].join(`
|
|
2
|
+
`),v=`${e} ${t}`,u=A.get(v);if(u!==void 0&&u.text===g&&u.lock===i)return u;const x=[...new Set(g.split(`
|
|
3
|
+
`).filter(H))],M=f.some(l=>!l.coverage.includes("*"))?W(U(o),"families","region"):"",_=s(l=>X(l,t,M,f,a),"stands"),S=new Set(x.filter(_)),C=new Set([...S].map(y)),b={text:g,lock:i,lines:x,applied:S,projected:C,folded:new Map};return A.set(v,b),b}s(p,"verified");function ut(e,t,r=!1){const o=p(e,t),i=o.folded.get(r);if(i!==void 0)return i;const n=j(o.lines.filter(d=>o.applied.has(d)||!r&&!/ sig=/.test(d)&&!o.projected.has(y(d)))).standing.filter(d=>h(d,"value")!=="withdraw");return o.folded.set(r,n),n}s(ut,"ownLockOf");const wt=s((e,t,r)=>p(e,t).applied.has(r),"admittedIn"),gt=s((e,t)=>[...p(e,t).applied],"appliedIn"),ht=s((e,t)=>(r=>j(r.lines.filter(o=>r.applied.has(o)||!/ sig=/.test(o)&&!r.projected.has(y(o)))).forks.map(o=>o.key))(p(e,t)),"forksIn"),yt=s((e,t)=>(r=>r.lines.filter(o=>!r.applied.has(o)).length)(p(e,t)),"writtenIn"),kt=s((e,t)=>[...p(e,t,!1).applied],"appliedHistoryIn");function X(e,t,r,o,i){const n=T(e);if(n.kind!=="fact"||n.value.fields.sig===void 0)return!1;const d=n.value.fields,a=o.find(c=>c.id===d.by),f=Number(d.epoch)||0;if(a===void 0||!Q(d,a.publicKey,i))return!1;const m=q(a,f);return f>=m.start&&(m.close===null||f<=m.close)&&a.coverage.some(c=>c==="*"||R(O(`${r}/${t}/${d.scope??""}`,"./"),O(c,"./")))}s(X,"ownRecordAdmitted");export{wt as admittedIn,kt as appliedHistoryIn,gt as appliedIn,ht as forksIn,ut as ownLockOf,X as ownRecordAdmitted,mt as tellOwn,pt as withOwnPreview,yt as writtenIn};
|
package/dist/fold/signers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var m=Object.defineProperty;var a=(e,r)=>m(e,"name",{value:r,configurable:!0});import{bootstrapAnchor as h}from"./bootstrap-anchor.js";import{
|
|
1
|
+
var m=Object.defineProperty;var a=(e,r)=>m(e,"name",{value:r,configurable:!0});import{bootstrapAnchor as h}from"./bootstrap-anchor.js";import{library14_authorityOf as k,library14_isKeyClaim as v,library14_signersOf as b}from"../vendor/runtime.js";import{verifiesFields as d}from"../land/sign.js";import{fieldOf as t,parsedLine as c}from"./claims.js";import{keyFor as g,lockStanding as w}from"./keys.js";import{storeOf as l}from"../land/ledger.js";function B(e){const r=c(e);return r.kind==="fact"&&v(r.value.fields)}a(B,"isSignerLock");function L(e,r,i,o){const s=e.map(n=>c(n)).flatMap(n=>n.kind==="fact"?[n.value.fields]:[]),u=b(s,r,(n,f)=>d(n,f,i));return{admitted:u.admitted,potential:u.potential,of:a(n=>{const f=c(n);return f.kind==="fact"?k(f.value.fields,u.admitted,(p,y)=>d(p,y,i),o):{kind:"grey",why:`not a claim line: ${f.why}`}},"of")}}a(L,"authorityFor");function x(e,r){for(const i of e){const o=/^keys\/([^/]+)$/.exec(t(i,"scope"))?.[1];if(o&&t(i,"measure")==="class"&&t(i,"value")===r)return o}}a(x,"writerFor");function O(e,r){const i=h(e);if(i?.id===r)return i.publicKey;const o=w(l(e)).find(s=>t(s,"scope")===`keys/${r}`&&t(s,"measure")==="public-key"&&t(s,"value")!=="withdraw");return o===void 0?void 0:t(o,"value")}a(O,"publicKeyOf");function A(e){const r=a((o,s)=>t(e.find(u=>t(u,"scope")===`keys/${o}`&&t(u,"measure")===s&&t(u,"value")!=="withdraw")??"","value")||void 0,"said"),i=x(e,"authorize")??"";return{id:i,keyClass:"authorize",publicKey:r(i,"public-key")??"",coverage:["*"],depth:{lo:1,hi:16},admittedBy:[]}}a(A,"releaseSigner");function M(e){const r=g(l(e),"authorize");return{id:r,keyClass:"authorize",publicKey:O(e,r)??"",coverage:["*"],depth:{lo:1,hi:16},admittedBy:[]}}a(M,"rootSigner");export{L as authorityFor,B as isSignerLock,O as publicKeyOf,A as releaseSigner,M as rootSigner,x as writerFor};
|
package/dist/fold/stranger.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
`).filter(
|
|
3
|
-
`),
|
|
4
|
-
`);for(const
|
|
5
|
-
`);i&&
|
|
6
|
-
`)}
|
|
1
|
+
var u=Object.defineProperty;var n=(s,e)=>u(s,"name",{value:e,configurable:!0});import{hostOutput as r}from"../host/call-context.js";import{existsSync as d,join as a,readdirSync as l}from"../host/io.js";import{library14_LOCK as m}from"../vendor/runtime.js";import{fieldOf as o,isWire as h}from"./claims.js";import{observeText as E}from"../observe/files.js";function x(s){const e=a(s,"ledger");return!d(e)||l(e).length===0}n(x,"emptyLedger");function C(s){const e=(E(a(s,m))??"").split(`
|
|
2
|
+
`).filter(h),c=[...new Set(e.flatMap(t=>o(t,"needs").split("|").filter(Boolean)))].sort(),f=e.filter(t=>{const p=o(t,"scope");return p.startsWith("uses/")&&!p.slice(5).includes("/")&&o(t,"value")!=="withdraw"}).map(t=>o(t,"scope")),i=o(e.find(t=>o(t,"scope").startsWith("view/")&&o(t,"shape")!==""&&o(t,"value")!=="withdraw")??"","shape");r("out",`RECEIPTS 0 read \xB7 1 opened
|
|
3
|
+
`),r("out",`NEEDS ${c.join(" ")}
|
|
4
|
+
`);for(const t of f)r("out",`OPEN ${t}/
|
|
5
|
+
`);i&&r("out",`RENDER ${i}
|
|
6
|
+
`)}n(C,"sayStranger");export{x as emptyLedger,C as sayStranger};
|
package/dist/fold/wire.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var $=Object.defineProperty;var n=(r,o)=>$(r,"name",{value:o,configurable:!0});import*as m from"../vendor/
|
|
1
|
+
var $=Object.defineProperty;var n=(r,o)=>$(r,"name",{value:o,configurable:!0});import*as m from"../vendor/library14.js";import{fieldOf as t,selfName as d}from"./claims.js";import{selectedWireList as x}from"../host/selected-topos.js";const i=m,F=i.namesAt??i.namesLeaf,R=i.roleAt??i.leafRoleOf,a=n((r,o)=>r.find(e=>t(e,"scope")===`wire/${o}`&&t(e,"value")!=="withdraw")??r.find(e=>t(e,"scope")===`audit/wire/${o}`&&t(e,"value")!=="withdraw"),"wireLine");function c(r,o){const e=a(r,o);return(e===void 0?[]:t(e,"value").split("|")).filter(Boolean)}n(c,"wordsOf");function h(r,o,e){const l=c(r,o),p=r.filter(f=>t(f,"scope").startsWith("uses/")&&t(f,"value")!=="withdraw"),s=a(r,o)===void 0&&p.length?x(r,Number.MAX_SAFE_INTEGER,p,o):l,w=typeof e=="string"?[e]:e,u=w.find(f=>s.includes(f));if(u!==void 0)return u;throw new Error(`${d()}: REFUSE\xB7wire \`${w.join("|")}\` is not one of \`wire/${o}\`: ${s.join("|")||"the lock lists none"}`)}n(h,"wordOf");function E(r,o){const e=c(r,o);if(e.length!==1)throw new Error(`${d()}: REFUSE\xB7wire \`wire/${o}\` names ${e.length} words, not one: ${e.join("|")||"the lock lists none"}`);return h(r,o,e)}n(E,"theWord");const j=n((r,o,e)=>E(c(r,o).length?r:e,o),"wordOn");function k(r,o,e,l){return h((typeof e=="string"?[e]:e).some(s=>c(r,o).includes(s))?r:l,o,e)}n(k,"wordFrom");const L=n((r,o)=>r.filter(e=>t(e,"scope")===o&&t(e,"value")!=="withdraw").flatMap(e=>t(e,"value").split("|").filter(Boolean)),"said");export{F as namesAt,R as roleAt,L as said,E as theWord,a as wireLine,k as wordFrom,h as wordOf,j as wordOn,c as wordsOf};
|
package/dist/fold/zoom.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var W=Object.defineProperty;var p=(l,i)=>W(l,"name",{value:i,configurable:!0});import{join as m}from"../host/io.js";import{
|
|
1
|
+
var W=Object.defineProperty;var p=(l,i)=>W(l,"name",{value:i,configurable:!0});import{join as m}from"../host/io.js";import{library14_canonical as w,library14_LOCK as C,library14_parse as O,library14_RECEIPTS as T}from"../vendor/runtime.js";import{fieldOf as f,foldClaims as j,isWire as g}from"./claims.js";import{observeText as $}from"../observe/files.js";import{placesIn as y}from"./places.js";function E(l,i){const d=O(l);if(d.kind!=="fact")return l;const t={...d.value.fields},s=`${i}/`,r=p(e=>e.split("|").filter(Boolean).flatMap(a=>a===s?["./"]:a.startsWith(s)?[a.slice(s.length)]:[]).join("|"),"paths"),c=p(e=>{if(e===s)return"./";if(e.startsWith(s))return e.slice(s.length);const a=e.split("/"),u=a.findIndex((x,h)=>x===i&&(h===1||h===2)&&h<a.length-1);return u<0?e:[...a.slice(0,u),...a.slice(u+1)].join("/")},"scope");if(t.needs!==void 0){const e=r(t.needs);e?t.needs=e:delete t.needs}for(const e of["scope","condition"])t[e]&&(t[e]=c(t[e]));const o=t.at??"",n=o.indexOf(":");return n>0&&o.startsWith(s,n+1)&&(t.at=`${o.slice(0,n+1)}${o.slice(n+1+s.length)}`),t.measure==="cone"&&t.value&&(t.value=r(t.value)),w(t)}p(E,"zoomed");function k(l){return y(l).filter(i=>!i.startsWith(".")).flatMap(i=>{const d=($(m(l,i,C))??"").split(`
|
|
2
2
|
`).filter(g);return j(d).standing.filter(t=>f(t,"value")!=="withdraw").map(t=>f(t,"scope")).filter(t=>t.startsWith(`${i}/`)||t.includes(`/${i}/`))}).length}p(k,"namingTheirPlace");function z(l,i){const d=i.filter(s=>/^publish\/[^/]+\/bootstrap$/.test(f(s,"scope"))&&f(s,"value")!=="withdraw").map(s=>f(s,"scope").split("/")[1]),t=p((s,r,c)=>{if(r===s)return!1;if(s===`${c}/`)return r!=="./";if(s.startsWith(`${c}/`))return r!==s.slice(c.length+1);const o=s.split("/");return![1,2].some(n=>o[n]===c&&n<o.length-1&&r===[...o.slice(0,n),...o.slice(n+1)].join("/"))},"lost");return d.reduce((s,r)=>{const c=$(m(l,r,T)),o=c===void 0?[]:c.split(`
|
|
3
3
|
`).filter(g);return s+[...i,...o].flatMap(n=>["scope","condition"].filter(e=>f(n,e).split("/").includes(r)).filter(e=>t(f(n,e),f(E(n,r),e),r))).length},0)}p(z,"zoomedOutsideThePlace");export{k as namingTheirPlace,E as zoomed,z as zoomedOutsideThePlace};
|
package/dist/host/act-cost.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var h=Object.defineProperty;var e=(s,t)=>h(s,"name",{value:t,configurable:!0});import{AsyncLocalStorage as l}from"node:async_hooks";class n{static{e(this,"ActCosts")}constructor(t=()=>performance.now()){this.occupied=0,this.largest=0,this.depth=0,this.clock=t,this.began=t()}begin(){const t=this.clock(),r=this.depth++===0;let i=!1;return()=>{if(i)throw Error("Act measurement closed twice");i=!0;const o=Math.max(0,this.clock()-t);this.depth--,this.largest=Math.max(this.largest,o),r&&(this.occupied+=o)}}measure(t){const r=this.begin();try{return t()}finally{r()}}measurement(){const t=Math.max(0,this.clock()-this.began),r=Math.max(0,t-this.occupied);return{elapsedMilliseconds:t,declaredMilliseconds:this.occupied,largestDeclaredMilliseconds:this.largest,unpartitionedMilliseconds:r,costMilliseconds:Math.max(this.largest,r)}}seconds(){return Math.max(0,Math.round(Math.max(this.largest,this.clock()-this.began-this.occupied)/1e3))}}const d=new n,a=new l;function p(s,t=()=>performance.now()){return a.run(new n(t),s)}e(p,"withActCosts");const c=e(()=>a.getStore()??d,"current"),g={begin:e(()=>c().begin(),"begin"),measure(s){return c().measure(s)},seconds:e(()=>c().seconds(),"seconds"),measurement:e(()=>c().measurement(),"measurement")};export{n as ActCosts,g as actCosts,p as withActCosts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var u=Object.defineProperty;var t=(r,e)=>u(r,"name",{value:e,configurable:!0});import{createPrivateKey as l,createPublicKey as o,sign as m,verify as c}from"node:crypto";import{
|
|
1
|
+
var u=Object.defineProperty;var t=(r,e)=>u(r,"name",{value:e,configurable:!0});import{createPrivateKey as l,createPublicKey as o,sign as m,verify as c}from"node:crypto";import{library14_formatSignature as y,library14_parseSignature as g}from"../../../vendor/runtime.js";const S=t((r,e,f)=>y(f,m(null,Buffer.from(r,"utf8"),l(e)).toString("base64")),"signBytes");function p(r){return r.startsWith("-----")?o(r):o({key:Buffer.from(r,"base64"),format:"der",type:"spki"})}t(p,"publicKeyOf");function v(r,e,f,s){const a=g(f);if(!a||!s.includes(a.algorithm))return!1;const n=Buffer.from(a.raw,"base64");if(n.length===0)return!1;try{return c(null,Buffer.from(r,"utf8"),p(e),n)}catch(i){if(i instanceof Error)return!1;throw i}}t(v,"verifyBytes");export{S as signBytes,v as verifyBytes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var h=Object.defineProperty;var s=(n,a)=>h(n,"name",{value:a,configurable:!0});import{BoundRefusal as c}from"../../refusals.js";class w extends Error{static{s(this,"ContentUnavailable")}}async function E(n,a,o={}){if(o.signal?.aborted)throw new c("reference/cancelled","REFUSE\xB7reference cancelled");const l=AbortSignal.timeout(a.timeoutMs),t=o.signal?AbortSignal.any([l,o.signal]):l;let r;const d=s(()=>{r?.cancel().catch(()=>{})},"cancel");t.addEventListener("abort",d,{once:!0});try{const e=await fetch(n,{signal:t,redirect:"manual"});if(e.status>=300&&e.status<400)throw new c("reference/transport","REFUSE\xB7transport redirect is not admitted");if(!e.ok)throw new w(`HTTP ${e.status}`);if(r=e.body?.getReader(),!r)return new Uint8Array;const f=[];let u=0;for(;;){const i=await r.read();if(t.aborted)throw t.reason;if(i.done)break;if(u+=i.value.length,u>a.responseBytes)throw await r.cancel(),new c("host-port/budget","REFUSE\xB7transport response exceeds declared byte bound");f.push(i.value)}return Buffer.concat(f)}catch(e){throw t.aborted?new c(o.signal?.aborted?"reference/cancelled":"host-port/timeout","REFUSE\xB7reference transport interrupted"):e instanceof TypeError?new w(e.message):e}finally{t.removeEventListener("abort",d),r?.releaseLock()}}s(E,"fetchBytes");export{w as ContentUnavailable,E as fetchBytes};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var f=Object.defineProperty;var s=(t,n)=>f(t,"name",{value:n,configurable:!0});import{hashText as g}from"./hash.js";import{admissionAnchor as m,admissionHistoryAt as p}from"../fold/admission-history.js";import{projectAuthenticatedStanding as l,publishedStandingLines as S}from"./standing-projection.js";import{createHash as b}from"node:crypto";let a;const d=new WeakMap;function x(t,n){const i=JSON.stringify(n),e=Object.isFrozen(t)?d.get(t):void 0;if(e?.anchor===i)return e.identity;const o=b("sha256"),r=g.bind(void 0,o);r("authenticated-root-history/1"),r(String(t.length));for(const u of t)r(u);r(i);const c=o.digest("hex");return Object.isFrozen(t)&&d.set(t,{anchor:i,identity:c}),c}s(x,"historicalIdentity");function h(t){const n=p(t,Number.MAX_SAFE_INTEGER),i=m(t),e=x(n,i);if(a?.identity===e)return a.standing;const o=l(n,i);return a={identity:e,standing:Object.freeze([...o])},a.standing}s(h,"authenticatedRootStanding");const E=h;function F(t){return S(h(t))}s(F,"publicStandingLines");export{h as authenticatedRootStanding,E as authenticatedStanding,F as publicStandingLines};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var n=Object.defineProperty;var
|
|
1
|
+
var n=Object.defineProperty;var o=(t,e)=>n(t,"name",{value:e,configurable:!0});import{AsyncLocalStorage as u}from"node:async_hooks";const s=new u,m=o(()=>s.getStore()?.freshBytes===!0,"hostRequiresFreshBytes"),i=o(()=>s.getStore()?.arguments,"hostArguments"),g=o(()=>s.getStore()?.instrumentName,"hostInstrumentName"),h=o(()=>s.getStore()?.runtime,"hostInstrumentRuntime"),S=o((t,e)=>s.run({...s.getStore(),instrumentName:t},e),"withHostInstrument"),a=o((t,e)=>s.run(t,e),"withHostCall");function l(t,e){const r=s.getStore()?.output;r?r(t,e):(t==="out"?process.stdout:process.stderr).write(e)}o(l,"hostOutput");export{i as hostArguments,g as hostInstrumentName,h as hostInstrumentRuntime,l as hostOutput,m as hostRequiresFreshBytes,a as withHostCall,S as withHostInstrument};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var y=Object.defineProperty;var f=(e,n)=>y(e,"name",{value:n,configurable:!0});import{hostOutput as h}from"./call-context.js";import{actCosts as m}from"./act-cost.js";import{fileURLToPath as g}from"node:url";import{boundedProcess as w}from"./process-lifetime.js";import{spawnSync as O}from"node:child_process";import{
|
|
1
|
+
var y=Object.defineProperty;var f=(e,n)=>y(e,"name",{value:n,configurable:!0});import{hostOutput as h}from"./call-context.js";import{actCosts as m}from"./act-cost.js";import{fileURLToPath as g}from"node:url";import{boundedProcess as w}from"./process-lifetime.js";import{spawnSync as O}from"node:child_process";import{library14_PROTOCOL as x}from"../vendor/runtime.js";class d extends Error{static{f(this,"CapsuleProcessError")}constructor(n,r){const s=r.stdout??"",o=r.stderr??"";super(`REFUSE\xB7capsule process ${n}
|
|
2
2
|
${o}${s}`),this.name="CapsuleProcessError",this.stdout=s,this.stderr=o,this.status=r.status,this.signal=r.signal,this.cause=r.error}}function b(e,n){if(e===null||typeof e!="object"||Array.isArray(e))return!1;const r=e;return r.protocol!==x?!1:r.kind==="refuse"||r.kind==="abstain"?typeof r.why=="string":r.kind!=="fact"?!1:n.verb==="render"?Array.isArray(r.lines)&&r.lines.every(s=>typeof s=="string"):n.verb==="read"?Array.isArray(r.claims):!0}f(b,"validResponse");function R(e,n,r,s={},o){return m.measure(()=>{const a=s.cwd,u=a===void 0?void 0:typeof a=="string"?a:g(a),t=o===void 0?O(e,n,{input:JSON.stringify(r),encoding:"utf8",maxBuffer:1<<26,...s}):w(e,n,JSON.stringify(r),o,u,s.env);if("error"in t&&t.error)throw new d(`failed: ${t.error.message}`,t);if(t.signal!==null||t.status!==0)throw new d(`exited ${t.status??`with signal ${t.signal}`}`,t);const p=/(?:^|\n)([^\n]*)$/.exec(t.stdout.trimEnd())?.[1]??"";let i;try{i=JSON.parse(p)}catch(c){throw new d("returned malformed or absent JSON",{...t,error:c})}if(!Array.isArray(i)||i.length!==r.length||!i.every((c,l)=>b(c,r[l])))throw new d(`returned an invalid batch; expected ${r.length} responses`,t);return t.stderr&&h("error",t.stderr),i})}f(R,"executeCapsule");export{d as CapsuleProcessError,R as executeCapsule,b as validResponse};
|
package/dist/host/capsule.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var G=Object.defineProperty;var l=(e,n)=>G(e,"name",{value:n,configurable:!0});import{hostOutput as F}from"./call-context.js";import{
|
|
1
|
+
var G=Object.defineProperty;var l=(e,n)=>G(e,"name",{value:n,configurable:!0});import{hostOutput as F}from"./call-context.js";import{library14_readerLifetime as K,library14_parse as Q}from"../vendor/runtime.js";import{contentStore as V,verifiedContent as X,contentPolicy as Y}from"./content-store.js";import{readOnly as Z}from"./read-only.js";import{readingBoundary as q}from"./reading-context.js";import{nativeReaderRoute as ee}from"./native-reader-context.js";import{assertNativeRouteCurrent as ne,invokeNativeRoute as te,materializeNativeRoute as re}from"./native/route.js";import{sha as oe}from"./hash.js";import{wireLinesOf as N}from"../fold/claims.js";import{createHash as b}from"node:crypto";import{mkdtempSync as ie,rmSync as C,statSync as se}from"node:fs";import{tmpdir as ae}from"node:os";import{basename as ce,join as $,resolve as de,relative as M,isAbsolute as fe,sep as le}from"node:path";import{library14_CAPSULE as k}from"../vendor/runtime.js";import{library4_declarationOf as j}from"../vendor/runtime.js";import{unpack as ue}from"./archive.js";import{executeCapsule as pe,validResponse as me}from"./capsule-process.js";import{holdStore as he,replaceWhole as we,storeAt as $e}from"../land/ledger.js";import{coordinatesUnder as ve,observeFile as A,observeText as E}from"../observe/files.js";import{hostOf as ye}from"../observe/run.js";import{ownLock as xe,ownRoot as ge,ownStore as P,processOf as _}from"../observe/runner.js";import{said as Ee}from"../fold/wire.js";const J=new Map,R=new Map,W=l(()=>{for(const e of R.values())C(e,{recursive:!0,force:!0})},"releaseLaid");function U(e,n){const r=R.get(e);if(r!==void 0)return r;const t=ie($(ae(),`${ce(ge())}-capsule-`));try{ue(n,t)}catch(o){throw C(t,{recursive:!0,force:!0}),o}return R.set(e,t),process.listeners("exit").includes(W)||process.once("exit",W),t}l(U,"unpacked");const B=new Map;function Qe(e,n,r){const t=r??V(),{bytes:o}=X(e,t),a=`${t}\0${e}\0${n}`,c=B.get(a);if(c!==void 0)return c;const m=J.get(e)??(y=>({lines:y,declaration:j(y)}))(N(E($(U(e,o),k))));J.set(e,m);const d=Object.keys(m.declaration.regions),i=U(e,o),u=de(i,n),v=M(i,u);if(!n||fe(n)||v===".."||v.startsWith(`..${le}`)||n.split(/[\\/]/).includes(".."))throw new Error(`REFUSE\xB7capsule ${e} declared entry ${n||"(absent)"} unavailable`);const h={digest:e,...m,ask:l((y,S)=>{if(!se(u,{throwIfNoEntry:!1})?.isFile())throw new Error(`REFUSE\xB7capsule ${e} declared entry ${n} unavailable`);return I(e,o,y,d,i,t,u,S)},"ask")};return B.set(a,h),h}l(Qe,"capsuleAt");const z=l(()=>Ee(xe(),"release/layout").map(e=>e.split(":")).filter(e=>e.length===2&&e[0]!==void 0&&e[1]!==void 0),"layoutsOf"),Se=l(e=>{const n=ve(e,e).filter(r=>r.endsWith(".js"));return n.length===1?n[0]:void 0},"oneModule"),D=new Map,H=l((e,n)=>{const r=D.get(e);if(r!==void 0)return r;const t=n.length===0?void 0:z().find(([a,c])=>n.some(m=>E($(e,a,`${m}${c}`))!==void 0)),o=t!==void 0?[_("located","host"),e,t[0],t[1]]:(a=>a===void 0?[]:[_("located","host"),e,a,"render"])(Se(e));return D.set(e,o),o},"spawnOf"),Oe=l((e=process.execArgv)=>e.filter((n,r)=>!/^(-e|-p|--eval|--print)$/.test(e[r-1]??"")&&!/^(-e|-p|--eval|--print|--input-type)(=|$)/.test(n)),"childFlags");function I(e,n,r,t,o,a=P(),c,m){const d=q(),i=ee();if(i){if(!d?.execution||e!==i.profile.selection.archive)throw Error("REFUSE\xB7native reader lacks its complete implementation identity");ne(i)}const u=c===void 0?H(o??U(e,n),t):[c];if(!u.length)return F("error",`LOAD regions \xB7 none of ${t.length} under the directories release/layout names
|
|
2
2
|
`),r.map(()=>{});const v=c!==void 0?`${b("sha256").update(`${M(o,c)}
|
|
3
3
|
`).digest("hex")}
|
|
4
4
|
`:u.length>1?`${b("sha256").update(A(u[0])??new Uint8Array).digest("hex")}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ee=Object.defineProperty;var f=(n,i)=>ee(n,"name",{value:i,configurable:!0});import{readFileSync as w,writeFileSync as D,existsSync as R,mkdirSync as te}from"node:fs";import{join as H,dirname as oe}from"node:path";import{performance as W}from"node:perf_hooks";import{fileURLToPath as re}from"node:url";import{
|
|
1
|
+
var ee=Object.defineProperty;var f=(n,i)=>ee(n,"name",{value:i,configurable:!0});import{readFileSync as w,writeFileSync as D,existsSync as R,mkdirSync as te}from"node:fs";import{join as H,dirname as oe}from"node:path";import{performance as W}from"node:perf_hooks";import{fileURLToPath as re}from"node:url";import{library14_canonical as g,library14_objectHistory as se,library14_parse as G,library14_byBytes as d,library14_wireAt as ne,library14_RECEIPTS as ie}from"../vendor/runtime.js";import{library11_cellInputs as ce,library11_cellReceiptContract as ae,library11_cellInputProfile as le}from"../vendor/runtime.js";import{library12_renderCells as pe}from"../vendor/runtime.js";import{admittedObjects as fe}from"./objects.js";import{objectFold as de}from"../engine/index.js";import{fullDigest as V,bytesDigest as k}from"./digest.js";import{closeReceipts as ue,noteIdle as me}from"../fold/closed.js";import{authorityFor as ye,rootSigner as be}from"../fold/signers.js";import{signaturesOf as he}from"../fold/digests.js";import{storeOf as Ee}from"../land/ledger.js";import{ownLock as we}from"../observe/runner.js";import{toposAt as ge}from"./selected-topos.js";const r=f(n=>{const i=G(n);return i.kind==="fact"?i.value.fields:{}},"fields");function ve(n){return["@lapxo/topos/cell-inputs","@lapxo/topos/cells-view"].map(i=>k(w(re(import.meta.resolve(i))),n)).sort(d)}f(ve,"implementation");async function Le(n,i,u){const X=W.now(),v=Ee(n),m=se(i);if(m.kind!=="fact")throw Error(`REFUSE\xB7wire ${m.why}`);const x=ye(i,be(n),he(v).admitted);for(const e of m.value.objects)if(x.of(g(e.fields)).kind!=="admitted")throw Error(`REFUSE\xB7authority receipt input ${e.fields.id}`);const P=m.value.configuration.filter(e=>x.of(g(e)).kind==="admitted");ae(P);const j=le(P),q=we().map(r),T=ne(q,Number.MAX_SAFE_INTEGER);if(!T)throw Error("REFUSE\xB7receipt no admitted digest algorithm");const a=[...T.digests][0];if(!a)throw Error("REFUSE\xB7receipt no digest algorithm");const B=ve(a),J=ce(m.value.objects,j),y=new Map,U=new Map,S=new Map;for(const e of m.value.objects.filter(t=>t.record==="cell")){const t=e.fields.topos;if(!S.has(t)){const Z=ge(t,v);S.set(t,[t,...Z.dependencies])}const o=`receipts/cells/${e.fields.scope}`,s=J.get(e.fields.scope),p=[...S.get(t),...B,"resolution=1"],c=j==="semantic-live@1"?[...s,...p].sort(d).join(`
|
|
2
2
|
`):[...s,...p.sort(d),`receipt-inputs=${j}`].join(`
|
|
3
3
|
`);U.set(o,c),y.set(o,V(c,a))}const A=V([...i,...B].sort(d),a),b=H(n,ie),M=R(b)?w(b,"utf8").split(`
|
|
4
4
|
`).filter(Boolean):[],h=M.filter(e=>G(e).kind==="fact"),E=h.filter(e=>r(e).scope==="receipts"&&r(e).measure==="digest"),O=f(e=>H(v,"cas","carried",e.slice(e.indexOf(":")+1)),"carried"),I=f(e=>{if(!e.startsWith(a+":")||!/^[a-f0-9]+$/.test(e.split(":")[1]??""))return;const t=O(e);if(!R(t))return;const o=w(t),s=k(o,a);if(s!==e){u(`RECEIPT invalid ${e} \xB7 got ${s} \xB7 recompute`);return}return o.toString("utf8")},"readVerified"),l=new Set(await ue(n,v,y)),K=h.filter(e=>r(e).scope!=="receipts").sort(d).join(`
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var I=Object.defineProperty;var s=(m,d)=>I(m,"name",{value:d,configurable:!0});import{withActCosts as H}from"./act-cost.js";import{mkdtempSync as O,writeFileSync as P,rmSync as N,realpathSync as w}from"node:fs";import{join as x}from"node:path";import{nativeHostInstrument as T}from"./native-receiver.js";import{withHostCall as z}from"./call-context.js";import{withActHost as G,underTheLock as J}from"../land/act.js";import{storeOf as M}from"../land/ledger.js";import{withNativeSigning as Z}from"./signing.js";import{BoundRefusal as c,refusalRecord as W}from"./refusals.js";import{readFileSync as _}from"node:fs";import{sha256 as $}from"./hash.js";import{nativePlaceState as D}from"./native-place-state.js";function dt(m){let d,o,E=!1,a;const h=s(t=>{process.connected&&process.send(t)},"send"),f=s(()=>{E=!0,o?.abort.abort(),a?.reject(new c("host/cancelled","REFUSE\xB7host/cancelled")),o||(d&&N(d.scratch,{recursive:!0,force:!0}),process.removeListener("message",v),process.connected&&process.disconnect())},"stop"),v=s(t=>{if(t?.kind==="configure"&&!d){d={place:w(t.place),scratch:w(t.scratch),limits:t.limits,instrumentName:t.instrumentName,instrumentRoot:w(t.instrumentRoot),instrumentEntry:w(process.argv[1])},h({kind:"ready",pid:process.pid});return}if(t?.kind==="close"){f();return}if(t?.kind==="cancel"&&o&&o.id===t.id){o.abort.abort(),a?.reject(new c("host/cancelled","REFUSE\xB7host/cancelled"));return}if(t?.kind==="signed"&&o?.id===t.id&&a){const u=a;if(a=void 0,t.error){const l=["host/signer-mismatch","host/unbound-signer"].includes(t.error.code)?t.error.code:"host-port/failed";u.reject(new c(l,"REFUSE\xB7"+l))}else u.resolve(t.records);return}if(t?.kind!=="request"||!d||E)return;if(o){h({kind:"result",id:t.id,status:1,stdout:"",stderr:`REFUSE\xB7host/busy
|
|
2
|
+
`});return}const n=d,S=new AbortController,g=t.id,A=s(async()=>{let u,l="",p="",F=0,k=1;const U=s((e,i)=>{if(F+=Buffer.byteLength(i),F>n.limits.responseBytes)throw new c("host/budget","REFUSE\xB7host/budget");e==="out"?l+=i:p+=i},"output");try{const e=t.command;if(Buffer.byteLength(JSON.stringify(e))>n.limits.requestBytes||!["fold","sign","land"].includes(e.verb)||!Array.isArray(e.args)||e.args.some(r=>typeof r!="string"))throw new c("host/context","REFUSE\xB7host/context");const i=D(n.place);if(i==="birth"&&e.verb!=="land")throw new c("host/foundation-required","REFUSE\xB7host/foundation-required");u=O(x(n.scratch,"request-"));const b=new Map;for(const r of e.inputs??[]){if(!/^[a-zA-Z0-9][a-zA-Z0-9._-]*$/.test(r.name)||b.has(r.name)||typeof r.text!="string")throw new c("host/context","REFUSE\xB7host/context");const y=x(u,r.name);P(y,r.text,{mode:384,flag:"wx"}),b.set(r.name,y)}const B=e.args.map(r=>r.startsWith("@input/")?b.get(r.slice(7))??(()=>{throw new c("host/context","REFUSE\xB7host/context")})():r),R=[e.verb,n.place,...B],L=t.signer?{...t.signer,signal:S.signal,sign:s(async r=>new Promise((y,C)=>{a={resolve:y,reject:C},h({kind:"sign",id:g,lot:r})}),"sign")}:void 0,j=T(n.instrumentRoot,n.instrumentEntry).runtime;k=await z({instrumentName:n.instrumentName,runtime:j,freshBytes:!0,arguments:R,output:U},()=>G({name:n.instrumentName,report:s(r=>U("error",r),"report"),signal:S.signal},()=>Z(L,()=>e.verb==="land"&&i==="admitted"?J(M(n.place),"host land",()=>m(R)):m(R))))}catch(e){if(p+=(e instanceof Error?e.message:"REFUSE\xB7host/failed")+`
|
|
3
|
+
`,e instanceof c){let i="";try{i=_(new URL("../../docs/contracts/refusals.bound",import.meta.url),"utf8")}catch{}p+=JSON.stringify(W(e,i,$))+`
|
|
4
|
+
`}}finally{a=void 0,u&&N(u,{recursive:!0,force:!0})}h({kind:"result",id:g,status:k,stdout:l,stderr:p})},"run"),q=Promise.resolve().then(()=>H(A)).finally(()=>{o=void 0,E&&f()});o={id:g,abort:S,done:q}},"receive");process.on("message",v),process.once("disconnect",f),process.once("SIGTERM",f),process.once("SIGINT",f)}s(dt,"serveNativeCommands");export{dt as serveNativeCommands};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var w=Object.defineProperty;var e=(t,o)=>w(t,"name",{value:o,configurable:!0});import{AsyncLocalStorage as d}from"node:async_hooks";import{createHash as E}from"node:crypto";import{blobAt as u}from"../land/ledger.js";import{observeFile as S}from"../observe/files.js";import{ownLock as b,ownStore as l}from"../observe/runner.js";import{
|
|
1
|
+
var w=Object.defineProperty;var e=(t,o)=>w(t,"name",{value:o,configurable:!0});import{AsyncLocalStorage as d}from"node:async_hooks";import{createHash as E}from"node:crypto";import{blobAt as u}from"../land/ledger.js";import{observeFile as S}from"../observe/files.js";import{ownLock as b,ownStore as l}from"../observe/runner.js";import{library14_parse as x,library14_wireAt as y}from"../vendor/runtime.js";import{ContentNeeded as A}from"./content-needed.js";const c=new d,L=e((t,o,i=()=>[])=>c.run({store:t,policy:i},o),"withContentStore"),M=e(()=>c.getStore()?.policy()??[],"contentPolicy"),F=e(()=>c.getStore()?.store??l(),"contentStore");function g(t,o=F(),i=l()){const h=b().flatMap(n=>{const r=x(n);return r.kind==="fact"?[r.value.fields]:[]}),f=y(h,Number.MAX_SAFE_INTEGER);if(!f)throw Error("REFUSE\xB7pin instrument has no admitted wire");const s=t.indexOf(":"),p=t.slice(0,s),m=t.slice(s+1);if(s<1||!f.digests.has(p)||!/^[a-f0-9]+$/.test(m))throw Error(`REFUSE\xB7pin ${t} digest is not admitted`);for(const n of new Set([o,i])){const r=u(n,t),a=S(r);if(a!==void 0){if(E(p).update(a).digest("hex")!==m)throw Error(`REFUSE\xB7pin ${t} content hash mismatch \xB7 store ${n} \xB7 not laid`);return{bytes:a,path:r}}}throw new A(t)}e(g,"verifiedContent");export{M as contentPolicy,F as contentStore,g as verifiedContent,L as withContentStore};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var S=Object.defineProperty;var r=(t,c)=>S(t,"name",{value:c,configurable:!0});import{openSync as A,fstatSync as C,readSync as x,closeSync as E}from"node:fs";import{
|
|
1
|
+
var S=Object.defineProperty;var r=(t,c)=>S(t,"name",{value:c,configurable:!0});import{openSync as A,fstatSync as C,readSync as x,closeSync as E}from"node:fs";import{library6_readPlaceActContext as y,library6_PLACE_ACT_CONTEXT as m}from"../vendor/runtime.js";import{declaredRootClockSource as d,hasRootClockSource as P}from"./root-clock-source.js";import{commitPlaceAct as T,placeActResult as _,committedPlaceActResults as g}from"./ports/place-act.js";import{placesIn as N}from"../fold/places.js";import{appliedHistoryIn as O}from"../fold/signed.js";import{storeOf as p}from"../land/ledger.js";import{publicStandingLines as R}from"./admitted-place.js";import{projectContextualStanding as w}from"./standing-carrier.js";import{admissionHistoryAt as B}from"../fold/admission-history.js";const u=r(t=>{throw Error("REFUSE\xB7contextual place "+t)},"fail");function k(t,c){const n=A(t,"r");try{const e=C(n);(!e.isFile()||e.size>c)&&u("batch byte budget");const o=Buffer.alloc(e.size);let i=0;for(;i<o.length;){const l=x(n,o,i,o.length-i,null);l||u("batch changed during read"),i+=l}return x(n,Buffer.alloc(1),0,1,null)&&u("batch changed during read"),new TextDecoder("utf8",{fatal:!0}).decode(o)}finally{E(n)}}r(k,"read");function U(t){return P(t)}r(U,"hasContextualPlace");async function q(t,c){const n=d(t),e=k(c,n.selection.budget.bytes);let o;try{o=JSON.parse(e)}catch{return u("invalid batch JSON")}return(!o||Object.keys(o).sort().join(",")!=="context,profile,receipts"||o.profile!==m||typeof o.context!="string"||!Array.isArray(o.receipts)||JSON.stringify(o)+`
|
|
2
2
|
`!==e)&&u("unsupported/noncanonical batch envelope"),T(p(t),o.context,o.receipts,n.trust,n.selection.storageBudget)}r(q,"landContextualPlace");function K(t,c){const n=d(t),e=_(p(t),c,n.trust,n.selection.storageBudget);if(!e)return;const o=new Map(g(p(t),n.trust,n.selection.storageBudget).map(s=>[s.identity,s])),i=new Set,l=[],f=r(s=>{if(i.has(s))return;const a=o.get(s);if(!a)return;i.add(s);const b=y(a.bundle.context,n.selection.budget);for(const h of b.places)f(h.previous);l.push({identity:a.identity,context:a.bundle.context,receipts:a.bundle.receipts,authority:n.authority(a.bundle.context)})},"visit");return f(c),{profile:m,identity:c,context:e.context,receipts:e.receipts,contexts:l}}r(K,"contextualAct");function j(t){const c=d(t),n=g(p(t),c.trust,c.selection.storageBudget);return{rootHistory:B(t,Number.MAX_SAFE_INTEGER),legacyPlaces:N(t).map(e=>({place:[e,"TARGET.bound"].join("/"),history:O(t,e)})),contexts:n.map(e=>({identity:e.identity,context:e.bundle.context,receipts:e.bundle.receipts,authority:c.authority(e.bundle.context)}))}}r(j,"contextualStandingSnapshot");function Q(t){const c=j(t),n=d(t);return w(R(t),c.legacyPlaces,c.contexts,c.contexts.map(e=>({identity:e.identity,context:y(e.context,n.selection.budget)})))}r(Q,"contextualStanding");export{K as contextualAct,Q as contextualStanding,j as contextualStandingSnapshot,U as hasContextualPlace,q as landContextualPlace};
|
package/dist/host/digest.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var f=Object.defineProperty;var t=(r,e)=>f(r,"name",{value:e,configurable:!0});import{createHash as o}from"node:crypto";import{
|
|
1
|
+
var f=Object.defineProperty;var t=(r,e)=>f(r,"name",{value:e,configurable:!0});import{createHash as o}from"node:crypto";import{library14_byBytes as a}from"../vendor/runtime.js";import{selfName as s}from"../fold/claims.js";function w(r,e){if(!e)throw new Error(`${s()}: REFUSE\xB7runtime a digest was asked for before the lock said which algorithm`);const i=typeof r=="string"?r:[...r].sort(a).join(`
|
|
2
2
|
`);return`${e}:${o(e).update(i).digest("hex")}`}t(w,"fullDigest");function m(r,e){if(!e)throw new Error(`${s()}: REFUSE\xB7runtime a digest was asked for before the lock said which algorithm`);return`${e}:${o(e).update(r).digest("hex")}`}t(m,"bytesDigest");export{m as bytesDigest,w as fullDigest};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var s=Object.defineProperty;var o=(e,t)=>s(e,"name",{value:t,configurable:!0});import{
|
|
1
|
+
var s=Object.defineProperty;var o=(e,t)=>s(e,"name",{value:t,configurable:!0});import{library14_LOCK as r}from"../vendor/runtime.js";import{BoundRefusal as n}from"./refusals.js";function i(e){throw new n("host/"+e,"REFUSE\xB7host/"+e)}o(i,"refuseHost");function u(e){e?.aborted&&i("cancelled")}o(u,"assertHostNotCancelled");function m(e,t){return(!/^(0|[1-9][0-9]*)$/.test(e)||!Number.isSafeInteger(Number(e)))&&t("unknown receiver clock"),Number(e)}o(m,"receiverClock");const p=o(e=>typeof e=="string"&&e.endsWith("/"+r)&&!e.startsWith("/")&&!e.split("/").some(t=>!t||t==="."||t===".."),"isPlaceLockCoordinate"),a=o(e=>e==="."?"":e.slice(0,-(r.length+1)),"placeRegionOf");export{u as assertHostNotCancelled,p as isPlaceLockCoordinate,a as placeRegionOf,m as receiverClock,i as refuseHost};
|