@serene-pub/sdk 0.6.0-pr-1
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 +202 -0
- package/NOTICE +17 -0
- package/README.md +368 -0
- package/dist/actions.d.ts +572 -0
- package/dist/actions.js +829 -0
- package/dist/annexFields.d.ts +234 -0
- package/dist/annexFields.js +413 -0
- package/dist/announce.d.ts +464 -0
- package/dist/announce.js +426 -0
- package/dist/attributes.d.ts +670 -0
- package/dist/attributes.js +904 -0
- package/dist/bands.d.ts +125 -0
- package/dist/bands.js +256 -0
- package/dist/builder.d.ts +683 -0
- package/dist/builder.js +677 -0
- package/dist/candidates.d.ts +109 -0
- package/dist/candidates.js +118 -0
- package/dist/capabilities.d.ts +744 -0
- package/dist/capabilities.js +679 -0
- package/dist/channels.d.ts +106 -0
- package/dist/channels.js +129 -0
- package/dist/clauses.d.ts +40 -0
- package/dist/clauses.js +43 -0
- package/dist/component.d.ts +33 -0
- package/dist/component.js +27 -0
- package/dist/componentBuild.d.ts +48 -0
- package/dist/componentBuild.js +84 -0
- package/dist/componentClient.d.ts +100 -0
- package/dist/componentClient.js +13 -0
- package/dist/componentImports.d.ts +51 -0
- package/dist/componentImports.js +106 -0
- package/dist/componentModule.d.ts +8 -0
- package/dist/componentModule.js +270 -0
- package/dist/componentWire.d.ts +130 -0
- package/dist/componentWire.js +280 -0
- package/dist/config.d.ts +295 -0
- package/dist/config.js +231 -0
- package/dist/connections.d.ts +89 -0
- package/dist/connections.js +131 -0
- package/dist/declarations.d.ts +290 -0
- package/dist/declarations.js +794 -0
- package/dist/descriptors.d.ts +1774 -0
- package/dist/descriptors.js +1329 -0
- package/dist/dev.d.ts +136 -0
- package/dist/dev.js +161 -0
- package/dist/document.d.ts +202 -0
- package/dist/document.js +312 -0
- package/dist/engines.d.ts +117 -0
- package/dist/engines.js +203 -0
- package/dist/eventMapLaws.d.ts +63 -0
- package/dist/eventMapLaws.js +128 -0
- package/dist/events.d.ts +554 -0
- package/dist/events.js +633 -0
- package/dist/executor.d.ts +771 -0
- package/dist/executor.js +1829 -0
- package/dist/extension.d.ts +448 -0
- package/dist/extension.js +315 -0
- package/dist/facets.d.ts +53 -0
- package/dist/facets.js +60 -0
- package/dist/foldedSections.d.ts +74 -0
- package/dist/foldedSections.js +161 -0
- package/dist/genres.d.ts +507 -0
- package/dist/genres.js +633 -0
- package/dist/guardedConnection.d.ts +138 -0
- package/dist/guardedConnection.js +341 -0
- package/dist/handlebarsReach.d.ts +122 -0
- package/dist/handlebarsReach.js +222 -0
- package/dist/hash.d.ts +146 -0
- package/dist/hash.js +166 -0
- package/dist/hookGrants.d.ts +47 -0
- package/dist/hookGrants.js +68 -0
- package/dist/hooks.d.ts +290 -0
- package/dist/hooks.js +113 -0
- package/dist/hostElements.d.ts +447 -0
- package/dist/hostElements.js +702 -0
- package/dist/i18n.d.ts +94 -0
- package/dist/i18n.js +123 -0
- package/dist/identity.d.ts +93 -0
- package/dist/identity.js +135 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +176 -0
- package/dist/layout.d.ts +194 -0
- package/dist/layout.js +40 -0
- package/dist/media.d.ts +202 -0
- package/dist/media.js +70 -0
- package/dist/messageBlocks.d.ts +487 -0
- package/dist/messageBlocks.js +683 -0
- package/dist/migration.d.ts +128 -0
- package/dist/migration.js +261 -0
- package/dist/names.d.ts +78 -0
- package/dist/names.js +136 -0
- package/dist/nodeInput.d.ts +399 -0
- package/dist/nodeInput.js +178 -0
- package/dist/participants.d.ts +291 -0
- package/dist/participants.js +252 -0
- package/dist/personGate.d.ts +62 -0
- package/dist/personGate.js +77 -0
- package/dist/pick.d.ts +84 -0
- package/dist/pick.js +103 -0
- package/dist/pluginHarness.d.ts +235 -0
- package/dist/pluginHarness.js +558 -0
- package/dist/pluginPermissions.d.ts +25 -0
- package/dist/pluginPermissions.js +97 -0
- package/dist/pluginRuleRef.d.ts +13 -0
- package/dist/pluginRuleRef.js +10 -0
- package/dist/predicates.d.ts +182 -0
- package/dist/predicates.js +249 -0
- package/dist/preview.d.ts +120 -0
- package/dist/preview.js +82 -0
- package/dist/promptBlocks.d.ts +130 -0
- package/dist/promptBlocks.js +197 -0
- package/dist/rankingDecisions.d.ts +60 -0
- package/dist/rankingDecisions.js +48 -0
- package/dist/receipt.d.ts +313 -0
- package/dist/receipt.js +60 -0
- package/dist/receiverRules.d.ts +24 -0
- package/dist/receiverRules.js +94 -0
- package/dist/refs.d.ts +117 -0
- package/dist/refs.js +137 -0
- package/dist/registry.d.ts +230 -0
- package/dist/registry.js +273 -0
- package/dist/review.d.ts +108 -0
- package/dist/review.js +97 -0
- package/dist/sampling.d.ts +152 -0
- package/dist/sampling.js +712 -0
- package/dist/scope.d.ts +65 -0
- package/dist/scope.js +128 -0
- package/dist/scripts.d.ts +243 -0
- package/dist/scripts.js +326 -0
- package/dist/sessionLayout.d.ts +339 -0
- package/dist/sessionLayout.js +503 -0
- package/dist/sessionSettings.d.ts +70 -0
- package/dist/sessionSettings.js +2 -0
- package/dist/settings.d.ts +501 -0
- package/dist/settings.js +604 -0
- package/dist/settingsSlot.d.ts +108 -0
- package/dist/settingsSlot.js +166 -0
- package/dist/shapes.d.ts +373 -0
- package/dist/shapes.js +408 -0
- package/dist/sheets.d.ts +165 -0
- package/dist/sheets.js +251 -0
- package/dist/statShapes.d.ts +96 -0
- package/dist/statShapes.js +112 -0
- package/dist/status.d.ts +103 -0
- package/dist/status.js +125 -0
- package/dist/storage.d.ts +145 -0
- package/dist/storage.js +33 -0
- package/dist/storyTime.d.ts +308 -0
- package/dist/storyTime.js +560 -0
- package/dist/surfaces.d.ts +501 -0
- package/dist/surfaces.js +292 -0
- package/dist/template.d.ts +312 -0
- package/dist/template.js +554 -0
- package/dist/templateCheck.d.ts +60 -0
- package/dist/templateCheck.js +516 -0
- package/dist/templateFit.d.ts +157 -0
- package/dist/templateFit.js +349 -0
- package/dist/templateIds.d.ts +138 -0
- package/dist/templateIds.js +144 -0
- package/dist/templateScopeAt.d.ts +131 -0
- package/dist/templateScopeAt.js +354 -0
- package/dist/testing.d.ts +177 -0
- package/dist/testing.js +383 -0
- package/dist/tokenizers.d.ts +113 -0
- package/dist/tokenizers.js +184 -0
- package/dist/turnLock.d.ts +96 -0
- package/dist/turnLock.js +79 -0
- package/dist/turnOrder.d.ts +143 -0
- package/dist/turnOrder.js +128 -0
- package/dist/validate.d.ts +74 -0
- package/dist/validate.js +1399 -0
- package/dist/values.d.ts +212 -0
- package/dist/values.js +390 -0
- package/dist/variables.d.ts +493 -0
- package/dist/variables.js +662 -0
- package/dist/verdicts.d.ts +275 -0
- package/dist/verdicts.js +348 -0
- package/dist/widgetDecls.d.ts +88 -0
- package/dist/widgetDecls.js +119 -0
- package/dist/widgets.d.ts +1527 -0
- package/dist/widgets.js +208 -0
- package/dist/wire.d.ts +126 -0
- package/dist/wire.js +140 -0
- package/dist/worldinfo.d.ts +150 -0
- package/dist/worldinfo.js +212 -0
- package/host-elements.d.ts +914 -0
- package/package.json +67 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The event map's two laws (PLAN-turn-order §B3), as pure functions the
|
|
3
|
+
* conformance kit (C28, C29) and a host's boot check both call — one
|
|
4
|
+
* judgement, two callers, so the kit and the warning cannot disagree.
|
|
5
|
+
*
|
|
6
|
+
* **C28 — every event a genre lists is caused or a declared root.** A
|
|
7
|
+
* listed event that nothing writes and nobody starts is a slot a preset can
|
|
8
|
+
* bind and nothing will ever fire.
|
|
9
|
+
*
|
|
10
|
+
* **C29 — every cycle has a termination policy.** The event map (events,
|
|
11
|
+
* pipelines, listeners; binds · causes · listens) may loop: a reply completes a
|
|
12
|
+
* message, the message recomputes the turn order, auto-advance asks for the
|
|
13
|
+
* next reply. A loop is fine when something in it declares how it stops —
|
|
14
|
+
* auto-advance's cause rule and cap, or the host's run caps, which park a
|
|
15
|
+
* run tree for its owner. A loop where nothing does runs until the host
|
|
16
|
+
* falls over.
|
|
17
|
+
*/
|
|
18
|
+
/** @experimental */
|
|
19
|
+
export type EventGraphNodeKind = 'event' | 'spec' | 'listener';
|
|
20
|
+
/** @experimental */
|
|
21
|
+
export type EventGraphEdgeKind = 'binds' | 'causes' | 'listens';
|
|
22
|
+
/** The event map as a host draws it — the same shape the app's `eventMap` returns. @experimental */
|
|
23
|
+
export interface EventGraph {
|
|
24
|
+
nodes: ReadonlyArray<{
|
|
25
|
+
id: string;
|
|
26
|
+
kind: EventGraphNodeKind;
|
|
27
|
+
}>;
|
|
28
|
+
edges: ReadonlyArray<{
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
kind: EventGraphEdgeKind;
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
/** One C28 finding: a genre lists an event that nothing causes and nobody starts. @experimental */
|
|
35
|
+
export interface UncausedEventFinding {
|
|
36
|
+
genre: string;
|
|
37
|
+
event: string;
|
|
38
|
+
sentence: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* C28 over one genre's event surface. An event the registry does not know
|
|
42
|
+
* is a finding too: it cannot be caused, because it does not exist.
|
|
43
|
+
* @experimental
|
|
44
|
+
*/
|
|
45
|
+
export declare function uncausedGenreEvents(genre: {
|
|
46
|
+
id: string;
|
|
47
|
+
events?: Readonly<Record<string, unknown>>;
|
|
48
|
+
}): UncausedEventFinding[];
|
|
49
|
+
/** One C29 finding: a cycle in which no node declares a termination policy. @experimental */
|
|
50
|
+
export interface UnterminatedCycleFinding {
|
|
51
|
+
/** The cycle's members (one strongly connected component), sorted. */
|
|
52
|
+
members: string[];
|
|
53
|
+
sentence: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* C29 over one drawn map. `terminationOf(id)` is the host's termination
|
|
57
|
+
* policy for a loop through that node — auto-advance's cause rule and cap, the run
|
|
58
|
+
* caps that park a tree — or undefined. Every strongly connected component
|
|
59
|
+
* that holds a cycle must hold a node with a termination policy.
|
|
60
|
+
* @experimental
|
|
61
|
+
*/
|
|
62
|
+
export declare function unterminatedCycles(graph: EventGraph, terminationOf: (nodeId: string) => string | undefined): UnterminatedCycleFinding[];
|
|
63
|
+
//# sourceMappingURL=eventMapLaws.d.ts.map
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The event map's two laws (PLAN-turn-order §B3), as pure functions the
|
|
3
|
+
* conformance kit (C28, C29) and a host's boot check both call — one
|
|
4
|
+
* judgement, two callers, so the kit and the warning cannot disagree.
|
|
5
|
+
*
|
|
6
|
+
* **C28 — every event a genre lists is caused or a declared root.** A
|
|
7
|
+
* listed event that nothing writes and nobody starts is a slot a preset can
|
|
8
|
+
* bind and nothing will ever fire.
|
|
9
|
+
*
|
|
10
|
+
* **C29 — every cycle has a termination policy.** The event map (events,
|
|
11
|
+
* pipelines, listeners; binds · causes · listens) may loop: a reply completes a
|
|
12
|
+
* message, the message recomputes the turn order, auto-advance asks for the
|
|
13
|
+
* next reply. A loop is fine when something in it declares how it stops —
|
|
14
|
+
* auto-advance's cause rule and cap, or the host's run caps, which park a
|
|
15
|
+
* run tree for its owner. A loop where nothing does runs until the host
|
|
16
|
+
* falls over.
|
|
17
|
+
*/
|
|
18
|
+
import { eventById } from './events.js';
|
|
19
|
+
/**
|
|
20
|
+
* C28 over one genre's event surface. An event the registry does not know
|
|
21
|
+
* is a finding too: it cannot be caused, because it does not exist.
|
|
22
|
+
* @experimental
|
|
23
|
+
*/
|
|
24
|
+
export function uncausedGenreEvents(genre) {
|
|
25
|
+
const out = [];
|
|
26
|
+
for (const event of Object.keys(genre.events ?? {})) {
|
|
27
|
+
const def = eventById(event);
|
|
28
|
+
if (!def)
|
|
29
|
+
out.push({
|
|
30
|
+
genre: genre.id,
|
|
31
|
+
event,
|
|
32
|
+
sentence: `genre '${genre.id}' lists '${event}', which no one declares — nothing can cause it`,
|
|
33
|
+
});
|
|
34
|
+
else if (!def.causedBy?.length && !def.declaredRoot)
|
|
35
|
+
out.push({
|
|
36
|
+
genre: genre.id,
|
|
37
|
+
event,
|
|
38
|
+
sentence: `genre '${genre.id}' lists '${event}', which no write causes and which is not a declared ` +
|
|
39
|
+
`root — a preset can bind it and nothing will ever fire it`,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
return out;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* C29 over one drawn map. `terminationOf(id)` is the host's termination
|
|
46
|
+
* policy for a loop through that node — auto-advance's cause rule and cap, the run
|
|
47
|
+
* caps that park a tree — or undefined. Every strongly connected component
|
|
48
|
+
* that holds a cycle must hold a node with a termination policy.
|
|
49
|
+
* @experimental
|
|
50
|
+
*/
|
|
51
|
+
export function unterminatedCycles(graph, terminationOf) {
|
|
52
|
+
const next = new Map();
|
|
53
|
+
const ids = new Set();
|
|
54
|
+
for (const n of graph.nodes)
|
|
55
|
+
ids.add(n.id);
|
|
56
|
+
for (const e of graph.edges) {
|
|
57
|
+
ids.add(e.from);
|
|
58
|
+
ids.add(e.to);
|
|
59
|
+
const list = next.get(e.from) ?? [];
|
|
60
|
+
list.push(e.to);
|
|
61
|
+
next.set(e.from, list);
|
|
62
|
+
}
|
|
63
|
+
// Tarjan's strongly connected components, iterative so a long chain
|
|
64
|
+
// cannot overflow the stack.
|
|
65
|
+
let index = 0;
|
|
66
|
+
const order = new Map();
|
|
67
|
+
const low = new Map();
|
|
68
|
+
const onStack = new Set();
|
|
69
|
+
const stack = [];
|
|
70
|
+
const components = [];
|
|
71
|
+
for (const root of [...ids].sort()) {
|
|
72
|
+
if (order.has(root))
|
|
73
|
+
continue;
|
|
74
|
+
const work = [{ id: root, i: 0 }];
|
|
75
|
+
order.set(root, index);
|
|
76
|
+
low.set(root, index++);
|
|
77
|
+
stack.push(root);
|
|
78
|
+
onStack.add(root);
|
|
79
|
+
while (work.length) {
|
|
80
|
+
const top = work[work.length - 1];
|
|
81
|
+
const outs = next.get(top.id) ?? [];
|
|
82
|
+
if (top.i < outs.length) {
|
|
83
|
+
const w = outs[top.i++];
|
|
84
|
+
if (!order.has(w)) {
|
|
85
|
+
order.set(w, index);
|
|
86
|
+
low.set(w, index++);
|
|
87
|
+
stack.push(w);
|
|
88
|
+
onStack.add(w);
|
|
89
|
+
work.push({ id: w, i: 0 });
|
|
90
|
+
}
|
|
91
|
+
else if (onStack.has(w))
|
|
92
|
+
low.set(top.id, Math.min(low.get(top.id), order.get(w)));
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
95
|
+
work.pop();
|
|
96
|
+
if (work.length) {
|
|
97
|
+
const parent = work[work.length - 1].id;
|
|
98
|
+
low.set(parent, Math.min(low.get(parent), low.get(top.id)));
|
|
99
|
+
}
|
|
100
|
+
if (low.get(top.id) === order.get(top.id)) {
|
|
101
|
+
const component = [];
|
|
102
|
+
let w;
|
|
103
|
+
do {
|
|
104
|
+
w = stack.pop();
|
|
105
|
+
onStack.delete(w);
|
|
106
|
+
component.push(w);
|
|
107
|
+
} while (w !== top.id);
|
|
108
|
+
components.push(component);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const out = [];
|
|
113
|
+
for (const c of components) {
|
|
114
|
+
const cyclic = c.length > 1 || (next.get(c[0]) ?? []).includes(c[0]);
|
|
115
|
+
if (!cyclic)
|
|
116
|
+
continue;
|
|
117
|
+
if (c.some((id) => terminationOf(id) !== undefined))
|
|
118
|
+
continue;
|
|
119
|
+
const members = [...c].sort();
|
|
120
|
+
out.push({
|
|
121
|
+
members,
|
|
122
|
+
sentence: `a loop through ${members.map((m) => `'${m}'`).join(', ')} has no termination policy — no ` +
|
|
123
|
+
`listener or pipeline in it declares how it stops, so one event can run it forever`,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=eventMapLaws.js.map
|