@serene-pub/sdk 0.6.0-pr-4 → 0.6.0-pr-6
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/README.md +23 -19
- package/dist/actions.d.ts +178 -69
- package/dist/actions.js +109 -40
- package/dist/annexFields.d.ts +12 -5
- package/dist/annexFields.js +6 -2
- package/dist/announce.d.ts +220 -30
- package/dist/announce.js +212 -7
- package/dist/attributes.d.ts +290 -11
- package/dist/attributes.js +317 -32
- package/dist/bands.d.ts +41 -6
- package/dist/bands.js +83 -33
- package/dist/bridges.d.ts +61 -0
- package/dist/bridges.js +112 -0
- package/dist/builder.d.ts +436 -106
- package/dist/builder.js +389 -46
- package/dist/cadences.d.ts +578 -0
- package/dist/cadences.js +1111 -0
- package/dist/candidates.d.ts +5 -3
- package/dist/candidates.js +3 -2
- package/dist/capabilities.d.ts +93 -15
- package/dist/capabilities.js +57 -6
- package/dist/checkMethods.d.ts +240 -0
- package/dist/checkMethods.js +362 -0
- package/dist/clauses.d.ts +2 -1
- package/dist/clauses.js +2 -1
- package/dist/component.d.ts +24 -7
- package/dist/component.js +16 -6
- package/dist/componentBuild.d.ts +16 -5
- package/dist/componentBuild.js +14 -5
- package/dist/componentClient.d.ts +61 -30
- package/dist/componentClient.js +11 -1
- package/dist/componentImports.d.ts +8 -5
- package/dist/componentImports.js +23 -4
- package/dist/componentModule.js +2 -1
- package/dist/componentWire.d.ts +2 -1
- package/dist/componentWire.js +34 -2
- package/dist/composerStates.d.ts +96 -0
- package/dist/composerStates.js +190 -0
- package/dist/conditions.d.ts +424 -0
- package/dist/conditions.js +521 -0
- package/dist/config.d.ts +69 -19
- package/dist/config.js +64 -26
- package/dist/connections.d.ts +9 -4
- package/dist/connections.js +7 -4
- package/dist/conversions.d.ts +41 -0
- package/dist/conversions.js +50 -0
- package/dist/declarations.d.ts +70 -18
- package/dist/declarations.js +194 -24
- package/dist/descriptors.d.ts +427 -100
- package/dist/descriptors.js +344 -59
- package/dist/dev.d.ts +6 -5
- package/dist/dev.js +6 -5
- package/dist/document.d.ts +121 -27
- package/dist/document.js +77 -24
- package/dist/dowry.d.ts +241 -0
- package/dist/dowry.js +315 -0
- package/dist/engines.d.ts +16 -7
- package/dist/engines.js +6 -4
- package/dist/entities.d.ts +156 -0
- package/dist/entities.js +259 -0
- package/dist/eventMapLaws.d.ts +19 -8
- package/dist/eventMapLaws.js +9 -6
- package/dist/events.d.ts +648 -40
- package/dist/events.js +451 -34
- package/dist/executor.d.ts +123 -41
- package/dist/executor.js +210 -103
- package/dist/exposure.d.ts +128 -0
- package/dist/exposure.js +168 -0
- package/dist/extension.d.ts +99 -35
- package/dist/extension.js +43 -9
- package/dist/facets.d.ts +2 -1
- package/dist/facets.js +4 -2
- package/dist/fit.d.ts +198 -0
- package/dist/fit.js +351 -0
- package/dist/foldedSections.d.ts +4 -2
- package/dist/foldedSections.js +2 -1
- package/dist/functions.d.ts +554 -0
- package/dist/functions.js +712 -0
- package/dist/genres.d.ts +408 -130
- package/dist/genres.js +412 -108
- package/dist/guardedConnection.d.ts +4 -3
- package/dist/guardedConnection.js +4 -3
- package/dist/handlebarsReach.d.ts +1 -1
- package/dist/handlebarsReach.js +1 -1
- package/dist/hash.d.ts +16 -5
- package/dist/hash.js +14 -4
- package/dist/hookGrants.d.ts +4 -3
- package/dist/hookGrants.js +7 -5
- package/dist/hooks.d.ts +42 -21
- package/dist/hooks.js +17 -12
- package/dist/hostElements.d.ts +47 -17
- package/dist/hostElements.js +62 -17
- package/dist/hostState.d.ts +110 -0
- package/dist/hostState.js +140 -0
- package/dist/i18n.d.ts +5 -3
- package/dist/i18n.js +5 -3
- package/dist/identity.d.ts +5 -4
- package/dist/identity.js +5 -4
- package/dist/index.d.ts +26 -0
- package/dist/index.js +55 -0
- package/dist/jsonSchema.d.ts +178 -0
- package/dist/jsonSchema.js +558 -0
- package/dist/layout.d.ts +36 -15
- package/dist/layout.js +2 -2
- package/dist/loadouts.d.ts +97 -0
- package/dist/loadouts.js +81 -0
- package/dist/media.d.ts +153 -16
- package/dist/media.js +47 -2
- package/dist/messageBlocks.d.ts +223 -37
- package/dist/messageBlocks.js +231 -24
- package/dist/migration.d.ts +16 -8
- package/dist/migration.js +14 -8
- package/dist/names.d.ts +2 -1
- package/dist/names.js +2 -1
- package/dist/nodeInput.d.ts +2 -1
- package/dist/nodeInput.js +2 -1
- package/dist/participants.d.ts +54 -24
- package/dist/participants.js +27 -14
- package/dist/personGate.d.ts +2 -1
- package/dist/personGate.js +2 -1
- package/dist/pluginHarness.d.ts +22 -35
- package/dist/pluginHarness.js +18 -143
- package/dist/pluginPermissions.d.ts +2 -1
- package/dist/pluginPermissions.js +13 -2
- package/dist/pluginRuleRef.d.ts +2 -2
- package/dist/pluginRuleRef.js +1 -1
- package/dist/predicates.d.ts +16 -11
- package/dist/predicates.js +7 -6
- package/dist/preview.d.ts +53 -7
- package/dist/preview.js +54 -13
- package/dist/primers.d.ts +177 -0
- package/dist/primers.js +265 -0
- package/dist/promptBlocks.d.ts +5 -3
- package/dist/promptBlocks.js +5 -3
- package/dist/rankingDecisions.d.ts +2 -1
- package/dist/rankingDecisions.js +2 -1
- package/dist/receipt.d.ts +76 -29
- package/dist/receipt.js +9 -4
- package/dist/receiverRules.js +3 -2
- package/dist/refs.d.ts +42 -9
- package/dist/refs.js +45 -13
- package/dist/registrations.d.ts +384 -0
- package/dist/registrations.js +625 -0
- package/dist/registry.d.ts +42 -23
- package/dist/registry.js +7 -5
- package/dist/repertoires.d.ts +502 -0
- package/dist/repertoires.js +666 -0
- package/dist/review.d.ts +16 -5
- package/dist/review.js +11 -4
- package/dist/rulesetDocument.d.ts +95 -0
- package/dist/rulesetDocument.js +190 -0
- package/dist/rulesetSections.d.ts +597 -0
- package/dist/rulesetSections.js +1249 -0
- package/dist/rulesetTemplates.d.ts +161 -0
- package/dist/rulesetTemplates.js +242 -0
- package/dist/rulesets.d.ts +899 -0
- package/dist/rulesets.js +1378 -0
- package/dist/sampling.d.ts +54 -0
- package/dist/sampling.js +95 -3
- package/dist/sceneSettings.d.ts +320 -0
- package/dist/sceneSettings.js +433 -0
- package/dist/scope.d.ts +50 -7
- package/dist/scope.js +22 -3
- package/dist/scripts.d.ts +112 -22
- package/dist/scripts.js +135 -19
- package/dist/sessionDossier.d.ts +638 -0
- package/dist/sessionDossier.js +33 -0
- package/dist/sessionLayout.d.ts +492 -55
- package/dist/sessionLayout.js +697 -90
- package/dist/sessionSettings.d.ts +32 -5
- package/dist/settings.d.ts +66 -20
- package/dist/settings.js +19 -12
- package/dist/settingsSlot.d.ts +11 -8
- package/dist/settingsSlot.js +11 -8
- package/dist/shapes.d.ts +139 -37
- package/dist/shapes.js +152 -38
- package/dist/sheets.d.ts +4 -2
- package/dist/sheets.js +6 -3
- package/dist/statShapes.d.ts +10 -2
- package/dist/statShapes.js +10 -2
- package/dist/status.d.ts +27 -9
- package/dist/status.js +20 -6
- package/dist/storage.d.ts +11 -67
- package/dist/storage.js +9 -13
- package/dist/storyTime.d.ts +13 -7
- package/dist/storyTime.js +11 -6
- package/dist/strokes.d.ts +176 -0
- package/dist/strokes.js +281 -0
- package/dist/surfaces.d.ts +54 -25
- package/dist/surfaces.js +3 -3
- package/dist/template.d.ts +9 -5
- package/dist/template.js +5 -3
- package/dist/templateCheck.d.ts +2 -2
- package/dist/templateCheck.js +2 -2
- package/dist/templateFit.d.ts +37 -8
- package/dist/templateFit.js +92 -8
- package/dist/templateIds.d.ts +3 -3
- package/dist/templateIds.js +3 -3
- package/dist/templateScopeAt.d.ts +22 -12
- package/dist/templateScopeAt.js +32 -19
- package/dist/testing.d.ts +11 -4
- package/dist/testing.js +13 -5
- package/dist/ties.d.ts +210 -0
- package/dist/ties.js +300 -0
- package/dist/tokenizers.d.ts +2 -2
- package/dist/tokenizers.js +2 -2
- package/dist/turnLock.d.ts +4 -2
- package/dist/turnLock.js +2 -1
- package/dist/turnOrder.d.ts +39 -22
- package/dist/turnOrder.js +30 -13
- package/dist/validate.d.ts +11 -8
- package/dist/validate.js +195 -29
- package/dist/values.d.ts +17 -8
- package/dist/values.js +11 -6
- package/dist/variables.d.ts +46 -7
- package/dist/variables.js +87 -6
- package/dist/verdicts.d.ts +20 -13
- package/dist/verdicts.js +17 -11
- package/dist/vocabularies.d.ts +192 -0
- package/dist/vocabularies.js +326 -0
- package/dist/widgetDecls.d.ts +20 -4
- package/dist/widgetDecls.js +6 -2
- package/dist/widgets.d.ts +1580 -111
- package/dist/widgets.js +113 -18
- package/dist/wire.d.ts +13 -6
- package/dist/wire.js +3 -3
- package/dist/worldinfo.d.ts +11 -6
- package/dist/worldinfo.js +8 -4
- package/host-elements.d.ts +101 -0
- package/package.json +1 -1
package/dist/actions.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Actions — what a person (or an AI-portrayed participant) can invoke, and
|
|
3
|
-
* where (
|
|
4
|
-
* 09-AMENDMENTS-B B9, F40 — was F38 before the 2026-09-17 renumbering; ruled
|
|
5
|
-
* 2026-09-15, built 2026-09-16 as U5c).
|
|
3
|
+
* where (built 2026-09-16).
|
|
6
4
|
*
|
|
7
5
|
* A spec contributes actions through `contributes.actions[]`. Core's own message verbs — the floors and the
|
|
8
|
-
* built-ins
|
|
6
|
+
* built-ins — are described by the same shape in `CORE_ACTIONS`, so
|
|
9
7
|
* a client renders **one list** per venue and never hand-writes a verb button.
|
|
10
8
|
*
|
|
11
9
|
* ## The four declarations
|
|
@@ -22,16 +20,16 @@
|
|
|
22
20
|
* - **quick** — the one prominence flag. Every venue is a **primary set**
|
|
23
21
|
* (`quick: true`) plus an **overflow** that always lists every enabled
|
|
24
22
|
* action; composer actions are always reachable through `/`. Placement is
|
|
25
|
-
* presentation; availability is data
|
|
23
|
+
* presentation; availability is data. A CSS pack may reposition the
|
|
26
24
|
* primary set, never remove an action.
|
|
27
25
|
* - **slash** — the stable ASCII id a composer action is called by. Core's
|
|
28
26
|
* specs claim bare names (`advance`, `narrate`); a plugin's are
|
|
29
27
|
* `<plugin>.<action>` (`acme.roll`), the plugin id being the spec's
|
|
30
28
|
* namespace — so a collision across owners is impossible by construction,
|
|
31
29
|
* and the palette autocompletes so nobody types the long form. Never
|
|
32
|
-
* localised
|
|
30
|
+
* localised: the palette shows the localised `label` beside it.
|
|
33
31
|
*
|
|
34
|
-
* - **enabled-when** (
|
|
32
|
+
* - **enabled-when** (built 2026-09-17) — whether the action is offered
|
|
35
33
|
* *now*: a declared predicate over the session's **published values**, the
|
|
36
34
|
* junction clause's shape (`{ on: 'state.world.location', truthy: true,
|
|
37
35
|
* reason }`), never code. A list means all must hold. The genre supplies
|
|
@@ -44,10 +42,11 @@
|
|
|
44
42
|
* ## What this is not
|
|
45
43
|
*
|
|
46
44
|
* Not a *pipeline* — an action *starts* one (`function` is the key routing
|
|
47
|
-
* resolves
|
|
45
|
+
* resolves). Not an *event* — those are core-owned occurrences. Not
|
|
48
46
|
* *availability* — the genre's `messageVerbs` and the preset's included set
|
|
49
47
|
* decide that; a declaration here says where and to whom an available action
|
|
50
48
|
* is offered.
|
|
49
|
+
* @ruling plans/29 R-15 *venue* · *audience* · *quick* · *slash name*, 09-AMENDMENTS-B B9, F40 (was F38 before the 2026-09-17 renumbering; ruled 2026-09-15), U5c, U5b, R-20, U5e, 19 §3
|
|
51
50
|
*/
|
|
52
51
|
import { isParticipantRef, PARTICIPANT_ROLES } from './participants.js';
|
|
53
52
|
import { DEFAULT_CHANNEL, parseChannel } from './channels.js';
|
|
@@ -56,30 +55,57 @@ import { enabledWhenFindings, i18nFindings, isEnabledWhenShaped, normalizeEnable
|
|
|
56
55
|
import { i18nText } from './i18n.js';
|
|
57
56
|
import { CORE_ACTION_SPEC_ID } from './identity.js';
|
|
58
57
|
import { assertSlotId } from './attributes.js';
|
|
59
|
-
|
|
58
|
+
import { STORY_TIME_UNITS } from './storyTime.js';
|
|
59
|
+
/**
|
|
60
|
+
* The two sides of the effects line. `fiction` is the default.
|
|
61
|
+
* @experimental
|
|
62
|
+
* @ruling R-15
|
|
63
|
+
*/
|
|
60
64
|
export const ACTION_EFFECTS = ['fiction', 'world'];
|
|
61
65
|
/**
|
|
62
|
-
* How much an action needs the text it **collects
|
|
63
|
-
*
|
|
66
|
+
* How much an action needs the text it **collects**: `required` — the
|
|
67
|
+
* press does not fire without some;
|
|
64
68
|
* `optional` — an empty submit fires too, and `CollectedText.ifEmpty` says
|
|
65
|
-
* what that does. Was `COMPOSER_TEXT_MODES
|
|
69
|
+
* what that does. Was `COMPOSER_TEXT_MODES`, when the text was read
|
|
66
70
|
* off the composer's draft.
|
|
67
71
|
* @experimental
|
|
72
|
+
* @ruling lair pass R3 (2026-09-28), B10
|
|
68
73
|
*/
|
|
69
74
|
export const TEXT_NEEDS = ['required', 'optional'];
|
|
75
|
+
/** The largest step a press may collect, either way — a typo of 100000 years is refused, not stepped. @experimental */
|
|
76
|
+
export const CLOCK_STEP_MAX = 10_000;
|
|
77
|
+
/**
|
|
78
|
+
* Why a collected clock step cannot ride, as a sentence — or null when it can:
|
|
79
|
+
* `{ by, unit }`, a whole `by` other than zero within ±`CLOCK_STEP_MAX`, a unit
|
|
80
|
+
* of `STORY_TIME_UNITS`. The host's door and the modal ask the same.
|
|
81
|
+
* @experimental
|
|
82
|
+
*/
|
|
83
|
+
export function clockStepRefusal(raw) {
|
|
84
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
85
|
+
return 'takes its time as { by, unit } — how many, and of what.';
|
|
86
|
+
const { by, unit } = raw;
|
|
87
|
+
if (typeof by !== 'number' || !Number.isInteger(by) || by === 0)
|
|
88
|
+
return 'takes a whole number of units other than zero.';
|
|
89
|
+
if (Math.abs(by) > CLOCK_STEP_MAX)
|
|
90
|
+
return `takes at most ${CLOCK_STEP_MAX} units at a time.`;
|
|
91
|
+
if (!STORY_TIME_UNITS.includes(unit))
|
|
92
|
+
return `counts in ${STORY_TIME_UNITS.join(', ')}.`;
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
70
95
|
/** The keys `ActionDecl.collects` may carry, and each request's own keys. */
|
|
71
|
-
const COLLECTS_KEYS = ['text', 'recipients'];
|
|
96
|
+
const COLLECTS_KEYS = ['text', 'recipients', 'clockStep'];
|
|
97
|
+
const COLLECTED_CLOCK_STEP_KEYS = ['label', 'default'];
|
|
72
98
|
const COLLECTED_TEXT_KEYS = ['need', 'label', 'placeholder', 'ifEmpty'];
|
|
73
99
|
const COLLECTED_RECIPIENTS_KEYS = ['label', 'min', 'max', 'overwrites'];
|
|
74
100
|
/**
|
|
75
101
|
* The venues a `world` action may appear in: never a form, the extra tab or a
|
|
76
102
|
* widget.
|
|
77
103
|
*
|
|
78
|
-
* ⚠ **`message` is on the owner's side since 2026-09-28
|
|
79
|
-
*
|
|
80
|
-
* to answer an out-of-fiction question
|
|
104
|
+
* ⚠ **`message` is on the owner's side since 2026-09-28**. The line exists
|
|
105
|
+
* so that a character can never be asked
|
|
106
|
+
* to answer an out-of-fiction question, and a question
|
|
81
107
|
* put to someone lives in the **`form`** venue — split out of `message` the
|
|
82
|
-
* day the line was built
|
|
108
|
+
* day the line was built. The `message` venue is a message's
|
|
83
109
|
* own ⋮ and quick row: a person's button, pressed by the person, on a row.
|
|
84
110
|
* With `act` held to `owner` / `admin` (`WORLD_ACTION_ACTORS`), no block
|
|
85
111
|
* naming it, and no fire made **as** a participant, a `world` action there
|
|
@@ -87,6 +113,7 @@ const COLLECTED_RECIPIENTS_KEYS = ['label', 'min', 'max', 'overwrites'];
|
|
|
87
113
|
* with the row as its subject. `extra` and `widget` stay out: a widget can
|
|
88
114
|
* invoke without a person's press.
|
|
89
115
|
* @experimental
|
|
116
|
+
* @ruling lair re-plan R11 *File as a room*, 29 R-15 *The line*, U5d review, S1
|
|
90
117
|
*/
|
|
91
118
|
export const WORLD_ACTION_VENUES = ['composer', 'message', 'session-settings', 'admin', 'review'];
|
|
92
119
|
/** The references a `world` action's `act` audience may name: the owner, an administrator. @experimental */
|
|
@@ -96,7 +123,7 @@ export const effectsOf = (action) => action.effects === 'world' ? 'world' : 'fic
|
|
|
96
123
|
/**
|
|
97
124
|
* The closed set of places an action may appear. Core owns it; a plugin picks.
|
|
98
125
|
*
|
|
99
|
-
* `form`
|
|
126
|
+
* `form` is the one venue nothing lists: an action carried
|
|
100
127
|
* by a **form** — a `choices` or `form` block in a message — and pressed
|
|
101
128
|
* only from that block (the Adventure genre's *Answer*). A `form`-venue
|
|
102
129
|
* action never appears in a message's overflow, the composer's More menu or
|
|
@@ -104,7 +131,7 @@ export const effectsOf = (action) => action.effects === 'world' ? 'world' : 'fic
|
|
|
104
131
|
* it. A `world` action may not take it (`WORLD_ACTION_VENUES`): an
|
|
105
132
|
* out-of-fiction effect is never a question a message carries.
|
|
106
133
|
*
|
|
107
|
-
* ⚠ **`form` stays fiction-only
|
|
134
|
+
* ⚠ **`form` stays fiction-only** (ruled 2026-09-17). A block
|
|
108
135
|
* addressed to the **owner** may name a `world` action — see
|
|
109
136
|
* `worldBlockFunctions` — but a *venue* is declared and an *addressee* is
|
|
110
137
|
* decided at run time, so this check cannot see one and would have to admit
|
|
@@ -113,6 +140,7 @@ export const effectsOf = (action) => action.effects === 'world' ? 'world' : 'fic
|
|
|
113
140
|
* says where the declaration may be OFFERED, the addressee says who may press
|
|
114
141
|
* this particular button, and the two answers stay separate.
|
|
115
142
|
* @experimental
|
|
143
|
+
* @ruling U5d review, S1, L1
|
|
116
144
|
*/
|
|
117
145
|
export const VENUE_KINDS = [
|
|
118
146
|
'composer',
|
|
@@ -143,10 +171,10 @@ export const BARE_SLASH = /^[a-z][a-z0-9-]*$/;
|
|
|
143
171
|
export const NAMESPACED_SLASH = /^([a-z0-9]+(?:[.-][a-z0-9]+)*)\.([a-z][a-z0-9-]*)$/;
|
|
144
172
|
/**
|
|
145
173
|
* Place actions into their venues for one channel — the placement rule every
|
|
146
|
-
* listing applies
|
|
174
|
+
* listing applies. `quick` → the primary set, else the
|
|
147
175
|
* overflow; a venue naming another channel's slug is skipped (a bare slug
|
|
148
|
-
* means every lane of it
|
|
149
|
-
* block alone reaches it
|
|
176
|
+
* means every lane of it); a `form` venue is listed nowhere — the
|
|
177
|
+
* block alone reaches it.
|
|
150
178
|
*
|
|
151
179
|
* Availability is decided BEFORE this: the genre's verbs, the preset's
|
|
152
180
|
* included set and enabled-when say which actions a session offers, and the
|
|
@@ -155,8 +183,9 @@ export const NAMESPACED_SLASH = /^([a-z0-9]+(?:[.-][a-z0-9]+)*)\.([a-z][a-z0-9-]
|
|
|
155
183
|
* the conformance kit's `listActions` seam on it — the SDK's own host does
|
|
156
184
|
* — and the kit itself never calls it: C19 judges the listing the HOST
|
|
157
185
|
* returns, entry by entry, and a rule the kit applied for the host would be
|
|
158
|
-
* a rule it could not see the host break
|
|
186
|
+
* a rule it could not see the host break.
|
|
159
187
|
* @experimental
|
|
188
|
+
* @ruling F40, R-15 *quick*, 20 §7, U5d review, S1, U7 review, C1
|
|
160
189
|
*/
|
|
161
190
|
export function placeActions(actions, channel = DEFAULT_CHANNEL) {
|
|
162
191
|
const listings = {};
|
|
@@ -174,7 +203,7 @@ export function placeActions(actions, channel = DEFAULT_CHANNEL) {
|
|
|
174
203
|
}
|
|
175
204
|
return listings;
|
|
176
205
|
}
|
|
177
|
-
/** The namespace of a spec id — `core:spec/
|
|
206
|
+
/** The namespace of a spec id — `core:spec/story-narrate` → `core`, `acme:spec/roll` → `acme`. @experimental */
|
|
178
207
|
export function specNamespace(specId) {
|
|
179
208
|
const i = specId.indexOf(':');
|
|
180
209
|
return i === -1 ? '' : specId.slice(0, i);
|
|
@@ -185,8 +214,9 @@ export const isCoreNamespace = (ns) => ns === 'core';
|
|
|
185
214
|
* The slash name an action is called by: the declared one, else derived from
|
|
186
215
|
* the key by the same rule a declared name must obey — `key` for core,
|
|
187
216
|
* `<plugin>.<key>` for a plugin. Always defined, so every composer action is
|
|
188
|
-
* reachable by `/`
|
|
217
|
+
* reachable by `/` whether or not its author named one.
|
|
189
218
|
* @experimental
|
|
219
|
+
* @ruling F40
|
|
190
220
|
*/
|
|
191
221
|
export function slashNameOf(action, specId) {
|
|
192
222
|
if (action.slash)
|
|
@@ -200,7 +230,7 @@ const EFFECTS_LINE_FIX = `move the action to a venue on the owner's side of the
|
|
|
200
230
|
`and keep audience.act to ${WORLD_ACTION_ACTORS.join(' and/or ')} — or declare effects: 'fiction' ` +
|
|
201
231
|
`if its result stays inside the story`;
|
|
202
232
|
/**
|
|
203
|
-
* The effects line at a declaration
|
|
233
|
+
* The effects line at a declaration: a `world` action
|
|
204
234
|
* is owner-only and never in a form, extra or widget venue. Judged one venue or one
|
|
205
235
|
* reference at a time, so the sentence names the venue or the reference
|
|
206
236
|
* that crossed.
|
|
@@ -211,6 +241,7 @@ const EFFECTS_LINE_FIX = `move the action to a venue on the owner's side of the
|
|
|
211
241
|
* import graph and must not import it. The verdict calls this for a
|
|
212
242
|
* `venue` or `actor` input; the door calls it directly and quotes it.
|
|
213
243
|
* @experimental
|
|
244
|
+
* @ruling R-15 *The line*, F41
|
|
214
245
|
*/
|
|
215
246
|
export function worldActionCrossing(input) {
|
|
216
247
|
if (input.effects !== 'world')
|
|
@@ -239,11 +270,12 @@ export function worldActionCrossing(input) {
|
|
|
239
270
|
};
|
|
240
271
|
}
|
|
241
272
|
/**
|
|
242
|
-
* Every fault in one `ActionDecl.collects
|
|
273
|
+
* Every fault in one `ActionDecl.collects`, as sentences: an
|
|
243
274
|
* unknown key, a missing label, an `optional` text with no `ifEmpty`, a
|
|
244
275
|
* `min` below 1 or a `max` below `min`. `where` is the field's address
|
|
245
276
|
* (`contributes.actions[nudge].collects`).
|
|
246
277
|
* @experimental
|
|
278
|
+
* @ruling lair pass R3
|
|
247
279
|
*/
|
|
248
280
|
export function collectsFindings(raw, where) {
|
|
249
281
|
const out = [];
|
|
@@ -253,7 +285,7 @@ export function collectsFindings(raw, where) {
|
|
|
253
285
|
out.push(`${at}: '${k}' is not something an action collects here — one of ${known.join(', ')}`);
|
|
254
286
|
};
|
|
255
287
|
if (!raw || typeof raw !== 'object' || Array.isArray(raw))
|
|
256
|
-
return [`${where} is { text?, recipients? } — what the press asks for before it fires`];
|
|
288
|
+
return [`${where} is { text?, recipients?, clockStep? } — what the press asks for before it fires`];
|
|
257
289
|
const c = raw;
|
|
258
290
|
unknownKeys(c, COLLECTS_KEYS, where);
|
|
259
291
|
if (c.text !== undefined) {
|
|
@@ -304,24 +336,43 @@ export function collectsFindings(raw, where) {
|
|
|
304
336
|
}
|
|
305
337
|
}
|
|
306
338
|
}
|
|
307
|
-
if (c.
|
|
308
|
-
|
|
339
|
+
if (c.clockStep !== undefined) {
|
|
340
|
+
const at = `${where}.clockStep`;
|
|
341
|
+
const k = c.clockStep;
|
|
342
|
+
if (!k || typeof k !== 'object' || Array.isArray(k))
|
|
343
|
+
out.push(`${at} is { label, default? } — the amount of story time the modal's stepper asks for`);
|
|
344
|
+
else {
|
|
345
|
+
unknownKeys(k, COLLECTED_CLOCK_STEP_KEYS, at);
|
|
346
|
+
out.push(...i18nFindings(k.label, `${at}.label`, { required: true }));
|
|
347
|
+
if (k.default !== undefined) {
|
|
348
|
+
const why = clockStepRefusal(k.default);
|
|
349
|
+
const by = k.default?.by;
|
|
350
|
+
if (why)
|
|
351
|
+
out.push(`${at}.default ${why}`);
|
|
352
|
+
else if (by < 0)
|
|
353
|
+
out.push(`${at}.default.by is above 0 — the stepper opens going forward; Back is the person's`);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
if (c.text === undefined && c.recipients === undefined && c.clockStep === undefined && !out.length)
|
|
358
|
+
out.push(`${where} collects nothing — declare text, recipients, clockStep, or leave collects out`);
|
|
309
359
|
return out;
|
|
310
360
|
}
|
|
311
361
|
/**
|
|
312
362
|
* Every fault in one action declaration, as sentences — the teaching-error
|
|
313
|
-
* pattern
|
|
363
|
+
* pattern. Empty when the declaration is sound.
|
|
314
364
|
*
|
|
315
365
|
* `specId` decides which slash grammar applies: a `core:` spec may not claim a
|
|
316
366
|
* dotted name and a plugin spec may not claim a bare one, or a name outside its
|
|
317
367
|
* own namespace. That rule is the whole collision guarantee.
|
|
318
368
|
* @experimental
|
|
369
|
+
* @ruling 15 §1.3
|
|
319
370
|
*/
|
|
320
371
|
export function actionFindings(raw, specId, at = 'contributes.actions') {
|
|
321
372
|
return actionFindingsByLaw(raw, specId, at).map((f) => f.message);
|
|
322
373
|
}
|
|
323
374
|
/** `actionFindings`, each sentence with the law it comes from (`ActionFinding`). @experimental */
|
|
324
|
-
export function actionFindingsByLaw(raw, specId, at = 'contributes.actions') {
|
|
375
|
+
export function actionFindingsByLaw(raw, specId, at = 'contributes.actions', opts = {}) {
|
|
325
376
|
const out = [];
|
|
326
377
|
/** A fault in the declaration's shape (R-15). */
|
|
327
378
|
const shape = (...messages) => {
|
|
@@ -339,7 +390,7 @@ export function actionFindingsByLaw(raw, specId, at = 'contributes.actions') {
|
|
|
339
390
|
const where = `${at}[${typeof a.key === 'string' ? a.key : '?'}]`;
|
|
340
391
|
if (typeof a.key !== 'string' || !KEY.test(a.key))
|
|
341
392
|
shape(`${where}: 'key' is required — a lowercase kebab token (${KEY.source})`);
|
|
342
|
-
if (typeof a.genre !== 'string' || !a.genre)
|
|
393
|
+
if (opts.unlocked ? a.genre !== undefined && (typeof a.genre !== 'string' || !a.genre) : typeof a.genre !== 'string' || !a.genre)
|
|
343
394
|
shape(`${where}: 'genre' is required — the genre id this action is offered to (24 §3), ` +
|
|
344
395
|
`such as core:genre/chat`);
|
|
345
396
|
const venues = Array.isArray(a.venue) ? a.venue : a.venue === undefined ? [] : [a.venue];
|
|
@@ -372,7 +423,7 @@ export function actionFindingsByLaw(raw, specId, at = 'contributes.actions') {
|
|
|
372
423
|
if (!isParticipantRef(r))
|
|
373
424
|
shape(`${where}: audience.${half} names '${String(r)}', which is not a participant ` +
|
|
374
425
|
`reference — one of ${PARTICIPANT_ROLES.join(', ')}, or user:<id>, ` +
|
|
375
|
-
`character:<id>, envoy:<slug>`);
|
|
426
|
+
`character:<id>, player-seat:<id>, envoy:<slug>`);
|
|
376
427
|
}
|
|
377
428
|
}
|
|
378
429
|
if (a.quick !== undefined && typeof a.quick !== 'boolean')
|
|
@@ -410,6 +461,18 @@ export function actionFindingsByLaw(raw, specId, at = 'contributes.actions') {
|
|
|
410
461
|
`({ en: 'Roll the dice and post the result.' })`);
|
|
411
462
|
else
|
|
412
463
|
shape(...i18nFindings(a.description, `${where}.description`));
|
|
464
|
+
if (a.confirm !== undefined) {
|
|
465
|
+
const c = a.confirm;
|
|
466
|
+
if (!c || typeof c !== 'object' || Array.isArray(c))
|
|
467
|
+
shape(`${where}.confirm is { question, description?, confirmLabel? } — the question asked before the action fires`);
|
|
468
|
+
else {
|
|
469
|
+
shape(...i18nFindings(c.question, `${where}.confirm.question`, { required: true }));
|
|
470
|
+
if (c.description !== undefined)
|
|
471
|
+
shape(...i18nFindings(c.description, `${where}.confirm.description`));
|
|
472
|
+
if (c.confirmLabel !== undefined)
|
|
473
|
+
shape(...i18nFindings(c.confirmLabel, `${where}.confirm.confirmLabel`));
|
|
474
|
+
}
|
|
475
|
+
}
|
|
413
476
|
if (a.iconAlt !== undefined) {
|
|
414
477
|
shape(...i18nFindings(a.iconAlt, `${where}.iconAlt`));
|
|
415
478
|
if (a.icon === undefined)
|
|
@@ -543,16 +606,16 @@ export function actionsOf(doc) {
|
|
|
543
606
|
export { ACTION_IDENTITY, ACTION_IDENTITY_MAX_LENGTH, CORE_ACTION_SPEC_ID, actionIdentity, isActionIdentity, parseActionIdentity, } from './identity.js';
|
|
544
607
|
/**
|
|
545
608
|
* A slash collision: two actions offered to one genre under one name. One
|
|
546
|
-
* slash name means one action (
|
|
609
|
+
* slash name means one action (ruled 2026-09-17): since the
|
|
547
610
|
* identity `<spec>#<key>` is the only routing key, two specs claiming one
|
|
548
611
|
* name are two actions a palette could not tell apart — a collision, not
|
|
549
|
-
* alternatives. (Until
|
|
612
|
+
* alternatives. (Until then two specs sharing a *function* under one name were
|
|
550
613
|
* alternatives a binding selected among; the function is gone, and so is the
|
|
551
614
|
* exemption.) A plugin's names are namespaced (`acme.roll`), so a plugin
|
|
552
615
|
* declaring the same `key` as a core verb is a different identity under a
|
|
553
616
|
* different name, and never shadows it.
|
|
554
617
|
*
|
|
555
|
-
* Core's verbs hold their names first
|
|
618
|
+
* Core's verbs hold their names first: every genre the list
|
|
556
619
|
* touches is seeded with `CORE_ACTIONS` under `core`, so a core spec claiming
|
|
557
620
|
* `/retry` collides with the verb rather than shadowing it in the palette. (A
|
|
558
621
|
* plugin spec cannot claim a bare name at all — that is the grammar's job.)
|
|
@@ -561,6 +624,7 @@ export { ACTION_IDENTITY, ACTION_IDENTITY_MAX_LENGTH, CORE_ACTION_SPEC_ID, actio
|
|
|
561
624
|
* document, `announce.build()` inside one package, and the host across every
|
|
562
625
|
* published spec of an install (a boot-time refusal).
|
|
563
626
|
* @experimental
|
|
627
|
+
* @ruling plans/31 V2, U5c review, S1
|
|
564
628
|
*/
|
|
565
629
|
export function slashCollisions(actions) {
|
|
566
630
|
const seen = new Map();
|
|
@@ -608,9 +672,12 @@ export function actionDocumentFindingsByLaw(doc) {
|
|
|
608
672
|
if (!c)
|
|
609
673
|
return [];
|
|
610
674
|
const out = [];
|
|
675
|
+
// 🚧 D3: a spec declared with `{ suits }` and no lock offers its actions
|
|
676
|
+
// where registrations include them — no genre on the declaration.
|
|
677
|
+
const unlocked = Array.isArray(doc.suits) && !doc.input;
|
|
611
678
|
for (const entry of c.actions ?? []) {
|
|
612
679
|
const a = normalizeAction(entry);
|
|
613
|
-
out.push(...actionFindingsByLaw(a, doc.id));
|
|
680
|
+
out.push(...actionFindingsByLaw(a, doc.id, 'contributes.actions', { unlocked }));
|
|
614
681
|
}
|
|
615
682
|
if (out.length)
|
|
616
683
|
return out;
|
|
@@ -618,12 +685,13 @@ export function actionDocumentFindingsByLaw(doc) {
|
|
|
618
685
|
}
|
|
619
686
|
/**
|
|
620
687
|
* The sentences beside a grey core verb, as locale maps — the `reason` of
|
|
621
|
-
* each verb's enabled-when below
|
|
688
|
+
* each verb's enabled-when below. One vocabulary: the host's chips,
|
|
622
689
|
* menus and palette read these through the verdict, and a refusal at the
|
|
623
690
|
* door says the same words. The two conditions that are NOT published
|
|
624
691
|
* values — an edit in progress, the audience — keep their sentences on the
|
|
625
692
|
* client (`messageVerbState.ts`).
|
|
626
693
|
* @internal
|
|
694
|
+
* @ruling U5e
|
|
627
695
|
*/
|
|
628
696
|
export const CORE_VERB_REASONS = Object.freeze({
|
|
629
697
|
generating: { en: 'wait for the reply to finish' },
|
|
@@ -645,8 +713,9 @@ const NEWEST = { on: 'item.isNewest', truthy: true, reason: CORE_VERB_REASONS.no
|
|
|
645
713
|
/**
|
|
646
714
|
* The row is a reply — retry, extend and swipe write a reply over the row,
|
|
647
715
|
* so on the author's own line (`role: 'user'`) they would overwrite what the
|
|
648
|
-
* author wrote with the narrator's prose (
|
|
716
|
+
* author wrote with the narrator's prose (in every persona-less genre). Keyed
|
|
649
717
|
* on the role, never on a persona: a persona-less author line has none.
|
|
718
|
+
* @ruling F1
|
|
650
719
|
*/
|
|
651
720
|
const REPLY = { on: 'item.role', equals: 'assistant', reason: CORE_VERB_REASONS.ownLine };
|
|
652
721
|
/** @internal */
|
package/dist/annexFields.d.ts
CHANGED
|
@@ -41,12 +41,13 @@
|
|
|
41
41
|
* declaration, so a field can only ever describe its own package's document.
|
|
42
42
|
* Core's own keys are core-catalog's `CORE_ANNEX_FIELDS`, under `core`.
|
|
43
43
|
*
|
|
44
|
-
* Never credentials or personal data
|
|
44
|
+
* Never credentials or personal data: a shape holding a `secret`
|
|
45
45
|
* anywhere is refused at the declaration.
|
|
46
46
|
*
|
|
47
47
|
* @experimental 🚧 provisional — the vocabulary (annex field, annex
|
|
48
48
|
* declaration, settable, the `<owner>:annex#<key>` identity) is new with this
|
|
49
49
|
* module.
|
|
50
|
+
* @ruling R61
|
|
50
51
|
*/
|
|
51
52
|
import { type FieldDecl, type SettingsSchema } from './settings.js';
|
|
52
53
|
import { type I18n } from './i18n.js';
|
|
@@ -69,9 +70,10 @@ export interface AnnexFieldDecl {
|
|
|
69
70
|
/** What the value must be — the settings vocabulary's `FieldDecl`, checked by `checkValues`. */
|
|
70
71
|
readonly shape: FieldDecl;
|
|
71
72
|
/**
|
|
72
|
-
* Who may SEE the stored value besides pipelines
|
|
73
|
+
* Who may SEE the stored value besides pipelines — a data
|
|
73
74
|
* audience (participant references). `[]` (the default) is
|
|
74
|
-
* pipelines only
|
|
75
|
+
* pipelines only: a widget cannot read back a value nobody may see.
|
|
76
|
+
* @ruling R57, R59
|
|
75
77
|
*/
|
|
76
78
|
readonly see: readonly string[];
|
|
77
79
|
/**
|
|
@@ -110,7 +112,10 @@ export declare function annexFieldFindings(raw: unknown, at?: string): string[];
|
|
|
110
112
|
* them while writing, never at a press.
|
|
111
113
|
* @experimental
|
|
112
114
|
*/
|
|
113
|
-
export declare function annexField(d:
|
|
115
|
+
export declare function annexField<const D extends AnnexFieldInput>(d: D): AnnexFieldDecl & {
|
|
116
|
+
readonly key: D['key'];
|
|
117
|
+
readonly __declared?: D;
|
|
118
|
+
};
|
|
114
119
|
/** Faults in a list of fields: each one's, and a key declared twice. @experimental */
|
|
115
120
|
export declare function annexFieldListFindings(raw: unknown, at?: string): string[];
|
|
116
121
|
/**
|
|
@@ -165,7 +170,9 @@ export declare const isSettableAnnexField: (f: Pick<AnnexFieldDecl, 'act'>) => b
|
|
|
165
170
|
* An owner's annex schema — key → declared shape — for a session of `genre`
|
|
166
171
|
* (or every genre, with none). Undefined when the owner is unknown here; `{}`
|
|
167
172
|
* when it declares nothing. What a typed template reads `annex.<owner>.<key>`
|
|
168
|
-
* against
|
|
173
|
+
* against.
|
|
174
|
+
* @experimental
|
|
175
|
+
* @ruling typed-templates §1b, P6
|
|
169
176
|
*/
|
|
170
177
|
export declare function annexSchemaOf(owner: string, genre?: string): SettingsSchema | undefined;
|
|
171
178
|
/**
|
package/dist/annexFields.js
CHANGED
|
@@ -41,12 +41,13 @@
|
|
|
41
41
|
* declaration, so a field can only ever describe its own package's document.
|
|
42
42
|
* Core's own keys are core-catalog's `CORE_ANNEX_FIELDS`, under `core`.
|
|
43
43
|
*
|
|
44
|
-
* Never credentials or personal data
|
|
44
|
+
* Never credentials or personal data: a shape holding a `secret`
|
|
45
45
|
* anywhere is refused at the declaration.
|
|
46
46
|
*
|
|
47
47
|
* @experimental 🚧 provisional — the vocabulary (annex field, annex
|
|
48
48
|
* declaration, settable, the `<owner>:annex#<key>` identity) is new with this
|
|
49
49
|
* module.
|
|
50
|
+
* @ruling R61
|
|
50
51
|
*/
|
|
51
52
|
import { dataAudienceFindings, isParticipantRef } from './participants.js';
|
|
52
53
|
import { checkSchema, checkValues } from './settings.js';
|
|
@@ -132,6 +133,7 @@ export function annexField(d) {
|
|
|
132
133
|
const problems = annexFieldFindings(d, 'annexField');
|
|
133
134
|
if (problems.length)
|
|
134
135
|
throw new Error(problems.join('\n'));
|
|
136
|
+
// `__declared` is a phantom (never set): the field as written, for `sessionOf`'s annex typing.
|
|
135
137
|
return Object.freeze({
|
|
136
138
|
__decl: 'annex-field',
|
|
137
139
|
key: d.key,
|
|
@@ -257,7 +259,9 @@ export const isSettableAnnexField = (f) => !!f.act?.length;
|
|
|
257
259
|
* An owner's annex schema — key → declared shape — for a session of `genre`
|
|
258
260
|
* (or every genre, with none). Undefined when the owner is unknown here; `{}`
|
|
259
261
|
* when it declares nothing. What a typed template reads `annex.<owner>.<key>`
|
|
260
|
-
* against
|
|
262
|
+
* against.
|
|
263
|
+
* @experimental
|
|
264
|
+
* @ruling typed-templates §1b, P6
|
|
261
265
|
*/
|
|
262
266
|
export function annexSchemaOf(owner, genre) {
|
|
263
267
|
const fields = declarations.get(owner);
|