@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,423 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type IntentId, type NodeId, type ProposalId } from "../ids.js";
|
|
3
|
+
import { type TreeDelta } from "../tree/delta.js";
|
|
4
|
+
import { type IntentOrigin } from "./intent.js";
|
|
5
|
+
/**
|
|
6
|
+
* Provenance answers "where did this change come from" in enough detail to
|
|
7
|
+
* audit it later: who or what asked, which interpreter turned the ask into a
|
|
8
|
+
* delta, and how sure that interpreter was. Telemetry consumes exactly this
|
|
9
|
+
* record alongside the disposition and the eventual outcome.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Who wrote the delta, as opposed to which component carried it.
|
|
13
|
+
*
|
|
14
|
+
* `interpreter` names the thing; this names its kind, and the difference is
|
|
15
|
+
* load-bearing. `confidence` is a self-grade, and only a model grades itself —
|
|
16
|
+
* a delta the runtime computed, such as the inverse behind a revert, has no
|
|
17
|
+
* opinion to be right or wrong about. Calibration (0031) measures self-grades,
|
|
18
|
+
* so it has to tell the two apart by type rather than by recognising a magic
|
|
19
|
+
* interpreter name.
|
|
20
|
+
*/
|
|
21
|
+
export declare const authorKindSchema: z.ZodEnum<["model", "runtime"]>;
|
|
22
|
+
export type AuthorKind = z.infer<typeof authorKindSchema>;
|
|
23
|
+
export declare const provenanceSchema: z.ZodObject<{
|
|
24
|
+
origin: z.ZodEnum<["user-instruction", "system-signal", "scheduled-adaptation", "developer"]>;
|
|
25
|
+
/**
|
|
26
|
+
* The user or system component that raised the intent, carried from
|
|
27
|
+
* `EditIntent.actor`. Opaque to the runtime: a host decides what an identity
|
|
28
|
+
* looks like, and nothing here parses it (0027).
|
|
29
|
+
*/
|
|
30
|
+
actor: z.ZodOptional<z.ZodString>;
|
|
31
|
+
/** Identifies what produced the delta — a model id, or a named component. */
|
|
32
|
+
interpreter: z.ZodString;
|
|
33
|
+
/**
|
|
34
|
+
* Defaulted rather than required, because every provenance written before
|
|
35
|
+
* this field existed was a model's. Absence means "recorded before the
|
|
36
|
+
* runtime authored anything", and that reading stays true forever.
|
|
37
|
+
*/
|
|
38
|
+
authoredBy: z.ZodDefault<z.ZodEnum<["model", "runtime"]>>;
|
|
39
|
+
/** Hash rather than the prompt itself, so provenance carries no user content. */
|
|
40
|
+
promptHash: z.ZodOptional<z.ZodString>;
|
|
41
|
+
/**
|
|
42
|
+
* The revision this change puts back, when it puts one back.
|
|
43
|
+
*
|
|
44
|
+
* `interpreter` already says *that* a change is an undo — `loom/revert` is a
|
|
45
|
+
* name a surface can read, which is the whole reason it is a stamp rather than
|
|
46
|
+
* a sentence. This says *which*, and it is here rather than on the proposal
|
|
47
|
+
* because provenance is the part of a proposal a log keeps (`StoredRevision`).
|
|
48
|
+
* A surface reading a log it did not write is exactly the reader that has no
|
|
49
|
+
* other way to know, and the one this was filed for.
|
|
50
|
+
*
|
|
51
|
+
* Before it existed the link was real but only ever narrated: `utterance` said
|
|
52
|
+
* `Undo revision 1.` and the rationale said so again in a longer sentence. Both
|
|
53
|
+
* are composed for people, and a surface needing the link had to parse prose it
|
|
54
|
+
* does not own — the thing the interpreter stamp exists to avoid — or carry the
|
|
55
|
+
* number itself, which only the caller that asked for the undo can do.
|
|
56
|
+
*
|
|
57
|
+
* Optional, and absent on every change that is not an undo. Absence therefore
|
|
58
|
+
* means "this puts nothing back", which is true of the whole log written before
|
|
59
|
+
* the field existed as well.
|
|
60
|
+
*/
|
|
61
|
+
undoes: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
confidence: z.ZodNumber;
|
|
63
|
+
interpretedAt: z.ZodString;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
66
|
+
confidence: number;
|
|
67
|
+
interpreter: string;
|
|
68
|
+
authoredBy: "model" | "runtime";
|
|
69
|
+
interpretedAt: string;
|
|
70
|
+
actor?: string | undefined;
|
|
71
|
+
promptHash?: string | undefined;
|
|
72
|
+
undoes?: number | undefined;
|
|
73
|
+
}, {
|
|
74
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
75
|
+
confidence: number;
|
|
76
|
+
interpreter: string;
|
|
77
|
+
interpretedAt: string;
|
|
78
|
+
actor?: string | undefined;
|
|
79
|
+
authoredBy?: "model" | "runtime" | undefined;
|
|
80
|
+
promptHash?: string | undefined;
|
|
81
|
+
undoes?: number | undefined;
|
|
82
|
+
}>;
|
|
83
|
+
export type Provenance = {
|
|
84
|
+
readonly origin: IntentOrigin;
|
|
85
|
+
readonly actor?: string;
|
|
86
|
+
readonly interpreter: string;
|
|
87
|
+
readonly authoredBy: AuthorKind;
|
|
88
|
+
readonly promptHash?: string;
|
|
89
|
+
/** The revision this change puts back; absent unless it puts one back. */
|
|
90
|
+
readonly undoes?: number;
|
|
91
|
+
readonly confidence: number;
|
|
92
|
+
readonly interpretedAt: string;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Work a change would take out of the current tree that its own delta does not
|
|
96
|
+
* show: a revision already in the log, and which of the nodes it named this
|
|
97
|
+
* change writes over.
|
|
98
|
+
*
|
|
99
|
+
* The delta is self-contained by construction (0001), which is what makes it
|
|
100
|
+
* individually reviewable — and is also why it cannot express this. "Set this
|
|
101
|
+
* text back to what it was" and "set this text back to what it was, discarding
|
|
102
|
+
* what two people wrote afterwards" are the same four operations. Only something
|
|
103
|
+
* holding the log can tell them apart, so whatever computed the delta from a log
|
|
104
|
+
* says so here.
|
|
105
|
+
*
|
|
106
|
+
* Nothing is lost from the record when this is applied. The discarded revisions
|
|
107
|
+
* stay in the log and the tree they made can be restored by undoing the undo,
|
|
108
|
+
* which is why this raises stakes rather than making a change irreversible.
|
|
109
|
+
*/
|
|
110
|
+
export declare const discardedWorkSchema: z.ZodObject<{
|
|
111
|
+
revision: z.ZodNumber;
|
|
112
|
+
nodeIds: z.ZodArray<z.ZodBranded<z.ZodString, "NodeId">, "many">;
|
|
113
|
+
}, "strip", z.ZodTypeAny, {
|
|
114
|
+
revision: number;
|
|
115
|
+
nodeIds: (string & z.BRAND<"NodeId">)[];
|
|
116
|
+
}, {
|
|
117
|
+
revision: number;
|
|
118
|
+
nodeIds: string[];
|
|
119
|
+
}>;
|
|
120
|
+
export type DiscardedWork = {
|
|
121
|
+
readonly revision: number;
|
|
122
|
+
readonly nodeIds: readonly NodeId[];
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
* The unit the Gate reviews: a concrete delta, why the interpreter believes it
|
|
126
|
+
* satisfies the intent, and where it came from. A proposal is inert — nothing
|
|
127
|
+
* has touched the tree yet.
|
|
128
|
+
*/
|
|
129
|
+
export declare const proposedChangeSchema: z.ZodObject<{
|
|
130
|
+
proposalId: z.ZodBranded<z.ZodString, "ProposalId">;
|
|
131
|
+
intentId: z.ZodBranded<z.ZodString, "IntentId">;
|
|
132
|
+
delta: z.ZodObject<{
|
|
133
|
+
deltaId: z.ZodBranded<z.ZodString, "DeltaId">;
|
|
134
|
+
treeId: z.ZodBranded<z.ZodString, "TreeId">;
|
|
135
|
+
baseRevision: z.ZodNumber;
|
|
136
|
+
operations: z.ZodArray<z.ZodDiscriminatedUnion<"op", [z.ZodObject<{
|
|
137
|
+
op: z.ZodLiteral<"insert">;
|
|
138
|
+
parentId: z.ZodBranded<z.ZodString, "NodeId">;
|
|
139
|
+
index: z.ZodNumber;
|
|
140
|
+
node: z.ZodType<import("../index.js").LoomNode, z.ZodTypeDef, unknown>;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
index: number;
|
|
143
|
+
op: "insert";
|
|
144
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
145
|
+
node: import("../index.js").LoomNode;
|
|
146
|
+
}, {
|
|
147
|
+
index: number;
|
|
148
|
+
op: "insert";
|
|
149
|
+
parentId: string;
|
|
150
|
+
node?: unknown;
|
|
151
|
+
}>, z.ZodObject<{
|
|
152
|
+
op: z.ZodLiteral<"remove">;
|
|
153
|
+
nodeId: z.ZodBranded<z.ZodString, "NodeId">;
|
|
154
|
+
}, "strip", z.ZodTypeAny, {
|
|
155
|
+
op: "remove";
|
|
156
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
157
|
+
}, {
|
|
158
|
+
op: "remove";
|
|
159
|
+
nodeId: string;
|
|
160
|
+
}>, z.ZodObject<{
|
|
161
|
+
op: z.ZodLiteral<"move">;
|
|
162
|
+
nodeId: z.ZodBranded<z.ZodString, "NodeId">;
|
|
163
|
+
parentId: z.ZodBranded<z.ZodString, "NodeId">;
|
|
164
|
+
index: z.ZodNumber;
|
|
165
|
+
}, "strip", z.ZodTypeAny, {
|
|
166
|
+
index: number;
|
|
167
|
+
op: "move";
|
|
168
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
169
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
170
|
+
}, {
|
|
171
|
+
index: number;
|
|
172
|
+
op: "move";
|
|
173
|
+
parentId: string;
|
|
174
|
+
nodeId: string;
|
|
175
|
+
}>, z.ZodObject<{
|
|
176
|
+
op: z.ZodLiteral<"configure">;
|
|
177
|
+
nodeId: z.ZodBranded<z.ZodString, "NodeId">;
|
|
178
|
+
set: z.ZodDefault<z.ZodType<import("../json.js").JsonObject, z.ZodTypeDef, import("../json.js").JsonObject>>;
|
|
179
|
+
unset: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
set: import("../json.js").JsonObject;
|
|
182
|
+
op: "configure";
|
|
183
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
184
|
+
unset: string[];
|
|
185
|
+
}, {
|
|
186
|
+
op: "configure";
|
|
187
|
+
nodeId: string;
|
|
188
|
+
set?: import("../json.js").JsonObject | undefined;
|
|
189
|
+
unset?: string[] | undefined;
|
|
190
|
+
}>]>, "many">;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
treeId: string & z.BRAND<"TreeId">;
|
|
193
|
+
operations: ({
|
|
194
|
+
index: number;
|
|
195
|
+
op: "insert";
|
|
196
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
197
|
+
node: import("../index.js").LoomNode;
|
|
198
|
+
} | {
|
|
199
|
+
op: "remove";
|
|
200
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
201
|
+
} | {
|
|
202
|
+
index: number;
|
|
203
|
+
op: "move";
|
|
204
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
205
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
206
|
+
} | {
|
|
207
|
+
set: import("../json.js").JsonObject;
|
|
208
|
+
op: "configure";
|
|
209
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
210
|
+
unset: string[];
|
|
211
|
+
})[];
|
|
212
|
+
deltaId: string & z.BRAND<"DeltaId">;
|
|
213
|
+
baseRevision: number;
|
|
214
|
+
}, {
|
|
215
|
+
treeId: string;
|
|
216
|
+
operations: ({
|
|
217
|
+
index: number;
|
|
218
|
+
op: "insert";
|
|
219
|
+
parentId: string;
|
|
220
|
+
node?: unknown;
|
|
221
|
+
} | {
|
|
222
|
+
op: "remove";
|
|
223
|
+
nodeId: string;
|
|
224
|
+
} | {
|
|
225
|
+
index: number;
|
|
226
|
+
op: "move";
|
|
227
|
+
parentId: string;
|
|
228
|
+
nodeId: string;
|
|
229
|
+
} | {
|
|
230
|
+
op: "configure";
|
|
231
|
+
nodeId: string;
|
|
232
|
+
set?: import("../json.js").JsonObject | undefined;
|
|
233
|
+
unset?: string[] | undefined;
|
|
234
|
+
})[];
|
|
235
|
+
deltaId: string;
|
|
236
|
+
baseRevision: number;
|
|
237
|
+
}>;
|
|
238
|
+
rationale: z.ZodString;
|
|
239
|
+
provenance: z.ZodObject<{
|
|
240
|
+
origin: z.ZodEnum<["user-instruction", "system-signal", "scheduled-adaptation", "developer"]>;
|
|
241
|
+
/**
|
|
242
|
+
* The user or system component that raised the intent, carried from
|
|
243
|
+
* `EditIntent.actor`. Opaque to the runtime: a host decides what an identity
|
|
244
|
+
* looks like, and nothing here parses it (0027).
|
|
245
|
+
*/
|
|
246
|
+
actor: z.ZodOptional<z.ZodString>;
|
|
247
|
+
/** Identifies what produced the delta — a model id, or a named component. */
|
|
248
|
+
interpreter: z.ZodString;
|
|
249
|
+
/**
|
|
250
|
+
* Defaulted rather than required, because every provenance written before
|
|
251
|
+
* this field existed was a model's. Absence means "recorded before the
|
|
252
|
+
* runtime authored anything", and that reading stays true forever.
|
|
253
|
+
*/
|
|
254
|
+
authoredBy: z.ZodDefault<z.ZodEnum<["model", "runtime"]>>;
|
|
255
|
+
/** Hash rather than the prompt itself, so provenance carries no user content. */
|
|
256
|
+
promptHash: z.ZodOptional<z.ZodString>;
|
|
257
|
+
/**
|
|
258
|
+
* The revision this change puts back, when it puts one back.
|
|
259
|
+
*
|
|
260
|
+
* `interpreter` already says *that* a change is an undo — `loom/revert` is a
|
|
261
|
+
* name a surface can read, which is the whole reason it is a stamp rather than
|
|
262
|
+
* a sentence. This says *which*, and it is here rather than on the proposal
|
|
263
|
+
* because provenance is the part of a proposal a log keeps (`StoredRevision`).
|
|
264
|
+
* A surface reading a log it did not write is exactly the reader that has no
|
|
265
|
+
* other way to know, and the one this was filed for.
|
|
266
|
+
*
|
|
267
|
+
* Before it existed the link was real but only ever narrated: `utterance` said
|
|
268
|
+
* `Undo revision 1.` and the rationale said so again in a longer sentence. Both
|
|
269
|
+
* are composed for people, and a surface needing the link had to parse prose it
|
|
270
|
+
* does not own — the thing the interpreter stamp exists to avoid — or carry the
|
|
271
|
+
* number itself, which only the caller that asked for the undo can do.
|
|
272
|
+
*
|
|
273
|
+
* Optional, and absent on every change that is not an undo. Absence therefore
|
|
274
|
+
* means "this puts nothing back", which is true of the whole log written before
|
|
275
|
+
* the field existed as well.
|
|
276
|
+
*/
|
|
277
|
+
undoes: z.ZodOptional<z.ZodNumber>;
|
|
278
|
+
confidence: z.ZodNumber;
|
|
279
|
+
interpretedAt: z.ZodString;
|
|
280
|
+
}, "strip", z.ZodTypeAny, {
|
|
281
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
282
|
+
confidence: number;
|
|
283
|
+
interpreter: string;
|
|
284
|
+
authoredBy: "model" | "runtime";
|
|
285
|
+
interpretedAt: string;
|
|
286
|
+
actor?: string | undefined;
|
|
287
|
+
promptHash?: string | undefined;
|
|
288
|
+
undoes?: number | undefined;
|
|
289
|
+
}, {
|
|
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
|
+
/**
|
|
300
|
+
* Set when this proposal replaces one the Gate refused. Stamped by the
|
|
301
|
+
* runtime rather than claimed by the proposer, so a weaker change offered
|
|
302
|
+
* after a refusal cannot present itself as an unrelated first attempt.
|
|
303
|
+
*/
|
|
304
|
+
repairOf: z.ZodOptional<z.ZodBranded<z.ZodString, "ProposalId">>;
|
|
305
|
+
/**
|
|
306
|
+
* Optional and absent by default: a proposal that declares nothing is one
|
|
307
|
+
* whose author had no log to consult, which is every proposal a model makes.
|
|
308
|
+
* Absence therefore means "not declared" rather than "nothing discarded", and
|
|
309
|
+
* that reading stays true forever (0035).
|
|
310
|
+
*/
|
|
311
|
+
discards: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
312
|
+
revision: z.ZodNumber;
|
|
313
|
+
nodeIds: z.ZodArray<z.ZodBranded<z.ZodString, "NodeId">, "many">;
|
|
314
|
+
}, "strip", z.ZodTypeAny, {
|
|
315
|
+
revision: number;
|
|
316
|
+
nodeIds: (string & z.BRAND<"NodeId">)[];
|
|
317
|
+
}, {
|
|
318
|
+
revision: number;
|
|
319
|
+
nodeIds: string[];
|
|
320
|
+
}>, "many">>;
|
|
321
|
+
}, "strip", z.ZodTypeAny, {
|
|
322
|
+
rationale: string;
|
|
323
|
+
intentId: string & z.BRAND<"IntentId">;
|
|
324
|
+
proposalId: string & z.BRAND<"ProposalId">;
|
|
325
|
+
delta: {
|
|
326
|
+
treeId: string & z.BRAND<"TreeId">;
|
|
327
|
+
operations: ({
|
|
328
|
+
index: number;
|
|
329
|
+
op: "insert";
|
|
330
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
331
|
+
node: import("../index.js").LoomNode;
|
|
332
|
+
} | {
|
|
333
|
+
op: "remove";
|
|
334
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
335
|
+
} | {
|
|
336
|
+
index: number;
|
|
337
|
+
op: "move";
|
|
338
|
+
parentId: string & z.BRAND<"NodeId">;
|
|
339
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
340
|
+
} | {
|
|
341
|
+
set: import("../json.js").JsonObject;
|
|
342
|
+
op: "configure";
|
|
343
|
+
nodeId: string & z.BRAND<"NodeId">;
|
|
344
|
+
unset: string[];
|
|
345
|
+
})[];
|
|
346
|
+
deltaId: string & z.BRAND<"DeltaId">;
|
|
347
|
+
baseRevision: number;
|
|
348
|
+
};
|
|
349
|
+
provenance: {
|
|
350
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
351
|
+
confidence: number;
|
|
352
|
+
interpreter: string;
|
|
353
|
+
authoredBy: "model" | "runtime";
|
|
354
|
+
interpretedAt: string;
|
|
355
|
+
actor?: string | undefined;
|
|
356
|
+
promptHash?: string | undefined;
|
|
357
|
+
undoes?: number | undefined;
|
|
358
|
+
};
|
|
359
|
+
repairOf?: (string & z.BRAND<"ProposalId">) | undefined;
|
|
360
|
+
discards?: {
|
|
361
|
+
revision: number;
|
|
362
|
+
nodeIds: (string & z.BRAND<"NodeId">)[];
|
|
363
|
+
}[] | undefined;
|
|
364
|
+
}, {
|
|
365
|
+
rationale: string;
|
|
366
|
+
intentId: string;
|
|
367
|
+
proposalId: string;
|
|
368
|
+
delta: {
|
|
369
|
+
treeId: string;
|
|
370
|
+
operations: ({
|
|
371
|
+
index: number;
|
|
372
|
+
op: "insert";
|
|
373
|
+
parentId: string;
|
|
374
|
+
node?: unknown;
|
|
375
|
+
} | {
|
|
376
|
+
op: "remove";
|
|
377
|
+
nodeId: string;
|
|
378
|
+
} | {
|
|
379
|
+
index: number;
|
|
380
|
+
op: "move";
|
|
381
|
+
parentId: string;
|
|
382
|
+
nodeId: string;
|
|
383
|
+
} | {
|
|
384
|
+
op: "configure";
|
|
385
|
+
nodeId: string;
|
|
386
|
+
set?: import("../json.js").JsonObject | undefined;
|
|
387
|
+
unset?: string[] | undefined;
|
|
388
|
+
})[];
|
|
389
|
+
deltaId: string;
|
|
390
|
+
baseRevision: number;
|
|
391
|
+
};
|
|
392
|
+
provenance: {
|
|
393
|
+
origin: "user-instruction" | "system-signal" | "scheduled-adaptation" | "developer";
|
|
394
|
+
confidence: number;
|
|
395
|
+
interpreter: string;
|
|
396
|
+
interpretedAt: string;
|
|
397
|
+
actor?: string | undefined;
|
|
398
|
+
authoredBy?: "model" | "runtime" | undefined;
|
|
399
|
+
promptHash?: string | undefined;
|
|
400
|
+
undoes?: number | undefined;
|
|
401
|
+
};
|
|
402
|
+
repairOf?: string | undefined;
|
|
403
|
+
discards?: {
|
|
404
|
+
revision: number;
|
|
405
|
+
nodeIds: string[];
|
|
406
|
+
}[] | undefined;
|
|
407
|
+
}>;
|
|
408
|
+
export type ProposedChange = {
|
|
409
|
+
readonly proposalId: ProposalId;
|
|
410
|
+
readonly intentId: IntentId;
|
|
411
|
+
readonly delta: TreeDelta;
|
|
412
|
+
readonly rationale: string;
|
|
413
|
+
readonly provenance: Provenance;
|
|
414
|
+
readonly repairOf?: ProposalId;
|
|
415
|
+
/**
|
|
416
|
+
* Only ever set by an interpreter that computed the delta from a log. It can
|
|
417
|
+
* make the Gate stricter and never more permissive, which is what makes it
|
|
418
|
+
* safe to accept as a declaration rather than a computation the Gate repeats
|
|
419
|
+
* (0035).
|
|
420
|
+
*/
|
|
421
|
+
readonly discards?: readonly DiscardedWork[];
|
|
422
|
+
};
|
|
423
|
+
//# sourceMappingURL=proposal.d.ts.map
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { intentIdSchema, nodeIdSchema, proposalIdSchema, } from "../ids.js";
|
|
3
|
+
import { treeDeltaSchema } from "../tree/delta.js";
|
|
4
|
+
import { intentOriginSchema } from "./intent.js";
|
|
5
|
+
/**
|
|
6
|
+
* Provenance answers "where did this change come from" in enough detail to
|
|
7
|
+
* audit it later: who or what asked, which interpreter turned the ask into a
|
|
8
|
+
* delta, and how sure that interpreter was. Telemetry consumes exactly this
|
|
9
|
+
* record alongside the disposition and the eventual outcome.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Who wrote the delta, as opposed to which component carried it.
|
|
13
|
+
*
|
|
14
|
+
* `interpreter` names the thing; this names its kind, and the difference is
|
|
15
|
+
* load-bearing. `confidence` is a self-grade, and only a model grades itself —
|
|
16
|
+
* a delta the runtime computed, such as the inverse behind a revert, has no
|
|
17
|
+
* opinion to be right or wrong about. Calibration (0031) measures self-grades,
|
|
18
|
+
* so it has to tell the two apart by type rather than by recognising a magic
|
|
19
|
+
* interpreter name.
|
|
20
|
+
*/
|
|
21
|
+
export const authorKindSchema = z.enum(["model", "runtime"]);
|
|
22
|
+
export const provenanceSchema = z.object({
|
|
23
|
+
origin: intentOriginSchema,
|
|
24
|
+
/**
|
|
25
|
+
* The user or system component that raised the intent, carried from
|
|
26
|
+
* `EditIntent.actor`. Opaque to the runtime: a host decides what an identity
|
|
27
|
+
* looks like, and nothing here parses it (0027).
|
|
28
|
+
*/
|
|
29
|
+
actor: z.string().min(1).optional(),
|
|
30
|
+
/** Identifies what produced the delta — a model id, or a named component. */
|
|
31
|
+
interpreter: z.string().min(1),
|
|
32
|
+
/**
|
|
33
|
+
* Defaulted rather than required, because every provenance written before
|
|
34
|
+
* this field existed was a model's. Absence means "recorded before the
|
|
35
|
+
* runtime authored anything", and that reading stays true forever.
|
|
36
|
+
*/
|
|
37
|
+
authoredBy: authorKindSchema.default("model"),
|
|
38
|
+
/** Hash rather than the prompt itself, so provenance carries no user content. */
|
|
39
|
+
promptHash: z.string().min(1).optional(),
|
|
40
|
+
/**
|
|
41
|
+
* The revision this change puts back, when it puts one back.
|
|
42
|
+
*
|
|
43
|
+
* `interpreter` already says *that* a change is an undo — `loom/revert` is a
|
|
44
|
+
* name a surface can read, which is the whole reason it is a stamp rather than
|
|
45
|
+
* a sentence. This says *which*, and it is here rather than on the proposal
|
|
46
|
+
* because provenance is the part of a proposal a log keeps (`StoredRevision`).
|
|
47
|
+
* A surface reading a log it did not write is exactly the reader that has no
|
|
48
|
+
* other way to know, and the one this was filed for.
|
|
49
|
+
*
|
|
50
|
+
* Before it existed the link was real but only ever narrated: `utterance` said
|
|
51
|
+
* `Undo revision 1.` and the rationale said so again in a longer sentence. Both
|
|
52
|
+
* are composed for people, and a surface needing the link had to parse prose it
|
|
53
|
+
* does not own — the thing the interpreter stamp exists to avoid — or carry the
|
|
54
|
+
* number itself, which only the caller that asked for the undo can do.
|
|
55
|
+
*
|
|
56
|
+
* Optional, and absent on every change that is not an undo. Absence therefore
|
|
57
|
+
* means "this puts nothing back", which is true of the whole log written before
|
|
58
|
+
* the field existed as well.
|
|
59
|
+
*/
|
|
60
|
+
undoes: z.number().int().positive().optional(),
|
|
61
|
+
confidence: z.number().min(0).max(1),
|
|
62
|
+
interpretedAt: z.string().datetime(),
|
|
63
|
+
});
|
|
64
|
+
/**
|
|
65
|
+
* Work a change would take out of the current tree that its own delta does not
|
|
66
|
+
* show: a revision already in the log, and which of the nodes it named this
|
|
67
|
+
* change writes over.
|
|
68
|
+
*
|
|
69
|
+
* The delta is self-contained by construction (0001), which is what makes it
|
|
70
|
+
* individually reviewable — and is also why it cannot express this. "Set this
|
|
71
|
+
* text back to what it was" and "set this text back to what it was, discarding
|
|
72
|
+
* what two people wrote afterwards" are the same four operations. Only something
|
|
73
|
+
* holding the log can tell them apart, so whatever computed the delta from a log
|
|
74
|
+
* says so here.
|
|
75
|
+
*
|
|
76
|
+
* Nothing is lost from the record when this is applied. The discarded revisions
|
|
77
|
+
* stay in the log and the tree they made can be restored by undoing the undo,
|
|
78
|
+
* which is why this raises stakes rather than making a change irreversible.
|
|
79
|
+
*/
|
|
80
|
+
export const discardedWorkSchema = z.object({
|
|
81
|
+
revision: z.number().int().positive(),
|
|
82
|
+
nodeIds: z.array(nodeIdSchema).min(1),
|
|
83
|
+
});
|
|
84
|
+
/**
|
|
85
|
+
* The unit the Gate reviews: a concrete delta, why the interpreter believes it
|
|
86
|
+
* satisfies the intent, and where it came from. A proposal is inert — nothing
|
|
87
|
+
* has touched the tree yet.
|
|
88
|
+
*/
|
|
89
|
+
export const proposedChangeSchema = z.object({
|
|
90
|
+
proposalId: proposalIdSchema,
|
|
91
|
+
intentId: intentIdSchema,
|
|
92
|
+
delta: treeDeltaSchema,
|
|
93
|
+
rationale: z.string().min(1),
|
|
94
|
+
provenance: provenanceSchema,
|
|
95
|
+
/**
|
|
96
|
+
* Set when this proposal replaces one the Gate refused. Stamped by the
|
|
97
|
+
* runtime rather than claimed by the proposer, so a weaker change offered
|
|
98
|
+
* after a refusal cannot present itself as an unrelated first attempt.
|
|
99
|
+
*/
|
|
100
|
+
repairOf: proposalIdSchema.optional(),
|
|
101
|
+
/**
|
|
102
|
+
* Optional and absent by default: a proposal that declares nothing is one
|
|
103
|
+
* whose author had no log to consult, which is every proposal a model makes.
|
|
104
|
+
* Absence therefore means "not declared" rather than "nothing discarded", and
|
|
105
|
+
* that reading stays true forever (0035).
|
|
106
|
+
*/
|
|
107
|
+
discards: z.array(discardedWorkSchema).optional(),
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=proposal.js.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { NodeId } from "../ids.js";
|
|
2
|
+
import type { EndpointId } from "../submit/endpoint.js";
|
|
3
|
+
import type { LoomNode } from "../tree/node.js";
|
|
4
|
+
/**
|
|
5
|
+
* Where a change moves a form's destination.
|
|
6
|
+
*
|
|
7
|
+
* [0065](../../decisions/0065-a-submission-names-a-destination-and-never-carries-one.md)
|
|
8
|
+
* keeps the address out of the tree, so a proposal cannot invent somewhere to
|
|
9
|
+
* post: `loom:submit` names a registered endpoint and nothing else leaves the
|
|
10
|
+
* deployment. That seam holds whatever a delta does to it, and it is not the
|
|
11
|
+
* whole question. A `configure` that moves `loom:submit` from
|
|
12
|
+
* `newsletter.subscribe` to `contact.enquiry` names two endpoints the host
|
|
13
|
+
* registered on purpose, authors no address, and still sends the next visitor's
|
|
14
|
+
* message to a different place than the one the page was built to send it.
|
|
15
|
+
*
|
|
16
|
+
* The analysis reports that today as a configured prop key like any other. It is
|
|
17
|
+
* the one prop whose meaning is *where a stranger's data goes*, and this module
|
|
18
|
+
* is what lets the Gate see it as that rather than as a string that changed.
|
|
19
|
+
*/
|
|
20
|
+
/** One form's destination, moved from one registered endpoint to another. */
|
|
21
|
+
export type RedirectedSubmission = {
|
|
22
|
+
readonly nodeId: NodeId;
|
|
23
|
+
readonly from: EndpointId;
|
|
24
|
+
readonly to: EndpointId;
|
|
25
|
+
};
|
|
26
|
+
export declare const describeRedirectedSubmission: (redirected: RedirectedSubmission) => string;
|
|
27
|
+
/**
|
|
28
|
+
* Every destination this change moves: a node that posted somewhere before and
|
|
29
|
+
* posts somewhere else after.
|
|
30
|
+
*
|
|
31
|
+
* Measured between the two trees rather than off the operations, for the reason
|
|
32
|
+
* `introducedNestedTargets` gives — but with the opposite conclusion about what
|
|
33
|
+
* counts. Nesting is a fact about a position, so any operation can produce it.
|
|
34
|
+
* A redirection is a fact about one node's identity persisting across the
|
|
35
|
+
* change, which is what makes it a redirection rather than a new form:
|
|
36
|
+
*
|
|
37
|
+
* - **A node that gains a declaration it did not have is not redirected.** An
|
|
38
|
+
* `insert` of a form pointing at `contact.enquiry`, or a `configure` that
|
|
39
|
+
* gives an unposted node a destination, is a form that did not exist before.
|
|
40
|
+
* Nobody's expectation about where their message goes is being moved.
|
|
41
|
+
* - **A node that loses one is not redirected either.** That form stops posting,
|
|
42
|
+
* which is breakage the shape factors already measure and is not this fact.
|
|
43
|
+
* - **A declaration that stops parsing reads as a loss**, because that is what
|
|
44
|
+
* the page does with it: `planSubmissionsIn` reports it as a problem and the
|
|
45
|
+
* node renders with no target. A redirection has to be somewhere a visitor's
|
|
46
|
+
* data will actually arrive.
|
|
47
|
+
*
|
|
48
|
+
* Host-independent, and so needs no vocabulary: `loom:submit` is the runtime's
|
|
49
|
+
* own key (0050), and whether a destination moved does not depend on which
|
|
50
|
+
* primitives a deployment protects.
|
|
51
|
+
*/
|
|
52
|
+
export declare const redirectedSubmissionsBetween: (before: LoomNode, after: LoomNode) => readonly RedirectedSubmission[];
|
|
53
|
+
//# sourceMappingURL=redirection.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { planSubmissionsIn } from "../submit/plan.js";
|
|
2
|
+
export const describeRedirectedSubmission = (redirected) => `${redirected.nodeId} from ${redirected.from} to ${redirected.to}`;
|
|
3
|
+
const destinationsIn = (root) => new Map(planSubmissionsIn(root).submissions.map(({ nodeId, to }) => [nodeId, to]));
|
|
4
|
+
/**
|
|
5
|
+
* Every destination this change moves: a node that posted somewhere before and
|
|
6
|
+
* posts somewhere else after.
|
|
7
|
+
*
|
|
8
|
+
* Measured between the two trees rather than off the operations, for the reason
|
|
9
|
+
* `introducedNestedTargets` gives — but with the opposite conclusion about what
|
|
10
|
+
* counts. Nesting is a fact about a position, so any operation can produce it.
|
|
11
|
+
* A redirection is a fact about one node's identity persisting across the
|
|
12
|
+
* change, which is what makes it a redirection rather than a new form:
|
|
13
|
+
*
|
|
14
|
+
* - **A node that gains a declaration it did not have is not redirected.** An
|
|
15
|
+
* `insert` of a form pointing at `contact.enquiry`, or a `configure` that
|
|
16
|
+
* gives an unposted node a destination, is a form that did not exist before.
|
|
17
|
+
* Nobody's expectation about where their message goes is being moved.
|
|
18
|
+
* - **A node that loses one is not redirected either.** That form stops posting,
|
|
19
|
+
* which is breakage the shape factors already measure and is not this fact.
|
|
20
|
+
* - **A declaration that stops parsing reads as a loss**, because that is what
|
|
21
|
+
* the page does with it: `planSubmissionsIn` reports it as a problem and the
|
|
22
|
+
* node renders with no target. A redirection has to be somewhere a visitor's
|
|
23
|
+
* data will actually arrive.
|
|
24
|
+
*
|
|
25
|
+
* Host-independent, and so needs no vocabulary: `loom:submit` is the runtime's
|
|
26
|
+
* own key (0050), and whether a destination moved does not depend on which
|
|
27
|
+
* primitives a deployment protects.
|
|
28
|
+
*/
|
|
29
|
+
export const redirectedSubmissionsBetween = (before, after) => {
|
|
30
|
+
const previous = destinationsIn(before);
|
|
31
|
+
if (previous.size === 0)
|
|
32
|
+
return [];
|
|
33
|
+
return Array.from(destinationsIn(after)).flatMap(([nodeId, to]) => {
|
|
34
|
+
const from = previous.get(nodeId);
|
|
35
|
+
return from !== undefined && from !== to ? [{ nodeId, from, to }] : [];
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=redirection.js.map
|