@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.
Files changed (186) hide show
  1. package/README.md +24 -20
  2. package/dist/actions.d.ts +150 -68
  3. package/dist/actions.js +90 -36
  4. package/dist/annexFields.d.ts +8 -4
  5. package/dist/annexFields.js +5 -2
  6. package/dist/announce.d.ts +78 -28
  7. package/dist/announce.js +14 -5
  8. package/dist/attributes.d.ts +9 -6
  9. package/dist/attributes.js +9 -5
  10. package/dist/bands.d.ts +41 -6
  11. package/dist/bands.js +83 -33
  12. package/dist/builder.d.ts +161 -58
  13. package/dist/builder.js +128 -22
  14. package/dist/candidates.d.ts +5 -3
  15. package/dist/candidates.js +3 -2
  16. package/dist/clauses.d.ts +2 -1
  17. package/dist/clauses.js +2 -1
  18. package/dist/component.d.ts +24 -7
  19. package/dist/component.js +16 -6
  20. package/dist/componentBuild.d.ts +16 -5
  21. package/dist/componentBuild.js +14 -5
  22. package/dist/componentClient.d.ts +61 -30
  23. package/dist/componentClient.js +11 -1
  24. package/dist/componentImports.d.ts +8 -5
  25. package/dist/componentImports.js +23 -4
  26. package/dist/componentModule.js +2 -1
  27. package/dist/componentWire.d.ts +2 -1
  28. package/dist/componentWire.js +34 -2
  29. package/dist/config.d.ts +28 -14
  30. package/dist/config.js +20 -10
  31. package/dist/connections.d.ts +9 -4
  32. package/dist/connections.js +7 -4
  33. package/dist/declarations.d.ts +46 -17
  34. package/dist/declarations.js +46 -15
  35. package/dist/descriptors.d.ts +242 -97
  36. package/dist/descriptors.js +145 -41
  37. package/dist/dev.d.ts +6 -5
  38. package/dist/dev.js +6 -5
  39. package/dist/document.d.ts +74 -25
  40. package/dist/document.js +32 -11
  41. package/dist/dowry.d.ts +241 -0
  42. package/dist/dowry.js +315 -0
  43. package/dist/engines.d.ts +16 -7
  44. package/dist/engines.js +6 -4
  45. package/dist/eventMapLaws.d.ts +19 -8
  46. package/dist/eventMapLaws.js +9 -6
  47. package/dist/events.d.ts +101 -39
  48. package/dist/events.js +106 -33
  49. package/dist/executor.d.ts +122 -41
  50. package/dist/executor.js +195 -96
  51. package/dist/extension.d.ts +99 -35
  52. package/dist/extension.js +43 -9
  53. package/dist/facets.d.ts +2 -1
  54. package/dist/facets.js +4 -2
  55. package/dist/foldedSections.d.ts +4 -2
  56. package/dist/foldedSections.js +2 -1
  57. package/dist/genres.d.ts +123 -41
  58. package/dist/genres.js +127 -22
  59. package/dist/guardedConnection.d.ts +4 -3
  60. package/dist/guardedConnection.js +4 -3
  61. package/dist/handlebarsReach.d.ts +1 -1
  62. package/dist/handlebarsReach.js +1 -1
  63. package/dist/hash.d.ts +16 -5
  64. package/dist/hash.js +14 -4
  65. package/dist/hookGrants.d.ts +3 -2
  66. package/dist/hookGrants.js +6 -4
  67. package/dist/hooks.d.ts +21 -16
  68. package/dist/hooks.js +12 -10
  69. package/dist/hostElements.d.ts +41 -17
  70. package/dist/hostElements.js +49 -17
  71. package/dist/i18n.d.ts +5 -3
  72. package/dist/i18n.js +5 -3
  73. package/dist/identity.d.ts +5 -4
  74. package/dist/identity.js +5 -4
  75. package/dist/index.d.ts +5 -0
  76. package/dist/index.js +15 -0
  77. package/dist/layout.d.ts +36 -15
  78. package/dist/layout.js +2 -2
  79. package/dist/loadouts.d.ts +97 -0
  80. package/dist/loadouts.js +81 -0
  81. package/dist/media.d.ts +26 -4
  82. package/dist/media.js +2 -1
  83. package/dist/messageBlocks.d.ts +44 -32
  84. package/dist/messageBlocks.js +23 -18
  85. package/dist/migration.d.ts +16 -8
  86. package/dist/migration.js +14 -8
  87. package/dist/names.d.ts +2 -1
  88. package/dist/names.js +2 -1
  89. package/dist/nodeInput.d.ts +2 -1
  90. package/dist/nodeInput.js +2 -1
  91. package/dist/participants.d.ts +22 -15
  92. package/dist/participants.js +14 -12
  93. package/dist/personGate.d.ts +2 -1
  94. package/dist/personGate.js +2 -1
  95. package/dist/pluginHarness.d.ts +8 -3
  96. package/dist/pluginHarness.js +4 -2
  97. package/dist/pluginPermissions.d.ts +2 -1
  98. package/dist/pluginPermissions.js +12 -1
  99. package/dist/pluginRuleRef.d.ts +2 -2
  100. package/dist/pluginRuleRef.js +1 -1
  101. package/dist/predicates.d.ts +16 -11
  102. package/dist/predicates.js +7 -6
  103. package/dist/preview.d.ts +8 -3
  104. package/dist/preview.js +2 -1
  105. package/dist/promptBlocks.d.ts +5 -3
  106. package/dist/promptBlocks.js +5 -3
  107. package/dist/rankingDecisions.d.ts +2 -1
  108. package/dist/rankingDecisions.js +2 -1
  109. package/dist/receipt.d.ts +65 -29
  110. package/dist/receipt.js +9 -4
  111. package/dist/receiverRules.js +3 -2
  112. package/dist/refs.d.ts +34 -9
  113. package/dist/refs.js +33 -13
  114. package/dist/registry.d.ts +42 -23
  115. package/dist/registry.js +7 -5
  116. package/dist/review.d.ts +16 -5
  117. package/dist/review.js +11 -4
  118. package/dist/sampling.d.ts +54 -0
  119. package/dist/sampling.js +95 -3
  120. package/dist/sceneSettings.d.ts +312 -0
  121. package/dist/sceneSettings.js +425 -0
  122. package/dist/scope.d.ts +6 -4
  123. package/dist/scope.js +4 -3
  124. package/dist/scripts.d.ts +81 -14
  125. package/dist/scripts.js +90 -11
  126. package/dist/sessionDossier.d.ts +521 -0
  127. package/dist/sessionDossier.js +33 -0
  128. package/dist/sessionLayout.d.ts +303 -19
  129. package/dist/sessionLayout.js +354 -40
  130. package/dist/sessionSettings.d.ts +8 -5
  131. package/dist/settings.d.ts +45 -20
  132. package/dist/settings.js +19 -12
  133. package/dist/settingsSlot.d.ts +11 -8
  134. package/dist/settingsSlot.js +11 -8
  135. package/dist/shapes.d.ts +103 -41
  136. package/dist/shapes.js +105 -40
  137. package/dist/sheets.d.ts +4 -2
  138. package/dist/sheets.js +6 -3
  139. package/dist/statShapes.d.ts +2 -1
  140. package/dist/statShapes.js +2 -1
  141. package/dist/status.d.ts +13 -9
  142. package/dist/status.js +8 -6
  143. package/dist/storage.d.ts +2 -1
  144. package/dist/storage.js +2 -1
  145. package/dist/storyTime.d.ts +13 -7
  146. package/dist/storyTime.js +11 -6
  147. package/dist/strokes.d.ts +176 -0
  148. package/dist/strokes.js +281 -0
  149. package/dist/surfaces.d.ts +54 -25
  150. package/dist/surfaces.js +3 -3
  151. package/dist/template.d.ts +9 -5
  152. package/dist/template.js +5 -3
  153. package/dist/templateCheck.d.ts +2 -2
  154. package/dist/templateCheck.js +2 -2
  155. package/dist/templateFit.d.ts +37 -8
  156. package/dist/templateFit.js +92 -8
  157. package/dist/templateIds.d.ts +3 -3
  158. package/dist/templateIds.js +3 -3
  159. package/dist/templateScopeAt.d.ts +21 -11
  160. package/dist/templateScopeAt.js +21 -11
  161. package/dist/testing.d.ts +11 -4
  162. package/dist/testing.js +13 -5
  163. package/dist/tokenizers.d.ts +2 -2
  164. package/dist/tokenizers.js +2 -2
  165. package/dist/turnLock.d.ts +4 -2
  166. package/dist/turnLock.js +2 -1
  167. package/dist/turnOrder.d.ts +17 -11
  168. package/dist/turnOrder.js +9 -5
  169. package/dist/validate.d.ts +11 -8
  170. package/dist/validate.js +81 -10
  171. package/dist/values.d.ts +17 -8
  172. package/dist/values.js +11 -6
  173. package/dist/variables.d.ts +46 -7
  174. package/dist/variables.js +87 -6
  175. package/dist/verdicts.d.ts +20 -13
  176. package/dist/verdicts.js +17 -11
  177. package/dist/widgetDecls.d.ts +8 -4
  178. package/dist/widgetDecls.js +4 -2
  179. package/dist/widgets.d.ts +987 -94
  180. package/dist/widgets.js +93 -18
  181. package/dist/wire.d.ts +13 -6
  182. package/dist/wire.js +3 -3
  183. package/dist/worldinfo.d.ts +11 -6
  184. package/dist/worldinfo.js +8 -4
  185. package/host-elements.d.ts +13 -0
  186. package/package.json +1 -1
@@ -0,0 +1,521 @@
1
+ /**
2
+ * ๐Ÿšง The conversation **dossier** โ€” `session_full.v1`, the section a widget
3
+ * granted `session:full` is posted ({@link WidgetScopedSections}): what core's
4
+ * conversation widget is told about its session beyond the envelope's base
5
+ * sections.
6
+ *
7
+ * The page answers here what only the page can: who the viewer controls, who
8
+ * spoke each line and with what face, where scenes and history entries fall,
9
+ * whether older messages remain. The widget judges nothing it is not told,
10
+ * and acts only through its verbs (`invoke`, `request`) โ€” so the same widget
11
+ * runs as a remote in the page's UI worker, where there is no page to ask.
12
+ *
13
+ * A plugin's widget sees it only when it declares the `session:full` scope
14
+ * and an admin grants that permission (`widget:session:full`) at review โ€”
15
+ * never by default; the grant shows the whole conversation as the viewer
16
+ * sees it (the cast, their personas, their unsent draft, the session's
17
+ * state).
18
+ *
19
+ * Declared here, beside the other section shapes, since 2026-10-10:
20
+ * it was core-catalog's
21
+ * `ConversationDossierV1`, which now names this type (โณ REMOVE in 0.7.0).
22
+ * The fields are exactly what core's conversation (`MessagesWidget` and
23
+ * its children) reads today, plus `backdrop`, which the host that draws the
24
+ * copy reads. Provisional as a whole: its shape settles when the
25
+ * conversation moves onto the public contract.
26
+ *
27
+ * Imports nothing but the story-time leaf's types (`StoryTime`,
28
+ * `StoryCalendar`, itself importing nothing), so `widgets.ts` names it
29
+ * without a cycle.
30
+ * @ruling C0b, PLAN-widget-system-consolidation C4, C8
31
+ */
32
+ import type { StoryCalendar, StoryTime } from './storyTime.js';
33
+ import type { SceneSummaryMode } from './sceneSettings.js';
34
+ /** A participant as a line names them: display name, reference, face. @experimental */
35
+ export interface ConversationSpeakerV1 {
36
+ name: string;
37
+ /** `character:3` โ€” what `sp-avatar` and `view-avatar` take; null for narration. */
38
+ ref: string | null;
39
+ /** The speaker's avatar. */
40
+ face: string | null;
41
+ /** The sprite this line was shown with โ€” what `avatarFace: sprite` draws instead. */
42
+ sprite: string | null;
43
+ /**
44
+ * ๐Ÿšง The session member a `name` that is a role belongs to: on a
45
+ * person's persona-less line named by the genre's `playerLabel`, the
46
+ * member's own name, present only when the session has more than one
47
+ * member โ€” shown after the name in muted text ("Dungeon Master ยท jody").
48
+ * Absent everywhere else.
49
+ * @ruling R4
50
+ */
51
+ member?: string;
52
+ }
53
+ /** What the page decided about one message. @experimental */
54
+ export interface ConversationLineV1 {
55
+ /** The viewer may press this line's own verbs (edit, hide, delete). */
56
+ controllable: boolean;
57
+ speaker: ConversationSpeakerV1;
58
+ /** Swipe arrows: shown at all, and whether there is a newer reply to take. */
59
+ swipes: {
60
+ show: boolean;
61
+ right: boolean;
62
+ };
63
+ /** The line's vectors against the active embedding model (hidden when retrieval is off). */
64
+ embedding: 'current' | 'stale' | 'none' | 'hidden';
65
+ /**
66
+ * The host holds this line's compiled prompt and the viewer may read it
67
+ * (`prompt-details`: admins, with context debugging on). The prompt itself
68
+ * never rides the row โ€” `debugMeta` is host bookkeeping (`MESSAGE_HOST_FIELDS`).
69
+ * Absent reads as false.
70
+ */
71
+ promptDetails?: boolean;
72
+ }
73
+ /**
74
+ * A scene over some of the log, with the history entry it sits in.
75
+ *
76
+ * ๐Ÿšง Two kinds while live scenes land (PROPOSAL-live-scenes ยง3): a **live
77
+ * scene** โ€” opened at a message, the run of one channel lane's lines between
78
+ * its two **scene boundaries** (`openedAtMessageId` โ€ฆ `closedAtMessageId`,
79
+ * the end null while it is the **open scene**) โ€” and a scene **captured by
80
+ * selection** (ticked lines, `openedAtMessageId` absent or null), which
81
+ * `selectedMessageIds` alone describes. A live scene's `selectedMessageIds`
82
+ * is the host's derived cache, written when it closes.
83
+ * @experimental
84
+ */
85
+ export interface ConversationSceneV1 {
86
+ id: number;
87
+ name: string | null;
88
+ lorebookId: number;
89
+ historyEntryId: number | null;
90
+ selectedMessageIds: number[];
91
+ historyEntry: {
92
+ id: number;
93
+ year: number;
94
+ month: number | null;
95
+ day: number | null;
96
+ isCompleted: boolean;
97
+ nextEntry: {
98
+ id: number;
99
+ year: number;
100
+ month: number | null;
101
+ day: number | null;
102
+ } | null;
103
+ } | null;
104
+ /** ๐Ÿšง The channel lane a live scene runs on, canonical (`main`, `phone:2`). Absent reads as `main`. */
105
+ channel?: string;
106
+ /** ๐Ÿšง The message a live scene opens at (its opening **scene boundary**); null or absent for a scene captured by selection. */
107
+ openedAtMessageId?: number | null;
108
+ /** ๐Ÿšง The message a live scene closes at; null while it is the session's **open scene** on its lane. */
109
+ closedAtMessageId?: number | null;
110
+ /** ๐Ÿšง The story clock as the scene opened โ€” the boundary line's stamp, else the session's story now. */
111
+ openedAt?: StoryTime | null;
112
+ /** ๐Ÿšง The story clock as the scene closed; null while it is open. */
113
+ closedAt?: StoryTime | null;
114
+ /**
115
+ * ๐Ÿšง Where its summary stands: `none` ยท `running` ยท `review` (the run
116
+ * finished and waits for the person's Apply โ€” the divider's *Ready to
117
+ * review*; ยง15 G8) ยท `done` ยท `failed`. Absent reads as unknown.
118
+ */
119
+ summaryStatus?: 'none' | 'running' | 'review' | 'done' | 'failed';
120
+ /**
121
+ * ๐Ÿšง The scene has summary text. With `summaryStatus: 'none'` on a live
122
+ * scene it is a summary a moved boundary left behind โ€” the divider says
123
+ * *Summary out of date* (lane E). Absent reads as false.
124
+ */
125
+ hasSummary?: boolean;
126
+ /**
127
+ * ๐Ÿšง Who is in the scene โ€” its cast as the host stores it (participants
128
+ * first), each named and drawn as the page names them; `ref` is the
129
+ * participant reference when the member is a card (`character:3`). A
130
+ * divider's faces read this; absent (a guest's page, say), they fall
131
+ * back to who spoke in its loaded lines (lane E).
132
+ */
133
+ cast?: ConversationSceneCastV1[];
134
+ }
135
+ /**
136
+ * ๐Ÿšง One member of a scene's cast, as a scene divider draws it.
137
+ * @experimental
138
+ */
139
+ export interface ConversationSceneCastV1 {
140
+ /** A participant reference (`character:3`) when the member is a card; null for a background member. */
141
+ ref: string | null;
142
+ name: string;
143
+ /** The face's image URL, or null for an initial. */
144
+ face: string | null;
145
+ }
146
+ /**
147
+ * ๐Ÿšง A **scene cue** at one line, as the conversation draws it โ€” Suggested
148
+ * scene mode's quiet *New scene?* chip in the line's scene-divider slot,
149
+ * with **Yes** and **Not here** (`decide-scene-cue`, by `id`). One per line
150
+ * and lane: the triggers that fired there are listed together. Offered only
151
+ * past the lane's latest scene boundary, and only to the session's owner
152
+ * (`sceneBoundaries`).
153
+ * @experimental
154
+ * @ruling PROPOSAL-live-scenes ยง4, ยง7 (2026-10-13)
155
+ */
156
+ export interface ConversationSceneCueV1 {
157
+ /** What `decide-scene-cue` takes; deciding it decides every trigger at this line. */
158
+ id: number;
159
+ /** The channel lane, canonical (`main`, `phone:2`). */
160
+ channel: string;
161
+ /** The line the next scene would open at. */
162
+ messageId: number;
163
+ /** The boundary triggers that fired at this line (`dayCrossed`, `timeAction`, โ€ฆ). */
164
+ triggers: string[];
165
+ /** Why, in words, for the chip: "the day changed", "time passed". */
166
+ reason: string;
167
+ }
168
+ /** The cast, as far as answering a form needs it (`canAnswerForm`). @experimental */
169
+ export interface ConversationCastV1 {
170
+ sessionPersonas: Array<{
171
+ personaId: number | null;
172
+ persona: {
173
+ userId: number | null;
174
+ } | null;
175
+ }>;
176
+ sessionCharacters: Array<{
177
+ characterId: number | null;
178
+ }>;
179
+ }
180
+ /**
181
+ * ๐Ÿšง The conversation dossier โ€” `session_full.v1` (see the head of this
182
+ * file). Every field is one core's conversation reads; each is the page's
183
+ * answer, never a verdict the widget re-derives.
184
+ * @experimental
185
+ */
186
+ export interface SessionDossierV1 {
187
+ /** The session the dossier describes โ€” what the composer files its draft under. */
188
+ sessionId: number;
189
+ /** Per message, by id. A message absent here reads as core-catalog's `NO_LINE`. */
190
+ lines: Record<number, ConversationLineV1>;
191
+ scenes: ConversationSceneV1[];
192
+ /** Messages already captured in a scene (not selectable for another). */
193
+ scened: number[];
194
+ /** Older messages remain to load, and a load is under way. */
195
+ hasOlder: boolean;
196
+ loadingOlder: boolean;
197
+ /** Why Extend is unavailable in this session, when it is. */
198
+ extendRefusal?: string;
199
+ /** The viewer owns the session (not a guest) โ€” a form to the owner is theirs. */
200
+ isOwner: boolean;
201
+ cast: ConversationCastV1;
202
+ /** What the session may write beyond messages (R-B): a scene, lore. */
203
+ writes: {
204
+ scenes: boolean;
205
+ lore: boolean;
206
+ };
207
+ /**
208
+ * ๐Ÿšง The viewer may place **scene boundaries** here โ€” *Start scene here*,
209
+ * *End scene here*, a scene divider's rename, *Remove boundary* and
210
+ * *Summarize*: the session's owner, its genre writes scenes, it reads a
211
+ * lorebook, and lore writes are not Off. The host's own refusals,
212
+ * mirrored so the widget hides what would be refused rather than offering
213
+ * it. Absent reads as false.
214
+ * @ruling PROPOSAL-live-scenes ยง7, ยง14 C
215
+ */
216
+ sceneBoundaries?: boolean;
217
+ /**
218
+ * ๐Ÿšง The **scene cues** waiting at lines of this session โ€” Suggested
219
+ * scene mode's *New scene?* chips, oldest first. Absent or empty: none.
220
+ * @ruling PROPOSAL-live-scenes ยง4 (2026-10-13)
221
+ */
222
+ sceneCues?: ConversationSceneCueV1[];
223
+ /**
224
+ * ๐Ÿšง When this session's scenes are summarized (its scene settings):
225
+ * under `never` no *Summarize* is offered โ€” a scene divider's included.
226
+ * Absent reads as `onRequest`.
227
+ * @ruling PROPOSAL-live-scenes ยง5 (2026-10-13)
228
+ */
229
+ sceneSummaryMode?: SceneSummaryMode;
230
+ /**
231
+ * ๐Ÿšง The **story calendar** of the book the session reads
232
+ * (`lorebooks.story_calendar`), what the conversation spells its dates
233
+ * through โ€” a scene divider's day, a day mark, a history marker โ€” as
234
+ * `formatStoryTime(time, calendar)` does. Null: the book declares none
235
+ * (free-form: *Year 412, Mo. 3, Day 5*). Absent: not known yet (the same).
236
+ * @ruling PROPOSAL-live-scenes ยง15 G9 (2026-10-13)
237
+ */
238
+ storyCalendar?: StoryCalendar | null;
239
+ /** Admins with context debugging on may open a line's prompt. */
240
+ debugPrompts: boolean;
241
+ /**
242
+ * Bumped when a host view (the workflow tab) asks the conversation to
243
+ * start selecting lines for a summary โ€” the widget starts on a change.
244
+ */
245
+ selectForSummary: number;
246
+ /** Bumped when the host's summary finished: the selection it was handed ends. */
247
+ summaryEnded: number;
248
+ /** What the composer is told. */
249
+ composer: ConversationComposerV1;
250
+ /** Who is due next, from the session's stored turn order. */
251
+ turn: {
252
+ /**
253
+ * ๐Ÿšง The stored order's entries (`TurnOrderV1.order`), as the page
254
+ * snapshots them. Open past `ref` on purpose: a turn strategy may add
255
+ * keys (a `channel`, a `reason`) and they ride through; the widget
256
+ * reads `ref` and passes the rest on.
257
+ */
258
+ order: Array<{
259
+ ref: string | null;
260
+ [k: string]: unknown;
261
+ }>;
262
+ candidates: Array<{
263
+ ref: string;
264
+ kind: string;
265
+ name: string;
266
+ nickname?: string;
267
+ ownerUserId?: number;
268
+ }>;
269
+ /** The nudge applies now (a turn is due, nothing is generating or drafted). */
270
+ show: boolean;
271
+ /** Anyone else could take the turn. */
272
+ canChoose: boolean;
273
+ /**
274
+ * ๐Ÿšง What the pipeline's own voice โ€” an entry with `ref: null` โ€” is
275
+ * called: the genre's fallback envoy (the Lair's
276
+ * "Castellan"), else the session's narrator name, else
277
+ * `UNCLAIMED_LINE_NAME`, as the page resolves it. Absent reads as
278
+ * "The narrator".
279
+ * @ruling lair re-plan R5
280
+ */
281
+ ownVoiceName?: string;
282
+ };
283
+ /**
284
+ * The session's mode is not installed: the log is read-only.
285
+ * @ruling 19 ยง6
286
+ */
287
+ readOnly: {
288
+ genreId: string | null;
289
+ } | null;
290
+ /** The session state's ledger under each line, and what waits for the viewer. */
291
+ state: ConversationStateV1;
292
+ /**
293
+ * ๐Ÿšง An app background image is painted behind the shell: the
294
+ * conversation gets its glass panel. Read by the HOST that draws the copy
295
+ * (its card's background), not by the widget โ€” the one field here no
296
+ * widget reads. Not the session's backdrop (`SessionV1.backdrop`).
297
+ */
298
+ appBackground: boolean;
299
+ }
300
+ /** One proposed change, described. @experimental */
301
+ export interface ConversationProposalV1 {
302
+ id: number;
303
+ status: string;
304
+ messageId: number | null;
305
+ /** The change, in words. */
306
+ text: string;
307
+ proposedBy: string | null;
308
+ /** For a superseded proposal: what moved since. */
309
+ moved: string | null;
310
+ }
311
+ /**
312
+ * ๐Ÿšง The session state's ledger, as the conversation draws it. @experimental
313
+ * @ruling C0b
314
+ */
315
+ export interface ConversationStateV1 {
316
+ /** Per message id: the changes it made, grouped by whose they are. */
317
+ ledgers: Record<number, Array<{
318
+ ownerKey: string;
319
+ ownerLabel: string;
320
+ lines: Array<{
321
+ key: string;
322
+ text: string;
323
+ updatedBy: string;
324
+ }>;
325
+ }>>;
326
+ /**
327
+ * ๐Ÿšง The conversation's **ledger head** (live scenes ยง15 G13): changes
328
+ * anchored to no message, grouped as a message's are โ€” the clock moves
329
+ * made before the session had a single line (a *Time passesโ€ฆ* pressed, or
330
+ * skipped for want of a clock, before anything was said). Drawn above the
331
+ * first message. Optional: a host that sends none has nothing there.
332
+ */
333
+ head?: Array<{
334
+ ownerKey: string;
335
+ ownerLabel: string;
336
+ lines: Array<{
337
+ key: string;
338
+ text: string;
339
+ updatedBy: string;
340
+ }>;
341
+ }>;
342
+ /** Per message id: proposals anchored to it. */
343
+ pending: Record<number, ConversationProposalV1[]>;
344
+ /** Every proposal waiting for the viewer (the Review panel). */
345
+ waiting: ConversationProposalV1[];
346
+ }
347
+ /** A tab of the composer's More panel: one of the host's own views. @experimental */
348
+ export interface ConversationTabV1 {
349
+ view: string;
350
+ title: string;
351
+ icon: string;
352
+ }
353
+ /**
354
+ * ๐Ÿšง What core's composer is told: the page's half of writing a line. @experimental
355
+ * @ruling C0b
356
+ */
357
+ export interface ConversationComposerV1 {
358
+ /**
359
+ * The host's last write to the draft: the one it kept, when the session
360
+ * opens; an empty one when an action spent it. The composer owns the
361
+ * draft between writes (and reports it back, `draft`); a new `write`
362
+ * number replaces the field, whatever it holds โ€” the same `write` never
363
+ * does, so a re-posted dossier leaves the person's typing alone.
364
+ */
365
+ draft: {
366
+ content: string;
367
+ write: number;
368
+ };
369
+ /** Whom the viewer may write as, and whom they are writing as. */
370
+ personas: Array<{
371
+ personaId: number;
372
+ name: string;
373
+ }>;
374
+ personaId: number | null;
375
+ /**
376
+ * ๐Ÿšง What the viewer's persona-less lines are called (the
377
+ * page's `sessionPlayerLabel`): the composer, writing as no persona, says
378
+ * "Write as the Dungeon Masterโ€ฆ". Absent when the genre declares none.
379
+ * @ruling lair pass R4, S2
380
+ */
381
+ playerLabel?: string;
382
+ /** A guest with no persona: the composer offers to add one instead. */
383
+ addPersona: boolean;
384
+ /** A genre with no field (`composer: 'none'`): triggers only. */
385
+ hidden: boolean;
386
+ /**
387
+ * The lanes a line may be written on, `main` first โ€” THIS copy's: the
388
+ * host narrows them per mount, so a Messages widget
389
+ * pinned to one channel is told that channel alone, and the primary log
390
+ * the channels no pinned copy claims. The log shows these channels' rows
391
+ * and nothing else.
392
+ * @ruling lair re-plan S1
393
+ */
394
+ channels: string[];
395
+ /**
396
+ * ๐Ÿšง What each channel is called, by slug, in the viewer's language
397
+ * (`ChannelDecl.label`): the Lair's `sanctum` reads
398
+ * _Sanctum_. A channel absent here is named by its slug, title-cased.
399
+ * @ruling lair re-plan R6/S1
400
+ */
401
+ channelLabels?: Record<string, string>;
402
+ /**
403
+ * ๐Ÿšง What each channel IS, by slug (`ChannelDecl.role`): only channels
404
+ * that declare a role, so `{ manuscript: 'folio' }` for the Writing Room.
405
+ * A Messages copy whose `channel` claim names a `folio` channel draws as
406
+ * Folio when its `presentation` setting is unset.
407
+ * Absent: every channel is a conversation.
408
+ * @ruling PLAN-core-widgets ยง3.7
409
+ */
410
+ channelRoles?: Record<string, 'conversation' | 'folio'>;
411
+ /** The draft's share of the context window, when counted. */
412
+ usage: {
413
+ total: number;
414
+ limit: number;
415
+ } | null;
416
+ /** The More panel's tabs, and the turn controls' own (`session-controls`). */
417
+ tabs: ConversationTabV1[];
418
+ /** The session's action chips (`session-actions`) have something to show. */
419
+ actions: boolean;
420
+ /** The retrieval notice (`retrieval-notice`) applies to this session. */
421
+ notice: boolean;
422
+ /**
423
+ * ๐Ÿšง The composer venue's overflow and `/` palette rows, and the newest
424
+ * line's values. Opaque here on purpose: the composer reads them as
425
+ * `WidgetAction[]`, core-catalog's `PaletteAction[]` and its `ItemValues`
426
+ * โ€” the last two are the catalogue's own shapes, which this package
427
+ * cannot name โ€” and the page fills them from its own action lists.
428
+ * Typed when the conversation moves onto the public contract.
429
+ * @ruling C8
430
+ */
431
+ overflow: unknown[];
432
+ palette: unknown[];
433
+ newest: unknown | null;
434
+ /** Someone is due next: Send takes the quieter look. */
435
+ sendTonal: boolean;
436
+ /**
437
+ * ๐Ÿšง The viewer's **tray**: the files they
438
+ * added to this composer and have not sent yet, in tray order โ€” uploading,
439
+ * ready or refused. The host keeps it; the composer draws the tiles and
440
+ * asks (`attach-files`, `remove-tray-item`). Absent, the host
441
+ * offers no attachments and the composer draws no Attach button.
442
+ * @ruling composer attachments ยง3.3
443
+ */
444
+ tray?: TrayItemV1[];
445
+ /**
446
+ * ๐Ÿšง What this session's reply can read (**attachment readers**):
447
+ * per attachment kind whether it may be attached and why not, and per
448
+ * model call what it reads. Null until the host has asked.
449
+ * @ruling composer attachments ยง3.2
450
+ */
451
+ attachments?: AttachmentReadersV1 | null;
452
+ }
453
+ /**
454
+ * ๐Ÿšง What kind of attachment a file is โ€” an
455
+ * **attachment kind**. Decided from the file's bytes, never its name.
456
+ * @experimental
457
+ * @ruling composer attachments D5
458
+ */
459
+ export type AttachmentKindV1 = 'image' | 'text' | 'pdf';
460
+ /**
461
+ * ๐Ÿšง One **tray item** as the composer draws it: a file uploaded into the
462
+ * session's composer and not yet sent. โš  Not a held import.
463
+ * @experimental
464
+ */
465
+ export interface TrayItemV1 {
466
+ id: string;
467
+ /** `uploading` (with `progress`), `ready`, or `refused` (with `refusal`). */
468
+ status: 'uploading' | 'ready' | 'refused';
469
+ /** 0โ€“1 while uploading. */
470
+ progress: number;
471
+ /** The sentence a refused tile shows. */
472
+ refusal: string | null;
473
+ filename: string;
474
+ bytes: number;
475
+ /** Null until the server has sniffed it. */
476
+ kind: AttachmentKindV1 | null;
477
+ /** The square thumbnail (`/media/<id>?v=thumb`) of a stored image, else null. */
478
+ thumbSrc: string | null;
479
+ }
480
+ /**
481
+ * ๐Ÿšง The session's **attachment readers** as the composer reads them.
482
+ * @experimental
483
+ * @ruling composer attachments ยง3.2
484
+ */
485
+ export interface AttachmentReadersV1 {
486
+ /**
487
+ * Per kind: may it be attached (the union over reading calls), and why not.
488
+ * @ruling composer attachments D1
489
+ */
490
+ kinds: Record<AttachmentKindV1, {
491
+ allowed: boolean;
492
+ reason?: string;
493
+ }>;
494
+ /**
495
+ * Each **reading call** โ€” a model call of the reply that is handed
496
+ * attachments โ€” with what it reads and what it gets as a placeholder
497
+ * (`[image: cat.png]`). `model` names its model for an administrator
498
+ * only.
499
+ * @ruling composer attachments D3
500
+ */
501
+ calls: Array<{
502
+ key: string;
503
+ label: string;
504
+ reads: AttachmentKindV1[];
505
+ placeholderFor: AttachmentKindV1[];
506
+ model?: string;
507
+ }>;
508
+ /** The file picker's filter for every kind that may be attached (`image/png,.md`). */
509
+ accept: string;
510
+ /**
511
+ * Files one message may carry.
512
+ * @ruling composer attachments D6
513
+ */
514
+ filesPerMessage: number;
515
+ /**
516
+ * The byte cap per kind, so a file is refused before it uploads.
517
+ * @ruling composer attachments D6
518
+ */
519
+ bytesPerKind: Record<AttachmentKindV1, number>;
520
+ }
521
+ //# sourceMappingURL=sessionDossier.d.ts.map
@@ -0,0 +1,33 @@
1
+ /**
2
+ * ๐Ÿšง The conversation **dossier** โ€” `session_full.v1`, the section a widget
3
+ * granted `session:full` is posted ({@link WidgetScopedSections}): what core's
4
+ * conversation widget is told about its session beyond the envelope's base
5
+ * sections.
6
+ *
7
+ * The page answers here what only the page can: who the viewer controls, who
8
+ * spoke each line and with what face, where scenes and history entries fall,
9
+ * whether older messages remain. The widget judges nothing it is not told,
10
+ * and acts only through its verbs (`invoke`, `request`) โ€” so the same widget
11
+ * runs as a remote in the page's UI worker, where there is no page to ask.
12
+ *
13
+ * A plugin's widget sees it only when it declares the `session:full` scope
14
+ * and an admin grants that permission (`widget:session:full`) at review โ€”
15
+ * never by default; the grant shows the whole conversation as the viewer
16
+ * sees it (the cast, their personas, their unsent draft, the session's
17
+ * state).
18
+ *
19
+ * Declared here, beside the other section shapes, since 2026-10-10:
20
+ * it was core-catalog's
21
+ * `ConversationDossierV1`, which now names this type (โณ REMOVE in 0.7.0).
22
+ * The fields are exactly what core's conversation (`MessagesWidget` and
23
+ * its children) reads today, plus `backdrop`, which the host that draws the
24
+ * copy reads. Provisional as a whole: its shape settles when the
25
+ * conversation moves onto the public contract.
26
+ *
27
+ * Imports nothing but the story-time leaf's types (`StoryTime`,
28
+ * `StoryCalendar`, itself importing nothing), so `widgets.ts` names it
29
+ * without a cycle.
30
+ * @ruling C0b, PLAN-widget-system-consolidation C4, C8
31
+ */
32
+ export {};
33
+ //# sourceMappingURL=sessionDossier.js.map