@jam-overture/loom 0.1.0
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/LICENSE +21 -0
- package/README.md +743 -0
- package/dist/catalogue.d.ts +70 -0
- package/dist/catalogue.js +88 -0
- package/dist/cli/args.d.ts +17 -0
- package/dist/cli/args.js +83 -0
- package/dist/cli/filesystem.d.ts +15 -0
- package/dist/cli/filesystem.js +31 -0
- package/dist/cli/index.d.ts +12 -0
- package/dist/cli/index.js +12 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.js +30 -0
- package/dist/cli/namespace.d.ts +40 -0
- package/dist/cli/namespace.js +40 -0
- package/dist/cli/plan.d.ts +84 -0
- package/dist/cli/plan.js +113 -0
- package/dist/cli/run.d.ts +17 -0
- package/dist/cli/run.js +75 -0
- package/dist/cli/templates.d.ts +43 -0
- package/dist/cli/templates.js +134 -0
- package/dist/closed-set.d.ts +34 -0
- package/dist/closed-set.js +34 -0
- package/dist/data/adapter.d.ts +123 -0
- package/dist/data/adapter.js +91 -0
- package/dist/data/binding.d.ts +48 -0
- package/dist/data/binding.js +39 -0
- package/dist/data/catalogue.d.ts +26 -0
- package/dist/data/catalogue.js +6 -0
- package/dist/data/index.d.ts +14 -0
- package/dist/data/index.js +14 -0
- package/dist/data/plan.d.ts +58 -0
- package/dist/data/plan.js +0 -0
- package/dist/data/resolution.d.ts +91 -0
- package/dist/data/resolution.js +96 -0
- package/dist/data/resolve.d.ts +46 -0
- package/dist/data/resolve.js +37 -0
- package/dist/data/source.d.ts +40 -0
- package/dist/data/source.js +45 -0
- package/dist/deadline.d.ts +57 -0
- package/dist/deadline.js +78 -0
- package/dist/frame/catalogue.d.ts +24 -0
- package/dist/frame/catalogue.js +5 -0
- package/dist/frame/index.d.ts +12 -0
- package/dist/frame/index.js +12 -0
- package/dist/frame/origin.d.ts +87 -0
- package/dist/frame/origin.js +114 -0
- package/dist/frame/resolution.d.ts +85 -0
- package/dist/frame/resolution.js +79 -0
- package/dist/grammar.d.ts +26 -0
- package/dist/grammar.js +28 -0
- package/dist/ids.d.ts +57 -0
- package/dist/ids.js +104 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +26 -0
- package/dist/interactivity.d.ts +50 -0
- package/dist/interactivity.js +22 -0
- package/dist/interpretation/anthropic.d.ts +22 -0
- package/dist/interpretation/anthropic.js +76 -0
- package/dist/interpretation/client.d.ts +83 -0
- package/dist/interpretation/client.js +2 -0
- package/dist/interpretation/draft.d.ts +234 -0
- package/dist/interpretation/draft.js +84 -0
- package/dist/interpretation/index.d.ts +15 -0
- package/dist/interpretation/index.js +15 -0
- package/dist/interpretation/interpreter.d.ts +62 -0
- package/dist/interpretation/interpreter.js +151 -0
- package/dist/interpretation/materialize.d.ts +42 -0
- package/dist/interpretation/materialize.js +107 -0
- package/dist/interpretation/prompt.d.ts +229 -0
- package/dist/interpretation/prompt.js +285 -0
- package/dist/interpretation/render.d.ts +76 -0
- package/dist/interpretation/render.js +272 -0
- package/dist/interpretation/schema.d.ts +49 -0
- package/dist/interpretation/schema.js +131 -0
- package/dist/json.d.ts +35 -0
- package/dist/json.js +11 -0
- package/dist/paging.d.ts +60 -0
- package/dist/paging.js +49 -0
- package/dist/primitive-type.d.ts +32 -0
- package/dist/primitive-type.js +39 -0
- package/dist/render/addressing.d.ts +59 -0
- package/dist/render/addressing.js +60 -0
- package/dist/render/anchor.d.ts +105 -0
- package/dist/render/anchor.js +84 -0
- package/dist/render/behaviour-adjust.d.ts +62 -0
- package/dist/render/behaviour-adjust.js +78 -0
- package/dist/render/behaviour-copy.d.ts +53 -0
- package/dist/render/behaviour-copy.js +75 -0
- package/dist/render/behaviour-disclose.d.ts +74 -0
- package/dist/render/behaviour-disclose.js +77 -0
- package/dist/render/behaviour-present.d.ts +123 -0
- package/dist/render/behaviour-present.js +173 -0
- package/dist/render/behaviour.d.ts +243 -0
- package/dist/render/behaviour.js +284 -0
- package/dist/render/control.d.ts +81 -0
- package/dist/render/control.js +80 -0
- package/dist/render/decorative.d.ts +62 -0
- package/dist/render/decorative.js +2 -0
- package/dist/render/diagnostics.d.ts +260 -0
- package/dist/render/diagnostics.js +61 -0
- package/dist/render/disclosed.d.ts +37 -0
- package/dist/render/disclosed.js +37 -0
- package/dist/render/editable.d.ts +34 -0
- package/dist/render/editable.js +35 -0
- package/dist/render/frame.d.ts +42 -0
- package/dist/render/frame.js +31 -0
- package/dist/render/index.d.ts +35 -0
- package/dist/render/index.js +35 -0
- package/dist/render/inline-variables.d.ts +77 -0
- package/dist/render/inline-variables.js +220 -0
- package/dist/render/presented.d.ts +82 -0
- package/dist/render/presented.js +82 -0
- package/dist/render/primitive.d.ts +228 -0
- package/dist/render/primitive.js +36 -0
- package/dist/render/props.d.ts +48 -0
- package/dist/render/props.js +2 -0
- package/dist/render/reads.d.ts +73 -0
- package/dist/render/reads.js +45 -0
- package/dist/render/render.d.ts +164 -0
- package/dist/render/render.js +571 -0
- package/dist/render/request.d.ts +111 -0
- package/dist/render/request.js +60 -0
- package/dist/render/text.d.ts +91 -0
- package/dist/render/text.js +44 -0
- package/dist/render/theme.d.ts +61 -0
- package/dist/render/theme.js +52 -0
- package/dist/reserved-props.d.ts +35 -0
- package/dist/reserved-props.js +45 -0
- package/dist/result.d.ts +27 -0
- package/dist/result.js +30 -0
- package/dist/role.d.ts +71 -0
- package/dist/role.js +22 -0
- package/dist/runtime/analysis.d.ts +149 -0
- package/dist/runtime/analysis.js +187 -0
- package/dist/runtime/assessment.d.ts +35 -0
- package/dist/runtime/assessment.js +13 -0
- package/dist/runtime/disposition.d.ts +102 -0
- package/dist/runtime/disposition.js +59 -0
- package/dist/runtime/events.d.ts +187 -0
- package/dist/runtime/events.js +7 -0
- package/dist/runtime/gate.d.ts +43 -0
- package/dist/runtime/gate.js +169 -0
- package/dist/runtime/index.d.ts +27 -0
- package/dist/runtime/index.js +27 -0
- package/dist/runtime/intent.d.ts +60 -0
- package/dist/runtime/intent.js +36 -0
- package/dist/runtime/interpreter.d.ts +117 -0
- package/dist/runtime/interpreter.js +46 -0
- package/dist/runtime/inverse-interpreter.d.ts +90 -0
- package/dist/runtime/inverse-interpreter.js +56 -0
- package/dist/runtime/inverse.d.ts +87 -0
- package/dist/runtime/inverse.js +48 -0
- package/dist/runtime/narration.d.ts +24 -0
- package/dist/runtime/narration.js +36 -0
- package/dist/runtime/nesting.d.ts +31 -0
- package/dist/runtime/nesting.js +46 -0
- package/dist/runtime/pipeline.d.ts +124 -0
- package/dist/runtime/pipeline.js +178 -0
- package/dist/runtime/policy-fingerprint.d.ts +29 -0
- package/dist/runtime/policy-fingerprint.js +119 -0
- package/dist/runtime/policy-source.d.ts +42 -0
- package/dist/runtime/policy-source.js +8 -0
- package/dist/runtime/policy.d.ts +156 -0
- package/dist/runtime/policy.js +107 -0
- package/dist/runtime/proposal.d.ts +423 -0
- package/dist/runtime/proposal.js +109 -0
- package/dist/runtime/redirection.d.ts +53 -0
- package/dist/runtime/redirection.js +38 -0
- package/dist/runtime/repointing.d.ts +71 -0
- package/dist/runtime/repointing.js +0 -0
- package/dist/runtime/reversibility.d.ts +36 -0
- package/dist/runtime/reversibility.js +39 -0
- package/dist/runtime/stake-level.d.ts +33 -0
- package/dist/runtime/stake-level.js +58 -0
- package/dist/runtime/stakes.d.ts +47 -0
- package/dist/runtime/stakes.js +305 -0
- package/dist/runtime/vocabulary.d.ts +122 -0
- package/dist/runtime/vocabulary.js +87 -0
- package/dist/sdk/audit.d.ts +195 -0
- package/dist/sdk/audit.js +128 -0
- package/dist/sdk/catalogue.d.ts +37 -0
- package/dist/sdk/catalogue.js +16 -0
- package/dist/sdk/conformance.d.ts +342 -0
- package/dist/sdk/conformance.js +494 -0
- package/dist/sdk/copy.d.ts +105 -0
- package/dist/sdk/copy.js +90 -0
- package/dist/sdk/definition.d.ts +242 -0
- package/dist/sdk/definition.js +64 -0
- package/dist/sdk/index.d.ts +19 -0
- package/dist/sdk/index.js +19 -0
- package/dist/sdk/interactivity.d.ts +29 -0
- package/dist/sdk/interactivity.js +34 -0
- package/dist/sdk/pairings.d.ts +124 -0
- package/dist/sdk/pairings.js +81 -0
- package/dist/sdk/registry.d.ts +162 -0
- package/dist/sdk/registry.js +329 -0
- package/dist/sdk/selection.d.ts +46 -0
- package/dist/sdk/selection.js +24 -0
- package/dist/sdk/text.d.ts +100 -0
- package/dist/sdk/text.js +105 -0
- package/dist/sdk/vocabulary.d.ts +39 -0
- package/dist/sdk/vocabulary.js +36 -0
- package/dist/signals/broadcast.d.ts +134 -0
- package/dist/signals/broadcast.js +451 -0
- package/dist/signals/collect.d.ts +184 -0
- package/dist/signals/collect.js +196 -0
- package/dist/signals/deliver.d.ts +64 -0
- package/dist/signals/deliver.js +85 -0
- package/dist/signals/fold.d.ts +112 -0
- package/dist/signals/fold.js +76 -0
- package/dist/signals/index.d.ts +31 -0
- package/dist/signals/index.js +31 -0
- package/dist/signals/ingest.d.ts +51 -0
- package/dist/signals/ingest.js +70 -0
- package/dist/signals/intake.d.ts +149 -0
- package/dist/signals/intake.js +154 -0
- package/dist/signals/journal.d.ts +94 -0
- package/dist/signals/journal.js +11 -0
- package/dist/signals/kinds.d.ts +22 -0
- package/dist/signals/kinds.js +22 -0
- package/dist/signals/ledger.d.ts +46 -0
- package/dist/signals/ledger.js +81 -0
- package/dist/signals/memory.d.ts +17 -0
- package/dist/signals/memory.js +99 -0
- package/dist/signals/migrate.d.ts +27 -0
- package/dist/signals/migrate.js +78 -0
- package/dist/signals/postgres.d.ts +7 -0
- package/dist/signals/postgres.js +295 -0
- package/dist/signals/rollup.d.ts +142 -0
- package/dist/signals/rollup.js +0 -0
- package/dist/signals/schema.d.ts +534 -0
- package/dist/signals/schema.js +92 -0
- package/dist/signals/signal.d.ts +381 -0
- package/dist/signals/signal.js +150 -0
- package/dist/signals/tally.d.ts +70 -0
- package/dist/signals/tally.js +2 -0
- package/dist/signals/view.d.ts +51 -0
- package/dist/signals/view.js +54 -0
- package/dist/store/attribution.d.ts +125 -0
- package/dist/store/attribution.js +116 -0
- package/dist/store/database.d.ts +14 -0
- package/dist/store/database.js +2 -0
- package/dist/store/driver.d.ts +29 -0
- package/dist/store/driver.js +39 -0
- package/dist/store/errors.d.ts +56 -0
- package/dist/store/errors.js +37 -0
- package/dist/store/index.d.ts +16 -0
- package/dist/store/index.js +16 -0
- package/dist/store/memory.d.ts +3 -0
- package/dist/store/memory.js +115 -0
- package/dist/store/migrate.d.ts +54 -0
- package/dist/store/migrate.js +122 -0
- package/dist/store/postgres-holds.d.ts +4 -0
- package/dist/store/postgres-holds.js +192 -0
- package/dist/store/postgres.d.ts +8 -0
- package/dist/store/postgres.js +262 -0
- package/dist/store/replay.d.ts +94 -0
- package/dist/store/replay.js +82 -0
- package/dist/store/revert.d.ts +116 -0
- package/dist/store/revert.js +243 -0
- package/dist/store/schema.d.ts +371 -0
- package/dist/store/schema.js +78 -0
- package/dist/store/source.d.ts +23 -0
- package/dist/store/source.js +37 -0
- package/dist/store/store.d.ts +231 -0
- package/dist/store/store.js +52 -0
- package/dist/store/undone.d.ts +18 -0
- package/dist/store/undone.js +89 -0
- package/dist/submit/catalogue.d.ts +20 -0
- package/dist/submit/catalogue.js +5 -0
- package/dist/submit/declaration.d.ts +39 -0
- package/dist/submit/declaration.js +30 -0
- package/dist/submit/endpoint.d.ts +131 -0
- package/dist/submit/endpoint.js +160 -0
- package/dist/submit/index.d.ts +13 -0
- package/dist/submit/index.js +13 -0
- package/dist/submit/plan.d.ts +49 -0
- package/dist/submit/plan.js +47 -0
- package/dist/submit/resolution.d.ts +61 -0
- package/dist/submit/resolution.js +64 -0
- package/dist/submit/resolve.d.ts +45 -0
- package/dist/submit/resolve.js +36 -0
- package/dist/telemetry/calibration.d.ts +132 -0
- package/dist/telemetry/calibration.js +151 -0
- package/dist/telemetry/episode.d.ts +140 -0
- package/dist/telemetry/episode.js +272 -0
- package/dist/telemetry/event.d.ts +2310 -0
- package/dist/telemetry/event.js +405 -0
- package/dist/telemetry/index.d.ts +15 -0
- package/dist/telemetry/index.js +15 -0
- package/dist/telemetry/journal.d.ts +116 -0
- package/dist/telemetry/journal.js +11 -0
- package/dist/telemetry/memory.d.ts +24 -0
- package/dist/telemetry/memory.js +75 -0
- package/dist/telemetry/migrate.d.ts +26 -0
- package/dist/telemetry/migrate.js +40 -0
- package/dist/telemetry/postgres.d.ts +6 -0
- package/dist/telemetry/postgres.js +139 -0
- package/dist/telemetry/retention.d.ts +131 -0
- package/dist/telemetry/retention.js +217 -0
- package/dist/telemetry/schema.d.ts +113 -0
- package/dist/telemetry/schema.js +33 -0
- package/dist/telemetry/sink.d.ts +42 -0
- package/dist/telemetry/sink.js +61 -0
- package/dist/testing/contracts.d.ts +34 -0
- package/dist/testing/contracts.js +34 -0
- package/dist/testing/definitions.d.ts +15 -0
- package/dist/testing/definitions.js +48 -0
- package/dist/testing/doubles.d.ts +94 -0
- package/dist/testing/doubles.js +141 -0
- package/dist/testing/episode-harness.d.ts +49 -0
- package/dist/testing/episode-harness.js +65 -0
- package/dist/testing/filesystem.d.ts +17 -0
- package/dist/testing/filesystem.js +17 -0
- package/dist/testing/fixtures.d.ts +57 -0
- package/dist/testing/fixtures.js +84 -0
- package/dist/testing/hold-contract.d.ts +19 -0
- package/dist/testing/hold-contract.js +374 -0
- package/dist/testing/index.d.ts +41 -0
- package/dist/testing/index.js +41 -0
- package/dist/testing/journal-contract.d.ts +17 -0
- package/dist/testing/journal-contract.js +353 -0
- package/dist/testing/model-replies.d.ts +34 -0
- package/dist/testing/model-replies.js +101 -0
- package/dist/testing/primitives.d.ts +7 -0
- package/dist/testing/primitives.js +29 -0
- package/dist/testing/reader-signal-contract.d.ts +38 -0
- package/dist/testing/reader-signal-contract.js +318 -0
- package/dist/testing/row-security.d.ts +17 -0
- package/dist/testing/row-security.js +21 -0
- package/dist/testing/store-contract.d.ts +25 -0
- package/dist/testing/store-contract.js +500 -0
- package/dist/theme/apply.d.ts +17 -0
- package/dist/theme/apply.js +60 -0
- package/dist/theme/contrast.d.ts +197 -0
- package/dist/theme/contrast.js +259 -0
- package/dist/theme/derive.d.ts +77 -0
- package/dist/theme/derive.js +167 -0
- package/dist/theme/faces.d.ts +73 -0
- package/dist/theme/faces.js +119 -0
- package/dist/theme/font-packs.d.ts +25 -0
- package/dist/theme/font-packs.js +257 -0
- package/dist/theme/index.d.ts +20 -0
- package/dist/theme/index.js +20 -0
- package/dist/theme/lab.d.ts +30 -0
- package/dist/theme/lab.js +46 -0
- package/dist/theme/library.d.ts +114 -0
- package/dist/theme/library.js +300 -0
- package/dist/theme/measure.d.ts +144 -0
- package/dist/theme/measure.js +145 -0
- package/dist/theme/palettes.d.ts +64 -0
- package/dist/theme/palettes.js +497 -0
- package/dist/theme/registry.d.ts +59 -0
- package/dist/theme/registry.js +60 -0
- package/dist/theme/separation.d.ts +177 -0
- package/dist/theme/separation.js +203 -0
- package/dist/theme/style-presets.d.ts +60 -0
- package/dist/theme/style-presets.js +124 -0
- package/dist/theme/theme.d.ts +253 -0
- package/dist/theme/theme.js +171 -0
- package/dist/tree/apply.d.ts +16 -0
- package/dist/tree/apply.js +104 -0
- package/dist/tree/builders.d.ts +19 -0
- package/dist/tree/builders.js +20 -0
- package/dist/tree/compare.d.ts +68 -0
- package/dist/tree/compare.js +75 -0
- package/dist/tree/configuration.d.ts +25 -0
- package/dist/tree/configuration.js +108 -0
- package/dist/tree/delta.d.ts +288 -0
- package/dist/tree/delta.js +88 -0
- package/dist/tree/errors.d.ts +69 -0
- package/dist/tree/errors.js +34 -0
- package/dist/tree/identity.d.ts +117 -0
- package/dist/tree/identity.js +145 -0
- package/dist/tree/index.d.ts +21 -0
- package/dist/tree/index.js +21 -0
- package/dist/tree/inverse.d.ts +24 -0
- package/dist/tree/inverse.js +112 -0
- package/dist/tree/mutation.d.ts +18 -0
- package/dist/tree/mutation.js +49 -0
- package/dist/tree/naming.d.ts +4 -0
- package/dist/tree/naming.js +35 -0
- package/dist/tree/navigation.d.ts +38 -0
- package/dist/tree/navigation.js +83 -0
- package/dist/tree/node.d.ts +103 -0
- package/dist/tree/node.js +46 -0
- package/dist/tree/outline.d.ts +28 -0
- package/dist/tree/outline.js +10 -0
- package/dist/tree/tree.d.ts +83 -0
- package/dist/tree/tree.js +62 -0
- package/dist/write/commit.d.ts +124 -0
- package/dist/write/commit.js +234 -0
- package/dist/write/held.d.ts +674 -0
- package/dist/write/held.js +185 -0
- package/dist/write/index.d.ts +11 -0
- package/dist/write/index.js +11 -0
- package/dist/write/liveness.d.ts +132 -0
- package/dist/write/liveness.js +91 -0
- package/dist/write/revert.d.ts +79 -0
- package/dist/write/revert.js +134 -0
- package/package.json +160 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { childrenOf } from "./node.js";
|
|
2
|
+
/**
|
|
3
|
+
* Read-only traversal. Every function here takes a root and derives a view;
|
|
4
|
+
* nothing caches, because a cache would be a second source of truth about a
|
|
5
|
+
* structure that changes on every accepted delta.
|
|
6
|
+
*/
|
|
7
|
+
export function* walkTree(root) {
|
|
8
|
+
yield root;
|
|
9
|
+
for (const child of childrenOf(root))
|
|
10
|
+
yield* walkTree(child);
|
|
11
|
+
}
|
|
12
|
+
export const collectNodeIds = (root) => Array.from(walkTree(root), (node) => node.id);
|
|
13
|
+
export const findNode = (root, nodeId) => {
|
|
14
|
+
for (const node of walkTree(root)) {
|
|
15
|
+
if (node.id === nodeId)
|
|
16
|
+
return node;
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
};
|
|
20
|
+
export const containsNode = (root, nodeId) => findNode(root, nodeId) !== null;
|
|
21
|
+
export const findParent = (root, nodeId) => {
|
|
22
|
+
for (const node of walkTree(root)) {
|
|
23
|
+
if (childrenOf(node).some((child) => child.id === nodeId))
|
|
24
|
+
return node;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The chain of nodes from the root down to and including `nodeId`, or null when
|
|
30
|
+
* the node is absent. Paths are derived on demand and never persisted — the id
|
|
31
|
+
* is the stable address, the path is the current position.
|
|
32
|
+
*/
|
|
33
|
+
export const nodePath = (root, nodeId) => {
|
|
34
|
+
if (root.id === nodeId)
|
|
35
|
+
return [root];
|
|
36
|
+
for (const child of childrenOf(root)) {
|
|
37
|
+
const childPath = nodePath(child, nodeId);
|
|
38
|
+
if (childPath)
|
|
39
|
+
return [root, ...childPath];
|
|
40
|
+
}
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
43
|
+
/** The same chain as ids, for callers that only need the address. */
|
|
44
|
+
export const pathToNode = (root, nodeId) => nodePath(root, nodeId)?.map((node) => node.id) ?? null;
|
|
45
|
+
export const isDescendantOf = (root, ancestorId, nodeId) => {
|
|
46
|
+
const ancestor = findNode(root, ancestorId);
|
|
47
|
+
if (!ancestor)
|
|
48
|
+
return false;
|
|
49
|
+
return childrenOf(ancestor).some((child) => child.id === nodeId || isDescendantOf(child, child.id, nodeId));
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* What a node says: every text node under it, in tree order, concatenated.
|
|
53
|
+
*
|
|
54
|
+
* Adjacent text nodes join with nothing between them because that is how they
|
|
55
|
+
* render — two text children of one element are one run of text to a reader,
|
|
56
|
+
* and a separator here would put something on a reader's clipboard that is not
|
|
57
|
+
* on their screen.
|
|
58
|
+
*
|
|
59
|
+
* It reads the **tree**, never the rendered markup. A behaviour that acts on a
|
|
60
|
+
* node's text (`render/behaviour.ts`) is then right before the browser has laid
|
|
61
|
+
* anything out, and cannot pick up a label, a caption or a control that a
|
|
62
|
+
* primitive rendered beside the content rather than as it.
|
|
63
|
+
*/
|
|
64
|
+
export const textOf = (root) => {
|
|
65
|
+
let text = "";
|
|
66
|
+
for (const node of walkTree(root)) {
|
|
67
|
+
if (node.kind === "text")
|
|
68
|
+
text += node.value;
|
|
69
|
+
}
|
|
70
|
+
return text;
|
|
71
|
+
};
|
|
72
|
+
/** Ids that appear more than once anywhere under `root`. */
|
|
73
|
+
export const duplicateNodeIds = (root) => {
|
|
74
|
+
const seen = new Set();
|
|
75
|
+
const duplicates = new Set();
|
|
76
|
+
for (const node of walkTree(root)) {
|
|
77
|
+
if (seen.has(node.id))
|
|
78
|
+
duplicates.add(node.id);
|
|
79
|
+
seen.add(node.id);
|
|
80
|
+
}
|
|
81
|
+
return Array.from(duplicates);
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=navigation.js.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type NodeId } from "../ids.js";
|
|
3
|
+
import { type JsonObject } from "../json.js";
|
|
4
|
+
import { type PrimitiveType, type SlotName } from "../primitive-type.js";
|
|
5
|
+
/**
|
|
6
|
+
* The component AST.
|
|
7
|
+
*
|
|
8
|
+
* Three node kinds, discriminated on `kind`:
|
|
9
|
+
*
|
|
10
|
+
* - `element` — an instance of a registered primitive. Carries props and an
|
|
11
|
+
* ordered child list. This is the only kind that composes.
|
|
12
|
+
* - `text` — a leaf string. Text is a node rather than a prop so that the
|
|
13
|
+
* runtime can address, move, and re-author a sentence the same way it
|
|
14
|
+
* addresses a card.
|
|
15
|
+
* - `slot` — a named region a host or parent primitive projects into. Its
|
|
16
|
+
* children are the fallback rendered when nothing is projected.
|
|
17
|
+
*
|
|
18
|
+
* Deliberately absent: a `fragment` kind (an element with no visual primitive
|
|
19
|
+
* is expressible as a registered `fragment` primitive, and a second way to
|
|
20
|
+
* express the same thing complicates every traversal) and conditional or
|
|
21
|
+
* looping nodes (adaptation happens by proposing a delta, not by embedding
|
|
22
|
+
* control flow the Gate cannot reason about).
|
|
23
|
+
*/
|
|
24
|
+
export type ElementNode = {
|
|
25
|
+
readonly kind: "element";
|
|
26
|
+
readonly id: NodeId;
|
|
27
|
+
readonly type: PrimitiveType;
|
|
28
|
+
readonly props: JsonObject;
|
|
29
|
+
readonly children: readonly LoomNode[];
|
|
30
|
+
};
|
|
31
|
+
export type TextNode = {
|
|
32
|
+
readonly kind: "text";
|
|
33
|
+
readonly id: NodeId;
|
|
34
|
+
readonly value: string;
|
|
35
|
+
};
|
|
36
|
+
export type SlotNode = {
|
|
37
|
+
readonly kind: "slot";
|
|
38
|
+
readonly id: NodeId;
|
|
39
|
+
readonly name: SlotName;
|
|
40
|
+
readonly children: readonly LoomNode[];
|
|
41
|
+
};
|
|
42
|
+
export type LoomNode = ElementNode | TextNode | SlotNode;
|
|
43
|
+
export type NodeKind = LoomNode["kind"];
|
|
44
|
+
export declare const loomNodeSchema: z.ZodType<LoomNode, z.ZodTypeDef, unknown>;
|
|
45
|
+
export declare const elementNodeSchema: z.ZodObject<{
|
|
46
|
+
kind: z.ZodLiteral<"element">;
|
|
47
|
+
id: z.ZodBranded<z.ZodString, "NodeId">;
|
|
48
|
+
type: z.ZodBranded<z.ZodString, "PrimitiveType">;
|
|
49
|
+
props: z.ZodType<JsonObject, z.ZodTypeDef, JsonObject>;
|
|
50
|
+
children: z.ZodReadonly<z.ZodArray<z.ZodType<LoomNode, z.ZodTypeDef, unknown>, "many">>;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
type: string & z.BRAND<"PrimitiveType">;
|
|
53
|
+
kind: "element";
|
|
54
|
+
id: string & z.BRAND<"NodeId">;
|
|
55
|
+
props: JsonObject;
|
|
56
|
+
children: readonly LoomNode[];
|
|
57
|
+
}, {
|
|
58
|
+
type: string;
|
|
59
|
+
kind: "element";
|
|
60
|
+
id: string;
|
|
61
|
+
props: JsonObject;
|
|
62
|
+
children: readonly unknown[];
|
|
63
|
+
}>;
|
|
64
|
+
export declare const textNodeSchema: z.ZodObject<{
|
|
65
|
+
kind: z.ZodLiteral<"text">;
|
|
66
|
+
id: z.ZodBranded<z.ZodString, "NodeId">;
|
|
67
|
+
value: z.ZodString;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
value: string;
|
|
70
|
+
kind: "text";
|
|
71
|
+
id: string & z.BRAND<"NodeId">;
|
|
72
|
+
}, {
|
|
73
|
+
value: string;
|
|
74
|
+
kind: "text";
|
|
75
|
+
id: string;
|
|
76
|
+
}>;
|
|
77
|
+
export declare const slotNodeSchema: z.ZodObject<{
|
|
78
|
+
kind: z.ZodLiteral<"slot">;
|
|
79
|
+
id: z.ZodBranded<z.ZodString, "NodeId">;
|
|
80
|
+
name: z.ZodBranded<z.ZodString, "SlotName">;
|
|
81
|
+
children: z.ZodReadonly<z.ZodArray<z.ZodType<LoomNode, z.ZodTypeDef, unknown>, "many">>;
|
|
82
|
+
}, "strip", z.ZodTypeAny, {
|
|
83
|
+
name: string & z.BRAND<"SlotName">;
|
|
84
|
+
kind: "slot";
|
|
85
|
+
id: string & z.BRAND<"NodeId">;
|
|
86
|
+
children: readonly LoomNode[];
|
|
87
|
+
}, {
|
|
88
|
+
name: string;
|
|
89
|
+
kind: "slot";
|
|
90
|
+
id: string;
|
|
91
|
+
children: readonly unknown[];
|
|
92
|
+
}>;
|
|
93
|
+
/** Text is a leaf; every other kind holds an ordered child list. */
|
|
94
|
+
export declare const isContainerNode: (node: LoomNode) => node is ElementNode | SlotNode;
|
|
95
|
+
export declare const childrenOf: (node: LoomNode) => readonly LoomNode[];
|
|
96
|
+
/**
|
|
97
|
+
* The node's own name, which is the only thing a reader recognises it by. Ids
|
|
98
|
+
* are minted and carry no meaning, so anything reported to a person names the
|
|
99
|
+
* node as well as addressing it.
|
|
100
|
+
*/
|
|
101
|
+
export declare const nodeLabel: (node: LoomNode) => string;
|
|
102
|
+
export declare const withChildren: <TNode extends ElementNode | SlotNode>(node: TNode, children: readonly LoomNode[]) => TNode;
|
|
103
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { nodeIdSchema } from "../ids.js";
|
|
3
|
+
import { jsonObjectSchema } from "../json.js";
|
|
4
|
+
import { assertNever } from "../result.js";
|
|
5
|
+
import { primitiveTypeSchema, slotNameSchema } from "../primitive-type.js";
|
|
6
|
+
export const loomNodeSchema = z.lazy(() => z.discriminatedUnion("kind", [elementNodeSchema, textNodeSchema, slotNodeSchema]));
|
|
7
|
+
export const elementNodeSchema = z.object({
|
|
8
|
+
kind: z.literal("element"),
|
|
9
|
+
id: nodeIdSchema,
|
|
10
|
+
type: primitiveTypeSchema,
|
|
11
|
+
props: jsonObjectSchema,
|
|
12
|
+
children: z.array(loomNodeSchema).readonly(),
|
|
13
|
+
});
|
|
14
|
+
export const textNodeSchema = z.object({
|
|
15
|
+
kind: z.literal("text"),
|
|
16
|
+
id: nodeIdSchema,
|
|
17
|
+
value: z.string(),
|
|
18
|
+
});
|
|
19
|
+
export const slotNodeSchema = z.object({
|
|
20
|
+
kind: z.literal("slot"),
|
|
21
|
+
id: nodeIdSchema,
|
|
22
|
+
name: slotNameSchema,
|
|
23
|
+
children: z.array(loomNodeSchema).readonly(),
|
|
24
|
+
});
|
|
25
|
+
/** Text is a leaf; every other kind holds an ordered child list. */
|
|
26
|
+
export const isContainerNode = (node) => node.kind !== "text";
|
|
27
|
+
export const childrenOf = (node) => isContainerNode(node) ? node.children : [];
|
|
28
|
+
/**
|
|
29
|
+
* The node's own name, which is the only thing a reader recognises it by. Ids
|
|
30
|
+
* are minted and carry no meaning, so anything reported to a person names the
|
|
31
|
+
* node as well as addressing it.
|
|
32
|
+
*/
|
|
33
|
+
export const nodeLabel = (node) => {
|
|
34
|
+
switch (node.kind) {
|
|
35
|
+
case "element":
|
|
36
|
+
return node.type;
|
|
37
|
+
case "slot":
|
|
38
|
+
return node.name;
|
|
39
|
+
case "text":
|
|
40
|
+
return "text";
|
|
41
|
+
default:
|
|
42
|
+
return assertNever(node, "nodeLabel");
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export const withChildren = (node, children) => ({ ...node, children });
|
|
46
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { NodeId } from "../ids.js";
|
|
2
|
+
import { type LoomNode } from "./node.js";
|
|
3
|
+
/**
|
|
4
|
+
* The tree, flattened into the reading order a list renders in.
|
|
5
|
+
*
|
|
6
|
+
* `walkTree` already yields every node, but it drops the two facts a list needs
|
|
7
|
+
* and cannot recover afterwards: how deep a node sits, and where it sits among
|
|
8
|
+
* its siblings. Recomputing either from a bare node requires a second traversal
|
|
9
|
+
* per node, so the traversal that knows them carries them out.
|
|
10
|
+
*
|
|
11
|
+
* This is a view, not a structure. Nothing here is persisted and nothing caches:
|
|
12
|
+
* a delta changes the tree, and the next outline is derived from the new one.
|
|
13
|
+
* `index` is the position among the parent's children, which is the same number
|
|
14
|
+
* an `insert` or a `move` names — an outline row is therefore enough to address
|
|
15
|
+
* a position, not only a node.
|
|
16
|
+
*/
|
|
17
|
+
export type OutlineEntry = {
|
|
18
|
+
readonly node: LoomNode;
|
|
19
|
+
/** 0 at the root. */
|
|
20
|
+
readonly depth: number;
|
|
21
|
+
/** null at the root. */
|
|
22
|
+
readonly parentId: NodeId | null;
|
|
23
|
+
/** Position among the parent's children; 0 at the root. */
|
|
24
|
+
readonly index: number;
|
|
25
|
+
};
|
|
26
|
+
/** Pre-order, so a row is always preceded by the row it is nested inside. */
|
|
27
|
+
export declare const outlineTree: (root: LoomNode) => readonly OutlineEntry[];
|
|
28
|
+
//# sourceMappingURL=outline.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { childrenOf } from "./node.js";
|
|
2
|
+
function* walkOutline(node, depth, parentId, index) {
|
|
3
|
+
yield { node, depth, parentId, index };
|
|
4
|
+
for (const [childIndex, child] of childrenOf(node).entries()) {
|
|
5
|
+
yield* walkOutline(child, depth + 1, node.id, childIndex);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** Pre-order, so a row is always preceded by the row it is nested inside. */
|
|
9
|
+
export const outlineTree = (root) => Array.from(walkOutline(root, 0, null, 0));
|
|
10
|
+
//# sourceMappingURL=outline.js.map
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type IdFactory, type TreeId } from "../ids.js";
|
|
3
|
+
import { type Result } from "../result.js";
|
|
4
|
+
import type { TreeError } from "./errors.js";
|
|
5
|
+
import { type ElementNode } from "./node.js";
|
|
6
|
+
/**
|
|
7
|
+
* The persisted document. A tree is a root element plus a revision counter —
|
|
8
|
+
* no timestamps, because minting one is a side effect and every function in
|
|
9
|
+
* this module is pure. Storage and telemetry stamp their own times.
|
|
10
|
+
*
|
|
11
|
+
* `revision` increments once per accepted delta. A delta names the revision it
|
|
12
|
+
* was authored against, which is how a stale AI proposal is detected instead of
|
|
13
|
+
* being applied to a tree that has moved on underneath it.
|
|
14
|
+
*/
|
|
15
|
+
export declare const TREE_SCHEMA_VERSION = 1;
|
|
16
|
+
export declare const loomTreeSchema: z.ZodObject<{
|
|
17
|
+
treeId: z.ZodBranded<z.ZodString, "TreeId">;
|
|
18
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
19
|
+
revision: z.ZodNumber;
|
|
20
|
+
root: z.ZodObject<{
|
|
21
|
+
kind: z.ZodLiteral<"element">;
|
|
22
|
+
id: z.ZodBranded<z.ZodString, "NodeId">;
|
|
23
|
+
type: z.ZodBranded<z.ZodString, "PrimitiveType">;
|
|
24
|
+
props: z.ZodType<import("../json.js").JsonObject, z.ZodTypeDef, import("../json.js").JsonObject>;
|
|
25
|
+
children: z.ZodReadonly<z.ZodArray<z.ZodType<import("./node.js").LoomNode, z.ZodTypeDef, unknown>, "many">>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
type: string & z.BRAND<"PrimitiveType">;
|
|
28
|
+
kind: "element";
|
|
29
|
+
id: string & z.BRAND<"NodeId">;
|
|
30
|
+
props: import("../json.js").JsonObject;
|
|
31
|
+
children: readonly import("./node.js").LoomNode[];
|
|
32
|
+
}, {
|
|
33
|
+
type: string;
|
|
34
|
+
kind: "element";
|
|
35
|
+
id: string;
|
|
36
|
+
props: import("../json.js").JsonObject;
|
|
37
|
+
children: readonly unknown[];
|
|
38
|
+
}>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
treeId: string & z.BRAND<"TreeId">;
|
|
41
|
+
schemaVersion: 1;
|
|
42
|
+
revision: number;
|
|
43
|
+
root: {
|
|
44
|
+
type: string & z.BRAND<"PrimitiveType">;
|
|
45
|
+
kind: "element";
|
|
46
|
+
id: string & z.BRAND<"NodeId">;
|
|
47
|
+
props: import("../json.js").JsonObject;
|
|
48
|
+
children: readonly import("./node.js").LoomNode[];
|
|
49
|
+
};
|
|
50
|
+
}, {
|
|
51
|
+
treeId: string;
|
|
52
|
+
schemaVersion: 1;
|
|
53
|
+
revision: number;
|
|
54
|
+
root: {
|
|
55
|
+
type: string;
|
|
56
|
+
kind: "element";
|
|
57
|
+
id: string;
|
|
58
|
+
props: import("../json.js").JsonObject;
|
|
59
|
+
children: readonly unknown[];
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
62
|
+
export type LoomTree = {
|
|
63
|
+
readonly treeId: TreeId;
|
|
64
|
+
readonly schemaVersion: typeof TREE_SCHEMA_VERSION;
|
|
65
|
+
readonly revision: number;
|
|
66
|
+
readonly root: ElementNode;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The root is an element rather than any node because a document always has a
|
|
70
|
+
* container: a bare text or slot root has no place to insert into, which would
|
|
71
|
+
* make the first `insert` of every tree a special case.
|
|
72
|
+
*/
|
|
73
|
+
export declare const createTree: (root: ElementNode, idFactory: IdFactory) => LoomTree;
|
|
74
|
+
export declare const withRoot: (tree: LoomTree, root: ElementNode) => LoomTree;
|
|
75
|
+
/**
|
|
76
|
+
* Structural invariants Zod cannot express. Currently one: node ids are unique
|
|
77
|
+
* across the whole tree, since ids are the addressing scheme for every
|
|
78
|
+
* downstream operation.
|
|
79
|
+
*/
|
|
80
|
+
export declare const validateTreeInvariants: (tree: LoomTree) => Result<LoomTree, TreeError>;
|
|
81
|
+
/** The boundary parse: unknown input in, a validated tree or a TreeError out. */
|
|
82
|
+
export declare const parseTree: (input: unknown) => Result<LoomTree, TreeError>;
|
|
83
|
+
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { treeIdSchema } from "../ids.js";
|
|
3
|
+
import { err, ok } from "../result.js";
|
|
4
|
+
import { duplicateNodeIds } from "./navigation.js";
|
|
5
|
+
import { elementNodeSchema } from "./node.js";
|
|
6
|
+
/**
|
|
7
|
+
* The persisted document. A tree is a root element plus a revision counter —
|
|
8
|
+
* no timestamps, because minting one is a side effect and every function in
|
|
9
|
+
* this module is pure. Storage and telemetry stamp their own times.
|
|
10
|
+
*
|
|
11
|
+
* `revision` increments once per accepted delta. A delta names the revision it
|
|
12
|
+
* was authored against, which is how a stale AI proposal is detected instead of
|
|
13
|
+
* being applied to a tree that has moved on underneath it.
|
|
14
|
+
*/
|
|
15
|
+
export const TREE_SCHEMA_VERSION = 1;
|
|
16
|
+
export const loomTreeSchema = z.object({
|
|
17
|
+
treeId: treeIdSchema,
|
|
18
|
+
schemaVersion: z.literal(TREE_SCHEMA_VERSION),
|
|
19
|
+
revision: z.number().int().nonnegative(),
|
|
20
|
+
root: elementNodeSchema,
|
|
21
|
+
});
|
|
22
|
+
/**
|
|
23
|
+
* The root is an element rather than any node because a document always has a
|
|
24
|
+
* container: a bare text or slot root has no place to insert into, which would
|
|
25
|
+
* make the first `insert` of every tree a special case.
|
|
26
|
+
*/
|
|
27
|
+
export const createTree = (root, idFactory) => ({
|
|
28
|
+
treeId: idFactory.treeId(),
|
|
29
|
+
schemaVersion: TREE_SCHEMA_VERSION,
|
|
30
|
+
revision: 0,
|
|
31
|
+
root,
|
|
32
|
+
});
|
|
33
|
+
export const withRoot = (tree, root) => ({
|
|
34
|
+
...tree,
|
|
35
|
+
revision: tree.revision + 1,
|
|
36
|
+
root,
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Structural invariants Zod cannot express. Currently one: node ids are unique
|
|
40
|
+
* across the whole tree, since ids are the addressing scheme for every
|
|
41
|
+
* downstream operation.
|
|
42
|
+
*/
|
|
43
|
+
export const validateTreeInvariants = (tree) => {
|
|
44
|
+
const [duplicate] = duplicateNodeIds(tree.root);
|
|
45
|
+
if (duplicate)
|
|
46
|
+
return err({ code: "duplicate-node-id", nodeId: duplicate });
|
|
47
|
+
return ok(tree);
|
|
48
|
+
};
|
|
49
|
+
/** The boundary parse: unknown input in, a validated tree or a TreeError out. */
|
|
50
|
+
export const parseTree = (input) => {
|
|
51
|
+
const parsed = loomTreeSchema.safeParse(input);
|
|
52
|
+
if (!parsed.success) {
|
|
53
|
+
const [issue] = parsed.error.issues;
|
|
54
|
+
return err({
|
|
55
|
+
code: "schema-violation",
|
|
56
|
+
path: issue ? issue.path.join(".") : "",
|
|
57
|
+
detail: issue?.message ?? "unknown schema violation",
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return validateTreeInvariants(parsed.data);
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { ProposalId } from "../ids.js";
|
|
2
|
+
import { type Result } from "../result.js";
|
|
3
|
+
import type { Disposition } from "../runtime/disposition.js";
|
|
4
|
+
import type { EditIntent } from "../runtime/intent.js";
|
|
5
|
+
import { type InterpretationError } from "../runtime/interpreter.js";
|
|
6
|
+
import { type CompositionRuntime } from "../runtime/pipeline.js";
|
|
7
|
+
import type { ProposedChange } from "../runtime/proposal.js";
|
|
8
|
+
import { type StoreError } from "../store/errors.js";
|
|
9
|
+
import type { TreeStore } from "../store/store.js";
|
|
10
|
+
import type { TreeDelta } from "../tree/delta.js";
|
|
11
|
+
import { type TreeError } from "../tree/errors.js";
|
|
12
|
+
import type { LoomTree } from "../tree/tree.js";
|
|
13
|
+
import { type HeldProposal, type HoldError, type HoldStore } from "./held.js";
|
|
14
|
+
/**
|
|
15
|
+
* The one write path (0017).
|
|
16
|
+
*
|
|
17
|
+
* `composeChange` decides whether a change may happen; this decides that it
|
|
18
|
+
* happened. Everything that reaches `store.append` comes through here, so there
|
|
19
|
+
* is exactly one place where a delta becomes history, and it is the same place
|
|
20
|
+
* the Gate ran.
|
|
21
|
+
*
|
|
22
|
+
* The two are kept apart on purpose. The composition runtime is a pure-ish
|
|
23
|
+
* function of a tree it was handed; making it read and write a store would give
|
|
24
|
+
* §2 a persistence dependency it does not need and would make every pipeline
|
|
25
|
+
* test set up a store. This module owns the seam instead: read head, refuse a
|
|
26
|
+
* stale intent before spending a model call on it, compose, persist.
|
|
27
|
+
*/
|
|
28
|
+
export type WritePath = {
|
|
29
|
+
readonly store: TreeStore;
|
|
30
|
+
readonly holds: HoldStore;
|
|
31
|
+
readonly runtime: CompositionRuntime;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Answering a held proposal names the proposal and whoever answered it.
|
|
35
|
+
*
|
|
36
|
+
* The two travel together rather than the actor being an optional trailing
|
|
37
|
+
* argument, because an answer with no one attached is a decision nobody made —
|
|
38
|
+
* and a parameter that is easy to leave off is one that will be (0027). A host
|
|
39
|
+
* with no identities to name omits it deliberately; it cannot omit it by
|
|
40
|
+
* forgetting there was a second argument.
|
|
41
|
+
*/
|
|
42
|
+
export type ProposalAnswer = {
|
|
43
|
+
readonly proposalId: ProposalId;
|
|
44
|
+
readonly actor?: string;
|
|
45
|
+
};
|
|
46
|
+
export type WriteOutcome = {
|
|
47
|
+
readonly kind: "committed";
|
|
48
|
+
readonly tree: LoomTree;
|
|
49
|
+
readonly proposal: ProposedChange;
|
|
50
|
+
readonly disposition: Disposition;
|
|
51
|
+
readonly inverse: TreeDelta;
|
|
52
|
+
} | {
|
|
53
|
+
readonly kind: "held";
|
|
54
|
+
readonly held: HeldProposal;
|
|
55
|
+
} | {
|
|
56
|
+
readonly kind: "refused";
|
|
57
|
+
readonly proposal: ProposedChange;
|
|
58
|
+
readonly disposition: Disposition;
|
|
59
|
+
/**
|
|
60
|
+
* Why no smaller change was offered instead, when a repairer was asked for
|
|
61
|
+
* one and declined. Carried straight through from the composition outcome,
|
|
62
|
+
* where the three endings a refusal can have are set out.
|
|
63
|
+
*/
|
|
64
|
+
readonly repairFailure?: InterpretationError;
|
|
65
|
+
} | {
|
|
66
|
+
readonly kind: "not-interpreted";
|
|
67
|
+
readonly error: InterpretationError;
|
|
68
|
+
} | {
|
|
69
|
+
readonly kind: "not-applicable";
|
|
70
|
+
readonly proposal: ProposedChange;
|
|
71
|
+
readonly error: TreeError;
|
|
72
|
+
}
|
|
73
|
+
/** Persistence refused, including the stale-intent case that never reached a model. */
|
|
74
|
+
| {
|
|
75
|
+
readonly kind: "not-written";
|
|
76
|
+
readonly error: StoreError;
|
|
77
|
+
}
|
|
78
|
+
/** The proposal being confirmed is not in custody — answered already, or never held. */
|
|
79
|
+
| {
|
|
80
|
+
readonly kind: "not-answerable";
|
|
81
|
+
readonly error: HoldError;
|
|
82
|
+
};
|
|
83
|
+
export type WriteOutcomeKind = WriteOutcome["kind"];
|
|
84
|
+
/**
|
|
85
|
+
* Every way a write can end, in the order the runtime reaches them.
|
|
86
|
+
*
|
|
87
|
+
* A `switch` over an outcome is exhaustive without this and always was. What
|
|
88
|
+
* needs a list is everything that walks the endings instead of reacting to one:
|
|
89
|
+
* a page that tells a host what it has to handle, a dashboard that wants a
|
|
90
|
+
* bucket per ending to exist before the first request arrives, a conformance
|
|
91
|
+
* check written against the write path. Each of those otherwise keeps its own
|
|
92
|
+
* copy, and a copy is a list that is silently wrong the day an eighth ending
|
|
93
|
+
* lands.
|
|
94
|
+
*
|
|
95
|
+
* The order is the order a request meets them rather than an order of severity:
|
|
96
|
+
* the two endings a healthy deployment produces, then the refusal, then the four
|
|
97
|
+
* ways a request fails to become a change at all.
|
|
98
|
+
*/
|
|
99
|
+
export declare const WRITE_OUTCOME_KINDS: readonly WriteOutcomeKind[];
|
|
100
|
+
export declare const describeWriteOutcome: (outcome: WriteOutcome) => string;
|
|
101
|
+
export declare const commitIntent: (path: WritePath, intent: EditIntent) => Promise<WriteOutcome>;
|
|
102
|
+
/**
|
|
103
|
+
* Answers a held proposal with yes.
|
|
104
|
+
*
|
|
105
|
+
* A hold names a revision, so a hold whose tree has moved on can never apply
|
|
106
|
+
* again — it is not stale pending a retry, it is dead. Confirming one therefore
|
|
107
|
+
* releases it and reports the conflict, rather than leaving a proposal in the
|
|
108
|
+
* queue that will refuse every time it is answered.
|
|
109
|
+
*
|
|
110
|
+
* The Gate runs again on the way through (`confirmChange`), against the tree as
|
|
111
|
+
* it stands. A human saying yes is permission to proceed, not permission to skip
|
|
112
|
+
* the check.
|
|
113
|
+
*/
|
|
114
|
+
export declare const confirmHeld: (path: WritePath, answer: ProposalAnswer) => Promise<WriteOutcome>;
|
|
115
|
+
/**
|
|
116
|
+
* Answers a held proposal with no.
|
|
117
|
+
*
|
|
118
|
+
* The most informative thing a reviewer does, from §6's point of view: the Gate
|
|
119
|
+
* was willing to offer this change and a human did not want it, which is the
|
|
120
|
+
* only signal that distinguishes a policy that is too permissive from one that
|
|
121
|
+
* is calibrated.
|
|
122
|
+
*/
|
|
123
|
+
export declare const discardHeld: (path: WritePath, answer: ProposalAnswer) => Promise<Result<HeldProposal, HoldError>>;
|
|
124
|
+
//# sourceMappingURL=commit.d.ts.map
|