@lapxo/bound 0.1.3 → 0.1.4
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/README.md +5 -5
- package/TARGET.bound +24 -9
- package/dist/cli/verb.js +8 -2
- package/dist/fold/observed.js +8 -6
- package/dist/fold/readers.d.ts +2 -0
- package/dist/fold/readers.js +3 -3
- package/dist/host/adapters/transport/http.d.ts +5 -0
- package/dist/host/adapters/transport/http.js +28 -0
- package/dist/host/capsule-process.d.ts +2 -1
- package/dist/host/capsule-process.js +4 -3
- package/dist/host/capsule.d.ts +1 -0
- package/dist/host/capsule.js +8 -10
- package/dist/host/cell-receipts.js +1 -1
- package/dist/host/content-store.d.ts +8 -0
- package/dist/host/content-store.js +31 -0
- package/dist/host/lifetime.d.ts +1 -0
- package/dist/host/lifetime.js +40 -0
- package/dist/host/objects.js +1 -1
- package/dist/host/ports/transport.d.ts +1 -0
- package/dist/host/ports/transport.js +48 -0
- package/dist/host/process-lifetime.d.ts +11 -0
- package/dist/host/process-lifetime.js +12 -0
- package/dist/host/selected-capsules.js +38 -12
- package/dist/host/selected-topos.d.ts +4 -4
- package/dist/host/selected-topos.js +8 -30
- package/dist/host/source-content.d.ts +1 -1
- package/dist/host/source-content.js +15 -15
- package/dist/observe/identity.d.ts +2 -0
- package/dist/observe/identity.js +3 -3
- package/dist/observe/run.d.ts +2 -1
- package/dist/observe/run.js +5 -3
- package/dist/render/receipts.js +2 -1
- package/package.json +2 -2
- package/receipts.bound +73 -75
package/README.md
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
Declare what must hold. Read what does. Keep the evidence
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npx @lapxo/bound@0.1.
|
|
9
|
-
npx @lapxo/bound@0.1.
|
|
8
|
+
npx @lapxo/bound@0.1.4 fold --as help
|
|
9
|
+
npx @lapxo/bound@0.1.4 fold
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
## How Bound reads a project
|
|
@@ -49,11 +49,11 @@ lot_dir="$(mktemp -d)"
|
|
|
49
49
|
Have the selected view produce a proposal at `$lot_dir/proposal.bound`, or prepare the project's permitted lines there for review. Unsigned proposals use `by=target`, without a preassigned epoch or `sig`. Lots stay outside the repository; the committed bound files are only `TARGET.bound` and `receipts.bound`.
|
|
50
50
|
|
|
51
51
|
```sh
|
|
52
|
-
npx @lapxo/bound@0.1.
|
|
52
|
+
npx @lapxo/bound@0.1.4 sign "$lot_dir/proposal.bound" \
|
|
53
53
|
--key "$BOUND_KEY_ID" --key-file "$BOUND_KEY_FILE" \
|
|
54
54
|
> "$lot_dir/signed.bound" &&
|
|
55
|
-
npx @lapxo/bound@0.1.
|
|
56
|
-
npx @lapxo/bound@0.1.
|
|
55
|
+
npx @lapxo/bound@0.1.4 land "$lot_dir/signed.bound" &&
|
|
56
|
+
npx @lapxo/bound@0.1.4 fold
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
`sign` assigns the admitted epoch and writes the signed lot to stdout. `land` validates the whole lot before admission. A refusal is evidence to inspect; it is not success. Do not proceed after a failed signature or admission. The key file is a PKCS8 private key matching the admitted public key; do not put it in the lot, source tree, package or CI artifacts.
|
package/TARGET.bound
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
bound-lock/1 about="# @lapxo/bound\n\nDeclare what must hold. Read what does. Keep the evidence.\n\nBound reads a project's admitted statements, checks observations against its requirements, and produces the views its selected topos declares. It keeps conflicting evidence and its origins instead of choosing a convenient answer.\n\n`fold` reads. `sign` signs a proposed lot. `land` admits that lot under the place's authority. These acts work across domains: a selected topos supplies forms, units, readers and views.\n\n## Start in an admitted project\n\n```sh\nnpx @lapxo/bound@0.1.
|
|
1
|
+
bound-lock/1 about="# @lapxo/bound\n\nDeclare what must hold. Read what does. Keep the evidence.\n\nBound reads a project's admitted statements, checks observations against its requirements, and produces the views its selected topos declares. It keeps conflicting evidence and its origins instead of choosing a convenient answer.\n\n`fold` reads. `sign` signs a proposed lot. `land` admits that lot under the place's authority. These acts work across domains: a selected topos supplies forms, units, readers and views.\n\n## Start in an admitted project\n\n```sh\nnpx @lapxo/bound@0.1.4 fold --as help\nnpx @lapxo/bound@0.1.4 fold\n```\n\nThe help view prints:\n\n```text\nverbs fold land sign\nflags --as --check --key --key-file --signer --place\n```\n\nThe default fold runs the project's declared views. Its authority and selected topos determine what can be admitted, read and shown.\n\nStart with the team's accepted TARGET, admitted authority and selected readers. [Full usage guide](https://github.com/Lapxo/bound/blob/2053bb6d6188f04538114eae6a0add5166944ed3/docs/usage.md).\n\n## A meeting everyone can understand\n\nAna is available from 10 to 14, Luis from 12 to 16, and the room from 10 to 13. Their common availability is 12 to 13. A boss available from 18 to 20 makes the encounter incompatible. Withdrawing that exact reading restores the overlap; Ana, Luis and the room remain.\n\nWith an interval form, those are object operations: observe independent claims, meet them, withdraw by id, and read the state. A narrower compatible meet is not a fork. Folding a file of declarations alone does not calculate meeting availability.\n\nThe same pattern applies to a delivery window, a sensor's allowed range, or an agreed performance budget. The chosen topos determines the units and how evidence is obtained. Bound does not supply a meeting-specific rule.\n\n## See how information holds together\n\n\n\nA travelling ceiling on B reaches C and G through their declared rest. A local join widens B alone. D is independent. The figure shows those relations; point size and camera distance do not measure information.\n\n| State | Meaning |\n| --- | --- |\n| REQUIRED | Compatible bounds, fewer than two independent origins. |\n| FREE | Independent origins meet and their encounter fits the bounds. |\n| CONFLICT | Bounds conflict, or eligible claims have no common encounter. |\n| FORBIDDEN | An inhabited encounter does not fit the bounds. |\n\nBounds are checked before origins and claims. A receipt is evidence of a reading, not another origin. Duplicating one does not add freedom.\n\n## Change a project without erasing evidence\n\nWork in the project's directory. Use an existing admitted key identifier and its matching private key stored outside every repository. The admitted key also names its signer with `keys/<who> measure=signer value=file`; `signer/timeout` and `signer/response-bytes` declare its limits. Your public key and coverage belong to the authority contract; possession of a private key alone does not authorize a scope.\n\n```sh\nexport BOUND_KEY_ID='your-admitted-key-id'\nexport BOUND_KEY_FILE=\"$HOME/Private/keys/your-device.pem\"\nlot_dir=\"$(mktemp -d)\"\n```\n\nHave the selected view produce a proposal at `$lot_dir/proposal.bound`, or prepare the project's permitted lines there for review. Unsigned proposals use `by=target`, without a preassigned epoch or `sig`. Lots stay outside the repository; the committed bound files are only `TARGET.bound` and `receipts.bound`.\n\n```sh\nnpx @lapxo/bound@0.1.4 sign \"$lot_dir/proposal.bound\" \\\n --key \"$BOUND_KEY_ID\" --key-file \"$BOUND_KEY_FILE\" \\\n > \"$lot_dir/signed.bound\" &&\nnpx @lapxo/bound@0.1.4 land \"$lot_dir/signed.bound\" &&\nnpx @lapxo/bound@0.1.4 fold\n```\n\n`sign` assigns the admitted epoch and writes the signed lot to stdout. `land` validates the whole lot before admission. A refusal is evidence to inspect; it is not success. Do not proceed after a failed signature or admission. The key file is a PKCS8 private key matching the admitted public key; do not put it in the lot, source tree, package or CI artifacts.\n\nFor typed object withdrawals, `takes` names the exact claim or mark id. Removing a local join leaves the travelling sign live. For untyped configuration, use the wire's exact withdrawal selectors; do not combine withdrawal and replacement with identical selectors in one lot. Wire alphabet updates supersede by epoch.\n\n[Authority, withdrawals, receipts and PR review](docs/usage.md).\n\n## Read a declared view and reuse its evidence\n\nWhen the project has admitted a cells view:\n\n```sh\nnpx @lapxo/bound@0.1.4 fold --as cells\n```\n\nThe installed interval scene printed this on an unchanged second reading:\n\n```text\nRECEIPTS 4 read · 0 opened · idle · provider 0\n```\n\nNative receipts identify the live semantic inputs, declared rest, selected topos, codecs and selected rendering implementation. They exclude delivery count, display paths and Bound's error wrapper. A local join changes its own cell's receipt. A travelling sign changes dependent cells. Missing or corrupt carried bytes cannot prove reuse.\n\nFor judgement:\n\n```sh\nnpx @lapxo/bound@0.1.4 fold --check\n```\n\nKeep stdout, stderr and the exit status. `--check` is not an install-and-build replacement. A source test passing does not pay an unread ceiling, prove a cold clone, or accept a release.\n\n## Select a topos by what it declares\n\n`sources/<name>` says where a world can be obtained. An admitted `uses/<name>` names the digest of that topos's folded standing: canonical live claims in wire byte order, excluding signature envelopes and host shape. Re-signing the same standing preserves the pin. A changed live form, class, view or offer changes it.\n\n`restsOn` closes artifact bytes separately. A capsule is one offer. Forms, classes and views need no capsule merely to be selected. Runtime and packing do not define standing identity. npm dependency ranges remain package metadata; they are not standing pins.\n\n| Responsibility | Owner |\n| --- | --- |\n| Meet, state, live acts and rest | Obligations |\n| Wire, forms, classes, views and offer contracts | Topos |\n| Admission, folding and evidence | Bound |\n| Domain measurement and representation | Selected topos |\n| Storage, transport and execution | Host |\n\nCell `restsOn` is the object's relation. Directory prefixes and file summaries are host coordinates, not object rest. Wire tokens are protocol constants, not organization, host, path or key literals.\n\n## Repository rules\n\nCommit `TARGET.bound`, `receipts.bound` and the outputs the forge reads. Ignore `.bound/` from the first line of `.gitignore`. Keep proposals, signed lots, keys, ledgers, caches and dependency blobs outside the published tree.\n\nThe lock is the project's own contract and pins. Read a dependency's declarations from its selected standing; do not copy its lines into your lock. README, package metadata and workflows must be renders of admitted declarations. A scan is an observation, not permission to lower a ceiling.\n\nA PR proposes lines and the leaf changes they render. The judge uses the team's accepted contract independently of the proposed revision. Preserve refusals, conflicting origins and unpaid demands. [Repository and contribution rules](https://github.com/Lapxo/bound/blob/2053bb6d6188f04538114eae6a0add5166944ed3/docs/usage.md#repository-and-pr-review).\n\n## An atlas you can question\n\nInformation can share a history without sharing a single presentation. The same admitted cells can support a compact status view, a spatial view of their relations, or a focused reading of one disagreement. Each view asks for a region and resolution; its selected topos determines the representation.\n\nThis makes changes inspectable. A local act can remain local, travelling bounds can reach dependent cells, and a receipt can name the inputs of the reading you saw. You can ask what changed and what depends on it without turning a drawing into the algebra.\n\nA pin names standing, not a download URL or runtime entry. Its declared artifact dependencies close the bytes needed for an offered operation. The boundary lets a form or view remain meaningful even when it has no executable capsule.\n\nUse Bound where independently attributed observations must be judged against an accepted contract: compatibility between components, operational limits, or a team's project requirements. The selected topos must supply the actual measurements; a digest identifies the evidence without declaring it true.\n\n[Contribute a counterexample or a proposed lot](CONTRIBUTING.md).\n" at=witness:bound/014-candidate by=target form=alphabet measure=text role=writes scope=prose/en/files/public-0 shape=README.md value=lock
|
|
2
2
|
bound-lock/1 about="# Contributing to Bound\n\nBring a counterexample, an observation or a proposed lot. Include the inputs and the output that led you to it. A signature establishes who was authorized to speak; it does not make their result true.\n\n## Set up a working copy\n\nClone the repository and use the Node version supported by package.json. If package-lock.json is present, run npm ci; otherwise use npm install --ignore-scripts --no-package-lock. Then run:\n\n```sh\nnpm run build\nnpm test\n```\n\nThese are development checks, not project acceptance. For a place with admitted trust context and native receipts, run the product judgement as well:\n\n```sh\nnpx @lapxo/bound@0.1.0 fold --check\n```\n\nPreserve a refusal and its exit status in your report. Do not borrow a neighbouring checkout's ledger or substitute local bytes for a named pin.\n\n## Make the smallest useful change\n\nBound owns admission, folding and evidence. Topos owns grammar, forms, classes, views and their contracts. A selected topos owns domain measurement. Obligations owns the algebra. Keep each change in its layer; do not put a domain decoder, path-based inference or a fallback for a missing pin into Bound.\n\nAn algebra change needs an independent oracle and a counterexample. A host change needs evidence for authentic bytes, failure propagation or reuse. A view change needs its declared region and implementation identity. A test should fail for a plausible incorrect implementation, not assert a source string or repeat the same expression on both sides.\n\nKeep regressions for changed signatures, unauthorized coverage, exact-id withdrawal, conflicting evidence, local versus travelling acts, corrupt content and duplicate delivery. Consolidate repeated setup and duplicate scenarios without removing distinct falsifiers.\n\n## Propose and admit\n\nKeep proposal and signed-lot files outside the repository. Use the current admitted wire, by=target, and no preassigned epoch or signature. The team's admitted key signs the lot; Bound admits it under scope coverage. The [usage guide](docs/usage.md) explains the transaction and external key-file requirements.\n\nSend the proposed lines with the leaf changes they render. A hand-edited render is evidence of the intended change, not an admitted contribution. Do not edit the accepted TARGET to make a test or ceiling pass. If a render disagrees with the lock, fix the proposed lines and re-render it.\n\nCommit only the project's TARGET.bound and native receipts.bound as bound files. The first .gitignore line excludes .bound/. Do not commit keys, stores, ledgers, caches, capsules, archives or vendored dependencies.\n\n## Submit a pull request\n\nExplain the concrete behavior before and after the change, the affected layer, and the checks you ran. Include stdout, stderr and exit status for a CLI case. State which reader and input bytes produced the evidence; a source harness is not an installed-package proof.\n\nPolicy changes receive explicit team review separately from measurements of the proposed source. Keep incompatible readings and their origins visible. Never remove a failing test or weaken a ceiling to obtain acceptance. Withdraw statements through their admitted history; do not rewrite prior signatures, tags or releases.\n\nDocumentation and workflows follow the same review: propose their lines and include the rendered changes.\n" at=policy:public-prose by=target form=alphabet measure=text role=writes scope=prose/en/files/public-1 shape=CONTRIBUTING.md value=lock
|
|
3
3
|
bound-lock/1 about="# Using Bound\n\nThis guide covers the current CLI in a place whose wire and authority are already admitted. A fresh unsigned TARGET is a proposal, not a trusted project. The prepared repository is not yet a certified empty-clone bootstrap.\n\n## Before the first fold\n\nYou need the team's accepted TARGET and trust context, authentic bytes for each selected digest, and the readers/views that TARGET names. Do not borrow a neighbouring repository's ledger or copy node_modules to make a missing pin look available.\n\nThe published repository carries exactly TARGET.bound and receipts.bound as bound files. Local admission history lives in the ignored .bound/ store. Published standing excludes the signature envelope; owner public keys retain their signatures.\n\nStart by asking for help and folding the project. If a selected view is unavailable, use the named refusal and its fix; do not invent an output with a similar name.\n\n## Keys and coverage\n\nUse a named key already admitted by the project. The authority contract declares its public key, class and scope coverage. Signing uses a declared port. The lock names `keys/<who> measure=signer value=<name>`; `signer/timeout` and `signer/response-bytes` bound each invocation. The built-in `file` port reads a matching PKCS8 PEM outside the repository through `--key-file`. For a command port, the host supplies a `BOUND_SIGNERS` registry mapping that admitted name to `{ \"kind\": \"command\", \"executable\": \"...\", \"args\": [] }`. A repository declaration cannot authorize a program. `--signer <name>` must match the admitted selection.\n\nA new device must have its public key and coverage admitted by an authority that already covers the intended scope. The CLI does not currently certify silent key creation or tap-to-sign. This guide does not substitute a self-authorized fixture key for the team's authority.\n\nFor automation through the file port, supply the private key through the runner's secret storage to a temporary external file with restricted permissions. A command signer receives the lot once as canonical signed bytes, one line per record in order. It returns one canonical wire response per record, containing `by` and `sig`, in that same order. Bound verifies the entire reply against the admitted public key before any admission. Timeout, nonzero exit, missing or invalid replies refuse the whole lot; raw signer output is not logged. Hosts can keep private keys outside Bound through this port. Key generation, storage and rotation belong to the host. Do not print, commit or upload it. A source-control token and a Bound authority key have different purposes. Key rotation and revocation are changes to the admitted authority contract, not edits that erase prior signatures.\n\n## Proposal → signature → admission → reading\n\nPrepare the proposed lines outside the repository. Each line must use the current wire's fields, forms and required set. Configuration retains its legacy required fields, including `at`. Typed cells, claims and marks use their exact row grammar; `role=reads` or `at` cannot repair an incomplete typed record.\n\nA proposal names `by=target` and omits epoch/signature. The CLI assigns epoch from admitted history when signing. Never copy an epoch from an example or change a signed line's body.\n\nUse the signing and admission transaction in the README. Shell `&&` prevents a failed sign from being followed by land. Successful signing alone does not mean admission. Successful admission alone does not mean every requirement is paid. Fold after land and inspect its states, receipts and exit status.\n\nCLI sign authenticates wire inscriptions. It is different from the object's travelling ceiling sign. The selected Topos decodes spans and supplies origin/witness context; Bound must not guess those from by, widens or a path.\n\n## Reading and withdrawing\n\nAsk only for a view admitted by the project, such as cells. A local join widens that cell with a witness; it leaves the travelling ceiling live. A travelling require supplies a floor. Claims carry distinct origins; their signatures do not by themselves establish independent origins.\n\nFor typed histories, a negative record names the exact id in takes. Withdrawing a claim removes that live observation; withdrawing a join removes that local widening, not the sign. A fresh claim with the same content is a new identity, not resurrection of a withdrawn id. Re-delivery of the same signed bytes is idempotent.\n\nFor configuration, the negative line preserves the exact non-envelope selectors and changes value to withdraw. Do not withdraw and replace identical selectors in the same batch. Use a new epoch when superseding an alphabet declaration. Never withdraw evidence merely to obtain a green verdict.\n\n## Receipts and refusals\n\nreceipts.bound is native fold output. Do not write it by hand, use JSON from a test as a receipt, or copy receipts from another tree. Unchanged inputs can reuse verified region receipts; missing bytes require recomputation or a refusal. A duplicate receipt does not create another origin.\n\nREFUSE·wire means the current grammar does not admit the record. REFUSE·pin/release means named authentic content or its closure is unavailable or does not match. REFUSE·view means the requested view cannot be rendered under its contract. Authority refusal means the signer is not covered. Keep the line and the failed exit status; follow an explicit fix without changing the named digest or dropping a conflicting statement.\n\nrelease/blocks is policy read by the fold. Its admitted category links select existing obligations. The fold prints each missing reading or crossed ceiling as BLOCK; a blocked or incomplete policy is not READY. Read the captured verdict for the exact candidate instead of inferring acceptance from a successful render.\n\n## Repository and PR review\n\nThe accepted TARGET is independent of a contributor's scan. Commit native receipts and admitted renders, not local .bound/ state. A page disagreeing with TARGET must be re-rendered; a ceiling is not lowered to fit the page.\n\nA contribution is a proposed lot with the leaf changes rendered from it. Send that lot for admission by the team's coverage. Do not submit hand-edited lock output as already accepted. Check secrets, extra bound files, foreign vendoring and uncaptured page claims before review.\n\nA review includes the product fold, meaningful suites and verification of the rendered bytes. Preserve their actual output and exit status.\n" at=policy:bound/011-signing-docs by=target form=alphabet measure=text role=writes scope=prose/en/files/public-2 shape=docs/usage.md value=lock
|
|
4
4
|
bound-lock/1 about=", & " at=policy:bound/010 by=target form=alphabet measure=text role=writes scope=prose/en/cite/and value=lock
|
|
@@ -13,7 +13,7 @@ bound-lock/1 about="A lock is the set of lines a place is bound by. A receipt is
|
|
|
13
13
|
bound-lock/1 about="A second independent reader must agree. The fold rebuilds from the files alone, offline." at=witness:project-coordinates-are-relative by=target form=alphabet kind=axiom measure=status needs=samples/yes/verify-agrees.json|samples/no/verify-agrees.json role=demands scope=law/verify-agrees value=present
|
|
14
14
|
bound-lock/1 about="Bind a package release with the pipeline views. Bind a page to its receipts with view/readme. Refuse a dependency drift with dep pins. Ask a second head that must agree." at=policy:bound/010 by=target form=alphabet measure=text role=writes scope=prose/en/learn value=present
|
|
15
15
|
bound-lock/1 about="Bound is the application of that algebra: signed bounds, folded by one meet, refused when they fork." at=policy:bound/010 by=target form=alphabet measure=text role=writes scope=prose/en/paper value=present
|
|
16
|
-
bound-lock/1 about="Bound reads a project's admitted statements and observations through its selected Topos, then renders the declared views and records their inputs in receipts. The example below explains the object; a file-fold alone does not calculate its intervals.\n\n## A meeting everyone can understand\n\nAna is available from 10 to 14, Luis from 12 to 16, and the room from 10 to 13. Their common availability is 12 to 13. A boss available from 18 to 20 makes the encounter incompatible. Withdrawing that exact reading restores the overlap; Ana, Luis and the room remain.\n\nWith an interval form, those are object operations: observe independent claims, meet them, withdraw by id, and read the state. A narrower compatible meet is not a fork. Folding a file of declarations alone does not calculate meeting availability.\n\nThe same pattern applies to a delivery window, a sensor's allowed range, or an agreed performance budget. The chosen topos determines the units and how evidence is obtained. Bound does not supply a meeting-specific rule.\n\n## See how information holds together\n\n\n\nA travelling ceiling on B reaches C and G through their declared rest. A local join widens B alone. D is independent. The figure shows those relations; point size and camera distance do not measure information.\n\n| State | Meaning |\n| --- | --- |\n| REQUIRED | Compatible bounds, fewer than two independent origins. |\n| FREE | Independent origins meet and their encounter fits the bounds. |\n| CONFLICT | Bounds conflict, or eligible claims have no common encounter. |\n| FORBIDDEN | An inhabited encounter does not fit the bounds. |\n\nBounds are checked before origins and claims. A receipt is evidence of a reading, not another origin. Duplicating one does not add freedom.\n\n## Change a project without erasing evidence\n\nWork in the project's directory. Use an existing admitted key identifier and its matching private key stored outside every repository. The admitted key also names its signer with `keys/<who> measure=signer value=file`; `signer/timeout` and `signer/response-bytes` declare its limits. Your public key and coverage belong to the authority contract; possession of a private key alone does not authorize a scope.\n\n```sh\nexport BOUND_KEY_ID='your-admitted-key-id'\nexport BOUND_KEY_FILE=\"$HOME/Private/keys/your-device.pem\"\nlot_dir=\"$(mktemp -d)\"\n```\n\nHave the selected view produce a proposal at `$lot_dir/proposal.bound`, or prepare the project's permitted lines there for review. Unsigned proposals use `by=target`, without a preassigned epoch or `sig`. Lots stay outside the repository; the committed bound files are only `TARGET.bound` and `receipts.bound`.\n\n```sh\nnpx @lapxo/bound@0.1.
|
|
16
|
+
bound-lock/1 about="Bound reads a project's admitted statements and observations through its selected Topos, then renders the declared views and records their inputs in receipts. The example below explains the object; a file-fold alone does not calculate its intervals.\n\n## A meeting everyone can understand\n\nAna is available from 10 to 14, Luis from 12 to 16, and the room from 10 to 13. Their common availability is 12 to 13. A boss available from 18 to 20 makes the encounter incompatible. Withdrawing that exact reading restores the overlap; Ana, Luis and the room remain.\n\nWith an interval form, those are object operations: observe independent claims, meet them, withdraw by id, and read the state. A narrower compatible meet is not a fork. Folding a file of declarations alone does not calculate meeting availability.\n\nThe same pattern applies to a delivery window, a sensor's allowed range, or an agreed performance budget. The chosen topos determines the units and how evidence is obtained. Bound does not supply a meeting-specific rule.\n\n## See how information holds together\n\n\n\nA travelling ceiling on B reaches C and G through their declared rest. A local join widens B alone. D is independent. The figure shows those relations; point size and camera distance do not measure information.\n\n| State | Meaning |\n| --- | --- |\n| REQUIRED | Compatible bounds, fewer than two independent origins. |\n| FREE | Independent origins meet and their encounter fits the bounds. |\n| CONFLICT | Bounds conflict, or eligible claims have no common encounter. |\n| FORBIDDEN | An inhabited encounter does not fit the bounds. |\n\nBounds are checked before origins and claims. A receipt is evidence of a reading, not another origin. Duplicating one does not add freedom.\n\n## Change a project without erasing evidence\n\nWork in the project's directory. Use an existing admitted key identifier and its matching private key stored outside every repository. The admitted key also names its signer with `keys/<who> measure=signer value=file`; `signer/timeout` and `signer/response-bytes` declare its limits. Your public key and coverage belong to the authority contract; possession of a private key alone does not authorize a scope.\n\n```sh\nexport BOUND_KEY_ID='your-admitted-key-id'\nexport BOUND_KEY_FILE=\"$HOME/Private/keys/your-device.pem\"\nlot_dir=\"$(mktemp -d)\"\n```\n\nHave the selected view produce a proposal at `$lot_dir/proposal.bound`, or prepare the project's permitted lines there for review. Unsigned proposals use `by=target`, without a preassigned epoch or `sig`. Lots stay outside the repository; the committed bound files are only `TARGET.bound` and `receipts.bound`.\n\n```sh\nnpx @lapxo/bound@0.1.4 sign \"$lot_dir/proposal.bound\" \\\n --key \"$BOUND_KEY_ID\" --key-file \"$BOUND_KEY_FILE\" \\\n > \"$lot_dir/signed.bound\" &&\nnpx @lapxo/bound@0.1.4 land \"$lot_dir/signed.bound\" &&\nnpx @lapxo/bound@0.1.4 fold\n```\n\n`sign` assigns the admitted epoch and writes the signed lot to stdout. `land` validates the whole lot before admission. A refusal is evidence to inspect; it is not success. Do not proceed after a failed signature or admission. The key file is a PKCS8 private key matching the admitted public key; do not put it in the lot, source tree, package or CI artifacts.\n\nFor typed object withdrawals, `takes` names the exact claim or mark id. Removing a local join leaves the travelling sign live. For untyped configuration, use the wire's exact withdrawal selectors; do not combine withdrawal and replacement with identical selectors in one lot. Wire alphabet updates supersede by epoch.\n\n[Authority, withdrawals, receipts and PR review](https://github.com/Lapxo/bound/blob/2053bb6d6188f04538114eae6a0add5166944ed3/docs/usage.md).\n\n## Select a topos by what it declares\n\n`sources/<name>` says where a world can be obtained. An admitted `uses/<name>` names the digest of that topos's folded standing: canonical live claims in wire byte order, excluding signature envelopes and host shape. Re-signing the same standing preserves the pin. A changed live form, class, view or offer changes it.\n\n`restsOn` closes artifact bytes separately. A capsule is one offer. Forms, classes and views need no capsule merely to be selected. Runtime and packing do not define standing identity. npm dependency ranges remain package metadata; they are not standing pins.\n\n| Responsibility | Owner |\n| --- | --- |\n| Meet, state, live acts and rest | Obligations |\n| Wire, forms, classes, views and offer contracts | Topos |\n| Admission, folding and evidence | Bound |\n| Domain measurement and representation | Selected topos |\n| Storage, transport and execution | Host |\n\nCell `restsOn` is the object's relation. Directory prefixes and file summaries are host coordinates, not object rest. Wire tokens are protocol constants, not organization, host, path or key literals.\n\n## Repository rules\n\nCommit `TARGET.bound`, `receipts.bound` and the outputs the forge reads. Ignore `.bound/` from the first line of `.gitignore`. Keep proposals, signed lots, keys, ledgers, caches and dependency blobs outside the published tree.\n\nThe lock is the project's own contract and pins. Read a dependency's declarations from its selected standing; do not copy its lines into your lock. README, package metadata and workflows must be renders of admitted declarations. A scan is an observation, not permission to lower a ceiling.\n\nA PR proposes lines and the leaf changes they render. The judge uses the team's accepted contract independently of the proposed revision. Preserve refusals, conflicting origins and unpaid demands. [Repository and contribution rules](https://github.com/Lapxo/bound/blob/2053bb6d6188f04538114eae6a0add5166944ed3/docs/usage.md#repository-and-pr-review).\n\n## An atlas you can question\n\nInformation can share a history without sharing a single presentation. The same admitted cells can support a compact status view, a spatial view of their relations, or a focused reading of one disagreement. Each view asks for a region and resolution; its selected topos determines the representation.\n\nThis makes changes inspectable. A local act can remain local, travelling bounds can reach dependent cells, and a receipt can name the inputs of the reading you saw. You can ask what changed and what depends on it without turning a drawing into the algebra.\n\nA pin names standing, not a download URL or runtime entry. Its declared artifact dependencies close the bytes needed for an offered operation. The boundary lets a form or view remain meaningful even when it has no executable capsule.\n\nUse Bound where independently attributed observations must be judged against an accepted contract: compatibility between components, operational limits, or a team's project requirements. The selected topos must supply the actual measurements; a digest identifies the evidence without declaring it true.\n\n[Contribute a counterexample or a proposed lot](CONTRIBUTING.md)." at=witness:bound/014-candidate by=target form=alphabet measure=text role=writes scope=prose/en/idea value=present
|
|
17
17
|
bound-lock/1 about="Cite it as {name}." at=policy:bound/010 by=target form=alphabet measure=text role=writes scope=prose/en/cff/name value=lock
|
|
18
18
|
bound-lock/1 about="Cite it by the paper it rests on, Two-Sided Constraints on a Valued Lattice." at=policy:bound/010 by=target form=alphabet measure=text role=writes scope=prose/en/cff/paper value=lock
|
|
19
19
|
bound-lock/1 about="Declare what must hold. Read what does. Keep the evidence." at=policy:bound/historical-prose by=target form=alphabet measure=text role=writes scope=docs/tagline value=present
|
|
@@ -37,6 +37,10 @@ bound-lock/1 about="Pending general document projection at docs/readme-assets/at
|
|
|
37
37
|
bound-lock/1 about="Pending general document projection at docs/usage.md; no automatic output is claimed by this capability demand." at=policy:own-prose by=target form=alphabet measure=id role=demands scope=view/files/public-2 value=text@3
|
|
38
38
|
bound-lock/1 about="Pending general document projection at package.json; no automatic output is claimed by this capability demand." at=policy:own-prose by=target form=alphabet measure=id role=demands scope=view/files/manifest value=text@3
|
|
39
39
|
bound-lock/1 about="Preview with fold --as before it lands." at=policy:bound/readme by=target form=alphabet measure=id role=writes scope=page/seq/look value=present
|
|
40
|
+
bound-lock/1 about="Rejected: a source URL does not define authenticated release lineage or order. A bump proposal requires an explicit release contract; downloaded bytes cannot replace an immutable standing pin." at=policy:bound/014-review by=target form=alphabet measure=text role=writes scope=policy/rejected/newest-by-url value=lock
|
|
41
|
+
bound-lock/1 about="Rejected: empty output is not universally a failure. Missing required inputs remain unpaid; a completed empty result is valid only where its declared Topos contract permits it." at=policy:bound/014-review by=target form=alphabet measure=text role=writes scope=policy/rejected/empty-is-failure value=lock
|
|
42
|
+
bound-lock/1 about="Rejected: key-name depth does not determine authority. Key identifier grammar and ambiguity belong to Topos; coverage and admitted public keys govern authorization." at=policy:bound/014-review by=target form=alphabet measure=text role=writes scope=policy/rejected/nested-key-authority value=lock
|
|
43
|
+
bound-lock/1 about="Rejected: read, write, delete, pay and subscribe are not a universal closed offer alphabet. Selected Topos profiles declare capability classes; class labels alone authorize no invocation." at=policy:bound/014-review by=target form=alphabet measure=text role=writes scope=policy/rejected/universal-offer-alphabet value=lock
|
|
40
44
|
bound-lock/1 about="Release selection of existing obligations; their fold evidence determines the verdict." at=policy:bound/release by=target form=alphabet measure=id role=writes scope=release/category/admission value=idempotent|one-writer|nothing-deleted
|
|
41
45
|
bound-lock/1 about="Release selection of existing obligations; their fold evidence determines the verdict." at=policy:bound/release by=target form=alphabet measure=id role=writes scope=release/category/cli value=cli/**|fold/idle|cost/act
|
|
42
46
|
bound-lock/1 about="Release selection of existing obligations; their fold evidence determines the verdict." at=policy:bound/release by=target form=alphabet measure=id role=writes scope=release/category/integrity value=literal/host|literal/key|literal/org|literal/path|duplicate/src|door/unreceipted
|
|
@@ -115,7 +119,7 @@ bound-lock/1 about="lines, not a page: blobs, laid snapshots and answer caches n
|
|
|
115
119
|
bound-lock/1 about="name: release\non:\n workflow_run:\n workflows: [tag]\n types: [completed]\n push:\n tags: ['v*']\njobs:\n release:\n if: github.event_name == 'push' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main')\n runs-on: ubuntu-latest\n permissions:\n contents: write\n outputs:\n tag: ${{ steps.version.outputs.tag }}\n asset: ${{ steps.archive.outputs.asset }}\n sha256: ${{ steps.archive.outputs.sha256 }}\n steps:\n - uses: actions/checkout@v4\n with:\n ref: ${{ github.event.workflow_run.head_sha || github.sha }}\n fetch-depth: 0\n - id: version\n env:\n EVENT_NAME: ${{ github.event_name }}\n REF_NAME: ${{ github.ref_name }}\n run: |\n version=\"v$(node -p \"require('./package.json').version\")\"\n if [ \"$EVENT_NAME\" = push ]; then\n test \"$REF_NAME\" = \"$version\"\n fi\n git rev-parse --verify \"refs/tags/$version\"\n echo \"tag=$version\" >> \"$GITHUB_OUTPUT\"\n git checkout --detach \"$version\"\n - uses: actions/setup-node@v4\n with:\n node-version: 24\n - run: npm ci\n - run: npm run build\n - run: npm test\n - run: node dist/cli/verb.js fold --check\n - id: archive\n env:\n GH_TOKEN: ${{ github.token }}\n run: |\n version=\"${{ steps.version.outputs.tag }}\"\n asset=\"$(npm pack --ignore-scripts --silent)\"\n echo \"asset=$asset\" >> \"$GITHUB_OUTPUT\"\n expected=\"$(sha256sum \"$asset\" | cut -d ' ' -f 1)\"\n echo \"sha256=$expected\" >> \"$GITHUB_OUTPUT\"\n if ! gh release view \"$version\" >/dev/null 2>&1; then\n gh release create \"$version\" \"$asset\" --title \"$version\" --notes \"$(git log -1 --format=%B)\"\n fi\n download_dir=\"$(mktemp -d)\"\n gh release download \"$version\" --pattern \"$asset\" --dir \"$download_dir\"\n actual=\"$(sha256sum \"$download_dir/$asset\" | cut -d ' ' -f 1)\"\n test \"$expected\" = \"$actual\"\n publish:\n needs: release\n environment: release\n runs-on: ubuntu-latest\n permissions:\n contents: read\n id-token: write\n steps:\n - uses: actions/checkout@v4\n with:\n ref: ${{ needs.release.outputs.tag }}\n - uses: actions/setup-node@v4\n with:\n node-version: 24\n - run: npm install --global npm@'12.1.0'\n - env:\n GH_TOKEN: ${{ github.token }}\n TAG: ${{ needs.release.outputs.tag }}\n ASSET: ${{ needs.release.outputs.asset }}\n EXPECTED: ${{ needs.release.outputs.sha256 }}\n run: |\n mkdir candidate\n gh release download \"$TAG\" --pattern \"$ASSET\" --dir candidate\n actual=\"$(sha256sum \"candidate/$ASSET\" | cut -d ' ' -f 1)\"\n test \"$EXPECTED\" = \"$actual\"\n npm stage publish \"./candidate/$ASSET\" --access public --ignore-scripts\n" at=policy:bound/011-port-release by=target form=alphabet measure=text role=writes scope=prose/en/files/workflow/release shape=.github/workflows/release.yml value=lock
|
|
116
120
|
bound-lock/1 about="name: tag\non:\n workflow_run:\n workflows: [test]\n types: [completed]\njobs:\n tag:\n if: github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'push' && github.event.workflow_run.head_branch == 'main'\n runs-on: ubuntu-latest\n permissions:\n contents: write\n steps:\n - uses: actions/checkout@v4\n with:\n ref: ${{ github.event.workflow_run.head_sha }}\n fetch-depth: 0\n - run: |\n version=\"v$(node -p \"require('./package.json').version\")\"\n git tag --list \"$version\" | grep -q . && exit 0\n git tag \"$version\" && git push origin \"$version\"\n" at=policy:bound/pipeline by=target form=alphabet measure=text role=writes scope=prose/en/files/workflow/tag shape=.github/workflows/tag.yml value=lock
|
|
117
121
|
bound-lock/1 about="name: test\non:\n push:\n branches: [main]\n pull_request:\njobs:\n test:\n strategy:\n fail-fast: false\n matrix:\n node: [22, 24]\n runs-on: ubuntu-latest\n permissions:\n contents: read\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with:\n node-version: ${{ matrix.node }}\n - run: npm ci\n - run: npm run build\n - run: npm test\n - name: Verify native closure and receipt reuse\n run: |\n node dist/cli/verb.js fold --check > \"$RUNNER_TEMP/bound-check.log\" 2>&1 || { cat \"$RUNNER_TEMP/bound-check.log\"; exit 1; }\n cat \"$RUNNER_TEMP/bound-check.log\"\n grep -Eq '^PASS +closed' \"$RUNNER_TEMP/bound-check.log\"\n grep -Eq '^RECEIPTS [1-9][0-9]* read · 0 opened' \"$RUNNER_TEMP/bound-check.log\"\n - run: npm pack --silent\n" at=policy:bound/pipeline by=target form=alphabet measure=text role=writes scope=prose/en/files/workflow/test shape=.github/workflows/test.yml value=lock
|
|
118
|
-
bound-lock/1 about="npx @lapxo/bound@0.1.
|
|
122
|
+
bound-lock/1 about="npx @lapxo/bound@0.1.4 fold --as help\nnpx @lapxo/bound@0.1.4 fold" at=witness:bound/014-candidate by=target form=alphabet measure=text role=writes scope=prose/en/commands value=lock
|
|
119
123
|
bound-lock/1 about="obligations is the meet. topos is the line. Worlds outside bound read a calendar, a package, a page. Bound reads lines, folds them, lands what was signed, and signs." at=policy:bound/010 by=target form=alphabet measure=text role=writes scope=prose/en/rests/on value=present
|
|
120
124
|
bound-lock/1 about="one origin is REQUIRED, two that meet inside every bound are FREE, two that meet outside a bound are FORBIDDEN, and two that do not meet are CONFLICT" at=policy:bound/010-states by=target form=alphabet measure=id role=writes scope=notation/states value="one origin=REQUIRED|claims that meet and fit the bounds=FREE|claims that meet outside the bounds=FORBIDDEN|bounds that cross=CONFLICT"
|
|
121
125
|
bound-lock/1 about="take the package in" at=policy:bound/door by=target form=alphabet measure=id role=writes scope=install value=npx
|
|
@@ -141,7 +145,6 @@ bound-lock/1 about="the capsule that renders a place-s forge, one workflow a fun
|
|
|
141
145
|
bound-lock/1 about="the capsule that renders a place-s pages as a function of its lines and the receipts of its regions: its prose in its language, what its code says as the language-s capsule read it, its object as its notation lines name it; named by the digest of its lock and its bytes, and the leaf of those bytes that runs" at=policy:bound/capsules by=target form=alphabet measure=id role=writes scope=dep/topos-doc/lines shape=dist/pages.js value=sha256:e8a91cc39437a8c9a4a658e84e5fda91c3668d31d88a57a685934494b452ee2e
|
|
142
146
|
bound-lock/1 about="the capsule that renders a place-s pages from its lock and the receipts of its regions, named by the digest of its lock and its bytes, and the leaf of those bytes that runs" at=policy:bound/capsules by=target form=alphabet measure=id role=writes scope=dep/topos-doc shape=dist/pages.js value=sha256:2f0d5b0b707b547ec437e38180eaacfccf669bb5ab83c58bd06f32ee3c8ccfdc
|
|
143
147
|
bound-lock/1 about="the capsule that renders a place-s pages, reading the accessors of its shell and the regions of its own lock, named by the digest of its lock and its bytes, and the leaf of those bytes that runs" at=policy:bound/capsules by=target form=alphabet measure=id role=writes scope=dep/topos-doc/regions shape=dist/pages.js value=sha256:6a80af35ed11eee5e91a1979a9c0e569e39d5f946ff86605116c0b16708ee488
|
|
144
|
-
bound-lock/1 about="the capture reader: the CLI on the meeting sample" at=witness:project-coordinates-are-relative by=target form=alphabet measure=reader needs=samples/yes/meeting.bound role=reads scope=reader/capture shape=*.bound value=src/observe/capture.ts
|
|
145
148
|
bound-lock/1 about="the cases a place holds, as the fold counts them from its receipts" at=policy:bound/regions by=target form=alphabet measure=receipts role=reads scope=region/cases value=cases/held
|
|
146
149
|
bound-lock/1 about="the coordinates of bound the artifacts region is handed: what a build writes beside its sources" at=policy:bound/regions by=target form=alphabet measure=coordinates role=reads scope=region/artifacts value=src/**/*.js|src/**/*.ts
|
|
147
150
|
bound-lock/1 about="the coordinates of bound the concepts region is handed: the modules whose exports are the instrument's concepts" at=policy:bound/regions by=target form=alphabet measure=coordinates role=reads scope=region/concepts value=src/cli/verb.ts|src/fold/**/*.ts|src/land/**/*.ts|src/judge/**/*.ts|src/render/**/*.ts|src/host/ports/store.ts|src/host/adapters/keys/**/*.ts
|
|
@@ -180,7 +183,6 @@ bound-lock/1 about="the fields the fold-together line fills" at=policy:bound/rea
|
|
|
180
183
|
bound-lock/1 about="the fields the line figure fills" at=policy:bound/readme by=target form=alphabet measure=id role=writes scope=form/template/figure/line value=scope|count
|
|
181
184
|
bound-lock/1 about="the fields the refuses figure fills" at=policy:bound/010-figure by=target form=alphabet measure=id role=writes scope=form/template/figure/refuses value=input|why
|
|
182
185
|
bound-lock/1 about="the fields the what-holds axiom line fills" at=policy:bound/readme by=target form=alphabet measure=id role=writes scope=form/template/what-holds/axiom value=sentence|name|rests
|
|
183
|
-
bound-lock/1 about="the figures reader: each SVG of the door" at=witness:project-coordinates-are-relative by=target form=alphabet measure=reader needs=docs/img role=reads scope=reader/figures shape=.svg/ value=src/observe/figures.ts
|
|
184
186
|
bound-lock/1 about="the fold as wire lines, so a script reads lines rather than parsing the human form" at=policy:bound/010 by=target form=alphabet measure=id role=demands scope=view/lines value=lines
|
|
185
187
|
bound-lock/1 about="the fold drawn from the meeting-time sample: two claims that meet and one that falls apart" at=witness:project-coordinates-are-relative by=target form=alphabet measure=id needs=docs/img/fold.svg|samples/yes/meeting.bound role=demands scope=view/figure-fold shape=docs/img/fold.svg value=figure-fold@1
|
|
186
188
|
bound-lock/1 about="the folder the no samples of this place live in" at=witness:project-coordinates-are-relative by=target form=alphabet measure=id role=writes scope=samples/no value=samples/no
|
|
@@ -232,7 +234,7 @@ bound-lock/1 about="the release of the forge capsule, named by the digest of wha
|
|
|
232
234
|
bound-lock/1 about="the release of the language capsule, named by the digest of what its published place holds" at=policy:bound/one-cell by=target form=alphabet measure=id role=reads scope=dep/topos-typescript-tree value=sha256:fcd87e3dcb13cb4f4bcb8f96b5cab419b8ee6930612979bb6f143c8a1a3dcc98
|
|
233
235
|
bound-lock/1 about="the release of the lock reader, named by the digest of what its published place holds" at=policy:bound/one-cell by=target form=alphabet measure=id role=reads scope=dep/topos-bound value=sha256:23ea35997c2ada24d7f0da362b9bd112ed52c1ab9bbcdcea1e9eeb91699bd854
|
|
234
236
|
bound-lock/1 about="the release of the node package capsule, named by the digest of what its published place holds" at=policy:bound/one-cell by=target form=alphabet measure=id role=reads scope=dep/topos-node value=sha256:c4ae9ecd8ecc422f6eedc17ae02202611517ae1a0c42ed1dbfcfcc97b534119e
|
|
235
|
-
bound-lock/1 about="the release of the notation, named by the digest of what its published place holds" at=witness:
|
|
237
|
+
bound-lock/1 about="the release of the notation, named by the digest of what its published place holds" at=witness:bound/014-sdk-published by=target form=alphabet measure=id needs=node_modules/@lapxo/topos role=reads scope=dep/topos shape=package value=sha256:ff642185cfb19d7555fb941575bd714e54f854c2f4fadf34b156bc684db4b885
|
|
236
238
|
bound-lock/1 about="the release of the pages capsule, named by the digest of what its published place holds" at=policy:bound/one-cell by=target form=alphabet measure=id role=reads scope=dep/topos-doc value=sha256:adc787638f8cb2c9f050b295e30a7959830682e793e6e5f3e265c85bd6ce6ebb
|
|
237
239
|
bound-lock/1 about="the release of the vectors reader, named by the digest of what its published place holds" at=witness:vectors-read-without-a-row-per-region by=target form=alphabet measure=id role=reads scope=dep/topos-json value=sha256:ddee424ba7c852f966569250f6b5520ecf4079a86cec673ac1a4fc88a934a56d
|
|
238
240
|
bound-lock/1 about="the release pin of a world, never drawn on the door" at=policy:bound/readme by=target form=alphabet measure=id role=demands scope=view/release value=line
|
|
@@ -252,7 +254,7 @@ bound-lock/1 about="the typescript tree world after its released capsule: said,
|
|
|
252
254
|
bound-lock/1 about="the vectors a place holds, a row per region, as the fold counts them from its receipts" at=policy:bound/regions by=target form=alphabet measure=receipts role=reads scope=region/vectors value=vector/**
|
|
253
255
|
bound-lock/1 about="the vectors world saying its own description in its own lock: the regions of 2fb13c6f unchanged, its prose under its key; packed from releases only, topos 0.1.2 and the algebra release, each laid from its digest" at=policy:bound/capsules by=target form=alphabet measure=id role=writes scope=dep/topos-json/own-what shape=dist/index.js value=sha256:5ec73255e3f089e3b9c7bc1d6351a07b8aa302a346fe16ed44cbcb67293c7891
|
|
254
256
|
bound-lock/1 about="the version the forge tags, read from the manifest" at=policy:bound/pipeline by=target form=alphabet measure=id role=writes scope=pipeline/version value="node -p \"require('./package.json').version\""
|
|
255
|
-
bound-lock/1 about="the version this place is bound at" at=witness:bound/
|
|
257
|
+
bound-lock/1 about="the version this place is bound at" at=witness:bound/014-candidate by=target form=alphabet measure=id role=writes scope=version value=0.1.4
|
|
256
258
|
bound-lock/1 about="the writer that vouches each source at the digest a take judged it: a family the wire lists, which bound reads here and never spells" at=policy:bound/store by=target form=alphabet measure=id role=reads scope=store/vouches value=tree
|
|
257
259
|
bound-lock/1 about="this place is a package: class defaults of package resolve here" at=policy:bound/place by=target form=alphabet measure=id role=writes scope=place/kind value=package
|
|
258
260
|
bound-lock/1 about="topos-node with a thin manifest: no typesVersions, main or types, dev dependencies only where a line says so, and a bin field from the place bin/<name> lines" at=policy:bound/capsules by=target form=alphabet measure=id role=writes scope=dep/topos-node/thin-manifest shape=dist/index.js value=sha256:da1fd0bb74f72ae95bce5929055c50ccd150d8903ba5560d99df48bf236d8dc0
|
|
@@ -268,7 +270,7 @@ bound-lock/1 about="what the second head found, which leaves the place has writt
|
|
|
268
270
|
bound-lock/1 about="when the apart claim is withdrawn" at=policy:bound/door by=target form=alphabet measure=id role=writes scope=form/style/fold/back value=2.2
|
|
269
271
|
bound-lock/1 about="where a located world keeps each region file, by directory and extension, so the host loads the tree beside the pin" at=policy:bound/010 by=target form=alphabet measure=id role=writes scope=release/layout value=src/regions:.ts
|
|
270
272
|
bound-lock/1 about="who signs this place" at=policy:bound/010 by=target form=alphabet measure=id role=writes scope=author value=Lapxo
|
|
271
|
-
bound-lock/1 about="{\n \"name\": \"@lapxo/bound\",\n \"version\": \"0.1.
|
|
273
|
+
bound-lock/1 about="{\n \"name\": \"@lapxo/bound\",\n \"version\": \"0.1.4\",\n \"type\": \"module\",\n \"description\": \"Read the bounds you already wrote, fold them, and name the contradictions.\",\n \"main\": \"dist/cli/verb.js\",\n \"types\": \"dist/cli/verb.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/cli/verb.d.ts\",\n \"default\": \"./dist/cli/verb.js\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"scripts\": {\n \"test\": \"node --import ./test/setup.ts --test test/*.test.ts\",\n \"clean\": \"rm -rf dist .tsbuildinfo* tsconfig.tsbuildinfo\",\n \"build\": \"node tools/build.mjs\",\n \"prepack\": \"npm run build\"\n },\n \"files\": [\n \"LICENSE\",\n \"README.md\",\n \"CONTRIBUTING.md\",\n \"dist/**/*\",\n \"TARGET.bound\",\n \"receipts.bound\",\n \"docs/usage.md\",\n \"docs/readme-assets/atlas.svg\"\n ],\n \"author\": \"Lapxo\",\n \"license\": \"MIT\",\n \"dependencies\": {\n \"@lapxo/obligations\": \"0.3.5\",\n \"@lapxo/topos\": \"0.1.9\"\n },\n \"devDependencies\": {\n \"@types/node\": \"^20.0.0\",\n \"typescript\": \"^5.0.0\"\n },\n \"sideEffects\": false,\n \"engines\": {\n \"node\": \">=22.15\"\n },\n \"bin\": {\n \"bound\": \"./dist/cli/verb.js\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/Lapxo/bound.git\"\n },\n \"homepage\": \"https://github.com/Lapxo/bound#readme\",\n \"bugs\": {\n \"url\": \"https://github.com/Lapxo/bound/issues\"\n },\n \"keywords\": [\n \"cli\",\n \"content-addressed\",\n \"provenance\",\n \"receipts\",\n \"constraints\",\n \"reproducible\"\n ]\n}" at=witness:bound/014-candidate by=target form=alphabet measure=text role=writes scope=prose/en/files/manifest shape=package.json value=lock
|
|
272
274
|
bound-lock/1 about="{count} hold" at=policy:bound/010 by=target form=alphabet measure=text role=writes scope=prose/en/badge/held value=lock
|
|
273
275
|
bound-lock/1 about="{lo}..{hi} · {state}" at=policy:bound/readme by=target form=alphabet measure=text role=writes scope=prose/en/figure/fold/together value=present
|
|
274
276
|
bound-lock/1 about="{title} (Version {version})" at=policy:bound/010 by=target form=alphabet measure=text role=writes scope=prose/en/cite/versioned value=lock
|
|
@@ -315,6 +317,18 @@ bound-lock/1 at=policy:bound/011-port-release by=target form=alphabet measure=si
|
|
|
315
317
|
bound-lock/1 at=policy:bound/011-port-release by=target form=interval measure=bytes role=writes scope=signer/response-bytes value=1048576..1048576
|
|
316
318
|
bound-lock/1 at=policy:bound/011-port-release by=target form=interval measure=milliseconds role=writes scope=signer/timeout value=30000..30000
|
|
317
319
|
bound-lock/1 at=policy:bound/011-signing-docs by=target form=alphabet measure=id needs=docs/usage.md role=demands scope=view/usage-profile shape=docs/usage.md value=text@3
|
|
320
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=alphabet measure=id role=writes scope=reader/empty value=required
|
|
321
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=alphabet measure=id role=writes scope=reader/inputs value=required
|
|
322
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=alphabet measure=id role=writes scope=transport/http value=fetch
|
|
323
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=alphabet measure=id role=writes scope=transport/https value=fetch
|
|
324
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=alphabet measure=id role=writes scope=wire/reader-empty value=declared-empty@1
|
|
325
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=alphabet measure=id role=writes scope=wire/reader-inputs value=declared-presence@1
|
|
326
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=alphabet measure=id role=writes scope=wire/reader-lifetime value=bounded-process@1
|
|
327
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=alphabet measure=id role=writes scope=wire/transport value=content-request/1
|
|
328
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=interval measure=bytes role=writes scope=reader/response-bytes value=0..67108864
|
|
329
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=interval measure=bytes role=writes scope=transport/response-bytes value=0..67108864
|
|
330
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=interval measure=milliseconds role=writes scope=reader/timeout value=0..30000
|
|
331
|
+
bound-lock/1 at=policy:bound/014-host-profile by=target form=interval measure=milliseconds role=writes scope=transport/timeout value=0..30000
|
|
318
332
|
bound-lock/1 at=policy:bound/authority by=owner epoch=1 form=alphabet measure=public-key role=writes scope=keys/owner sig="ed25519:era1:IA0IME384zILkebRhsBRopKbz8uPLRX95xUu45dqM0vrc5RzPaeiyJR9s/bb/QFtY6fLiilDy17p89cN3Tm6AQ==" value="MCowBQYDK2VwAyEAIYI0be8OWhf3HcVceKpibjgZ+hbYJKYO5ayX8Kk16LE="
|
|
319
333
|
bound-lock/1 at=policy:bound/authority by=target form=alphabet measure=class role=writes scope=keys/owner value=authorize
|
|
320
334
|
bound-lock/1 at=policy:bound/authority by=target form=alphabet measure=coverage role=writes scope=keys/owner value=*
|
|
@@ -348,12 +362,12 @@ bound-lock/1 at=policy:project/local-journals by=target form=alphabet measure=cl
|
|
|
348
362
|
bound-lock/1 at=policy:prose/render-contract by=target form=alphabet measure=digest role=writes scope=uses/prose-render value=sha256:8b678e37f1fe656a5c456f09c0d57020e3aeddb8acec2b5ffc92054a3ce26c3b
|
|
349
363
|
bound-lock/1 at=policy:prose/render-contract by=target form=alphabet measure=id role=writes scope=dep/prose-render shape=dist/regions/text.js value=sha256:a1c31a72a31eaf8ea7df0fb98235c4b465aee1d9575aebcc480f09b4bf64daf1
|
|
350
364
|
bound-lock/1 at=policy:public-artifact-source by=target form=alphabet measure=id role=writes scope=sources/obligations value=https://registry.npmjs.org/@lapxo/obligations/-/obligations-0.3.5.tgz
|
|
351
|
-
bound-lock/1 at=policy:public-artifact-source by=target form=alphabet measure=id role=writes scope=sources/topos value=https://registry.npmjs.org/@lapxo/topos/-/topos-0.1.8.tgz
|
|
352
365
|
bound-lock/1 at=policy:public-artifact-source by=target form=alphabet measure=id role=writes scope=sources/typescript value=https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz
|
|
353
366
|
bound-lock/1 at=policy:rendering by=target form=alphabet measure=digest role=writes scope=uses/rendering value=sha256:0f7653b659f372fd7bc1b140d0103606ebd8814dee8ef3be30949c6647b482a3
|
|
354
367
|
bound-lock/1 at=policy:selected-wire by=target form=alphabet measure=digest role=writes scope=uses/wire value=sha256:a717c60945add1facfd822b3ee2da73a8fa2f781dd0aa2de9be778e66b8f3591
|
|
355
368
|
bound-lock/1 at=witness:admission-samples-are-inputs by=target form=alphabet measure=coordinates role=reads scope=region/captures value=src/**|test/**|vectors/process/**|dist/**|package.json|TARGET.bound|samples/admission/**
|
|
356
369
|
bound-lock/1 at=witness:admission-samples-are-inputs by=target form=alphabet measure=coordinates role=reads scope=region/vectors value=src/**|test/**|vectors/process/**|dist/**|package.json|TARGET.bound|samples/admission/**
|
|
370
|
+
bound-lock/1 at=witness:bound/014-sdk-source by=target form=alphabet measure=id role=writes scope=sources/topos value=https://registry.npmjs.org/@lapxo/topos/-/topos-0.1.9.tgz
|
|
357
371
|
bound-lock/1 at=witness:explicit-executable-candidate by=target form=alphabet measure=id role=writes scope=dep/topos-doc/born shape=dist/index.js value=sha256:2c507e7fe764e55d08fc27b01567d462060fe50d1896d19866f831a823852ae5
|
|
358
372
|
bound-lock/1 at=witness:process-captures-reader by=target form=alphabet measure=digest role=writes scope=dep/process-readings shape=dist/regions/vectors.js value=sha256:b22d161e8ae7c96789c7fb038b1d755fa149203c7e035c6d2fa5f2a164fecb54
|
|
359
373
|
bound-lock/1 at=witness:process-captures-selection by=target form=alphabet measure=digest role=writes scope=uses/process-readings value=sha256:a55f6849b39e77b6fcd89b2a2ba8fa286a7c8626193bbfe14aef30bef6b29458
|
|
@@ -372,4 +386,5 @@ bound-lock/1 at=witness:project-coordinates-are-relative by=target form=interval
|
|
|
372
386
|
bound-lock/1 at=witness:project-coordinates-are-relative by=target form=interval measure=count needs=samples/literal/yes/path.json|samples/literal/no/path.json role=reads scope=literal/path value=0..0
|
|
373
387
|
bound-lock/1 at=witness:public-artifact-closure by=target form=alphabet measure=digest needs=node_modules/typescript role=reads scope=dep/typescript shape=package value=sha256:10e108c9cf7d5f2879053dff18515fb405abf2ccef63eaaf017d9c571687a1d3
|
|
374
388
|
bound-lock/1 at=witness:source-reader by=target form=alphabet measure=digest role=writes scope=dep/source-readings shape=dist/regions/source.js value=sha256:5ccae33a9e99f6acba690d9664e22cfe818205841e4e9d3083d4b24fb68d7075
|
|
389
|
+
bound-lock/1 at=witness:source-region-inputs by=target form=alphabet measure=coordinates role=reads scope=region/source value=src/**/*.ts
|
|
375
390
|
bound-lock/1 at=witness:source-selection by=target form=alphabet measure=digest role=writes scope=uses/source-readings value=sha256:4129c469d3296a1fcda640f59e0d7c37f255b1e88c2f8e2447cd1359a514f356
|
package/dist/cli/verb.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { withContentStore } from "../host/content-store.js";
|
|
2
3
|
import { withoutEffects } from "../host/read-only.js";
|
|
3
4
|
import { resolveSources, resolveRequested } from "../host/source-content.js";
|
|
4
5
|
import { cellsWithReceipts } from "../host/cell-receipts.js";
|
|
@@ -413,6 +414,9 @@ function foldVerb(root, rest) {
|
|
|
413
414
|
return foldAt(tree, place ? `${place}/` : undefined, rest);
|
|
414
415
|
}
|
|
415
416
|
async function foldAt(root, under, argv) {
|
|
417
|
+
return withContentStore(storeOf(root), () => foldRequested(root, under, argv), () => standingOf(root, under).standing);
|
|
418
|
+
}
|
|
419
|
+
async function foldRequested(root, under, argv) {
|
|
416
420
|
const as = valueOf(argv, FLAGS.as);
|
|
417
421
|
const prospective = as !== undefined && positionalsOf(argv).some(one => existsSync(resolve(one)) && !lstatSync(resolve(one)).isDirectory());
|
|
418
422
|
if (as === NAMED_VIEWS.help || prospective || argv.includes(FLAGS.check))
|
|
@@ -495,8 +499,10 @@ function main(argv) {
|
|
|
495
499
|
const verb = argv[0] ?? '';
|
|
496
500
|
const run = verb in VERBS ? VERBS[verb] : undefined;
|
|
497
501
|
const places = positionalsOf(run === undefined ? argv : argv.slice(1)).filter((one) => existsSync(resolve(one)) && lstatSync(resolve(one)).isDirectory());
|
|
498
|
-
if (run !== undefined)
|
|
499
|
-
|
|
502
|
+
if (run !== undefined) {
|
|
503
|
+
const root = resolve(places[0] ?? '.');
|
|
504
|
+
return withContentStore(storeOf(root), () => run(root, argv.slice(1), argv));
|
|
505
|
+
}
|
|
500
506
|
const under = argv[0] ?? '';
|
|
501
507
|
if (under && !under.startsWith('-') && places.includes(under)) {
|
|
502
508
|
const root = resolve('.');
|
package/dist/fold/observed.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readerLifetime, readerAllowsEmpty, assertReaderInputs, parse as parseLifetime } from '@lapxo/topos/wire';
|
|
1
2
|
import { readOnly } from "../host/read-only.js";
|
|
2
3
|
import { basename, dirname, existsSync, mkdirSync, resolve, rmSync, spawn, statSync, writeFileSync } from "../host/io.js";
|
|
3
4
|
import { bundleOf, processOf } from "../observe/runner.js";
|
|
@@ -264,14 +265,15 @@ export function observedClaims(root, store, options = {}) {
|
|
|
264
265
|
}
|
|
265
266
|
function observeOne(reader, started) {
|
|
266
267
|
const module = resolve(root, reader.module);
|
|
267
|
-
const asked = reader.capsule === undefined ? undefined : capsuleAt(reader.capsule.digest, reader.capsule.entry);
|
|
268
|
+
const asked = reader.capsule === undefined ? undefined : reader.capsule.selected ?? capsuleAt(reader.capsule.digest, reader.capsule.entry);
|
|
268
269
|
const source = reader.capsule === undefined ? observeFile(module) : asked === undefined ? undefined : new Uint8Array();
|
|
269
270
|
const bundle = source && reader.capsule === undefined ? bundleOf(module) ?? bytesDigest(store, source) : 'none';
|
|
270
271
|
const offered = offersOf(root, store, reader, roleOf, look, (where) => reached(trimmed(where)));
|
|
272
|
+
assertReaderInputs(standing.flatMap(line => { const p = parseLifetime(line); return p.kind === 'fact' ? [p.value.fields] : []; }), reader.module, offered.length);
|
|
271
273
|
const vectors = reader.capsule === undefined ? observeText(resolve(root, vectorsOf(reader.module, standing))) : undefined;
|
|
272
274
|
const kept = whole && legacy === undefined && answered === undefined && source ? sha([
|
|
273
275
|
speaker, reader.module, reader.kind, reader.shape.join('|'), reader.where.join('|'), bundle, vectors === undefined ? 'no vectors' : sha(vectors),
|
|
274
|
-
reader.capsule === undefined ? '' : `${reader.capsule.digest} ${reader.capsule.region} ${reader.capsule.reads.join('|')} ${[...reader.capsule.globs].map(([place, globs]) => `${place}${globs.join('|')}`).join(' ')}`,
|
|
276
|
+
reader.capsule === undefined ? '' : `${reader.capsule.selected?.selection ?? reader.capsule.digest} ${reader.capsule.region} ${reader.capsule.reads.join('|')} ${[...reader.capsule.globs].map(([place, globs]) => `${place}${globs.join('|')}`).join(' ')}`,
|
|
275
277
|
...offered.map((offer) => `${offer.place} ${offer.digest?.() ?? bytesDigest(store, offer.bytes())}`),
|
|
276
278
|
].join('\n')) : undefined;
|
|
277
279
|
const stored = kept === undefined ? undefined : observeText(memoAt(store, `observed/${kept}`));
|
|
@@ -286,8 +288,8 @@ export function observedClaims(root, store, options = {}) {
|
|
|
286
288
|
const own = shardLines(store, speaker, home).filter((line) => fieldOf(line, 'scope') === `reader/${reader.module}`);
|
|
287
289
|
const lineage = own.filter((line) => fieldOf(line, 'measure') === 'identity').map((line) => fieldOf(line, 'value'));
|
|
288
290
|
const sum = source && reader.capsule === undefined ? bytesDigest(store, new TextEncoder().encode(`${reader.module} ${bundle}`)).replace(/^sha256:/, '').slice(0, 12) : 'none';
|
|
289
|
-
const measured = reader.capsule !== undefined ? { by: source ? sha(`${reader.capsule.digest}\n${reader.capsule.region}`).slice(0, 12) : 'none', lines: [] }
|
|
290
|
-
: source ? identityOf({ store, root, speaker, module: reader.module, kind: reader.kind, code: sum, lineage, kept: own.filter((line) => /(?:^|\s)measure=(?:extension|emits)\s/.test(line)) })
|
|
291
|
+
const measured = reader.capsule !== undefined ? { by: source ? sha(`${reader.capsule.selected?.selection ?? reader.capsule.digest}\n${reader.capsule.region}`).slice(0, 12) : 'none', lines: [] }
|
|
292
|
+
: source ? identityOf({ store, root, speaker, module: reader.module, kind: reader.kind, code: sum, lineage, lifetime: readerLifetime(standing.flatMap(line => { const p = parseLifetime(line); return p.kind === 'fact' ? [p.value.fields] : []; }), reader.module), kept: own.filter((line) => /(?:^|\s)measure=(?:extension|emits)\s/.test(line)) })
|
|
291
293
|
: { by: 'none', lines: [] };
|
|
292
294
|
const by = measured.by;
|
|
293
295
|
const level = [...measured.lines];
|
|
@@ -407,7 +409,7 @@ export function observedClaims(root, store, options = {}) {
|
|
|
407
409
|
throw new Error(`REFUSE·reader ${reader.module} · ${answer?.why ?? 'no capsule answer'}`);
|
|
408
410
|
return (answer.claims ?? []);
|
|
409
411
|
})
|
|
410
|
-
: runReader(module, root, due.map((d) => ({ place: d.place, ...(reader.kind === 'js' ? { text: new TextDecoder().decode(d.bytes) } : {}), held: heldOf(d.place, d.region) })));
|
|
412
|
+
: runReader(module, root, due.map((d) => ({ place: d.place, ...(reader.kind === 'js' ? { text: new TextDecoder().decode(d.bytes) } : {}), held: heldOf(d.place, d.region) })), readerLifetime(standing.flatMap(line => { const p = parseLifetime(line); return p.kind === 'fact' ? [p.value.fields] : []; }), reader.module));
|
|
411
413
|
}
|
|
412
414
|
catch (error) {
|
|
413
415
|
const why = `REFUSE·reader ${reader.module} · ${error instanceof Error ? error.message : String(error)}`;
|
|
@@ -415,7 +417,7 @@ export function observedClaims(root, store, options = {}) {
|
|
|
415
417
|
process.stderr.write(`${why}\n`);
|
|
416
418
|
return false;
|
|
417
419
|
}
|
|
418
|
-
if (rows.every((mine) => !mine.length)) {
|
|
420
|
+
if (rows.every((mine) => !mine.length) && !readerAllowsEmpty(standing.flatMap(line => { const p = parseLifetime(line); return p.kind === 'fact' ? [p.value.fields] : []; }), reader.module)) {
|
|
419
421
|
const why = `REFUSE·reader ${reader.module} · answered none of ${due.length} places · nothing landed, they stay due`;
|
|
420
422
|
refused.push(why);
|
|
421
423
|
process.stderr.write(`${why}\n`);
|
package/dist/fold/readers.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Capsule } from '../host/capsule.ts';
|
|
1
2
|
import type { CoordinateRole } from './wire.ts';
|
|
2
3
|
import { capsulesFor } from './reach.ts';
|
|
3
4
|
import type { Kind } from '../observe/run.ts';
|
|
@@ -8,6 +9,7 @@ export interface ReaderClaim {
|
|
|
8
9
|
readonly module: string;
|
|
9
10
|
readonly kind: Kind;
|
|
10
11
|
readonly capsule?: {
|
|
12
|
+
readonly selected?: Capsule;
|
|
11
13
|
readonly digest: string;
|
|
12
14
|
readonly entry: string;
|
|
13
15
|
readonly region: string;
|
package/dist/fold/readers.js
CHANGED
|
@@ -62,13 +62,13 @@ export function capsuleReadersOf(root, store, standing, lines, resolve = capsule
|
|
|
62
62
|
const pkg = fieldOf(by?.offer ?? '', 'scope').split('/')[1] ?? '';
|
|
63
63
|
if (by === undefined || reaching.has(`${pkg} ${region} ${where || '/'}`))
|
|
64
64
|
continue;
|
|
65
|
-
const key = `${by.capsule.digest} ${region}`;
|
|
66
|
-
const group = groups.get(key) ?? groups.set(key, { module: `${pkg}/${region}`, digest: by.capsule.digest, entry: fieldOf(by.offer, 'shape'), region, reads: by.capsule.declaration.regions[region] ?? [], globs: new Map() }).get(key);
|
|
65
|
+
const key = `${by.capsule.selection ?? by.capsule.digest} ${region}`;
|
|
66
|
+
const group = groups.get(key) ?? groups.set(key, { module: `${pkg}/${region}`, digest: by.capsule.digest, entry: fieldOf(by.offer, 'shape'), selected: by.capsule, region, reads: by.capsule.declaration.regions[region] ?? [], globs: new Map() }).get(key);
|
|
67
67
|
group.globs.set(where, fieldOf(line, 'value').split('|').filter(Boolean));
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
return [...groups.values()].map((group) => ({ id: group.module, shape: ['run'], where: [...group.globs.keys()], module: group.module, kind: 'process',
|
|
71
|
-
capsule: { digest: group.digest, entry: group.entry, region: group.region, reads: group.reads, globs: group.globs } }));
|
|
71
|
+
capsule: { selected: group.selected, digest: group.digest, entry: group.entry, region: group.region, reads: group.reads, globs: group.globs } }));
|
|
72
72
|
}
|
|
73
73
|
export function handedAt(root, reader, roleOf, look, place) {
|
|
74
74
|
const { reads, globs } = reader.capsule;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** Reference HTTP adapter. Location and budgets are already selected by admitted host policy. */
|
|
2
|
+
export async function fetchBytes(location, limits) {
|
|
3
|
+
const signal = AbortSignal.timeout(limits.timeoutMs), response = await fetch(location, { signal });
|
|
4
|
+
if (!response.ok)
|
|
5
|
+
throw Error(`HTTP ${response.status}`);
|
|
6
|
+
const reader = response.body?.getReader();
|
|
7
|
+
if (!reader)
|
|
8
|
+
return new Uint8Array();
|
|
9
|
+
const chunks = [];
|
|
10
|
+
let size = 0;
|
|
11
|
+
try {
|
|
12
|
+
for (;;) {
|
|
13
|
+
const part = await reader.read();
|
|
14
|
+
if (part.done)
|
|
15
|
+
break;
|
|
16
|
+
size += part.value.length;
|
|
17
|
+
if (size > limits.responseBytes) {
|
|
18
|
+
await reader.cancel();
|
|
19
|
+
throw Error('response exceeds declared byte bound');
|
|
20
|
+
}
|
|
21
|
+
chunks.push(part.value);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
finally {
|
|
25
|
+
reader.releaseLock();
|
|
26
|
+
}
|
|
27
|
+
return Buffer.concat(chunks);
|
|
28
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReaderLifetime } from '@lapxo/topos/wire';
|
|
1
2
|
import type { SpawnSyncOptionsWithStringEncoding } from 'node:child_process';
|
|
2
3
|
import type { Request, Response } from '@lapxo/topos/contract';
|
|
3
4
|
/** Operational process failure, distinct from a valid contract refusal or abstention. */
|
|
@@ -17,4 +18,4 @@ export declare class CapsuleProcessError extends Error {
|
|
|
17
18
|
}
|
|
18
19
|
export declare function validResponse(value: unknown, request: Request): value is Response;
|
|
19
20
|
/** Last-line JSON is the wire framing. No partial batch, failed exit or synthetic missing response is accepted. */
|
|
20
|
-
export declare function executeCapsule(command: string, args: readonly string[], requests: readonly Request[], limits?: Pick<SpawnSyncOptionsWithStringEncoding, 'timeout' | 'maxBuffer'
|
|
21
|
+
export declare function executeCapsule(command: string, args: readonly string[], requests: readonly Request[], limits?: Pick<SpawnSyncOptionsWithStringEncoding, 'timeout' | 'maxBuffer'>, lifetime?: ReaderLifetime): readonly Response[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { boundedProcess } from "./process-lifetime.js";
|
|
1
2
|
import { spawnSync } from 'node:child_process';
|
|
2
3
|
import { PROTOCOL } from '@lapxo/topos/wire';
|
|
3
4
|
/** Operational process failure, distinct from a valid contract refusal or abstention. */
|
|
@@ -31,9 +32,9 @@ export function validResponse(value, request) {
|
|
|
31
32
|
return true;
|
|
32
33
|
}
|
|
33
34
|
/** Last-line JSON is the wire framing. No partial batch, failed exit or synthetic missing response is accepted. */
|
|
34
|
-
export function executeCapsule(command, args, requests, limits = {}) {
|
|
35
|
-
const run = spawnSync(command, args, { input: JSON.stringify(requests), encoding: 'utf8', maxBuffer: 1 << 26, ...limits });
|
|
36
|
-
if (run.error)
|
|
35
|
+
export function executeCapsule(command, args, requests, limits = {}, lifetime) {
|
|
36
|
+
const run = lifetime === undefined ? spawnSync(command, args, { input: JSON.stringify(requests), encoding: 'utf8', maxBuffer: 1 << 26, ...limits }) : boundedProcess(command, args, JSON.stringify(requests), lifetime);
|
|
37
|
+
if ('error' in run && run.error)
|
|
37
38
|
throw new CapsuleProcessError(`failed: ${run.error.message}`, run);
|
|
38
39
|
if (run.signal !== null || run.status !== 0)
|
|
39
40
|
throw new CapsuleProcessError(`exited ${run.status ?? `with signal ${run.signal}`}`, run);
|
package/dist/host/capsule.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Declaration } from '@lapxo/topos/capsule';
|
|
2
2
|
import type { Request, Response } from '@lapxo/topos/contract';
|
|
3
3
|
export interface Capsule {
|
|
4
|
+
readonly selection?: string;
|
|
4
5
|
readonly digest: string;
|
|
5
6
|
readonly declaration: Declaration;
|
|
6
7
|
readonly lines: readonly string[];
|
package/dist/host/capsule.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readerLifetime, parse } from '@lapxo/topos/wire';
|
|
2
|
+
import { contentStore, verifiedContent, contentPolicy } from "./content-store.js";
|
|
2
3
|
import { readOnly } from "./read-only.js";
|
|
3
4
|
import { sha } from "./hash.js";
|
|
4
5
|
import { wireLinesOf as linesOf } from "../fold/claims.js";
|
|
@@ -10,7 +11,7 @@ import { CAPSULE } from '@lapxo/topos/wire';
|
|
|
10
11
|
import { declarationOf } from '@lapxo/topos/capsule';
|
|
11
12
|
import { unpack } from "./archive.js";
|
|
12
13
|
import { executeCapsule, validResponse } from "./capsule-process.js";
|
|
13
|
-
import {
|
|
14
|
+
import { holdStore, replaceWhole, storeAt } from "../land/ledger.js";
|
|
14
15
|
import { coordinatesUnder, observeFile, observeText } from "../observe/files.js";
|
|
15
16
|
import { hostOf } from "../observe/run.js";
|
|
16
17
|
import { ownLock, ownRoot, ownStore, processOf } from "../observe/runner.js";
|
|
@@ -44,15 +45,12 @@ function unpacked(digest, bytes) {
|
|
|
44
45
|
const capsules = new Map();
|
|
45
46
|
/** A blob is loaded once in an act. A later ask for the same digest reads that capsule, and does not hash or unpack it again. */
|
|
46
47
|
export function capsuleAt(digest, entry, store) {
|
|
47
|
-
const
|
|
48
|
+
const cacheStore = store ?? contentStore();
|
|
49
|
+
const { bytes } = verifiedContent(digest, cacheStore);
|
|
50
|
+
const identity = `${cacheStore}\0${digest}\0${entry}`;
|
|
48
51
|
const held = capsules.get(identity);
|
|
49
52
|
if (held !== undefined)
|
|
50
53
|
return held;
|
|
51
|
-
const bytes = observeFile(blobAt(store ?? ownStore(), digest));
|
|
52
|
-
if (bytes === undefined)
|
|
53
|
-
throw new ContentNeeded(digest, `REFUSE·pin ${digest} offered capsule unavailable · not laid`);
|
|
54
|
-
if (`sha256:${createHash('sha256').update(bytes).digest('hex')}` !== digest)
|
|
55
|
-
throw Error(`REFUSE·pin ${digest} content hash mismatch · not laid`);
|
|
56
54
|
const known = declared.get(digest) ?? ((lines) => ({ lines, declaration: declarationOf(lines) }))(linesOf(observeText(join(unpacked(digest, bytes), CAPSULE))));
|
|
57
55
|
declared.set(digest, known);
|
|
58
56
|
const names = Object.keys(known.declaration.regions);
|
|
@@ -65,7 +63,7 @@ export function capsuleAt(digest, entry, store) {
|
|
|
65
63
|
const capsule = { digest, ...known, ask: (requests) => {
|
|
66
64
|
if (!statSync(module, { throwIfNoEntry: false })?.isFile())
|
|
67
65
|
throw new Error(`REFUSE·capsule ${digest} declared entry ${entry} unavailable`);
|
|
68
|
-
return answered(digest, bytes, requests, names, root,
|
|
66
|
+
return answered(digest, bytes, requests, names, root, cacheStore, module);
|
|
69
67
|
} };
|
|
70
68
|
capsules.set(identity, capsule);
|
|
71
69
|
return capsule;
|
|
@@ -117,7 +115,7 @@ function answered(digest, bytes, requests, names, tree, cacheStore = ownStore(),
|
|
|
117
115
|
if (missing.length)
|
|
118
116
|
process.stderr.write(`CAPSULE ${digest.slice(7, 19)} · ${requests.length} asked · ${missing.length} run · ${missing.map((one) => `${one.rootScope}${one.region}`).join(' ')}\n`);
|
|
119
117
|
// Execute and validate the entire batch before committing any answer to the cache.
|
|
120
|
-
const ran = !missing.length ? [] : executeCapsule(process.execPath, [...childFlags(), hostOf(), ...child], missing);
|
|
118
|
+
const ran = !missing.length ? [] : executeCapsule(process.execPath, [...childFlags(), hostOf(), ...child], missing, {}, readerLifetime(contentPolicy().flatMap(line => { const p = parse(line); return p.kind === 'fact' ? [p.value.fields] : []; }), digest));
|
|
121
119
|
return requests.map((request, i) => {
|
|
122
120
|
if (held[i] !== undefined)
|
|
123
121
|
return held[i];
|
|
@@ -43,7 +43,7 @@ export async function cellsWithReceipts(root, history, emit) {
|
|
|
43
43
|
for (const record of parsed.value.objects.filter(r => r.record === 'cell')) {
|
|
44
44
|
const pin = record.fields.topos;
|
|
45
45
|
if (!pins.has(pin)) {
|
|
46
|
-
const top = toposAt(pin);
|
|
46
|
+
const top = toposAt(pin, store);
|
|
47
47
|
pins.set(pin, [pin, ...top.dependencies]);
|
|
48
48
|
}
|
|
49
49
|
const scope = `receipts/cells/${record.fields.scope}`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const withContentStore: <T>(store: string, run: () => T, policy?: () => readonly string[]) => T;
|
|
2
|
+
export declare const contentPolicy: () => readonly string[];
|
|
3
|
+
export declare const contentStore: () => string;
|
|
4
|
+
/** Only immutable verified bytes may be shared with the instrument. Local corruption is never hidden by fallback. */
|
|
5
|
+
export declare function verifiedContent(digest: string, store?: string, instrument?: string): {
|
|
6
|
+
readonly bytes: Uint8Array;
|
|
7
|
+
readonly path: string;
|
|
8
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import { blobAt } from "../land/ledger.js";
|
|
4
|
+
import { observeFile } from "../observe/files.js";
|
|
5
|
+
import { ownLock, ownStore } from "../observe/runner.js";
|
|
6
|
+
import { parse, wireAt } from '@lapxo/topos/wire';
|
|
7
|
+
import { ContentNeeded } from "./content-needed.js";
|
|
8
|
+
// Each invocation carries its place explicitly; asynchronous requests cannot share a mutable current root.
|
|
9
|
+
const requested = new AsyncLocalStorage();
|
|
10
|
+
export const withContentStore = (store, run, policy = () => []) => requested.run({ store, policy }, run);
|
|
11
|
+
export const contentPolicy = () => requested.getStore()?.policy() ?? [];
|
|
12
|
+
export const contentStore = () => requested.getStore()?.store ?? ownStore();
|
|
13
|
+
/** Only immutable verified bytes may be shared with the instrument. Local corruption is never hidden by fallback. */
|
|
14
|
+
export function verifiedContent(digest, store = contentStore(), instrument = ownStore()) {
|
|
15
|
+
const fields = ownLock().flatMap(line => { const p = parse(line); return p.kind === 'fact' ? [p.value.fields] : []; });
|
|
16
|
+
const wire = wireAt(fields, Number.MAX_SAFE_INTEGER);
|
|
17
|
+
if (!wire)
|
|
18
|
+
throw Error('REFUSE·pin instrument has no admitted wire');
|
|
19
|
+
const split = digest.indexOf(':'), algorithm = digest.slice(0, split), hex = digest.slice(split + 1);
|
|
20
|
+
if (split < 1 || !wire.digests.has(algorithm) || !/^[a-f0-9]+$/.test(hex))
|
|
21
|
+
throw Error(`REFUSE·pin ${digest} digest is not admitted`);
|
|
22
|
+
for (const at of new Set([store, instrument])) {
|
|
23
|
+
const path = blobAt(at, digest), bytes = observeFile(path);
|
|
24
|
+
if (bytes === undefined)
|
|
25
|
+
continue;
|
|
26
|
+
if (createHash(algorithm).update(bytes).digest('hex') !== hex)
|
|
27
|
+
throw Error(`REFUSE·pin ${digest} content hash mismatch · store ${at} · not laid`);
|
|
28
|
+
return { bytes, path };
|
|
29
|
+
}
|
|
30
|
+
throw new ContentNeeded(digest);
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|