@serene-pub/sdk 0.6.0-pr-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +17 -0
- package/README.md +368 -0
- package/dist/actions.d.ts +572 -0
- package/dist/actions.js +829 -0
- package/dist/annexFields.d.ts +234 -0
- package/dist/annexFields.js +413 -0
- package/dist/announce.d.ts +464 -0
- package/dist/announce.js +426 -0
- package/dist/attributes.d.ts +670 -0
- package/dist/attributes.js +904 -0
- package/dist/bands.d.ts +125 -0
- package/dist/bands.js +256 -0
- package/dist/builder.d.ts +683 -0
- package/dist/builder.js +677 -0
- package/dist/candidates.d.ts +109 -0
- package/dist/candidates.js +118 -0
- package/dist/capabilities.d.ts +744 -0
- package/dist/capabilities.js +679 -0
- package/dist/channels.d.ts +106 -0
- package/dist/channels.js +129 -0
- package/dist/clauses.d.ts +40 -0
- package/dist/clauses.js +43 -0
- package/dist/component.d.ts +33 -0
- package/dist/component.js +27 -0
- package/dist/componentBuild.d.ts +48 -0
- package/dist/componentBuild.js +84 -0
- package/dist/componentClient.d.ts +100 -0
- package/dist/componentClient.js +13 -0
- package/dist/componentImports.d.ts +51 -0
- package/dist/componentImports.js +106 -0
- package/dist/componentModule.d.ts +8 -0
- package/dist/componentModule.js +270 -0
- package/dist/componentWire.d.ts +130 -0
- package/dist/componentWire.js +280 -0
- package/dist/config.d.ts +295 -0
- package/dist/config.js +231 -0
- package/dist/connections.d.ts +89 -0
- package/dist/connections.js +131 -0
- package/dist/declarations.d.ts +290 -0
- package/dist/declarations.js +794 -0
- package/dist/descriptors.d.ts +1774 -0
- package/dist/descriptors.js +1329 -0
- package/dist/dev.d.ts +136 -0
- package/dist/dev.js +161 -0
- package/dist/document.d.ts +202 -0
- package/dist/document.js +312 -0
- package/dist/engines.d.ts +117 -0
- package/dist/engines.js +203 -0
- package/dist/eventMapLaws.d.ts +63 -0
- package/dist/eventMapLaws.js +128 -0
- package/dist/events.d.ts +554 -0
- package/dist/events.js +633 -0
- package/dist/executor.d.ts +771 -0
- package/dist/executor.js +1829 -0
- package/dist/extension.d.ts +448 -0
- package/dist/extension.js +315 -0
- package/dist/facets.d.ts +53 -0
- package/dist/facets.js +60 -0
- package/dist/foldedSections.d.ts +74 -0
- package/dist/foldedSections.js +161 -0
- package/dist/genres.d.ts +507 -0
- package/dist/genres.js +633 -0
- package/dist/guardedConnection.d.ts +138 -0
- package/dist/guardedConnection.js +341 -0
- package/dist/handlebarsReach.d.ts +122 -0
- package/dist/handlebarsReach.js +222 -0
- package/dist/hash.d.ts +146 -0
- package/dist/hash.js +166 -0
- package/dist/hookGrants.d.ts +47 -0
- package/dist/hookGrants.js +68 -0
- package/dist/hooks.d.ts +290 -0
- package/dist/hooks.js +113 -0
- package/dist/hostElements.d.ts +447 -0
- package/dist/hostElements.js +702 -0
- package/dist/i18n.d.ts +94 -0
- package/dist/i18n.js +123 -0
- package/dist/identity.d.ts +93 -0
- package/dist/identity.js +135 -0
- package/dist/index.d.ts +85 -0
- package/dist/index.js +176 -0
- package/dist/layout.d.ts +194 -0
- package/dist/layout.js +40 -0
- package/dist/media.d.ts +202 -0
- package/dist/media.js +70 -0
- package/dist/messageBlocks.d.ts +487 -0
- package/dist/messageBlocks.js +683 -0
- package/dist/migration.d.ts +128 -0
- package/dist/migration.js +261 -0
- package/dist/names.d.ts +78 -0
- package/dist/names.js +136 -0
- package/dist/nodeInput.d.ts +399 -0
- package/dist/nodeInput.js +178 -0
- package/dist/participants.d.ts +291 -0
- package/dist/participants.js +252 -0
- package/dist/personGate.d.ts +62 -0
- package/dist/personGate.js +77 -0
- package/dist/pick.d.ts +84 -0
- package/dist/pick.js +103 -0
- package/dist/pluginHarness.d.ts +235 -0
- package/dist/pluginHarness.js +558 -0
- package/dist/pluginPermissions.d.ts +25 -0
- package/dist/pluginPermissions.js +97 -0
- package/dist/pluginRuleRef.d.ts +13 -0
- package/dist/pluginRuleRef.js +10 -0
- package/dist/predicates.d.ts +182 -0
- package/dist/predicates.js +249 -0
- package/dist/preview.d.ts +120 -0
- package/dist/preview.js +82 -0
- package/dist/promptBlocks.d.ts +130 -0
- package/dist/promptBlocks.js +197 -0
- package/dist/rankingDecisions.d.ts +60 -0
- package/dist/rankingDecisions.js +48 -0
- package/dist/receipt.d.ts +313 -0
- package/dist/receipt.js +60 -0
- package/dist/receiverRules.d.ts +24 -0
- package/dist/receiverRules.js +94 -0
- package/dist/refs.d.ts +117 -0
- package/dist/refs.js +137 -0
- package/dist/registry.d.ts +230 -0
- package/dist/registry.js +273 -0
- package/dist/review.d.ts +108 -0
- package/dist/review.js +97 -0
- package/dist/sampling.d.ts +152 -0
- package/dist/sampling.js +712 -0
- package/dist/scope.d.ts +65 -0
- package/dist/scope.js +128 -0
- package/dist/scripts.d.ts +243 -0
- package/dist/scripts.js +326 -0
- package/dist/sessionLayout.d.ts +339 -0
- package/dist/sessionLayout.js +503 -0
- package/dist/sessionSettings.d.ts +70 -0
- package/dist/sessionSettings.js +2 -0
- package/dist/settings.d.ts +501 -0
- package/dist/settings.js +604 -0
- package/dist/settingsSlot.d.ts +108 -0
- package/dist/settingsSlot.js +166 -0
- package/dist/shapes.d.ts +373 -0
- package/dist/shapes.js +408 -0
- package/dist/sheets.d.ts +165 -0
- package/dist/sheets.js +251 -0
- package/dist/statShapes.d.ts +96 -0
- package/dist/statShapes.js +112 -0
- package/dist/status.d.ts +103 -0
- package/dist/status.js +125 -0
- package/dist/storage.d.ts +145 -0
- package/dist/storage.js +33 -0
- package/dist/storyTime.d.ts +308 -0
- package/dist/storyTime.js +560 -0
- package/dist/surfaces.d.ts +501 -0
- package/dist/surfaces.js +292 -0
- package/dist/template.d.ts +312 -0
- package/dist/template.js +554 -0
- package/dist/templateCheck.d.ts +60 -0
- package/dist/templateCheck.js +516 -0
- package/dist/templateFit.d.ts +157 -0
- package/dist/templateFit.js +349 -0
- package/dist/templateIds.d.ts +138 -0
- package/dist/templateIds.js +144 -0
- package/dist/templateScopeAt.d.ts +131 -0
- package/dist/templateScopeAt.js +354 -0
- package/dist/testing.d.ts +177 -0
- package/dist/testing.js +383 -0
- package/dist/tokenizers.d.ts +113 -0
- package/dist/tokenizers.js +184 -0
- package/dist/turnLock.d.ts +96 -0
- package/dist/turnLock.js +79 -0
- package/dist/turnOrder.d.ts +143 -0
- package/dist/turnOrder.js +128 -0
- package/dist/validate.d.ts +74 -0
- package/dist/validate.js +1399 -0
- package/dist/values.d.ts +212 -0
- package/dist/values.js +390 -0
- package/dist/variables.d.ts +493 -0
- package/dist/variables.js +662 -0
- package/dist/verdicts.d.ts +275 -0
- package/dist/verdicts.js +348 -0
- package/dist/widgetDecls.d.ts +88 -0
- package/dist/widgetDecls.js +119 -0
- package/dist/widgets.d.ts +1527 -0
- package/dist/widgets.js +208 -0
- package/dist/wire.d.ts +126 -0
- package/dist/wire.js +140 -0
- package/dist/worldinfo.d.ts +150 -0
- package/dist/worldinfo.js +212 -0
- package/host-elements.d.ts +914 -0
- package/package.json +67 -0
|
@@ -0,0 +1,464 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* announce() — the serializer behind `defineExtension()` (R48, T1b). A package
|
|
3
|
+
* is authored with `defineExtension()`; `announcementOf()` compiles that to the
|
|
4
|
+
* announcement document this builder produces. Kept exported for core's and
|
|
5
|
+
* the CLI's use, and for one release of packages still exporting a builder.
|
|
6
|
+
*
|
|
7
|
+
* Was: "the ONE authoring surface" (24 §6).
|
|
8
|
+
*
|
|
9
|
+
* A package is an announcement: identity first, then everything it declares —
|
|
10
|
+
* genres, hook declarations, pipelines, configs, presets. Plugins compile the
|
|
11
|
+
* announcement via the CLI (the announcement IS the manifest); SP core
|
|
12
|
+
* authors the same announcement in-repo and compiles it at boot/seed. One
|
|
13
|
+
* validator, one document shape, one hash discipline.
|
|
14
|
+
*
|
|
15
|
+
* The builder hands authors a **context-bound toolkit**: value kinds, genres
|
|
16
|
+
* and hooks minted through it are namespaced under the package id, so
|
|
17
|
+
* collision with core or another package is impossible by construction.
|
|
18
|
+
*
|
|
19
|
+
* Cross-package references are ids with the referenced thing's owner in them
|
|
20
|
+
* (`use()` handles compile down to these). Referencing something external is
|
|
21
|
+
* allowed and recorded; what the instance enforces at install is the
|
|
22
|
+
* requirement, not the bundle (24 §10).
|
|
23
|
+
*/
|
|
24
|
+
import type { BuiltSpec } from './builder.js';
|
|
25
|
+
import { type SpecDocument } from './document.js';
|
|
26
|
+
/** announce() accepts pipelines built or already compiled — one shape lands. @experimental */
|
|
27
|
+
export type AnnouncedSpec = BuiltSpec | SpecDocument;
|
|
28
|
+
/**
|
|
29
|
+
* A reference to something another package ships (24 §10): an id plus an
|
|
30
|
+
* optional semver range. `use()` handles compile to references in the
|
|
31
|
+
* document and requirements in the manifest — never a bundle. The
|
|
32
|
+
* fully-typed form (option autocomplete off the published declaration
|
|
33
|
+
* artifact's generated .d.ts) rides the artifact work; this is the
|
|
34
|
+
* reference primitive both share.
|
|
35
|
+
* @experimental
|
|
36
|
+
*/
|
|
37
|
+
export interface ExternalRef {
|
|
38
|
+
readonly kind: 'external-ref';
|
|
39
|
+
/** The referenced id, range stripped — what documents store. */
|
|
40
|
+
readonly id: string;
|
|
41
|
+
/** The semver range the manifest requires, e.g. '^2'. */
|
|
42
|
+
readonly range?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* An external reference carrying its target's option space in the type —
|
|
46
|
+
* what the generated typings (`serene-pub types`) produce, so a config over
|
|
47
|
+
* another package's pipeline autocompletes node → slot → field (24 T7b).
|
|
48
|
+
* The phantom never exists at runtime; the document still stores the id.
|
|
49
|
+
* @experimental
|
|
50
|
+
*/
|
|
51
|
+
export interface TypedExternalRef<T> extends ExternalRef {
|
|
52
|
+
readonly __options?: T;
|
|
53
|
+
}
|
|
54
|
+
/** Three-level partial: node → slot → fields, all optional — deltas only. @experimental */
|
|
55
|
+
export type PartialValues<T> = {
|
|
56
|
+
[N in keyof T]?: {
|
|
57
|
+
[S in keyof T[N]]?: T[N][S] extends Record<string, unknown> ? Partial<T[N][S]> : T[N][S];
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/** @public */
|
|
61
|
+
export declare function use(ref: string): ExternalRef;
|
|
62
|
+
/**
|
|
63
|
+
* A spec as a declaration names it: one this package ships, built or
|
|
64
|
+
* compiled, or another package's, through `use()`. Never a bare id — a string
|
|
65
|
+
* is a typo waiting for an install to find it.
|
|
66
|
+
* @experimental
|
|
67
|
+
*/
|
|
68
|
+
export type SpecRef = AnnouncedSpec | ExternalRef;
|
|
69
|
+
/** The id a `SpecRef` names; a bare string is refused with the fix. @experimental */
|
|
70
|
+
export declare function specIdOf(v: unknown, where: string): string;
|
|
71
|
+
import { type GenreDecl, type GenreProps } from './genres.js';
|
|
72
|
+
import { type SessionEventDecl } from './events.js';
|
|
73
|
+
import { type ValueToolkit } from './values.js';
|
|
74
|
+
import type { ComponentDecl, Extension } from './extension.js';
|
|
75
|
+
import type { SurfacesDecl } from './surfaces.js';
|
|
76
|
+
import { type I18n } from './i18n.js';
|
|
77
|
+
import { type StoredSwapContribution, type SwapContribution } from './declarations.js';
|
|
78
|
+
/** @experimental */
|
|
79
|
+
export interface PackageIdentity {
|
|
80
|
+
/** The package namespace every declared id lives under — `core`, `acme.dice`. */
|
|
81
|
+
ns: string;
|
|
82
|
+
author: string;
|
|
83
|
+
/** What the package is called where it is listed — a string or a locale map with `en` (R-20). */
|
|
84
|
+
title: I18n;
|
|
85
|
+
repo?: string;
|
|
86
|
+
summary?: I18n;
|
|
87
|
+
description?: I18n;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* A hook *declaration* (24 §11): identity, event, contract, ordering. The
|
|
91
|
+
* implementation lives with its capabilities — core's in core, a plugin's in
|
|
92
|
+
* its sandboxed bundle — and boot/install binds implementation to declared id
|
|
93
|
+
* with a completeness check.
|
|
94
|
+
* @experimental
|
|
95
|
+
*/
|
|
96
|
+
export interface HookDeclaration {
|
|
97
|
+
event: string;
|
|
98
|
+
description?: unknown;
|
|
99
|
+
/** Ordering constraints against other hook ids. */
|
|
100
|
+
before?: string[];
|
|
101
|
+
after?: string[];
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A shipped prompt (24 T6b): authored prose for one NODE's prompts slot,
|
|
105
|
+
* selectable wherever that node is used. The slug is the stable identity an
|
|
106
|
+
* instance's seed pass matches on; the label is display.
|
|
107
|
+
*
|
|
108
|
+
* Keyed by the node rather than by a spec, because a prompt follows the node it
|
|
109
|
+
* was written for: a pipeline that reuses somebody's summarize step inherits
|
|
110
|
+
* the prompts written for it, and one built from other nodes is offered none of
|
|
111
|
+
* them. Spec scoping said the same thing less precisely and cost the reuse.
|
|
112
|
+
* @experimental
|
|
113
|
+
*/
|
|
114
|
+
export interface PromptDecl {
|
|
115
|
+
/**
|
|
116
|
+
* The pool: an UNVERSIONED node type id (`core:task/build-template-context`),
|
|
117
|
+
* which may belong to another package. Unversioned so a node's @1 → @2 does
|
|
118
|
+
* not strand the prose written for it.
|
|
119
|
+
*/
|
|
120
|
+
nodeType: string;
|
|
121
|
+
/**
|
|
122
|
+
* The pool's second half — which prompts slot on that node. A type may
|
|
123
|
+
* declare more than one, each with its own field set.
|
|
124
|
+
*/
|
|
125
|
+
slot: string;
|
|
126
|
+
slug: string;
|
|
127
|
+
/** The name a picker lists it by — a string or a locale map with `en` (R-20). */
|
|
128
|
+
label: I18n;
|
|
129
|
+
/** Field name → prose, exactly as that slot declares them. */
|
|
130
|
+
fields: Record<string, string>;
|
|
131
|
+
}
|
|
132
|
+
/** A named configuration: a typed delta over a spec's author defaults (24 §7). @experimental */
|
|
133
|
+
export interface ConfigDecl {
|
|
134
|
+
/** The spec it configures — may be external (another package's id). */
|
|
135
|
+
spec: string;
|
|
136
|
+
slug: string;
|
|
137
|
+
/** The name a picker lists it by — a string or a locale map with `en` (R-20). */
|
|
138
|
+
label: I18n;
|
|
139
|
+
description?: I18n;
|
|
140
|
+
/** nodeKey → slot → value. Only deviations; everything else inherits. */
|
|
141
|
+
values: Record<string, Record<string, unknown>>;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* A config as authored: the spec it configures is a value, so a
|
|
145
|
+
* preset binding can check that the config it names was made for the spec
|
|
146
|
+
* it binds. `config()` makes one; the entry stores it as a `ConfigDecl`.
|
|
147
|
+
* @experimental
|
|
148
|
+
*/
|
|
149
|
+
export interface ConfigInput<T = Record<string, Record<string, unknown>>> {
|
|
150
|
+
readonly spec: SpecRef | TypedExternalRef<T>;
|
|
151
|
+
slug: string;
|
|
152
|
+
label: I18n;
|
|
153
|
+
description?: I18n;
|
|
154
|
+
values: PartialValues<T>;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Author a config against a spec value, or another package's through `use()`.
|
|
158
|
+
* With a spec value the node keys are checked at build; through `use()` they
|
|
159
|
+
* are recorded and checked by the instance that has the spec.
|
|
160
|
+
* @experimental
|
|
161
|
+
*/
|
|
162
|
+
export declare function config<T = Record<string, Record<string, unknown>>>(spec: SpecRef | TypedExternalRef<T>, slug: string, meta: {
|
|
163
|
+
label: I18n;
|
|
164
|
+
description?: I18n;
|
|
165
|
+
}, values: PartialValues<T>): ConfigInput<T>;
|
|
166
|
+
/** The stored form of a config — the spec read down to its id. @experimental */
|
|
167
|
+
export declare function storedConfig(c: ConfigInput<any>): ConfigDecl;
|
|
168
|
+
/** One event slot's binding: which pipeline answers, with which config. @experimental */
|
|
169
|
+
export interface PresetBinding {
|
|
170
|
+
spec: string;
|
|
171
|
+
/** A config slug of that spec. Absent = the spec's shipped default. */
|
|
172
|
+
config?: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* What a preset pre-fills the creation form with (23 §9).
|
|
176
|
+
*
|
|
177
|
+
* Every key optional and every key advisory: the form applies the ones it
|
|
178
|
+
* recognises, type-checks each, and ignores the rest — so a preset written
|
|
179
|
+
* against a newer genre than the instance has can still be started, and a
|
|
180
|
+
* genre's own fields ride along in `genreFields` rather than growing this
|
|
181
|
+
* shape a key at a time.
|
|
182
|
+
* @experimental
|
|
183
|
+
*/
|
|
184
|
+
export interface PresetDefaults {
|
|
185
|
+
name?: string;
|
|
186
|
+
scenario?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Swaps to seat the session with (R40): for each, a definition the named
|
|
189
|
+
* spec offers on the named node — its pin or one of its `expose.swaps`,
|
|
190
|
+
* or an enabled contribution. The same shape a package contributes with
|
|
191
|
+
* (`SwapContribution`), stored with ids:
|
|
192
|
+
* `{ spec: chatTurnOrder, node: 'decide.rules.strategy', definition: C.turnManual }`.
|
|
193
|
+
* Written as the session's rebinds at create; an entry the node does not
|
|
194
|
+
* offer is refused there, logged, and the session starts on the pin.
|
|
195
|
+
* Replaced `speakerStrategy` (2026-09-23), which named one node.
|
|
196
|
+
*/
|
|
197
|
+
swaps?: StoredSwapContribution[];
|
|
198
|
+
lorebookId?: number | null;
|
|
199
|
+
tags?: string[];
|
|
200
|
+
/** The genre's declared fields, by key. */
|
|
201
|
+
genreFields?: Record<string, unknown>;
|
|
202
|
+
/**
|
|
203
|
+
* Envoys to seat on creation, by slug (R-18; U5g) — beside the genre's
|
|
204
|
+
* `default: true` ones, which are seated with no choice. A slug the
|
|
205
|
+
* genre (or an installed action) does not declare is ignored, on the
|
|
206
|
+
* same advisory terms as every other key here.
|
|
207
|
+
*/
|
|
208
|
+
envoys?: string[];
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* A preset populates a genre's event slots (24 §1): for each event the genre
|
|
212
|
+
* declares, which pipeline variant answers it, with which config.
|
|
213
|
+
* @experimental
|
|
214
|
+
*/
|
|
215
|
+
export interface PresetDecl {
|
|
216
|
+
slug: string;
|
|
217
|
+
genre: string;
|
|
218
|
+
/** The name the picker lists it by — a string or a locale map with `en` (R-20). */
|
|
219
|
+
label: I18n;
|
|
220
|
+
description?: I18n;
|
|
221
|
+
bindings: Record<string, PresetBinding>;
|
|
222
|
+
/**
|
|
223
|
+
* For the open `session-action` slot: which actions come along, each by
|
|
224
|
+
* its **identity** — `<spec slug>#<key>` (U5c review, W-A). A preset
|
|
225
|
+
* curates declarations, never functions: two specs contributing one
|
|
226
|
+
* function are two entries, and including one says nothing about the
|
|
227
|
+
* other. Absent means the host's companion rule (every action from the
|
|
228
|
+
* genre owner's own namespace).
|
|
229
|
+
*/
|
|
230
|
+
actions?: {
|
|
231
|
+
include: string[];
|
|
232
|
+
};
|
|
233
|
+
/** What starting from this preset pre-fills the creation form with. */
|
|
234
|
+
defaults?: PresetDefaults;
|
|
235
|
+
/**
|
|
236
|
+
* Whether the instance should offer this preset the moment the package is
|
|
237
|
+
* enabled. **Absent means no**, and that is the interesting half.
|
|
238
|
+
*
|
|
239
|
+
* A preset is what a non-admin picks from, so a package that installed one
|
|
240
|
+
* straight into everybody's picker would be deciding, on the administrator's
|
|
241
|
+
* behalf, what this instance offers. So the projection lands it disabled and
|
|
242
|
+
* an administrator switches it on — the same shape as a declared permission,
|
|
243
|
+
* which is also announced by the package and granted by the instance.
|
|
244
|
+
*
|
|
245
|
+
* Setting it is a request, not a grant: an instance is free to ignore it,
|
|
246
|
+
* and an administrator who has already disabled a preset keeps that decision
|
|
247
|
+
* across upgrades.
|
|
248
|
+
*/
|
|
249
|
+
enabled?: boolean;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* One binding in a preset: a spec value, bound on every event its inlet
|
|
253
|
+
* lock answers, or `{ spec, config?, events? }`. `events` narrows a lock over
|
|
254
|
+
* several events, and is required for another package's spec (`use()`),
|
|
255
|
+
* whose lock this build cannot read. The stored form is keyed by event.
|
|
256
|
+
* @experimental
|
|
257
|
+
*/
|
|
258
|
+
export type BindingEntry = AnnouncedSpec | {
|
|
259
|
+
spec: SpecRef;
|
|
260
|
+
config?: ConfigInput<any>;
|
|
261
|
+
events?: string[];
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* An action a preset brings along: a spec value, for every action it
|
|
265
|
+
* contributes, or `{ spec, key }` for one of them. Stored as the action
|
|
266
|
+
* identity, `<spec slug>#<key>`.
|
|
267
|
+
* @experimental
|
|
268
|
+
*/
|
|
269
|
+
export type ActionPick = AnnouncedSpec | {
|
|
270
|
+
spec: SpecRef;
|
|
271
|
+
key: string;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Who may record a package's event, as authored: a binding subject — an
|
|
275
|
+
* event id of the genre (`sessionEvents.messageRespond`), an action pick
|
|
276
|
+
* (`{ spec, key }`), or a spec value, which stands for every subject its
|
|
277
|
+
* inlet lock serves.
|
|
278
|
+
* @experimental
|
|
279
|
+
*/
|
|
280
|
+
export type RecordedByEntry = string | ActionPick;
|
|
281
|
+
/** A package's event and its recording scope, as authored in `defineExtension({ events })`. @experimental */
|
|
282
|
+
export interface EventDeclarationInput {
|
|
283
|
+
event: SessionEventDecl;
|
|
284
|
+
genre: GenreDecl | ExternalRef;
|
|
285
|
+
/** The subjects whose pipelines may record it, or `'any'` for every spec. */
|
|
286
|
+
recordedBy: readonly RecordedByEntry[] | 'any';
|
|
287
|
+
}
|
|
288
|
+
/** An event declaration as stored in the manifest and the announcement: ids throughout. @experimental */
|
|
289
|
+
export interface StoredEventDeclaration {
|
|
290
|
+
event: string;
|
|
291
|
+
payload: string;
|
|
292
|
+
name: I18n;
|
|
293
|
+
description: I18n;
|
|
294
|
+
domain: 'session';
|
|
295
|
+
genre: string;
|
|
296
|
+
/** Event ids and action identities (`<spec slug>#<key>`), or `'any'`. */
|
|
297
|
+
recordedBy: string[] | 'any';
|
|
298
|
+
}
|
|
299
|
+
/** The stored form of an event declaration; throws the first mistake, with the fix. @experimental */
|
|
300
|
+
export declare function storedEventDeclaration(d: EventDeclarationInput): StoredEventDeclaration;
|
|
301
|
+
/** `PresetDefaults` as authored: swaps name their spec by value. @experimental */
|
|
302
|
+
export type PresetDefaultsInput = Omit<PresetDefaults, 'swaps'> & {
|
|
303
|
+
swaps?: SwapContribution[];
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* A preset as authored: the genre, the bound specs, their configs and
|
|
307
|
+
* the included actions are values. The entry (`defineExtension`,
|
|
308
|
+
* `announce().presets`) stores it as a `PresetDecl`, which is unchanged.
|
|
309
|
+
* @experimental
|
|
310
|
+
*/
|
|
311
|
+
export interface PresetInput {
|
|
312
|
+
slug: string;
|
|
313
|
+
genre: GenreDecl | ExternalRef;
|
|
314
|
+
/** The name the picker lists it by — a string or a locale map with `en` (R-20). */
|
|
315
|
+
label: I18n;
|
|
316
|
+
description?: I18n;
|
|
317
|
+
bindings: BindingEntry[];
|
|
318
|
+
/** Absent means the host's companion rule — see `PresetDecl.actions`. */
|
|
319
|
+
actions?: {
|
|
320
|
+
include: ActionPick[];
|
|
321
|
+
};
|
|
322
|
+
defaults?: PresetDefaultsInput;
|
|
323
|
+
/** Ask the instance to offer this preset immediately. See `PresetDecl.enabled`. */
|
|
324
|
+
enabled?: boolean;
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* The stored form of a preset. Every reference is read down to its id and
|
|
328
|
+
* checked against what the value says: a binding's events against its spec's
|
|
329
|
+
* lock, a config against the spec it was made for, an action key against
|
|
330
|
+
* the keys the spec declares. Throws the first mistake, with the fix.
|
|
331
|
+
* @experimental
|
|
332
|
+
*/
|
|
333
|
+
export declare function preset(input: PresetInput): PresetDecl;
|
|
334
|
+
/** The compiled announcement — the package's declaration artifact (24 §10). @experimental */
|
|
335
|
+
export interface AnnouncementDocument {
|
|
336
|
+
schemaVersion: 1;
|
|
337
|
+
identity: PackageIdentity;
|
|
338
|
+
genres: GenreDecl[];
|
|
339
|
+
/** Fully-qualified hook id → declaration. */
|
|
340
|
+
hooks: Record<string, HookDeclaration>;
|
|
341
|
+
pipelines: SpecDocument[];
|
|
342
|
+
prompts: PromptDecl[];
|
|
343
|
+
configs: ConfigDecl[];
|
|
344
|
+
presets: PresetDecl[];
|
|
345
|
+
/**
|
|
346
|
+
* Frame surfaces this package ships (20 §12, 21 §7) — the documents an
|
|
347
|
+
* instance mounts in opaque-origin iframes. Absent means the package has
|
|
348
|
+
* no UI of its own, which is the common case.
|
|
349
|
+
*/
|
|
350
|
+
surfaces?: SurfacesDecl;
|
|
351
|
+
/** In-document components (10 §2, virtual tier). */
|
|
352
|
+
components: ComponentDecl[];
|
|
353
|
+
/**
|
|
354
|
+
* Definitions this package offers on other packages' swappable nodes
|
|
355
|
+
* (R29), definitions as ids. Absent when the package contributes none, so
|
|
356
|
+
* a package that declares no swap announces exactly what it did before.
|
|
357
|
+
*/
|
|
358
|
+
swaps?: StoredSwapContribution[];
|
|
359
|
+
/**
|
|
360
|
+
* Events this package declares, with who may record them. Absent
|
|
361
|
+
* when it declares none, so a package without events announces exactly
|
|
362
|
+
* what it did before.
|
|
363
|
+
*/
|
|
364
|
+
events?: StoredEventDeclaration[];
|
|
365
|
+
/** Ids referenced but not declared here — the instance enforces these at install. */
|
|
366
|
+
requires: string[];
|
|
367
|
+
}
|
|
368
|
+
/** One event slot's standing in a preset, for the coverage report (24 §7). @experimental */
|
|
369
|
+
export interface CoverageSlot {
|
|
370
|
+
event: string;
|
|
371
|
+
required: boolean;
|
|
372
|
+
binding?: PresetBinding;
|
|
373
|
+
/**
|
|
374
|
+
* `bound` — filled and verified against the announced spec's input lock;
|
|
375
|
+
* `bound-external` — filled by a reference this package cannot verify
|
|
376
|
+
* (the instance will); `unbound` — an optional slot left empty;
|
|
377
|
+
* `MISSING` — a required slot left empty (also a build error).
|
|
378
|
+
*/
|
|
379
|
+
status: 'bound' | 'bound-external' | 'unbound' | 'MISSING';
|
|
380
|
+
}
|
|
381
|
+
/** @experimental */
|
|
382
|
+
export interface CoverageReport {
|
|
383
|
+
presets: Array<{
|
|
384
|
+
preset: string;
|
|
385
|
+
genre: string;
|
|
386
|
+
slots: CoverageSlot[];
|
|
387
|
+
}>;
|
|
388
|
+
/** Deliberate holes: `todo()` sentinels found in config values. */
|
|
389
|
+
todos: Array<{
|
|
390
|
+
path: string;
|
|
391
|
+
note: string;
|
|
392
|
+
}>;
|
|
393
|
+
}
|
|
394
|
+
/** @internal The builder behind `announcementOf()`; author a package with `defineExtension()`. */
|
|
395
|
+
export declare class AnnouncementBuilder {
|
|
396
|
+
readonly identity: PackageIdentity;
|
|
397
|
+
/** The context-bound value toolkit — custom kinds mint under this package. */
|
|
398
|
+
readonly v: ValueToolkit;
|
|
399
|
+
private _genres;
|
|
400
|
+
private _hooks;
|
|
401
|
+
private _pipelines;
|
|
402
|
+
private _configs;
|
|
403
|
+
private _presets;
|
|
404
|
+
private _prompts;
|
|
405
|
+
private _surfaces;
|
|
406
|
+
private _components;
|
|
407
|
+
private _swaps;
|
|
408
|
+
private _events;
|
|
409
|
+
constructor(identity: PackageIdentity);
|
|
410
|
+
/** Context sugar: mints `${ns}:genre/${name}` so the id cannot be mistyped. */
|
|
411
|
+
genre(name: string, props: GenreProps): GenreDecl;
|
|
412
|
+
genres(map: Record<string, GenreDecl>): this;
|
|
413
|
+
/** Declarations only — implementations bind by id per trust domain (24 §11). */
|
|
414
|
+
hooks(map: Record<string, HookDeclaration>): this;
|
|
415
|
+
pipelines(...specs: AnnouncedSpec[]): this;
|
|
416
|
+
configs(...configs: ConfigInput<any>[]): this;
|
|
417
|
+
prompts(...prompts: PromptDecl[]): this;
|
|
418
|
+
presets(...presets: PresetInput[]): this;
|
|
419
|
+
/**
|
|
420
|
+
* The frame surfaces this package ships (20 §12): documents mounted in
|
|
421
|
+
* opaque-origin iframes. Declared, never discovered — an instance renders
|
|
422
|
+
* what the manifest says and `serene-pub preview` renders the same list,
|
|
423
|
+
* so a surface a modder previewed is a surface an instance will offer.
|
|
424
|
+
*/
|
|
425
|
+
surfaces(decl: SurfacesDecl): this;
|
|
426
|
+
/** In-document components (10 §2, virtual tier) — code trust at install. */
|
|
427
|
+
components(...components: ComponentDecl[]): this;
|
|
428
|
+
/**
|
|
429
|
+
* Offer this package's definitions on another package's swappable nodes:
|
|
430
|
+
* `.swaps({ spec: chatTurnOrder, node: 'decide.rules.strategy', definition: myStrategy })`,
|
|
431
|
+
* the spec a value you imported, or `use('<spec id>')`. For a node of this package's own spec, list
|
|
432
|
+
* the swap on the node itself with `expose.swaps` instead.
|
|
433
|
+
*/
|
|
434
|
+
swaps(...contributions: SwapContribution[]): this;
|
|
435
|
+
/**
|
|
436
|
+
* Validate the announcement as a whole and compile it to the document.
|
|
437
|
+
* Errors carry exact paths — the teaching-error pattern (15 §1.3).
|
|
438
|
+
*/
|
|
439
|
+
build(): {
|
|
440
|
+
document: AnnouncementDocument;
|
|
441
|
+
coverage: CoverageReport;
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
/** Build refusal that still carries the coverage — the report is the error's context. @experimental */
|
|
445
|
+
export declare class AnnouncementError extends Error {
|
|
446
|
+
readonly errors: string[];
|
|
447
|
+
readonly coverage: CoverageReport;
|
|
448
|
+
constructor(errors: string[], coverage: CoverageReport);
|
|
449
|
+
}
|
|
450
|
+
/** @internal Author a package with `defineExtension()`; this is the serializer behind it. */
|
|
451
|
+
export declare function announce(identity: PackageIdentity): AnnouncementBuilder;
|
|
452
|
+
/**
|
|
453
|
+
* The announcement document a `defineExtension()` declaration compiles to —
|
|
454
|
+
* what a host syncs and what the coverage report reads. Core declares itself
|
|
455
|
+
* with `defineExtension()` like any package and is announced through this.
|
|
456
|
+
*
|
|
457
|
+
* @internal Author a package with `defineExtension()`; this is the host's
|
|
458
|
+
* view of it.
|
|
459
|
+
*/
|
|
460
|
+
export declare function announcementOf(e: Extension): {
|
|
461
|
+
document: AnnouncementDocument;
|
|
462
|
+
coverage: CoverageReport;
|
|
463
|
+
};
|
|
464
|
+
//# sourceMappingURL=announce.d.ts.map
|