@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,674 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type ProposalId, type TreeId } from "../ids.js";
|
|
3
|
+
import { type Result } from "../result.js";
|
|
4
|
+
import { type Disposition } from "../runtime/disposition.js";
|
|
5
|
+
import { type EditIntent } from "../runtime/intent.js";
|
|
6
|
+
import { type ProposedChange } from "../runtime/proposal.js";
|
|
7
|
+
/**
|
|
8
|
+
* Custody of the changes the Gate held back.
|
|
9
|
+
*
|
|
10
|
+
* A proposal the Gate marked `requires-confirmation` has to survive the request
|
|
11
|
+
* that produced it, because the human who answers it arrives later. It cannot
|
|
12
|
+
* live in the tree's log: 0016 makes the log the truth and a revision the count
|
|
13
|
+
* of its entries, so an entry that advanced nothing would break the invariant
|
|
14
|
+
* the snapshot is checked against. And it cannot live in the browser, because
|
|
15
|
+
* 0017 already settled that a client never posts an authored change — a
|
|
16
|
+
* confirmation that carried the proposal with it would be exactly that.
|
|
17
|
+
*
|
|
18
|
+
* So it lives here: server-side, keyed by the proposal's own id, and a
|
|
19
|
+
* confirmation names the id rather than the change.
|
|
20
|
+
*/
|
|
21
|
+
export type HeldProposal = {
|
|
22
|
+
readonly proposalId: ProposalId;
|
|
23
|
+
readonly treeId: TreeId;
|
|
24
|
+
/**
|
|
25
|
+
* The revision the proposal was judged against. Held separately from the
|
|
26
|
+
* delta so a reader can tell a hold is stale without parsing the delta, and
|
|
27
|
+
* because it is the intent's promise, not the delta's.
|
|
28
|
+
*/
|
|
29
|
+
readonly baseRevision: number;
|
|
30
|
+
/** Kept whole so a confirmation can be re-judged, and so §6 can pair ask with answer. */
|
|
31
|
+
readonly intent: EditIntent;
|
|
32
|
+
readonly proposal: ProposedChange;
|
|
33
|
+
/** What the Gate said when it held it, so a reviewer sees the reason rather than a verdict. */
|
|
34
|
+
readonly disposition: Disposition;
|
|
35
|
+
readonly heldAt: string;
|
|
36
|
+
};
|
|
37
|
+
export declare const heldProposalSchema: z.ZodObject<{
|
|
38
|
+
proposalId: z.ZodBranded<z.ZodString, "ProposalId">;
|
|
39
|
+
treeId: z.ZodBranded<z.ZodString, "TreeId">;
|
|
40
|
+
baseRevision: z.ZodNumber;
|
|
41
|
+
intent: z.ZodObject<{
|
|
42
|
+
intentId: z.ZodBranded<z.ZodString, "IntentId">;
|
|
43
|
+
treeId: z.ZodBranded<z.ZodString, "TreeId">;
|
|
44
|
+
baseRevision: z.ZodNumber;
|
|
45
|
+
origin: z.ZodEnum<["user-instruction", "system-signal", "scheduled-adaptation", "developer"]>;
|
|
46
|
+
actor: z.ZodOptional<z.ZodString>;
|
|
47
|
+
utterance: z.ZodString;
|
|
48
|
+
scopeNodeId: z.ZodOptional<z.ZodBranded<z.ZodString, "NodeId">>;
|
|
49
|
+
observedAt: z.ZodString;
|
|
50
|
+
}, "strip", z.ZodTypeAny, {
|
|
51
|
+
treeId: string & z.BRAND<"TreeId">;
|
|
52
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
53
|
+
baseRevision: number;
|
|
54
|
+
intentId: string & z.BRAND<"IntentId">;
|
|
55
|
+
utterance: string;
|
|
56
|
+
observedAt: string;
|
|
57
|
+
actor?: string | undefined;
|
|
58
|
+
scopeNodeId?: (string & z.BRAND<"NodeId">) | undefined;
|
|
59
|
+
}, {
|
|
60
|
+
treeId: string;
|
|
61
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
62
|
+
baseRevision: number;
|
|
63
|
+
intentId: string;
|
|
64
|
+
utterance: string;
|
|
65
|
+
observedAt: string;
|
|
66
|
+
actor?: string | undefined;
|
|
67
|
+
scopeNodeId?: string | undefined;
|
|
68
|
+
}>;
|
|
69
|
+
proposal: z.ZodObject<{
|
|
70
|
+
proposalId: z.ZodBranded<z.ZodString, "ProposalId">;
|
|
71
|
+
intentId: z.ZodBranded<z.ZodString, "IntentId">;
|
|
72
|
+
delta: z.ZodObject<{
|
|
73
|
+
deltaId: z.ZodBranded<z.ZodString, "DeltaId">;
|
|
74
|
+
treeId: z.ZodBranded<z.ZodString, "TreeId">;
|
|
75
|
+
baseRevision: z.ZodNumber;
|
|
76
|
+
operations: z.ZodArray<z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
|
|
77
|
+
op: z.ZodLiteral<"insert">;
|
|
78
|
+
parentId: z.ZodBranded<z.ZodString, "NodeId">;
|
|
79
|
+
index: z.ZodNumber;
|
|
80
|
+
node: z.ZodType<import("../index.js").LoomNode, z.ZodTypeDef, unknown>;
|
|
81
|
+
}, "strip", z.ZodTypeAny, {
|
|
82
|
+
index: number;
|
|
83
|
+
op: "insert";
|
|
84
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
85
|
+
node: import("../index.js").LoomNode;
|
|
86
|
+
}, {
|
|
87
|
+
index: number;
|
|
88
|
+
op: "insert";
|
|
89
|
+
parentId: string;
|
|
90
|
+
node?: unknown;
|
|
91
|
+
}>, z.ZodObject<{
|
|
92
|
+
op: z.ZodLiteral<"remove">;
|
|
93
|
+
nodeId: z.ZodBranded<z.ZodString, "NodeId">;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
op: "remove";
|
|
96
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
97
|
+
}, {
|
|
98
|
+
op: "remove";
|
|
99
|
+
nodeId: string;
|
|
100
|
+
}>, z.ZodObject<{
|
|
101
|
+
op: z.ZodLiteral<"move">;
|
|
102
|
+
nodeId: z.ZodBranded<z.ZodString, "NodeId">;
|
|
103
|
+
parentId: z.ZodBranded<z.ZodString, "NodeId">;
|
|
104
|
+
index: z.ZodNumber;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
index: number;
|
|
107
|
+
op: "move";
|
|
108
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
109
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
110
|
+
}, {
|
|
111
|
+
index: number;
|
|
112
|
+
op: "move";
|
|
113
|
+
parentId: string;
|
|
114
|
+
nodeId: string;
|
|
115
|
+
}>, z.ZodObject<{
|
|
116
|
+
op: z.ZodLiteral<"configure">;
|
|
117
|
+
nodeId: z.ZodBranded<z.ZodString, "NodeId">;
|
|
118
|
+
set: z.ZodDefault<z.ZodType<import("../json.js").JsonObject, z.ZodTypeDef, import("../json.js").JsonObject>>;
|
|
119
|
+
unset: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
120
|
+
}, "strip", z.ZodTypeAny, {
|
|
121
|
+
set: import("../json.js").JsonObject;
|
|
122
|
+
op: "configure";
|
|
123
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
124
|
+
unset: string[];
|
|
125
|
+
}, {
|
|
126
|
+
op: "configure";
|
|
127
|
+
nodeId: string;
|
|
128
|
+
set?: import("../json.js").JsonObject | undefined;
|
|
129
|
+
unset?: string[] | undefined;
|
|
130
|
+
}>]>, "many">;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
treeId: string & z.BRAND<"TreeId">;
|
|
133
|
+
operations: ({
|
|
134
|
+
index: number;
|
|
135
|
+
op: "insert";
|
|
136
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
137
|
+
node: import("../index.js").LoomNode;
|
|
138
|
+
} | {
|
|
139
|
+
op: "remove";
|
|
140
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
141
|
+
} | {
|
|
142
|
+
index: number;
|
|
143
|
+
op: "move";
|
|
144
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
145
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
146
|
+
} | {
|
|
147
|
+
set: import("../json.js").JsonObject;
|
|
148
|
+
op: "configure";
|
|
149
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
150
|
+
unset: string[];
|
|
151
|
+
})[];
|
|
152
|
+
deltaId: string & z.BRAND<"DeltaId">;
|
|
153
|
+
baseRevision: number;
|
|
154
|
+
}, {
|
|
155
|
+
treeId: string;
|
|
156
|
+
operations: ({
|
|
157
|
+
index: number;
|
|
158
|
+
op: "insert";
|
|
159
|
+
parentId: string;
|
|
160
|
+
node?: unknown;
|
|
161
|
+
} | {
|
|
162
|
+
op: "remove";
|
|
163
|
+
nodeId: string;
|
|
164
|
+
} | {
|
|
165
|
+
index: number;
|
|
166
|
+
op: "move";
|
|
167
|
+
parentId: string;
|
|
168
|
+
nodeId: string;
|
|
169
|
+
} | {
|
|
170
|
+
op: "configure";
|
|
171
|
+
nodeId: string;
|
|
172
|
+
set?: import("../json.js").JsonObject | undefined;
|
|
173
|
+
unset?: string[] | undefined;
|
|
174
|
+
})[];
|
|
175
|
+
deltaId: string;
|
|
176
|
+
baseRevision: number;
|
|
177
|
+
}>;
|
|
178
|
+
rationale: z.ZodString;
|
|
179
|
+
provenance: z.ZodObject<{
|
|
180
|
+
origin: z.ZodEnum<["user-instruction", "system-signal", "scheduled-adaptation", "developer"]>;
|
|
181
|
+
actor: z.ZodOptional<z.ZodString>;
|
|
182
|
+
interpreter: z.ZodString;
|
|
183
|
+
authoredBy: z.ZodDefault<z.ZodEnum<["model", "runtime"]>>;
|
|
184
|
+
promptHash: z.ZodOptional<z.ZodString>;
|
|
185
|
+
undoes: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
confidence: z.ZodNumber;
|
|
187
|
+
interpretedAt: z.ZodString;
|
|
188
|
+
}, "strip", z.ZodTypeAny, {
|
|
189
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
190
|
+
confidence: number;
|
|
191
|
+
interpreter: string;
|
|
192
|
+
authoredBy: "model" | "runtime";
|
|
193
|
+
interpretedAt: string;
|
|
194
|
+
actor?: string | undefined;
|
|
195
|
+
promptHash?: string | undefined;
|
|
196
|
+
undoes?: number | undefined;
|
|
197
|
+
}, {
|
|
198
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
199
|
+
confidence: number;
|
|
200
|
+
interpreter: string;
|
|
201
|
+
interpretedAt: string;
|
|
202
|
+
actor?: string | undefined;
|
|
203
|
+
authoredBy?: "model" | "runtime" | undefined;
|
|
204
|
+
promptHash?: string | undefined;
|
|
205
|
+
undoes?: number | undefined;
|
|
206
|
+
}>;
|
|
207
|
+
repairOf: z.ZodOptional<z.ZodBranded<z.ZodString, "ProposalId">>;
|
|
208
|
+
discards: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
209
|
+
revision: z.ZodNumber;
|
|
210
|
+
nodeIds: z.ZodArray<z.ZodBranded<z.ZodString, "NodeId">, "many">;
|
|
211
|
+
}, "strip", z.ZodTypeAny, {
|
|
212
|
+
revision: number;
|
|
213
|
+
nodeIds: (string & z.BRAND<"NodeId">)[];
|
|
214
|
+
}, {
|
|
215
|
+
revision: number;
|
|
216
|
+
nodeIds: string[];
|
|
217
|
+
}>, "many">>;
|
|
218
|
+
}, "strip", z.ZodTypeAny, {
|
|
219
|
+
rationale: string;
|
|
220
|
+
intentId: string & z.BRAND<"IntentId">;
|
|
221
|
+
proposalId: string & z.BRAND<"ProposalId">;
|
|
222
|
+
delta: {
|
|
223
|
+
treeId: string & z.BRAND<"TreeId">;
|
|
224
|
+
operations: ({
|
|
225
|
+
index: number;
|
|
226
|
+
op: "insert";
|
|
227
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
228
|
+
node: import("../index.js").LoomNode;
|
|
229
|
+
} | {
|
|
230
|
+
op: "remove";
|
|
231
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
232
|
+
} | {
|
|
233
|
+
index: number;
|
|
234
|
+
op: "move";
|
|
235
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
236
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
237
|
+
} | {
|
|
238
|
+
set: import("../json.js").JsonObject;
|
|
239
|
+
op: "configure";
|
|
240
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
241
|
+
unset: string[];
|
|
242
|
+
})[];
|
|
243
|
+
deltaId: string & z.BRAND<"DeltaId">;
|
|
244
|
+
baseRevision: number;
|
|
245
|
+
};
|
|
246
|
+
provenance: {
|
|
247
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
248
|
+
confidence: number;
|
|
249
|
+
interpreter: string;
|
|
250
|
+
authoredBy: "model" | "runtime";
|
|
251
|
+
interpretedAt: string;
|
|
252
|
+
actor?: string | undefined;
|
|
253
|
+
promptHash?: string | undefined;
|
|
254
|
+
undoes?: number | undefined;
|
|
255
|
+
};
|
|
256
|
+
repairOf?: (string & z.BRAND<"ProposalId">) | undefined;
|
|
257
|
+
discards?: {
|
|
258
|
+
revision: number;
|
|
259
|
+
nodeIds: (string & z.BRAND<"NodeId">)[];
|
|
260
|
+
}[] | undefined;
|
|
261
|
+
}, {
|
|
262
|
+
rationale: string;
|
|
263
|
+
intentId: string;
|
|
264
|
+
proposalId: string;
|
|
265
|
+
delta: {
|
|
266
|
+
treeId: string;
|
|
267
|
+
operations: ({
|
|
268
|
+
index: number;
|
|
269
|
+
op: "insert";
|
|
270
|
+
parentId: string;
|
|
271
|
+
node?: unknown;
|
|
272
|
+
} | {
|
|
273
|
+
op: "remove";
|
|
274
|
+
nodeId: string;
|
|
275
|
+
} | {
|
|
276
|
+
index: number;
|
|
277
|
+
op: "move";
|
|
278
|
+
parentId: string;
|
|
279
|
+
nodeId: string;
|
|
280
|
+
} | {
|
|
281
|
+
op: "configure";
|
|
282
|
+
nodeId: string;
|
|
283
|
+
set?: import("../json.js").JsonObject | undefined;
|
|
284
|
+
unset?: string[] | undefined;
|
|
285
|
+
})[];
|
|
286
|
+
deltaId: string;
|
|
287
|
+
baseRevision: number;
|
|
288
|
+
};
|
|
289
|
+
provenance: {
|
|
290
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
291
|
+
confidence: number;
|
|
292
|
+
interpreter: string;
|
|
293
|
+
interpretedAt: string;
|
|
294
|
+
actor?: string | undefined;
|
|
295
|
+
authoredBy?: "model" | "runtime" | undefined;
|
|
296
|
+
promptHash?: string | undefined;
|
|
297
|
+
undoes?: number | undefined;
|
|
298
|
+
};
|
|
299
|
+
repairOf?: string | undefined;
|
|
300
|
+
discards?: {
|
|
301
|
+
revision: number;
|
|
302
|
+
nodeIds: string[];
|
|
303
|
+
}[] | undefined;
|
|
304
|
+
}>;
|
|
305
|
+
disposition: z.ZodObject<{
|
|
306
|
+
kind: z.ZodEnum<["accepted", "requires-confirmation", "rejected"]>;
|
|
307
|
+
reason: z.ZodObject<{
|
|
308
|
+
code: z.ZodEnum<["confidence-below-floor", "stakes-at-refusal-floor", "irreversible", "discards-later-work", "redirected-submission", "repointed-binding", "stakes-above-ceiling", "confidence-below-minimum", "within-policy"]>;
|
|
309
|
+
detail: z.ZodString;
|
|
310
|
+
}, "strip", z.ZodTypeAny, {
|
|
311
|
+
code: "discards-later-work" | "redirected-submission" | "repointed-binding" | "confidence-below-floor" | "stakes-at-refusal-floor" | "irreversible" | "stakes-above-ceiling" | "confidence-below-minimum" | "within-policy";
|
|
312
|
+
detail: string;
|
|
313
|
+
}, {
|
|
314
|
+
code: "discards-later-work" | "redirected-submission" | "repointed-binding" | "confidence-below-floor" | "stakes-at-refusal-floor" | "irreversible" | "stakes-above-ceiling" | "confidence-below-minimum" | "within-policy";
|
|
315
|
+
detail: string;
|
|
316
|
+
}>;
|
|
317
|
+
stakes: z.ZodEnum<["low", "medium", "high", "critical"]>;
|
|
318
|
+
reversible: z.ZodBoolean;
|
|
319
|
+
confidence: z.ZodNumber;
|
|
320
|
+
policyId: z.ZodDefault<z.ZodString>;
|
|
321
|
+
policyFingerprint: z.ZodOptional<z.ZodString>;
|
|
322
|
+
}, "strip", z.ZodTypeAny, {
|
|
323
|
+
kind: "rejected" | "accepted" | "requires-confirmation";
|
|
324
|
+
confidence: number;
|
|
325
|
+
policyId: string;
|
|
326
|
+
reason: {
|
|
327
|
+
code: "discards-later-work" | "redirected-submission" | "repointed-binding" | "confidence-below-floor" | "stakes-at-refusal-floor" | "irreversible" | "stakes-above-ceiling" | "confidence-below-minimum" | "within-policy";
|
|
328
|
+
detail: string;
|
|
329
|
+
};
|
|
330
|
+
stakes: "low" | "medium" | "high" | "critical";
|
|
331
|
+
reversible: boolean;
|
|
332
|
+
policyFingerprint?: string | undefined;
|
|
333
|
+
}, {
|
|
334
|
+
kind: "rejected" | "accepted" | "requires-confirmation";
|
|
335
|
+
confidence: number;
|
|
336
|
+
reason: {
|
|
337
|
+
code: "discards-later-work" | "redirected-submission" | "repointed-binding" | "confidence-below-floor" | "stakes-at-refusal-floor" | "irreversible" | "stakes-above-ceiling" | "confidence-below-minimum" | "within-policy";
|
|
338
|
+
detail: string;
|
|
339
|
+
};
|
|
340
|
+
stakes: "low" | "medium" | "high" | "critical";
|
|
341
|
+
reversible: boolean;
|
|
342
|
+
policyId?: string | undefined;
|
|
343
|
+
policyFingerprint?: string | undefined;
|
|
344
|
+
}>;
|
|
345
|
+
heldAt: z.ZodString;
|
|
346
|
+
}, "strip", z.ZodTypeAny, {
|
|
347
|
+
treeId: string & z.BRAND<"TreeId">;
|
|
348
|
+
baseRevision: number;
|
|
349
|
+
proposalId: string & z.BRAND<"ProposalId">;
|
|
350
|
+
proposal: {
|
|
351
|
+
rationale: string;
|
|
352
|
+
intentId: string & z.BRAND<"IntentId">;
|
|
353
|
+
proposalId: string & z.BRAND<"ProposalId">;
|
|
354
|
+
delta: {
|
|
355
|
+
treeId: string & z.BRAND<"TreeId">;
|
|
356
|
+
operations: ({
|
|
357
|
+
index: number;
|
|
358
|
+
op: "insert";
|
|
359
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
360
|
+
node: import("../index.js").LoomNode;
|
|
361
|
+
} | {
|
|
362
|
+
op: "remove";
|
|
363
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
364
|
+
} | {
|
|
365
|
+
index: number;
|
|
366
|
+
op: "move";
|
|
367
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
368
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
369
|
+
} | {
|
|
370
|
+
set: import("../json.js").JsonObject;
|
|
371
|
+
op: "configure";
|
|
372
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
373
|
+
unset: string[];
|
|
374
|
+
})[];
|
|
375
|
+
deltaId: string & z.BRAND<"DeltaId">;
|
|
376
|
+
baseRevision: number;
|
|
377
|
+
};
|
|
378
|
+
provenance: {
|
|
379
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
380
|
+
confidence: number;
|
|
381
|
+
interpreter: string;
|
|
382
|
+
authoredBy: "model" | "runtime";
|
|
383
|
+
interpretedAt: string;
|
|
384
|
+
actor?: string | undefined;
|
|
385
|
+
promptHash?: string | undefined;
|
|
386
|
+
undoes?: number | undefined;
|
|
387
|
+
};
|
|
388
|
+
repairOf?: (string & z.BRAND<"ProposalId">) | undefined;
|
|
389
|
+
discards?: {
|
|
390
|
+
revision: number;
|
|
391
|
+
nodeIds: (string & z.BRAND<"NodeId">)[];
|
|
392
|
+
}[] | undefined;
|
|
393
|
+
};
|
|
394
|
+
disposition: {
|
|
395
|
+
kind: "rejected" | "accepted" | "requires-confirmation";
|
|
396
|
+
confidence: number;
|
|
397
|
+
policyId: string;
|
|
398
|
+
reason: {
|
|
399
|
+
code: "discards-later-work" | "redirected-submission" | "repointed-binding" | "confidence-below-floor" | "stakes-at-refusal-floor" | "irreversible" | "stakes-above-ceiling" | "confidence-below-minimum" | "within-policy";
|
|
400
|
+
detail: string;
|
|
401
|
+
};
|
|
402
|
+
stakes: "low" | "medium" | "high" | "critical";
|
|
403
|
+
reversible: boolean;
|
|
404
|
+
policyFingerprint?: string | undefined;
|
|
405
|
+
};
|
|
406
|
+
intent: {
|
|
407
|
+
treeId: string & z.BRAND<"TreeId">;
|
|
408
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
409
|
+
baseRevision: number;
|
|
410
|
+
intentId: string & z.BRAND<"IntentId">;
|
|
411
|
+
utterance: string;
|
|
412
|
+
observedAt: string;
|
|
413
|
+
actor?: string | undefined;
|
|
414
|
+
scopeNodeId?: (string & z.BRAND<"NodeId">) | undefined;
|
|
415
|
+
};
|
|
416
|
+
heldAt: string;
|
|
417
|
+
}, {
|
|
418
|
+
treeId: string;
|
|
419
|
+
baseRevision: number;
|
|
420
|
+
proposalId: string;
|
|
421
|
+
proposal: {
|
|
422
|
+
rationale: string;
|
|
423
|
+
intentId: string;
|
|
424
|
+
proposalId: string;
|
|
425
|
+
delta: {
|
|
426
|
+
treeId: string;
|
|
427
|
+
operations: ({
|
|
428
|
+
index: number;
|
|
429
|
+
op: "insert";
|
|
430
|
+
parentId: string;
|
|
431
|
+
node?: unknown;
|
|
432
|
+
} | {
|
|
433
|
+
op: "remove";
|
|
434
|
+
nodeId: string;
|
|
435
|
+
} | {
|
|
436
|
+
index: number;
|
|
437
|
+
op: "move";
|
|
438
|
+
parentId: string;
|
|
439
|
+
nodeId: string;
|
|
440
|
+
} | {
|
|
441
|
+
op: "configure";
|
|
442
|
+
nodeId: string;
|
|
443
|
+
set?: import("../json.js").JsonObject | undefined;
|
|
444
|
+
unset?: string[] | undefined;
|
|
445
|
+
})[];
|
|
446
|
+
deltaId: string;
|
|
447
|
+
baseRevision: number;
|
|
448
|
+
};
|
|
449
|
+
provenance: {
|
|
450
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
451
|
+
confidence: number;
|
|
452
|
+
interpreter: string;
|
|
453
|
+
interpretedAt: string;
|
|
454
|
+
actor?: string | undefined;
|
|
455
|
+
authoredBy?: "model" | "runtime" | undefined;
|
|
456
|
+
promptHash?: string | undefined;
|
|
457
|
+
undoes?: number | undefined;
|
|
458
|
+
};
|
|
459
|
+
repairOf?: string | undefined;
|
|
460
|
+
discards?: {
|
|
461
|
+
revision: number;
|
|
462
|
+
nodeIds: string[];
|
|
463
|
+
}[] | undefined;
|
|
464
|
+
};
|
|
465
|
+
disposition: {
|
|
466
|
+
kind: "rejected" | "accepted" | "requires-confirmation";
|
|
467
|
+
confidence: number;
|
|
468
|
+
reason: {
|
|
469
|
+
code: "discards-later-work" | "redirected-submission" | "repointed-binding" | "confidence-below-floor" | "stakes-at-refusal-floor" | "irreversible" | "stakes-above-ceiling" | "confidence-below-minimum" | "within-policy";
|
|
470
|
+
detail: string;
|
|
471
|
+
};
|
|
472
|
+
stakes: "low" | "medium" | "high" | "critical";
|
|
473
|
+
reversible: boolean;
|
|
474
|
+
policyId?: string | undefined;
|
|
475
|
+
policyFingerprint?: string | undefined;
|
|
476
|
+
};
|
|
477
|
+
intent: {
|
|
478
|
+
treeId: string;
|
|
479
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
480
|
+
baseRevision: number;
|
|
481
|
+
intentId: string;
|
|
482
|
+
utterance: string;
|
|
483
|
+
observedAt: string;
|
|
484
|
+
actor?: string | undefined;
|
|
485
|
+
scopeNodeId?: string | undefined;
|
|
486
|
+
};
|
|
487
|
+
heldAt: string;
|
|
488
|
+
}>;
|
|
489
|
+
export type HoldError =
|
|
490
|
+
/** Nothing under this id: never held, already answered, or expired. */
|
|
491
|
+
{
|
|
492
|
+
readonly code: "not-held";
|
|
493
|
+
readonly proposalId: ProposalId;
|
|
494
|
+
} | {
|
|
495
|
+
readonly code: "already-held";
|
|
496
|
+
readonly proposalId: ProposalId;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* The store did not answer. Nothing is known about what it holds, and the
|
|
500
|
+
* same call a moment later may well succeed.
|
|
501
|
+
*/
|
|
502
|
+
| {
|
|
503
|
+
readonly code: "unavailable";
|
|
504
|
+
readonly detail: string;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* The store answered, and something it returned is not a hold this build can
|
|
508
|
+
* read.
|
|
509
|
+
*
|
|
510
|
+
* Separate from `unavailable` because the two want opposite next moves from
|
|
511
|
+
* whoever is reading the screen: a store that did not answer is waited out,
|
|
512
|
+
* and a row that did not parse is gone and looked at. A reader told only
|
|
513
|
+
* "unavailable" either waits out a problem that does not resolve or
|
|
514
|
+
* investigates a blip, and the store is the only party that knows which.
|
|
515
|
+
*/
|
|
516
|
+
| {
|
|
517
|
+
readonly code: "unreadable";
|
|
518
|
+
readonly detail: string;
|
|
519
|
+
};
|
|
520
|
+
export declare const describeHoldError: (error: HoldError) => string;
|
|
521
|
+
/**
|
|
522
|
+
* Reads a hold back out of storage, or says why it could not.
|
|
523
|
+
*
|
|
524
|
+
* The assertion is about the shape of optionality and never about validity — the
|
|
525
|
+
* schema above establishes that. Zod infers an optional field as `T | undefined`,
|
|
526
|
+
* which `exactOptionalPropertyTypes` distinguishes from an absent key, while JSON
|
|
527
|
+
* has no `undefined` at all: a stored hold either carries `actor` or omits it,
|
|
528
|
+
* and never holds it as an explicit nothing. So the parsed value already has the
|
|
529
|
+
* shape the type asks for, and this is the one place that has to say so.
|
|
530
|
+
*/
|
|
531
|
+
export declare const parseHeldProposal: (row: unknown) => Result<HeldProposal, HoldError>;
|
|
532
|
+
/**
|
|
533
|
+
* Where a page of holds resumes: an instant and an id, never an instant alone.
|
|
534
|
+
*
|
|
535
|
+
* `heldAt` is not unique and is not close to unique — two proposals judged in
|
|
536
|
+
* the same request share one, and every fixture in the contract suite shares
|
|
537
|
+
* one by default. A cursor naming only the instant would repeat a hold or skip
|
|
538
|
+
* one depending on which side of the comparison it fell, which is the failure a
|
|
539
|
+
* cursor exists to prevent. `proposalId` is the store's primary key, so
|
|
540
|
+
* `(heldAt, proposalId)` is total and stable — the property 0020 requires of
|
|
541
|
+
* anything a cursor is taken from.
|
|
542
|
+
*/
|
|
543
|
+
export type HoldPosition = {
|
|
544
|
+
readonly heldAt: string;
|
|
545
|
+
readonly proposalId: ProposalId;
|
|
546
|
+
};
|
|
547
|
+
/**
|
|
548
|
+
* The order both listings are in: oldest first, then by id.
|
|
549
|
+
*
|
|
550
|
+
* Written once and shared for the reason `pageEnds` and `anchorBound` are — it
|
|
551
|
+
* is the part most likely to drift between two backends and least likely to be
|
|
552
|
+
* noticed when it does. `postgresHoldStore` is the one caller that cannot use
|
|
553
|
+
* it, because ordering has to happen in the statement for an index to be usable;
|
|
554
|
+
* its `ORDER BY` names this function, and the contract suite is what holds the
|
|
555
|
+
* two to the same answer.
|
|
556
|
+
*/
|
|
557
|
+
export declare const compareHolds: (left: HoldPosition, right: HoldPosition) => number;
|
|
558
|
+
export declare const holdCursor: (position: HoldPosition) => string;
|
|
559
|
+
/**
|
|
560
|
+
* Reads a cursor back into the position it names, or says it cannot.
|
|
561
|
+
*
|
|
562
|
+
* Unreadable means the same thing here as everywhere else in Loom (see
|
|
563
|
+
* `cursorPosition`): start at the beginning, rather than one implementation
|
|
564
|
+
* refusing what another silently accepts. Both halves are checked, because a
|
|
565
|
+
* cursor that survived a URL is a value from outside — and a position built
|
|
566
|
+
* from an instant that is not one would compare against nonsense and page from
|
|
567
|
+
* somewhere no caller asked for. The separator is a space, which neither an
|
|
568
|
+
* RFC 3339 instant nor an id can contain.
|
|
569
|
+
*/
|
|
570
|
+
export declare const holdCursorPosition: (cursor: string | undefined) => HoldPosition | undefined;
|
|
571
|
+
/**
|
|
572
|
+
* The two columns a page is ordered by, checked, or nothing.
|
|
573
|
+
*
|
|
574
|
+
* Separate from reading a whole hold because it is a strictly smaller question
|
|
575
|
+
* and it is the one a listing cannot proceed without. A backend that skips the
|
|
576
|
+
* rows it could not read still has to page past them, and it can only do that
|
|
577
|
+
* if it can position them — so the position is parsed first and on its own,
|
|
578
|
+
* and a row that has one is a row the queue can always name and always get
|
|
579
|
+
* beyond, whatever its payload turned out to be.
|
|
580
|
+
*/
|
|
581
|
+
export declare const holdPosition: (row: {
|
|
582
|
+
readonly heldAt: string;
|
|
583
|
+
readonly proposalId: string;
|
|
584
|
+
}) => HoldPosition | undefined;
|
|
585
|
+
/**
|
|
586
|
+
* Smaller than a tree listing's page, because a held proposal is the heaviest
|
|
587
|
+
* row this store keeps: a whole delta, the intent that asked for it, and the
|
|
588
|
+
* judgment that held it back. A reviewer reads them one at a time, so a page is
|
|
589
|
+
* sized for a screen rather than for a fold.
|
|
590
|
+
*/
|
|
591
|
+
export declare const DEFAULT_HOLD_LIMIT = 25;
|
|
592
|
+
export declare const MAX_HOLD_LIMIT = 100;
|
|
593
|
+
export declare const clampHoldLimit: (limit: number | undefined) => number;
|
|
594
|
+
export type HoldListRequest = {
|
|
595
|
+
/**
|
|
596
|
+
* Opaque to the caller: the previous page's `cursor`, passed back unread. A
|
|
597
|
+
* cursor naming a hold that has since been answered is not an error — the
|
|
598
|
+
* page resumes from the next position after it, which is what makes a queue
|
|
599
|
+
* safe to page through while people are emptying it.
|
|
600
|
+
*/
|
|
601
|
+
readonly cursor?: string;
|
|
602
|
+
/** Clamped by the implementation — see `clampHoldLimit`. */
|
|
603
|
+
readonly limit?: number;
|
|
604
|
+
};
|
|
605
|
+
/**
|
|
606
|
+
* A row the listing could place and could not read.
|
|
607
|
+
*
|
|
608
|
+
* It is a `HoldPosition` and a reason, which is everything a reviewer needs to
|
|
609
|
+
* go and look: the position is the row's primary key and the instant beside it,
|
|
610
|
+
* so it names the row in the table, and it sorts in `compareHolds` order
|
|
611
|
+
* alongside the holds that did parse.
|
|
612
|
+
*
|
|
613
|
+
* `detail` is the same sentence `parseHeldProposal` would have failed with. It
|
|
614
|
+
* says which field disagreed, which is the difference between a reviewer
|
|
615
|
+
* knowing a rollout is mid-flight and a reviewer knowing only that something is
|
|
616
|
+
* wrong.
|
|
617
|
+
*/
|
|
618
|
+
export type UnreadableHold = HoldPosition & {
|
|
619
|
+
readonly detail: string;
|
|
620
|
+
};
|
|
621
|
+
/**
|
|
622
|
+
* What a listing found, and what it could not read while finding it.
|
|
623
|
+
*
|
|
624
|
+
* Both halves, for the reason 0138 gives for `MarkedHolds`: a caller that must
|
|
625
|
+
* render every row needs the ones that worked and the ones that did not in one
|
|
626
|
+
* answer, in one order, rather than an error standing in for a page. A listing
|
|
627
|
+
* over an empty store and a listing over a store whose every row is from a
|
|
628
|
+
* later build are different facts, and only this shape can tell them apart.
|
|
629
|
+
*/
|
|
630
|
+
export type HoldListing = {
|
|
631
|
+
readonly held: readonly HeldProposal[];
|
|
632
|
+
readonly unreadable: readonly UnreadableHold[];
|
|
633
|
+
};
|
|
634
|
+
export type HoldPage = HoldListing & {
|
|
635
|
+
/** `null` when this was the last page. */
|
|
636
|
+
readonly cursor: string | null;
|
|
637
|
+
};
|
|
638
|
+
/**
|
|
639
|
+
* `release` is a take, not a read: it removes and returns in one step, which is
|
|
640
|
+
* what makes answering a proposal exactly once a property of the store rather
|
|
641
|
+
* than a rule every caller has to remember. Confirming and discarding both go
|
|
642
|
+
* through it, so two confirmations racing cannot both apply the same delta.
|
|
643
|
+
*
|
|
644
|
+
* Two listings, and the difference between them is the question being asked.
|
|
645
|
+
* `forTree` answers *what is waiting on this page*, which a screen showing one
|
|
646
|
+
* tree already knows the scope of; it is unpaged because the holds against a
|
|
647
|
+
* single tree are bounded by how many changes one document can have in flight.
|
|
648
|
+
* `waiting` answers *does anything need me at all*, which is the portal's front
|
|
649
|
+
* door and cannot be assembled from the first: doing it that way is one query
|
|
650
|
+
* per tree, over a listing that is itself bounded, so the answer is O(pages)
|
|
651
|
+
* reads and still cannot be complete. Neither widens what a handle can see —
|
|
652
|
+
* both are the holds this handle could already reach one tree at a time, which
|
|
653
|
+
* is why 0020 permits the second.
|
|
654
|
+
*
|
|
655
|
+
* Both answer with a `HoldListing` rather than an array, and the rule they keep
|
|
656
|
+
* is 0175's: a row the implementation could place and could not read is
|
|
657
|
+
* skipped, named under `unreadable` and paged past. A listing fails outright
|
|
658
|
+
* only when it cannot place a row at all, because that is the one case where
|
|
659
|
+
* skipping would take everything after it off the queue in silence.
|
|
660
|
+
*/
|
|
661
|
+
export interface HoldStore {
|
|
662
|
+
readonly hold: (held: HeldProposal) => Promise<Result<HeldProposal, HoldError>>;
|
|
663
|
+
readonly get: (proposalId: ProposalId) => Promise<Result<HeldProposal, HoldError>>;
|
|
664
|
+
readonly forTree: (treeId: TreeId) => Promise<Result<HoldListing, HoldError>>;
|
|
665
|
+
readonly waiting: (request?: HoldListRequest) => Promise<Result<HoldPage, HoldError>>;
|
|
666
|
+
readonly release: (proposalId: ProposalId) => Promise<Result<HeldProposal, HoldError>>;
|
|
667
|
+
}
|
|
668
|
+
/**
|
|
669
|
+
* The reference implementation. Both listings are in `compareHolds` order, so a
|
|
670
|
+
* queue reads oldest-first: a change that has been waiting longest is the one
|
|
671
|
+
* most likely to be about to go stale.
|
|
672
|
+
*/
|
|
673
|
+
export declare const memoryHoldStore: () => HoldStore;
|
|
674
|
+
//# sourceMappingURL=held.d.ts.map
|