@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
package/dist/index.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
export * from './shapes.js';
|
|
2
|
+
export * from './candidates.js';
|
|
3
|
+
// Display text (R-20): the one `I18n` type, `i18nFindings` every publish door
|
|
4
|
+
// runs, and `i18nText` every reader resolves through.
|
|
5
|
+
export * from './i18n.js';
|
|
6
|
+
// One verdict per law (01 §13): `defineVerdict` / `verdicts()` and the five
|
|
7
|
+
// verdicts whose judges read only leaf vocabulary — the effects line and form
|
|
8
|
+
// staleness are declared in `messageBlocks.ts`, beside the primitives they
|
|
9
|
+
// call. On the barrel because a plugin author's own rules register through
|
|
10
|
+
// the same door, and the conformance kit (C27) enumerates what is registered.
|
|
11
|
+
export * from './verdicts.js';
|
|
12
|
+
export * from './descriptors.js';
|
|
13
|
+
// Handler input types, derived from the contract (ruling 2026-09-10). Beside
|
|
14
|
+
// descriptors because it is the same declaration read from the other end.
|
|
15
|
+
export * from './nodeInput.js';
|
|
16
|
+
export * from './refs.js';
|
|
17
|
+
export * from './media.js';
|
|
18
|
+
export * from './storage.js';
|
|
19
|
+
export * from './scope.js';
|
|
20
|
+
export * from './builder.js';
|
|
21
|
+
export * from './document.js';
|
|
22
|
+
export * from './connections.js';
|
|
23
|
+
export * from './registry.js';
|
|
24
|
+
export * from './dev.js';
|
|
25
|
+
export * from './validate.js';
|
|
26
|
+
export * from './config.js';
|
|
27
|
+
export * from './executor.js';
|
|
28
|
+
export * from './receipt.js';
|
|
29
|
+
export * from './review.js';
|
|
30
|
+
export * from './clauses.js';
|
|
31
|
+
// The one slot the substrate declares (R-9): `enabled` / `review` / a
|
|
32
|
+
// gather's `mode`. Beside review and clauses because it is their switches,
|
|
33
|
+
// declared.
|
|
34
|
+
export * from './settingsSlot.js';
|
|
35
|
+
export * from './messageBlocks.js';
|
|
36
|
+
// A reply's folded sections (B4): the port's checks, where a row keeps them,
|
|
37
|
+
// and the `core:section` part each becomes.
|
|
38
|
+
export * from './foldedSections.js';
|
|
39
|
+
export * from './promptBlocks.js';
|
|
40
|
+
export * from './facets.js';
|
|
41
|
+
export * from './template.js';
|
|
42
|
+
export * from './engines.js';
|
|
43
|
+
// Template ids — the owner-namespaced name a spec references a template row by,
|
|
44
|
+
// and the declaration a plugin ships one under (R19). Beside engines because the
|
|
45
|
+
// two share the `template` kind segment and must be read together.
|
|
46
|
+
export * from './templateIds.js';
|
|
47
|
+
export * from './variables.js';
|
|
48
|
+
// Bands as template variables (typed templates P2): a source declares the
|
|
49
|
+
// bands it publishes; `rendersAt` is what a node's variables slot renders.
|
|
50
|
+
export * from './bands.js';
|
|
51
|
+
// Typed templates P3: what a template slot can reference at one node, typed.
|
|
52
|
+
export * from './templateScopeAt.js';
|
|
53
|
+
// Typed templates P5: does a template fit the node that renders it — the
|
|
54
|
+
// selection refusal, law T1 and the packager's seed check share it. Takes the
|
|
55
|
+
// checker as a value, so the barrel stays dependency-free.
|
|
56
|
+
export * from './templateFit.js';
|
|
57
|
+
// Typed templates P4: what a Handlebars reference reaches at one point — the
|
|
58
|
+
// reading the checker (`/template-check`, which carries the engines) and a
|
|
59
|
+
// host's editor assist share. Dependency-free, so it stays on the barrel.
|
|
60
|
+
export * from './handlebarsReach.js';
|
|
61
|
+
// Attribute slots — the declared vocabulary stats and states are stored
|
|
62
|
+
// against. Beside variables because it is the same idea one layer down: a
|
|
63
|
+
// declaration a template reads through, rather than a shape a node emits.
|
|
64
|
+
export * from './attributes.js';
|
|
65
|
+
// A sheet — the named, ordered bundle of slots a genre or an owner carries.
|
|
66
|
+
// Beside attributes because it is the same registry discipline one level up:
|
|
67
|
+
// a slot says what one value is, a sheet says which values a thing has.
|
|
68
|
+
export * from './sheets.js';
|
|
69
|
+
// Stat shapes — the named FieldDecls a slot's value may take, and the story
|
|
70
|
+
// time a clock/date stat holds. Beside sheets: the same registry discipline,
|
|
71
|
+
// one level down (a sheet names slots, a slot names its shape).
|
|
72
|
+
export * from './statShapes.js';
|
|
73
|
+
export * from './storyTime.js';
|
|
74
|
+
// The turn lock — whether the numbers written for one speaker are still open.
|
|
75
|
+
// In the SDK because the host's write gate, a plugin proposing a change and
|
|
76
|
+
// the client drawing the ledger must answer it identically; see the file.
|
|
77
|
+
export * from './turnLock.js';
|
|
78
|
+
export * from './scripts.js';
|
|
79
|
+
export * from './wire.js';
|
|
80
|
+
export * from './preview.js';
|
|
81
|
+
export * from './migration.js';
|
|
82
|
+
export * from './extension.js';
|
|
83
|
+
export * from './identity.js';
|
|
84
|
+
export * from './events.js';
|
|
85
|
+
export * from './eventMapLaws.js';
|
|
86
|
+
export * from './rankingDecisions.js';
|
|
87
|
+
export * from './values.js';
|
|
88
|
+
export * from './genres.js';
|
|
89
|
+
export * from './announce.js';
|
|
90
|
+
// The checks both authoring surfaces run over what a package declares (D-1).
|
|
91
|
+
// After announce.js, because its declaration types are the ones these read.
|
|
92
|
+
export * from './declarations.js';
|
|
93
|
+
export * from './hooks.js';
|
|
94
|
+
export * from './settings.js';
|
|
95
|
+
export * from './sampling.js';
|
|
96
|
+
export * from './capabilities.js';
|
|
97
|
+
export * from './hookGrants.js';
|
|
98
|
+
export * from './pluginPermissions.js';
|
|
99
|
+
export * from './worldinfo.js';
|
|
100
|
+
// The widget envelope — the sections and verbs every session widget receives,
|
|
101
|
+
// native and frame alike. Before surfaces because the frame wire carries these
|
|
102
|
+
// shapes; `widgets.ts` imports nothing, so neither direction can cycle.
|
|
103
|
+
export * from './widgets.js';
|
|
104
|
+
// The person gate on a widget's invoke of a message-changing core verb — the
|
|
105
|
+
// page's and the harness's one table (imports nothing).
|
|
106
|
+
export * from './personGate.js';
|
|
107
|
+
// Annex fields (2026-09-26): a declared key a widget sets through core's one
|
|
108
|
+
// pipeline — no pipeline per value. Imports participants/settings/i18n only.
|
|
109
|
+
export * from './annexFields.js';
|
|
110
|
+
export * from './surfaces.js';
|
|
111
|
+
// The widget declarations a layout places. Beside surfaces because it is the
|
|
112
|
+
// other half of the same story: a surface is where a plugin renders, a widget
|
|
113
|
+
// is what lands on screen. Imports only types, so `descriptors.ts` can name
|
|
114
|
+
// `WidgetDecl` without a cycle.
|
|
115
|
+
export * from './layout.js';
|
|
116
|
+
// The session layout (`SessionLayoutV1`): the ONE layout format a genre ships,
|
|
117
|
+
// a person arranges and the screen draws, its id readers and its validator.
|
|
118
|
+
export * from './sessionLayout.js';
|
|
119
|
+
// What a component places and imports (§3.5): the host-element vocabulary the
|
|
120
|
+
// receiver enforces, and the import whitelist the compilers enforce.
|
|
121
|
+
export * from './hostElements.js';
|
|
122
|
+
export * from './componentBuild.js';
|
|
123
|
+
// The page's rules on top of that table — whose box it is, and the value
|
|
124
|
+
// judged being the value written — for the page's receiver and the harness.
|
|
125
|
+
export * from './receiverRules.js';
|
|
126
|
+
// …and the guard that applies them to a remote's records, record by record,
|
|
127
|
+
// for the page's receiver and the harness alike (Remote DOM's types only).
|
|
128
|
+
export * from './guardedConnection.js';
|
|
129
|
+
export * from './componentImports.js';
|
|
130
|
+
export * from './componentClient.js';
|
|
131
|
+
export * from './componentWire.js';
|
|
132
|
+
export * from './componentModule.js';
|
|
133
|
+
export * from './channels.js';
|
|
134
|
+
// Participant references — the audience grammar and the inlet's speaker
|
|
135
|
+
// (R-15, R-18 (3)); `Portrayal` is the resolver's answer the receipt pins.
|
|
136
|
+
export * from './participants.js';
|
|
137
|
+
// Turn order as state (PLAN-turn-order §4.2): the candidate, entry and order
|
|
138
|
+
// documents, `EMPTY_TURN_ORDER` and `readTurnOrder`. After participants
|
|
139
|
+
// because a candidate's `ref` is a participant reference.
|
|
140
|
+
export * from './turnOrder.js';
|
|
141
|
+
// The settings document (§4.12): what every run reads its session settings
|
|
142
|
+
// as. After turnOrder because it carries the order's state.
|
|
143
|
+
export * from './sessionSettings.js';
|
|
144
|
+
export * from './actions.js';
|
|
145
|
+
// The predicate core (U5e): `readPath` / `predicateHolds` the junction clause
|
|
146
|
+
// and an action's enabled-when both read, and the enabled-when evaluator the
|
|
147
|
+
// host and the client run against the same published-values document.
|
|
148
|
+
export * from './predicates.js';
|
|
149
|
+
export * from './status.js';
|
|
150
|
+
// On the barrel because core hashes these same declarations a second time, when
|
|
151
|
+
// it projects them into `pipeline_definition_registry` rows. Two answers to "is this
|
|
152
|
+
// the same content?" drifted apart once already — see `declarationMaterial` —
|
|
153
|
+
// and one shared strip is what keeps them together.
|
|
154
|
+
export * from './hash.js';
|
|
155
|
+
// ── D-4a: the pick hash ──────────────────────────────────────────────── start
|
|
156
|
+
// A DIFFERENT hash from the one above, and deliberately its own module: that one
|
|
157
|
+
// answers "is this the same declaration?", this one derives a session's chosen
|
|
158
|
+
// fact (a culprit, a secret entry) and is a stored answer in everything but
|
|
159
|
+
// name. Core's `core:task/pick-by-hash@1` binding and a plugin's own picker read
|
|
160
|
+
// the one implementation, so two readers of the same session cannot disagree.
|
|
161
|
+
export * from './pick.js';
|
|
162
|
+
// ── D-4a: the pick hash ────────────────────────────────────────────────── end
|
|
163
|
+
// The name rule (lair pass R7): one normalizer, so the undescribed-name check,
|
|
164
|
+
// a plugin's own check and the tests agree on when two names are one.
|
|
165
|
+
export * from './names.js';
|
|
166
|
+
// `/testing` is a separate entry point: an author's test-only imports should not be
|
|
167
|
+
// reachable from the runtime bundle (04 §2 — three scopes).
|
|
168
|
+
//
|
|
169
|
+
// `/tokenizers` is separate for the size reason rather than the scope one. It is
|
|
170
|
+
// the seam a HOST wires (registering the loaders for the eight ids that need a
|
|
171
|
+
// merge table); a pipeline author never touches it, and everything those loaders
|
|
172
|
+
// reach is the host's dependency tree, not this package's. Off the barrel, the
|
|
173
|
+
// executor's own `await import('./tokenizers.js')` stays a real split point —
|
|
174
|
+
// on it, every bundle that can see `run` would carry the registry.
|
|
175
|
+
export * from './widgetDecls.js';
|
|
176
|
+
//# sourceMappingURL=index.js.map
|
package/dist/layout.d.ts
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **widget declaration** a package ships (`WidgetDecl`) and its parts:
|
|
3
|
+
* what a widget renders, the data it asks for, the styles and settings it
|
|
4
|
+
* offers. Where an instance of it sits is the **session layout**'s business
|
|
5
|
+
* (`sessionLayout.ts`, `SessionLayoutV1`); a declaration never says.
|
|
6
|
+
*
|
|
7
|
+
* It lives beside `settings.ts` and `descriptors.ts` because it is a public
|
|
8
|
+
* contract on the same terms as those, and it imports only their types so
|
|
9
|
+
* `descriptors.ts` can name `WidgetDecl` without a cycle.
|
|
10
|
+
*
|
|
11
|
+
* The file kept its name when the retired layout document (LayoutDoc v2) and
|
|
12
|
+
* its machinery left it (plan `PLAN-layout-one-format-2026-09-28`, brief 1):
|
|
13
|
+
* the widget half is what stayed.
|
|
14
|
+
*/
|
|
15
|
+
import type { I18n } from './i18n.js';
|
|
16
|
+
import type { SettingsSchema } from './settings.js';
|
|
17
|
+
import type { WidgetBaseSection, WidgetSectionScope } from './widgets.js';
|
|
18
|
+
/**
|
|
19
|
+
* Data a widget requests access to (grant-gated, host-enforced at
|
|
20
|
+
* projection): a scope that delivers a scoped section — the SDK's one table,
|
|
21
|
+
* `WidgetScopedSections` (`session:full`, `session:state`, `persona`,
|
|
22
|
+
* `characters`, `lore`) — or a `channel:<slug>`.
|
|
23
|
+
* @experimental
|
|
24
|
+
*/
|
|
25
|
+
export type WidgetScope = WidgetSectionScope | `channel:${string}`;
|
|
26
|
+
/** An external plugin dependency; the CLI captures pkg/range from the imports. @experimental */
|
|
27
|
+
export interface WidgetDependency {
|
|
28
|
+
/** The depended-on plugin's stable manifest id. */
|
|
29
|
+
pluginId: string;
|
|
30
|
+
/** The npm package the direct API reference resolved to (CLI-filled). */
|
|
31
|
+
pkg?: string;
|
|
32
|
+
/** Semver range the author built against (CLI-filled). */
|
|
33
|
+
range?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A built-in style a widget ships. Seeded as a `source: "system"` row keyed by
|
|
37
|
+
* `systemStyleSlug(widgetId, slug)`; users never edit these in place — they
|
|
38
|
+
* clone one into a private style. `css` is the scoped skin injected into the
|
|
39
|
+
* widget's box; `vars` overrides design
|
|
40
|
+
* tokens (CSS custom properties).
|
|
41
|
+
* @experimental
|
|
42
|
+
*/
|
|
43
|
+
export interface WidgetStylePreset {
|
|
44
|
+
/** Stable per-widget key — the seed identity within this widget's styles. */
|
|
45
|
+
slug: string;
|
|
46
|
+
title: string;
|
|
47
|
+
css: string;
|
|
48
|
+
vars?: Record<string, string>;
|
|
49
|
+
/**
|
|
50
|
+
* What `vars` this pack exposes, in the one field language.
|
|
51
|
+
*
|
|
52
|
+
* Stored per style row as today — the schema only makes the pack's own
|
|
53
|
+
* knobs editable **without CSS**, so a person can retune a shipped skin
|
|
54
|
+
* instead of cloning it and hand-editing a stylesheet to change one radius.
|
|
55
|
+
* A var with no declaration here stays exactly what it is: CSS the author
|
|
56
|
+
* wrote, which nothing offers to edit.
|
|
57
|
+
*/
|
|
58
|
+
varsSchema?: SettingsSchema;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The globally-unique, reseed-stable slug for a widget's built-in style. This is
|
|
62
|
+
* both the system row's `slug` (the layout's reference target) and its seed
|
|
63
|
+
* identity — the reconciler upserts and prunes system rows by matching on it,
|
|
64
|
+
* NEVER on a numeric id (the codified seed rule).
|
|
65
|
+
*
|
|
66
|
+
* Widget ids and preset slugs are simple kebab tokens (no `:`), so the join is
|
|
67
|
+
* unambiguous.
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
export declare function systemStyleSlug(widgetId: string, presetSlug: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* What a widget renders, resolved — the host's switch. `remote` is a
|
|
73
|
+
* component running in its owner's UI worker, mirrored through the
|
|
74
|
+
* vocabulary (§3.5) — core's own components as much as a plugin's (R79).
|
|
75
|
+
* A real document goes INSIDE the component, as an `sp-frame`; a widget is
|
|
76
|
+
* never a bare frame (the `surface` shortcut retired 2026-10-02).
|
|
77
|
+
* @experimental
|
|
78
|
+
*/
|
|
79
|
+
export type WidgetSurface = {
|
|
80
|
+
kind: 'remote';
|
|
81
|
+
owner: string;
|
|
82
|
+
component: string;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Resolve a widget declaration to what the host mounts. `owner` is `'core'`
|
|
86
|
+
* or the declaring plugin's id: a `component` is that owner's remote. `null`
|
|
87
|
+
* when the declaration names no component — validation reports that; the
|
|
88
|
+
* host treats it as a missing widget, never a crash.
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
export declare function resolveWidgetSurface(decl: Pick<WidgetDecl, 'component'>, owner: string): WidgetSurface | null;
|
|
92
|
+
/**
|
|
93
|
+
* One **widget** a session offers: the conversation, a portrait column, a
|
|
94
|
+
* plugin's board. Every widget names a component (R25); a plugin that needs a
|
|
95
|
+
* real document places an `sp-frame` inside that component.
|
|
96
|
+
*
|
|
97
|
+
* Declaring a widget makes it *addable*. Where an instance of it sits is the
|
|
98
|
+
* **session layout**'s business (`SessionLayoutV1`): any widget may sit in any
|
|
99
|
+
* zone, as many times as the layout places it (`maxInstances` aside).
|
|
100
|
+
* @experimental
|
|
101
|
+
*/
|
|
102
|
+
export interface WidgetDecl {
|
|
103
|
+
/** Stable id — a layout's widget instance ids and `surface:open` intents key on this. */
|
|
104
|
+
id: string;
|
|
105
|
+
/** Human title shown in the widget's chrome and the tray — a string or a locale map (R-20). */
|
|
106
|
+
title: I18n;
|
|
107
|
+
/** Optional icon name (the app maps it to its icon set). */
|
|
108
|
+
icon?: string;
|
|
109
|
+
/**
|
|
110
|
+
* `primary` is the genre's **floor widget**: a layout always places one,
|
|
111
|
+
* anywhere — any zone, a tab group — and a reader that finds none appends
|
|
112
|
+
* it to the middle. Core's conversation is the primary; a genre that
|
|
113
|
+
* withholds it (`omitWidgets`) ships the widget that stands in its place.
|
|
114
|
+
* Everything else is `secondary` (the default).
|
|
115
|
+
*/
|
|
116
|
+
role?: 'primary' | 'secondary';
|
|
117
|
+
/**
|
|
118
|
+
* The genres whose sessions offer it (R71), by id — `widget()` reads
|
|
119
|
+
* genre values down to these. Absent = every genre. A genre may still
|
|
120
|
+
* withhold it (`GenreDecl.omitWidgets`).
|
|
121
|
+
*/
|
|
122
|
+
genres?: string[];
|
|
123
|
+
/**
|
|
124
|
+
* What renders inside: the slug of a {@link ComponentDecl} in the same
|
|
125
|
+
* package (R25). Core's widgets name core components. A document the
|
|
126
|
+
* widget needs goes inside that component, as an `sp-frame`.
|
|
127
|
+
*/
|
|
128
|
+
component: string;
|
|
129
|
+
/** Which channels feed it (20 §4/§7). A widget is a view onto its channels. */
|
|
130
|
+
channels?: string[];
|
|
131
|
+
/** Data the widget requests; each entry is a grant an admin can deny. */
|
|
132
|
+
scopes?: WidgetScope[];
|
|
133
|
+
/**
|
|
134
|
+
* The BASE sections this widget reads (R75) — `messages`, `settings`, … —
|
|
135
|
+
* and so the only ones its host sends it: a widget that does not read
|
|
136
|
+
* `messages` is never handed the log again on every token. Absent means
|
|
137
|
+
* every base section, which is what a widget declared before R75 reads.
|
|
138
|
+
* A name outside `WIDGET_BASE_SECTIONS` is refused where the widget is
|
|
139
|
+
* declared. Scoped sections are not named here — `scopes` asks for them.
|
|
140
|
+
*/
|
|
141
|
+
reads?: WidgetBaseSection[];
|
|
142
|
+
/** External plugin dependencies (CLI-captured into the manifest). */
|
|
143
|
+
dependencies?: WidgetDependency[];
|
|
144
|
+
/** Built-in styles this widget ships; seeded as system rows. */
|
|
145
|
+
presets?: WidgetStylePreset[];
|
|
146
|
+
/**
|
|
147
|
+
* Per-instance settings this widget offers, in the SDK's one field
|
|
148
|
+
* language — the same `FieldDecl` a node's `params` are declared in, so one
|
|
149
|
+
* renderer draws both and an author who has written node params has written
|
|
150
|
+
* these.
|
|
151
|
+
*
|
|
152
|
+
* Exposure is progressive and declaration-driven: a field appears in the
|
|
153
|
+
* widget's settings panel only because it is here, and a field carrying
|
|
154
|
+
* `group: 'behaviour'` appears behind the advanced disclosure. Core owns
|
|
155
|
+
* `title` and `lane` for every widget, so those two keys are reserved and a
|
|
156
|
+
* declaration of either is ignored.
|
|
157
|
+
*
|
|
158
|
+
* Values are stored per widget instance as deviations from the defaults
|
|
159
|
+
* declared here; a field dropped from this schema has its stored values
|
|
160
|
+
* pruned on the next reconcile.
|
|
161
|
+
*/
|
|
162
|
+
settings?: SettingsSchema;
|
|
163
|
+
/**
|
|
164
|
+
* The most instances of this widget one layout may place — a positive
|
|
165
|
+
* integer; absent means as many as a person adds. For a widget that holds
|
|
166
|
+
* state only one copy can own (global keybindings, an audio bus). At the
|
|
167
|
+
* cap the editor offers no more; a layout over it draws the first ones in
|
|
168
|
+
* reading order (middle, left, right) and `validateSessionLayout` warns.
|
|
169
|
+
*/
|
|
170
|
+
maxInstances?: number;
|
|
171
|
+
/**
|
|
172
|
+
* ⏳ The surface manager's packing hints — what the app's panel packer
|
|
173
|
+
* reads: the column span a widget asks for, its minimum box, whether it may
|
|
174
|
+
* collapse or close, and whether it prefers the drawer. The layout
|
|
175
|
+
* document's replacements for them (`placement`, `cells`, `fold`) retired
|
|
176
|
+
* with it (owner L1, 2026-09-28), so these stand until the session layout
|
|
177
|
+
* states sizes of its own.
|
|
178
|
+
*/
|
|
179
|
+
layout?: {
|
|
180
|
+
span?: {
|
|
181
|
+
ideal?: number;
|
|
182
|
+
min?: number;
|
|
183
|
+
max?: number;
|
|
184
|
+
};
|
|
185
|
+
minInline?: number;
|
|
186
|
+
minBlock?: number;
|
|
187
|
+
collapsible?: boolean;
|
|
188
|
+
closable?: boolean;
|
|
189
|
+
prefer?: 'grid' | 'drawer';
|
|
190
|
+
};
|
|
191
|
+
/** Seed this widget into a new session's default layout. Default false. */
|
|
192
|
+
defaultActive?: boolean;
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=layout.d.ts.map
|
package/dist/layout.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **widget declaration** a package ships (`WidgetDecl`) and its parts:
|
|
3
|
+
* what a widget renders, the data it asks for, the styles and settings it
|
|
4
|
+
* offers. Where an instance of it sits is the **session layout**'s business
|
|
5
|
+
* (`sessionLayout.ts`, `SessionLayoutV1`); a declaration never says.
|
|
6
|
+
*
|
|
7
|
+
* It lives beside `settings.ts` and `descriptors.ts` because it is a public
|
|
8
|
+
* contract on the same terms as those, and it imports only their types so
|
|
9
|
+
* `descriptors.ts` can name `WidgetDecl` without a cycle.
|
|
10
|
+
*
|
|
11
|
+
* The file kept its name when the retired layout document (LayoutDoc v2) and
|
|
12
|
+
* its machinery left it (plan `PLAN-layout-one-format-2026-09-28`, brief 1):
|
|
13
|
+
* the widget half is what stayed.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The globally-unique, reseed-stable slug for a widget's built-in style. This is
|
|
17
|
+
* both the system row's `slug` (the layout's reference target) and its seed
|
|
18
|
+
* identity — the reconciler upserts and prunes system rows by matching on it,
|
|
19
|
+
* NEVER on a numeric id (the codified seed rule).
|
|
20
|
+
*
|
|
21
|
+
* Widget ids and preset slugs are simple kebab tokens (no `:`), so the join is
|
|
22
|
+
* unambiguous.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export function systemStyleSlug(widgetId, presetSlug) {
|
|
26
|
+
return `${widgetId}:${presetSlug}`;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve a widget declaration to what the host mounts. `owner` is `'core'`
|
|
30
|
+
* or the declaring plugin's id: a `component` is that owner's remote. `null`
|
|
31
|
+
* when the declaration names no component — validation reports that; the
|
|
32
|
+
* host treats it as a missing widget, never a crash.
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
35
|
+
export function resolveWidgetSurface(decl, owner) {
|
|
36
|
+
if (typeof decl.component === 'string' && decl.component)
|
|
37
|
+
return { kind: 'remote', owner, component: decl.component };
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=layout.js.map
|
package/dist/media.d.ts
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The media vocabulary — one discriminated kind, not a family of sibling shapes.
|
|
3
|
+
*
|
|
4
|
+
* ## Why a discriminator rather than separate shapes per modality
|
|
5
|
+
*
|
|
6
|
+
* The tempting design is `S.image`, `S.audio`, `S.video`, `S.document` as
|
|
7
|
+
* peers, each with its own ports. It does not survive contact with the way
|
|
8
|
+
* models are actually going: every new modality would be a new shape, new ports
|
|
9
|
+
* on every provider that touches media, and a new branch in every wire adapter
|
|
10
|
+
* — the combinatorial growth this SDK avoids everywhere else by declaring data
|
|
11
|
+
* rather than switching on it. The contracts file opens by noting that the LLM,
|
|
12
|
+
* TTS and image-gen providers are structurally identical precisely *because*
|
|
13
|
+
* nothing switches on modality (17 §1); sibling media shapes would undo that.
|
|
14
|
+
*
|
|
15
|
+
* ## Why not simply "file", either
|
|
16
|
+
*
|
|
17
|
+
* Full generalisation loses the one thing the type system is actually needed
|
|
18
|
+
* for: **capability negotiation**. "This model takes images but not PDFs" is a
|
|
19
|
+
* real and common constraint, and it is the check that turns a failed API call
|
|
20
|
+
* into a disabled button. A bare `file` shape cannot express it.
|
|
21
|
+
*
|
|
22
|
+
* So: **one shape, a declared kind, and capability sets that enumerate kinds.**
|
|
23
|
+
* Ports stay general (no explosion), while what a connection or node will
|
|
24
|
+
* accept stays specific (a real check). This is the same split the app's own
|
|
25
|
+
* `files` table already makes — a coarse `kind` derived from the mime and
|
|
26
|
+
* stored, so "every document" is an index scan rather than a string parse.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* The coarse classification, matching the app's `files.kind` exactly so a blob
|
|
30
|
+
* does not change category on its way through a pipeline.
|
|
31
|
+
*
|
|
32
|
+
* Declared as a const array rather than a bare union so it is introspectable:
|
|
33
|
+
* a settings control that offers "which kinds does this accept" enumerates
|
|
34
|
+
* this instead of hardcoding a list that drifts.
|
|
35
|
+
* @experimental
|
|
36
|
+
*/
|
|
37
|
+
export declare const MEDIA_KINDS: readonly ['image', 'audio', 'video', 'document'];
|
|
38
|
+
/** @experimental */
|
|
39
|
+
export type MediaKind = (typeof MEDIA_KINDS)[number];
|
|
40
|
+
/** @experimental */
|
|
41
|
+
export declare const isMediaKind: (v: unknown) => v is MediaKind;
|
|
42
|
+
/**
|
|
43
|
+
* A reference to stored media, as it travels on a port.
|
|
44
|
+
*
|
|
45
|
+
* **A reference, never bytes.** The uuid is the app's public media address.
|
|
46
|
+
* Passing bytes on a port instead would put megabytes in every receipt, defeat
|
|
47
|
+
* dedupe, and give a plugin a copy the host cannot account for.
|
|
48
|
+
*
|
|
49
|
+
* The fields split along the same seam the app's tables do (0182), and knowing
|
|
50
|
+
* which side a field is on is the difference between a correct consumer and one
|
|
51
|
+
* that quietly serves the wrong representation:
|
|
52
|
+
*
|
|
53
|
+
* - FILE-level, and exact: `uuid`, `kind`, `width`, `height`, `duration`,
|
|
54
|
+
* `filename`, `text`. One file, one uuid, shared by every representation of
|
|
55
|
+
* it, and it no longer rotates — the app carries cache invalidation in a
|
|
56
|
+
* separate revision counter that never reaches a port.
|
|
57
|
+
* - VARIANT-level, and therefore a HINT: `mime` and `bytes`. They describe the
|
|
58
|
+
* file's DISPLAY variant — which is what a bare `/media/{uuid}` serves — and
|
|
59
|
+
* a request that names a variant, or one negotiated down by an `Accept`
|
|
60
|
+
* header, can legitimately be answered with different bytes and a different
|
|
61
|
+
* type. Do not treat them as a promise about what arrived; a receipt records
|
|
62
|
+
* what was actually sent.
|
|
63
|
+
* @experimental
|
|
64
|
+
*/
|
|
65
|
+
export interface MediaRef {
|
|
66
|
+
/** The public address (`/media/{uuid}`). Stable for this FILE, shared by
|
|
67
|
+
* every variant of it. */
|
|
68
|
+
uuid: string;
|
|
69
|
+
kind: MediaKind;
|
|
70
|
+
/** The display variant's mime. A HINT — see above. */
|
|
71
|
+
mime: string;
|
|
72
|
+
/** The display variant's byte length. A HINT — see above. */
|
|
73
|
+
bytes: number;
|
|
74
|
+
width?: number;
|
|
75
|
+
height?: number;
|
|
76
|
+
/** Seconds, when the source has a time dimension. Its PRESENCE is the signal
|
|
77
|
+
* that converting to a still format would be a downgrade. */
|
|
78
|
+
duration?: number;
|
|
79
|
+
/** Display metadata only — never resolved, never part of a path. */
|
|
80
|
+
filename?: string;
|
|
81
|
+
/** Alt text / transcript, when one is known. Carried so a downgrade to a
|
|
82
|
+
* text-only consumer has something to say instead of nothing. */
|
|
83
|
+
text?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 🚧 One file attached to one history message (PLAN-composer-attachments §3.5)
|
|
87
|
+
* — an entry of `core:shape/media-by-message@1`, which
|
|
88
|
+
* `core:query/history-attachments@1` publishes keyed by message id.
|
|
89
|
+
*
|
|
90
|
+
* A {@link MediaRef} plus the two facts placement needs and a reference does
|
|
91
|
+
* not carry: which **attachment kind** the file is (`image`, `text`, `pdf`, or
|
|
92
|
+
* `null` for a file no model is offered — an EPUB an outlet posted), and, for
|
|
93
|
+
* a text file, its **body**, because a text file reaches every model as text
|
|
94
|
+
* and a pure placement step cannot read a disk.
|
|
95
|
+
* @experimental
|
|
96
|
+
*/
|
|
97
|
+
export interface HistoryAttachmentV1 extends MediaRef {
|
|
98
|
+
/** `image` / `text` / `pdf`, decided from the stored mime; `null` for any
|
|
99
|
+
* other file, which every call is shown as a name. */
|
|
100
|
+
attachmentKind: 'image' | 'text' | 'pdf' | null;
|
|
101
|
+
/** A text file's body, read up to the query's cap. Absent for other files. */
|
|
102
|
+
body?: string;
|
|
103
|
+
/** True when `body` stopped at the query's cap rather than at the file's end. */
|
|
104
|
+
bodyTruncated?: boolean;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* 🚧 What the pair behind a connection slot reads (PLAN-composer-attachments
|
|
108
|
+
* §5.2) — `metadata.reads` on a resolved connection descriptor, computed by the
|
|
109
|
+
* host's ONE reading predicate (the same answer the composer's readers line
|
|
110
|
+
* shows). A placement step reads it the way `assemble` reads
|
|
111
|
+
* `metadata.promptFormat`, so it stays pure.
|
|
112
|
+
* @experimental
|
|
113
|
+
*/
|
|
114
|
+
export interface ConnectionReadsV1 {
|
|
115
|
+
/** The pair sends images to its model on its wire mode. */
|
|
116
|
+
image: boolean;
|
|
117
|
+
/** The pair sends PDFs to its model on its wire mode. */
|
|
118
|
+
pdf: boolean;
|
|
119
|
+
/** Why not, per kind — a sentence that names no connection. */
|
|
120
|
+
why?: {
|
|
121
|
+
image?: string;
|
|
122
|
+
pdf?: string;
|
|
123
|
+
};
|
|
124
|
+
/** Estimated prompt tokens one placed image costs. An estimate, never a cap. */
|
|
125
|
+
tokensPerImage?: number;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* What a node, provider or connection will handle.
|
|
129
|
+
*
|
|
130
|
+
* Both directions are declared because they are genuinely independent: a vision
|
|
131
|
+
* model accepts images and emits none; an image generator is the reverse; a
|
|
132
|
+
* multimodal model that reads and draws does both. A single `supports` list
|
|
133
|
+
* could not tell those apart, and the difference is exactly what a picker needs
|
|
134
|
+
* in order to grey out the wrong connection.
|
|
135
|
+
* @experimental
|
|
136
|
+
*/
|
|
137
|
+
export interface MediaCapability {
|
|
138
|
+
/** Kinds this can take as input. Absent or empty: text only. */
|
|
139
|
+
accepts?: readonly MediaKind[];
|
|
140
|
+
/** Kinds this can produce. Absent or empty: text only. */
|
|
141
|
+
emits?: readonly MediaKind[];
|
|
142
|
+
/** Mime allow-list, when a kind is too coarse — e.g. a model that reads
|
|
143
|
+
* `image/png` and `image/jpeg` but not `image/gif`. Absent means every
|
|
144
|
+
* mime of an accepted kind. */
|
|
145
|
+
mimes?: readonly string[];
|
|
146
|
+
}
|
|
147
|
+
/** Does `cap` accept this reference? The check a picker and a wire adapter
|
|
148
|
+
* both need, written once so they cannot disagree.
|
|
149
|
+
* @experimental
|
|
150
|
+
*/
|
|
151
|
+
export declare function accepts(cap: MediaCapability | undefined, ref: MediaRef): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* One item of a model's output.
|
|
154
|
+
*
|
|
155
|
+
* ## Why output is a list of parts rather than a string
|
|
156
|
+
*
|
|
157
|
+
* Because that is what a model call already returns, everywhere. A single
|
|
158
|
+
* response now routinely carries an ordered mix of prose, reasoning, tool calls
|
|
159
|
+
* and generated media — interleaved image output alongside text, code
|
|
160
|
+
* execution that yields both a summary and a file, audio with its transcript.
|
|
161
|
+
* Modelling the reply as `text` and bolting media on beside it means the
|
|
162
|
+
* *order* is lost, which is the one thing an interleaved response is about.
|
|
163
|
+
*
|
|
164
|
+
* The app already stores messages this way (`messageParts`, with
|
|
165
|
+
* `core:image` / `core:file`). This is the provider contract catching up to
|
|
166
|
+
* the storage model, not a speculative addition.
|
|
167
|
+
* @experimental
|
|
168
|
+
*/
|
|
169
|
+
export type OutputPart = {
|
|
170
|
+
t: 'text';
|
|
171
|
+
text: string;
|
|
172
|
+
}
|
|
173
|
+
/** Chain-of-thought or similar, kept separate so it can be hidden,
|
|
174
|
+
* budgeted and excluded from context independently of the answer. */
|
|
175
|
+
| {
|
|
176
|
+
t: 'reasoning';
|
|
177
|
+
text: string;
|
|
178
|
+
} | {
|
|
179
|
+
t: 'media';
|
|
180
|
+
ref: MediaRef;
|
|
181
|
+
} | {
|
|
182
|
+
t: 'tool-call';
|
|
183
|
+
id: string;
|
|
184
|
+
name: string;
|
|
185
|
+
args: unknown;
|
|
186
|
+
}
|
|
187
|
+
/** Provider-specific passthrough. Named so an unknown part is inert rather
|
|
188
|
+
* than an error — a host that does not understand one skips it. */
|
|
189
|
+
| {
|
|
190
|
+
t: 'other';
|
|
191
|
+
subtype: string;
|
|
192
|
+
data: unknown;
|
|
193
|
+
};
|
|
194
|
+
/** Everything in a part list that is prose, concatenated — the degrade path
|
|
195
|
+
* for a consumer that only understands text. Reasoning is deliberately
|
|
196
|
+
* excluded: it is not the answer.
|
|
197
|
+
* @experimental
|
|
198
|
+
*/
|
|
199
|
+
export declare function partsToText(parts: readonly OutputPart[]): string;
|
|
200
|
+
/** Every media reference in a part list, in order. @experimental */
|
|
201
|
+
export declare function partsToMedia(parts: readonly OutputPart[]): MediaRef[];
|
|
202
|
+
//# sourceMappingURL=media.d.ts.map
|