@serene-pub/sdk 0.6.0-pr-2 → 0.6.0-pr-5
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 +24 -20
- package/dist/actions.d.ts +150 -68
- package/dist/actions.js +90 -36
- package/dist/annexFields.d.ts +8 -4
- package/dist/annexFields.js +5 -2
- package/dist/announce.d.ts +78 -28
- package/dist/announce.js +14 -5
- package/dist/attributes.d.ts +9 -6
- package/dist/attributes.js +9 -5
- package/dist/bands.d.ts +41 -6
- package/dist/bands.js +83 -33
- package/dist/builder.d.ts +161 -58
- package/dist/builder.js +128 -22
- package/dist/candidates.d.ts +5 -3
- package/dist/candidates.js +3 -2
- 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/config.d.ts +28 -14
- package/dist/config.js +20 -10
- package/dist/connections.d.ts +9 -4
- package/dist/connections.js +7 -4
- package/dist/declarations.d.ts +46 -17
- package/dist/declarations.js +46 -15
- package/dist/descriptors.d.ts +242 -97
- package/dist/descriptors.js +145 -41
- package/dist/dev.d.ts +6 -5
- package/dist/dev.js +6 -5
- package/dist/document.d.ts +74 -25
- package/dist/document.js +32 -11
- 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/eventMapLaws.d.ts +19 -8
- package/dist/eventMapLaws.js +9 -6
- package/dist/events.d.ts +101 -39
- package/dist/events.js +106 -33
- package/dist/executor.d.ts +122 -41
- package/dist/executor.js +195 -96
- 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/foldedSections.d.ts +4 -2
- package/dist/foldedSections.js +2 -1
- package/dist/genres.d.ts +123 -41
- package/dist/genres.js +127 -22
- 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 +3 -2
- package/dist/hookGrants.js +6 -4
- package/dist/hooks.d.ts +21 -16
- package/dist/hooks.js +12 -10
- package/dist/hostElements.d.ts +41 -17
- package/dist/hostElements.js +49 -17
- 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 +5 -0
- package/dist/index.js +15 -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 +26 -4
- package/dist/media.js +2 -1
- package/dist/messageBlocks.d.ts +44 -32
- package/dist/messageBlocks.js +23 -18
- 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 +22 -15
- package/dist/participants.js +14 -12
- package/dist/personGate.d.ts +2 -1
- package/dist/personGate.js +2 -1
- package/dist/pluginHarness.d.ts +8 -3
- package/dist/pluginHarness.js +4 -2
- package/dist/pluginPermissions.d.ts +2 -1
- package/dist/pluginPermissions.js +12 -1
- 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 +8 -3
- package/dist/preview.js +2 -1
- 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 +65 -29
- package/dist/receipt.js +9 -4
- package/dist/receiverRules.js +3 -2
- package/dist/refs.d.ts +34 -9
- package/dist/refs.js +33 -13
- package/dist/registry.d.ts +42 -23
- package/dist/registry.js +7 -5
- package/dist/review.d.ts +16 -5
- package/dist/review.js +11 -4
- package/dist/sampling.d.ts +54 -0
- package/dist/sampling.js +95 -3
- package/dist/sceneSettings.d.ts +312 -0
- package/dist/sceneSettings.js +425 -0
- package/dist/scope.d.ts +6 -4
- package/dist/scope.js +4 -3
- package/dist/scripts.d.ts +81 -14
- package/dist/scripts.js +90 -11
- package/dist/sessionDossier.d.ts +521 -0
- package/dist/sessionDossier.js +33 -0
- package/dist/sessionLayout.d.ts +303 -19
- package/dist/sessionLayout.js +354 -40
- package/dist/sessionSettings.d.ts +8 -5
- package/dist/settings.d.ts +45 -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 +103 -41
- package/dist/shapes.js +105 -40
- package/dist/sheets.d.ts +4 -2
- package/dist/sheets.js +6 -3
- package/dist/statShapes.d.ts +2 -1
- package/dist/statShapes.js +2 -1
- package/dist/status.d.ts +13 -9
- package/dist/status.js +8 -6
- package/dist/storage.d.ts +2 -1
- package/dist/storage.js +2 -1
- 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 +21 -11
- package/dist/templateScopeAt.js +21 -11
- package/dist/testing.d.ts +11 -4
- package/dist/testing.js +13 -5
- 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 +17 -11
- package/dist/turnOrder.js +9 -5
- package/dist/validate.d.ts +11 -8
- package/dist/validate.js +81 -10
- 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/widgetDecls.d.ts +8 -4
- package/dist/widgetDecls.js +4 -2
- package/dist/widgets.d.ts +987 -94
- package/dist/widgets.js +93 -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 +13 -0
- package/package.json +1 -1
package/dist/extension.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `defineExtension` — the one entry point a plugin author starts from
|
|
2
|
+
* `defineExtension` — the one entry point a plugin author starts from.
|
|
3
3
|
*
|
|
4
4
|
* Before this existed, the SDK could express a pipeline and nothing else. An author could
|
|
5
5
|
* build a spec but had nowhere to say *"this is my plugin, here are its lifecycle
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* difference between authoring a pipeline and writing a plugin, and it is most of what
|
|
9
9
|
* "download the SDK" has to mean.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* It says the rest of it too — the **genres**, **surfaces**, **presets**,
|
|
12
12
|
* **configs**, **prompts** and declared **permissions** that were only sayable through
|
|
13
13
|
* `announce()`. One declaration, one build: `serene-pub build` emits a single manifest
|
|
14
14
|
* carrying both halves, and a package no longer has to choose which half of itself to
|
|
@@ -17,9 +17,10 @@
|
|
|
17
17
|
* announcement document a host syncs.
|
|
18
18
|
*
|
|
19
19
|
* Everything here is a **literal declaration**, because the compiler extracts it from the
|
|
20
|
-
* source without executing it
|
|
20
|
+
* source without executing it. A registration assembled at runtime is
|
|
21
21
|
* a lint error rather than a silent omission — the manifest has to be a complete statement
|
|
22
22
|
* of what a plugin can do, or the permission model is a guess.
|
|
23
|
+
* @ruling 03, 09, D-1, F6, 03 §3, 13/§30
|
|
23
24
|
*/
|
|
24
25
|
import type { WidgetDecl } from './layout.js';
|
|
25
26
|
import type { BuiltSpec } from './builder.js';
|
|
@@ -28,9 +29,11 @@ import type { PluginSettings, SettingsSchema } from './settings.js';
|
|
|
28
29
|
import type { EventListener, LifecycleCallback, LifecycleMoment } from './hooks.js';
|
|
29
30
|
import type { Result } from './executor.js';
|
|
30
31
|
import { type TemplateSeed } from './templateIds.js';
|
|
32
|
+
import { type LoadoutDecl } from './loadouts.js';
|
|
31
33
|
import { type I18n } from './i18n.js';
|
|
32
34
|
import type { SpecDocument } from './document.js';
|
|
33
35
|
import { type SessionEventDecl } from './events.js';
|
|
36
|
+
import { type ShapeDef } from './shapes.js';
|
|
34
37
|
import { type EventDeclarationInput, type StoredEventDeclaration, type ConfigDecl, type ConfigInput, type PresetDecl, type HookDeclaration, type PresetInput, type PromptDecl } from './announce.js';
|
|
35
38
|
import type { GenreDecl } from './genres.js';
|
|
36
39
|
import { type AnnexFieldDecl } from './annexFields.js';
|
|
@@ -38,13 +41,14 @@ import type { SurfacesDecl } from './surfaces.js';
|
|
|
38
41
|
import { type VariableDecl } from './variables.js';
|
|
39
42
|
import { type StoredSwapContribution, type SwapContribution } from './declarations.js';
|
|
40
43
|
/**
|
|
41
|
-
* The **handler** implementing a node definition
|
|
42
|
-
*
|
|
44
|
+
* The **handler** implementing a node definition. Data in, expected shape out; the executor is the only caller.
|
|
45
|
+
* **Private** (the default) means only this extension's pipelines may use the
|
|
43
46
|
* node — not another package's, not one a person authors; **public** means any may, which
|
|
44
47
|
* is how peer composition happens — as a node on the spine, never a peer call mid-run
|
|
45
|
-
*
|
|
48
|
+
* The node's visibility is this, and only this: the definition does not
|
|
46
49
|
* say `public` itself. Enforced at install, at publish and at the run.
|
|
47
50
|
* @experimental
|
|
51
|
+
* @ruling R-1, 01 §9, F10, R62
|
|
48
52
|
*/
|
|
49
53
|
export interface HandlerDecl<D extends Descriptor<any, any, any> = Descriptor> {
|
|
50
54
|
readonly __decl: 'handler';
|
|
@@ -57,13 +61,14 @@ export interface HandlerDecl<D extends Descriptor<any, any, any> = Descriptor> {
|
|
|
57
61
|
*
|
|
58
62
|
* An extension hook running inside Serene Pub's process cannot be stopped —
|
|
59
63
|
* a runaway loop or a blocking call takes the whole application with it, and
|
|
60
|
-
*
|
|
61
|
-
*
|
|
64
|
+
* the promise that every hook invocation is bounded becomes unenforceable.
|
|
65
|
+
* It also shares the host's memory, so a crash is the host's crash
|
|
62
66
|
* and a leak is the host's leak.
|
|
63
67
|
*
|
|
64
68
|
* Kept as a field rather than dropped because the *value* still travels into
|
|
65
69
|
* the registry row, where install-time validation reads it without executing
|
|
66
|
-
* the plugin
|
|
70
|
+
* the plugin. A manifest claiming anything else is refused there.
|
|
71
|
+
* @ruling F36, 13 §7h, F6
|
|
67
72
|
*/
|
|
68
73
|
runtime?: 'process';
|
|
69
74
|
}
|
|
@@ -91,7 +96,7 @@ export declare const lifecycleCallback: (moment: LifecycleMoment, handler: Lifec
|
|
|
91
96
|
*
|
|
92
97
|
* There is deliberately nothing here for ordering or for using your return
|
|
93
98
|
* value, and both absences are the same absence. Delivery is fire-and-forget
|
|
94
|
-
*
|
|
99
|
+
* your return is dropped, and dispatch order is **declaration
|
|
95
100
|
* order** — the order you wrote your own subscriptions in, tie-broken across
|
|
96
101
|
* extensions by plugin id. A `priority` field would manufacture an ordering
|
|
97
102
|
* guarantee core does not give, and be a collision of its own the moment two
|
|
@@ -99,6 +104,7 @@ export declare const lifecycleCallback: (moment: LifecycleMoment, handler: Lifec
|
|
|
99
104
|
* extension rewrite what the next one is told. Neither is a thing you can ask
|
|
100
105
|
* for, which is why neither is a thing you have to defend against.
|
|
101
106
|
* @experimental
|
|
107
|
+
* @ruling 01 §9c, 11 §3
|
|
102
108
|
*/
|
|
103
109
|
export interface EventListenerDecl {
|
|
104
110
|
readonly __decl: 'event-listener';
|
|
@@ -118,7 +124,7 @@ export declare const eventListener: (event: string | SessionEventDecl, handler:
|
|
|
118
124
|
timeoutMs?: number;
|
|
119
125
|
}) => EventListenerDecl;
|
|
120
126
|
/**
|
|
121
|
-
* The one unit of custom UI
|
|
127
|
+
* The one unit of custom UI: a module the page's UI worker runs,
|
|
122
128
|
* placing elements from the host vocabulary (`SP_HOST_ELEMENTS`), which the
|
|
123
129
|
* host mirrors into the box it is mounted in. A {@link WidgetDecl} names one
|
|
124
130
|
* by `component`; a page mount point will name one the same way.
|
|
@@ -127,12 +133,16 @@ export declare const eventListener: (event: string | SessionEventDecl, handler:
|
|
|
127
133
|
* (core, or one plugin) per session page. Its only path to data is the
|
|
128
134
|
* component client's port; it imports only `COMPONENT_IMPORTS`.
|
|
129
135
|
* @experimental
|
|
136
|
+
* @ruling §3.5, R25
|
|
130
137
|
*/
|
|
131
138
|
export interface ComponentDecl {
|
|
132
139
|
readonly __decl: 'component';
|
|
133
140
|
/** Unique within the package — a widget's `component` names it. */
|
|
134
141
|
slug: string;
|
|
135
|
-
/**
|
|
142
|
+
/**
|
|
143
|
+
* What an admin sees it called — a string or a locale map.
|
|
144
|
+
* @ruling R-20
|
|
145
|
+
*/
|
|
136
146
|
label: I18n;
|
|
137
147
|
/**
|
|
138
148
|
* The component's source — `.svelte`, `.ts` or `.js` — relative to the
|
|
@@ -141,19 +151,21 @@ export interface ComponentDecl {
|
|
|
141
151
|
*/
|
|
142
152
|
entry: string;
|
|
143
153
|
/**
|
|
144
|
-
* Which adapter renders it
|
|
154
|
+
* Which adapter renders it: Svelte, compiled, and vanilla —
|
|
145
155
|
* plain DOM, which needs no compiler and proves the seam is not
|
|
146
156
|
* Svelte-shaped. Preact, and React on `preact/compat`, come after 1.0.
|
|
157
|
+
* @ruling R35, R37
|
|
147
158
|
*/
|
|
148
159
|
framework: ComponentFramework;
|
|
149
160
|
/** Per-instance settings, delivered as a widget's are (`settings.v1`). */
|
|
150
161
|
settings?: SettingsSchema;
|
|
151
162
|
/**
|
|
152
|
-
* A clone records its upstream, so an update can be offered
|
|
163
|
+
* A clone records its upstream, so an update can be offered:
|
|
153
164
|
* the upstream component's slug, its package's version, and — experimental
|
|
154
|
-
*
|
|
165
|
+
* — the `sourceHash` of the source it was cloned from (core's
|
|
155
166
|
* `dist/components/<slug>.source.json` carries it), so "the upstream
|
|
156
167
|
* changed since you cloned" is a hash comparison, not a version guess.
|
|
168
|
+
* @ruling R-fork, C6
|
|
157
169
|
*/
|
|
158
170
|
basedOn?: {
|
|
159
171
|
component: string;
|
|
@@ -161,7 +173,11 @@ export interface ComponentDecl {
|
|
|
161
173
|
sourceHash?: string;
|
|
162
174
|
};
|
|
163
175
|
}
|
|
164
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* The component frameworks SDK 1.0 ships. The list grows; it never shrinks.
|
|
178
|
+
* @experimental
|
|
179
|
+
* @ruling R35
|
|
180
|
+
*/
|
|
165
181
|
export declare const COMPONENT_FRAMEWORKS: readonly ['svelte', 'vanilla'];
|
|
166
182
|
/** @experimental */
|
|
167
183
|
export type ComponentFramework = (typeof COMPONENT_FRAMEWORKS)[number];
|
|
@@ -223,9 +239,15 @@ export interface TemplateEngineHookInput {
|
|
|
223
239
|
export type TemplateEngineHook = (input: TemplateEngineHookInput) => string | Promise<string>;
|
|
224
240
|
/** @experimental */
|
|
225
241
|
export interface ExtensionDecl {
|
|
226
|
-
/**
|
|
242
|
+
/**
|
|
243
|
+
* `vendor.plugin` — the owner segment of every id this plugin registers.
|
|
244
|
+
* @ruling F2
|
|
245
|
+
*/
|
|
227
246
|
slug: string;
|
|
228
|
-
/**
|
|
247
|
+
/**
|
|
248
|
+
* What the plugin is called where it is listed — a string or a locale map with `en`.
|
|
249
|
+
* @ruling R-20
|
|
250
|
+
*/
|
|
229
251
|
name: I18n;
|
|
230
252
|
version: string;
|
|
231
253
|
description?: I18n;
|
|
@@ -234,9 +256,12 @@ export interface ExtensionDecl {
|
|
|
234
256
|
/** Where its source lives, when it is public. */
|
|
235
257
|
repo?: string;
|
|
236
258
|
/**
|
|
237
|
-
* Supported SP range, separate from the SDK range
|
|
238
|
-
* (`{ 'serene-pub': '>=0.
|
|
239
|
-
*
|
|
259
|
+
* Supported SP range, separate from the SDK range — npm-style
|
|
260
|
+
* (`{ 'serene-pub': '>=0.6.0-0 <0.8' }`). A prerelease instance is inside
|
|
261
|
+
* a range only when the range names a prerelease of the same version, so a
|
|
262
|
+
* floor meant to admit `0.6.0-pr-4` ends in `-0`. Version ranges and nothing else: a
|
|
263
|
+
* template engine this plugin ships is `templateEngines`.
|
|
264
|
+
* @ruling 09, R1
|
|
240
265
|
*/
|
|
241
266
|
engines?: {
|
|
242
267
|
'serene-pub'?: string;
|
|
@@ -262,8 +287,8 @@ export interface ExtensionDecl {
|
|
|
262
287
|
/**
|
|
263
288
|
* The hooks this package defines — points where other authored code may
|
|
264
289
|
* run, by key (namespaced `<slug>:hook/<key>` in the announcement). Core
|
|
265
|
-
* declares its own here
|
|
266
|
-
*
|
|
290
|
+
* declares its own here; a plugin's travel in its manifest's
|
|
291
|
+
* `declaredHooks`, under the same fully-qualified ids.
|
|
267
292
|
*/
|
|
268
293
|
hooks?: Record<string, HookDeclaration>;
|
|
269
294
|
/**
|
|
@@ -276,11 +301,12 @@ export interface ExtensionDecl {
|
|
|
276
301
|
events?: EventDeclarationInput[];
|
|
277
302
|
components?: ComponentDecl[];
|
|
278
303
|
/**
|
|
279
|
-
* The widgets this package offers
|
|
304
|
+
* The widgets this package offers — `widget({ … })` values, each
|
|
280
305
|
* naming one of `components` and optionally scoped to genres. A genre
|
|
281
306
|
* withholds any of them by value (`omitWidgets`); a session offers every
|
|
282
307
|
* widget scoped to its genre or to all. The instance knows each under this
|
|
283
308
|
* package's namespace (`<slug>:<id>`).
|
|
309
|
+
* @ruling R71
|
|
284
310
|
*/
|
|
285
311
|
widgets?: WidgetDecl[];
|
|
286
312
|
/**
|
|
@@ -314,13 +340,16 @@ export interface ExtensionDecl {
|
|
|
314
340
|
* @experimental
|
|
315
341
|
*/
|
|
316
342
|
variables?: VariableDecl[];
|
|
317
|
-
/**
|
|
343
|
+
/**
|
|
344
|
+
* Pipelines shipped with the plugin — built specs, or documents already compiled. Compiled at build time.
|
|
345
|
+
* @ruling F6
|
|
346
|
+
*/
|
|
318
347
|
pipelines?: Array<BuiltSpec | SpecDocument>;
|
|
319
348
|
/**
|
|
320
|
-
* Genres this plugin declares
|
|
349
|
+
* Genres this plugin declares — a genre is a package-level
|
|
321
350
|
* declaration like a pipeline, so it belongs where the package is declared.
|
|
322
351
|
*
|
|
323
|
-
*
|
|
352
|
+
* Previously a genre could only be declared through `announce()`, and a
|
|
324
353
|
* package with both a genre and its own node definitions had to export two
|
|
325
354
|
* declarations and build only one of them: the artifact carried the genre
|
|
326
355
|
* and not the handlers, or the handlers and not the genre. Every genre
|
|
@@ -332,10 +361,11 @@ export interface ExtensionDecl {
|
|
|
332
361
|
* which is a reference rather than a claim of ownership. And a genre needs
|
|
333
362
|
* exactly one create pipeline in `pipelines`, so the two fields are checked
|
|
334
363
|
* against each other rather than separately.
|
|
364
|
+
* @ruling 24 §3, D-1
|
|
335
365
|
*/
|
|
336
366
|
genres?: GenreDecl[];
|
|
337
367
|
/**
|
|
338
|
-
* Frame surfaces this plugin ships
|
|
368
|
+
* Frame surfaces this plugin ships: documents an instance
|
|
339
369
|
* mounts in opaque-origin iframes. Declared, never discovered — an instance
|
|
340
370
|
* renders what the manifest says and `serene-pub ui` renders the same list,
|
|
341
371
|
* so a surface a modder previewed is a surface an instance will offer.
|
|
@@ -343,16 +373,23 @@ export interface ExtensionDecl {
|
|
|
343
373
|
* Distinct from `components`, and the difference is a trust decision: a
|
|
344
374
|
* frame gets a document and a MessageChannel, a component gets the host's
|
|
345
375
|
* own DOM.
|
|
376
|
+
* @ruling 20 §12, 21 §7
|
|
346
377
|
*/
|
|
347
378
|
surfaces?: SurfacesDecl;
|
|
348
|
-
/**
|
|
379
|
+
/**
|
|
380
|
+
* Named configurations over this plugin's specs — typed deltas, made by `config()`.
|
|
381
|
+
* @ruling 24 §7
|
|
382
|
+
*/
|
|
349
383
|
configs?: ConfigInput<any>[];
|
|
350
384
|
/**
|
|
351
385
|
* Presets: which pipelines a session of a genre runs. Each binds spec
|
|
352
386
|
* values on the events their inlet locks answer.
|
|
353
387
|
*/
|
|
354
388
|
presets?: PresetInput[];
|
|
355
|
-
/**
|
|
389
|
+
/**
|
|
390
|
+
* Authored prose for a node's prompts slot, shipped as rows.
|
|
391
|
+
* @ruling 24 T6b
|
|
392
|
+
*/
|
|
356
393
|
prompts?: PromptDecl[];
|
|
357
394
|
/**
|
|
358
395
|
* This plugin's definitions, offered on another package's swappable nodes —
|
|
@@ -362,7 +399,7 @@ export interface ExtensionDecl {
|
|
|
362
399
|
*/
|
|
363
400
|
swaps?: SwapContribution[];
|
|
364
401
|
/**
|
|
365
|
-
* What this plugin asks the sandbox for
|
|
402
|
+
* What this plugin asks the sandbox for: a storage quota, a network
|
|
366
403
|
* allowlist. **Declared, because nothing else can compile them** — the
|
|
367
404
|
* packager derives the rest of the permission list from what the code
|
|
368
405
|
* actually calls, but a quota is a number and a host is a name, and neither
|
|
@@ -377,11 +414,12 @@ export interface ExtensionDecl {
|
|
|
377
414
|
* Folded in here so a package declares its permissions in the one place it
|
|
378
415
|
* declares everything else. The separate `ManifestInput` the CLI's sandbox
|
|
379
416
|
* compiler accepts still works for a package that has not moved.
|
|
417
|
+
* @ruling 12 §6
|
|
380
418
|
*/
|
|
381
419
|
permissions?: DeclaredPermissions;
|
|
382
420
|
/**
|
|
383
421
|
* Template rows shipped with the plugin — prompts, context templates and
|
|
384
|
-
* variable layouts, each under an owner-namespaced **template id
|
|
422
|
+
* variable layouts, each under an owner-namespaced **template id**.
|
|
385
423
|
*
|
|
386
424
|
* Beside `pipelines` because that is the gap: a plugin could ship a spec
|
|
387
425
|
* whose configuration points at a prompt, and had no way to ship the prompt.
|
|
@@ -393,11 +431,24 @@ export interface ExtensionDecl {
|
|
|
393
431
|
*
|
|
394
432
|
* A new major of a template is a NEW entry under a new id; the old id keeps
|
|
395
433
|
* resolving to the row every spec pinned to it was written against.
|
|
434
|
+
* @ruling R19
|
|
396
435
|
*/
|
|
397
436
|
templates?: readonly TemplateSeed[];
|
|
437
|
+
/**
|
|
438
|
+
* **Loadouts** shipped with the plugin (I12) — `<slug>:loadout/<name>@<major>`
|
|
439
|
+
* declarations, each naming a sampling preset by seed key (a core one, or
|
|
440
|
+
* one of the plugin's own). Never a pair: they arrive **unfilled** and
|
|
441
|
+
* **unmerged**, so installing a plugin never changes which model runs —
|
|
442
|
+
* an unfilled loadout falls back to its transform's default until an admin
|
|
443
|
+
* fills or merges it. A spec of the plugin's names one on an oracle's
|
|
444
|
+
* `loadout` slot (`p.loadout(node, slot.loadout(id))`), and may name core's.
|
|
445
|
+
* @ruling DESIGN-image-generation §13
|
|
446
|
+
*/
|
|
447
|
+
loadouts?: readonly LoadoutDecl[];
|
|
398
448
|
/**
|
|
399
449
|
* Dependencies on **public handlers** other plugins expose. Definition-level pins
|
|
400
|
-
* only; runtime peer invocation is banned
|
|
450
|
+
* only; runtime peer invocation is banned.
|
|
451
|
+
* @ruling F10, 01 §9b
|
|
401
452
|
*/
|
|
402
453
|
peerTypes?: string[];
|
|
403
454
|
}
|
|
@@ -412,6 +463,14 @@ export interface Extension extends Omit<ExtensionDecl, 'configs' | 'presets' | '
|
|
|
412
463
|
presets?: PresetDecl[];
|
|
413
464
|
swaps?: StoredSwapContribution[];
|
|
414
465
|
events?: StoredEventDeclaration[];
|
|
466
|
+
/**
|
|
467
|
+
* The shapes registered under this package's slug when it was declared
|
|
468
|
+
* (`defineShape`, `<slug>:shape/…`) — what the packager writes into the
|
|
469
|
+
* manifest's `shapes`. Captured here because the package's module may
|
|
470
|
+
* resolve its own copy of the SDK, whose registry the packager cannot
|
|
471
|
+
* read. Absent when there are none.
|
|
472
|
+
*/
|
|
473
|
+
shapes?: ShapeDef[];
|
|
415
474
|
}
|
|
416
475
|
/** @experimental */
|
|
417
476
|
export declare class ExtensionError extends Error {
|
|
@@ -432,13 +491,18 @@ export declare const eventListenersOf: (e: Extension) => EventListenerDecl[];
|
|
|
432
491
|
* Every variable a package declares, as its manifest carries them: the
|
|
433
492
|
* `variables` list first, then each variable a band of its handlers'
|
|
434
493
|
* definitions holds (`Descriptor.bands`) — a band is a value holding its
|
|
435
|
-
* variable, so the author never lists it twice
|
|
494
|
+
* variable, so the author never lists it twice — then each variable **of the
|
|
495
|
+
* package's own namespace** named by id in a `renders`: a handler
|
|
496
|
+
* definition's `variables` slot, or a node of one of its pipelines
|
|
497
|
+
* (2026-10-13). An id is resolved from the registry this package was built
|
|
498
|
+
* in; an instance refuses a `renders` naming a variable it was never handed,
|
|
499
|
+
* so a variable named only there must travel too. One entry per distinct
|
|
436
500
|
* declaration: the same variable reached twice (two definitions declaring
|
|
437
501
|
* one band) is one entry; one id with two different contents stays two, and
|
|
438
502
|
* `pluginVariableFindings` refuses it.
|
|
439
503
|
* @experimental
|
|
440
504
|
*/
|
|
441
|
-
export declare function variablesOf(e: Pick<ExtensionDecl, 'variables' | 'handlers'>): VariableDecl[];
|
|
505
|
+
export declare function variablesOf(e: Pick<ExtensionDecl, 'variables' | 'handlers'> & Partial<Pick<ExtensionDecl, 'slug' | 'pipelines'>>): VariableDecl[];
|
|
442
506
|
/**
|
|
443
507
|
* The bindings map the executor wants, built from the declaration. So an author's tests
|
|
444
508
|
* run their real handlers rather than a hand-maintained parallel map that drifts.
|
package/dist/extension.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `defineExtension` — the one entry point a plugin author starts from
|
|
2
|
+
* `defineExtension` — the one entry point a plugin author starts from.
|
|
3
3
|
*
|
|
4
4
|
* Before this existed, the SDK could express a pipeline and nothing else. An author could
|
|
5
5
|
* build a spec but had nowhere to say *"this is my plugin, here are its lifecycle
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* difference between authoring a pipeline and writing a plugin, and it is most of what
|
|
9
9
|
* "download the SDK" has to mean.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* It says the rest of it too — the **genres**, **surfaces**, **presets**,
|
|
12
12
|
* **configs**, **prompts** and declared **permissions** that were only sayable through
|
|
13
13
|
* `announce()`. One declaration, one build: `serene-pub build` emits a single manifest
|
|
14
14
|
* carrying both halves, and a package no longer has to choose which half of itself to
|
|
@@ -17,18 +17,21 @@
|
|
|
17
17
|
* announcement document a host syncs.
|
|
18
18
|
*
|
|
19
19
|
* Everything here is a **literal declaration**, because the compiler extracts it from the
|
|
20
|
-
* source without executing it
|
|
20
|
+
* source without executing it. A registration assembled at runtime is
|
|
21
21
|
* a lint error rather than a silent omission — the manifest has to be a complete statement
|
|
22
22
|
* of what a plugin can do, or the permission model is a guess.
|
|
23
|
+
* @ruling 03, 09, D-1, F6, 03 §3, 13/§30
|
|
23
24
|
*/
|
|
24
25
|
import { ownWidgets } from './widgetDecls.js';
|
|
25
26
|
import { pluginRuleRef } from './pluginRuleRef.js';
|
|
26
27
|
import { templateSeedProblems } from './templateIds.js';
|
|
28
|
+
import { loadoutDeclProblems } from './loadouts.js';
|
|
27
29
|
import { i18nFindings } from './i18n.js';
|
|
28
30
|
import { isSessionEventDecl } from './events.js';
|
|
31
|
+
import { listShapes } from './shapes.js';
|
|
29
32
|
import { preset, storedConfig, storedEventDeclaration, } from './announce.js';
|
|
30
33
|
import { annexFieldListFindings } from './annexFields.js';
|
|
31
|
-
import { pluginVariableFindings } from './variables.js';
|
|
34
|
+
import { getVariable, pluginVariableFindings } from './variables.js';
|
|
32
35
|
import { declarationFindings, storedSwap, swapInputFindings, } from './declarations.js';
|
|
33
36
|
/** @public */
|
|
34
37
|
export function handler(definition, fn, opts = {}) {
|
|
@@ -53,7 +56,11 @@ export const eventListener = (event, handler, opts = {}) => ({
|
|
|
53
56
|
handler,
|
|
54
57
|
...opts,
|
|
55
58
|
});
|
|
56
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* The component frameworks SDK 1.0 ships. The list grows; it never shrinks.
|
|
61
|
+
* @experimental
|
|
62
|
+
* @ruling R35
|
|
63
|
+
*/
|
|
57
64
|
export const COMPONENT_FRAMEWORKS = ['svelte', 'vanilla'];
|
|
58
65
|
/** @public */
|
|
59
66
|
export const component = (d) => ({
|
|
@@ -118,7 +125,7 @@ export function defineExtension(d) {
|
|
|
118
125
|
`(e.g. 'chariot.dice-tray'). It is the namespace every id you register must sit under.`);
|
|
119
126
|
}
|
|
120
127
|
if (!/^\d+\.\d+\.\d+/.test(d.version)) {
|
|
121
|
-
problems.push(`'${d.version}' is not semver. A plugin upgrades by version comparison
|
|
128
|
+
problems.push(`'${d.version}' is not semver. A plugin upgrades by version comparison.`);
|
|
122
129
|
}
|
|
123
130
|
// The display text (R-20): the name the plugin list shows and the
|
|
124
131
|
// description under it. The packager and the install repeat this check
|
|
@@ -180,9 +187,16 @@ export function defineExtension(d) {
|
|
|
180
187
|
for (const t of d.templates ?? []) {
|
|
181
188
|
problems.push(...templateSeedProblems(t, d.slug));
|
|
182
189
|
if (templateIds.has(t.id))
|
|
183
|
-
problems.push(`duplicate template id '${t.id}' — the id is the sync key
|
|
190
|
+
problems.push(`duplicate template id '${t.id}' — the id is the sync key.`);
|
|
184
191
|
templateIds.add(t.id);
|
|
185
192
|
}
|
|
193
|
+
const loadoutIds = new Set();
|
|
194
|
+
for (const l of d.loadouts ?? []) {
|
|
195
|
+
problems.push(...loadoutDeclProblems(l, d.slug));
|
|
196
|
+
if (loadoutIds.has(l.id))
|
|
197
|
+
problems.push(`duplicate loadout id '${l.id}' — the id is the sync key.`);
|
|
198
|
+
loadoutIds.add(l.id);
|
|
199
|
+
}
|
|
186
200
|
problems.push(...permissionFindings(d.permissions));
|
|
187
201
|
problems.push(...annexFieldListFindings(d.annexFields));
|
|
188
202
|
// The variables an instance registers from the manifest — the declared
|
|
@@ -249,6 +263,8 @@ export function defineExtension(d) {
|
|
|
249
263
|
// writes to its own annex must be declared (ruling 2026-09-26).
|
|
250
264
|
annexFields: d.annexFields ?? [],
|
|
251
265
|
}).errors);
|
|
266
|
+
// Its own shapes, as data, for the manifest (core's travel with the app).
|
|
267
|
+
const shapes = d.slug === 'core' ? [] : listShapes().filter((sh) => sh.id.startsWith(`${d.slug}:shape/`));
|
|
252
268
|
if (problems.length) {
|
|
253
269
|
throw new ExtensionError(`invalid extension '${d.slug}':\n` + problems.map((p) => ` • ${p}`).join('\n'));
|
|
254
270
|
}
|
|
@@ -259,6 +275,7 @@ export function defineExtension(d) {
|
|
|
259
275
|
...(presets ? { presets } : {}),
|
|
260
276
|
...(events ? { events } : {}),
|
|
261
277
|
...(d.swaps ? { swaps: d.swaps.map(storedSwap) } : {}),
|
|
278
|
+
...(shapes.length ? { shapes } : {}),
|
|
262
279
|
};
|
|
263
280
|
}
|
|
264
281
|
// ── Derived views ───────────────────────────────────────────────────────────
|
|
@@ -272,7 +289,12 @@ export const eventListenersOf = (e) => (e.handlers ?? []).filter((h) => h.__decl
|
|
|
272
289
|
* Every variable a package declares, as its manifest carries them: the
|
|
273
290
|
* `variables` list first, then each variable a band of its handlers'
|
|
274
291
|
* definitions holds (`Descriptor.bands`) — a band is a value holding its
|
|
275
|
-
* variable, so the author never lists it twice
|
|
292
|
+
* variable, so the author never lists it twice — then each variable **of the
|
|
293
|
+
* package's own namespace** named by id in a `renders`: a handler
|
|
294
|
+
* definition's `variables` slot, or a node of one of its pipelines
|
|
295
|
+
* (2026-10-13). An id is resolved from the registry this package was built
|
|
296
|
+
* in; an instance refuses a `renders` naming a variable it was never handed,
|
|
297
|
+
* so a variable named only there must travel too. One entry per distinct
|
|
276
298
|
* declaration: the same variable reached twice (two definitions declaring
|
|
277
299
|
* one band) is one entry; one id with two different contents stays two, and
|
|
278
300
|
* `pluginVariableFindings` refuses it.
|
|
@@ -292,13 +314,25 @@ export function variablesOf(e) {
|
|
|
292
314
|
};
|
|
293
315
|
for (const v of e.variables ?? [])
|
|
294
316
|
add(v);
|
|
317
|
+
const named = [];
|
|
295
318
|
for (const h of e.handlers ?? []) {
|
|
296
319
|
if (h.__decl !== 'handler')
|
|
297
320
|
continue;
|
|
298
|
-
const
|
|
321
|
+
const type = h.type;
|
|
322
|
+
const bands = type?.bands;
|
|
299
323
|
for (const v of Object.values(bands ?? {}))
|
|
300
324
|
add(v);
|
|
325
|
+
for (const s of Object.values((type?.slots ?? {})))
|
|
326
|
+
if (s?.kind === 'variables')
|
|
327
|
+
named.push(...Object.values(s.renders ?? {}));
|
|
301
328
|
}
|
|
329
|
+
for (const p of e.pipelines ?? [])
|
|
330
|
+
for (const n of p.nodes ?? [])
|
|
331
|
+
named.push(...Object.values(n.renders ?? {}));
|
|
332
|
+
if (e.slug)
|
|
333
|
+
for (const id of named)
|
|
334
|
+
if (typeof id === 'string' && id.startsWith(`${e.slug}:`))
|
|
335
|
+
add(getVariable(id));
|
|
302
336
|
return out;
|
|
303
337
|
}
|
|
304
338
|
/**
|
package/dist/facets.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A slot already carries a `facet` — `prompts`, `weights`, `review` — and the
|
|
5
5
|
* configuration panel groups on it, because a facet names a kind and never a
|
|
6
|
-
* node key, a count or an order
|
|
6
|
+
* node key, a count or an order. What the panel did *not* have was any
|
|
7
7
|
* way to know a facet's heading, its position, or whether it leads the panel or
|
|
8
8
|
* sits behind the tuning door. All three lived in a hardcoded list in the
|
|
9
9
|
* client.
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* So a facet is declared here, and the client renders what it is sent. An
|
|
18
18
|
* undeclared facet still gets a group of its own rather than disappearing:
|
|
19
19
|
* unknown is not the same as absent, and the panel should say so.
|
|
20
|
+
* @ruling 05 §0a
|
|
20
21
|
*/
|
|
21
22
|
import type { I18n } from './descriptors.js';
|
|
22
23
|
/** @experimental */
|
package/dist/facets.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* A slot already carries a `facet` — `prompts`, `weights`, `review` — and the
|
|
5
5
|
* configuration panel groups on it, because a facet names a kind and never a
|
|
6
|
-
* node key, a count or an order
|
|
6
|
+
* node key, a count or an order. What the panel did *not* have was any
|
|
7
7
|
* way to know a facet's heading, its position, or whether it leads the panel or
|
|
8
8
|
* sits behind the tuning door. All three lived in a hardcoded list in the
|
|
9
9
|
* client.
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
* So a facet is declared here, and the client renders what it is sent. An
|
|
18
18
|
* undeclared facet still gets a group of its own rather than disappearing:
|
|
19
19
|
* unknown is not the same as absent, and the panel should say so.
|
|
20
|
+
* @ruling 05 §0a
|
|
20
21
|
*/
|
|
21
22
|
import { refuseUnlessIdentical } from './hash.js';
|
|
22
23
|
const facets = new Map();
|
|
@@ -50,9 +51,10 @@ defineFacet({ id: 'weights', i18n: { en: 'Tuning' }, order: 5 });
|
|
|
50
51
|
defineFacet({ id: 'review', i18n: { en: 'Review' }, order: 6, simple: true });
|
|
51
52
|
/**
|
|
52
53
|
* The substrate's own (`settingsSlot.ts`): an optional node's switch, a gather
|
|
53
|
-
* clause's mode. Declared since
|
|
54
|
+
* clause's mode. Declared since 2026-09-16 — it resolved through the
|
|
54
55
|
* undeclared-facet fallback before, which is the path meant for a plugin's
|
|
55
56
|
* word, not core's. Same heading; behind the tuning door as it always was.
|
|
57
|
+
* @ruling R-9
|
|
56
58
|
*/
|
|
57
59
|
defineFacet({ id: 'settings', i18n: { en: 'Settings' }, order: 7 });
|
|
58
60
|
/** `context-budget` and friends declare a bare `parameters` slot. */
|
package/dist/foldedSections.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Folded sections
|
|
2
|
+
* Folded sections — the checks a host makes on
|
|
3
3
|
* the message outlets' `sections` in-port, the one reading of where a row keeps
|
|
4
4
|
* them, and the one `core:section` part each becomes. Pure: the host's write,
|
|
5
5
|
* its projection to parts and a widget's fallback all read through here, so
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* alternative's sections are the row's `sections` — the ones it had before
|
|
12
12
|
* anybody swiped.
|
|
13
13
|
* @experimental
|
|
14
|
+
* @ruling B4, decision D5 (2026-09-27)
|
|
14
15
|
*/
|
|
15
16
|
import type { FoldedSectionPartDataV1, FoldedSectionV1 } from './widgets.js';
|
|
16
17
|
/**
|
|
@@ -59,7 +60,7 @@ export declare function foldedSectionPart(section: FoldedSectionV1): {
|
|
|
59
60
|
};
|
|
60
61
|
/**
|
|
61
62
|
* The readable lines a document's lists make — what `core:task/list-section@1`
|
|
62
|
-
* folds into one section's `items
|
|
63
|
+
* folds into one section's `items`.
|
|
63
64
|
*
|
|
64
65
|
* `path` names the keys to read, comma-separated and in order (`'beats,speakers'`);
|
|
65
66
|
* empty reads the document itself. A list contributes one line per entry and
|
|
@@ -69,6 +70,7 @@ export declare function foldedSectionPart(section: FoldedSectionV1): {
|
|
|
69
70
|
* Nested lists and objects inside an entry are left out rather than printed.
|
|
70
71
|
* Blank lines are dropped, so a document with nothing to say makes no lines.
|
|
71
72
|
* @experimental
|
|
73
|
+
* @ruling lair pass B5, decision D5 (2026-09-27)
|
|
72
74
|
*/
|
|
73
75
|
export declare function sectionItemsOf(document: unknown, path?: string): string[];
|
|
74
76
|
//# sourceMappingURL=foldedSections.d.ts.map
|
package/dist/foldedSections.js
CHANGED
|
@@ -115,7 +115,7 @@ export function foldedSectionPart(section) {
|
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
117
|
* The readable lines a document's lists make — what `core:task/list-section@1`
|
|
118
|
-
* folds into one section's `items
|
|
118
|
+
* folds into one section's `items`.
|
|
119
119
|
*
|
|
120
120
|
* `path` names the keys to read, comma-separated and in order (`'beats,speakers'`);
|
|
121
121
|
* empty reads the document itself. A list contributes one line per entry and
|
|
@@ -125,6 +125,7 @@ export function foldedSectionPart(section) {
|
|
|
125
125
|
* Nested lists and objects inside an entry are left out rather than printed.
|
|
126
126
|
* Blank lines are dropped, so a document with nothing to say makes no lines.
|
|
127
127
|
* @experimental
|
|
128
|
+
* @ruling lair pass B5, decision D5 (2026-09-27)
|
|
128
129
|
*/
|
|
129
130
|
export function sectionItemsOf(document, path = '') {
|
|
130
131
|
const keys = path
|