@lapxo/bound 0.2.4 → 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 +1 -1
- package/TARGET.bound +44 -39
- package/dist/cli/accept.js +72 -590
- 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 -282
- package/dist/cli/release-result.js +3 -80
- package/dist/cli/retained-judgment.js +1 -25
- package/dist/cli/standing-result.js +4 -19
- package/dist/cli/takes.js +10 -112
- package/dist/cli/verb.d.ts +1 -2
- package/dist/cli/verb.js +83 -684
- 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 -117
- 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 -132
- package/dist/fold/closed.js +24 -235
- 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 -35
- package/dist/host/archive.js +1 -152
- package/dist/host/call-context.js +1 -14
- package/dist/host/capsule-process.js +2 -62
- package/dist/host/capsule.js +9 -171
- package/dist/host/cell-receipts.js +12 -128
- package/dist/host/commit-result.js +1 -5
- package/dist/host/content-needed.js +1 -8
- package/dist/host/content-store.js +1 -31
- package/dist/host/contextual-place.js +2 -72
- package/dist/host/digest.js +2 -15
- package/dist/host/hash.js +1 -9
- package/dist/host/host-controls.js +1 -19
- package/dist/host/in-process-act.js +3 -84
- package/dist/host/in-process-context.js +3 -91
- package/dist/host/in-process-root.js +6 -84
- package/dist/host/in-process.js +4 -55
- package/dist/host/index.d.ts +1 -15
- package/dist/host/index.js +1 -7
- 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 -25
- package/dist/host/objects.js +1 -38
- package/dist/host/order.js +1 -2
- package/dist/host/place-act-transaction.js +4 -78
- 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 -183
- package/dist/host/ports/place-act.js +1 -134
- 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 -307
- package/dist/host/selected-capsules.js +1 -50
- package/dist/host/selected-topos.js +1 -80
- package/dist/host/signature-era.js +1 -12
- package/dist/host/signing.js +2 -48
- package/dist/host/source-content.js +2 -111
- package/dist/host/standing-carrier.js +1 -18
- package/dist/host/standing-projection.js +1 -50
- 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 -336
- 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 -41
- package/dist/observe/runner.js +4 -101
- 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-publication.inventory.json +2 -1
- package/docs/contracts/optional-wasm-adapter.publication.json +1 -1
- 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/reference.md +1 -0
- package/package.json +23 -34
- package/receipts.bound +11627 -10323
- package/samples/reading-identity/no.json +20 -0
- package/samples/reading-identity/yes.json +46 -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/.github/workflows/release.yml +0 -67
- package/.github/workflows/test.yml +0 -35
- package/dist/engine/object.d.ts +0 -17
- package/dist/engine/ports.d.ts +0 -37
- package/dist/fold/claims.d.ts +0 -29
- package/dist/host/call-context.d.ts +0 -20
- package/dist/host/commit-result.d.ts +0 -6
- package/dist/host/in-process-act.d.ts +0 -82
- package/dist/host/in-process-context.d.ts +0 -46
- package/dist/host/in-process-root.d.ts +0 -117
- package/dist/host/in-process.d.ts +0 -41
- package/dist/host/native/module-closure.d.ts +0 -35
- package/dist/host/native-receiver.d.ts +0 -19
- package/dist/host/place-act-transaction.d.ts +0 -24
- package/dist/host/place-clock-selection.d.ts +0 -55
- package/dist/host/ports/local-act.d.ts +0 -44
- package/dist/host/ports/place-act.d.ts +0 -49
- package/dist/host/ports/publication.d.ts +0 -10
- 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/host/root-clock-source.d.ts +0 -86
package/dist/cli/place.js
CHANGED
|
@@ -1,282 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { point, region, within } from '@lapxo/obligations/field';
|
|
8
|
-
import { basename, join } from 'node:path';
|
|
9
|
-
import { observeText } from "../observe/files.js";
|
|
10
|
-
import { placesOf, viewsOf } from "../fold/views.js";
|
|
11
|
-
import { prerender, viewOf } from "../render/view.js";
|
|
12
|
-
import { meets, instrumentKept } from "../fold/closed.js";
|
|
13
|
-
import { foldPoints, keepFold, keptPlace } from "../fold/kept.js";
|
|
14
|
-
import { openCells } from "../render/open.js";
|
|
15
|
-
import { boundOf, packRegions, regionsNamed, regionsOf, unlikeReplay } from "../fold/region.js";
|
|
16
|
-
import { answersElsewhere, foldCeilings, ceilingSummary } from "../fold/ceilings.js";
|
|
17
|
-
import { keyOf, keyFor, lockLines, lockStanding } from "../fold/keys.js";
|
|
18
|
-
import { wordFrom, wordOf, wordOn } from "../fold/wire.js";
|
|
19
|
-
import { bytesDigest, instrumentOf, signaturesOf } from "../fold/digests.js";
|
|
20
|
-
import { claimKey, fieldOf, fieldsOf, isWire } from "../fold/claims.js";
|
|
21
|
-
import { canonical, LOCK, parse } from '@lapxo/topos/wire';
|
|
22
|
-
import { classDefaults, kindsOf, placesIn, spoken } from "../fold/places.js";
|
|
23
|
-
import { isCeiling } from "../fold/configures.js";
|
|
24
|
-
import { observedClaims, placedReadings } from "../fold/observed.js";
|
|
25
|
-
import { capsuleReadingsOver, currentReceiptObservations, retiredReceiptHistory } from "../observe/regions.js";
|
|
26
|
-
import { costReadings, ownReadings, currentActReadings } from "../fold/own.js";
|
|
27
|
-
import { paidOf } from "../fold/paid.js";
|
|
28
|
-
import { rolesOf } from "../fold/roles.js";
|
|
29
|
-
import { secondHead } from "../fold/second.js";
|
|
30
|
-
import { authorityFor, rootSigner, writerFor } from "../fold/signers.js";
|
|
31
|
-
import { ledgerLines, storeOf } from "../land/ledger.js";
|
|
32
|
-
import { vouchedCoordinates } from "../land/vouched.js";
|
|
33
|
-
import { ownLock, ownRoot } from "../observe/runner.js";
|
|
34
|
-
import { epochOf, historyOf, renderedLock, standingDemands } from "./owner.js";
|
|
35
|
-
function beatsOf(store, standing, under) {
|
|
36
|
-
const folder = writerFor(standing, 'fold');
|
|
37
|
-
const middle = (at) => {
|
|
38
|
-
const ms = (folder === undefined ? [] : ledgerLines(store, folder))
|
|
39
|
-
.filter((line) => fieldOf(line, 'scope') === `beat/${under ?? '.'}` && fieldOf(line, 'at') === `place:${at}`)
|
|
40
|
-
.map((line) => Number(fieldOf(line, 'value').split('..')[0])).filter((one) => Number.isFinite(one)).slice(-10).sort((a, b) => a - b);
|
|
41
|
-
return ms.length ? ms[Math.floor(ms.length / 2)] ?? 0 : 0;
|
|
42
|
-
};
|
|
43
|
-
return { kept: middle('kept'), folded: middle('folded') };
|
|
44
|
-
}
|
|
45
|
-
const costsOf = (store) => ledgerLines(store, 'take').filter((line) => fieldOf(line, 'measure') === 'ms')
|
|
46
|
-
.map((line) => Number(fieldOf(line, 'value').split('..')[0])).filter((ms) => Number.isFinite(ms)).slice(-10);
|
|
47
|
-
function effectStates(_store) {
|
|
48
|
-
return 'none';
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* The fold of a place: the standing lock and what readers saw, narrowed to the place when one is named. A demand is the
|
|
52
|
-
* place's when every place it asks about lies there; a SHORT on a question also read outside it is not the place's to
|
|
53
|
-
* answer. The count of a place's own readings is the instrument's, taken inside the place alone. What each key has
|
|
54
|
-
* signed that stands is counted apart: the owner's lines stand in this fold, a second head's in its own ledger, and its
|
|
55
|
-
* word on a lock is asked once for the lines a batch and the ledger own together.
|
|
56
|
-
*/
|
|
57
|
-
const counted = new WeakMap();
|
|
58
|
-
const seconds = new WeakMap();
|
|
59
|
-
function secondOf(root, store, attested, owned) {
|
|
60
|
-
const held = seconds.get(owned);
|
|
61
|
-
if (held !== undefined)
|
|
62
|
-
return held;
|
|
63
|
-
const head = keyOf(store, 'attest');
|
|
64
|
-
const heard = head === undefined ? undefined : authorityFor([...owned, ...ledgerLines(store, head)], rootSigner(root), signaturesOf(store).admitted);
|
|
65
|
-
return seconds.set(owned, secondHead(store, attested, (line) => heard?.of(line).kind === 'admitted', owned)).get(owned);
|
|
66
|
-
}
|
|
67
|
-
function signedByKey(store, standing, observed) {
|
|
68
|
-
const signed = new Map();
|
|
69
|
-
const reader = (() => {
|
|
70
|
-
try {
|
|
71
|
-
return keyFor(store, 'read');
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
return undefined;
|
|
75
|
-
}
|
|
76
|
-
})();
|
|
77
|
-
for (const line of standing)
|
|
78
|
-
signed.set(fieldOf(line, 'by'), (signed.get(fieldOf(line, 'by')) ?? 0) + 1);
|
|
79
|
-
for (const line of standing) {
|
|
80
|
-
const key = /^keys\/([^/]+)$/.exec(fieldOf(line, 'scope'))?.[1];
|
|
81
|
-
const lines = key === undefined || signed.has(key) ? undefined : key === reader ? observed : ledgerLines(store, key);
|
|
82
|
-
if (key !== undefined && lines !== undefined)
|
|
83
|
-
signed.set(key, counted.get(lines) ?? counted.set(lines, new Set(lines.filter(line => fieldOf(line, 'sig') !== '')).size).get(lines));
|
|
84
|
-
}
|
|
85
|
-
return signed;
|
|
86
|
-
}
|
|
87
|
-
/** Generic view checks: declared output equality and one writer per coordinate. Domain measurements belong to selected providers. */
|
|
88
|
-
function viewReadings(place) {
|
|
89
|
-
const leaf = wordOn(place.standing, 'region-leaf', ownLock());
|
|
90
|
-
const at = (coordinate) => join(place.root, place.under ?? '', coordinate);
|
|
91
|
-
const every = [...viewsOf(place.standing).values()].flatMap((view) => ('regions' in view && view.shape ? [view] : []))
|
|
92
|
-
.filter((view) => observeText(at(view.shape)) !== undefined);
|
|
93
|
-
const named = (view) => placesOf(place.standing, view).includes(place.under ?? '');
|
|
94
|
-
const shaped = every.filter((view) => named(view) || (!placesOf(place.standing, view).length && !every.some((other) => other.shape === view.shape && named(other))));
|
|
95
|
-
prerender(place, shaped);
|
|
96
|
-
const same = new Set(shaped.filter((view) => observeText(at(view.shape)) === viewOf(place, view)).map((view) => view.name));
|
|
97
|
-
const differ = shaped.length - same.size;
|
|
98
|
-
const twice = [...every.filter((view) => named(view) || !placesOf(place.standing, view).length)
|
|
99
|
-
.reduce((by, view) => by.set(view.shape, (by.get(view.shape) ?? 0) + 1), new Map()).values()].filter((n) => n > 1).length;
|
|
100
|
-
return { readings: { [`rendered-${leaf}-differ`]: differ, 'rendered-coordinates-differ': differ, [`${leaf}-with-two-views`]: twice, 'coordinates-with-two-views': twice }, same, here: new Set(shaped.map(view => view.name)) };
|
|
101
|
-
}
|
|
102
|
-
const NONE = [];
|
|
103
|
-
const ownings = new WeakMap();
|
|
104
|
-
const ownedOf = (store, told) => ((lock) => ((byLock) => byLock.get(told) ?? byLock.set(told, [...lock, ...told]).get(told))(ownings.get(lock) ?? ownings.set(lock, new WeakMap()).get(lock)))(lockLines(store));
|
|
105
|
-
export function standingOf(root, under, told = NONE) {
|
|
106
|
-
const store = storeOf(root);
|
|
107
|
-
const owned = ownedOf(store, told);
|
|
108
|
-
const rendered = renderedLock(root, store, told);
|
|
109
|
-
const lock = rendered.text.split('\n').filter(isWire);
|
|
110
|
-
const said = spoken(root);
|
|
111
|
-
if (!said.length)
|
|
112
|
-
return { standing: lock, lock, rendered, owned };
|
|
113
|
-
const views = `${wordOf(lock, 'families', 'view')}/`;
|
|
114
|
-
const isView = (line) => fieldOf(line, 'scope').startsWith(views);
|
|
115
|
-
const ruled = new Set(said.filter((one) => !isView(one.line)).map((one) => claimKey(one.line)));
|
|
116
|
-
const owners = new Map();
|
|
117
|
-
for (const one of said.filter((o) => isView(o.line)))
|
|
118
|
-
owners.set(fieldOf(one.line, 'scope'), (owners.get(fieldOf(one.line, 'scope')) ?? new Set()).add(`${one.place}/`));
|
|
119
|
-
const tree = lock.flatMap((line) => {
|
|
120
|
-
const by = isView(line) ? owners.get(fieldOf(line, 'scope')) : undefined;
|
|
121
|
-
if (by === undefined)
|
|
122
|
-
return ruled.has(claimKey(line)) ? [] : [line];
|
|
123
|
-
const needs = fieldOf(line, 'needs').split('|').filter(Boolean);
|
|
124
|
-
const left = needs.filter((need) => ![...by].some((place) => need.startsWith(place)));
|
|
125
|
-
if (!needs.length || left.length === needs.length)
|
|
126
|
-
return [line];
|
|
127
|
-
const got = parse(line);
|
|
128
|
-
return left.length && got.kind === 'fact' ? [canonical({ ...got.value.fields, needs: left.join('|') })] : [];
|
|
129
|
-
});
|
|
130
|
-
const here = under?.replace(/\/$/, '');
|
|
131
|
-
const first = said.filter((one) => one.place === here).map((one) => one.line);
|
|
132
|
-
const rest = said.filter((one) => one.place !== here).map((one) => one.line);
|
|
133
|
-
const standing = [...new Set([...first, ...tree, ...rest])];
|
|
134
|
-
return { standing: [...standing, ...inheritedOf(root, standing)], lock, rendered, owned };
|
|
135
|
-
}
|
|
136
|
-
function inheritedOf(root, standing) {
|
|
137
|
-
const defaults = classDefaults(root);
|
|
138
|
-
if (!defaults.length)
|
|
139
|
-
return [];
|
|
140
|
-
const held = standing.filter(isCeiling);
|
|
141
|
-
const extra = [];
|
|
142
|
-
for (const place of placesIn(root)) {
|
|
143
|
-
const kinds = kindsOf(root, place);
|
|
144
|
-
const prefix = `${place}/`;
|
|
145
|
-
const measures = new Set(held.filter((line) => fieldOf(line, 'scope').startsWith(prefix)).map((line) => fieldOf(line, 'measure')));
|
|
146
|
-
for (const def of defaults) {
|
|
147
|
-
if (!def.classes.includes('*') && !def.classes.some((kind) => kinds.includes(kind)))
|
|
148
|
-
continue;
|
|
149
|
-
const measure = fieldOf(def.line, 'measure');
|
|
150
|
-
if (measures.has(measure))
|
|
151
|
-
continue;
|
|
152
|
-
const got = parse(def.line);
|
|
153
|
-
if (got.kind !== 'fact')
|
|
154
|
-
continue;
|
|
155
|
-
extra.push(canonical({ ...got.value.fields, scope: `${prefix}${fieldOf(def.line, 'scope')}` }));
|
|
156
|
-
measures.add(measure);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
return extra;
|
|
160
|
-
}
|
|
161
|
-
export function coneOf(root, entry, ceilings, descent) {
|
|
162
|
-
const store = storeOf(root);
|
|
163
|
-
const { standing, rendered } = standingOf(root);
|
|
164
|
-
// Admission consumes the verified completed fold; it does not ask providers again.
|
|
165
|
-
// Receipt bytes, reader history and instrument identity must all still agree.
|
|
166
|
-
if (meets(root, store, '') && instrumentKept(store) === instrumentOf(store, entry, standing, root, ownLock())) {
|
|
167
|
-
const held = keptPlace(store);
|
|
168
|
-
if (held !== undefined)
|
|
169
|
-
return { standing, observed: held.observed, own: { ...held.own, ...currentActReadings() }, kept: true };
|
|
170
|
-
}
|
|
171
|
-
const named = regionsNamed(standing);
|
|
172
|
-
const reach = descent !== undefined && descent.length ? [...descent] : [...new Set(ceilings.map((line) => boundOf(named, line).region))];
|
|
173
|
-
const read = observedClaims(root, store, { wait: false, ...(reach.includes('') ? {} : { reach }) });
|
|
174
|
-
const current = currentReceiptObservations({ root, store, standing, observed: read });
|
|
175
|
-
const observed = [...current, ...capsuleReadingsOver({ root, store, standing, observed: read })];
|
|
176
|
-
const own = {
|
|
177
|
-
...ownReadings({ root, store, entry, roleOf: rolesOf(store), standing, observed, unadmitted: rendered.grey.length + rendered.refused.length, orphans: 0 }),
|
|
178
|
-
...costReadings(store, standing),
|
|
179
|
-
};
|
|
180
|
-
const measured = new Set([...Object.keys(own), ...placedReadings(observed).map((reading) => reading.measure), wordOf(standing, 'states', 'unread')]);
|
|
181
|
-
const reached = ceilings.every((line) => measured.has(fieldOf(line, 'measure')) || fieldOf(line, 'scope') in own);
|
|
182
|
-
if (reached)
|
|
183
|
-
return { standing, observed, own, kept: true };
|
|
184
|
-
const whole = foldPlace(root, entry);
|
|
185
|
-
return { ...whole, kept: whole.kept ?? false };
|
|
186
|
-
}
|
|
187
|
-
export const ownCeilings = (under) => ((home) => (under === undefined || under === `${home}/`
|
|
188
|
-
? ownLock().filter(isCeiling).map((line) => canonical({ ...fieldsOf(line), scope: `${home}/${fieldOf(line, 'scope')}` })) : []))(basename(ownRoot()));
|
|
189
|
-
export function foldPlace(root, entry, under, look = true, given) {
|
|
190
|
-
const store = storeOf(root);
|
|
191
|
-
const digestAt = Date.now();
|
|
192
|
-
const closed = meets(root, store, under ?? '');
|
|
193
|
-
const digestMs = Date.now() - digestAt;
|
|
194
|
-
if (closed && given?.free !== true) {
|
|
195
|
-
const prior = keptPlace(store, under, instrumentOf(store, entry, standingOf(root).standing, root, ownLock()));
|
|
196
|
-
if (prior !== undefined) {
|
|
197
|
-
hostOutput('error', `CLOSED ${under || '.'} · digest ${digestMs} ms\n`);
|
|
198
|
-
return refreshRetainedJudgment(prior, [...prior.standing.filter((line) => isCeiling(line) && !(under && fieldOf(line, 'measure') === 'unread')), ...ownCeilings(under)]);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
const { standing, lock: attested, rendered, owned } = given?.standing ?? standingOf(root, under);
|
|
202
|
-
const folder = writerFor(standing, 'fold');
|
|
203
|
-
const answered = given === undefined && under ? new Map() : undefined;
|
|
204
|
-
const reached = given?.observed ?? observedClaims(root, store, { wait: look, ...(under ? { reach: [under], answered } : {}) });
|
|
205
|
-
const self = instrumentOf(store, entry, standing, root, ownLock());
|
|
206
|
-
const inside = (place) => !under || within(point(place.replace(/\/\*$/, '')), region(under));
|
|
207
|
-
const history = historyOf(root, store, standingDemands(store));
|
|
208
|
-
const theirs = history.live.filter((line) => ((needs) => !under || (needs.length > 0 && needs.every(inside)))(fieldOf(line, 'needs').split('|').filter(Boolean)));
|
|
209
|
-
const reads = under && under !== `${basename(ownRoot())}/` ? { owned, place: under, scopes: new Set(theirs.map((line) => fieldOf(line, 'scope'))) } : undefined;
|
|
210
|
-
const spent = [];
|
|
211
|
-
const took = timing(spent);
|
|
212
|
-
const read = given?.observed ?? (under ? took('observe', () => observedClaims(root, store, { wait: look })) : reached);
|
|
213
|
-
const current = currentReceiptObservations({ root, store, ...(under ? { under } : {}), standing, observed: read });
|
|
214
|
-
const everywhere = [...current, ...took('capsules', () => capsuleReadingsOver({ root, store, ...(under ? { under } : {}), standing, observed: read }))];
|
|
215
|
-
const points = foldPoints(store, standing, under, folder, self, reached, root, answered, reads);
|
|
216
|
-
const taken = bytesDigest(store, new TextEncoder().encode(points.join('\n'))).replace(/^sha256:/, '');
|
|
217
|
-
const observed = everywhere.filter((line) => !/ measure=observed /.test(line) || inside(fieldOf(line, 'scope')));
|
|
218
|
-
const shared = new Set(under ? placedReadings(everywhere).filter((r) => !inside(r.place)).map((r) => r.question) : []);
|
|
219
|
-
const live = history;
|
|
220
|
-
const demands = theirs;
|
|
221
|
-
const orphans = [];
|
|
222
|
-
const ceilings = [...standing.filter((line) => isCeiling(line) && !(under && fieldOf(line, 'measure') === 'unread')), ...ownCeilings(under)];
|
|
223
|
-
const own = took('own', () => ownReadings({
|
|
224
|
-
root, store, entry, roleOf: rolesOf(store), standing, observed: everywhere,
|
|
225
|
-
unadmitted: rendered.grey.length + rendered.refused.length, orphans: orphans.length, ...(under ? { under } : {}),
|
|
226
|
-
}));
|
|
227
|
-
const regions = took('regions', () => regionsOf(standing, ceilings.filter((line) => !answersElsewhere(line, own, under, new Set(placesIn(root)))), placedReadings(observed)));
|
|
228
|
-
const fold = (docs) => foldCeilings({ standing, ceilings, observed, own: { ...own, ...docs }, epoch: epochOf(owned), ...(under ? { under, places: new Set(placesIn(root)) } : {}) });
|
|
229
|
-
const folded = took('ceilings', () => fold({}));
|
|
230
|
-
const { paid, missing } = took('paid', () => paidOf(store, demands, observed, `${wordFrom(standing, 'families', 'view', lockStanding(store))}/`));
|
|
231
|
-
const lock = (observeText(join(root, under ?? '', LOCK)) ?? '').split('\n').filter(isWire).length;
|
|
232
|
-
const second = secondOf(root, store, attested, owned);
|
|
233
|
-
const policyStanding = standing.filter((line) => !rendered.grey.includes(line) && !rendered.refused.includes(line));
|
|
234
|
-
const faults = releaseFaults({ forks: rendered.forks, refused: rendered.refused, grey: rendered.grey, orphans, second });
|
|
235
|
-
const place = {
|
|
236
|
-
release: releasePolicy({ standing: policyStanding, demands, paid, ceilings, readings: folded, faults, verdicts: attestationObservations(policyStanding.map(line => { const r = parseEvidenceFields(line); return r.kind === 'fact' ? r.value.fields : {}; }), second), snapshot: { fold: taken, instrument: self } }),
|
|
237
|
-
root, store, ...(under ? { under } : {}), epoch: epochOf(owned), standing, claims: rendered.standing,
|
|
238
|
-
forks: rendered.forks, grey: rendered.grey, refused: rendered.refused, vacuous: rendered.vacuous.length,
|
|
239
|
-
demands, paid, missing,
|
|
240
|
-
history: live.history.filter((line) => fieldOf(line, 'needs').split('|').filter(Boolean).some(inside)),
|
|
241
|
-
observed,
|
|
242
|
-
receiptHistory: retiredReceiptHistory({ root, store, ...(under ? { under } : {}), standing, observed: read }),
|
|
243
|
-
ceilings: ceilingSummary(folded, ceilings.length, shared),
|
|
244
|
-
orphans,
|
|
245
|
-
lock,
|
|
246
|
-
signed: signedByKey(store, standing, everywhere),
|
|
247
|
-
second,
|
|
248
|
-
effects: effectStates(store),
|
|
249
|
-
key: taken,
|
|
250
|
-
instrument: self,
|
|
251
|
-
own,
|
|
252
|
-
open: openCells({ store, standing, observed, grey: rendered.grey, epoch: epochOf(owned) }),
|
|
253
|
-
regions: packRegions(regions),
|
|
254
|
-
beats: beatsOf(store, standing, under),
|
|
255
|
-
landed: [...vouchedCoordinates(store).keys()].filter((coordinate) => !under || coordinate.startsWith(under)).length,
|
|
256
|
-
costs: costsOf(store),
|
|
257
|
-
};
|
|
258
|
-
const { readings: found, same, here } = took('docs', () => viewReadings(place));
|
|
259
|
-
const family = `${wordFrom(standing, 'families', 'view', lockStanding(store))}/`;
|
|
260
|
-
const coordinates = new Set([...here].map((name) => `${family}${name}`));
|
|
261
|
-
const writes = (line) => coordinates.has(fieldOf(line, 'scope'));
|
|
262
|
-
const holds = (line) => same.has(fieldOf(line, 'scope').slice(family.length));
|
|
263
|
-
const owed = [...place.missing.filter((line) => !writes(line) || !holds(line)), ...place.paid.filter((line) => writes(line) && !holds(line))];
|
|
264
|
-
const docs = {
|
|
265
|
-
...found, 'payments-lost-on-equal-output': owed.filter((line) => writes(line) && holds(line)).length,
|
|
266
|
-
'poles-unlike-replay': unlikeReplay(regions, new Set(folded.over.map((one) => one.ceiling)), { ...own, unread: folded.unread.length + folded.vacuous.length }),
|
|
267
|
-
};
|
|
268
|
-
const again = took('ceilings', () => fold(docs));
|
|
269
|
-
const finalPaid = [...place.paid.filter((line) => !writes(line) || holds(line)), ...place.missing.filter((line) => writes(line) && holds(line))];
|
|
270
|
-
const whole = {
|
|
271
|
-
...place,
|
|
272
|
-
paid: finalPaid,
|
|
273
|
-
release: releasePolicy({ standing: policyStanding, demands, paid: finalPaid, ceilings, readings: again, faults, verdicts: attestationObservations(policyStanding.map(line => { const r = parseEvidenceFields(line); return r.kind === 'fact' ? r.value.fields : {}; }), second), snapshot: { fold: taken, instrument: self } }),
|
|
274
|
-
missing: owed,
|
|
275
|
-
own: { ...place.own, ...docs },
|
|
276
|
-
ceilings: ceilingSummary(again, ceilings.length, shared),
|
|
277
|
-
};
|
|
278
|
-
if (folder !== undefined && meets(root, store, under ?? '', true, whole.observed))
|
|
279
|
-
took('keep', () => keepFold(store, taken, whole, points, self));
|
|
280
|
-
hostOutput('error', `SPENT fold ${spent.join(' ms · ')} ms\n`);
|
|
281
|
-
return whole;
|
|
282
|
-
}
|
|
1
|
+
var Ae=Object.defineProperty;var m=(e,o)=>Ae(e,"name",{value:o,configurable:!0});import{hostOutput as me}from"../host/call-context.js";import{refreshRetainedJudgment as Ie}from"./retained-judgment.js";import{timing as Je}from"../host/timing.js";import{attestationObservations as ge}from"../fold/evidence.js";import{library11_parse as ue}from"../vendor/runtime.js";import{releasePolicy as he,releaseFaults as Ve}from"../fold/release-policy.js";import{library12_point as Ge,library12_region as Qe,library12_within as Ue}from"../vendor/runtime.js";import{basename as we,join as ye}from"node:path";import{observeText as I}from"../observe/files.js";import{placesOf as J,viewsOf as Xe}from"../fold/views.js";import{prerender as Ye,viewOf as Ze}from"../render/view.js";import{meets as V,instrumentKept as es}from"../fold/closed.js";import{foldPoints as ss,keepFold as ts,keptPlace as ke}from"../fold/kept.js";import{openCells as ns}from"../render/open.js";import{boundOf as is,packRegions as os,regionsNamed as rs,regionsOf as as,unlikeReplay as cs}from"../fold/region.js";import{answersElsewhere as fs,foldCeilings as ds,ceilingSummary as ve}from"../fold/ceilings.js";import{keyOf as ls,keyFor as ps,lockLines as ms,lockStanding as be}from"../fold/keys.js";import{wordFrom as Oe,wordOf as $e,wordOn as gs}from"../fold/wire.js";import{bytesDigest as us,instrumentOf as G,signaturesOf as hs}from"../fold/digests.js";import{claimKey as Se,fieldOf as d,fieldsOf as ws,isWire as Me}from"../fold/claims.js";import{library11_canonical as Q,library11_LOCK as ys,library11_parse as Re}from"../vendor/runtime.js";import{classDefaults as ks,kindsOf as vs,placesIn as U,spoken as bs}from"../fold/places.js";import{isCeiling as T}from"../fold/configures.js";import{observedClaims as X,placedReadings as Y}from"../fold/observed.js";import{capsuleReadingsOver as xe,currentReceiptObservations as Ce,retiredReceiptHistory as Os}from"../observe/regions.js";import{costReadings as $s,ownReadings as Fe,currentActReadings as Ss}from"../fold/own.js";import{paidOf as Ms}from"../fold/paid.js";import{rolesOf as We}from"../fold/roles.js";import{secondHead as Rs}from"../fold/second.js";import{authorityFor as xs,rootSigner as Cs,writerFor as Ne}from"../fold/signers.js";import{ledgerLines as q,storeOf as Z}from"../land/ledger.js";import{vouchedCoordinates as Fs}from"../land/vouched.js";import{ownLock as E,ownRoot as _e}from"../observe/runner.js";import{epochOf as ee,historyOf as Ws,renderedLock as Ns,standingDemands as _s}from"./owner.js";function Ds(e,o,s){const a=Ne(o,"fold"),r=m(n=>{const l=(a===void 0?[]:q(e,a)).filter(c=>d(c,"scope")===`beat/${s??"."}`&&d(c,"at")===`place:${n}`).map(c=>Number(d(c,"value").split("..")[0])).filter(c=>Number.isFinite(c)).slice(-10).sort((c,u)=>c-u);return l.length?l[Math.floor(l.length/2)]??0:0},"middle");return{kept:r("kept"),folded:r("folded")}}m(Ds,"beatsOf");const Es=m(e=>q(e,"take").filter(o=>d(o,"measure")==="ms").map(o=>Number(d(o,"value").split("..")[0])).filter(o=>Number.isFinite(o)).slice(-10),"costsOf");function Ls(e){return"none"}m(Ls,"effectStates");const De=new WeakMap,Ee=new WeakMap;function Ps(e,o,s,a){const r=Ee.get(a);if(r!==void 0)return r;const n=ls(o,"attest"),l=n===void 0?void 0:xs([...a,...q(o,n)],Cs(e),hs(o).admitted);return Ee.set(a,Rs(o,s,c=>l?.of(c).kind==="admitted",a)).get(a)}m(Ps,"secondOf");function js(e,o,s){const a=new Map,r=(()=>{try{return ps(e,"read")}catch{return}})();for(const n of o)a.set(d(n,"by"),(a.get(d(n,"by"))??0)+1);for(const n of o){const l=/^keys\/([^/]+)$/.exec(d(n,"scope"))?.[1],c=l===void 0||a.has(l)?void 0:l===r?s:q(e,l);l!==void 0&&c!==void 0&&a.set(l,De.get(c)??De.set(c,new Set(c.filter(u=>d(u,"sig")!=="")).size).get(c))}return a}m(js,"signedByKey");function Ks(e){const o=gs(e.standing,"region-leaf",E()),s=m(t=>ye(e.root,e.under??"",t),"at"),a=[...Xe(e.standing).values()].flatMap(t=>"regions"in t&&t.shape?[t]:[]).filter(t=>I(s(t.shape))!==void 0),r=m(t=>J(e.standing,t).includes(e.under??""),"named"),n=a.filter(t=>r(t)||!J(e.standing,t).length&&!a.some(h=>h.shape===t.shape&&r(h)));Ye(e,n);const l=new Set(n.filter(t=>I(s(t.shape))===Ze(e,t)).map(t=>t.name)),c=n.length-l.size,u=[...a.filter(t=>r(t)||!J(e.standing,t).length).reduce((t,h)=>t.set(h.shape,(t.get(h.shape)??0)+1),new Map).values()].filter(t=>t>1).length;return{readings:{[`rendered-${o}-differ`]:c,"rendered-coordinates-differ":c,[`${o}-with-two-views`]:u,"coordinates-with-two-views":u},same:l,here:new Set(n.map(t=>t.name))}}m(Ks,"viewReadings");const Bs=[],Le=new WeakMap,Hs=m((e,o)=>(s=>(a=>a.get(o)??a.set(o,[...s,...o]).get(o))(Le.get(s)??Le.set(s,new WeakMap).get(s)))(ms(e)),"ownedOf");function se(e,o,s=Bs){const a=Z(e),r=Hs(a,s),n=Ns(e,a,s),l=n.text.split(`
|
|
2
|
+
`).filter(Me),c=bs(e);if(!c.length)return{standing:l,lock:l,rendered:n,owned:r};const u=`${$e(l,"families","view")}/`,t=m(f=>d(f,"scope").startsWith(u),"isView"),h=new Set(c.filter(f=>!t(f.line)).map(f=>Se(f.line))),p=new Map;for(const f of c.filter(O=>t(O.line)))p.set(d(f.line,"scope"),(p.get(d(f.line,"scope"))??new Set).add(`${f.place}/`));const w=l.flatMap(f=>{const O=t(f)?p.get(d(f,"scope")):void 0;if(O===void 0)return h.has(Se(f))?[]:[f];const S=d(f,"needs").split("|").filter(Boolean),x=S.filter(y=>![...O].some(F=>y.startsWith(F)));if(!S.length||x.length===S.length)return[f];const C=Re(f);return x.length&&C.kind==="fact"?[Q({...C.value.fields,needs:x.join("|")})]:[]}),v=o?.replace(/\/$/,""),R=c.filter(f=>f.place===v).map(f=>f.line),b=c.filter(f=>f.place!==v).map(f=>f.line),g=[...new Set([...R,...w,...b])];return{standing:[...g,...Ts(e,g)],lock:l,rendered:n,owned:r}}m(se,"standingOf");function Ts(e,o){const s=ks(e);if(!s.length)return[];const a=o.filter(T),r=[];for(const n of U(e)){const l=vs(e,n),c=`${n}/`,u=new Set(a.filter(t=>d(t,"scope").startsWith(c)).map(t=>d(t,"measure")));for(const t of s){if(!t.classes.includes("*")&&!t.classes.some(w=>l.includes(w)))continue;const h=d(t.line,"measure");if(u.has(h))continue;const p=Re(t.line);p.kind==="fact"&&(r.push(Q({...p.value.fields,scope:`${c}${d(t.line,"scope")}`})),u.add(h))}}return r}m(Ts,"inheritedOf");function Mt(e,o,s,a){const r=Z(e),{standing:n,rendered:l}=se(e);if(V(e,r,"")&&es(r)===G(r,o,n,e,E())){const g=ke(r);if(g!==void 0)return{standing:n,observed:g.observed,own:{...g.own,...Ss()},kept:!0}}const c=rs(n),u=a!==void 0&&a.length?[...a]:[...new Set(s.map(g=>is(c,g).region))],t=X(e,r,{wait:!1,...u.includes("")?{}:{reach:u}}),p=[...Ce({root:e,store:r,standing:n,observed:t}),...xe({root:e,store:r,standing:n,observed:t})],w={...Fe({root:e,store:r,entry:o,roleOf:We(r),standing:n,observed:p,unadmitted:l.grey.length+l.refused.length,orphans:0}),...$s(r,n)},v=new Set([...Object.keys(w),...Y(p).map(g=>g.measure),$e(n,"states","unread")]);if(s.every(g=>v.has(d(g,"measure"))||d(g,"scope")in w))return{standing:n,observed:p,own:w,kept:!0};const b=qs(e,o);return{...b,kept:b.kept??!1}}m(Mt,"coneOf");const Pe=m(e=>(o=>e===void 0||e===`${o}/`?E().filter(T).map(s=>Q({...ws(s),scope:`${o}/${d(s,"scope")}`})):[])(we(_e())),"ownCeilings");function qs(e,o,s,a=!0,r){const n=Z(e),l=Date.now(),c=V(e,n,s??""),u=Date.now()-l;if(c&&r?.free!==!0){const i=ke(n,s,G(n,o,se(e).standing,e,E()));if(i!==void 0)return me("error",`CLOSED ${s||"."} \xB7 digest ${u} ms
|
|
3
|
+
`),Ie(i,[...i.standing.filter(k=>T(k)&&!(s&&d(k,"measure")==="unread")),...Pe(s)])}const{standing:t,lock:h,rendered:p,owned:w}=r?.standing??se(e,s),v=Ne(t,"fold"),R=r===void 0&&s?new Map:void 0,b=r?.observed??X(e,n,{wait:a,...s?{reach:[s],answered:R}:{}}),g=G(n,o,t,e,E()),f=m(i=>!s||Ue(Ge(i.replace(/\/\*$/,"")),Qe(s)),"inside"),O=Ws(e,n,_s(n)),S=O.live.filter(i=>(k=>!s||k.length>0&&k.every(f))(d(i,"needs").split("|").filter(Boolean))),x=s&&s!==`${we(_e())}/`?{owned:w,place:s,scopes:new Set(S.map(i=>d(i,"scope")))}:void 0,C=[],y=Je(C),F=r?.observed??(s?y("observe",()=>X(e,n,{wait:a})):b),L=[...Ce({root:e,store:n,...s?{under:s}:{},standing:t,observed:F}),...y("capsules",()=>xe({root:e,store:n,...s?{under:s}:{},standing:t,observed:F}))],te=ss(n,t,s,v,g,b,e,R,x),P=us(n,new TextEncoder().encode(te.join(`
|
|
4
|
+
`))).replace(/^sha256:/,""),W=L.filter(i=>!/ measure=observed /.test(i)||f(d(i,"scope"))),ne=new Set(s?Y(L).filter(i=>!f(i.place)).map(i=>i.question):[]),je=O,j=S,z=[],M=[...t.filter(i=>T(i)&&!(s&&d(i,"measure")==="unread")),...Pe(s)],K=y("own",()=>Fe({root:e,store:n,entry:o,roleOf:We(n),standing:t,observed:L,unadmitted:p.grey.length+p.refused.length,orphans:z.length,...s?{under:s}:{}})),ie=y("regions",()=>as(t,M.filter(i=>!fs(i,K,s,new Set(U(e)))),Y(W))),oe=m(i=>ds({standing:t,ceilings:M,observed:W,own:{...K,...i},epoch:ee(w),...s?{under:s,places:new Set(U(e))}:{}}),"fold"),N=y("ceilings",()=>oe({})),{paid:re,missing:Ke}=y("paid",()=>Ms(n,j,W,`${Oe(t,"families","view",be(n))}/`)),Be=(I(ye(e,s??"",ys))??"").split(`
|
|
5
|
+
`).filter(Me).length,B=Ps(e,n,h,w),H=t.filter(i=>!p.grey.includes(i)&&!p.refused.includes(i)),ae=Ve({forks:p.forks,refused:p.refused,grey:p.grey,orphans:z,second:B}),$={release:he({standing:H,demands:j,paid:re,ceilings:M,readings:N,faults:ae,verdicts:ge(H.map(i=>{const k=ue(i);return k.kind==="fact"?k.value.fields:{}}),B),snapshot:{fold:P,instrument:g}}),root:e,store:n,...s?{under:s}:{},epoch:ee(w),standing:t,claims:p.standing,forks:p.forks,grey:p.grey,refused:p.refused,vacuous:p.vacuous.length,demands:j,paid:re,missing:Ke,history:je.history.filter(i=>d(i,"needs").split("|").filter(Boolean).some(f)),observed:W,receiptHistory:Os({root:e,store:n,...s?{under:s}:{},standing:t,observed:F}),ceilings:ve(N,M.length,ne),orphans:z,lock:Be,signed:js(n,t,L),second:B,effects:Ls(n),key:P,instrument:g,own:K,open:ns({store:n,standing:t,observed:W,grey:p.grey,epoch:ee(w)}),regions:os(ie),beats:Ds(n,t,s),landed:[...Fs(n).keys()].filter(i=>!s||i.startsWith(s)).length,costs:Es(n)},{readings:He,same:Te,here:qe}=y("docs",()=>Ks($)),ce=`${Oe(t,"families","view",be(n))}/`,ze=new Set([...qe].map(i=>`${ce}${i}`)),_=m(i=>ze.has(d(i,"scope")),"writes"),D=m(i=>Te.has(d(i,"scope").slice(ce.length)),"holds"),fe=[...$.missing.filter(i=>!_(i)||!D(i)),...$.paid.filter(i=>_(i)&&!D(i))],de={...He,"payments-lost-on-equal-output":fe.filter(i=>_(i)&&D(i)).length,"poles-unlike-replay":cs(ie,new Set(N.over.map(i=>i.ceiling)),{...K,unread:N.unread.length+N.vacuous.length})},le=y("ceilings",()=>oe(de)),pe=[...$.paid.filter(i=>!_(i)||D(i)),...$.missing.filter(i=>_(i)&&D(i))],A={...$,paid:pe,release:he({standing:H,demands:j,paid:pe,ceilings:M,readings:le,faults:ae,verdicts:ge(H.map(i=>{const k=ue(i);return k.kind==="fact"?k.value.fields:{}}),B),snapshot:{fold:P,instrument:g}}),missing:fe,own:{...$.own,...de},ceilings:ve(le,M.length,ne)};return v!==void 0&&V(e,n,s??"",!0,A.observed)&&y("keep",()=>ts(n,P,A,te,g)),me("error",`SPENT fold ${C.join(" ms \xB7 ")} ms
|
|
6
|
+
`),A}m(qs,"foldPlace");export{Mt as coneOf,qs as foldPlace,Pe as ownCeilings,se as standingOf};
|
|
@@ -1,80 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { fieldOf, foldClaims } from "../fold/claims.js";
|
|
5
|
-
import { observeText } from "../observe/files.js";
|
|
6
|
-
import { claimLinesIn } from "./args.js";
|
|
7
|
-
import { LOCK } from '@lapxo/topos/wire';
|
|
8
|
-
import { join } from 'node:path';
|
|
9
|
-
/** Judge an external signed approval without landing it, fetching its source,
|
|
10
|
-
* executing a provider, or changing the release-policy verdict of the place.
|
|
11
|
-
* The anchor is the place's key, never a key offered by the approval. */
|
|
12
|
-
export function releaseApproval(lock, lines) {
|
|
13
|
-
const standing = foldClaims(lock).standing;
|
|
14
|
-
const id = writerFor(standing, 'authorize');
|
|
15
|
-
if (!id)
|
|
16
|
-
throw Error('REFUSE·release place names no authorizer');
|
|
17
|
-
const one = (rows, scope, measure) => {
|
|
18
|
-
const selected = rows.filter(line => fieldOf(line, 'scope') === scope && (!measure || fieldOf(line, 'measure') === measure) && fieldOf(line, 'value') !== 'withdraw');
|
|
19
|
-
if (selected.length !== 1)
|
|
20
|
-
throw Error(`REFUSE·release ${scope} needs one declaration`);
|
|
21
|
-
return fieldOf(selected[0], 'value');
|
|
22
|
-
};
|
|
23
|
-
const anchor = { ...releaseSigner(standing), id, publicKey: one(standing, `keys/${id}`, 'public-key'), coverage: one(standing, `keys/${id}`, 'coverage').split('|') };
|
|
24
|
-
if (!lines.length)
|
|
25
|
-
throw Error('REFUSE·release empty approval');
|
|
26
|
-
for (const line of lines) {
|
|
27
|
-
const got = parse(line);
|
|
28
|
-
if (got.kind !== 'fact')
|
|
29
|
-
throw Error('REFUSE·release malformed approval');
|
|
30
|
-
if (got.value.fields['by'] !== id || !got.value.fields['sig'])
|
|
31
|
-
throw Error(`REFUSE·release approval must be signed by ${id}`);
|
|
32
|
-
}
|
|
33
|
-
// A separate release place may declare an era; its configuration must itself
|
|
34
|
-
// authenticate against the existing anchor. No packet key or coverage is used.
|
|
35
|
-
const wire = lines.filter(line => ['wire/signature-algorithms', 'audit/wire/signature-algorithms', 'wire/era', 'audit/wire/era'].includes(fieldOf(line, 'scope')));
|
|
36
|
-
let era;
|
|
37
|
-
try {
|
|
38
|
-
era = eraOf(wire.length ? foldClaims(wire).standing : standing);
|
|
39
|
-
}
|
|
40
|
-
catch {
|
|
41
|
-
throw Error('REFUSE·release signature era is absent or conflicting');
|
|
42
|
-
}
|
|
43
|
-
const authority = authorityFor([], anchor, era.admitted);
|
|
44
|
-
for (const line of lines) {
|
|
45
|
-
const verdict = authority.of(line);
|
|
46
|
-
if (verdict.kind !== 'admitted')
|
|
47
|
-
throw Error(`REFUSE·release ${fieldOf(line, 'scope')}: ${verdict.why ?? verdict.kind}`);
|
|
48
|
-
}
|
|
49
|
-
const released = lines.filter(line => /^release\/[^/]+$/.test(fieldOf(line, 'scope')) && fieldOf(line, 'measure') === 'digest' && fieldOf(line, 'role') === 'writes');
|
|
50
|
-
if (released.length !== 1)
|
|
51
|
-
throw Error('REFUSE·release needs one signed release/<tag> digest');
|
|
52
|
-
const required = (scope, measure) => {
|
|
53
|
-
const selected = lines.filter(line => fieldOf(line, 'scope') === scope);
|
|
54
|
-
if (selected.some(line => fieldOf(line, 'role') !== 'writes' || fieldOf(line, 'form') !== 'alphabet' || fieldOf(line, 'measure') !== measure))
|
|
55
|
-
throw Error(`REFUSE·release ${scope} is not an approval declaration`);
|
|
56
|
-
return one(selected, scope, measure);
|
|
57
|
-
};
|
|
58
|
-
const digest = required(fieldOf(released[0], 'scope'), 'digest'), name = required('release/artifact', 'id'), source = required('sources/archive', 'id');
|
|
59
|
-
if (!/^sha256:[a-f0-9]{64}$/.test(digest))
|
|
60
|
-
throw Error('REFUSE·release archive needs sha256');
|
|
61
|
-
if (!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(name))
|
|
62
|
-
throw Error('REFUSE·release artifact needs one safe filename');
|
|
63
|
-
let url;
|
|
64
|
-
try {
|
|
65
|
-
url = new URL(source);
|
|
66
|
-
}
|
|
67
|
-
catch {
|
|
68
|
-
throw Error('REFUSE·release archive source needs an absolute URL');
|
|
69
|
-
}
|
|
70
|
-
if (url.username || url.password || /[\s\x00-\x1f\x7f]/.test(source))
|
|
71
|
-
throw Error('REFUSE·release archive source needs a credential-free absolute URL without whitespace');
|
|
72
|
-
return `READY ${digest} ${name} ${source}`;
|
|
73
|
-
}
|
|
74
|
-
export function printReleaseApproval(root, file) {
|
|
75
|
-
const text = observeText(file);
|
|
76
|
-
if (text === undefined)
|
|
77
|
-
throw Error('REFUSE·release approval file is absent');
|
|
78
|
-
const lines = text.split('\n').filter(line => line.trim().length > 0);
|
|
79
|
-
process.stdout.write(releaseApproval(claimLinesIn(join(root, LOCK)), lines) + '\n');
|
|
80
|
-
}
|
|
1
|
+
var S=Object.defineProperty;var f=(n,o)=>S(n,"name",{value:o,configurable:!0});import{library11_parse as y}from"../vendor/runtime.js";import{authorityFor as b,writerFor as $,releaseSigner as x}from"../fold/signers.js";import{eraOf as k}from"../fold/digests.js";import{fieldOf as r,foldClaims as R}from"../fold/claims.js";import{observeText as L}from"../observe/files.js";import{claimLinesIn as A}from"./args.js";import{library11_LOCK as z}from"../vendor/runtime.js";import{join as O}from"node:path";function C(n,o){const a=R(n).standing,s=$(a,"authorize");if(!s)throw Error("REFUSE\xB7release place names no authorizer");const l=f((e,t,c)=>{const i=e.filter(h=>r(h,"scope")===t&&(!c||r(h,"measure")===c)&&r(h,"value")!=="withdraw");if(i.length!==1)throw Error(`REFUSE\xB7release ${t} needs one declaration`);return r(i[0],"value")},"one"),U={...x(a),id:s,publicKey:l(a,`keys/${s}`,"public-key"),coverage:l(a,`keys/${s}`,"coverage").split("|")};if(!o.length)throw Error("REFUSE\xB7release empty approval");for(const e of o){const t=y(e);if(t.kind!=="fact")throw Error("REFUSE\xB7release malformed approval");if(t.value.fields.by!==s||!t.value.fields.sig)throw Error(`REFUSE\xB7release approval must be signed by ${s}`)}const u=o.filter(e=>["wire/signature-algorithms","audit/wire/signature-algorithms","wire/era","audit/wire/era"].includes(r(e,"scope")));let m;try{m=k(u.length?R(u).standing:a)}catch{throw Error("REFUSE\xB7release signature era is absent or conflicting")}const F=b([],U,m.admitted);for(const e of o){const t=F.of(e);if(t.kind!=="admitted")throw Error(`REFUSE\xB7release ${r(e,"scope")}: ${t.why??t.kind}`)}const w=o.filter(e=>/^release\/[^/]+$/.test(r(e,"scope"))&&r(e,"measure")==="digest"&&r(e,"role")==="writes");if(w.length!==1)throw Error("REFUSE\xB7release needs one signed release/<tag> digest");const d=f((e,t)=>{const c=o.filter(i=>r(i,"scope")===e);if(c.some(i=>r(i,"role")!=="writes"||r(i,"form")!=="alphabet"||r(i,"measure")!==t))throw Error(`REFUSE\xB7release ${e} is not an approval declaration`);return l(c,e,t)},"required"),g=d(r(w[0],"scope"),"digest"),v=d("release/artifact","id"),E=d("sources/archive","id");if(!/^sha256:[a-f0-9]{64}$/.test(g))throw Error("REFUSE\xB7release archive needs sha256");if(!/^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(v))throw Error("REFUSE\xB7release artifact needs one safe filename");let p;try{p=new URL(E)}catch{throw Error("REFUSE\xB7release archive source needs an absolute URL")}if(p.username||p.password||/[\s\x00-\x1f\x7f]/.test(E))throw Error("REFUSE\xB7release archive source needs a credential-free absolute URL without whitespace");return`READY ${g} ${v} ${E}`}f(C,"releaseApproval");function B(n,o){const a=L(o);if(a===void 0)throw Error("REFUSE\xB7release approval file is absent");const s=a.split(`
|
|
2
|
+
`).filter(l=>l.trim().length>0);process.stdout.write(C(A(O(n,z)),s)+`
|
|
3
|
+
`)}f(B,"printReleaseApproval");export{B as printReleaseApproval,C as releaseApproval};
|
|
@@ -1,25 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { currentActReadings } from "../fold/own.js";
|
|
3
|
-
import { placedReadings } from "../fold/observed.js";
|
|
4
|
-
import { placesIn } from "../fold/places.js";
|
|
5
|
-
import { releasePolicy, releaseFaults } from "../fold/release-policy.js";
|
|
6
|
-
import { attestationObservations } from "../fold/evidence.js";
|
|
7
|
-
import { parse } from '@lapxo/topos/wire';
|
|
8
|
-
import { point, region, within } from '@lapxo/obligations/field';
|
|
9
|
-
/** A verified semantic fold can be reused. Its previous act's measurements cannot.
|
|
10
|
-
* Keep history intact and judge current measurements with the ordinary interpreters.
|
|
11
|
-
*/
|
|
12
|
-
export function refreshRetainedJudgment(prior, ceilings, current = currentActReadings(prior.under)) {
|
|
13
|
-
const own = { ...prior.own, ...current };
|
|
14
|
-
const readings = foldCeilings({ standing: prior.standing, ceilings, observed: prior.observed,
|
|
15
|
-
own, epoch: prior.epoch, ...(prior.under ? { under: prior.under, places: new Set(placesIn(prior.root)) } : {}) });
|
|
16
|
-
const standing = prior.standing.filter(line => !prior.grey.includes(line) && !prior.refused.includes(line));
|
|
17
|
-
const shared = new Set(prior.under ? placedReadings(prior.observed)
|
|
18
|
-
.filter(reading => !within(point(reading.place.replace(/\/\*$/, '')), region(prior.under)))
|
|
19
|
-
.map(reading => reading.question) : []);
|
|
20
|
-
return { ...prior, kept: true, own, ceilings: ceilingSummary(readings, ceilings.length, shared),
|
|
21
|
-
release: releasePolicy({ standing, demands: prior.demands, paid: prior.paid, ceilings, readings,
|
|
22
|
-
faults: releaseFaults(prior),
|
|
23
|
-
verdicts: attestationObservations(standing.map(line => { const got = parse(line); return got.kind === 'fact' ? got.value.fields : {}; }), prior.second),
|
|
24
|
-
snapshot: { fold: prior.key, instrument: prior.instrument } }) };
|
|
25
|
-
}
|
|
1
|
+
var r=Object.defineProperty;var m=(e,t)=>r(e,"name",{value:t,configurable:!0});import{foldCeilings as u,ceilingSummary as c}from"../fold/ceilings.js";import{currentActReadings as f}from"../fold/own.js";import{placedReadings as g}from"../fold/observed.js";import{placesIn as b}from"../fold/places.js";import{releasePolicy as h,releaseFaults as y}from"../fold/release-policy.js";import{attestationObservations as p}from"../fold/evidence.js";import{library11_parse as v}from"../vendor/runtime.js";import{library12_point as w,library12_region as _,library12_within as k}from"../vendor/runtime.js";function O(e,t,o=f(e.under)){const s={...e.own,...o},a=u({standing:e.standing,ceilings:t,observed:e.observed,own:s,epoch:e.epoch,...e.under?{under:e.under,places:new Set(b(e.root))}:{}}),d=e.standing.filter(n=>!e.grey.includes(n)&&!e.refused.includes(n)),l=new Set(e.under?g(e.observed).filter(n=>!k(w(n.place.replace(/\/\*$/,"")),_(e.under))).map(n=>n.question):[]);return{...e,kept:!0,own:s,ceilings:c(a,t.length,l),release:h({standing:d,demands:e.demands,paid:e.paid,ceilings:t,readings:a,faults:y(e),verdicts:p(d.map(n=>{const i=v(n);return i.kind==="fact"?i.value.fields:{}}),e.second),snapshot:{fold:e.key,instrument:e.instrument}})}}m(O,"refreshRetainedJudgment");export{O as refreshRetainedJudgment};
|
|
@@ -1,19 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { storeOf } from "../land/ledger.js";
|
|
6
|
-
/** An evidence projection, never a new authority lock. Authentication uses
|
|
7
|
-
* the admission snapshot at each local epoch; the existing fold applies
|
|
8
|
-
* supersessions and withdrawals across all declared classes. Storage layout
|
|
9
|
-
* and delivery mode do not enter this public boundary. */
|
|
10
|
-
export function printStandingResult(root) {
|
|
11
|
-
const store = storeOf(root);
|
|
12
|
-
assertStandingView(lockStanding(store));
|
|
13
|
-
if (hasContextualPlace(root)) {
|
|
14
|
-
process.stdout.write(JSON.stringify(contextualStanding(root)) + '\n');
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const standing = publicStandingLines(root);
|
|
18
|
-
process.stdout.write(standing.length ? standing.join('\n') + '\n' : '');
|
|
19
|
-
}
|
|
1
|
+
var o=Object.defineProperty;var r=(t,n)=>o(t,"name",{value:n,configurable:!0});import{hasContextualPlace as s,contextualStanding as e}from"../host/contextual-place.js";import{publicStandingLines as a}from"../host/admitted-place.js";import{assertStandingView as m}from"../host/standing-projection.js";import{lockStanding as p}from"../fold/keys.js";import{storeOf as c}from"../land/ledger.js";function w(t){const n=c(t);if(m(p(n)),s(t)){process.stdout.write(JSON.stringify(e(t))+`
|
|
2
|
+
`);return}const i=a(t);process.stdout.write(i.length?i.join(`
|
|
3
|
+
`)+`
|
|
4
|
+
`:"")}r(w,"printStandingResult");export{w as printStandingResult};
|
package/dist/cli/takes.js
CHANGED
|
@@ -1,112 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import { land, landEnvelope, ledgerLines, storeOf } from "../land/ledger.js";
|
|
12
|
-
import { wordOf } from "../fold/wire.js";
|
|
13
|
-
import { hasVouchedTree, inside, landCoordinates, coordinatesOf, locationsOf, vouchedCoordinates, witnessOf } from "../land/vouched.js";
|
|
14
|
-
import { ownerOf, forkedScopes, signedOwnerLines } from "./owner.js";
|
|
15
|
-
export function judgeDemand(root, demand) {
|
|
16
|
-
const started = Date.now();
|
|
17
|
-
const store = storeOf(root);
|
|
18
|
-
const scope = fieldOf(demand, 'scope');
|
|
19
|
-
const refuse = (why) => ({ kind: 'refused', scope, why });
|
|
20
|
-
if (!hasVouchedTree(store))
|
|
21
|
-
return refuse('no source is vouched; land the lock once');
|
|
22
|
-
if (forkedScopes(store).has(scope))
|
|
23
|
-
return refuse('it stands as a fork; the owner narrows or withdraws one line first');
|
|
24
|
-
const condition = fieldOf(demand, 'condition');
|
|
25
|
-
if (condition) {
|
|
26
|
-
const paid = ledgerLines(store, 'judge').filter((line) => fieldOf(line, 'scope') === condition && fieldOf(line, 'value') === 'present').pop();
|
|
27
|
-
if (!paid)
|
|
28
|
-
return { kind: 'owed', scope, why: `it rests on ${condition}, which has no FACT: it stands owed until that is paid` };
|
|
29
|
-
const absent = locationsOf(fieldOf(demand, 'needs')).locations.filter((l) => !existsSync(join(root, l.replace(/\/$/, ''))));
|
|
30
|
-
if (absent.length)
|
|
31
|
-
return refuse(`demanded locations absent: ${absent.join(', ')}`);
|
|
32
|
-
return { kind: 'conditioned', scope, demand, receipt: fieldOf(paid, 'at'), condition };
|
|
33
|
-
}
|
|
34
|
-
const { locations, refused } = locationsOf(fieldOf(demand, 'needs'));
|
|
35
|
-
if (refused.length)
|
|
36
|
-
return refuse(`needs that are not locations: ${refused.join(', ')}`);
|
|
37
|
-
const roleOf = rolesOf(store);
|
|
38
|
-
const ignored = new Map();
|
|
39
|
-
const walked = (coordinate) => {
|
|
40
|
-
const role = roleOf(coordinate);
|
|
41
|
-
if (role !== 'source')
|
|
42
|
-
ignored.set(role, (ignored.get(role) ?? 0) + 1);
|
|
43
|
-
return role;
|
|
44
|
-
};
|
|
45
|
-
const before = new Map([...vouchedCoordinates(store)].filter(([coordinate]) => locations.some((l) => inside(coordinate, l)) && roleOf(coordinate) === 'source'));
|
|
46
|
-
const after = new Map();
|
|
47
|
-
for (const location of locations)
|
|
48
|
-
for (const [coordinate, digest] of coordinatesOf(root, location, walked))
|
|
49
|
-
after.set(coordinate, digest);
|
|
50
|
-
const law = [scope.split('/').pop() ?? scope, fieldOf(demand, 'at').replace(/^witness:/, '')].filter(Boolean);
|
|
51
|
-
const standing = foldClaims(signedOwnerLines(store)).standing;
|
|
52
|
-
const unpaid = paidOf(store, [demand], [], `${wordOf(standing, 'families', 'view')}/`).missing.length === 1;
|
|
53
|
-
const verdict = judgeTake({
|
|
54
|
-
root, scope, value: fieldOf(demand, 'value'), locations, before, after, law, unpaid,
|
|
55
|
-
shape: fieldOf(demand, 'shape'), restsOn: fieldOf(demand, 'restsOn'), witnessOf: (coordinate) => witnessOf(root, coordinate),
|
|
56
|
-
template: wordOf(foldClaims(signedOwnerLines(store)).standing, 'templates', '{roots}'),
|
|
57
|
-
});
|
|
58
|
-
return { kind: 'judged', scope, demand, locations, before, after, verdict, ignored, started };
|
|
59
|
-
}
|
|
60
|
-
/** A take its batch let land: its receipt sealed with the gates the batch passed, its cone vouched, its fact landed. */
|
|
61
|
-
export function landTake(root, one, gates) {
|
|
62
|
-
const store = storeOf(root);
|
|
63
|
-
if (one.kind === 'refused')
|
|
64
|
-
return;
|
|
65
|
-
if (one.kind === 'owed') {
|
|
66
|
-
hostOutput('out', `OWED take ${one.scope} · ${one.why}\n`);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (one.kind === 'conditioned') {
|
|
70
|
-
const { scope, demand, receipt, condition } = one;
|
|
71
|
-
land(store, 'judge', [canonical({
|
|
72
|
-
scope, role: 'writes', form: 'alphabet', measure: fieldOf(demand, 'measure') || 'status', value: fieldOf(demand, 'value') || 'present', by: 'judge', at: receipt, condition,
|
|
73
|
-
})]);
|
|
74
|
-
land(store, 'take', [canonical({ scope: `take/${scope}`, role: 'writes', form: 'alphabet', measure: 'status', value: 'fact', by: 'judge', at: receipt })]);
|
|
75
|
-
hostOutput('out', `FACT take ${scope} · paid by ${receipt} · condition ${condition} · no moved set\n`);
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const { scope, demand, before, after, ignored, started } = one;
|
|
79
|
-
const verdict = sealed(root, one.verdict, gates);
|
|
80
|
-
const who = writerFor(signedOwnerLines(store), 'fold') ?? ownerOf(store);
|
|
81
|
-
const cone = fullDigest(store, [...before].map(([path, digest]) => `${path} ${digest}`));
|
|
82
|
-
land(store, 'take', [canonical({ scope: `take/${scope}`, role: 'writes', form: 'alphabet', measure: 'status', value: 'open', by: who, at: `place:${cone}` })]);
|
|
83
|
-
landEnvelope(store, verdict.digest, `${JSON.stringify(verdict.envelope, null, 1)}\n`);
|
|
84
|
-
const receipt = `receipt:${verdict.digest}`;
|
|
85
|
-
const generation = fullDigest(store, [...after].sort().map(([coordinate, digest]) => `${coordinate} ${digest}`));
|
|
86
|
-
land(store, 'judge', verdict.envelope.effects.map((effect) => canonical({
|
|
87
|
-
scope: `${effect.kind}/${generation}`, role: 'writes', form: 'alphabet', measure: 'status', value: effect.status, by: 'judge', at: receipt,
|
|
88
|
-
})));
|
|
89
|
-
if (verdict.kind === 'fact') {
|
|
90
|
-
const present = new Map(verdict.changed.filter((path) => after.has(path)).map((path) => [path, after.get(path) ?? '']));
|
|
91
|
-
const gone = verdict.changed.filter((path) => !after.has(path));
|
|
92
|
-
landCoordinates(store, present, gone, receipt);
|
|
93
|
-
land(store, 'judge', [
|
|
94
|
-
canonical({
|
|
95
|
-
scope, role: 'writes', form: 'alphabet', measure: fieldOf(demand, 'measure') || 'status', value: fieldOf(demand, 'value') || 'present', by: 'judge', at: receipt,
|
|
96
|
-
}),
|
|
97
|
-
canonical({ scope, role: 'writes', form: 'alphabet', measure: 'cone', value: (verdict.changed.length ? verdict.changed : [...after.keys()].sort()).join('|'), by: 'judge', at: receipt }),
|
|
98
|
-
]);
|
|
99
|
-
}
|
|
100
|
-
const ms = Date.now() - started;
|
|
101
|
-
land(store, 'take', [
|
|
102
|
-
canonical({ scope: `take/${scope}`, role: 'writes', form: 'alphabet', measure: 'status', value: verdict.kind, by: 'judge', at: receipt }),
|
|
103
|
-
canonical({ scope: `take/${scope}`, role: 'writes', form: 'interval', measure: 'ms', value: `${ms}..${ms}`, by: 'judge', at: receipt }),
|
|
104
|
-
]);
|
|
105
|
-
const effects = verdict.envelope.effects.map((e) => `${e.kind}@${e.at || '.'}:${e.admitted ? e.status : `${e.status}·grey`}(${e.ms} ms)`).join(' ') || 'none';
|
|
106
|
-
hostOutput('out', `${verdict.kind === 'fact' ? 'FACT ' : 'REFUSE'} take ${scope} · ${verdict.why}\n`
|
|
107
|
-
+ `MOVED ${verdict.changed.length} sources: ${verdict.changed.join(' ')}\n`
|
|
108
|
-
+ `IGNORED ${[...ignored].map(([role, n]) => `${n} ${role}`).join(' · ') || 'none'} (not walked, never landed)\n`
|
|
109
|
-
+ `${verdict.notOwned.length ? `NOT OWN ${verdict.notOwned.length} witnesses of other laws, left for them: ${verdict.notOwned.join(' ')}\n` : ''}`
|
|
110
|
-
+ `EFFECTS ${effects}\n`
|
|
111
|
-
+ `RECEIPT ${verdict.digest} · ${ms} ms\n`);
|
|
112
|
-
}
|
|
1
|
+
var N=Object.defineProperty;var g=(c,s)=>N(c,"name",{value:s,configurable:!0});import{hostOutput as E}from"../host/call-context.js";import{existsSync as x}from"node:fs";import{join as A}from"node:path";import{fullDigest as C}from"../fold/digests.js";import{library11_canonical as u}from"../vendor/runtime.js";import{fieldOf as i,foldClaims as D}from"../fold/claims.js";import{paidOf as R}from"../fold/paid.js";import{rolesOf as I}from"../fold/roles.js";import{writerFor as L}from"../fold/signers.js";import{judgeTake as V,sealed as W}from"../judge/take.js";import{land as $,landEnvelope as B,ledgerLines as G,storeOf as F}from"../land/ledger.js";import{wordOf as M}from"../fold/wire.js";import{hasVouchedTree as J,inside as P,landCoordinates as U,coordinatesOf as _,locationsOf as S,vouchedCoordinates as q,witnessOf as z}from"../land/vouched.js";import{ownerOf as H,forkedScopes as K,signedOwnerLines as T}from"./owner.js";function fe(c,s){const O=Date.now(),r=F(c),a=i(s,"scope"),p=g(e=>({kind:"refused",scope:a,why:e}),"refuse");if(!J(r))return p("no source is vouched; land the lock once");if(K(r).has(a))return p("it stands as a fork; the owner narrows or withdraws one line first");const m=i(s,"condition");if(m){const e=G(r,"judge").filter(f=>i(f,"scope")===m&&i(f,"value")==="present").pop();if(!e)return{kind:"owed",scope:a,why:`it rests on ${m}, which has no FACT: it stands owed until that is paid`};const n=S(i(s,"needs")).locations.filter(f=>!x(A(c,f.replace(/\/$/,""))));return n.length?p(`demanded locations absent: ${n.join(", ")}`):{kind:"conditioned",scope:a,demand:s,receipt:i(e,"at"),condition:m}}const{locations:d,refused:w}=S(i(s,"needs"));if(w.length)return p(`needs that are not locations: ${w.join(", ")}`);const k=I(r),t=new Map,j=g(e=>{const n=k(e);return n!=="source"&&t.set(n,(t.get(n)??0)+1),n},"walked"),v=new Map([...q(r)].filter(([e])=>d.some(n=>P(e,n))&&k(e)==="source")),l=new Map;for(const e of d)for(const[n,f]of _(c,e,j))l.set(n,f);const b=[a.split("/").pop()??a,i(s,"at").replace(/^witness:/,"")].filter(Boolean),h=D(T(r)).standing,y=R(r,[s],[],`${M(h,"families","view")}/`).missing.length===1,o=V({root:c,scope:a,value:i(s,"value"),locations:d,before:v,after:l,law:b,unpaid:y,shape:i(s,"shape"),restsOn:i(s,"restsOn"),witnessOf:g(e=>z(c,e),"witnessOf"),template:M(D(T(r)).standing,"templates","{roots}")});return{kind:"judged",scope:a,demand:s,locations:d,before:v,after:l,verdict:o,ignored:t,started:O}}g(fe,"judgeDemand");function ue(c,s,O){const r=F(c);if(s.kind==="refused")return;if(s.kind==="owed"){E("out",`OWED take ${s.scope} \xB7 ${s.why}
|
|
2
|
+
`);return}if(s.kind==="conditioned"){const{scope:o,demand:e,receipt:n,condition:f}=s;$(r,"judge",[u({scope:o,role:"writes",form:"alphabet",measure:i(e,"measure")||"status",value:i(e,"value")||"present",by:"judge",at:n,condition:f})]),$(r,"take",[u({scope:`take/${o}`,role:"writes",form:"alphabet",measure:"status",value:"fact",by:"judge",at:n})]),E("out",`FACT take ${o} \xB7 paid by ${n} \xB7 condition ${f} \xB7 no moved set
|
|
3
|
+
`);return}const{scope:a,demand:p,before:m,after:d,ignored:w,started:k}=s,t=W(c,s.verdict,O),j=L(T(r),"fold")??H(r),v=C(r,[...m].map(([o,e])=>`${o} ${e}`));$(r,"take",[u({scope:`take/${a}`,role:"writes",form:"alphabet",measure:"status",value:"open",by:j,at:`place:${v}`})]),B(r,t.digest,`${JSON.stringify(t.envelope,null,1)}
|
|
4
|
+
`);const l=`receipt:${t.digest}`,b=C(r,[...d].sort().map(([o,e])=>`${o} ${e}`));if($(r,"judge",t.envelope.effects.map(o=>u({scope:`${o.kind}/${b}`,role:"writes",form:"alphabet",measure:"status",value:o.status,by:"judge",at:l}))),t.kind==="fact"){const o=new Map(t.changed.filter(n=>d.has(n)).map(n=>[n,d.get(n)??""])),e=t.changed.filter(n=>!d.has(n));U(r,o,e,l),$(r,"judge",[u({scope:a,role:"writes",form:"alphabet",measure:i(p,"measure")||"status",value:i(p,"value")||"present",by:"judge",at:l}),u({scope:a,role:"writes",form:"alphabet",measure:"cone",value:(t.changed.length?t.changed:[...d.keys()].sort()).join("|"),by:"judge",at:l})])}const h=Date.now()-k;$(r,"take",[u({scope:`take/${a}`,role:"writes",form:"alphabet",measure:"status",value:t.kind,by:"judge",at:l}),u({scope:`take/${a}`,role:"writes",form:"interval",measure:"ms",value:`${h}..${h}`,by:"judge",at:l})]);const y=t.envelope.effects.map(o=>`${o.kind}@${o.at||"."}:${o.admitted?o.status:`${o.status}\xB7grey`}(${o.ms} ms)`).join(" ")||"none";E("out",`${t.kind==="fact"?"FACT ":"REFUSE"} take ${a} \xB7 ${t.why}
|
|
5
|
+
MOVED ${t.changed.length} sources: ${t.changed.join(" ")}
|
|
6
|
+
IGNORED ${[...w].map(([o,e])=>`${e} ${o}`).join(" \xB7 ")||"none"} (not walked, never landed)
|
|
7
|
+
${t.notOwned.length?`NOT OWN ${t.notOwned.length} witnesses of other laws, left for them: ${t.notOwned.join(" ")}
|
|
8
|
+
`:""}EFFECTS ${y}
|
|
9
|
+
RECEIPT ${t.digest} \xB7 ${h} ms
|
|
10
|
+
`)}g(ue,"landTake");export{fe as judgeDemand,ue as landTake};
|
package/dist/cli/verb.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export {};
|
|
1
|
+
export {} from "../public-types.js";
|