@lapxo/bound 0.2.3 → 0.2.5
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 +19 -0
- package/TARGET.bound +95 -39
- package/dist/cli/accept.js +72 -558
- package/dist/cli/act-result.js +3 -103
- package/dist/cli/args.js +3 -44
- package/dist/cli/custodian.js +2 -29
- package/dist/cli/host.js +4 -32
- package/dist/cli/names.js +1 -12
- package/dist/cli/native-descendant.js +1 -19
- package/dist/cli/native.js +3 -60
- package/dist/cli/observe.js +1 -13
- package/dist/cli/owner.js +3 -139
- package/dist/cli/pass.js +21 -321
- package/dist/cli/place.js +6 -281
- package/dist/cli/release-result.js +3 -80
- package/dist/cli/retained-judgment.js +1 -25
- package/dist/cli/standing-result.js +4 -21
- package/dist/cli/takes.js +10 -111
- package/dist/cli/verb.d.ts +1 -2
- package/dist/cli/verb.js +83 -683
- package/dist/engine/computation.js +2 -0
- package/dist/engine/conformance.js +4 -0
- package/dist/engine/encoding.js +1 -2
- package/dist/engine/index.d.ts +1 -13
- package/dist/engine/index.js +2 -11
- package/dist/engine/object.js +1 -38
- package/dist/engine/ports.js +2 -103
- package/dist/fold/admission-history.js +1 -17
- package/dist/fold/bootstrap-anchor.js +1 -28
- package/dist/fold/ceilings.js +1 -142
- package/dist/fold/claims.js +2 -131
- package/dist/fold/closed.js +24 -234
- package/dist/fold/configures.js +1 -25
- package/dist/fold/digests.js +10 -226
- package/dist/fold/evidence.js +1 -22
- package/dist/fold/fold-worker.js +1 -13
- package/dist/fold/kept.js +12 -173
- package/dist/fold/keys.js +3 -91
- package/dist/fold/laid.js +3 -90
- package/dist/fold/nos.js +1 -48
- package/dist/fold/object.js +1 -2
- package/dist/fold/observed.js +27 -534
- package/dist/fold/opened.js +1 -33
- package/dist/fold/own.js +3 -217
- package/dist/fold/paid.js +1 -92
- package/dist/fold/place-inputs.js +1 -70
- package/dist/fold/places.js +3 -100
- package/dist/fold/rank.js +1 -9
- package/dist/fold/reach.js +1 -83
- package/dist/fold/readers.js +6 -142
- package/dist/fold/receipts.js +1 -47
- package/dist/fold/region-declarations.js +1 -13
- package/dist/fold/region.js +8 -286
- package/dist/fold/release-policy.js +1 -101
- package/dist/fold/resolved.js +6 -145
- package/dist/fold/roles.js +2 -59
- package/dist/fold/second.js +4 -71
- package/dist/fold/shards.js +12 -100
- package/dist/fold/signed.js +3 -81
- package/dist/fold/signers.js +1 -54
- package/dist/fold/stranger.js +6 -24
- package/dist/fold/views.js +1 -66
- package/dist/fold/wire.js +1 -46
- package/dist/fold/zoom.js +3 -81
- package/dist/host/act-cost.js +1 -25
- package/dist/host/adapters/keys/ed25519.js +1 -30
- package/dist/host/adapters/modules/javascript.js +1 -50
- package/dist/host/adapters/transport/http.js +1 -28
- package/dist/host/admitted-place.js +1 -63
- package/dist/host/archive.js +1 -152
- package/dist/host/call-context.js +1 -0
- package/dist/host/capsule-process.js +2 -61
- package/dist/host/capsule.js +9 -168
- package/dist/host/cell-receipts.js +12 -128
- package/dist/host/commit-result.js +1 -0
- package/dist/host/content-needed.js +1 -8
- package/dist/host/content-store.js +1 -31
- package/dist/host/contextual-place.js +2 -77
- package/dist/host/digest.js +2 -15
- package/dist/host/hash.js +1 -9
- package/dist/host/host-controls.js +1 -0
- package/dist/host/in-process-act.js +3 -0
- package/dist/host/in-process-context.js +3 -0
- package/dist/host/in-process-root.js +6 -0
- package/dist/host/in-process.js +4 -0
- package/dist/host/index.d.ts +1 -0
- package/dist/host/index.js +1 -0
- package/dist/host/io.js +1 -11
- package/dist/host/lifetime.js +1 -79
- package/dist/host/located.js +6 -105
- package/dist/host/native/bounded-file.js +1 -32
- package/dist/host/native/command.js +1 -91
- package/dist/host/native/control-bridge-worker.js +2 -88
- package/dist/host/native/control-bridge.js +1 -110
- package/dist/host/native/control-selection.js +1 -32
- package/dist/host/native/custody.js +1 -91
- package/dist/host/native/deadline.js +1 -28
- package/dist/host/native/descendants.js +1 -528
- package/dist/host/native/generated-custodian.js +5 -267
- package/dist/host/native/generated.js +1 -379
- package/dist/host/native/image.js +1 -45
- package/dist/host/native/jobs.js +2 -148
- package/dist/host/native/loader.js +1 -269
- package/dist/host/native/materialize.js +1 -175
- package/dist/host/native/module-closure.js +1 -130
- package/dist/host/native/module-delivery.d.ts +1 -62
- package/dist/host/native/module-delivery.js +1 -151
- package/dist/host/native/module-syntax.js +1 -69
- package/dist/host/native/native-binary.js +1 -115
- package/dist/host/native/native-program.js +1 -72
- package/dist/host/native/node-jobs.js +3 -187
- package/dist/host/native/node-launch.js +1 -159
- package/dist/host/native/preload.js +1 -45
- package/dist/host/native/reading.js +1 -249
- package/dist/host/native/receipt-environment.js +1 -41
- package/dist/host/native/references.js +1 -30
- package/dist/host/native/root.js +1 -37
- package/dist/host/native/route.js +1 -216
- package/dist/host/native/runtime.js +1 -9
- package/dist/host/native-reader-context.js +1 -8
- package/dist/host/native-receiver.js +1 -0
- package/dist/host/objects.js +1 -38
- package/dist/host/order.js +1 -2
- package/dist/host/place-act-transaction.js +4 -0
- package/dist/host/place-clock-selection.js +5 -124
- package/dist/host/ports/ingress.js +2 -57
- package/dist/host/ports/local-act.js +5 -172
- package/dist/host/ports/place-act.js +1 -169
- package/dist/host/ports/publication.js +1 -56
- package/dist/host/ports/signing.js +1 -74
- package/dist/host/ports/store.js +1 -18
- package/dist/host/ports/transport.js +1 -48
- package/dist/host/process-lifetime.js +1 -17
- package/dist/host/provide.js +1 -183
- package/dist/host/read-only.js +1 -9
- package/dist/host/reading-closures.js +7 -227
- package/dist/host/reading-context.js +1 -53
- package/dist/host/reading-identity-types.js +0 -0
- package/dist/host/reading-identity.js +3 -0
- package/dist/host/reading-preparation.js +6 -0
- package/dist/host/reference-authenticated.d.ts +1 -40
- package/dist/host/reference-authenticated.js +3 -100
- package/dist/host/reference-contracts.js +1 -6
- package/dist/host/reference-export.js +6 -81
- package/dist/host/reference-native-api.d.ts +1 -3
- package/dist/host/reference-native-api.js +1 -3
- package/dist/host/reference-native.js +1 -74
- package/dist/host/reference-profile.js +1 -63
- package/dist/host/reference-standing.js +2 -18
- package/dist/host/reference.js +1 -24
- package/dist/host/refusals.js +2 -43
- package/dist/host/release.js +4 -256
- package/dist/host/root-clock-source.js +1 -305
- package/dist/host/selected-capsules.js +1 -50
- package/dist/host/selected-topos.js +1 -80
- package/dist/host/signature-era.js +1 -0
- package/dist/host/signing.js +2 -48
- package/dist/host/source-content.js +2 -110
- package/dist/host/standing-carrier.js +1 -0
- package/dist/host/standing-projection.js +1 -0
- package/dist/host/timing.js +1 -7
- package/dist/host/walk.js +20 -193
- package/dist/judge/late.js +1 -33
- package/dist/judge/take.js +2 -75
- package/dist/judge/widening.js +1 -25
- package/dist/land/act.js +8 -302
- package/dist/land/alias.js +1 -41
- package/dist/land/held.js +1 -23
- package/dist/land/inert.js +1 -33
- package/dist/land/leaving.js +1 -55
- package/dist/land/ledger.js +7 -188
- package/dist/land/owned.js +4 -66
- package/dist/land/sign.js +1 -53
- package/dist/land/standing-pin.js +1 -49
- package/dist/land/vouched.js +1 -112
- package/dist/land/withdraw.js +1 -24
- package/dist/observe/files.js +1 -88
- package/dist/observe/identity.js +1 -61
- package/dist/observe/match.js +1 -8
- package/dist/observe/regions.js +7 -306
- package/dist/observe/run.js +2 -40
- package/dist/observe/runner.js +4 -93
- package/dist/public-types.d.ts +1114 -0
- package/dist/render/capsule.js +1 -30
- package/dist/render/field.js +1 -40
- package/dist/render/names.js +1 -4
- package/dist/render/open.js +1 -61
- package/dist/render/page.js +1 -7
- package/dist/render/receipts.js +1 -47
- package/dist/render/shape.js +1 -74
- package/dist/render/target.js +4 -52
- package/dist/render/view.js +7 -197
- package/dist/vendor/50086958553b9376d600583f7dff354196bfeb41170fc6d1482ca7bea7c493e2.LICENSE +21 -0
- package/dist/vendor/b3e938d28f88a1851af303a40c749e12ebd5a686daac4f0b343b5cdd2e040419.LICENSE +21 -0
- package/dist/vendor/bundle.json +1 -0
- package/dist/vendor/library11.js +1 -0
- package/dist/vendor/object-provider.js +42 -0
- package/dist/vendor/runtime.js +38 -0
- package/dist/vendor/sources.json +1 -0
- package/dist/wasm/adapter.d.ts +1 -51
- package/dist/wasm/adapter.js +1 -180
- package/dist/wasm/node-worker.js +1 -13
- package/dist/wasm/object.js +1 -76
- package/dist/wasm/worker.js +1 -7
- package/docs/contracts/closure-delivery.md +1 -1
- package/docs/contracts/closure-delivery.publication.json +1 -1
- package/docs/contracts/conformance.json +142 -0
- package/docs/contracts/determinism.bound +9 -0
- package/docs/contracts/engine-object-projection.publication.json +1 -1
- package/docs/contracts/engine.md +21 -1
- package/docs/contracts/native-host.md +21 -0
- package/docs/contracts/native-host.publication.json +25 -0
- package/docs/contracts/native-publication.inventory.json +3 -1
- package/docs/contracts/optional-wasm-adapter.publication.json +1 -1
- package/docs/contracts/publication.inventory.json +29 -0
- package/docs/contracts/reading-identity.md +37 -0
- package/docs/contracts/reading-identity.publication.json +25 -0
- package/docs/contracts/refusals.bound +51 -0
- package/docs/contracts/refusals.md +18 -3
- package/docs/contracts/refusals.publication.json +2 -2
- package/docs/contracts/views.md +8 -0
- package/docs/guide.md +10 -0
- package/docs/reference.md +40 -0
- package/docs/why.md +109 -0
- package/package.json +37 -18
- package/receipts.bound +11675 -9725
- package/samples/native-host/no.json +10 -0
- package/samples/native-host/yes.json +20 -0
- package/samples/reading-identity/no.json +20 -0
- package/samples/reading-identity/yes.json +46 -0
- package/vectors/native/native-host.vector.json +62 -0
- package/vectors/native/reading-identity.vector.json +101 -0
- package/vectors/native/refusals.vector.json +104 -0
- package/vendor/syntax/LICENSE.md +7 -0
- package/vendor/syntax/parser.js +1 -0
- package/dist/engine/object.d.ts +0 -17
- package/dist/engine/ports.d.ts +0 -32
- package/dist/host/native/module-closure.d.ts +0 -35
- package/dist/host/reference-export.d.ts +0 -33
- package/dist/host/reference-native.d.ts +0 -30
- package/dist/host/reference-profile.d.ts +0 -23
- package/dist/host/refusals.d.ts +0 -14
package/dist/fold/opened.js
CHANGED
|
@@ -1,33 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { fieldOf } from "./claims.js";
|
|
3
|
-
import { viewsOf } from "./views.js";
|
|
4
|
-
const wild = (glob) => glob.split('/').every((step) => step === '' || step === '*' || step === '**');
|
|
5
|
-
const covers = (glob, scope, rel) => !wild(glob) && (matches(glob, rel) || matches(glob, scope));
|
|
6
|
-
/**
|
|
7
|
-
* What one landed line opens inside its place: a region whose reads cover the line's scope, a view whose shape covers
|
|
8
|
-
* it, and the scope's own tail. Every other region stays on its receipt at one step.
|
|
9
|
-
*/
|
|
10
|
-
export function openedBy(places, standing, lines) {
|
|
11
|
-
const known = new Set(places);
|
|
12
|
-
const reads = standing.filter((line) => fieldOf(line, 'scope').startsWith('region/') && fieldOf(line, 'measure') === 'reads' && fieldOf(line, 'value') !== 'withdraw');
|
|
13
|
-
const views = [...viewsOf(standing).values()];
|
|
14
|
-
const opened = new Set();
|
|
15
|
-
for (const line of lines) {
|
|
16
|
-
const scope = fieldOf(line, 'scope');
|
|
17
|
-
const [place = '', ...rest] = scope.split('/');
|
|
18
|
-
if (!known.has(place))
|
|
19
|
-
continue;
|
|
20
|
-
const rel = rest.join('/');
|
|
21
|
-
if (rel)
|
|
22
|
-
opened.add(`${place}/${rel}`);
|
|
23
|
-
for (const region of reads) {
|
|
24
|
-
const name = fieldOf(region, 'scope').slice('region/'.length);
|
|
25
|
-
if (covers(fieldOf(region, 'value'), scope, rel))
|
|
26
|
-
opened.add(`${place}/${name}`);
|
|
27
|
-
}
|
|
28
|
-
for (const view of views)
|
|
29
|
-
if (view.shape && covers(view.shape, scope, rel))
|
|
30
|
-
opened.add(`${place}/${view.name}`);
|
|
31
|
-
}
|
|
32
|
-
return [...opened].sort();
|
|
33
|
-
}
|
|
1
|
+
var $=Object.defineProperty;var a=(o,e)=>$(o,"name",{value:e,configurable:!0});import{library11_matches as d}from"../vendor/runtime.js";import{fieldOf as t}from"./claims.js";import{viewsOf as y}from"./views.js";const O=a(o=>o.split("/").every(e=>e===""||e==="*"||e==="**"),"wild"),m=a((o,e,f)=>!O(o)&&(d(o,f)||d(o,e)),"covers");function x(o,e,f){const l=new Set(o),w=e.filter(n=>t(n,"scope").startsWith("region/")&&t(n,"measure")==="reads"&&t(n,"value")!=="withdraw"),h=[...y(e).values()],r=new Set;for(const n of f){const p=t(n,"scope"),[c="",...v]=p.split("/");if(!l.has(c))continue;const i=v.join("/");i&&r.add(`${c}/${i}`);for(const s of w){const u=t(s,"scope").slice(7);m(t(s,"value"),p,i)&&r.add(`${c}/${u}`)}for(const s of h)s.shape&&m(s.shape,p,i)&&r.add(`${c}/${s.name}`)}return[...r].sort()}a(x,"openedBy");export{x as openedBy};
|
package/dist/fold/own.js
CHANGED
|
@@ -1,217 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { fieldOf, isWire } from "./claims.js";
|
|
5
|
-
import { wordsOf } from "./wire.js";
|
|
6
|
-
import { inheritedRoles, stepsOutside } from "./roles.js";
|
|
7
|
-
import { writerFor } from "./signers.js";
|
|
8
|
-
import { isCeiling } from "./configures.js";
|
|
9
|
-
import { keyOf } from "./keys.js";
|
|
10
|
-
import { VERB_NAMES } from "../cli/names.js";
|
|
11
|
-
import { actSeconds, idleCount, receiptsSeen } from "./closed.js";
|
|
12
|
-
import { foldsElsewhere } from "./kept.js";
|
|
13
|
-
import { ledgerLines } from "../land/ledger.js";
|
|
14
|
-
import { vouchedCoordinates } from "../land/vouched.js";
|
|
15
|
-
import { placedReadings, readerLines, readerModules } from "./observed.js";
|
|
16
|
-
import { storeDirs } from "../host/ports/store.js";
|
|
17
|
-
import { entriesIn, observeText } from "../observe/files.js";
|
|
18
|
-
import { placesOf, viewsOf } from "./views.js";
|
|
19
|
-
import { declaredBy } from "../observe/regions.js";
|
|
20
|
-
import { REGION_NAMES } from "../render/names.js";
|
|
21
|
-
import { ownLock, ownRoot } from "../observe/runner.js";
|
|
22
|
-
import { namingTheirPlace, zoomedOutsideThePlace } from "./zoom.js";
|
|
23
|
-
import { resetsOnEqualEmits, withoutVectors } from "../observe/identity.js";
|
|
24
|
-
import { instrumentCoordinates } from "./digests.js";
|
|
25
|
-
import { bugsWithoutANo } from "./nos.js";
|
|
26
|
-
import { writtenIn } from "./signed.js";
|
|
27
|
-
import { laidDiffers } from "./laid.js";
|
|
28
|
-
import { heldBytes } from "../land/held.js";
|
|
29
|
-
import { capsuleAt, placesIn, worldAt } from "./places.js";
|
|
30
|
-
/** Measurements of this invocation; never evidence of an earlier kept fold. */
|
|
31
|
-
export function currentActReadings(under) {
|
|
32
|
-
const receipts = receiptsSeen();
|
|
33
|
-
return placeOnly({ idle: idleCount(), s: actSeconds(), 'walk-read': receipts.count, 'walk-ms': receipts.ms,
|
|
34
|
-
'kept-folds-read-under-another-instrument': foldsElsewhere() }, under);
|
|
35
|
-
}
|
|
36
|
-
const entered = { foreign: 0 };
|
|
37
|
-
/** Host and instrument measurements. Domain contracts require their selected readers; missing readings are not fabricated zeroes. */
|
|
38
|
-
function shipped(root, store, standing, under) {
|
|
39
|
-
const shape = [...viewsOf(standing).values()].flatMap((view) => ('regions' in view && view.shape ? [view.shape] : []))
|
|
40
|
-
.find((coordinate) => coordinate.endsWith(EXTENSION));
|
|
41
|
-
if (shape === undefined)
|
|
42
|
-
return 0;
|
|
43
|
-
const outside = stepsOutside(store);
|
|
44
|
-
const places = under ? [under] : ['', ...entriesIn(resolve(root)).filter((entry) => entry.dir && !outside.has(entry.name)).map((entry) => `${entry.name}/`)];
|
|
45
|
-
const ships = () => wordsOf(standing, 'ships');
|
|
46
|
-
entered.foreign = 0;
|
|
47
|
-
return Math.max(0, ...places.map((place) => (ships().includes(shape) ? (observeText(resolve(root, place, shape)) ?? '').split('\n').filter(isWire).length : 0)));
|
|
48
|
-
}
|
|
49
|
-
function unrenderedIn(root, store, standing, observed) {
|
|
50
|
-
const views = [...viewsOf(standing).values()].flatMap((view) => ('regions' in view && view.shape ? [view] : []));
|
|
51
|
-
const own = new Set(REGION_NAMES);
|
|
52
|
-
const missing = new Set();
|
|
53
|
-
for (const place of ['', ...placesIn(root).map((one) => `${one}/`)]) {
|
|
54
|
-
const declared = declaredBy({ root, store, standing, observed, ...(place ? { under: place } : {}) });
|
|
55
|
-
const here = views.filter((view) => ((at) => (at.length ? at.includes(place) : observeText(resolve(root, place, view.shape)) !== undefined))(placesOf(standing, view)));
|
|
56
|
-
for (const region of here.flatMap((view) => view.regions))
|
|
57
|
-
if (!own.has(region.name) && !declared.some((glob) => matches(glob, region.name)))
|
|
58
|
-
missing.add(`${place}${region.name}`);
|
|
59
|
-
}
|
|
60
|
-
return missing.size;
|
|
61
|
-
}
|
|
62
|
-
function removedByHand(root, store, under) {
|
|
63
|
-
return [...vouchedCoordinates(store).keys()].filter((coordinate) => (!under || coordinate.startsWith(under)) && !existsSync(resolve(root, coordinate))).length;
|
|
64
|
-
}
|
|
65
|
-
function readersOverFirstRun(store) {
|
|
66
|
-
const runs = new Map();
|
|
67
|
-
for (const line of readerLines(store)) {
|
|
68
|
-
const scope = fieldOf(line, 'scope');
|
|
69
|
-
if (!scope.startsWith('cost/reader/') || !/^place:[0-9a-f]{64}$/.test(fieldOf(line, 'at')))
|
|
70
|
-
continue;
|
|
71
|
-
const key = `${scope} ${fieldOf(line, 'by')} ${fieldOf(line, 'at')}`;
|
|
72
|
-
runs.set(key, [...(runs.get(key) ?? []), Number(fieldOf(line, 'value').split('..')[0])]);
|
|
73
|
-
}
|
|
74
|
-
return [...runs.values()].filter((ms) => ms.length > 1 && ms[ms.length - 1] > ms[0]).length;
|
|
75
|
-
}
|
|
76
|
-
function attestBeat(store, standing) {
|
|
77
|
-
const head = keyOf(store, 'attest');
|
|
78
|
-
if (head === undefined)
|
|
79
|
-
return undefined;
|
|
80
|
-
return middleBeat(store, standing, `${head}/beat`, 'folded', head);
|
|
81
|
-
}
|
|
82
|
-
function twiceWritten(observed) {
|
|
83
|
-
const places = new Map();
|
|
84
|
-
for (const reading of placedReadings(observed)) {
|
|
85
|
-
if (!reading.question.startsWith('concept/'))
|
|
86
|
-
continue;
|
|
87
|
-
places.set(reading.question, (places.get(reading.question) ?? new Set()).add(reading.place));
|
|
88
|
-
}
|
|
89
|
-
return [...places.values()].filter((held) => held.size > 1).length;
|
|
90
|
-
}
|
|
91
|
-
function counted(store, standing, scope, at) {
|
|
92
|
-
const folder = writerFor(standing, 'fold');
|
|
93
|
-
if (folder === undefined)
|
|
94
|
-
return 0;
|
|
95
|
-
return ledgerLines(store, folder)
|
|
96
|
-
.filter((line) => fieldOf(line, 'scope') === scope && /place:(folded|kept)$/.test(fieldOf(line, 'at')))
|
|
97
|
-
.slice(-10)
|
|
98
|
-
.filter((line) => fieldOf(line, 'at') === `place:${at}`).length;
|
|
99
|
-
}
|
|
100
|
-
function middleBeat(store, standing, scope, at, signer) {
|
|
101
|
-
const folder = signer ?? writerFor(standing, 'fold');
|
|
102
|
-
if (folder === undefined)
|
|
103
|
-
return undefined;
|
|
104
|
-
const ms = ledgerLines(store, folder)
|
|
105
|
-
.filter((line) => fieldOf(line, 'scope') === scope && fieldOf(line, 'at') === `place:${at}`)
|
|
106
|
-
.map((line) => Number(fieldOf(line, 'value').split('..')[0]))
|
|
107
|
-
.filter((one) => Number.isFinite(one))
|
|
108
|
-
.slice(-10)
|
|
109
|
-
.sort((a, b) => a - b);
|
|
110
|
-
return ms[Math.floor(ms.length / 2)];
|
|
111
|
-
}
|
|
112
|
-
function alphabetsInCode(observed, standing, under) {
|
|
113
|
-
const signed = standing
|
|
114
|
-
.filter((line) => fieldOf(line, 'form') === 'alphabet')
|
|
115
|
-
.map((line) => fieldOf(line, 'value'))
|
|
116
|
-
.filter((value) => value !== 'withdraw' && !value.startsWith('not:'))
|
|
117
|
-
.map((value) => new Set(value.split('|').filter(Boolean)))
|
|
118
|
-
.filter((alphabet) => alphabet.size > 1);
|
|
119
|
-
const crossing = placedReadings(observed)
|
|
120
|
-
.filter((reading) => reading.question === 'alphabet' && reading.measure === 'id' && (!under || reading.place.startsWith(under)))
|
|
121
|
-
.filter((reading) => signed.some((alphabet) => reading.value.split('|').every((member) => alphabet.has(member))));
|
|
122
|
-
return new Set(crossing.map((reading) => `${reading.place} ${reading.value}`)).size;
|
|
123
|
-
}
|
|
124
|
-
const ceilingsNamed = (standing, name) => standing.filter((line) => isCeiling(line) && (fieldOf(line, 'measure') === name || fieldOf(line, 'scope').split('/').pop() === name));
|
|
125
|
-
const ownFrom = (line, name, value) => {
|
|
126
|
-
if (value === undefined)
|
|
127
|
-
return {};
|
|
128
|
-
const scope = fieldOf(line ?? '', 'scope');
|
|
129
|
-
return { [name]: value, ...(scope && scope !== name ? { [scope]: value } : {}) };
|
|
130
|
-
};
|
|
131
|
-
const exporting = (observed, under, names) => new Set(placedReadings(observed).filter((one) => one.place.startsWith(under) && names.some((name) => one.question === `export/${name}`)).map((one) => one.place)).size;
|
|
132
|
-
export const outsideTheirCapsule = (root, standing, lines) => {
|
|
133
|
-
const family = wordsOf(standing, 'families').find((one) => one === 'reader' || one === 'readers');
|
|
134
|
-
return lines.filter((line) => (family === undefined || fieldOf(line, 'scope').startsWith(`${family}/`))
|
|
135
|
-
&& fieldOf(line, 'measure') === 'reader' && fieldOf(line, 'value') !== 'withdraw'
|
|
136
|
-
&& ((head) => !fieldOf(line, 'value').includes('/') || (capsuleAt(root, head) && !worldAt(root, head)))(fieldOf(line, 'value').split('/')[0] ?? ''));
|
|
137
|
-
};
|
|
138
|
-
const TREE = new Set(['readers-over-their-first-run', 'stale-capsules', 'accept-line',
|
|
139
|
-
'regions-described', 'walks-prune-by-role',
|
|
140
|
-
'ledger-region-verdicts-served-from-a-kept-fold', 'kept-folds-read-under-another-instrument', 'accepts-that-refolded',
|
|
141
|
-
'readers-without-vectors', 'lines-that-name-their-place', 'memo-resets-on-unchanged-extension', 'status-for-no-effect', 'accept-ms',
|
|
142
|
-
'bodies-written-twice', 'world-lines-outside-their-capsule']);
|
|
143
|
-
const placeOnly = (readings, under) => Object.fromEntries(Object.entries(readings).flatMap(([measure, value]) => (value === undefined || (under && TREE.has(measure)) ? [] : [[measure, value]])));
|
|
144
|
-
/**
|
|
145
|
-
* What the instrument reads of itself rather than through a reader: how many programs its source opens, how many
|
|
146
|
-
* signed lines stand unadmitted, how many stores it keeps, which of the modules it runs are no source, how many samples
|
|
147
|
-
* nothing names, how many alphabets are spelled both in code and in the lock, and how many regions it writes that no
|
|
148
|
-
* line of the lock describes, how many bodies are written twice anywhere in the tree rather than once and used by
|
|
149
|
-
* digest, and whether the version a package carries is the one the lock names. Inside one package, only what lies
|
|
150
|
-
* there. A cost is read now and never read back from the fold it was taken with: a beat is a line of the ledger.
|
|
151
|
-
*/
|
|
152
|
-
export function costReadings(store, standing, under) {
|
|
153
|
-
return placeOnly({
|
|
154
|
-
'beat-kept': middleBeat(store, standing, `beat/${under ?? '.'}`, 'kept'),
|
|
155
|
-
'accept-line': middleBeat(store, standing, 'beat/accept', 'line'),
|
|
156
|
-
'accept-ms': middleBeat(store, standing, 'beat/accept', 'total'),
|
|
157
|
-
'accepts-that-refolded': counted(store, standing, 'beat/accept', 'folded'),
|
|
158
|
-
'test-kept': under ? middleBeat(store, standing, `beat/${under}`, 'kept') : undefined,
|
|
159
|
-
'programs-place': under ? middleBeat(store, standing, `beat/${under}`, 'command-kept') : undefined,
|
|
160
|
-
...(keyOf(store, 'attest') === undefined ? {} : { [`${keyOf(store, 'attest')}-ms`]: under ? undefined : attestBeat(store, standing) }),
|
|
161
|
-
}, under);
|
|
162
|
-
}
|
|
163
|
-
export function ownReadings(input) {
|
|
164
|
-
const { root, store, entry, roleOf, standing, observed, under } = input;
|
|
165
|
-
const spent = [];
|
|
166
|
-
const took = timing(spent);
|
|
167
|
-
const instrument = under === undefined || under === `${basename(ownRoot())}/`;
|
|
168
|
-
const tree = (fn) => (under ? undefined : fn());
|
|
169
|
-
const imported = tree(() => took('imports', () => [...instrumentCoordinates(store, resolve(root, entry), standing, root, ownLock()).keys()]
|
|
170
|
-
.filter((coordinate) => capsuleAt(root, relative(root, coordinate).split('/')[0] ?? '')).length));
|
|
171
|
-
const twice = tree(() => took('bodies', () => twiceWritten(observed)));
|
|
172
|
-
const local = {
|
|
173
|
-
'orphan-samples': input.orphans,
|
|
174
|
-
'removed-by-hand': took('removed', () => removedByHand(root, store, under)),
|
|
175
|
-
'readers-over-their-first-run': tree(() => took('readers', () => readersOverFirstRun(store))),
|
|
176
|
-
'alphabet-in-code': took('alphabets', () => alphabetsInCode(observed, standing, under)),
|
|
177
|
-
'stale-capsules': tree(() => took('capsules', () => inheritedRoles(store).stale.length)),
|
|
178
|
-
'beat-kept': middleBeat(store, standing, `beat/${under ?? '.'}`, 'kept'),
|
|
179
|
-
'accept-line': tree(() => middleBeat(store, standing, 'beat/accept', 'line')),
|
|
180
|
-
'accept-ms': tree(() => middleBeat(store, standing, 'beat/accept', 'total')),
|
|
181
|
-
'test-kept': under ? middleBeat(store, standing, `beat/${under}`, 'kept') : undefined,
|
|
182
|
-
'programs-place': under ? middleBeat(store, standing, `beat/${under}`, 'command-kept') : undefined,
|
|
183
|
-
'regions-described': tree(() => took('regions', () => unrenderedIn(root, store, standing, observed))),
|
|
184
|
-
'readers-without-vectors': tree(() => took('vectors', () => withoutVectors(root, readerModules(store), standing))),
|
|
185
|
-
'lines-that-name-their-place': tree(() => took('zoom', () => namingTheirPlace(root))),
|
|
186
|
-
...(instrument ? {
|
|
187
|
-
'bugs-without-a-no': took('nos', () => bugsWithoutANo(root, store, standing, basename(ownRoot()), 'bugs-without-a-no')),
|
|
188
|
-
'zoom-rewrites-outside-the-place': took('zoomed', () => zoomedOutsideThePlace(root, standing)),
|
|
189
|
-
'own-lines-written-in': took('applied', () => writtenIn(root, basename(ownRoot()))),
|
|
190
|
-
'laid-digest-differs': took('laid', () => laidDiffers(store, ownRoot(), ownLock(), writerFor(standing, 'fold'))),
|
|
191
|
-
} : {}),
|
|
192
|
-
'memo-resets-on-unchanged-extension': tree(() => took('resets', () => resetsOnEqualEmits(readerLines(store)))),
|
|
193
|
-
...ownFrom(ceilingsNamed(standing, 'capsules-imported').find((line) => fieldOf(line, 'form') === 'interval'), 'capsules-imported', imported),
|
|
194
|
-
...((n) => ({ bytes: n, 'store/bytes': n }))(took('store', () => heldBytes(root, store, standing))),
|
|
195
|
-
'walks-prune-by-role': entered.foreign,
|
|
196
|
-
...ownFrom(ceilingsNamed(standing, 'bodies-written-twice').find((line) => fieldOf(line, 'form') === 'interval'), 'bodies-written-twice', twice),
|
|
197
|
-
...Object.fromEntries(standing.filter((line) => isCeiling(line) && (fieldOf(line, 'measure') === 'render-modules' || fieldOf(line, 'scope').split('/').pop() === 'render-modules'))
|
|
198
|
-
.flatMap((line) => ((place) => place === undefined ? [] : [[fieldOf(line, 'scope'), tree(() => exporting(observed, `${place}/`, ['render']))]])(fieldOf(line, 'scope').split('/').find((step) => capsuleAt(root, step))))),
|
|
199
|
-
...Object.fromEntries(standing.filter((line) => isCeiling(line) && (fieldOf(line, 'measure') === 'reader-modules' || fieldOf(line, 'scope').split('/').pop() === 'reader-modules'))
|
|
200
|
-
.flatMap((line) => ((place) => place === undefined ? [] : [[fieldOf(line, 'scope'), tree(() => exporting(observed, `${place}/`, ['observe', 'run']))]])(fieldOf(line, 'scope').split('/').find((step) => capsuleAt(root, step))))),
|
|
201
|
-
...ownFrom(ceilingsNamed(standing, 'world-lines-outside-their-capsule').find((line) => fieldOf(line, 'form') === 'interval'), 'world-lines-outside-their-capsule', tree(() => outsideTheirCapsule(root, standing, standing).length)),
|
|
202
|
-
...currentActReadings(),
|
|
203
|
-
'cli-verbs': VERB_NAMES.length,
|
|
204
|
-
'accepts-that-refolded': tree(() => counted(store, standing, 'beat/accept', 'folded')),
|
|
205
|
-
...(keyOf(store, 'attest') === undefined ? {} : { [`${keyOf(store, 'attest')}-ms`]: tree(() => attestBeat(store, standing)) }),
|
|
206
|
-
ship: took('ship', () => shipped(root, store, standing, under)),
|
|
207
|
-
};
|
|
208
|
-
process.stderr.write(`OWN ${spent.join(' ms · ')} ms\n`);
|
|
209
|
-
if (under)
|
|
210
|
-
return placeOnly(local, under);
|
|
211
|
-
return {
|
|
212
|
-
...placeOnly(local),
|
|
213
|
-
unadmitted: input.unadmitted,
|
|
214
|
-
dirs: storeDirs(store),
|
|
215
|
-
'artifacts-in-loop': [entry, ...readerModules(store)].filter((coordinate) => roleOf(coordinate) !== 'source').length,
|
|
216
|
-
};
|
|
217
|
-
}
|
|
1
|
+
var D=Object.defineProperty;var l=(s,t)=>D(s,"name",{value:t,configurable:!0});import{timing as P}from"../host/timing.js";import{basename as y,existsSync as V,relative as X,resolve as w}from"../host/io.js";import{library11_EXTENSION as G,library11_matches as H}from"../vendor/runtime.js";import{fieldOf as n,isWire as J}from"./claims.js";import{wordsOf as x}from"./wire.js";import{inheritedRoles as K,stepsOutside as Q}from"./roles.js";import{writerFor as O}from"./signers.js";import{isCeiling as E}from"./configures.js";import{keyOf as g}from"./keys.js";import{VERB_NAMES as U}from"../cli/names.js";import{actSeconds as Y,idleCount as Z,receiptsSeen as ee}from"./closed.js";import{foldsElsewhere as te}from"./kept.js";import{ledgerLines as R}from"../land/ledger.js";import{vouchedCoordinates as re}from"../land/vouched.js";import{placedReadings as S,readerLines as z,readerModules as I}from"./observed.js";import{storeDirs as se}from"../host/ports/store.js";import{entriesIn as oe,observeText as B}from"../observe/files.js";import{placesOf as ie,viewsOf as T}from"./views.js";import{declaredBy as ne}from"../observe/regions.js";import{REGION_NAMES as ae}from"../render/names.js";import{ownLock as q,ownRoot as $}from"../observe/runner.js";import{namingTheirPlace as ce,zoomedOutsideThePlace as pe}from"./zoom.js";import{resetsOnEqualEmits as de,withoutVectors as le}from"../observe/identity.js";import{instrumentCoordinates as fe}from"./digests.js";import{bugsWithoutANo as me}from"./nos.js";import{writtenIn as ue}from"./signed.js";import{laidDiffers as he}from"./laid.js";import{heldBytes as be}from"../land/held.js";import{capsuleAt as v,placesIn as we,worldAt as ge}from"./places.js";function $e(s){const t=ee();return k({idle:Z(),s:Y(),"walk-read":t.count,"walk-ms":t.ms,"kept-folds-read-under-another-instrument":te()},s)}l($e,"currentActReadings");const A={foreign:0};function ve(s,t,e,i){const a=[...T(e).values()].flatMap(d=>"regions"in d&&d.shape?[d.shape]:[]).find(d=>d.endsWith(G));if(a===void 0)return 0;const r=Q(t),m=i?[i]:["",...oe(w(s)).filter(d=>d.dir&&!r.has(d.name)).map(d=>`${d.name}/`)],o=l(()=>x(e,"ships"),"ships");return A.foreign=0,Math.max(0,...m.map(d=>o().includes(a)?(B(w(s,d,a))??"").split(`
|
|
2
|
+
`).filter(J).length:0))}l(ve,"shipped");function ke(s,t,e,i){const a=[...T(e).values()].flatMap(o=>"regions"in o&&o.shape?[o]:[]),r=new Set(ae),m=new Set;for(const o of["",...we(s).map(d=>`${d}/`)]){const d=ne({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)(ie(e,b)));for(const b of f.flatMap(p=>p.regions))!r.has(b.name)&&!d.some(p=>H(p,b.name))&&m.add(`${o}${b.name}`)}return m.size}l(ke,"unrenderedIn");function ye(s,t,e){return[...re(t).keys()].filter(i=>(!e||i.startsWith(e))&&!V(w(s,i))).length}l(ye,"removedByHand");function Oe(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}l(Oe,"readersOverFirstRun");function C(s,t){const e=g(s,"attest");if(e!==void 0)return u(s,t,`${e}/beat`,"folded",e)}l(C,"attestBeat");function Ee(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}l(Ee,"twiceWritten");function j(s,t,e,i){const a=O(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}l(j,"counted");function u(s,t,e,i,a){const r=a??O(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,d)=>o-d);return m[Math.floor(m.length/2)]}l(u,"middleBeat");function Se(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}l(Se,"alphabetsInCode");const M=l((s,t)=>s.filter(e=>E(e)&&(n(e,"measure")===t||n(e,"scope").split("/").pop()===t)),"ceilingsNamed"),N=l((s,t,e)=>{if(e===void 0)return{};const i=n(s??"","scope");return{[t]:e,...i&&i!==t?{[i]:e}:{}}},"ownFrom"),F=l((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"),Me=l((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)&&!ge(s,r))(n(a,"value").split("/")[0]??""))},"outsideTheirCapsule"),Ne=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=l((s,t)=>Object.fromEntries(Object.entries(s).flatMap(([e,i])=>i===void 0||t&&Ne.has(e)?[]:[[e,i]])),"placeOnly");function ot(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)}l(ot,"costReadings");function it(s){const{root:t,store:e,entry:i,roleOf:a,standing:r,observed:m,under:o}=s,d=[],f=P(d),b=o===void 0||o===`${y($())}/`,p=l(c=>o?void 0:c(),"tree"),_=p(()=>f("imports",()=>[...fe(e,w(t,i),r,t,q()).keys()].filter(c=>v(t,X(t,c).split("/")[0]??"")).length)),L=p(()=>f("bodies",()=>Ee(m))),W={"orphan-samples":s.orphans,"removed-by-hand":f("removed",()=>ye(t,e,o)),"readers-over-their-first-run":p(()=>f("readers",()=>Oe(e))),"alphabet-in-code":f("alphabets",()=>Se(m,r,o)),"stale-capsules":p(()=>f("capsules",()=>K(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",()=>ke(t,e,r,m))),"readers-without-vectors":p(()=>f("vectors",()=>le(t,I(e),r))),"lines-that-name-their-place":p(()=>f("zoom",()=>ce(t))),...b?{"bugs-without-a-no":f("nos",()=>me(t,e,r,y($()),"bugs-without-a-no")),"zoom-rewrites-outside-the-place":f("zoomed",()=>pe(t,r)),"own-lines-written-in":f("applied",()=>ue(t,y($()))),"laid-digest-differs":f("laid",()=>he(e,$(),q(),O(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",()=>be(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(()=>Me(t,r,r).length)),...$e(),"cli-verbs":U.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",()=>ve(t,e,r,o))};return process.stderr.write(`OWN ${d.join(" ms \xB7 ")} ms
|
|
3
|
+
`),o?k(W,o):{...k(W),unadmitted:s.unadmitted,dirs:se(e),"artifacts-in-loop":[i,...I(e)].filter(c=>a(c)!=="source").length}}l(it,"ownReadings");export{ot as costReadings,$e as currentActReadings,Me as outsideTheirCapsule,it as ownReadings};
|
package/dist/fold/paid.js
CHANGED
|
@@ -1,92 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { alphabetForm } from '@lapxo/obligations/forms';
|
|
3
|
-
import { cell, mark, observe, state } from '@lapxo/obligations/views/field';
|
|
4
|
-
import { fieldOf } from "./claims.js";
|
|
5
|
-
import { boundOf, regionsNamed } from "./region.js";
|
|
6
|
-
import { wordFrom } from "./wire.js";
|
|
7
|
-
import { lockStanding } from "./keys.js";
|
|
8
|
-
import { ledgerLines, storeAt } from "../land/ledger.js";
|
|
9
|
-
import { observeText } from "../observe/files.js";
|
|
10
|
-
import { memoized } from "./digests.js";
|
|
11
|
-
/** Where a case lies: a demand is judged only over a cone that holds one, by a take or read from a landed cone alike. */
|
|
12
|
-
export const holdsCases = (location) => {
|
|
13
|
-
const steps = location.split('/');
|
|
14
|
-
return steps.includes('yes') || steps.includes('no');
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* A cone answers for a region it covers as much as for one it lies inside: the same region read at two resolutions
|
|
18
|
-
* (L09). A fact about a region a demand never asked about pays nothing, a demand every asked coordinate of which was
|
|
19
|
-
* judged is paid even when the take that judged it reached further, and an answer pays only what its take judged.
|
|
20
|
-
*/
|
|
21
|
-
function pays(demand, answer, views) {
|
|
22
|
-
if (answer.value !== (fieldOf(demand, 'value') || 'present'))
|
|
23
|
-
return false;
|
|
24
|
-
const needs = fieldOf(demand, 'needs').split('|').filter(Boolean);
|
|
25
|
-
if (answer.read && !fieldOf(demand, 'scope').startsWith(views) && !needs.some(holdsCases))
|
|
26
|
-
return false;
|
|
27
|
-
const asked = needs.map((need) => region(need));
|
|
28
|
-
if (answer.judged && !asked.every((where) => answer.judged?.some((judged) => within(where, region(judged)))))
|
|
29
|
-
return false;
|
|
30
|
-
const moved = answer.cone.split('|').filter(Boolean).map((coordinate) => point(coordinate));
|
|
31
|
-
if (!moved.length)
|
|
32
|
-
return true;
|
|
33
|
-
return answers(moved, asked) || (asked.length > 0 && asked.every((where) => moved.some((coordinate) => within(coordinate, where))));
|
|
34
|
-
}
|
|
35
|
-
function judgedBy(store, scope, at) {
|
|
36
|
-
if (!at.startsWith('receipt:sha256:'))
|
|
37
|
-
return undefined;
|
|
38
|
-
const held = memoized(store, `judged ${at}`, () => {
|
|
39
|
-
const text = observeText(storeAt(store, 'cas', 'envelopes', `${at.replace(/^receipt:sha256:/, '')}.json`));
|
|
40
|
-
const got = text === undefined ? {} : JSON.parse(text);
|
|
41
|
-
return JSON.stringify(Array.isArray(got.cone) ? [got.scope ?? '', ...got.cone] : []);
|
|
42
|
-
});
|
|
43
|
-
const [said, ...cone] = JSON.parse(held);
|
|
44
|
-
return said === scope ? cone : undefined;
|
|
45
|
-
}
|
|
46
|
-
export function paidOf(store, demands, observed, views) {
|
|
47
|
-
const wanted = new Set(demands.map((line) => fieldOf(line, 'scope')));
|
|
48
|
-
const seen = [...ledgerLines(store, 'judge'), ...observed].filter((line) => wanted.has(fieldOf(line, 'scope')));
|
|
49
|
-
const cones = new Map();
|
|
50
|
-
for (const line of seen)
|
|
51
|
-
if (fieldOf(line, 'measure') === 'cone')
|
|
52
|
-
cones.set(`${fieldOf(line, 'scope')} ${fieldOf(line, 'at')}`, fieldOf(line, 'value'));
|
|
53
|
-
const answered = new Map();
|
|
54
|
-
for (const line of seen) {
|
|
55
|
-
const scope = fieldOf(line, 'scope');
|
|
56
|
-
if (!scope || fieldOf(line, 'measure') === 'cone')
|
|
57
|
-
continue;
|
|
58
|
-
const judged = judgedBy(store, scope, fieldOf(line, 'at'));
|
|
59
|
-
(answered.get(scope) ?? answered.set(scope, []).get(scope)).push({
|
|
60
|
-
value: fieldOf(line, 'value'), cone: cones.get(`${scope} ${fieldOf(line, 'at')}`) ?? '', read: fieldOf(line, 'at').startsWith('cone:'), ...(judged ? { judged } : {}),
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
const paid = demands.filter((line) => (answered.get(fieldOf(line, 'scope')) ?? []).some((answer) => pays(line, answer, views)));
|
|
64
|
-
return { paid, missing: demands.filter((line) => !paid.includes(line)), answered: new Set(answered.keys()) };
|
|
65
|
-
}
|
|
66
|
-
const HELD = { tokens: ['absent', 'present'] };
|
|
67
|
-
const heldAs = (holds) => alphabetForm.parse(HELD, { want: [holds ? 'present' : 'absent'] });
|
|
68
|
-
/**
|
|
69
|
-
* The judge's verdict on each demand, as the object judges a cell: the demand is the floor its place requires, and the
|
|
70
|
-
* two heads are the origins that speak on it — the take, holding it or not where it answered or paid it, and the second
|
|
71
|
-
* head, holding what the take holds where it agrees, the other where the demand's region stands apart, and silent where
|
|
72
|
-
* its word is stale, grey or missing. Both holding it is FREE, one alone REQUIRED, their disagreeing CONFLICT, and
|
|
73
|
-
* neither admitting it FORBIDDEN.
|
|
74
|
-
*/
|
|
75
|
-
function verdictsOf(demands, paid, answered, second, standing) {
|
|
76
|
-
const named = regionsNamed(standing);
|
|
77
|
-
const apart = new Set((second.apart ?? []).map((one) => (one === '.' ? '' : one)));
|
|
78
|
-
const heard = second.verdict === 'agrees' || second.verdict === 'forks';
|
|
79
|
-
return Object.fromEntries(demands.map((line) => {
|
|
80
|
-
const scope = fieldOf(line, 'scope');
|
|
81
|
-
const holds = paid.includes(line);
|
|
82
|
-
const spoke = holds || answered.has(scope);
|
|
83
|
-
const differs = second.verdict === 'forks' && (second.apart === undefined || apart.has(boundOf(named, line).region));
|
|
84
|
-
let one = { ...cell(scope), marks: [mark({ pole: 'floor', reach: 'local', span: heldAs(true) })] };
|
|
85
|
-
if (spoke)
|
|
86
|
-
one = observe(one, { origin: 'take', span: heldAs(holds), id: 'take' });
|
|
87
|
-
if (spoke && heard)
|
|
88
|
-
one = observe(one, { origin: 'second', span: heldAs(differs ? !holds : holds), id: 'second' });
|
|
89
|
-
return [scope, state(alphabetForm.lattice(HELD), one)];
|
|
90
|
-
}));
|
|
91
|
-
}
|
|
92
|
-
export const verdictsFor = (fold) => verdictsOf(fold.demands, fold.paid, paidOf(fold.store, fold.demands, fold.observed, `${wordFrom(fold.standing, 'families', 'view', lockStanding(fold.store))}/`).answered, fold.second, fold.standing);
|
|
1
|
+
var _=Object.defineProperty;var f=(e,r)=>_(e,"name",{value:r,configurable:!0});import{library12_answers as j,library12_point as O,library12_region as h,library12_within as b}from"../vendor/runtime.js";import{library13_alphabetForm as v}from"../vendor/runtime.js";import{library14_cell as S,library14_mark as $,library14_observe as y,library14_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,70 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { fieldOf, fieldsOf } from "../fold/claims.js";
|
|
3
|
-
import { lockStanding } from "../fold/keys.js";
|
|
4
|
-
import { worldAt } from "../fold/places.js";
|
|
5
|
-
import { defaulted, placesOf, viewsOf } from "../fold/views.js";
|
|
6
|
-
import { zoomed } from "../fold/zoom.js";
|
|
7
|
-
import { ownLockOf } from "../fold/signed.js";
|
|
8
|
-
import { wordFrom, wireLine } from "../fold/wire.js";
|
|
9
|
-
import { sourced } from "../land/vouched.js";
|
|
10
|
-
import { nameOf } from "../render/page.js";
|
|
11
|
-
/** Ephemeral view input, never a signed source record or publication artifact. */
|
|
12
|
-
const unsigned = (line) => {
|
|
13
|
-
const fields = fieldsOf(line);
|
|
14
|
-
delete fields['sig'];
|
|
15
|
-
delete fields['epoch'];
|
|
16
|
-
return { ...fields, by: 'target' };
|
|
17
|
-
};
|
|
18
|
-
import { ownLock, ownStore } from "../observe/runner.js";
|
|
19
|
-
/**
|
|
20
|
-
* A place seen from inside it: the wire and the keys it is read with, the regions it is written in, and every line of
|
|
21
|
-
* the place — its manifest, its build, its pages, its prose, its own ceilings and every line a view of it reads. Nothing
|
|
22
|
-
* of the tree's history, and nothing the instrument keeps for itself, crosses; a need outside the place is left behind.
|
|
23
|
-
* A capsule renders a place from these lines, in the tree as in the place published alone, so both write one coordinate; the
|
|
24
|
-
* lock a place is rendered with is these lines as target lines its first land signs at epoch one, the bootstrap first.
|
|
25
|
-
* A view is the place's own: a line of it that names coordinates is taken when one of them is a coordinate of the place, and a
|
|
26
|
-
* line that names none where its view names this place or no place at all, or at a world that holds no line of a view
|
|
27
|
-
* the views/world list names. A line another published place leads is taken only by its needs.
|
|
28
|
-
*/
|
|
29
|
-
export function takenFor(held, under, world) {
|
|
30
|
-
const views = new Map([...viewsOf(held).values()].flatMap((view) => ('regions' in view ? [[view.name, view]] : [])));
|
|
31
|
-
const inside = (need) => need.startsWith(under);
|
|
32
|
-
const crosses = ownLock().filter((line) => fieldOf(line, 'scope') === 'publish/takes').flatMap((line) => fieldOf(line, 'value').split('|').filter(Boolean));
|
|
33
|
-
const kept = new Set([sourced(held), wordFrom(held, 'families', 'reader', lockStanding(ownStore())), 'publish']);
|
|
34
|
-
const places = new Set(held.map((line) => fieldOf(line, 'scope').split('/')).filter((steps) => steps.length === 3 && steps[0] === 'publish' && steps[2] === 'bootstrap').map((steps) => steps[1]));
|
|
35
|
-
return (line) => {
|
|
36
|
-
const scope = fieldOf(line, 'scope');
|
|
37
|
-
const needs = fieldOf(line, 'needs').split('|').filter(Boolean);
|
|
38
|
-
if (crosses.some((glob) => matches(glob, scope)))
|
|
39
|
-
return true;
|
|
40
|
-
if (scope.startsWith(under))
|
|
41
|
-
return true;
|
|
42
|
-
if (scope.startsWith('view/')) {
|
|
43
|
-
const view = views.get(scope.slice('view/'.length));
|
|
44
|
-
if (view === undefined || view.shape === '')
|
|
45
|
-
return false;
|
|
46
|
-
const listed = wireLine(held, 'views/world');
|
|
47
|
-
if ((listed === undefined ? [] : fieldOf(listed, 'value').split('|').filter(Boolean)).includes(view.name))
|
|
48
|
-
return world !== undefined && defaulted(held, view, world.own, world.tree);
|
|
49
|
-
return (world !== undefined && defaulted(held, view, world.own, world.tree)) || (needs.length ? needs.some(inside) : placesOf(held, view).includes(under) || !placesOf(held, view).length);
|
|
50
|
-
}
|
|
51
|
-
const first = scope.split('/')[0] ?? '';
|
|
52
|
-
if (kept.has(first))
|
|
53
|
-
return false;
|
|
54
|
-
return (!places.has(first) && scope.includes(`/${under}`)) || (needs.length > 0 && needs.every(inside));
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
export function placeLines(fold) {
|
|
58
|
-
const place = nameOf(fold);
|
|
59
|
-
const under = `${place}/`;
|
|
60
|
-
const held = fold.standing.filter((line) => fieldOf(line, 'value') !== 'withdraw');
|
|
61
|
-
const own = ownLockOf(fold.root, place);
|
|
62
|
-
const taken = takenFor(held, under, worldAt(fold.root, place) ? { own, tree: viewsOf(ownLockOf(fold.root, '')) } : undefined);
|
|
63
|
-
const rooted = (line) => canonical(unsigned(zoomed(line, place)));
|
|
64
|
-
const key = (line) => ['scope', 'role', 'measure'].map((field) => fieldOf(line, field)).join(' ');
|
|
65
|
-
const mine = own.filter((line) => !fieldOf(line, 'scope').startsWith('keys/')).map((line) => canonical(unsigned(line)));
|
|
66
|
-
const ruled = new Set(mine.map(key));
|
|
67
|
-
const merged = [...mine, ...held.filter(taken).map(rooted).filter((line) => !ruled.has(key(line)))];
|
|
68
|
-
const scopes = new Set(merged.map((line) => fieldOf(line, 'scope')));
|
|
69
|
-
return [...new Set(merged.filter((line) => !fieldOf(line, 'condition') || scopes.has(fieldOf(line, 'condition'))))];
|
|
70
|
-
}
|
|
1
|
+
var y=Object.defineProperty;var c=(o,n)=>y(o,"name",{value:n,configurable:!0});import{library11_canonical as h,library11_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,100 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { releasesOf } from "../host/release.js";
|
|
5
|
-
import { archiveCoordinate } from "../host/archive.js";
|
|
6
|
-
import { fieldOf } from "./claims.js";
|
|
7
|
-
import { isCeiling } from "./configures.js";
|
|
8
|
-
import { entriesIn, observeText } from "../observe/files.js";
|
|
9
|
-
import { ownLock } from "../observe/runner.js";
|
|
10
|
-
import { said } from "./wire.js";
|
|
11
|
-
import { ownLockOf } from "./signed.js";
|
|
12
|
-
/** A dependency's lock describes the dependency, never a child of its host.
|
|
13
|
-
* Retiring a mount does not turn its retained bytes into local declarations. */
|
|
14
|
-
export function mountedCoordinatesIn(root, history = lockLines(join(root, EXTENSION))) {
|
|
15
|
-
return releasesOf(history).flatMap(line => {
|
|
16
|
-
const needs = fieldOf(line, 'needs');
|
|
17
|
-
return needs ? [archiveCoordinate(needs)] : [];
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
export function localDirectoriesIn(root, history = lockLines(join(root, EXTENSION))) {
|
|
21
|
-
const mounts = new Set(mountedCoordinatesIn(root, history));
|
|
22
|
-
return entriesIn(root).filter(entry => entry.dir && !mounts.has(entry.name)).map(entry => entry.name).sort();
|
|
23
|
-
}
|
|
24
|
-
export function placesIn(root, history = lockLines(join(root, EXTENSION))) {
|
|
25
|
-
return localDirectoriesIn(root, history).filter(name => observeText(join(root, name, LOCK)) !== undefined);
|
|
26
|
-
}
|
|
27
|
-
/** A directory with no own lock is founded by the root: a line of its region family names the directory's coordinates, and a covered batch that names the place lands its first own lock. */
|
|
28
|
-
export const foundableIn = (root, standing, family, name) => !placesIn(root).includes(name)
|
|
29
|
-
&& (entriesIn(root).find((entry) => entry.name === name)?.dir ?? false)
|
|
30
|
-
&& standing.some((line) => fieldOf(line, 'scope') === `${family}/${name}` && fieldOf(line, 'measure') === 'coordinates' && fieldOf(line, 'value').split('|').includes(`${name}/**`));
|
|
31
|
-
export const capsuleAt = (root, name) => [LOCK, CAPSULE]
|
|
32
|
-
.some((lock) => (observeText(join(root, name, lock)) ?? '').split('\n').some((line) => fieldOf(line, 'scope').startsWith('capsule/')));
|
|
33
|
-
/** A world is a place whose own lock names capsule/key. A view named by wire/views/world resolves into these and no other place. */
|
|
34
|
-
export const worldAt = (root, name) => [LOCK, CAPSULE]
|
|
35
|
-
.some((lock) => (observeText(join(root, name, lock)) ?? '').split('\n').some((line) => fieldOf(line, 'scope') === 'capsule/key' && fieldOf(line, 'value') !== 'withdraw'));
|
|
36
|
-
export const worldsIn = (root) => placesIn(root).filter((name) => worldAt(root, name));
|
|
37
|
-
export function kindsOf(root, place) {
|
|
38
|
-
const lock = ownLockOf(root, place);
|
|
39
|
-
const kinds = [];
|
|
40
|
-
if (worldAt(root, place))
|
|
41
|
-
kinds.push('world');
|
|
42
|
-
const saidKind = lock.find((line) => fieldOf(line, 'scope') === 'place/kind' && fieldOf(line, 'value') !== 'withdraw');
|
|
43
|
-
if (saidKind !== undefined)
|
|
44
|
-
kinds.push(...fieldOf(saidKind, 'value').split('|').filter(Boolean));
|
|
45
|
-
return [...new Set(kinds)];
|
|
46
|
-
}
|
|
47
|
-
export function classDefaults(root) {
|
|
48
|
-
return placesIn(root).flatMap((place) => {
|
|
49
|
-
const lock = ownLockOf(root, place);
|
|
50
|
-
return lock.filter((line) => fieldOf(line, 'scope').startsWith('class/') && fieldOf(line, 'value') !== 'withdraw')
|
|
51
|
-
.flatMap((line) => {
|
|
52
|
-
const kind = fieldOf(line, 'scope').slice('class/'.length);
|
|
53
|
-
const named = new Set(fieldOf(line, 'value').split('|').filter(Boolean));
|
|
54
|
-
return lock.filter((one) => named.has(fieldOf(one, 'scope')) && isCeiling(one))
|
|
55
|
-
.map((audit) => ({ classes: kind === '' ? [] : [kind], line: audit }));
|
|
56
|
-
});
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
export const fromPlace = (place, places) => (path) => (path === './' ? `${place}/` : places.some((one) => path.startsWith(`${one}/`)) ? path : `${place}/${path}`);
|
|
60
|
-
/**
|
|
61
|
-
* What each place's own lock says for the tree, in the tree's names: the families bound's own lock lists, every need
|
|
62
|
-
* and every reader's module read from the place, and the scopes it lists under a place written with the place after
|
|
63
|
-
* the steps its glob names. A view the place writes and no need names is the place's own coordinate.
|
|
64
|
-
*/
|
|
65
|
-
const heard = new Map();
|
|
66
|
-
export function spoken(root) {
|
|
67
|
-
const places = placesIn(root);
|
|
68
|
-
const parts = [ownLock(), ...places.map((place) => ownLockOf(root, place))];
|
|
69
|
-
const last = heard.get(root);
|
|
70
|
-
if (last !== undefined && last.parts.length === parts.length && last.parts.every((part, i) => part === parts[i]))
|
|
71
|
-
return last.got;
|
|
72
|
-
const got = speakingOf(root, places);
|
|
73
|
-
heard.set(root, { parts, got });
|
|
74
|
-
return got;
|
|
75
|
-
}
|
|
76
|
-
function speakingOf(root, places) {
|
|
77
|
-
const speaks = said(ownLock(), 'place/speaks');
|
|
78
|
-
const under = said(ownLock(), 'place/speaks-under');
|
|
79
|
-
if (!speaks.length && !under.length)
|
|
80
|
-
return [];
|
|
81
|
-
return places.flatMap((place) => ownLockOf(root, place).flatMap((line) => {
|
|
82
|
-
const got = parse(line);
|
|
83
|
-
const scope = fieldOf(line, 'scope');
|
|
84
|
-
const steps = scope.split('/');
|
|
85
|
-
const cut = under.flatMap((glob) => steps.map((_, i) => i + 1).filter((i) => i < steps.length && matches(glob, steps.slice(0, i).join('/')))).sort((a, b) => a - b)[0];
|
|
86
|
-
if (got.kind !== 'fact' || (cut === undefined && !speaks.some((glob) => matches(glob, scope))))
|
|
87
|
-
return [];
|
|
88
|
-
const fields = { ...got.value.fields };
|
|
89
|
-
const path = fromPlace(place, places);
|
|
90
|
-
if (cut !== undefined && steps[cut] !== place)
|
|
91
|
-
fields['scope'] = [...steps.slice(0, cut), place, ...steps.slice(cut)].join('/');
|
|
92
|
-
if (fields['needs'])
|
|
93
|
-
fields['needs'] = fields['needs'].split('|').filter(Boolean).map(path).join('|');
|
|
94
|
-
else if (fields['shape'] && fields['role'] === 'demands')
|
|
95
|
-
fields['needs'] = path(fields['shape']);
|
|
96
|
-
if (fields['measure'] === 'reader' && fields['value'])
|
|
97
|
-
fields['value'] = path(fields['value']);
|
|
98
|
-
return [{ place, line: canonical(fields) }];
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
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{library11_CAPSULE as y,library11_canonical as j,library11_EXTENSION as v,library11_LOCK as g,library11_matches as C,library11_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
|
+
`).some(s=>o(s,"scope").startsWith("capsule/"))),"capsuleAt"),S=a((e,t)=>[g,y].some(n=>(O(f(e,t,n))??"").split(`
|
|
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/rank.js
CHANGED
|
@@ -1,9 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/** What rests on a signed line: the rank of a signature is the lines that would move with it and nothing else. */
|
|
3
|
-
export function rankLines(fold) {
|
|
4
|
-
const on = new Map();
|
|
5
|
-
for (const line of fold.standing)
|
|
6
|
-
for (const name of fieldOf(line, 'restsOn').split('|').filter(Boolean))
|
|
7
|
-
on.set(name, (on.get(name) ?? 0) + 1);
|
|
8
|
-
return [...on].sort((a, b) => b[1] - a[1]).map(([scope, n]) => `RANK ${scope} · ${n} lines rest on it`);
|
|
9
|
-
}
|
|
1
|
+
var s=Object.defineProperty;var r=(e,o)=>s(e,"name",{value:o,configurable:!0});import{fieldOf as i}from"./claims.js";function l(e){const o=new Map;for(const t of e.standing)for(const n of i(t,"restsOn").split("|").filter(Boolean))o.set(n,(o.get(n)??0)+1);return[...o].sort((t,n)=>n[1]-t[1]).map(([t,n])=>`RANK ${t} \xB7 ${n} lines rest on it`)}r(l,"rankLines");export{l as rankLines};
|