@jam-overture/loom 0.2.0 → 0.3.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/dist/audience/compose.d.ts +112 -0
- package/dist/audience/compose.js +134 -0
- package/dist/audience/memory.d.ts +14 -0
- package/dist/audience/memory.js +71 -0
- package/dist/audience/overlay-store.d.ts +343 -0
- package/dist/audience/overlay-store.js +217 -0
- package/dist/audience/rule.d.ts +121 -0
- package/dist/audience/rule.js +78 -0
- package/dist/cli/index.d.ts +3 -4
- package/dist/cli/index.js +3 -4
- package/dist/data/adapter.d.ts +9 -1
- package/dist/data/adapter.js +2 -0
- package/dist/data/resolve.d.ts +1 -1
- package/dist/interpretation/anthropic.d.ts +1 -1
- package/dist/interpretation/anthropic.js +2 -22
- package/dist/interpretation/client.d.ts +1 -1
- package/dist/interpretation/materialize.js +67 -22
- package/dist/interpretation/openai-compatible.d.ts +36 -0
- package/dist/interpretation/openai-compatible.js +79 -0
- package/dist/interpretation/status.d.ts +19 -0
- package/dist/interpretation/status.js +26 -0
- package/dist/live/index.d.ts +73 -0
- package/dist/live/index.js +73 -0
- package/dist/live/pages.d.ts +187 -0
- package/dist/live/pages.js +161 -0
- package/dist/live/pull.d.ts +147 -0
- package/dist/live/pull.js +398 -0
- package/dist/live/pulling.d.ts +79 -0
- package/dist/live/pulling.js +117 -0
- package/dist/live/window.d.ts +129 -0
- package/dist/live/window.js +132 -0
- package/dist/render/addressed.d.ts +35 -0
- package/dist/render/addressed.js +79 -0
- package/dist/render/document-theme.d.ts +70 -0
- package/dist/render/document-theme.js +139 -0
- package/dist/render/editable.d.ts +15 -1
- package/dist/render/editable.js +13 -1
- package/dist/render/expected.d.ts +98 -0
- package/dist/render/expected.js +88 -0
- package/dist/render/index.d.ts +2 -0
- package/dist/render/index.js +2 -0
- package/dist/render/render.d.ts +11 -0
- package/dist/render/render.js +192 -46
- package/dist/render/request.d.ts +8 -1
- package/dist/render/request.js +1 -0
- package/dist/runtime/auto-apply-ceiling.d.ts +54 -0
- package/dist/runtime/auto-apply-ceiling.js +66 -0
- package/dist/runtime/gate.js +69 -10
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/nesting.d.ts +13 -1
- package/dist/runtime/nesting.js +41 -24
- package/dist/runtime/policy-change.js +8 -2
- package/dist/runtime/policy-log.d.ts +5 -5
- package/dist/runtime/policy.d.ts +8 -6
- package/dist/runtime/policy.js +5 -2
- package/dist/runtime/repointing.js +0 -0
- package/dist/sdk/definition.d.ts +65 -6
- package/dist/sdk/definition.js +44 -0
- package/dist/sdk/registry.d.ts +17 -1
- package/dist/sdk/registry.js +39 -0
- package/dist/signals/acted.contract.d.ts +21 -0
- package/dist/signals/acted.contract.js +236 -0
- package/dist/signals/acted.d.ts +359 -0
- package/dist/signals/acted.js +135 -0
- package/dist/signals/agenda.d.ts +585 -0
- package/dist/signals/agenda.js +295 -0
- package/dist/signals/arrivals.contract.d.ts +21 -0
- package/dist/signals/arrivals.contract.js +180 -0
- package/dist/signals/arrivals.d.ts +375 -0
- package/dist/signals/arrivals.js +254 -0
- package/dist/signals/broadcast.d.ts +25 -15
- package/dist/signals/broadcast.js +209 -36
- package/dist/signals/collect.d.ts +137 -43
- package/dist/signals/collect.js +103 -36
- package/dist/signals/conversion.d.ts +348 -0
- package/dist/signals/conversion.js +235 -0
- package/dist/signals/correlated.contract.d.ts +24 -0
- package/dist/signals/correlated.contract.js +94 -0
- package/dist/signals/counters.d.ts +51 -0
- package/dist/signals/counters.js +58 -0
- package/dist/signals/deployment-change.d.ts +28 -4
- package/dist/signals/deployment-change.js +57 -16
- package/dist/signals/deployment.d.ts +18 -5
- package/dist/signals/deployment.js +37 -11
- package/dist/signals/door.d.ts +34 -12
- package/dist/signals/door.js +37 -13
- package/dist/signals/expire.d.ts +192 -0
- package/dist/signals/expire.js +213 -0
- package/dist/signals/frontier.d.ts +268 -0
- package/dist/signals/frontier.js +145 -0
- package/dist/signals/funnel-hours.contract.d.ts +21 -0
- package/dist/signals/funnel-hours.contract.js +221 -0
- package/dist/signals/funnel-hours.d.ts +293 -0
- package/dist/signals/funnel-hours.js +99 -0
- package/dist/signals/funnel.d.ts +60 -0
- package/dist/signals/funnel.js +35 -20
- package/dist/signals/health.d.ts +201 -4
- package/dist/signals/health.js +214 -2
- package/dist/signals/index.d.ts +19 -0
- package/dist/signals/index.js +19 -0
- package/dist/signals/inside.d.ts +190 -0
- package/dist/signals/inside.js +263 -0
- package/dist/signals/join.d.ts +56 -0
- package/dist/signals/join.js +60 -0
- package/dist/signals/journal.d.ts +112 -9
- package/dist/signals/kept.contract.d.ts +22 -0
- package/dist/signals/kept.contract.js +111 -0
- package/dist/signals/library-agenda-change.d.ts +324 -0
- package/dist/signals/library-agenda-change.js +199 -0
- package/dist/signals/library-agenda.d.ts +258 -0
- package/dist/signals/library-agenda.js +167 -0
- package/dist/signals/library-reach-change.d.ts +10 -0
- package/dist/signals/library-reach-change.js +11 -3
- package/dist/signals/library-senders-change.d.ts +457 -0
- package/dist/signals/library-senders-change.js +367 -0
- package/dist/signals/library-senders-reach-change.d.ts +486 -0
- package/dist/signals/library-senders-reach-change.js +538 -0
- package/dist/signals/library-senders-reach.d.ts +340 -0
- package/dist/signals/library-senders-reach.js +252 -0
- package/dist/signals/library-senders.d.ts +271 -0
- package/dist/signals/library-senders.js +180 -0
- package/dist/signals/library-word-reach-change.js +2 -6
- package/dist/signals/memory.js +142 -1
- package/dist/signals/migrate.d.ts +6 -5
- package/dist/signals/migrate.js +150 -6
- package/dist/signals/notice.d.ts +88 -33
- package/dist/signals/notice.js +38 -16
- package/dist/signals/part-pace.d.ts +378 -0
- package/dist/signals/part-pace.js +333 -0
- package/dist/signals/parts.d.ts +25 -15
- package/dist/signals/parts.js +32 -73
- package/dist/signals/postgres.js +400 -26
- package/dist/signals/region.d.ts +1 -1
- package/dist/signals/retention.d.ts +43 -21
- package/dist/signals/retention.js +25 -8
- package/dist/signals/rhythm.d.ts +302 -0
- package/dist/signals/rhythm.js +262 -0
- package/dist/signals/rollup.d.ts +127 -1
- package/dist/signals/rollup.js +211 -24
- package/dist/signals/schema.d.ts +640 -3
- package/dist/signals/schema.js +239 -3
- package/dist/signals/silences.d.ts +310 -11
- package/dist/signals/silences.js +243 -0
- package/dist/signals/subtrees.d.ts +123 -0
- package/dist/signals/subtrees.js +102 -0
- package/dist/signals/tally.d.ts +125 -4
- package/dist/signals/unread.d.ts +292 -0
- package/dist/signals/unread.js +137 -0
- package/dist/signals/window-agenda.d.ts +276 -0
- package/dist/signals/window-agenda.js +83 -0
- package/dist/signals/window-funnels.d.ts +88 -0
- package/dist/signals/window-funnels.js +47 -0
- package/dist/store/cache.d.ts +101 -0
- package/dist/store/cache.js +149 -0
- package/dist/store/history.d.ts +82 -0
- package/dist/store/history.js +36 -0
- package/dist/store/index.d.ts +11 -0
- package/dist/store/index.js +11 -0
- package/dist/store/migrate.d.ts +26 -0
- package/dist/store/migrate.js +64 -0
- package/dist/store/postgres-audience.d.ts +14 -0
- package/dist/store/postgres-audience.js +272 -0
- package/dist/store/postgres.d.ts +1 -0
- package/dist/store/postgres.js +1 -0
- package/dist/store/schema.d.ts +312 -0
- package/dist/store/schema.js +77 -0
- package/dist/store/source.d.ts +57 -1
- package/dist/store/source.js +65 -1
- package/dist/submit/resolve.d.ts +1 -1
- package/dist/telemetry/index.d.ts +1 -0
- package/dist/telemetry/index.js +1 -0
- package/dist/telemetry/journal.d.ts +32 -0
- package/dist/telemetry/memory.js +10 -1
- package/dist/telemetry/postgres.js +18 -2
- package/dist/telemetry/window.d.ts +135 -0
- package/dist/telemetry/window.js +101 -0
- package/dist/testing/audience-overlay-contract.d.ts +31 -0
- package/dist/testing/audience-overlay-contract.js +354 -0
- package/dist/testing/contracts.d.ts +1 -0
- package/dist/testing/contracts.js +1 -0
- package/dist/testing/journal-contract.js +158 -5
- package/dist/theme/contrast.d.ts +19 -14
- package/dist/theme/contrast.js +181 -17
- package/dist/tree/apply.js +13 -0
- package/dist/tree/mutation.d.ts +18 -0
- package/dist/tree/mutation.js +24 -12
- package/dist/tree/navigation.d.ts +5 -0
- package/dist/tree/navigation.js +32 -10
- package/dist/tree/outline.d.ts +7 -0
- package/dist/tree/outline.js +9 -5
- package/package.json +39 -96
- package/dist/runtime/inverse-interpreter.d.ts +0 -90
- package/dist/runtime/inverse-interpreter.js +0 -56
|
@@ -25,7 +25,19 @@ export type NestedTarget = {
|
|
|
25
25
|
readonly ancestorId: NodeId;
|
|
26
26
|
readonly ancestorType: PrimitiveType;
|
|
27
27
|
};
|
|
28
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Every target this tree puts inside another, in document order.
|
|
30
|
+
*
|
|
31
|
+
* The walk carries an **explicit stack** and is not recursive (0380): a page's
|
|
32
|
+
* depth is data, and this read answered `RangeError` rather than a fault list
|
|
33
|
+
* at ten thousand deep while every read and edit in `src/tree/` answered at
|
|
34
|
+
* five hundred thousand (0372, 0373). The deeper a tree is, the less likely
|
|
35
|
+
* anyone is to have found the pair by eye, so this is the read whose answer
|
|
36
|
+
* matters most exactly where it used to stop having one.
|
|
37
|
+
*
|
|
38
|
+
* Children are pushed in reverse so the pop order is the document order the
|
|
39
|
+
* recursion gave, which is the order a fault list is read in.
|
|
40
|
+
*/
|
|
29
41
|
export declare const nestedTargetsIn: (root: LoomNode, isInteractive: InteractivePredicate) => readonly NestedTarget[];
|
|
30
42
|
export declare const describeNestedTarget: (nested: NestedTarget) => string;
|
|
31
43
|
//# sourceMappingURL=nesting.d.ts.map
|
package/dist/runtime/nesting.js
CHANGED
|
@@ -14,32 +14,49 @@ export const interactivePredicateFor = (types) => {
|
|
|
14
14
|
return when !== undefined && isInteractiveWith(when, node.props);
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* the chain off the tree; told only about the ends, they cannot.
|
|
31
|
-
*
|
|
32
|
-
* Slot nodes are descended without being targets themselves — a region
|
|
33
|
-
* projected into a linked card sits inside it exactly as a child does.
|
|
34
|
-
*/
|
|
35
|
-
const below = target ? { id: target.id, type: target.type } : enclosing;
|
|
36
|
-
for (const child of childrenOf(node))
|
|
37
|
-
collect(child, below, isInteractive, found);
|
|
38
|
-
};
|
|
39
|
-
/** Every target this tree puts inside another, in document order. */
|
|
17
|
+
/**
|
|
18
|
+
* Every target this tree puts inside another, in document order.
|
|
19
|
+
*
|
|
20
|
+
* The walk carries an **explicit stack** and is not recursive (0380): a page's
|
|
21
|
+
* depth is data, and this read answered `RangeError` rather than a fault list
|
|
22
|
+
* at ten thousand deep while every read and edit in `src/tree/` answered at
|
|
23
|
+
* five hundred thousand (0372, 0373). The deeper a tree is, the less likely
|
|
24
|
+
* anyone is to have found the pair by eye, so this is the read whose answer
|
|
25
|
+
* matters most exactly where it used to stop having one.
|
|
26
|
+
*
|
|
27
|
+
* Children are pushed in reverse so the pop order is the document order the
|
|
28
|
+
* recursion gave, which is the order a fault list is read in.
|
|
29
|
+
*/
|
|
40
30
|
export const nestedTargetsIn = (root, isInteractive) => {
|
|
41
31
|
const found = [];
|
|
42
|
-
|
|
32
|
+
const pending = [{ node: root, enclosing: null }];
|
|
33
|
+
for (let reached = pending.pop(); reached !== undefined; reached = pending.pop()) {
|
|
34
|
+
const { node, enclosing } = reached;
|
|
35
|
+
const target = node.kind === "element" && isInteractive(node) ? node : null;
|
|
36
|
+
if (target && enclosing) {
|
|
37
|
+
found.push({
|
|
38
|
+
nodeId: target.id,
|
|
39
|
+
type: target.type,
|
|
40
|
+
ancestorId: enclosing.id,
|
|
41
|
+
ancestorType: enclosing.type,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The *nearest* enclosing target, not the outermost. Three deep is two
|
|
46
|
+
* faults rather than one, and a reviewer told about each pair that touches
|
|
47
|
+
* can read the chain off the tree; told only about the ends, they cannot.
|
|
48
|
+
*
|
|
49
|
+
* Slot nodes are descended without being targets themselves — a region
|
|
50
|
+
* projected into a linked card sits inside it exactly as a child does.
|
|
51
|
+
*/
|
|
52
|
+
const below = target ? { id: target.id, type: target.type } : enclosing;
|
|
53
|
+
const children = childrenOf(node);
|
|
54
|
+
for (let index = children.length - 1; index >= 0; index -= 1) {
|
|
55
|
+
const child = children[index];
|
|
56
|
+
if (child)
|
|
57
|
+
pending.push({ node: child, enclosing: below });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
43
60
|
return found;
|
|
44
61
|
};
|
|
45
62
|
export const describeNestedTarget = (nested) => `${nested.type} ${nested.nodeId} inside ${nested.ancestorType} ${nested.ancestorId}`;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { compareCeilings } from "./auto-apply-ceiling.js";
|
|
1
2
|
import { policyFingerprintOf } from "./policy-fingerprint.js";
|
|
2
3
|
import { compareStakes } from "./stake-level.js";
|
|
3
4
|
const compareStrings = (left, right) => left < right ? -1 : left > right ? 1 : 0;
|
|
@@ -125,7 +126,8 @@ const interactiveChange = (was, now) => {
|
|
|
125
126
|
};
|
|
126
127
|
};
|
|
127
128
|
/**
|
|
128
|
-
* The per-origin ceilings, compared
|
|
129
|
+
* The per-origin ceilings, compared on the ceiling scale rather than as
|
|
130
|
+
* strings.
|
|
129
131
|
*
|
|
130
132
|
* `autoApplyCeiling` is the one map field with an ordered value, so an entry
|
|
131
133
|
* that moved has a direction of its own: raising a ceiling applies more without
|
|
@@ -134,6 +136,10 @@ const interactiveChange = (was, now) => {
|
|
|
134
136
|
* does with an absent one — so writing `low` where there was no entry is not a
|
|
135
137
|
* change, and the comparison says so instead of reporting an edit that changed
|
|
136
138
|
* no decision.
|
|
139
|
+
*
|
|
140
|
+
* `nothing` is the bottom rung of that scale and not a value outside it
|
|
141
|
+
* (0405), so an origin switched off reads as a ceiling lowered, which is what
|
|
142
|
+
* it is: stricter, in the same column as every other tightening.
|
|
137
143
|
*/
|
|
138
144
|
const ceilingChange = (was, now) => {
|
|
139
145
|
const origins = sorted([...Object.keys(was), ...Object.keys(now)]);
|
|
@@ -148,7 +154,7 @@ const ceilingChange = (was, now) => {
|
|
|
148
154
|
if (before === after)
|
|
149
155
|
continue;
|
|
150
156
|
moved.push(`${origin} ${before} became ${after}`);
|
|
151
|
-
if (
|
|
157
|
+
if (compareCeilings(after, before) > 0)
|
|
152
158
|
raised = true;
|
|
153
159
|
else
|
|
154
160
|
lowered = true;
|
|
@@ -67,7 +67,7 @@ export declare const policyRevisionSchema: z.ZodObject<{
|
|
|
67
67
|
inverseRetentionBudget: z.ZodDefault<z.ZodNumber>;
|
|
68
68
|
minimumConfidence: z.ZodDefault<z.ZodNumber>;
|
|
69
69
|
confidenceFloor: z.ZodDefault<z.ZodNumber>;
|
|
70
|
-
autoApplyCeiling: z.ZodDefault<z.ZodRecord<z.ZodEnum<["user-instruction", "system-signal", "scheduled-adaptation", "developer"]>, z.ZodEnum<["low", "medium", "high", "critical"]>>>;
|
|
70
|
+
autoApplyCeiling: z.ZodDefault<z.ZodRecord<z.ZodEnum<["user-instruction", "system-signal", "scheduled-adaptation", "developer"]>, z.ZodUnion<[z.ZodLiteral<"nothing">, z.ZodEnum<["low", "medium", "high", "critical"]>]>>>;
|
|
71
71
|
refusalFloor: z.ZodDefault<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
72
72
|
}, "strip", z.ZodTypeAny, {
|
|
73
73
|
policyId: string;
|
|
@@ -85,7 +85,7 @@ export declare const policyRevisionSchema: z.ZodObject<{
|
|
|
85
85
|
inverseRetentionBudget: number;
|
|
86
86
|
minimumConfidence: number;
|
|
87
87
|
confidenceFloor: number;
|
|
88
|
-
autoApplyCeiling: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical">>;
|
|
88
|
+
autoApplyCeiling: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical" | "nothing">>;
|
|
89
89
|
refusalFloor: "low" | "medium" | "high" | "critical";
|
|
90
90
|
}, {
|
|
91
91
|
policyId?: string | undefined;
|
|
@@ -103,7 +103,7 @@ export declare const policyRevisionSchema: z.ZodObject<{
|
|
|
103
103
|
inverseRetentionBudget?: number | undefined;
|
|
104
104
|
minimumConfidence?: number | undefined;
|
|
105
105
|
confidenceFloor?: number | undefined;
|
|
106
|
-
autoApplyCeiling?: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical">> | undefined;
|
|
106
|
+
autoApplyCeiling?: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical" | "nothing">> | undefined;
|
|
107
107
|
refusalFloor?: "low" | "medium" | "high" | "critical" | undefined;
|
|
108
108
|
}>;
|
|
109
109
|
actor: z.ZodString;
|
|
@@ -130,7 +130,7 @@ export declare const policyRevisionSchema: z.ZodObject<{
|
|
|
130
130
|
inverseRetentionBudget: number;
|
|
131
131
|
minimumConfidence: number;
|
|
132
132
|
confidenceFloor: number;
|
|
133
|
-
autoApplyCeiling: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical">>;
|
|
133
|
+
autoApplyCeiling: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical" | "nothing">>;
|
|
134
134
|
refusalFloor: "low" | "medium" | "high" | "critical";
|
|
135
135
|
};
|
|
136
136
|
recordedAt: string;
|
|
@@ -156,7 +156,7 @@ export declare const policyRevisionSchema: z.ZodObject<{
|
|
|
156
156
|
inverseRetentionBudget?: number | undefined;
|
|
157
157
|
minimumConfidence?: number | undefined;
|
|
158
158
|
confidenceFloor?: number | undefined;
|
|
159
|
-
autoApplyCeiling?: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical">> | undefined;
|
|
159
|
+
autoApplyCeiling?: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical" | "nothing">> | undefined;
|
|
160
160
|
refusalFloor?: "low" | "medium" | "high" | "critical" | undefined;
|
|
161
161
|
};
|
|
162
162
|
recordedAt: string;
|
package/dist/runtime/policy.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { type AutoApplyCeiling } from "./auto-apply-ceiling.js";
|
|
2
3
|
import { type IntentOrigin } from "./intent.js";
|
|
3
|
-
import { type StakeLevel } from "./stake-level.js";
|
|
4
4
|
/**
|
|
5
5
|
* Everything the Gate needs that is a choice rather than a fact.
|
|
6
6
|
*
|
|
@@ -85,9 +85,11 @@ export declare const gatePolicySchema: z.ZodObject<{
|
|
|
85
85
|
confidenceFloor: z.ZodDefault<z.ZodNumber>;
|
|
86
86
|
/**
|
|
87
87
|
* The highest stakes each origin may apply without asking. An explicit human
|
|
88
|
-
* instruction earns more latitude than an adaptation nobody requested
|
|
88
|
+
* instruction earns more latitude than an adaptation nobody requested, and
|
|
89
|
+
* `nothing` is the deployment that lets none of them through unattended
|
|
90
|
+
* (0405).
|
|
89
91
|
*/
|
|
90
|
-
autoApplyCeiling: z.ZodDefault<z.ZodRecord<z.ZodEnum<["user-instruction", "system-signal", "scheduled-adaptation", "developer"]>, z.ZodEnum<["low", "medium", "high", "critical"]>>>;
|
|
92
|
+
autoApplyCeiling: z.ZodDefault<z.ZodRecord<z.ZodEnum<["user-instruction", "system-signal", "scheduled-adaptation", "developer"]>, z.ZodUnion<[z.ZodLiteral<"nothing">, z.ZodEnum<["low", "medium", "high", "critical"]>]>>>;
|
|
91
93
|
/** At or above this, the change is refused outright rather than offered. */
|
|
92
94
|
refusalFloor: z.ZodDefault<z.ZodEnum<["low", "medium", "high", "critical"]>>;
|
|
93
95
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -106,7 +108,7 @@ export declare const gatePolicySchema: z.ZodObject<{
|
|
|
106
108
|
inverseRetentionBudget: number;
|
|
107
109
|
minimumConfidence: number;
|
|
108
110
|
confidenceFloor: number;
|
|
109
|
-
autoApplyCeiling: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical">>;
|
|
111
|
+
autoApplyCeiling: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical" | "nothing">>;
|
|
110
112
|
refusalFloor: "low" | "medium" | "high" | "critical";
|
|
111
113
|
}, {
|
|
112
114
|
policyId?: string | undefined;
|
|
@@ -124,7 +126,7 @@ export declare const gatePolicySchema: z.ZodObject<{
|
|
|
124
126
|
inverseRetentionBudget?: number | undefined;
|
|
125
127
|
minimumConfidence?: number | undefined;
|
|
126
128
|
confidenceFloor?: number | undefined;
|
|
127
|
-
autoApplyCeiling?: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical">> | undefined;
|
|
129
|
+
autoApplyCeiling?: Partial<Record<"user-instruction" | "system-signal" | "scheduled-adaptation" | "developer", "low" | "medium" | "high" | "critical" | "nothing">> | undefined;
|
|
128
130
|
refusalFloor?: "low" | "medium" | "high" | "critical" | undefined;
|
|
129
131
|
}>;
|
|
130
132
|
/**
|
|
@@ -152,5 +154,5 @@ export type GatePolicy = Readonly<z.infer<typeof gatePolicySchema>>;
|
|
|
152
154
|
* removed, how broadly, how close to the root.
|
|
153
155
|
*/
|
|
154
156
|
export declare const defaultGatePolicy: GatePolicy;
|
|
155
|
-
export declare const ceilingFor: (policy: GatePolicy, origin: IntentOrigin) =>
|
|
157
|
+
export declare const ceilingFor: (policy: GatePolicy, origin: IntentOrigin) => AutoApplyCeiling;
|
|
156
158
|
//# sourceMappingURL=policy.d.ts.map
|
package/dist/runtime/policy.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { interactiveTypesSchema } from "../interactivity.js";
|
|
3
3
|
import { primitiveTypeSchema } from "../primitive-type.js";
|
|
4
|
+
import { autoApplyCeilingSchema } from "./auto-apply-ceiling.js";
|
|
4
5
|
import { intentOriginSchema } from "./intent.js";
|
|
5
6
|
import { stakeLevelSchema } from "./stake-level.js";
|
|
6
7
|
/**
|
|
@@ -83,10 +84,12 @@ export const gatePolicySchema = z.object({
|
|
|
83
84
|
confidenceFloor: z.number().min(0).max(1).default(0.3),
|
|
84
85
|
/**
|
|
85
86
|
* The highest stakes each origin may apply without asking. An explicit human
|
|
86
|
-
* instruction earns more latitude than an adaptation nobody requested
|
|
87
|
+
* instruction earns more latitude than an adaptation nobody requested, and
|
|
88
|
+
* `nothing` is the deployment that lets none of them through unattended
|
|
89
|
+
* (0405).
|
|
87
90
|
*/
|
|
88
91
|
autoApplyCeiling: z
|
|
89
|
-
.record(intentOriginSchema,
|
|
92
|
+
.record(intentOriginSchema, autoApplyCeilingSchema)
|
|
90
93
|
.default({
|
|
91
94
|
"user-instruction": "medium",
|
|
92
95
|
"system-signal": "low",
|
|
Binary file
|
package/dist/sdk/definition.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { ZodType, ZodTypeDef } from "zod";
|
|
1
|
+
import type { ZodType, ZodTypeAny, ZodTypeDef } from "zod";
|
|
2
2
|
import { type CataloguedProp, type ClosedChoice } from "../catalogue.js";
|
|
3
3
|
import type { InteractiveWhen } from "../interactivity.js";
|
|
4
4
|
import type { JsonObject, JsonObjectView } from "../json.js";
|
|
5
5
|
import type { BehaviourName } from "../render/behaviour.js";
|
|
6
6
|
import type { LoomPrimitive } from "../render/primitive.js";
|
|
7
7
|
import type { PropsVerdict } from "../render/props.js";
|
|
8
|
+
import type { AnswerExpectation } from "../render/expected.js";
|
|
8
9
|
import type { BindingDeclaration } from "../render/reads.js";
|
|
9
10
|
import type { UnshownDeclaration } from "../render/unshown.js";
|
|
10
11
|
import { type PrimitiveText } from "../render/text.js";
|
|
@@ -55,6 +56,11 @@ import type { PrimitiveRole } from "../role.js";
|
|
|
55
56
|
* primitive never reads (0181). Each entry is a fixed name or the name a prop
|
|
56
57
|
* gives (0184). Optional, and the second declaration where leaving it out and
|
|
57
58
|
* declaring it empty differ.
|
|
59
|
+
* - `expects` — the shape of answer it can read under each of those names, so an
|
|
60
|
+
* answer the source was happy with and this primitive cannot draw is the named
|
|
61
|
+
* absence of an answer rather than whatever a hand-written parse fell through
|
|
62
|
+
* to (0357). Optional, keyed by declared name, and the top level only: each
|
|
63
|
+
* row stays the primitive's to read.
|
|
58
64
|
* - `unshown` — its own reading of the answers it was given, so the walk can say
|
|
59
65
|
* that eleven of twelve rows arrived and were not drawn (0206). The only
|
|
60
66
|
* declaration here that is a function, because how many rows survived a shape
|
|
@@ -79,7 +85,7 @@ export type PrimitiveDefinition<TProps extends JsonObjectView = JsonObject, TTex
|
|
|
79
85
|
* declares; the registry refuses a declaration that names one it does not, so
|
|
80
86
|
* a renamed prop cannot leave this quietly pointing at nothing.
|
|
81
87
|
*/
|
|
82
|
-
readonly interactive?: InteractiveWhen;
|
|
88
|
+
readonly interactive?: InteractiveWhen | undefined;
|
|
83
89
|
/**
|
|
84
90
|
* `true` for a primitive whose job includes sending what it collected. It
|
|
85
91
|
* takes no conditional form, unlike `interactive`: a card is a target only
|
|
@@ -160,7 +166,7 @@ export type PrimitiveDefinition<TProps extends JsonObjectView = JsonObject, TTex
|
|
|
160
166
|
* over a string the runtime does not know, so the registry refuses one rather
|
|
161
167
|
* than letting a misspelling read as "declares no role".
|
|
162
168
|
*/
|
|
163
|
-
readonly role?: PrimitiveRole;
|
|
169
|
+
readonly role?: PrimitiveRole | undefined;
|
|
164
170
|
/**
|
|
165
171
|
* The props whose values a reader reads as words — `["value", "label",
|
|
166
172
|
* "caption"]` on a stat, `[]` on an arrangement that shows none of its own.
|
|
@@ -177,7 +183,7 @@ export type PrimitiveDefinition<TProps extends JsonObjectView = JsonObject, TTex
|
|
|
177
183
|
* not — the same drift `frames` and `interactive` are checked for, with less
|
|
178
184
|
* riding on it and the same silence when it happens.
|
|
179
185
|
*/
|
|
180
|
-
readonly copy?: readonly string[];
|
|
186
|
+
readonly copy?: readonly string[] | undefined;
|
|
181
187
|
/**
|
|
182
188
|
* The binding names this primitive reads an answer under — `["entries"]` on a
|
|
183
189
|
* feed, `[]` on everything that draws only what the tree wrote.
|
|
@@ -207,7 +213,49 @@ export type PrimitiveDefinition<TProps extends JsonObjectView = JsonObject, TTex
|
|
|
207
213
|
* `fromProp` — is checked against the schema the way `copy` and `frames` are,
|
|
208
214
|
* so a declaration cannot go on naming a prop that was renamed away.
|
|
209
215
|
*/
|
|
210
|
-
readonly reads?: readonly BindingDeclaration[];
|
|
216
|
+
readonly reads?: readonly BindingDeclaration[] | undefined;
|
|
217
|
+
/**
|
|
218
|
+
* The shape of answer this primitive can read, per binding name it reads —
|
|
219
|
+
* `{ entries: z.array(z.unknown()) }` on a feed, `{ value: figureSchema }` on
|
|
220
|
+
* a figure.
|
|
221
|
+
*
|
|
222
|
+
* The seam validates an answer against the **source's** schema, which is a
|
|
223
|
+
* claim about a host's database and says nothing about what can go on a page;
|
|
224
|
+
* so a bound primitive carries its own schema for what it draws (0180). Until
|
|
225
|
+
* this existed that schema was private to the component, which left the one
|
|
226
|
+
* mistake nothing could catch: a list bound to a primitive that draws a
|
|
227
|
+
* figure resolves cleanly, is handed over, and is refused inside a component
|
|
228
|
+
* where the only report of it is whatever that component chose to draw.
|
|
229
|
+
*
|
|
230
|
+
* **The top level only.** A row's shape is the one thing only the component
|
|
231
|
+
* knows, and a listing that skips a row it cannot read is doing its job
|
|
232
|
+
* rather than failing (0175); what it dropped is reported with a count by
|
|
233
|
+
* `unshown` (0206). So an expectation answers *is this the kind of answer I
|
|
234
|
+
* asked for* and never *is every row in it drawable*, and the two halves stay
|
|
235
|
+
* where each can be told the truth.
|
|
236
|
+
*
|
|
237
|
+
* Keyed by the name as **declared** — the string, or a prop-named
|
|
238
|
+
* declaration's `default` (0184). A node that renames the binding it draws
|
|
239
|
+
* from has not changed the shape this primitive draws, so the expectation
|
|
240
|
+
* belongs to the declaration rather than to whatever the node called it.
|
|
241
|
+
*
|
|
242
|
+
* Every key must be a name `reads` declares. The registry refuses one that is
|
|
243
|
+
* not, which is the drift `frames`, `copy` and `names` are each checked for
|
|
244
|
+
* and fails the same silent way: a binding renamed in `reads` would leave an
|
|
245
|
+
* expectation here checking nothing, for ever.
|
|
246
|
+
*
|
|
247
|
+
* `ZodTypeAny`, like every other schema this file holds and for the same
|
|
248
|
+
* reason: the output type is discarded, so the only thing the declaration has
|
|
249
|
+
* to be is a Zod schema. Narrowing it to one producing `JsonValue` would
|
|
250
|
+
* refuse `z.array(z.unknown())`, which is the schema the library's own feed
|
|
251
|
+
* actually holds.
|
|
252
|
+
*
|
|
253
|
+
* Optional, and unlike `reads` and `copy` there is no claim in its absence to
|
|
254
|
+
* distinguish from an empty one: a primitive that has declared no expectation
|
|
255
|
+
* for a name is handed that name's answer exactly as it was before this
|
|
256
|
+
* existed. `{}` says the same thing, so nothing reads it differently.
|
|
257
|
+
*/
|
|
258
|
+
readonly expects?: Readonly<Record<string, ZodTypeAny>>;
|
|
211
259
|
/**
|
|
212
260
|
* What this primitive made of each answer it was given: the rows it found and
|
|
213
261
|
* the rows it placed. The walk reports the ones where those differ.
|
|
@@ -233,7 +281,7 @@ export type PrimitiveDefinition<TProps extends JsonObjectView = JsonObject, TTex
|
|
|
233
281
|
* `unshown-unreadable` against the primitive rather than allowed to cost the
|
|
234
282
|
* page, because rendering is total.
|
|
235
283
|
*/
|
|
236
|
-
readonly unshown?: UnshownDeclaration;
|
|
284
|
+
readonly unshown?: UnshownDeclaration | undefined;
|
|
237
285
|
readonly component: LoomPrimitive<TProps, TText, TBehaviour>;
|
|
238
286
|
};
|
|
239
287
|
/**
|
|
@@ -289,6 +337,17 @@ export type PrimitiveEntry = {
|
|
|
289
337
|
* two mean different things here and all the way out to the render walk.
|
|
290
338
|
*/
|
|
291
339
|
readonly reads: readonly BindingDeclaration[] | undefined;
|
|
340
|
+
/**
|
|
341
|
+
* The declared answer shapes, erased to validators and keyed by declared
|
|
342
|
+
* name. `undefined` for the primitive that declared none, which is every
|
|
343
|
+
* primitive that reads no data and most of the ones that do.
|
|
344
|
+
*
|
|
345
|
+
* Erased here rather than carried as schemas for `validate`'s reason: the one
|
|
346
|
+
* place that still holds every schema is the one place that should turn it
|
|
347
|
+
* into a function, and nothing in the render path then depends on which
|
|
348
|
+
* schema library declared it.
|
|
349
|
+
*/
|
|
350
|
+
readonly expects: Readonly<Record<string, AnswerExpectation>> | undefined;
|
|
292
351
|
/**
|
|
293
352
|
* The declared reading of this node's answers, or `undefined` where the author
|
|
294
353
|
* has not said. Nothing to check at registration — there are no names in it
|
package/dist/sdk/definition.js
CHANGED
|
@@ -35,6 +35,49 @@ const freezeNames = (names) => {
|
|
|
35
35
|
}
|
|
36
36
|
return Object.freeze(copy);
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* The first reason a schema gave, as one line a diagnostic can carry.
|
|
40
|
+
*
|
|
41
|
+
* Private here and private again in `data/adapter.ts`, which says the same
|
|
42
|
+
* sentence about a source's own schema. Shared between them it would have to be
|
|
43
|
+
* exported from the package, and a formatter for somebody else's error type is
|
|
44
|
+
* not a thing this library should promise to keep.
|
|
45
|
+
*/
|
|
46
|
+
const firstIssueOf = (error) => {
|
|
47
|
+
const [issue] = error.issues;
|
|
48
|
+
if (!issue)
|
|
49
|
+
return "refused, without saying why";
|
|
50
|
+
const path = issue.path.length === 0 ? "" : `${issue.path.map(String).join(".")}: `;
|
|
51
|
+
return `${path}${issue.message}`;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Declared answer shapes, erased to validators at declaration.
|
|
55
|
+
*
|
|
56
|
+
* Copied into a frozen null-prototype map for `freezeText`'s reason, and erased
|
|
57
|
+
* for `validate`'s: the schema is turned into a function in the one place that
|
|
58
|
+
* still holds it, so the render path never has to know it was Zod.
|
|
59
|
+
*
|
|
60
|
+
* The parse output is discarded and the answer the primitive receives is the one
|
|
61
|
+
* the source gave, which is the same bargain `verdictFor` makes with props and is
|
|
62
|
+
* load-bearing for the same reason. An expectation is a gate rather than a
|
|
63
|
+
* transform: 0180 is explicit that unknown keys on a row are stripped and not
|
|
64
|
+
* refused, and a page assembled from whatever this schema happened to keep would
|
|
65
|
+
* be a function of this deployment's schema version rather than of the answer.
|
|
66
|
+
*/
|
|
67
|
+
const freezeExpectations = (expects) => {
|
|
68
|
+
if (!expects)
|
|
69
|
+
return undefined;
|
|
70
|
+
const copy = Object.create(null);
|
|
71
|
+
for (const [name, schema] of Object.entries(expects)) {
|
|
72
|
+
copy[name] = (answer) => {
|
|
73
|
+
const parsed = schema.safeParse(answer);
|
|
74
|
+
return parsed.success
|
|
75
|
+
? { outcome: "readable" }
|
|
76
|
+
: { outcome: "unreadable", detail: firstIssueOf(parsed.error) };
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
return Object.freeze(copy);
|
|
80
|
+
};
|
|
38
81
|
const toIssue = (issue) => ({
|
|
39
82
|
path: issue.path.length === 0 ? "props" : issue.path.map(String).join("."),
|
|
40
83
|
message: issue.message,
|
|
@@ -69,6 +112,7 @@ export const definePrimitive = (definition) => ({
|
|
|
69
112
|
role: definition.role,
|
|
70
113
|
copy: definition.copy,
|
|
71
114
|
reads: definition.reads,
|
|
115
|
+
expects: freezeExpectations(definition.expects),
|
|
72
116
|
unshown: definition.unshown,
|
|
73
117
|
/**
|
|
74
118
|
* The one narrowing cast in the SDK, and the invariant that makes it sound:
|
package/dist/sdk/registry.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { type PrimitiveType, type SlotName } from "../primitive-type.js";
|
|
|
5
5
|
import { type Result } from "../result.js";
|
|
6
6
|
import { type BehaviourName, type BehaviourResolver, type ControlNameProps } from "../render/behaviour.js";
|
|
7
7
|
import type { FrameResolver } from "../render/frame.js";
|
|
8
|
+
import { type AnswerExpectation, type AnswerReader } from "../render/expected.js";
|
|
8
9
|
import type { BindingDeclaration, BindingReader } from "../render/reads.js";
|
|
9
10
|
import type { UnshownDeclaration, UnshownReader } from "../render/unshown.js";
|
|
10
11
|
import type { LoomPrimitive, PrimitiveResolver } from "../render/primitive.js";
|
|
@@ -77,6 +78,17 @@ export type RegisteredPrimitive = {
|
|
|
77
78
|
* walk reports under the first and stays quiet under the second.
|
|
78
79
|
*/
|
|
79
80
|
readonly reads: readonly BindingDeclaration<BindingName>[] | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* The shape of answer it can read under each of those names (0357), erased to
|
|
83
|
+
* a validator. `undefined` where the primitive has declared none, which here
|
|
84
|
+
* is the same answer as declaring an empty map — unlike `reads` and `copy`,
|
|
85
|
+
* because there is no claim in the absence to tell apart: a name with no
|
|
86
|
+
* expectation is handed its answer unchecked either way.
|
|
87
|
+
*
|
|
88
|
+
* Keyed by the name as declared, so a prop-named declaration's expectation is
|
|
89
|
+
* found under its `default` and not under whatever a node renamed it to.
|
|
90
|
+
*/
|
|
91
|
+
readonly expects: Readonly<Record<string, AnswerExpectation>> | undefined;
|
|
80
92
|
/**
|
|
81
93
|
* Its own reading of the answers it was given (0206). `undefined` where the
|
|
82
94
|
* author has not said, which here is the same answer as declaring one that
|
|
@@ -154,11 +166,15 @@ export type RegistryError = {
|
|
|
154
166
|
readonly code: "undeclared-reads-prop";
|
|
155
167
|
readonly type: string;
|
|
156
168
|
readonly prop: string;
|
|
169
|
+
} | {
|
|
170
|
+
readonly code: "unread-expects-binding";
|
|
171
|
+
readonly type: string;
|
|
172
|
+
readonly name: string;
|
|
157
173
|
} | {
|
|
158
174
|
readonly code: "duplicate-primitive-type";
|
|
159
175
|
readonly type: string;
|
|
160
176
|
};
|
|
161
|
-
export type PrimitiveRegistry = PrimitiveResolver & PropsValidator & TextResolver & BehaviourResolver & FrameResolver & BindingReader & SlotPlacer & UnshownReader & CopyDeclarations & {
|
|
177
|
+
export type PrimitiveRegistry = PrimitiveResolver & PropsValidator & TextResolver & BehaviourResolver & FrameResolver & BindingReader & AnswerReader & SlotPlacer & UnshownReader & CopyDeclarations & {
|
|
162
178
|
/** In registration order, so a catalogue and an audit read predictably. */
|
|
163
179
|
readonly primitives: readonly RegisteredPrimitive[];
|
|
164
180
|
/**
|
package/dist/sdk/registry.js
CHANGED
|
@@ -2,6 +2,7 @@ import { BINDING_NAME_EXPECTATION, bindingNameSchema, } from "../data/source.js"
|
|
|
2
2
|
import { primitiveTypeSchema, slotNameSchema, textKeySchema, } from "../primitive-type.js";
|
|
3
3
|
import { err, ok } from "../result.js";
|
|
4
4
|
import { BEHAVIOURS, isBehaviourName, NO_CONTROL_NAME_PROPS, } from "../render/behaviour.js";
|
|
5
|
+
import { declaredName } from "../render/expected.js";
|
|
5
6
|
import { NO_TEXT } from "../render/text.js";
|
|
6
7
|
import { isPrimitiveRole, PRIMITIVE_ROLES } from "../role.js";
|
|
7
8
|
const NO_BEHAVIOUR_NAMES = Object.freeze([]);
|
|
@@ -33,6 +34,8 @@ export const describeRegistryError = (error) => {
|
|
|
33
34
|
return `"${error.type}" says it reads a binding called "${error.name}", which is not a binding name — ${BINDING_NAME_EXPECTATION}; a tree cannot ask under a name it cannot write, so this primitive would report every binding it was ever given`;
|
|
34
35
|
case "unpaired-behaviour":
|
|
35
36
|
return `"${error.type}" takes the "${error.behaviour}" behaviour and not "${error.requires}", which it does nothing without; it would render a control that asks a region nothing opens to close`;
|
|
37
|
+
case "unread-expects-binding":
|
|
38
|
+
return `"${error.type}" says what shape it expects under "${error.name}", which is not a binding name it declares that it reads; the expectation would then be checked against nothing, and would go on being checked against nothing after the name it was written for was renamed`;
|
|
36
39
|
case "undeclared-reads-prop":
|
|
37
40
|
return `"${error.type}" says it reads a binding under whichever name its "${error.prop}" prop gives, which its props schema does not declare; that prop can never arrive, so the primitive would read its default for ever and go on doing so after the prop it names was renamed`;
|
|
38
41
|
case "undeclared-named-behaviour":
|
|
@@ -243,6 +246,29 @@ const registeredReads = (entry) => {
|
|
|
243
246
|
* with the mistaken.
|
|
244
247
|
*/
|
|
245
248
|
const declaresProp = (entry, prop) => !entry.declaredProps || entry.declaredProps.some((declared) => declared.name === prop);
|
|
249
|
+
/**
|
|
250
|
+
* An expectation written for a name this primitive does not read, if there is
|
|
251
|
+
* one.
|
|
252
|
+
*
|
|
253
|
+
* The drift `frames` and `copy` are checked for, one seam over: a declaration
|
|
254
|
+
* naming something the thing it describes does not have, left pointing at
|
|
255
|
+
* nothing by a rename. It is checked against `reads` rather than against the
|
|
256
|
+
* props schema because a binding name is not a prop name, and against the name
|
|
257
|
+
* as **declared** — a prop-named declaration's `default` — because that is what
|
|
258
|
+
* an expectation is keyed by (0184, 0357).
|
|
259
|
+
*
|
|
260
|
+
* A primitive that declared expectations and no `reads` at all fails here on its
|
|
261
|
+
* first expectation, which is right: it has said what shape it expects of an
|
|
262
|
+
* answer without ever saying it reads one, so there is no name any of it could
|
|
263
|
+
* be about.
|
|
264
|
+
*/
|
|
265
|
+
const unreadExpectsBinding = (entry) => {
|
|
266
|
+
const { expects, reads } = entry;
|
|
267
|
+
if (!expects)
|
|
268
|
+
return undefined;
|
|
269
|
+
const names = new Set((reads ?? []).map(declaredName));
|
|
270
|
+
return Object.keys(expects).find((name) => !names.has(name));
|
|
271
|
+
};
|
|
246
272
|
const registerEntry = (entry) => {
|
|
247
273
|
const type = primitiveTypeSchema.safeParse(entry.type);
|
|
248
274
|
if (!type.success)
|
|
@@ -273,6 +299,10 @@ const registerEntry = (entry) => {
|
|
|
273
299
|
if (unreadable !== undefined) {
|
|
274
300
|
return err({ code: "undeclared-copy-prop", type: entry.type, prop: unreadable });
|
|
275
301
|
}
|
|
302
|
+
const unexpected = unreadExpectsBinding(entry);
|
|
303
|
+
if (unexpected !== undefined) {
|
|
304
|
+
return err({ code: "unread-expects-binding", type: entry.type, name: unexpected });
|
|
305
|
+
}
|
|
276
306
|
const behaviours = registeredBehaviours(entry);
|
|
277
307
|
if (!behaviours.ok)
|
|
278
308
|
return behaviours;
|
|
@@ -302,6 +332,7 @@ const registerEntry = (entry) => {
|
|
|
302
332
|
role: role.value,
|
|
303
333
|
copy: entry.copy ? Object.freeze([...entry.copy]) : undefined,
|
|
304
334
|
reads: reads.value,
|
|
335
|
+
expects: entry.expects,
|
|
305
336
|
unshown: entry.unshown,
|
|
306
337
|
validate: entry.validate,
|
|
307
338
|
});
|
|
@@ -362,6 +393,14 @@ export const createPrimitiveRegistry = (entries) => {
|
|
|
362
393
|
* primitive reads.
|
|
363
394
|
*/
|
|
364
395
|
bindingsReadBy: (type) => byType.get(type)?.reads,
|
|
396
|
+
/**
|
|
397
|
+
* `undefined` for a primitive that declared no expectation and for a type
|
|
398
|
+
* this registry does not hold, and the two collapsing is correct for
|
|
399
|
+
* `bindingsReadBy`'s reason: a walk that could not find the primitive has
|
|
400
|
+
* said so as `unknown-primitive` and has no standing to say what shape that
|
|
401
|
+
* primitive can read.
|
|
402
|
+
*/
|
|
403
|
+
answersExpectedBy: (type) => byType.get(type)?.expects,
|
|
365
404
|
/**
|
|
366
405
|
* `undefined` for a type nobody registered as well as for one that declared
|
|
367
406
|
* nothing, and the two collapsing here is correct: neither has said what a
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seventh contract suite both reader-signal tally stores are run against:
|
|
3
|
+
* **what readers did to a part, filed under the hour they did it in, and the
|
|
4
|
+
* hours of a part summing to the part's own counters** (`acted.ts`).
|
|
5
|
+
*
|
|
6
|
+
* Here rather than beside the three in `src/testing/reader-signal-contract.ts`
|
|
7
|
+
* for the reason `arrivals.contract.ts` is: that directory is another lane's
|
|
8
|
+
* and this is reader-signal work.
|
|
9
|
+
*
|
|
10
|
+
* **Every property here needs two implementations to be worth asserting**, and
|
|
11
|
+
* they are the same three hazards the arrivals suite names, one table deeper.
|
|
12
|
+
* The hour is a `timestamptz` in one store and a number in the other; a part's
|
|
13
|
+
* row is written in the same transaction as the tally it slices in one and
|
|
14
|
+
* through two maps in the other; and two rows naming one part-hour inside a
|
|
15
|
+
* single call are an `ON CONFLICT` Postgres **raises** on and a `Map` silently
|
|
16
|
+
* overwrites. Each is a way for a goal's chart to stop summing to the goal's
|
|
17
|
+
* own figure, which is permanent (0158).
|
|
18
|
+
*/
|
|
19
|
+
import type { ReaderTallyStore } from "./tally.js";
|
|
20
|
+
export declare const describeActedHourContract: (name: string, make: () => Promise<ReaderTallyStore> | ReaderTallyStore) => void;
|
|
21
|
+
//# sourceMappingURL=acted.contract.d.ts.map
|