@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.
Files changed (250) hide show
  1. package/CITATION.cff +1 -1
  2. package/TARGET.bound +44 -39
  3. package/dist/cli/accept.js +72 -590
  4. package/dist/cli/act-result.js +3 -103
  5. package/dist/cli/args.js +3 -44
  6. package/dist/cli/custodian.js +2 -29
  7. package/dist/cli/host.js +4 -32
  8. package/dist/cli/names.js +1 -12
  9. package/dist/cli/native-descendant.js +1 -19
  10. package/dist/cli/native.js +3 -60
  11. package/dist/cli/observe.js +1 -13
  12. package/dist/cli/owner.js +3 -139
  13. package/dist/cli/pass.js +21 -321
  14. package/dist/cli/place.js +6 -282
  15. package/dist/cli/release-result.js +3 -80
  16. package/dist/cli/retained-judgment.js +1 -25
  17. package/dist/cli/standing-result.js +4 -19
  18. package/dist/cli/takes.js +10 -112
  19. package/dist/cli/verb.d.ts +1 -2
  20. package/dist/cli/verb.js +83 -684
  21. package/dist/engine/computation.js +2 -0
  22. package/dist/engine/conformance.js +4 -0
  23. package/dist/engine/encoding.js +1 -2
  24. package/dist/engine/index.d.ts +1 -13
  25. package/dist/engine/index.js +2 -11
  26. package/dist/engine/object.js +1 -38
  27. package/dist/engine/ports.js +2 -117
  28. package/dist/fold/admission-history.js +1 -17
  29. package/dist/fold/bootstrap-anchor.js +1 -28
  30. package/dist/fold/ceilings.js +1 -142
  31. package/dist/fold/claims.js +2 -132
  32. package/dist/fold/closed.js +24 -235
  33. package/dist/fold/configures.js +1 -25
  34. package/dist/fold/digests.js +10 -226
  35. package/dist/fold/evidence.js +1 -22
  36. package/dist/fold/fold-worker.js +1 -13
  37. package/dist/fold/kept.js +12 -173
  38. package/dist/fold/keys.js +3 -91
  39. package/dist/fold/laid.js +3 -90
  40. package/dist/fold/nos.js +1 -48
  41. package/dist/fold/object.js +1 -2
  42. package/dist/fold/observed.js +27 -534
  43. package/dist/fold/opened.js +1 -33
  44. package/dist/fold/own.js +3 -217
  45. package/dist/fold/paid.js +1 -92
  46. package/dist/fold/place-inputs.js +1 -70
  47. package/dist/fold/places.js +3 -100
  48. package/dist/fold/rank.js +1 -9
  49. package/dist/fold/reach.js +1 -83
  50. package/dist/fold/readers.js +6 -142
  51. package/dist/fold/receipts.js +1 -47
  52. package/dist/fold/region-declarations.js +1 -13
  53. package/dist/fold/region.js +8 -286
  54. package/dist/fold/release-policy.js +1 -101
  55. package/dist/fold/resolved.js +6 -145
  56. package/dist/fold/roles.js +2 -59
  57. package/dist/fold/second.js +4 -71
  58. package/dist/fold/shards.js +12 -100
  59. package/dist/fold/signed.js +3 -81
  60. package/dist/fold/signers.js +1 -54
  61. package/dist/fold/stranger.js +6 -24
  62. package/dist/fold/views.js +1 -66
  63. package/dist/fold/wire.js +1 -46
  64. package/dist/fold/zoom.js +3 -81
  65. package/dist/host/act-cost.js +1 -25
  66. package/dist/host/adapters/keys/ed25519.js +1 -30
  67. package/dist/host/adapters/modules/javascript.js +1 -50
  68. package/dist/host/adapters/transport/http.js +1 -28
  69. package/dist/host/admitted-place.js +1 -35
  70. package/dist/host/archive.js +1 -152
  71. package/dist/host/call-context.js +1 -14
  72. package/dist/host/capsule-process.js +2 -62
  73. package/dist/host/capsule.js +9 -171
  74. package/dist/host/cell-receipts.js +12 -128
  75. package/dist/host/commit-result.js +1 -5
  76. package/dist/host/content-needed.js +1 -8
  77. package/dist/host/content-store.js +1 -31
  78. package/dist/host/contextual-place.js +2 -72
  79. package/dist/host/digest.js +2 -15
  80. package/dist/host/hash.js +1 -9
  81. package/dist/host/host-controls.js +1 -19
  82. package/dist/host/in-process-act.js +3 -84
  83. package/dist/host/in-process-context.js +3 -91
  84. package/dist/host/in-process-root.js +6 -84
  85. package/dist/host/in-process.js +4 -55
  86. package/dist/host/index.d.ts +1 -15
  87. package/dist/host/index.js +1 -7
  88. package/dist/host/io.js +1 -11
  89. package/dist/host/lifetime.js +1 -79
  90. package/dist/host/located.js +6 -105
  91. package/dist/host/native/bounded-file.js +1 -32
  92. package/dist/host/native/command.js +1 -91
  93. package/dist/host/native/control-bridge-worker.js +2 -88
  94. package/dist/host/native/control-bridge.js +1 -110
  95. package/dist/host/native/control-selection.js +1 -32
  96. package/dist/host/native/custody.js +1 -91
  97. package/dist/host/native/deadline.js +1 -28
  98. package/dist/host/native/descendants.js +1 -528
  99. package/dist/host/native/generated-custodian.js +5 -267
  100. package/dist/host/native/generated.js +1 -379
  101. package/dist/host/native/image.js +1 -45
  102. package/dist/host/native/jobs.js +2 -148
  103. package/dist/host/native/loader.js +1 -269
  104. package/dist/host/native/materialize.js +1 -175
  105. package/dist/host/native/module-closure.js +1 -130
  106. package/dist/host/native/module-delivery.d.ts +1 -62
  107. package/dist/host/native/module-delivery.js +1 -151
  108. package/dist/host/native/module-syntax.js +1 -69
  109. package/dist/host/native/native-binary.js +1 -115
  110. package/dist/host/native/native-program.js +1 -72
  111. package/dist/host/native/node-jobs.js +3 -187
  112. package/dist/host/native/node-launch.js +1 -159
  113. package/dist/host/native/preload.js +1 -45
  114. package/dist/host/native/reading.js +1 -249
  115. package/dist/host/native/receipt-environment.js +1 -41
  116. package/dist/host/native/references.js +1 -30
  117. package/dist/host/native/root.js +1 -37
  118. package/dist/host/native/route.js +1 -216
  119. package/dist/host/native/runtime.js +1 -9
  120. package/dist/host/native-reader-context.js +1 -8
  121. package/dist/host/native-receiver.js +1 -25
  122. package/dist/host/objects.js +1 -38
  123. package/dist/host/order.js +1 -2
  124. package/dist/host/place-act-transaction.js +4 -78
  125. package/dist/host/place-clock-selection.js +5 -124
  126. package/dist/host/ports/ingress.js +2 -57
  127. package/dist/host/ports/local-act.js +5 -183
  128. package/dist/host/ports/place-act.js +1 -134
  129. package/dist/host/ports/publication.js +1 -56
  130. package/dist/host/ports/signing.js +1 -74
  131. package/dist/host/ports/store.js +1 -18
  132. package/dist/host/ports/transport.js +1 -48
  133. package/dist/host/process-lifetime.js +1 -17
  134. package/dist/host/provide.js +1 -183
  135. package/dist/host/read-only.js +1 -9
  136. package/dist/host/reading-closures.js +7 -227
  137. package/dist/host/reading-context.js +1 -53
  138. package/dist/host/reading-identity-types.js +0 -0
  139. package/dist/host/reading-identity.js +3 -0
  140. package/dist/host/reading-preparation.js +6 -0
  141. package/dist/host/reference-authenticated.d.ts +1 -40
  142. package/dist/host/reference-authenticated.js +3 -100
  143. package/dist/host/reference-contracts.js +1 -6
  144. package/dist/host/reference-export.js +6 -81
  145. package/dist/host/reference-native-api.d.ts +1 -3
  146. package/dist/host/reference-native-api.js +1 -3
  147. package/dist/host/reference-native.js +1 -74
  148. package/dist/host/reference-profile.js +1 -63
  149. package/dist/host/reference-standing.js +2 -18
  150. package/dist/host/reference.js +1 -24
  151. package/dist/host/refusals.js +2 -43
  152. package/dist/host/release.js +4 -256
  153. package/dist/host/root-clock-source.js +1 -307
  154. package/dist/host/selected-capsules.js +1 -50
  155. package/dist/host/selected-topos.js +1 -80
  156. package/dist/host/signature-era.js +1 -12
  157. package/dist/host/signing.js +2 -48
  158. package/dist/host/source-content.js +2 -111
  159. package/dist/host/standing-carrier.js +1 -18
  160. package/dist/host/standing-projection.js +1 -50
  161. package/dist/host/timing.js +1 -7
  162. package/dist/host/walk.js +20 -193
  163. package/dist/judge/late.js +1 -33
  164. package/dist/judge/take.js +2 -75
  165. package/dist/judge/widening.js +1 -25
  166. package/dist/land/act.js +8 -336
  167. package/dist/land/alias.js +1 -41
  168. package/dist/land/held.js +1 -23
  169. package/dist/land/inert.js +1 -33
  170. package/dist/land/leaving.js +1 -55
  171. package/dist/land/ledger.js +7 -188
  172. package/dist/land/owned.js +4 -66
  173. package/dist/land/sign.js +1 -53
  174. package/dist/land/standing-pin.js +1 -49
  175. package/dist/land/vouched.js +1 -112
  176. package/dist/land/withdraw.js +1 -24
  177. package/dist/observe/files.js +1 -88
  178. package/dist/observe/identity.js +1 -61
  179. package/dist/observe/match.js +1 -8
  180. package/dist/observe/regions.js +7 -306
  181. package/dist/observe/run.js +2 -41
  182. package/dist/observe/runner.js +4 -101
  183. package/dist/public-types.d.ts +1114 -0
  184. package/dist/render/capsule.js +1 -30
  185. package/dist/render/field.js +1 -40
  186. package/dist/render/names.js +1 -4
  187. package/dist/render/open.js +1 -61
  188. package/dist/render/page.js +1 -7
  189. package/dist/render/receipts.js +1 -47
  190. package/dist/render/shape.js +1 -74
  191. package/dist/render/target.js +4 -52
  192. package/dist/render/view.js +7 -197
  193. package/dist/vendor/50086958553b9376d600583f7dff354196bfeb41170fc6d1482ca7bea7c493e2.LICENSE +21 -0
  194. package/dist/vendor/b3e938d28f88a1851af303a40c749e12ebd5a686daac4f0b343b5cdd2e040419.LICENSE +21 -0
  195. package/dist/vendor/bundle.json +1 -0
  196. package/dist/vendor/library11.js +1 -0
  197. package/dist/vendor/object-provider.js +42 -0
  198. package/dist/vendor/runtime.js +38 -0
  199. package/dist/vendor/sources.json +1 -0
  200. package/dist/wasm/adapter.d.ts +1 -51
  201. package/dist/wasm/adapter.js +1 -180
  202. package/dist/wasm/node-worker.js +1 -13
  203. package/dist/wasm/object.js +1 -76
  204. package/dist/wasm/worker.js +1 -7
  205. package/docs/contracts/closure-delivery.md +1 -1
  206. package/docs/contracts/closure-delivery.publication.json +1 -1
  207. package/docs/contracts/conformance.json +142 -0
  208. package/docs/contracts/determinism.bound +9 -0
  209. package/docs/contracts/engine-object-projection.publication.json +1 -1
  210. package/docs/contracts/engine.md +21 -1
  211. package/docs/contracts/native-publication.inventory.json +2 -1
  212. package/docs/contracts/optional-wasm-adapter.publication.json +1 -1
  213. package/docs/contracts/reading-identity.md +37 -0
  214. package/docs/contracts/reading-identity.publication.json +25 -0
  215. package/docs/contracts/refusals.bound +51 -0
  216. package/docs/contracts/refusals.md +18 -3
  217. package/docs/contracts/refusals.publication.json +2 -2
  218. package/docs/contracts/views.md +8 -0
  219. package/docs/reference.md +1 -0
  220. package/package.json +23 -34
  221. package/receipts.bound +11627 -10323
  222. package/samples/reading-identity/no.json +20 -0
  223. package/samples/reading-identity/yes.json +46 -0
  224. package/vectors/native/reading-identity.vector.json +101 -0
  225. package/vectors/native/refusals.vector.json +104 -0
  226. package/vendor/syntax/LICENSE.md +7 -0
  227. package/vendor/syntax/parser.js +1 -0
  228. package/.github/workflows/release.yml +0 -67
  229. package/.github/workflows/test.yml +0 -35
  230. package/dist/engine/object.d.ts +0 -17
  231. package/dist/engine/ports.d.ts +0 -37
  232. package/dist/fold/claims.d.ts +0 -29
  233. package/dist/host/call-context.d.ts +0 -20
  234. package/dist/host/commit-result.d.ts +0 -6
  235. package/dist/host/in-process-act.d.ts +0 -82
  236. package/dist/host/in-process-context.d.ts +0 -46
  237. package/dist/host/in-process-root.d.ts +0 -117
  238. package/dist/host/in-process.d.ts +0 -41
  239. package/dist/host/native/module-closure.d.ts +0 -35
  240. package/dist/host/native-receiver.d.ts +0 -19
  241. package/dist/host/place-act-transaction.d.ts +0 -24
  242. package/dist/host/place-clock-selection.d.ts +0 -55
  243. package/dist/host/ports/local-act.d.ts +0 -44
  244. package/dist/host/ports/place-act.d.ts +0 -49
  245. package/dist/host/ports/publication.d.ts +0 -10
  246. package/dist/host/reference-export.d.ts +0 -33
  247. package/dist/host/reference-native.d.ts +0 -30
  248. package/dist/host/reference-profile.d.ts +0 -23
  249. package/dist/host/refusals.d.ts +0 -14
  250. package/dist/host/root-clock-source.d.ts +0 -86
@@ -1,50 +1 @@
1
- import { capsuleAt } from "./capsule.js";
2
- import { capsuleOffers, providerInputs, providerInputRegions, capsuleDescriptor, assertCapsuleDescriptor } from '@lapxo/topos/standing';
3
- import { fullDigest } from "./digest.js";
4
- import { wireAt, parse } from '@lapxo/topos/wire';
5
- import { selectedTopoi, toposAt } from "./selected-topos.js";
6
- import { canonical } from '@lapxo/topos/wire';
7
- import { fieldOf } from "../fold/claims.js";
8
- import { ownLock } from "../observe/runner.js";
9
- import { archiveCoordinate } from "./archive.js";
10
- /** Only explicit capsule offers request execution. Forms/classes/views do not need an executable alias. */
11
- export function selectedCapsules(pins, resolve = capsuleAt, select = toposAt, host = ownLock()) {
12
- return selectedTopoi(pins, select).flatMap(({ digest, topos }) => capsuleOffers(topos).map(offer => {
13
- const load = () => {
14
- const projections = host.filter(line => fieldOf(line, 'scope').startsWith('dep/') && fieldOf(line, 'role') === 'writes' && fieldOf(line, 'value') === offer.value);
15
- if (!projections.length || projections.some(line => !fieldOf(line, 'shape')))
16
- throw Error(`REFUSE·pin ${digest} capsule ${offer.value} needs one host projection`);
17
- const entries = [...new Set(projections.map(line => archiveCoordinate(fieldOf(line, 'shape'))))];
18
- if (entries.length !== 1)
19
- throw Error(`REFUSE·pin ${digest} capsule ${offer.value} has conflicting host projections`);
20
- const loaded = resolve(offer.value, entries[0]);
21
- if (loaded === undefined)
22
- throw Error(`REFUSE·pin ${digest} · ${offer.scope} · offered capsule ${offer.value} unavailable`);
23
- return { capsule: loaded, offer: canonical({ ...offer, shape: entries[0] }) };
24
- };
25
- const descriptor = capsuleDescriptor(topos, offer.scope ?? '');
26
- const loaded = descriptor === undefined ? load() : undefined;
27
- const supplied = loaded === undefined ? {
28
- digest: offer.value, selection: `${digest} ${offer.scope}`, ...descriptor, ask: (requests, reader) => {
29
- if (!requests.length)
30
- return [];
31
- const actual = load();
32
- assertCapsuleDescriptor(descriptor.lines, actual.capsule.lines);
33
- return actual.capsule.ask(requests, reader);
34
- },
35
- } : { ...loaded.capsule, selection: `${digest} ${offer.scope}` };
36
- const capsule = { ...supplied, selectedWorld: { standing: topos, offer: offer.scope ?? '' } };
37
- const projected = loaded?.offer ?? canonical(offer);
38
- if (!providerInputRegions(topos, offer.scope ?? '').length)
39
- return { capsule, offer: projected };
40
- const fields = ownLock().flatMap(line => { const p = parse(line); return p.kind === 'fact' ? [p.value.fields] : []; });
41
- const wire = wireAt(fields, Number.MAX_SAFE_INTEGER), algorithm = wire && [...wire.digests][0];
42
- if (!algorithm)
43
- throw Error('REFUSE·input instrument has no admitted digest algorithm');
44
- const selected = { ...capsule, selection: `${digest} ${offer.scope}`, ask: (requests, reader) => capsule.ask(requests.map(request => {
45
- const provider = providerInputs(topos, digest, offer.scope ?? '', offer.value, request.region ?? '', bytes => fullDigest(bytes, algorithm));
46
- return provider === undefined ? request : { ...request, provider };
47
- }), reader) };
48
- return { capsule: selected, offer: projected };
49
- }));
50
- }
1
+ var R=Object.defineProperty;var n=(l,c)=>R(l,"name",{value:c,configurable:!0});import{capsuleAt as k}from"./capsule.js";import{library7_capsuleOffers as A,library7_providerInputs as S,library7_providerInputRegions as D,library7_capsuleDescriptor as F,library7_assertCapsuleDescriptor as I}from"../vendor/runtime.js";import{fullDigest as j}from"./digest.js";import{library11_wireAt as C,library11_parse as U}from"../vendor/runtime.js";import{selectedTopoi as M,toposAt as O}from"./selected-topos.js";import{library11_canonical as $}from"../vendor/runtime.js";import{fieldOf as p}from"../fold/claims.js";import{ownLock as b}from"../observe/runner.js";import{archiveCoordinate as N}from"./archive.js";function Q(l,c=k,w=O,_=b()){return M(l,w).flatMap(({digest:o,topos:i})=>A(i).map(e=>{const h=n(()=>{const r=_.filter(t=>p(t,"scope").startsWith("dep/")&&p(t,"role")==="writes"&&p(t,"value")===e.value);if(!r.length||r.some(t=>!p(t,"shape")))throw Error(`REFUSE\xB7pin ${o} capsule ${e.value} needs one host projection`);const s=[...new Set(r.map(t=>N(p(t,"shape"))))];if(s.length!==1)throw Error(`REFUSE\xB7pin ${o} capsule ${e.value} has conflicting host projections`);const a=c(e.value,s[0]);if(a===void 0)throw Error(`REFUSE\xB7pin ${o} \xB7 ${e.scope} \xB7 offered capsule ${e.value} unavailable`);return{capsule:a,offer:$({...e,shape:s[0]})}},"load"),u=F(i,e.scope??""),d=u===void 0?h():void 0,m={...d===void 0?{digest:e.value,selection:`${o} ${e.scope}`,...u,ask:n((r,s)=>{if(!r.length)return[];const a=h();return I(u.lines,a.capsule.lines),a.capsule.ask(r,s)},"ask")}:{...d.capsule,selection:`${o} ${e.scope}`},selectedWorld:{standing:i,offer:e.scope??""}},v=d?.offer??$(e);if(!D(i,e.scope??"").length)return{capsule:m,offer:v};const g=b().flatMap(r=>{const s=U(r);return s.kind==="fact"?[s.value.fields]:[]}),f=C(g,Number.MAX_SAFE_INTEGER),E=f&&[...f.digests][0];if(!E)throw Error("REFUSE\xB7input instrument has no admitted digest algorithm");return{capsule:{...m,selection:`${o} ${e.scope}`,ask:n((r,s)=>m.ask(r.map(a=>{const t=S(i,o,e.scope??"",e.value,a.region??"",y=>j(y,E));return t===void 0?a:{...a,provider:t}}),s),"ask")},offer:v}}))}n(Q,"selectedCapsules");export{Q as selectedCapsules};
@@ -1,80 +1 @@
1
- import { verifiedContent } from "./content-store.js";
2
- import { readStanding } from '@lapxo/topos/standing';
3
- import { parse, wireAt, fromLine } from '@lapxo/topos/wire';
4
- import { fieldOf } from "../fold/claims.js";
5
- import { moduleClosure } from "./native/module-closure.js";
6
- import { sha256, isSha256 } from "./hash.js";
7
- /** Local grammar is sufficient for locally declared records. Resolve selected
8
- * contracts only when a reader is missing; a local refusal remains a refusal. */
9
- export function admittedLine(line, local, epoch, pins, resolve = toposAt) {
10
- const own = wireAt(local, epoch);
11
- // A signature era alone is not a configuration grammar. An absent list
12
- // must be supplied by the selected contract; an explicit local list remains
13
- // authoritative and may refuse a field without opening unrelated content.
14
- if (own && ['fields', 'required', 'roles', 'forms', 'at-classes'].every(name => own.lists.has(name))) {
15
- const got = fromLine(line, own);
16
- const needsObject = fieldOf(line, 'type') !== '' && !own.object;
17
- if (got.kind === 'fact' || (got.kind === 'refuse' && !needsObject))
18
- return got;
19
- }
20
- return fromLine(line, selectedWireAt(local, epoch, pins, resolve));
21
- }
22
- /** Resolve content using the instrument wire's admitted digest algorithms. No transport interpretation. */
23
- export function toposAt(digest, store) {
24
- const topos = readStanding(Buffer.from(contentAt(digest, store)).toString('utf8'));
25
- return topos;
26
- }
27
- export function contentAt(digest, store) {
28
- return verifiedContent(digest, store).bytes;
29
- }
30
- /** The declared module runs from the store that supplied its verified bytes. No copy or live-checkout fallback. */
31
- export function contextModuleAt(digest, store, dependencies) {
32
- if (dependencies !== undefined) {
33
- if (!isSha256(digest) || !dependencies.includes(digest) || dependencies.some(pin => !isSha256(pin)))
34
- throw Error('REFUSE·context module closure requires declared SHA-256 members');
35
- const pins = [...new Set(dependencies)].sort(), members = new Map(pins.map(pin => [pin.slice(pin.indexOf(':') + 1), { digest: pin, source: new TextDecoder('utf-8', { fatal: true }).decode(contentAt(pin, store)) }]));
36
- moduleClosure({ identity: sha256(JSON.stringify(pins)), entry: digest.slice(digest.indexOf(':') + 1), members }, () => undefined);
37
- }
38
- return verifiedContent(digest, store).path;
39
- }
40
- /** Selection verifies standing identity. Requested capabilities verify their artifact bytes separately. */
41
- export function selectedTopoi(pins, resolve = toposAt) {
42
- return [...new Set(pins.map(pin => fieldOf(pin, 'value')))].map(digest => ({ digest, topos: resolve(digest) }));
43
- }
44
- /** Read a declared wire list without copying a world's claims or executing its offers.
45
- * Independent declarations must agree; selection order cannot choose a contract.
46
- */
47
- export function selectedWireList(local, epoch, pins, list, resolve = toposAt) {
48
- const records = local.flatMap(line => { const got = parse(line); return got.kind === 'fact' ? [got.value.fields] : []; });
49
- const contracts = [{ name: 'place', wire: wireAt(records, epoch) }, ...selectedTopoi(pins, resolve).map(({ digest, topos }) => ({ name: digest, wire: wireAt(topos.parts, Number.MAX_SAFE_INTEGER) }))]
50
- .flatMap(({ name, wire }) => { const words = wire?.lists.get(list); return words === undefined ? [] : [{ name, words: [...words] }]; });
51
- if (!contracts.length)
52
- throw Error(`REFUSE·wire wire/${list} has no declared contract in the place or its selected topoi`);
53
- const first = contracts[0];
54
- if (contracts.some(({ words }) => words.length !== first.words.length || words.some(word => !first.words.includes(word))))
55
- throw Error(`REFUSE·wire wire/${list} has conflicting contracts · ${contracts.map(one => one.name).join(' · ')}`);
56
- return first.words;
57
- }
58
- /** Complete an admission snapshot from the selected standing. Local declarations
59
- * govern their own lists; independent selected contracts cannot choose by order. */
60
- export function selectedWireAt(local, epoch, pins, resolve = toposAt) {
61
- const own = wireAt(local, epoch);
62
- const worlds = selectedTopoi(pins, resolve).map(({ digest, topos }) => ({ digest, parts: topos.parts, wire: wireAt(topos.parts, Number.MAX_SAFE_INTEGER) }));
63
- const key = (scope) => scope.startsWith('wire/') ? scope.slice(5) : scope.startsWith('audit/wire/') ? scope.slice(11) : undefined;
64
- const declared = new Set(local.filter(f => Number(f.epoch ?? 0) <= epoch).map(f => key(f.scope ?? '')).filter((k) => k !== undefined));
65
- const selected = new Map();
66
- for (const world of worlds)
67
- for (const f of world.parts) {
68
- const name = key(f.scope ?? '');
69
- if (name === undefined || declared.has(name))
70
- continue;
71
- const list = world.wire?.lists.get(name);
72
- const value = list ? [...list].sort().join('|') : f.value ?? '';
73
- const previous = selected.get(name);
74
- if (previous && previous.value !== value)
75
- throw Error(`REFUSE·wire wire/${name} has conflicting selected contracts · ${previous.digest} · ${world.digest}`);
76
- if (!previous)
77
- selected.set(name, { value, fields: f, digest: world.digest });
78
- }
79
- return selected.size ? wireAt([...selected.values()].map(one => one.fields).concat(local), epoch) : own;
80
- }
1
+ var b=Object.defineProperty;var a=(t,r)=>b(t,"name",{value:r,configurable:!0});import{verifiedContent as S}from"./content-store.js";import{library7_readStanding as O}from"../vendor/runtime.js";import{library11_parse as F,library11_wireAt as m,library11_fromLine as g}from"../vendor/runtime.js";import{fieldOf as x}from"../fold/claims.js";import{moduleClosure as M}from"./native/module-closure.js";import{sha256 as N,isSha256 as y}from"./hash.js";function J(t,r,o,s,f=p){const n=m(r,o);if(n&&["fields","required","roles","forms","at-classes"].every(i=>n.lists.has(i))){const i=g(t,n),u=x(t,"type")!==""&&!n.object;if(i.kind==="fact"||i.kind==="refuse"&&!u)return i}return g(t,_(r,o,s,f))}a(J,"admittedLine");function p(t,r){return O(Buffer.from(v(t,r)).toString("utf8"))}a(p,"toposAt");function v(t,r){return S(t,r).bytes}a(v,"contentAt");function R(t,r,o){if(!Array.isArray(o)||!y(t)||!o.includes(t)||o.some(n=>!y(n)))throw Error("REFUSE\xB7context module closure requires declared SHA-256 members");const s=[...new Set(o)].sort(),f=new Map(s.map(n=>[n.slice(n.indexOf(":")+1),{digest:n,source:new TextDecoder("utf-8",{fatal:!0}).decode(v(n,r))}]));return M({identity:N(JSON.stringify(s)),entry:t.slice(t.indexOf(":")+1),members:f},()=>{},{esmOnly:!0}),S(t,r).path}a(R,"contextModuleAt");function q(t){const r=new Map;return{topos:a(o=>{const s=p(o,t);for(const f of s.parts.filter(n=>n.kind==="check"&&n.value)){const n=[...new Set((f.restsOn??"").split("|").filter(Boolean))].sort(),i=r.get(f.value);if(i&&JSON.stringify(i)!==JSON.stringify(n))throw Error("REFUSE\xB7context module has conflicting declared closures");r.set(f.value,n)}return s},"topos"),module:a(o=>{const s=r.get(o);if(s===void 0)throw Error("REFUSE\xB7context module has no declared closure");return R(o,t,s)},"module")}}a(q,"contextProviderServices");function A(t,r=p){return[...new Set(t.map(o=>x(o,"value")))].map(o=>({digest:o,topos:r(o)}))}a(A,"selectedTopoi");function B(t,r,o,s,f=p){const n=t.flatMap(c=>{const e=F(c);return e.kind==="fact"?[e.value.fields]:[]}),i=[{name:"place",wire:m(n,r)},...A(o,f).map(({digest:c,topos:e})=>({name:c,wire:m(e.parts,Number.MAX_SAFE_INTEGER)}))].flatMap(({name:c,wire:e})=>{const d=e?.lists.get(s);return d===void 0?[]:[{name:c,words:[...d]}]});if(!i.length)throw Error(`REFUSE\xB7wire wire/${s} has no declared contract in the place or its selected topoi`);const u=i[0];if(i.some(({words:c})=>c.length!==u.words.length||c.some(e=>!u.words.includes(e))))throw Error(`REFUSE\xB7wire wire/${s} has conflicting contracts \xB7 ${i.map(c=>c.name).join(" \xB7 ")}`);return u.words}a(B,"selectedWireList");function _(t,r,o,s=p){const f=m(t,r),n=A(o,s).map(({digest:e,topos:d})=>({digest:e,parts:d.parts,wire:m(d.parts,Number.MAX_SAFE_INTEGER)})),i=a(e=>e.startsWith("wire/")?e.slice(5):e.startsWith("audit/wire/")?e.slice(11):void 0,"key"),u=new Set(t.filter(e=>Number(e.epoch??0)<=r).map(e=>i(e.scope??"")).filter(e=>e!==void 0)),c=new Map;for(const e of n)for(const d of e.parts){const l=i(d.scope??"");if(l===void 0||u.has(l))continue;const E=e.wire?.lists.get(l),h=E?[...E].sort().join("|"):d.value??"",w=c.get(l);if(w&&w.value!==h)throw Error(`REFUSE\xB7wire wire/${l} has conflicting selected contracts \xB7 ${w.digest} \xB7 ${e.digest}`);w||c.set(l,{value:h,fields:d,digest:e.digest})}return c.size?m([...c.values()].map(e=>e.fields).concat(t),r):f}a(_,"selectedWireAt");export{J as admittedLine,v as contentAt,R as contextModuleAt,q as contextProviderServices,A as selectedTopoi,_ as selectedWireAt,B as selectedWireList,p as toposAt};
@@ -1,12 +1 @@
1
- import { wireLine } from "../fold/wire.js";
2
- import { fieldOf } from "../fold/claims.js";
3
- /** Pure signature vocabulary; no instrument discovery for diagnostics. */
4
- export function signatureEraOf(standing) {
5
- const said = wireLine(standing, 'signature-algorithms');
6
- const admitted = (said === undefined ? [] : fieldOf(said, 'value').split('|')).filter(Boolean);
7
- const current = wireLine(standing, 'era');
8
- const era = (current === undefined ? undefined : admitted.find((one) => one.endsWith(`:${fieldOf(current, 'value')}`))) ?? admitted.find((one) => one.includes(':'));
9
- if (era === undefined)
10
- throw new Error(`REFUSE·runtime the lock names no signature algorithm by digest: nothing can be signed here`);
11
- return { admitted, era };
12
- }
1
+ var s=Object.defineProperty;var d=(e,n)=>s(e,"name",{value:n,configurable:!0});import{wireLine as a}from"../fold/wire.js";import{fieldOf as f}from"../fold/claims.js";function m(e){const n=a(e,"signature-algorithms"),i=(n===void 0?[]:f(n,"value").split("|")).filter(Boolean),t=a(e,"era"),o=(t===void 0?void 0:i.find(r=>r.endsWith(`:${f(t,"value")}`)))??i.find(r=>r.includes(":"));if(o===void 0)throw new Error("REFUSE\xB7runtime the lock names no signature algorithm by digest: nothing can be signed here");return{admitted:i,era:o}}d(m,"signatureEraOf");export{m as signatureEraOf};
@@ -1,48 +1,2 @@
1
- import { invokeSigningPort } from "../engine/ports.js";
2
- import { readFileSync } from 'node:fs';
3
- import { parse, signerSelection, signerRequestBytes, signerResponseBytes, signerResponseOf } from '@lapxo/topos/wire';
4
- import { invokeSigner, SigningFailure } from "./ports/signing.js";
5
- /** An explicitly supplied host registry; a repository cannot supply executable bindings. */
6
- function binding(name, keyFile) {
7
- if (name === 'file') {
8
- if (!keyFile)
9
- throw new SigningFailure('REFUSE·signer file needs --key-file');
10
- return { kind: 'file', path: keyFile };
11
- }
12
- if (keyFile)
13
- throw new SigningFailure('REFUSE·signer command cannot use --key-file');
14
- const path = process.env['BOUND_SIGNERS'];
15
- if (!path)
16
- throw new SigningFailure('REFUSE·signer no host binding registry');
17
- try {
18
- const registry = JSON.parse(readFileSync(path, 'utf8'));
19
- if (!registry || typeof registry !== 'object' || !Object.prototype.hasOwnProperty.call(registry, name))
20
- throw Error();
21
- const record = registry[name];
22
- if (!record || typeof record !== 'object')
23
- throw Error();
24
- const f = record;
25
- if (f['kind'] !== 'command' || typeof f['executable'] !== 'string' || !f['executable']
26
- || !Array.isArray(f['args']) || !f['args'].every(a => typeof a === 'string'))
27
- throw Error();
28
- return { kind: 'command', executable: f['executable'], args: f['args'] };
29
- }
30
- catch {
31
- throw new SigningFailure('REFUSE·signer host binding unavailable or invalid');
32
- }
33
- }
34
- /** Resolve data before acquisition; all mechanisms use one wire protocol and verification path. */
35
- export function signerFor(lines, keyId, selected, keyFile, injected) {
36
- const fields = lines.flatMap(line => { const got = parse(line); return got.kind === 'fact' ? [got.value.fields] : []; });
37
- const declaration = signerSelection(fields, keyId);
38
- if (selected !== undefined && selected !== declaration.name)
39
- throw new SigningFailure(`REFUSE·signer ${keyId} CLI selection conflicts with declaration`);
40
- if (injected) {
41
- if (injected.name !== declaration.name || keyFile)
42
- throw new SigningFailure('REFUSE·signer injected host binding conflicts with declaration or key file');
43
- return (lot) => invokeSigningPort(lot, injected.sign, { timeoutMs: declaration.timeoutMs, maxBytes: declaration.responseBytes }, injected.signal);
44
- }
45
- const mechanism = binding(declaration.name, keyFile);
46
- const protocol = { request: signerRequestBytes, response: signerResponseBytes, reply: signerResponseOf };
47
- return (lot) => invokeSigner(lot, mechanism, protocol, declaration);
48
- }
1
+ var d=Object.defineProperty;var a=(t,n)=>d(t,"name",{value:n,configurable:!0});import{invokeSigningPort as h}from"../engine/ports.js";import{readFileSync as w}from"node:fs";import{library11_parse as S,library11_signerSelection as b,library11_signerRequestBytes as E,library11_signerResponseBytes as l,library11_signerResponseOf as p}from"../vendor/runtime.js";import{invokeSigner as u,SigningFailure as c}from"./ports/signing.js";function y(t,n){if(t==="file"){if(!n)throw new c("REFUSE\xB7signer file needs --key-file");return{kind:"file",path:n}}if(n)throw new c("REFUSE\xB7signer command cannot use --key-file");const o=process.env.BOUND_SIGNERS;if(!o)throw new c("REFUSE\xB7signer no host binding registry");try{const i=JSON.parse(w(o,"utf8"));if(!i||typeof i!="object"||!Object.prototype.hasOwnProperty.call(i,t))throw Error();const r=i[t];if(!r||typeof r!="object")throw Error();const e=r;if(e.kind!=="command"||typeof e.executable!="string"||!e.executable||!Array.isArray(e.args)||!e.args.every(s=>typeof s=="string"))throw Error();return{kind:"command",executable:e.executable,args:e.args}}catch{throw new c("REFUSE\xB7signer host binding unavailable or invalid")}}a(y,"binding");function m(t,n,o){const i=t.flatMap(e=>{const s=S(e);return s.kind==="fact"?[s.value.fields]:[]}),r=b(i,n);if(o!==void 0&&o!==r.name)throw new c(`REFUSE\xB7signer ${n} CLI selection conflicts with declaration`);return r}a(m,"declaredSigner");function O(t,n,o,i,r){const e=m(t,n,o);if(r){if(r.name!==e.name||i)throw new c("REFUSE\xB7signer injected host binding conflicts with declaration or key file");return g=>h(g,r.sign,{timeoutMs:e.timeoutMs,maxBytes:e.responseBytes},r.signal)}const s=y(e.name,i),f={request:E,response:l,reply:p};return g=>u(g,s,f,e)}a(O,"signerFor");function U(t,n,o,i){const r=m(t,n,o),e=y(r.name,i),s={request:a(f=>JSON.stringify(f)+`
2
+ `,"request"),response:l,reply:p};return f=>u(f,e,s,r)}a(U,"frameSignerFor");export{U as frameSignerFor,O as signerFor};
@@ -1,111 +1,2 @@
1
- import { hostOutput } from "./call-context.js";
2
- import { transportBytes } from "./ports/transport.js";
3
- import { contentStore, verifiedContent } from "./content-store.js";
4
- import { ContentNeeded } from "./content-needed.js";
5
- import { createHash } from 'node:crypto';
6
- import { parse, wireAt } from '@lapxo/topos/wire';
7
- import { landBlob } from "../land/ledger.js";
8
- import { ownLock } from "../observe/runner.js";
9
- /** Transport uses declared locations; only the requested digest admits bytes into the cache. */
10
- export async function resolveSelectedContent(lines, port, requested) {
11
- const fields = lines.flatMap(line => { const p = parse(line); return p.kind === 'fact' && p.value.fields.value !== 'withdraw' ? [p.value.fields] : []; });
12
- const selectionIndex = (scope) => { const match = /(^|\/)uses\//.exec(scope); return match === null ? -1 : match.index + match[1].length; };
13
- // A dependency constraint is not a content binding. Historical artifact records
14
- // use measure=id; explicit digest records still validate even when malformed.
15
- const bindings = fields.filter(f => selectionIndex(f.scope ?? '') >= 0 ||
16
- (f.scope?.startsWith('dep/') && (f.measure === 'digest' || /^[a-zA-Z][a-zA-Z0-9-]*:[a-f0-9]+$/.test(f.value ?? ''))));
17
- const locations = new Map();
18
- for (const binding of bindings) {
19
- const scope = binding.scope ?? '';
20
- const index = selectionIndex(scope);
21
- const sourceScope = index >= 0 ? scope.slice(0, index) + 'sources/' + scope.slice(index + 5) : 'sources/' + scope.slice(4);
22
- const urls = fields.filter(f => f.scope === sourceScope).map(f => f.value ?? '');
23
- if (urls.length)
24
- locations.set(binding.value ?? '', [...new Set([...(locations.get(binding.value ?? '') ?? []), ...urls])]);
25
- }
26
- const received = [];
27
- const validate = (digest) => {
28
- const split = digest.indexOf(':');
29
- const algorithm = digest.slice(0, split), hex = digest.slice(split + 1);
30
- if (split < 1 || !port.algorithms.has(algorithm) || !/^[a-f0-9]+$/.test(hex))
31
- throw Error(`REFUSE·pin ${digest} digest is not admitted`);
32
- return { algorithm, hex };
33
- };
34
- const ensure = async (digest) => {
35
- const { algorithm, hex } = validate(digest);
36
- const verify = (bytes) => {
37
- if (createHash(algorithm).update(bytes).digest('hex') !== hex)
38
- throw Error(`REFUSE·pin ${digest} content hash mismatch · not laid`);
39
- return bytes;
40
- };
41
- const cached = port.read(digest);
42
- if (cached !== undefined)
43
- return verify(cached);
44
- const urls = locations.get(digest) ?? [];
45
- if (!urls.length)
46
- throw Error(`REFUSE·pin ${digest} content unavailable · no declared source · not laid`);
47
- let last;
48
- for (const url of urls) {
49
- let bytes;
50
- try {
51
- bytes = await port.fetch(url, digest);
52
- }
53
- catch (error) {
54
- last = error;
55
- continue;
56
- }
57
- verify(bytes);
58
- port.write(digest, bytes);
59
- received.push(digest);
60
- return bytes;
61
- }
62
- throw Error(`REFUSE·source ${digest} ${last instanceof Error ? last.message : 'declared sources unavailable'}`);
63
- };
64
- for (const digest of new Set(requested))
65
- await ensure(digest);
66
- return received;
67
- }
68
- /** Exact resource URLs; no repository checkout or inferred release. */
69
- export async function resolveSources(standing, requested) {
70
- const instrument = ownLock().flatMap(line => { const p = parse(line); return p.kind === 'fact' ? [p.value.fields] : []; });
71
- const wire = wireAt(instrument, Number.MAX_SAFE_INTEGER);
72
- if (wire === null)
73
- throw Error('REFUSE·pin instrument has no admitted wire');
74
- const bindings = ownLock().filter(line => {
75
- const p = parse(line);
76
- if (p.kind !== 'fact')
77
- return false;
78
- const fields = p.value.fields;
79
- return fields.scope?.startsWith('sources/') || fields.scope?.startsWith('dep/');
80
- });
81
- const received = await resolveSelectedContent([...standing, ...bindings], {
82
- algorithms: wire.digests,
83
- read: digest => { try {
84
- return verifiedContent(digest).bytes;
85
- }
86
- catch (error) {
87
- if (error instanceof ContentNeeded)
88
- return undefined;
89
- throw error;
90
- } },
91
- write: (digest, bytes) => { landBlob(contentStore(), digest, bytes); },
92
- fetch: async (url, digest) => transportBytes(url, digest, [...ownLock(), ...standing]),
93
- }, requested);
94
- for (const digest of received)
95
- hostOutput('out', `FETCHED ${digest} · verified\n`);
96
- }
97
- /** A changed verified store is the only reason to retry. A repeated miss never loops or changes a named pin. */
98
- export async function resolveRequested(resolve, fold) {
99
- const attempted = new Set();
100
- for (;;) {
101
- try {
102
- return await fold();
103
- }
104
- catch (error) {
105
- if (!(error instanceof ContentNeeded) || attempted.has(error.digest))
106
- throw error;
107
- attempted.add(error.digest);
108
- await resolve(error.digest);
109
- }
110
- }
111
- }
1
+ var $=Object.defineProperty;var s=(c,i)=>$(c,"name",{value:i,configurable:!0});import{hostOutput as F}from"./call-context.js";import{transportBytes as R}from"./ports/transport.js";import{contentStore as A,verifiedContent as U}from"./content-store.js";import{ContentNeeded as x}from"./content-needed.js";import{createHash as k}from"node:crypto";import{library11_parse as y,library11_wireAt as C}from"../vendor/runtime.js";import{landBlob as M}from"../land/ledger.js";import{ownLock as S}from"../observe/runner.js";async function _(c,i,u){const n=c.flatMap(e=>{const t=y(e);return t.kind==="fact"&&t.value.fields.value!=="withdraw"?[t.value.fields]:[]}),h=s(e=>{const t=/(^|\/)uses\//.exec(e);return t===null?-1:t.index+t[1].length},"selectionIndex"),E=n.filter(e=>h(e.scope??"")>=0||e.scope?.startsWith("dep/")&&(e.measure==="digest"||/^[a-zA-Z][a-zA-Z0-9-]*:[a-f0-9]+$/.test(e.value??""))),r=new Map;for(const e of E){const t=e.scope??"",a=h(t),l=a>=0?t.slice(0,a)+"sources/"+t.slice(a+5):"sources/"+t.slice(4),d=n.filter(f=>f.scope===l).map(f=>f.value??"");d.length&&r.set(e.value??"",[...new Set([...r.get(e.value??"")??[],...d])])}const o=[],p=s(e=>{const t=e.indexOf(":"),a=e.slice(0,t),l=e.slice(t+1);if(t<1||!i.algorithms.has(a)||!/^[a-f0-9]+$/.test(l))throw Error(`REFUSE\xB7pin ${e} digest is not admitted`);return{algorithm:a,hex:l}},"validate"),b=s(async e=>{const{algorithm:t,hex:a}=p(e),l=s(m=>{if(k(t).update(m).digest("hex")!==a)throw Error(`REFUSE\xB7pin ${e} content hash mismatch \xB7 not laid`);return m},"verify"),d=i.read(e);if(d!==void 0)return l(d);const f=r.get(e)??[];if(!f.length)throw Error(`REFUSE\xB7pin ${e} content unavailable \xB7 no declared source \xB7 not laid`);let v;for(const m of f){let w;try{w=await i.fetch(m,e)}catch(g){v=g;continue}return l(w),i.write(e,w),o.push(e),w}throw Error(`REFUSE\xB7source ${e} ${v instanceof Error?v.message:"declared sources unavailable"}`)},"ensure");for(const e of new Set(u))await b(e);return o}s(_,"resolveSelectedContent");async function q(c,i){const u=S().flatMap(r=>{const o=y(r);return o.kind==="fact"?[o.value.fields]:[]}),n=C(u,Number.MAX_SAFE_INTEGER);if(n===null)throw Error("REFUSE\xB7pin instrument has no admitted wire");const h=S().filter(r=>{const o=y(r);if(o.kind!=="fact")return!1;const p=o.value.fields;return p.scope?.startsWith("sources/")||p.scope?.startsWith("dep/")}),E=await _([...c,...h],{algorithms:n.digests,read:s(r=>{try{return U(r).bytes}catch(o){if(o instanceof x)return;throw o}},"read"),write:s((r,o)=>{M(A(),r,o)},"write"),fetch:s(async(r,o)=>R(r,o,[...S(),...c]),"fetch")},i);for(const r of E)F("out",`FETCHED ${r} \xB7 verified
2
+ `)}s(q,"resolveSources");async function D(c,i){const u=new Set;for(;;)try{return await i()}catch(n){if(!(n instanceof x)||u.has(n.digest))throw n;u.add(n.digest),await c(n.digest)}}s(D,"resolveRequested");export{D as resolveRequested,_ as resolveSelectedContent,q as resolveSources};
@@ -1,18 +1 @@
1
- import { PLACE_ACT_CONTEXT } from '@lapxo/topos/core';
2
- import { foldClaims, fieldOf } from "../fold/claims.js";
3
- /** Projection only, after the caller authenticates the complete carrier. The
4
- * CLI and in-process reader use this same fold and output shape. */
5
- export function projectContextualStanding(root, legacy, contexts, decoded) {
6
- const groups = new Map();
7
- for (const act of contexts) {
8
- const context = decoded.find(one => one.identity === act.identity).context;
9
- for (const p of context.places) {
10
- const key = JSON.stringify([context.root.namespace, p.place]), group = groups.get(key) ?? { namespace: context.root.namespace, place: p.place, lines: [], contexts: [] };
11
- group.lines.push(...p.records);
12
- group.contexts.push({ identity: act.identity, context: act.context, receipts: act.receipts });
13
- groups.set(key, group);
14
- }
15
- }
16
- const legacyPlaces = legacy.map(place => ({ namespace: 'legacy-global', place: place.place, standing: foldClaims(place.history).standing.filter(line => fieldOf(line, 'value') !== 'withdraw'), history: place.history }));
17
- return { profile: PLACE_ACT_CONTEXT, root, legacyPlaces, contexts, places: [...groups.values()].map(group => { const folded = foldClaims(group.lines); return { namespace: group.namespace, place: group.place, standing: folded.standing.filter(line => fieldOf(line, 'value') !== 'withdraw'), retracted: folded.retracted, superseded: folded.superseded, forks: folded.forks, contexts: group.contexts }; }) };
18
- }
1
+ var y=Object.defineProperty;var l=(n,a)=>y(n,"name",{value:a,configurable:!0});import{library3_PLACE_ACT_CONTEXT as u}from"../vendor/runtime.js";import{foldClaims as p,fieldOf as d}from"../fold/claims.js";function h(n,a,r,f){const o=new Map;for(const e of r){const t=f.find(s=>s.identity===e.identity).context;for(const s of t.places){const i=JSON.stringify([t.root.namespace,s.place]),c=o.get(i)??{namespace:t.root.namespace,place:s.place,lines:[],contexts:[]};c.lines.push(...s.records),c.contexts.push({identity:e.identity,context:e.context,receipts:e.receipts}),o.set(i,c)}}const m=a.map(e=>({namespace:"legacy-global",place:e.place,standing:p(e.history).standing.filter(t=>d(t,"value")!=="withdraw"),history:e.history}));return{profile:u,root:n,legacyPlaces:m,contexts:r,places:[...o.values()].map(e=>{const t=p(e.lines);return{namespace:e.namespace,place:e.place,standing:t.standing.filter(s=>d(s,"value")!=="withdraw"),retracted:t.retracted,superseded:t.superseded,forks:t.forks,contexts:e.contexts}})}}l(h,"projectContextualStanding");export{h as projectContextualStanding};
@@ -1,50 +1 @@
1
- import { viewsOf } from "../fold/views.js";
2
- import { BoundRefusal } from "./refusals.js";
3
- import { authorityFor } from "../fold/signers.js";
4
- import { signatureEraOf as eraOf } from "./signature-era.js";
5
- import { fieldOf, foldClaims, isConfig } from "../fold/claims.js";
6
- import { foldedEvidence } from '@lapxo/topos/contract';
7
- /** Project the supplied signed history against the host's original trust anchor.
8
- * No current-root selection, storage access, effects or retained authority.
9
- * The file host and the in-process host use this same admission-snapshot fold. */
10
- export function projectAuthenticatedStanding(history, anchor) {
11
- const snapshots = new Map();
12
- const admitted = history.filter(line => {
13
- const epoch = Number(fieldOf(line, 'epoch')) || 0;
14
- let authority = snapshots.get(epoch);
15
- if (!authority) {
16
- // This invocation has freshly read the complete signed inventory. Derive
17
- // the same historical cutoff without reopening it for every epoch; the
18
- // next invocation still rereads every authority input.
19
- const snapshot = history.filter(record => !isConfig(record) || Number(fieldOf(record, 'epoch')) <= epoch);
20
- // The signature vocabulary is configuration, not the as-yet
21
- // unauthenticated evidence whose values are about to be folded.
22
- const wire = snapshot.filter(record => {
23
- const scope = fieldOf(record, 'scope');
24
- return scope.startsWith('wire/') || scope.startsWith('audit/wire/');
25
- });
26
- authority = authorityFor(snapshot, anchor, eraOf(foldClaims(wire).standing).admitted);
27
- snapshots.set(epoch, authority);
28
- }
29
- return authority.of(line).kind === 'admitted';
30
- });
31
- // The host authenticates against historical authority; Topos projects the
32
- // authenticated history using the instrument's existing fold.
33
- const { standing } = foldedEvidence(admitted, {
34
- classification: () => 'local',
35
- fold: lines => foldClaims(lines).standing,
36
- });
37
- return [...standing];
38
- }
39
- /** One check shared by the CLI and the read-only native host. */
40
- export function assertStandingView(lines) {
41
- const view = viewsOf(lines).get('standing');
42
- if (!view || view.shape || !view.regions.some(region => region.name === 'standing'))
43
- throw new BoundRefusal('standing/view', 'REFUSE·view standing requires a declared standing view');
44
- }
45
- export function publicStandingProjection(history, anchor) {
46
- return publishedStandingLines(projectAuthenticatedStanding(history, anchor));
47
- }
48
- export function publishedStandingLines(standing) {
49
- return standing.filter(line => !isConfig(line) || fieldOf(line, 'value') !== 'withdraw');
50
- }
1
+ var w=Object.defineProperty;var e=(i,t)=>w(i,"name",{value:t,configurable:!0});import{viewsOf as h}from"../fold/views.js";import{BoundRefusal as v}from"./refusals.js";import{authorityFor as b}from"../fold/signers.js";import{signatureEraOf as E}from"./signature-era.js";import{fieldOf as a,foldClaims as p,isConfig as u}from"../fold/claims.js";import{library2_foldedEvidence as S}from"../vendor/runtime.js";function x(i,t){const n=new Map,m=i.filter(o=>{const d=Number(a(o,"epoch"))||0;let r=n.get(d);if(!r){const f=i.filter(s=>!u(s)||Number(a(s,"epoch"))<=d),g=f.filter(s=>{const c=a(s,"scope");return c.startsWith("wire/")||c.startsWith("audit/wire/")});r=b(f,t,E(p(g).standing).admitted),n.set(d,r)}return r.of(o).kind==="admitted"}),{standing:l}=S(m,{classification:e(()=>"local","classification"),fold:e(o=>p(o).standing,"fold")});return[...l]}e(x,"projectAuthenticatedStanding");function k(i){const t=h(i).get("standing");if(!t||t.shape||!t.regions.some(n=>n.name==="standing"))throw new v("standing/view","REFUSE\xB7view standing requires a declared standing view")}e(k,"assertStandingView");function q(i,t){return O(x(i,t))}e(q,"publicStandingProjection");function O(i){return i.filter(t=>!u(t)||a(t,"value")!=="withdraw")}e(O,"publishedStandingLines");export{k as assertStandingView,x as projectAuthenticatedStanding,q as publicStandingProjection,O as publishedStandingLines};
@@ -1,7 +1 @@
1
- /** Record completed synchronous host work without changing its result or refusal. */
2
- export const timing = (spent) => (what, fn) => {
3
- const at = Date.now();
4
- const got = fn();
5
- spent.push(`${what} ${Date.now() - at}`);
6
- return got;
7
- };
1
+ var c=Object.defineProperty;var o=(t,n)=>c(t,"name",{value:n,configurable:!0});const g=o(t=>(n,e)=>{const s=Date.now(),a=e();return t.push(`${n} ${Date.now()-s}`),a},"timing");export{g as timing};