@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The component client's contract
|
|
2
|
+
* The component client's contract: what a remote component is
|
|
3
3
|
* handed. The host implements it in the page's UI worker over the widget
|
|
4
4
|
* wire — the same sections a native widget reads off its context and a
|
|
5
5
|
* frame is posted, and the same verbs back — and `@serene-pub/component-client`
|
|
@@ -7,46 +7,66 @@
|
|
|
7
7
|
*
|
|
8
8
|
* A component module exports one mount function: it draws into `root`
|
|
9
9
|
* (placing elements from `SP_HOST_ELEMENTS`) and returns a cleanup.
|
|
10
|
+
*
|
|
11
|
+
* **A component never types `v1`.** `.v1` is the wire's version clock: the
|
|
12
|
+
* envelope ({@link WidgetData}) carries each section as `{ v1 }`, and the
|
|
13
|
+
* component client unwraps the current version — `ctx.messages` is
|
|
14
|
+
* `messages.v1`, `ctx.scope('session:state')` is `session_state.v1`. When a
|
|
15
|
+
* section ships a `v2`, the client is the one place that picks.
|
|
16
|
+
*
|
|
17
|
+
* New to the project's words (scope, section, grant, dossier)? See the
|
|
18
|
+
* vocabulary page, `guides/vocabulary.md`.
|
|
19
|
+
* @ruling §3.5, C3
|
|
10
20
|
*/
|
|
11
|
-
import type {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
21
|
+
import type { MessageV1, WidgetBaseSection, WidgetData, WidgetEvent, WidgetRequestKind, WidgetRequests, WidgetScopedSections, WidgetScopedSectionValues, WidgetSectionScope, WidgetWriteGrant } from './widgets.js';
|
|
22
|
+
/**
|
|
23
|
+
* Every base section of the envelope ({@link WidgetData}) but `channels`,
|
|
24
|
+
* flat: the section's current version, `undefined` until the host posts it.
|
|
25
|
+
* Derived, never hand-listed — a base section added to `WidgetData` is here
|
|
26
|
+
* at once, and the component wire does not compile until it hands it over.
|
|
27
|
+
* (`channels` differs on purpose: the envelope's is the declared slugs; a
|
|
28
|
+
* component is handed each lane's rows, below.)
|
|
29
|
+
* @experimental
|
|
30
|
+
*/
|
|
31
|
+
export type ComponentBaseSections = {
|
|
32
|
+
[S in Exclude<WidgetBaseSection, 'channels'>]?: WidgetData[S]['v1'];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Every section the host pushes, as the latest value received.
|
|
36
|
+
*
|
|
37
|
+
* `session`, `messages`, `layout`, `actions`, `props`, `settings`, `annex`,
|
|
38
|
+
* `locale`, `viewer` (🚧 who is looking), `turnOrder`, `attendance` — each
|
|
39
|
+
* that section's `v1`, from {@link ComponentBaseSections}.
|
|
40
|
+
* @experimental
|
|
41
|
+
*/
|
|
42
|
+
export interface ComponentSections extends ComponentBaseSections {
|
|
17
43
|
/** Per-lane rows, when the widget declared channels. */
|
|
18
|
-
channels: Record<string,
|
|
19
|
-
settings?: Record<string, unknown>;
|
|
20
|
-
actions?: unknown;
|
|
21
|
-
annex?: Record<string, unknown>;
|
|
22
|
-
props?: Record<string, unknown>;
|
|
44
|
+
channels: Record<string, MessageV1[]>;
|
|
23
45
|
theme?: {
|
|
24
46
|
theme: string;
|
|
25
47
|
mode: 'light' | 'dark';
|
|
26
48
|
};
|
|
27
|
-
/** The viewer's language code — render a locale map with `i18nText(text, ctx.locale)`. */
|
|
28
|
-
locale?: string;
|
|
29
|
-
/** 🚧 Who is looking: `{ userId, isAdmin, isGuest }`. */
|
|
30
|
-
viewer?: ViewerV1;
|
|
31
|
-
/** The session's turn order: who is due, in order, and who could be (`turnOrder.v1`). */
|
|
32
|
-
turnOrder?: TurnOrderV1;
|
|
33
49
|
/**
|
|
34
|
-
* 🚧 The scoped sections this widget was granted, by their
|
|
35
|
-
* (`session_full`, `session_state`, …) — the SDK's one table
|
|
36
|
-
* (`WidgetScopedSections`), each its section's `v1`.
|
|
50
|
+
* 🚧 The raw bag: the scoped sections this widget was granted, by their
|
|
51
|
+
* posted name (`session_full`, `session_state`, …) — the SDK's one table
|
|
52
|
+
* (`WidgetScopedSections`), each its section's `v1`. Read one with
|
|
53
|
+
* {@link ComponentContext.scope}, by the scope you declared; this bag is
|
|
54
|
+
* for code that walks every section.
|
|
37
55
|
*/
|
|
38
56
|
scoped: Partial<WidgetScopedSectionValues>;
|
|
39
57
|
/**
|
|
40
|
-
* 🚧 The scopes this widget holds, BARE
|
|
58
|
+
* 🚧 The scopes and write grants this widget holds, BARE
|
|
59
|
+
* (`session:state`, `session:state:write`, `channel:main:write`; never
|
|
41
60
|
* `widget:session:state`) — as the host last said (`grants`), on mount
|
|
42
61
|
* and whenever an admin's review changes them. `undefined` until the host
|
|
43
62
|
* says (and from a host that never does). So a component tells "this
|
|
44
63
|
* scope was not granted" (drawn as such) from "its section has not been
|
|
45
64
|
* posted yet" (drawn as loading) — both of which are an absent `scoped`
|
|
46
|
-
* entry
|
|
65
|
+
* entry — and can hide a button whose write it does not hold. A write
|
|
66
|
+
* grant ({@link WidgetWriteGrant}) pushes no section of its own. Read one
|
|
67
|
+
* with {@link ComponentContext.granted}.
|
|
47
68
|
*/
|
|
48
|
-
grants?: readonly WidgetSectionScope[];
|
|
49
|
-
layout?: unknown;
|
|
69
|
+
grants?: readonly (WidgetSectionScope | WidgetWriteGrant)[];
|
|
50
70
|
/** The view state this widget saved last time, handed back once on mount. */
|
|
51
71
|
state?: unknown;
|
|
52
72
|
suspended: boolean;
|
|
@@ -66,7 +86,7 @@ export interface ComponentContext extends Readonly<ComponentSections> {
|
|
|
66
86
|
/** Called with the section's name whenever the host pushes one. */
|
|
67
87
|
subscribe(fn: (section: ComponentSection) => void): () => void;
|
|
68
88
|
/** Widget events (`message:created`, `layout:changed`, …). */
|
|
69
|
-
onEvent(fn: (event:
|
|
89
|
+
onEvent(fn: (event: WidgetEvent) => void): () => void;
|
|
70
90
|
/** Press an action by key or identity, as the native `invoke` verb does. */
|
|
71
91
|
invoke(key: string, args?: ComponentInvokeArgs): void;
|
|
72
92
|
/**
|
|
@@ -87,11 +107,22 @@ export interface ComponentContext extends Readonly<ComponentSections> {
|
|
|
87
107
|
*/
|
|
88
108
|
t(source: string): string;
|
|
89
109
|
/**
|
|
90
|
-
* 🚧 Was `scope`
|
|
91
|
-
*
|
|
92
|
-
*
|
|
110
|
+
* 🚧 Was `scope` — or a write grant, `session:state:write`,
|
|
111
|
+
* `channel:<slug>:write` — granted? `true` or `false` once the host has
|
|
112
|
+
* said (`grants`); `undefined` before it has — so `false` is the one
|
|
113
|
+
* answer that means "draw not granted", and `undefined` still means "wait".
|
|
114
|
+
* A widget that asks `send`, `draft` or `set-attribute-value` checks its
|
|
115
|
+
* write grant here before it offers the button.
|
|
116
|
+
*/
|
|
117
|
+
granted(scope: WidgetSectionScope | WidgetWriteGrant): boolean | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* 🚧 The section a granted scope delivers, by the same string `scopes`
|
|
120
|
+
* and `granted` take: `ctx.scope('session:state')` is the session's
|
|
121
|
+
* stats and states. `undefined` when it is not granted, or not posted
|
|
122
|
+
* yet — {@link granted} tells the two apart. (Not `scopes`: that is the
|
|
123
|
+
* list a widget declares.)
|
|
93
124
|
*/
|
|
94
|
-
|
|
125
|
+
scope<S extends WidgetSectionScope>(scope: S): WidgetScopedSectionValues[WidgetScopedSections[S]['section']] | undefined;
|
|
95
126
|
}
|
|
96
127
|
/** What a component module exports: mount into `root`; return a cleanup. @experimental */
|
|
97
128
|
export type ComponentMountFn = (root: HTMLElement, ctx: ComponentContext) => void | (() => void);
|
package/dist/componentClient.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The component client's contract
|
|
2
|
+
* The component client's contract: what a remote component is
|
|
3
3
|
* handed. The host implements it in the page's UI worker over the widget
|
|
4
4
|
* wire — the same sections a native widget reads off its context and a
|
|
5
5
|
* frame is posted, and the same verbs back — and `@serene-pub/component-client`
|
|
@@ -7,6 +7,16 @@
|
|
|
7
7
|
*
|
|
8
8
|
* A component module exports one mount function: it draws into `root`
|
|
9
9
|
* (placing elements from `SP_HOST_ELEMENTS`) and returns a cleanup.
|
|
10
|
+
*
|
|
11
|
+
* **A component never types `v1`.** `.v1` is the wire's version clock: the
|
|
12
|
+
* envelope ({@link WidgetData}) carries each section as `{ v1 }`, and the
|
|
13
|
+
* component client unwraps the current version — `ctx.messages` is
|
|
14
|
+
* `messages.v1`, `ctx.scope('session:state')` is `session_state.v1`. When a
|
|
15
|
+
* section ships a `v2`, the client is the one place that picks.
|
|
16
|
+
*
|
|
17
|
+
* New to the project's words (scope, section, grant, dossier)? See the
|
|
18
|
+
* vocabulary page, `guides/vocabulary.md`.
|
|
19
|
+
* @ruling §3.5, C3
|
|
10
20
|
*/
|
|
11
21
|
/** Types a component's mount function; returns it unchanged. @experimental */
|
|
12
22
|
export const defineComponent = (fn) => fn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What a component may import
|
|
2
|
+
* What a component may import.
|
|
3
3
|
*
|
|
4
4
|
* A component's source imports `svelte`, the component client and the
|
|
5
5
|
* unstyled controls — and places `sp-*` elements (`hostElements.ts`). It
|
|
@@ -19,24 +19,27 @@
|
|
|
19
19
|
* 3. **Runtime** — the worker's own CSP and the bootstrap's stripped network
|
|
20
20
|
* globals.
|
|
21
21
|
*
|
|
22
|
-
* Preact, the React alias and `htm` arrive after 1.0
|
|
22
|
+
* Preact, the React alias and `htm` arrive after 1.0; the list grows,
|
|
23
23
|
* it never shrinks.
|
|
24
|
+
* @ruling §3.5, R23, R35, R35
|
|
24
25
|
*/
|
|
25
26
|
/**
|
|
26
27
|
* Bare specifiers a component may import. A trailing `/*` admits subpaths.
|
|
27
28
|
*
|
|
28
|
-
* The last
|
|
29
|
+
* The last eight are experimental: the
|
|
29
30
|
* SDK's component subpath and core's UI kit — the helpers core's own
|
|
30
31
|
* components are written against — so a clone of a core component compiles
|
|
31
32
|
* in-app from its source, and a CLI modder has the same kit. Each names ONE
|
|
32
33
|
* module (no `/*`): nothing else of the SDK's or core-catalog's is admitted.
|
|
33
34
|
* @experimental
|
|
35
|
+
* @ruling C6 P1, owner ruling 2026-09-25 Q4
|
|
34
36
|
*/
|
|
35
|
-
export declare const COMPONENT_IMPORTS: readonly ['svelte', 'svelte/*', '@serene-pub/component-client', '@serene-pub/component-client/*', '@serene-pub/controls', '@serene-pub/sdk/component', '@serene-pub/core-catalog/conversation', '@serene-pub/core-catalog/lore-entries', '@serene-pub/core-catalog/scene-portraits', '@serene-pub/core-catalog/session-state', '@serene-pub/core-catalog/widgets', '@serene-pub/core-catalog/authors-note'];
|
|
37
|
+
export declare const COMPONENT_IMPORTS: readonly ['svelte', 'svelte/*', '@serene-pub/component-client', '@serene-pub/component-client/*', '@serene-pub/controls', '@serene-pub/sdk/component', '@serene-pub/core-catalog/conversation', '@serene-pub/core-catalog/lore-entries', '@serene-pub/core-catalog/scene-portraits', '@serene-pub/core-catalog/session-state', '@serene-pub/core-catalog/widgets', '@serene-pub/core-catalog/authors-note', '@serene-pub/core-catalog/turn-order', '@serene-pub/core-catalog/actions', '@serene-pub/core-catalog/annex', '@serene-pub/core-catalog/album', '@serene-pub/core-catalog/chronicle', '@serene-pub/core-catalog/places', '@serene-pub/core-catalog/attendance', '@serene-pub/core-catalog/backdrop'];
|
|
36
38
|
/**
|
|
37
39
|
* Specifiers no component may import, however it is built — the renderer is
|
|
38
|
-
* the host's
|
|
40
|
+
* the host's, and so is the worker runtime that installs it.
|
|
39
41
|
* @experimental
|
|
42
|
+
* @ruling R23
|
|
40
43
|
*/
|
|
41
44
|
export declare const COMPONENT_FORBIDDEN_IMPORTS: readonly ['@remote-dom/*', '@serene-pub/component-client/worker-runtime'];
|
|
42
45
|
/**
|
package/dist/componentImports.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What a component may import
|
|
2
|
+
* What a component may import.
|
|
3
3
|
*
|
|
4
4
|
* A component's source imports `svelte`, the component client and the
|
|
5
5
|
* unstyled controls — and places `sp-*` elements (`hostElements.ts`). It
|
|
@@ -19,18 +19,20 @@
|
|
|
19
19
|
* 3. **Runtime** — the worker's own CSP and the bootstrap's stripped network
|
|
20
20
|
* globals.
|
|
21
21
|
*
|
|
22
|
-
* Preact, the React alias and `htm` arrive after 1.0
|
|
22
|
+
* Preact, the React alias and `htm` arrive after 1.0; the list grows,
|
|
23
23
|
* it never shrinks.
|
|
24
|
+
* @ruling §3.5, R23, R35, R35
|
|
24
25
|
*/
|
|
25
26
|
/**
|
|
26
27
|
* Bare specifiers a component may import. A trailing `/*` admits subpaths.
|
|
27
28
|
*
|
|
28
|
-
* The last
|
|
29
|
+
* The last eight are experimental: the
|
|
29
30
|
* SDK's component subpath and core's UI kit — the helpers core's own
|
|
30
31
|
* components are written against — so a clone of a core component compiles
|
|
31
32
|
* in-app from its source, and a CLI modder has the same kit. Each names ONE
|
|
32
33
|
* module (no `/*`): nothing else of the SDK's or core-catalog's is admitted.
|
|
33
34
|
* @experimental
|
|
35
|
+
* @ruling C6 P1, owner ruling 2026-09-25 Q4
|
|
34
36
|
*/
|
|
35
37
|
export const COMPONENT_IMPORTS = [
|
|
36
38
|
'svelte',
|
|
@@ -47,11 +49,28 @@ export const COMPONENT_IMPORTS = [
|
|
|
47
49
|
// 🚧 2026-10-02 (AN1): the author's note widget's plain half — appended,
|
|
48
50
|
// so the list only grows.
|
|
49
51
|
'@serene-pub/core-catalog/authors-note',
|
|
52
|
+
// 🚧 2026-10-10 (W1): the turn order widget's plain half — appended.
|
|
53
|
+
'@serene-pub/core-catalog/turn-order',
|
|
54
|
+
// 🚧 2026-10-11 (W8): the actions widget's plain half — appended.
|
|
55
|
+
'@serene-pub/core-catalog/actions',
|
|
56
|
+
// 🚧 2026-10-11 (W9): the annex widget's plain half — appended.
|
|
57
|
+
'@serene-pub/core-catalog/annex',
|
|
58
|
+
// 🚧 2026-10-11 (W2): the album widget's plain half — appended.
|
|
59
|
+
'@serene-pub/core-catalog/album',
|
|
60
|
+
// 🚧 2026-10-11 (W3): the chronicle widget's plain half — appended.
|
|
61
|
+
'@serene-pub/core-catalog/chronicle',
|
|
62
|
+
// 🚧 2026-10-11 (W4): the places widget's plain half — appended.
|
|
63
|
+
'@serene-pub/core-catalog/places',
|
|
64
|
+
// 🚧 2026-10-11 (W10): the Who's here widget's plain half — appended.
|
|
65
|
+
'@serene-pub/core-catalog/attendance',
|
|
66
|
+
// 🚧 2026-10-12 (DESIGN-image-generation §6.4): the backdrop widget's plain half — appended.
|
|
67
|
+
'@serene-pub/core-catalog/backdrop',
|
|
50
68
|
];
|
|
51
69
|
/**
|
|
52
70
|
* Specifiers no component may import, however it is built — the renderer is
|
|
53
|
-
* the host's
|
|
71
|
+
* the host's, and so is the worker runtime that installs it.
|
|
54
72
|
* @experimental
|
|
73
|
+
* @ruling R23
|
|
55
74
|
*/
|
|
56
75
|
export const COMPONENT_FORBIDDEN_IMPORTS = ['@remote-dom/*', '@serene-pub/component-client/worker-runtime'];
|
|
57
76
|
const matches = (specifier, pattern) => pattern.endsWith('/*')
|
package/dist/componentModule.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What a BUILT component module may carry
|
|
2
|
+
* What a BUILT component module may carry — judged on the
|
|
3
3
|
* module's text, as a host judges a package it is handed and the CLI judges
|
|
4
4
|
* what it just wrote.
|
|
5
5
|
*
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* Worker( is bad") is not code, and minified output (`import{a}from"x"`)
|
|
20
20
|
* is read as the import it is. The CSP of the page's worker is the wall;
|
|
21
21
|
* this says so at build time.
|
|
22
|
+
* @ruling §3.5, C4 / C30
|
|
22
23
|
*/
|
|
23
24
|
import { isHostElement } from './hostElements.js';
|
|
24
25
|
/** Keywords after which a `/` starts a regular expression, not a division. */
|
package/dist/componentWire.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The component wire
|
|
2
|
+
* The component wire: what crosses between a page and its UI
|
|
3
3
|
* worker, beside each mount's own widget-protocol port — and the worker
|
|
4
4
|
* side of that port, the {@link ComponentContext} a component is handed.
|
|
5
5
|
*
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* cannot overtake the DOM changes of the turn that sent it.
|
|
17
17
|
*
|
|
18
18
|
* @internal
|
|
19
|
+
* @ruling §3.5, C2/C3b
|
|
19
20
|
*/
|
|
20
21
|
import type { ComponentContext } from './componentClient.js';
|
|
21
22
|
import type { RequestDeclineCode } from './surfaces.js';
|
package/dist/componentWire.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { WIDGET_SCOPED_SECTIONS, isWidgetScopedSectionName } from './widgets.js';
|
|
2
|
+
/**
|
|
3
|
+
* A grant a component may be told it holds: a scope the table names, or a
|
|
4
|
+
* write grant — `<scope>:write` on such a scope, or `channel:<slug>:write`.
|
|
5
|
+
* Anything else the host sends is dropped, as an unknown scope always was.
|
|
6
|
+
*/
|
|
7
|
+
const isHeldGrant = (g) => {
|
|
8
|
+
if (typeof g !== 'string')
|
|
9
|
+
return false;
|
|
10
|
+
if (Object.hasOwn(WIDGET_SCOPED_SECTIONS, g))
|
|
11
|
+
return true;
|
|
12
|
+
if (!g.endsWith(':write'))
|
|
13
|
+
return false;
|
|
14
|
+
const base = g.slice(0, -':write'.length);
|
|
15
|
+
return Object.hasOwn(WIDGET_SCOPED_SECTIONS, base) || /^channel:\S+$/.test(base);
|
|
16
|
+
};
|
|
2
17
|
/** The handle key a function is replaced by on the wire. @experimental */
|
|
3
18
|
export const FN = '__spFn';
|
|
4
19
|
/** @experimental */
|
|
@@ -116,10 +131,11 @@ export function createComponentContext(port) {
|
|
|
116
131
|
return notify('scoped');
|
|
117
132
|
}
|
|
118
133
|
case 'grants': {
|
|
119
|
-
// A list, or nothing new; only a scope the table names
|
|
134
|
+
// A list, or nothing new; only a scope the table names, or a
|
|
135
|
+
// write grant, is kept. Sections still key off the scopes alone.
|
|
120
136
|
if (!Array.isArray(m.grants))
|
|
121
137
|
return;
|
|
122
|
-
data.grants = m.grants.filter(
|
|
138
|
+
data.grants = m.grants.filter(isHeldGrant);
|
|
123
139
|
return notify('grants');
|
|
124
140
|
}
|
|
125
141
|
case 'viewer':
|
|
@@ -128,6 +144,9 @@ export function createComponentContext(port) {
|
|
|
128
144
|
case 'turn-order':
|
|
129
145
|
data.turnOrder = m.turnOrder;
|
|
130
146
|
return notify('turnOrder');
|
|
147
|
+
case 'attendance':
|
|
148
|
+
data.attendance = m.attendance;
|
|
149
|
+
return notify('attendance');
|
|
131
150
|
case 'page':
|
|
132
151
|
case 'response': {
|
|
133
152
|
const waiting = pending.get(String(m.requestId));
|
|
@@ -257,12 +276,20 @@ export function createComponentContext(port) {
|
|
|
257
276
|
get turnOrder() {
|
|
258
277
|
return data.turnOrder;
|
|
259
278
|
},
|
|
279
|
+
get attendance() {
|
|
280
|
+
return data.attendance;
|
|
281
|
+
},
|
|
260
282
|
get grants() {
|
|
261
283
|
return data.grants;
|
|
262
284
|
},
|
|
263
285
|
granted(scope) {
|
|
264
286
|
return data.grants === undefined ? undefined : data.grants.includes(scope);
|
|
265
287
|
},
|
|
288
|
+
// One spelling for the author: the scope they declared, looked up in
|
|
289
|
+
// the table, read off the raw bag. A withdrawn grant left no entry.
|
|
290
|
+
scope(scope) {
|
|
291
|
+
return data.scoped[WIDGET_SCOPED_SECTIONS[scope]];
|
|
292
|
+
},
|
|
266
293
|
ready() {
|
|
267
294
|
port.postMessage({ t: 'ready' });
|
|
268
295
|
},
|
|
@@ -275,6 +302,11 @@ export function createComponentContext(port) {
|
|
|
275
302
|
port.close();
|
|
276
303
|
}
|
|
277
304
|
};
|
|
305
|
+
// Every section a component is handed has a getter here: a base section
|
|
306
|
+
// added to `WidgetData` (and so to `ComponentSections`) does not compile
|
|
307
|
+
// until this object hands it over.
|
|
308
|
+
const handsEvery = true;
|
|
309
|
+
void handsEvery;
|
|
278
310
|
return ctx;
|
|
279
311
|
}
|
|
280
312
|
//# sourceMappingURL=componentWire.js.map
|
package/dist/config.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Configuration resolution
|
|
2
|
+
* Configuration resolution. Four layers, first hit wins, evaluated
|
|
3
3
|
* independently per path — which is what makes an admin's connection change reach a
|
|
4
|
-
* user who has customized their prompts
|
|
4
|
+
* user who has customized their prompts.
|
|
5
5
|
*
|
|
6
|
-
* ## The chain (
|
|
6
|
+
* ## The chain (ruled 2026-09-15)
|
|
7
7
|
*
|
|
8
8
|
* **`session · config · defaults · author`.**
|
|
9
9
|
*
|
|
10
10
|
* - `session` — a session's own override of a value (the *chat override* of
|
|
11
|
-
*
|
|
11
|
+
* the "pipeline → config → chat override").
|
|
12
12
|
* - `config` — the rows of the **selected config**: the config IS the
|
|
13
13
|
* instance's tuning. An administrator's edit lands in the config (ruled
|
|
14
14
|
* 2026-08-24), so there is no separate `instance` layer for it to be shadowed
|
|
@@ -20,19 +20,20 @@
|
|
|
20
20
|
* - `author` — the definition's declared parameter defaults; the floor.
|
|
21
21
|
*
|
|
22
22
|
* `user` and `instance` stood in this list until 2026-09-16 and were pushed by
|
|
23
|
-
* nothing: `world.ts` never projected a row at either
|
|
23
|
+
* nothing: `world.ts` never projected a row at either. Their
|
|
24
24
|
* semantics fold into `config` — the config an admin edits is the instance's
|
|
25
25
|
* configuration — which is the 2026-08-24 ruling stated as a constant.
|
|
26
26
|
*
|
|
27
27
|
* Resolved run-wide *before* execution, which is why referencing another node's
|
|
28
|
-
* config is not a data edge
|
|
28
|
+
* config is not a data edge.
|
|
29
29
|
*
|
|
30
|
-
* ## `config`, not `preset`
|
|
30
|
+
* ## `config`, not `preset`
|
|
31
31
|
*
|
|
32
32
|
* Two other things are called a preset — a **session preset** (the bundle a
|
|
33
33
|
* session is born on) and an author's `.preset(…)` on a spec — and neither is
|
|
34
34
|
* this layer, so the scope takes the canon's word for what it holds: the
|
|
35
35
|
* **config**.
|
|
36
|
+
* @ruling 12 §2, F20, R-10, 09-B B8, 12 §2, plans/29a §3, F35, R1
|
|
36
37
|
*/
|
|
37
38
|
import type { CapabilitySet } from './capabilities.js';
|
|
38
39
|
/** @experimental */
|
|
@@ -101,7 +102,10 @@ export interface ConnectionRecord {
|
|
|
101
102
|
id: string;
|
|
102
103
|
name: string;
|
|
103
104
|
kind: string;
|
|
104
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Readable — not a credential.
|
|
107
|
+
* @ruling 01 §10
|
|
108
|
+
*/
|
|
105
109
|
metadata: {
|
|
106
110
|
contextLength?: number;
|
|
107
111
|
tokenizer?: string;
|
|
@@ -180,7 +184,7 @@ export declare function slotConnectionModelId(value: unknown): string | number |
|
|
|
180
184
|
* A resolved `connection` slot, as a binding receives it.
|
|
181
185
|
*
|
|
182
186
|
* `metadata` only — `material` is a credential and is injected by the executor
|
|
183
|
-
* at call time
|
|
187
|
+
* at call time, so no node ever sees it.
|
|
184
188
|
*
|
|
185
189
|
* `modelId` is the model half of the pair the slot named, carried through so a
|
|
186
190
|
* host can honour the pick instead of reducing it to an endpoint. Null means
|
|
@@ -190,6 +194,7 @@ export declare function slotConnectionModelId(value: unknown): string | number |
|
|
|
190
194
|
* whose own defaults are pairs resolves that half for itself, from the store
|
|
191
195
|
* the default came out of.
|
|
192
196
|
* @experimental
|
|
197
|
+
* @ruling 01 §10
|
|
193
198
|
*/
|
|
194
199
|
export interface ResolvedConnection {
|
|
195
200
|
id: string;
|
|
@@ -201,10 +206,11 @@ export interface ResolvedConnection {
|
|
|
201
206
|
* (`ConfigWorld.models`); null when the slot named no model or the model
|
|
202
207
|
* states none, in which case the sampling config's window decides.
|
|
203
208
|
*
|
|
204
|
-
* Carried here so the ONE window computation
|
|
209
|
+
* Carried here so the ONE window computation can read it off the
|
|
205
210
|
* same resolved slot the request is sent with — a budget sized to the
|
|
206
211
|
* sampling config's window while the request went to a model with a
|
|
207
212
|
* smaller one was wrong in the direction that truncates.
|
|
213
|
+
* @ruling R-8
|
|
208
214
|
*/
|
|
209
215
|
contextWindow: number | null;
|
|
210
216
|
}
|
|
@@ -224,7 +230,10 @@ export interface ConfigWorld {
|
|
|
224
230
|
connectionId: string;
|
|
225
231
|
contextWindow?: number | null;
|
|
226
232
|
}>;
|
|
227
|
-
/**
|
|
233
|
+
/**
|
|
234
|
+
* Singleton kinds, e.g. embeddings.
|
|
235
|
+
* @ruling 01 §10
|
|
236
|
+
*/
|
|
228
237
|
activeConnection: Record<string, string | null>;
|
|
229
238
|
/**
|
|
230
239
|
* The instance's default sampling config per kind — the same keys
|
|
@@ -278,18 +287,23 @@ export declare function resolveConfigSources(world: ConfigWorld, nodeKeys: strin
|
|
|
278
287
|
/** Effective config = base ⊕ overrides, per (nodeKey, slot, path). @internal */
|
|
279
288
|
export declare function resolveConfig(world: ConfigWorld, nodeKeys: string[]): ResolvedConfig;
|
|
280
289
|
/**
|
|
281
|
-
* Which scopes may write which slot
|
|
290
|
+
* Which scopes may write which slot. The admin cascade needs no mechanism:
|
|
282
291
|
* connection has no writable scope below the config for a non-admin, so an
|
|
283
292
|
* admin's choice reaches everyone automatically.
|
|
284
293
|
*
|
|
285
294
|
* `config` here is the selected config — the one place an administrator's
|
|
286
|
-
* edit lands (
|
|
295
|
+
* edit lands (`instance` was folded into it, 2026-09-16). A slot a session may
|
|
287
296
|
* not write is a slot only the config carries.
|
|
288
297
|
* @internal
|
|
298
|
+
* @ruling 12 §4, R-10
|
|
289
299
|
*/
|
|
290
300
|
export declare const WRITE_MATRIX: Record<string, ScopeKind[]>;
|
|
291
301
|
/** @internal */
|
|
292
302
|
export declare function mayWrite(slot: string, scope: ScopeKind): boolean;
|
|
293
|
-
/**
|
|
303
|
+
/**
|
|
304
|
+
* Reject a write the matrix forbids, with the reason.
|
|
305
|
+
* @experimental
|
|
306
|
+
* @ruling 15 §1.3
|
|
307
|
+
*/
|
|
294
308
|
export declare function assertWritable(slot: string, scope: ScopeKind): void;
|
|
295
309
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Configuration resolution
|
|
2
|
+
* Configuration resolution. Four layers, first hit wins, evaluated
|
|
3
3
|
* independently per path — which is what makes an admin's connection change reach a
|
|
4
|
-
* user who has customized their prompts
|
|
4
|
+
* user who has customized their prompts.
|
|
5
5
|
*
|
|
6
|
-
* ## The chain (
|
|
6
|
+
* ## The chain (ruled 2026-09-15)
|
|
7
7
|
*
|
|
8
8
|
* **`session · config · defaults · author`.**
|
|
9
9
|
*
|
|
10
10
|
* - `session` — a session's own override of a value (the *chat override* of
|
|
11
|
-
*
|
|
11
|
+
* the "pipeline → config → chat override").
|
|
12
12
|
* - `config` — the rows of the **selected config**: the config IS the
|
|
13
13
|
* instance's tuning. An administrator's edit lands in the config (ruled
|
|
14
14
|
* 2026-08-24), so there is no separate `instance` layer for it to be shadowed
|
|
@@ -20,19 +20,20 @@
|
|
|
20
20
|
* - `author` — the definition's declared parameter defaults; the floor.
|
|
21
21
|
*
|
|
22
22
|
* `user` and `instance` stood in this list until 2026-09-16 and were pushed by
|
|
23
|
-
* nothing: `world.ts` never projected a row at either
|
|
23
|
+
* nothing: `world.ts` never projected a row at either. Their
|
|
24
24
|
* semantics fold into `config` — the config an admin edits is the instance's
|
|
25
25
|
* configuration — which is the 2026-08-24 ruling stated as a constant.
|
|
26
26
|
*
|
|
27
27
|
* Resolved run-wide *before* execution, which is why referencing another node's
|
|
28
|
-
* config is not a data edge
|
|
28
|
+
* config is not a data edge.
|
|
29
29
|
*
|
|
30
|
-
* ## `config`, not `preset`
|
|
30
|
+
* ## `config`, not `preset`
|
|
31
31
|
*
|
|
32
32
|
* Two other things are called a preset — a **session preset** (the bundle a
|
|
33
33
|
* session is born on) and an author's `.preset(…)` on a spec — and neither is
|
|
34
34
|
* this layer, so the scope takes the canon's word for what it holds: the
|
|
35
35
|
* **config**.
|
|
36
|
+
* @ruling 12 §2, F20, R-10, 09-B B8, 12 §2, plans/29a §3, F35, R1
|
|
36
37
|
*/
|
|
37
38
|
/** @internal */
|
|
38
39
|
export const SCOPE_ORDER = ['session', 'config', 'defaults', 'author'];
|
|
@@ -177,14 +178,15 @@ export function resolveConfig(world, nodeKeys) {
|
|
|
177
178
|
return out;
|
|
178
179
|
}
|
|
179
180
|
/**
|
|
180
|
-
* Which scopes may write which slot
|
|
181
|
+
* Which scopes may write which slot. The admin cascade needs no mechanism:
|
|
181
182
|
* connection has no writable scope below the config for a non-admin, so an
|
|
182
183
|
* admin's choice reaches everyone automatically.
|
|
183
184
|
*
|
|
184
185
|
* `config` here is the selected config — the one place an administrator's
|
|
185
|
-
* edit lands (
|
|
186
|
+
* edit lands (`instance` was folded into it, 2026-09-16). A slot a session may
|
|
186
187
|
* not write is a slot only the config carries.
|
|
187
188
|
* @internal
|
|
189
|
+
* @ruling 12 §4, R-10
|
|
188
190
|
*/
|
|
189
191
|
export const WRITE_MATRIX = {
|
|
190
192
|
// A session names no connection (ruled 2026-09-30): the pair a step runs
|
|
@@ -210,13 +212,21 @@ export const WRITE_MATRIX = {
|
|
|
210
212
|
// reports cannot be compared. Same scopes as `template`; widening to
|
|
211
213
|
// session later is one entry here, additively (18 §4a).
|
|
212
214
|
scripts: ['config'],
|
|
215
|
+
// A loadout is the engine a step runs on (I12) — compute, like the
|
|
216
|
+
// connection beside it, so only the configuration may name one. A session
|
|
217
|
+
// never picks a loadout (09-30: a session never picks a connection).
|
|
218
|
+
loadout: ['config'],
|
|
213
219
|
};
|
|
214
220
|
/** @internal */
|
|
215
221
|
export function mayWrite(slot, scope) {
|
|
216
222
|
const kind = scopeKindOf(scope);
|
|
217
223
|
return kind !== undefined && (WRITE_MATRIX[slot] ?? []).includes(kind);
|
|
218
224
|
}
|
|
219
|
-
/**
|
|
225
|
+
/**
|
|
226
|
+
* Reject a write the matrix forbids, with the reason.
|
|
227
|
+
* @experimental
|
|
228
|
+
* @ruling 15 §1.3
|
|
229
|
+
*/
|
|
220
230
|
export function assertWritable(slot, scope) {
|
|
221
231
|
if (!mayWrite(slot, scope)) {
|
|
222
232
|
throw new Error(`scope '${scope}' may not write slot '${slot}'. ` +
|
package/dist/connections.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* What an import has to wire before it can run — the ruling on
|
|
2
|
+
* What an import has to wire before it can run — the ruling on connection bindings.
|
|
3
3
|
*
|
|
4
4
|
* The question was whether connection bindings deserve their own table, so that an
|
|
5
5
|
* export could state *structurally* that connections were excluded rather than relying
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* **Ruled: no table.** A second table implies a second lifecycle — its own ids, its own
|
|
9
9
|
* ownership rules, its own migration — and there isn't one. A connection binding is a
|
|
10
|
-
* config value at instance scope, which
|
|
10
|
+
* config value at instance scope, which the config chain already owns.
|
|
11
11
|
*
|
|
12
12
|
* The guarantee people wanted from the table is available without it, and stronger. A
|
|
13
13
|
* table could only ever report the connections the exporting instance had *filled in*,
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* importer would find out at the first run. Slots are declared on the **type**, so
|
|
16
16
|
* deriving the requirement from descriptors is complete by construction — independent of
|
|
17
17
|
* what the exporter did, and independent of whether the exporter was even configured.
|
|
18
|
+
* @ruling 13 §10a, 12
|
|
18
19
|
*/
|
|
19
20
|
import type { SpecDocument } from './document.js';
|
|
20
21
|
import { type CapabilityId, type CapabilitySet, type Verdict } from './capabilities.js';
|
|
@@ -22,7 +23,10 @@ import { type CapabilityId, type CapabilitySet, type Verdict } from './capabilit
|
|
|
22
23
|
export interface ConnectionRequirement {
|
|
23
24
|
nodeKey: string;
|
|
24
25
|
slot: string;
|
|
25
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Which connection kind satisfies it — the produced shape.
|
|
28
|
+
* @ruling F17
|
|
29
|
+
*/
|
|
26
30
|
kind?: string;
|
|
27
31
|
definitionId: string;
|
|
28
32
|
/** What the connection must be able to do. Unmet is a hard failure at bind. */
|
|
@@ -41,10 +45,11 @@ export declare function requiredConnections(doc: SpecDocument): ConnectionRequir
|
|
|
41
45
|
/**
|
|
42
46
|
* What is still unwired, given what the importing instance has bound so far.
|
|
43
47
|
*
|
|
44
|
-
* Feeds `needs-configuration
|
|
48
|
+
* Feeds `needs-configuration`, which is deliberately not `broken`. A spec nobody
|
|
45
49
|
* has given a connection is not damaged, it is unfinished — and the difference decides
|
|
46
50
|
* whether a user files a bug or opens settings.
|
|
47
51
|
* @experimental
|
|
52
|
+
* @ruling 12 §6
|
|
48
53
|
*/
|
|
49
54
|
export declare function unwiredConnections(doc: SpecDocument, bound: ReadonlyArray<{
|
|
50
55
|
nodeKey: string;
|