@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
package/dist/nodeInput.js CHANGED
@@ -59,7 +59,7 @@ export function declaresReads(hook, requires) {
59
59
  return Object.assign(hook, { requires });
60
60
  }
61
61
  /**
62
- * Attach a read declaration a contract has checked (ruling R-12, 2026-09-15).
62
+ * Attach a read declaration a contract has checked.
63
63
  *
64
64
  * ```ts
65
65
  * reads<typeof C.sessionHistory>(
@@ -94,6 +94,7 @@ export function declaresReads(hook, requires) {
94
94
  * when the two pins read differently, and declare the intersection when they
95
95
  * do not. An identical redeclaration is a no-op, on the registry's own terms.
96
96
  * @experimental
97
+ * @ruling R-12 (2026-09-15)
97
98
  */
98
99
  export function reads(hook, requires) {
99
100
  const plain = {
@@ -1,7 +1,5 @@
1
1
  /**
2
- * Participant references — who an audience names, and who is speaking
3
- * (plans/29 R-15 *audience*, R-18 (3), R-21 (4); ruled 2026-09-15, built
4
- * 2026-09-16 as U5a).
2
+ * Participant references — who an audience names, and who is speaking.
5
3
  *
6
4
  * One grammar answers two questions that used to be answered by two
7
5
  * vocabularies: an action's **audience** (who may *see* it, who may *act* on
@@ -23,7 +21,7 @@
23
21
  * | `item` | The **per-message ownership rule**: whoever the message belongs to, decided at the venue, never resolvable ahead of a message. |
24
22
  * | `run-owner` | The person who started the run. |
25
23
  *
26
- * `character:` and `envoy:` are the two forms a **speaker** takes (R-18 (3)):
24
+ * `character:` and `envoy:` are the two forms a **speaker** takes:
27
25
  * a character id for somebody in the library, an envoy slug for somebody who
28
26
  * exists nowhere but the genre. The slug is namespaced like a slash name when
29
27
  * an action contributes it (`<plugin>.<key>`), so it cannot collide with a
@@ -33,30 +31,31 @@
33
31
  *
34
32
  * A reference is a name; **who portrays it this turn** — a person, the AI, or
35
33
  * nobody — is the host's answer, resolved once at run start and pinned on
36
- * the receipt as `portrayals` (R-21 (4)), like config. The SDK declares the
34
+ * the receipt as `portrayals`, like config. The SDK declares the
37
35
  * question's shape (`Portrayal`) and never answers it: nodes stay blind to
38
36
  * it, and a definition that needs the answer declares an in-port.
39
37
  *
40
38
  * *Portrayal*, not *voice*: a **voice** is one cast member's step inside an
41
39
  * adventure turn (`.each('voices')`), and a connection's `voices` are TTS —
42
- * the resolver's answer is a third thing and gets its own word (ruled
43
- * 2026-09-16).
40
+ * the resolver's answer is a third thing and gets its own word.
44
41
  *
45
42
  * ## What this is not
46
43
  *
47
- * Not a *cast* row (a membership), not a *scope* (§6 config layering), and
44
+ * Not a *cast* row (a membership), not a *scope* (config layering), and
48
45
  * not *availability* (the genre's `messageVerbs`). A reference says *who*;
49
46
  * the venue says *where*; the resolver says *whether they are here*.
47
+ * @ruling plans/29 R-15 *audience*, R-18 (3), R-21 (4) (ruled 2026-09-15), U5a (2026-09-16), R-18 (3), R-21 (4), ruled 2026-09-16, §6
50
48
  */
51
49
  /**
52
50
  * The role-shaped references — no id, resolved against the session and the run.
53
51
  *
54
52
  * `participant` is everyone in the session: its people, and the model's
55
- * context. The two catch-alls split it (R57): `person` is every human member,
53
+ * context. The two catch-alls split it: `person` is every human member,
56
54
  * `ai` is the model's context — what goes into a prompt. A data audience
57
55
  * (`see` on a stored value) is written in these; an empty one is pipelines
58
56
  * only.
59
57
  * @experimental
58
+ * @ruling R57
60
59
  */
61
60
  export declare const PARTICIPANT_ROLES: readonly ['owner', 'admin', 'participant', 'person', 'ai', 'item', 'run-owner'];
62
61
  /** @experimental */
@@ -85,9 +84,10 @@ export type ParsedParticipantRef = {
85
84
  slug: string;
86
85
  };
87
86
  /**
88
- * Who may see, and who may act (R-15). Declared here for the action model;
89
- * consumed by the venue work (U5c) — no UI reads it yet.
87
+ * Who may see, and who may act. Declared here for the action model;
88
+ * consumed by the venue work — no UI reads it yet.
90
89
  * @experimental
90
+ * @ruling R-15, U5c
91
91
  */
92
92
  export interface Audience {
93
93
  see: ParticipantRef[];
@@ -133,30 +133,37 @@ export declare function audienceHolds(refs: ReadonlyArray<ParticipantRef>, portr
133
133
  userId: number | string;
134
134
  }, item?: boolean): boolean;
135
135
  /**
136
- * Does the model's context hold any of these references (R57)? The prompt
136
+ * Does the model's context hold any of these references? The prompt
137
137
  * built for `speaker` — a `character:` or `envoy:` reference, when there is
138
138
  * one — may carry what everyone may see (`participant`), what the model may
139
139
  * (`ai`), and what that speaker may. `[]` holds for nobody.
140
140
  * @internal
141
+ * @ruling R57
141
142
  */
142
143
  export declare function aiHolds(refs: ReadonlyArray<ParticipantRef>, speaker?: ParticipantRef | null): boolean;
143
144
  /** The one spelling of a reference — `' character:7 '` is `character:7`. Throws on a non-reference. @internal */
144
145
  export declare const canonicalParticipantRef: (raw: string) => ParticipantRef;
145
- /** Who may see each stored value, by owner and key; a key with no entry is pipelines only (R59). @experimental */
146
+ /**
147
+ * Who may see each stored value, by owner and key; a key with no entry is pipelines only.
148
+ * @experimental
149
+ * @ruling R59
150
+ */
146
151
  export type DataAudiences = Record<string, Record<string, ParticipantRef[]>>;
147
152
  /**
148
- * One reader's view of an owner-keyed store (R57): the values whose audience
153
+ * One reader's view of an owner-keyed store: the values whose audience
149
154
  * `holds` for that reader, as one object per owner. An owner left with no
150
155
  * value the reader may see is left out. Pipelines read the store itself, not
151
156
  * this.
152
157
  * @internal
158
+ * @ruling R57
153
159
  */
154
160
  export declare function visibleTo(values: Record<string, unknown>, audiences: DataAudiences, holds: (refs: ReadonlyArray<ParticipantRef>) => boolean): Record<string, Record<string, unknown>>;
155
161
  /**
156
- * What is wrong with an audience a write names, or undefined (R57). A list of
162
+ * What is wrong with an audience a write names, or undefined. A list of
157
163
  * participant references; `item` and `run-owner` mean nothing for a stored
158
164
  * value — there is no message to own, and a value outlives the run.
159
165
  * @internal
166
+ * @ruling R57
160
167
  */
161
168
  export declare function dataAudienceFindings(raw: unknown): string | undefined;
162
169
  /**
@@ -1,7 +1,5 @@
1
1
  /**
2
- * Participant references — who an audience names, and who is speaking
3
- * (plans/29 R-15 *audience*, R-18 (3), R-21 (4); ruled 2026-09-15, built
4
- * 2026-09-16 as U5a).
2
+ * Participant references — who an audience names, and who is speaking.
5
3
  *
6
4
  * One grammar answers two questions that used to be answered by two
7
5
  * vocabularies: an action's **audience** (who may *see* it, who may *act* on
@@ -23,7 +21,7 @@
23
21
  * | `item` | The **per-message ownership rule**: whoever the message belongs to, decided at the venue, never resolvable ahead of a message. |
24
22
  * | `run-owner` | The person who started the run. |
25
23
  *
26
- * `character:` and `envoy:` are the two forms a **speaker** takes (R-18 (3)):
24
+ * `character:` and `envoy:` are the two forms a **speaker** takes:
27
25
  * a character id for somebody in the library, an envoy slug for somebody who
28
26
  * exists nowhere but the genre. The slug is namespaced like a slash name when
29
27
  * an action contributes it (`<plugin>.<key>`), so it cannot collide with a
@@ -33,30 +31,31 @@
33
31
  *
34
32
  * A reference is a name; **who portrays it this turn** — a person, the AI, or
35
33
  * nobody — is the host's answer, resolved once at run start and pinned on
36
- * the receipt as `portrayals` (R-21 (4)), like config. The SDK declares the
34
+ * the receipt as `portrayals`, like config. The SDK declares the
37
35
  * question's shape (`Portrayal`) and never answers it: nodes stay blind to
38
36
  * it, and a definition that needs the answer declares an in-port.
39
37
  *
40
38
  * *Portrayal*, not *voice*: a **voice** is one cast member's step inside an
41
39
  * adventure turn (`.each('voices')`), and a connection's `voices` are TTS —
42
- * the resolver's answer is a third thing and gets its own word (ruled
43
- * 2026-09-16).
40
+ * the resolver's answer is a third thing and gets its own word.
44
41
  *
45
42
  * ## What this is not
46
43
  *
47
- * Not a *cast* row (a membership), not a *scope* (§6 config layering), and
44
+ * Not a *cast* row (a membership), not a *scope* (config layering), and
48
45
  * not *availability* (the genre's `messageVerbs`). A reference says *who*;
49
46
  * the venue says *where*; the resolver says *whether they are here*.
47
+ * @ruling plans/29 R-15 *audience*, R-18 (3), R-21 (4) (ruled 2026-09-15), U5a (2026-09-16), R-18 (3), R-21 (4), ruled 2026-09-16, §6
50
48
  */
51
49
  /**
52
50
  * The role-shaped references — no id, resolved against the session and the run.
53
51
  *
54
52
  * `participant` is everyone in the session: its people, and the model's
55
- * context. The two catch-alls split it (R57): `person` is every human member,
53
+ * context. The two catch-alls split it: `person` is every human member,
56
54
  * `ai` is the model's context — what goes into a prompt. A data audience
57
55
  * (`see` on a stored value) is written in these; an empty one is pipelines
58
56
  * only.
59
57
  * @experimental
58
+ * @ruling R57
60
59
  */
61
60
  export const PARTICIPANT_ROLES = ['owner', 'admin', 'participant', 'person', 'ai', 'item', 'run-owner'];
62
61
  /**
@@ -86,11 +85,12 @@ export function audienceHolds(refs, portrayals, viewer, item) {
86
85
  return false;
87
86
  }
88
87
  /**
89
- * Does the model's context hold any of these references (R57)? The prompt
88
+ * Does the model's context hold any of these references? The prompt
90
89
  * built for `speaker` — a `character:` or `envoy:` reference, when there is
91
90
  * one — may carry what everyone may see (`participant`), what the model may
92
91
  * (`ai`), and what that speaker may. `[]` holds for nobody.
93
92
  * @internal
93
+ * @ruling R57
94
94
  */
95
95
  export function aiHolds(refs, speaker) {
96
96
  const who = speaker && isParticipantRef(speaker) ? canonicalParticipantRef(speaker) : null;
@@ -104,11 +104,12 @@ export function aiHolds(refs, speaker) {
104
104
  /** The one spelling of a reference — `' character:7 '` is `character:7`. Throws on a non-reference. @internal */
105
105
  export const canonicalParticipantRef = (raw) => formatParticipantRef(parseParticipantRef(raw));
106
106
  /**
107
- * One reader's view of an owner-keyed store (R57): the values whose audience
107
+ * One reader's view of an owner-keyed store: the values whose audience
108
108
  * `holds` for that reader, as one object per owner. An owner left with no
109
109
  * value the reader may see is left out. Pipelines read the store itself, not
110
110
  * this.
111
111
  * @internal
112
+ * @ruling R57
112
113
  */
113
114
  export function visibleTo(values, audiences, holds) {
114
115
  const out = {};
@@ -127,10 +128,11 @@ export function visibleTo(values, audiences, holds) {
127
128
  return out;
128
129
  }
129
130
  /**
130
- * What is wrong with an audience a write names, or undefined (R57). A list of
131
+ * What is wrong with an audience a write names, or undefined. A list of
131
132
  * participant references; `item` and `run-owner` mean nothing for a stored
132
133
  * value — there is no message to own, and a value outlives the run.
133
134
  * @internal
135
+ * @ruling R57
134
136
  */
135
137
  export function dataAudienceFindings(raw) {
136
138
  if (raw === undefined)
@@ -18,7 +18,8 @@
18
18
  *
19
19
  * Pure — no DOM, no clock: callers hand in the last press and `now`.
20
20
  *
21
- * @experimental 🚧 provisional with the widget invoke vocabulary (C7, R80).
21
+ * @experimental 🚧 provisional with the widget invoke vocabulary.
22
+ * @ruling C7, R80
22
23
  */
23
24
  /** Core's verbs that change a message or start a turn, and so need a person behind a widget's invoke of them. @experimental */
24
25
  export declare const PERSON_GATED_CORE_VERBS: ReadonlySet<string>;
@@ -18,7 +18,8 @@
18
18
  *
19
19
  * Pure — no DOM, no clock: callers hand in the last press and `now`.
20
20
  *
21
- * @experimental 🚧 provisional with the widget invoke vocabulary (C7, R80).
21
+ * @experimental 🚧 provisional with the widget invoke vocabulary.
22
+ * @ruling C7, R80
22
23
  */
23
24
  /** Core's verbs that change a message or start a turn, and so need a person behind a widget's invoke of them. @experimental */
24
25
  export const PERSON_GATED_CORE_VERBS = new Set([
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The **plugin sandbox's context, in the author's harness** (plans 29 §14 D-3).
2
+ * The **plugin sandbox's context, in the author's harness**.
3
3
  *
4
4
  * The SDK's executor builds a node's context itself — `{ signal, progress,
5
5
  * status, log, countTokens }`, plus `read` for a Query, `call` for an Oracle and
@@ -32,6 +32,7 @@
32
32
  * reproduced is the *shape* — which members exist, which are withheld, what a
33
33
  * refusal says, and where the randomness and the clock come from — because that
34
34
  * is what a handler can be written against and get wrong.
35
+ * @ruling plans 29 §14 D-3
35
36
  */
36
37
  import { type Bindings, type Result } from './executor.js';
37
38
  import type { HookFetchInit, HookFetchResponse } from './hooks.js';
@@ -164,7 +165,10 @@ export interface PluginHandlerContextOptions {
164
165
  * to be able to reproduce.
165
166
  */
166
167
  seed?: string;
167
- /** The hook kind, which decides the grants (R-3). Omitted: both granted. */
168
+ /**
169
+ * The hook kind, which decides the grants. Omitted: both granted.
170
+ * @ruling R-3
171
+ */
168
172
  kind?: HookCtxKind;
169
173
  /** Override the kind's grants — for pinning what a handler does without one. */
170
174
  grants?: Partial<HookCtxGrants>;
@@ -228,8 +232,9 @@ export interface PluginNodeBindingOptions {
228
232
  * place. Everything else it built — `read`, `call`, `commit`, `progress`,
229
233
  * `status`, `countTokens` — is dropped, because no sandbox has ever endowed it.
230
234
  * A plugin Query reaching for `ctx.read` therefore fails here exactly as it
231
- * fails at install, which is the whole reason this exists (G13).
235
+ * fails at install, which is the whole reason this exists.
232
236
  * @experimental
237
+ * @ruling G13
233
238
  */
234
239
  export declare function pluginNodeBindings(opts: PluginNodeBindingOptions): Bindings;
235
240
  //# sourceMappingURL=pluginHarness.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * The **plugin sandbox's context, in the author's harness** (plans 29 §14 D-3).
2
+ * The **plugin sandbox's context, in the author's harness**.
3
3
  *
4
4
  * The SDK's executor builds a node's context itself — `{ signal, progress,
5
5
  * status, log, countTokens }`, plus `read` for a Query, `call` for an Oracle and
@@ -32,6 +32,7 @@
32
32
  * reproduced is the *shape* — which members exist, which are withheld, what a
33
33
  * refusal says, and where the randomness and the clock come from — because that
34
34
  * is what a handler can be written against and get wrong.
35
+ * @ruling plans 29 §14 D-3
35
36
  */
36
37
  import { getDefinition } from './descriptors.js';
37
38
  import { err, ok } from './executor.js';
@@ -525,8 +526,9 @@ function makeFetch(opts, signal) {
525
526
  * place. Everything else it built — `read`, `call`, `commit`, `progress`,
526
527
  * `status`, `countTokens` — is dropped, because no sandbox has ever endowed it.
527
528
  * A plugin Query reaching for `ctx.read` therefore fails here exactly as it
528
- * fails at install, which is the whole reason this exists (G13).
529
+ * fails at install, which is the whole reason this exists.
529
530
  * @experimental
531
+ * @ruling G13
530
532
  */
531
533
  export function pluginNodeBindings(opts) {
532
534
  const storage = opts.storage ?? memoryStorage();
@@ -1,5 +1,5 @@
1
1
  /**
2
- * What a plugin may do, by kind (K1, R50): one table, rendered from the grant
2
+ * What a plugin may do, by kind: one table, rendered from the grant
3
3
  * table the sandboxes enforce (`hookCtxKeysFor`) and the rulings every door
4
4
  * refuses on, so the guide cannot claim more or less than the code does.
5
5
  *
@@ -9,6 +9,7 @@
9
9
  *
10
10
  * ⚠ Not a **capability** — that is what a *connection* can do (`capabilities.ts`).
11
11
  * These are a plugin's **permissions**: what its sandboxed code may do (canon).
12
+ * @ruling K1, R50
12
13
  */
13
14
  import type { PluginRule } from './pluginRuleRef.js';
14
15
  export { PLUGIN_PERMISSIONS_GUIDE, pluginRuleRef, type PluginRule } from './pluginRuleRef.js';
@@ -1,5 +1,5 @@
1
1
  /**
2
- * What a plugin may do, by kind (K1, R50): one table, rendered from the grant
2
+ * What a plugin may do, by kind: one table, rendered from the grant
3
3
  * table the sandboxes enforce (`hookCtxKeysFor`) and the rulings every door
4
4
  * refuses on, so the guide cannot claim more or less than the code does.
5
5
  *
@@ -9,6 +9,7 @@
9
9
  *
10
10
  * ⚠ Not a **capability** — that is what a *connection* can do (`capabilities.ts`).
11
11
  * These are a plugin's **permissions**: what its sandboxed code may do (canon).
12
+ * @ruling K1, R50
12
13
  */
13
14
  import { HOOK_CTX_KINDS, hookCtxKeysFor } from './hookGrants.js';
14
15
  export { PLUGIN_PERMISSIONS_GUIDE, pluginRuleRef } from './pluginRuleRef.js';
@@ -44,6 +45,16 @@ export const PLUGIN_RULES = {
44
45
  text: 'No node emits an event or starts a pipeline. A package records its own declared event with the ' +
45
46
  '`record-event` write, within the scope its entry declares, and everything in the session hears it.',
46
47
  },
48
+ 'widget-writes': {
49
+ title: 'A widget writes only behind a write grant',
50
+ ruling: 'Q2',
51
+ text: "A widget's scope lets it read (`session:state`, reviewed as `widget:session:state`); changing what the " +
52
+ 'scope covers is a separate **write grant**, asked for in the same `scopes` and reviewed on its own: ' +
53
+ '`session:state:write` lets it ask `set-attribute-value`, and `channel:<slug>:write` lets it ask `send` ' +
54
+ "and `draft` on that channel, which it must also list in its `channels`. Holding the write never grants the " +
55
+ "read. Each write goes in as the viewer, only while a person is pressing in the widget, and with the " +
56
+ "viewer's own permissions. Every other change a widget wants goes through its plugin's own actions.",
57
+ },
47
58
  };
48
59
  /** The anchor a kind's heading gets: `kind-oracle`. */
49
60
  const kindAnchor = (kind) => `kind-${kind}`;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * A refusal's pointer to the plugin permissions guide (K1c) — its own module,
2
+ * A refusal's pointer to the plugin permissions guide — its own module,
3
3
  * with one type-only import, so every refusal site (descriptors, the extension, the CLI) can
4
4
  * name a row without pulling the grant table in behind it.
5
5
  */
@@ -7,7 +7,7 @@ import type { HookCtxKind } from './hookGrants.js';
7
7
  /** Where the guide lives, as a refusal sentence names it. @experimental */
8
8
  export declare const PLUGIN_PERMISSIONS_GUIDE = "guides/plugin-permissions.md";
9
9
  /** The rules a refusal can point at; each is a heading in the guide. @experimental */
10
- export type PluginRule = 'connections' | 'private-nodes' | 'secrets' | 'events';
10
+ export type PluginRule = 'connections' | 'private-nodes' | 'secrets' | 'events' | 'widget-writes';
11
11
  /** ` (see guides/plugin-permissions.md#secrets)` — a row's anchor, as a refusal names it. @experimental */
12
12
  export declare const pluginRuleRef: (anchor: PluginRule | `kind-${HookCtxKind}`) => string;
13
13
  //# sourceMappingURL=pluginRuleRef.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * A refusal's pointer to the plugin permissions guide (K1c) — its own module,
2
+ * A refusal's pointer to the plugin permissions guide — its own module,
3
3
  * with one type-only import, so every refusal site (descriptors, the extension, the CLI) can
4
4
  * name a row without pulling the grant table in behind it.
5
5
  */
@@ -1,7 +1,6 @@
1
1
  /**
2
- * Predicates — one declared shape, read in two places (plans/29 R-15
3
- * *enabled-when*; 20 §10 *junction*; ruled 2026-09-15, built 2026-09-17 as
4
- * U5e).
2
+ * Predicates — one declared shape, read in two places (*enabled-when* and
3
+ * *junction*; ruled 2026-09-15, built 2026-09-17).
5
4
  *
6
5
  * A **junction** clause branches on a value a task computed: each branch is
7
6
  * `{ path?, equals? | equalsPath? | truthy? }` over that value. An action's
@@ -12,7 +11,7 @@
12
11
  * both read, so a predicate that fires a branch and one that greys a button
13
12
  * can never mean two things.
14
13
  *
15
- * ## The two-port compare (D-4a, 2026-09-17)
14
+ * ## The two-port compare (2026-09-17)
16
15
  *
17
16
  * `equals` takes a literal, so until this the grammar could ask *is the
18
17
  * accused Vell?* and never *is the accused the culprit?* — and a genre that
@@ -31,6 +30,7 @@
31
30
  * or in a value the state-keeper publishes. And not the field-level
32
31
  * `ValuePredicate` of `values.ts`, which gates one settings-form field on a
33
32
  * sibling field's value.
33
+ * @ruling plans/29 R-15, 20 §10, U5e, D-4a (2026-09-17)
34
34
  */
35
35
  import type { I18n, LocaleMap } from './descriptors.js';
36
36
  import { i18nFindings, localeMapOf } from './i18n.js';
@@ -53,7 +53,7 @@ export interface Predicate {
53
53
  equals?: unknown;
54
54
  /**
55
55
  * Holds when the value strictly equals **the value at another path in the
56
- * same document** — the two-port compare (D-4a, 2026-09-17).
56
+ * same document** — the two-port compare.
57
57
  *
58
58
  * `equals` takes a literal, so a document could state *is the accused
59
59
  * Vell?* and never *is the accused the culprit?* — which is the one
@@ -70,6 +70,7 @@ export interface Predicate {
70
70
  * Strict (`===`) like `equals`, so it compares a key and not a document:
71
71
  * two structurally equal objects are not equal here, and a structured
72
72
  * comparison belongs in a value the pipeline publishes as one.
73
+ * @ruling D-4a (2026-09-17)
73
74
  */
74
75
  equalsPath?: string;
75
76
  /** Holds when the value is truthy (`truthy`). */
@@ -101,7 +102,7 @@ export declare const PREDICATE_CONDITION_KEYS: readonly string[];
101
102
  */
102
103
  export declare function predicateHolds(pred: Predicate, value: unknown, scope?: unknown): boolean;
103
104
  /**
104
- * One enabled-when predicate (plans/29 R-15): a declared condition over the
105
+ * One enabled-when predicate: a declared condition over the
105
106
  * session's published values that says whether an action is offered *now*.
106
107
  * The junction clause's predicate shape, never code.
107
108
  *
@@ -111,10 +112,10 @@ export declare function predicateHolds(pred: Predicate, value: unknown, scope?:
111
112
  * `message` venue, `item.<field>` per message — `item.id`, `item.isNewest`,
112
113
  * `item.hidden`, `item.generating`, `item.role`, `item.mine`,
113
114
  * `item.hasSwipes`, `item.greeting`, `item.channel`, `item.speaker` (a
114
- * participant reference, or null) and `item.characterLine` (lair re-plan
115
- * R11). A predicate over `item.*` is evaluated
115
+ * participant reference, or null) and `item.characterLine`. A predicate over `item.*` is evaluated
116
116
  * where a message is at hand: the client per row, the server at the door.
117
117
  * @experimental
118
+ * @ruling plans/29 R-15, lair re-plan R11
118
119
  */
119
120
  export interface EnabledWhen extends Predicate {
120
121
  /**
@@ -123,7 +124,10 @@ export interface EnabledWhen extends Predicate {
123
124
  * actions live outside a run.
124
125
  */
125
126
  on: string;
126
- /** Why the control is grey when this predicate does not hold. Required (R-20: a string or a locale map with `en`). */
127
+ /**
128
+ * Why the control is grey when this predicate does not hold. Required (a string or a locale map with `en`).
129
+ * @ruling R-20
130
+ */
127
131
  reason: I18n;
128
132
  }
129
133
  /** The keys an enabled-when may carry; anything else is a finding. @experimental */
@@ -172,11 +176,12 @@ export declare function partitionEnabledWhen(preds: ReadonlyArray<EnabledWhen>,
172
176
  };
173
177
  /**
174
178
  * Every fault in one enabled-when declaration — a predicate or a list — as
175
- * sentences that say what to do instead (the teaching-error pattern, 15
176
- * §1.3). Empty when it is sound, and for `undefined` (no predicate). Applied
179
+ * sentences that say what to do instead (the teaching-error pattern).
180
+ * Empty when it is sound, and for `undefined` (no predicate). Applied
177
181
  * to an action's `enabledWhen` at construction, in `validate()` and at the
178
182
  * host's publish, and to a genre's defaults at declaration.
179
183
  * @experimental
184
+ * @ruling 15 §1.3
180
185
  */
181
186
  export declare function enabledWhenFindings(raw: unknown, at?: string): string[];
182
187
  //# sourceMappingURL=predicates.d.ts.map
@@ -1,7 +1,6 @@
1
1
  /**
2
- * Predicates — one declared shape, read in two places (plans/29 R-15
3
- * *enabled-when*; 20 §10 *junction*; ruled 2026-09-15, built 2026-09-17 as
4
- * U5e).
2
+ * Predicates — one declared shape, read in two places (*enabled-when* and
3
+ * *junction*; ruled 2026-09-15, built 2026-09-17).
5
4
  *
6
5
  * A **junction** clause branches on a value a task computed: each branch is
7
6
  * `{ path?, equals? | equalsPath? | truthy? }` over that value. An action's
@@ -12,7 +11,7 @@
12
11
  * both read, so a predicate that fires a branch and one that greys a button
13
12
  * can never mean two things.
14
13
  *
15
- * ## The two-port compare (D-4a, 2026-09-17)
14
+ * ## The two-port compare (2026-09-17)
16
15
  *
17
16
  * `equals` takes a literal, so until this the grammar could ask *is the
18
17
  * accused Vell?* and never *is the accused the culprit?* — and a genre that
@@ -31,6 +30,7 @@
31
30
  * or in a value the state-keeper publishes. And not the field-level
32
31
  * `ValuePredicate` of `values.ts`, which gates one settings-form field on a
33
32
  * sibling field's value.
33
+ * @ruling plans/29 R-15, 20 §10, U5e, D-4a (2026-09-17)
34
34
  */
35
35
  import { i18nFindings, localeMapOf } from './i18n.js';
36
36
  /** The junction's truthiness: a value that is not falsy and not an empty list. @experimental */
@@ -166,11 +166,12 @@ export function partitionEnabledWhen(preds, prefix) {
166
166
  }
167
167
  /**
168
168
  * Every fault in one enabled-when declaration — a predicate or a list — as
169
- * sentences that say what to do instead (the teaching-error pattern, 15
170
- * §1.3). Empty when it is sound, and for `undefined` (no predicate). Applied
169
+ * sentences that say what to do instead (the teaching-error pattern).
170
+ * Empty when it is sound, and for `undefined` (no predicate). Applied
171
171
  * to an action's `enabledWhen` at construction, in `validate()` and at the
172
172
  * host's publish, and to a genre's defaults at declaration.
173
173
  * @experimental
174
+ * @ruling 15 §1.3
174
175
  */
175
176
  export function enabledWhenFindings(raw, at = 'enabledWhen') {
176
177
  if (raw === undefined || raw === null)
package/dist/preview.d.ts CHANGED
@@ -9,10 +9,11 @@
9
9
  * because something is off.
10
10
  *
11
11
  * Almost everything the panel shows is already in the receipt: Assemble records the
12
- * allocation it computed and the inputs it computed it from (16 §5a), and the Provider's
12
+ * allocation it computed and the inputs it computed it from, and the Provider's
13
13
  * resolved input is recorded like any node's. The preview hoists those into one place so
14
14
  * a UI does not have to reassemble them from three node receipts, and adds the one thing
15
15
  * that only exists at the call site — the formed payload and its token count.
16
+ * @ruling 16 §5a
16
17
  */
17
18
  import type { Receipt } from './receipt.js';
18
19
  /** @experimental */
@@ -40,7 +41,10 @@ export interface PreviewReport {
40
41
  atNode: string;
41
42
  definitionId: string;
42
43
  targetedBy: 'first-provider-on-spine' | 'explicit';
43
- /** Metadata only — material never leaves core (F18). */
44
+ /**
45
+ * Metadata only — material never leaves core.
46
+ * @ruling F18
47
+ */
44
48
  connection?: {
45
49
  id?: string;
46
50
  kind?: string;
@@ -58,9 +62,10 @@ export interface PreviewReport {
58
62
  tokens: number;
59
63
  };
60
64
  /**
61
- * How blocks became that payload (16 §7). Present once a Provider declares a `wire`
65
+ * How blocks became that payload. Present once a Provider declares a `wire`
62
66
  * slot — and it is what makes the scaffolding cost visible rather than a mystery
63
67
  * gap between "my blocks add up to 3,000" and "it said 3,180".
68
+ * @ruling 16 §7
64
69
  */
65
70
  wire?: {
66
71
  format: string;
package/dist/preview.js CHANGED
@@ -9,10 +9,11 @@
9
9
  * because something is off.
10
10
  *
11
11
  * Almost everything the panel shows is already in the receipt: Assemble records the
12
- * allocation it computed and the inputs it computed it from (16 §5a), and the Provider's
12
+ * allocation it computed and the inputs it computed it from, and the Provider's
13
13
  * resolved input is recorded like any node's. The preview hoists those into one place so
14
14
  * a UI does not have to reassemble them from three node receipts, and adds the one thing
15
15
  * that only exists at the call site — the formed payload and its token count.
16
+ * @ruling 16 §5a
16
17
  */
17
18
  /**
18
19
  * What a counter measures when it is handed something that is not a string.
@@ -11,9 +11,9 @@
11
11
  *
12
12
  * ## ⚠ A third sense of the word `block`
13
13
  *
14
- * NOMENCLATURE §15 says a **block** is one message — `system`, `user`,
14
+ * The vocabulary canon says a **block** is one message — `system`, `user`,
15
15
  * `assistant`. The pipeline container that used to share the word is a
16
- * **clause** since 2026-09-15 (R-14), which took one sense off the pile. This
16
+ * **clause** since 2026-09-15, which took one sense off the pile. This
17
17
  * is another: one **section within** a prompt, named by the template variable
18
18
  * that renders it. The word is the ruling's, so it is used here and recorded
19
19
  * there rather than quietly replaced with a fresh invention. Say **prompt
@@ -27,6 +27,7 @@
27
27
  * with its receipt. It renders nothing and knows no template syntax — which
28
28
  * template variables a given story string produces is a question only that
29
29
  * template's engine can answer, and the host asks it.
30
+ * @ruling NOMENCLATURE §15, R-14
30
31
  */
31
32
  import type { FieldDecl } from './settings.js';
32
33
  /**
@@ -54,12 +55,13 @@ export interface PromptBlockEntry {
54
55
  * declared default cannot drift from the prompt a fresh install actually gets.
55
56
  *
56
57
  * Order is the 0.5 prompt's order, with `characterLore` under the cards it is
57
- * about — and `currentDate` LAST (B2, 2026-10-03), not first: the top of the
58
+ * about — and `currentDate` LAST, not first: the top of the
58
59
  * prompt is what a backend's cache reuses from turn to turn, and the date is
59
60
  * the one system-block value that changes on its own. Do not tidy it: every
60
61
  * entry's position is a byte in every prompt on every install that has
61
62
  * changed nothing.
62
63
  * @internal
64
+ * @ruling B2 (2026-10-03)
63
65
  */
64
66
  export declare const SHIPPED_PROMPT_BLOCK_IDS: readonly ['instructions', 'characters', 'personas', 'characterLore', 'scenario', 'worldLore', 'history', 'relationshipsPerspectives', 'relationshipsKnown', 'currentDate'];
65
67
  /** @experimental */
@@ -11,9 +11,9 @@
11
11
  *
12
12
  * ## ⚠ A third sense of the word `block`
13
13
  *
14
- * NOMENCLATURE §15 says a **block** is one message — `system`, `user`,
14
+ * The vocabulary canon says a **block** is one message — `system`, `user`,
15
15
  * `assistant`. The pipeline container that used to share the word is a
16
- * **clause** since 2026-09-15 (R-14), which took one sense off the pile. This
16
+ * **clause** since 2026-09-15, which took one sense off the pile. This
17
17
  * is another: one **section within** a prompt, named by the template variable
18
18
  * that renders it. The word is the ruling's, so it is used here and recorded
19
19
  * there rather than quietly replaced with a fresh invention. Say **prompt
@@ -27,6 +27,7 @@
27
27
  * with its receipt. It renders nothing and knows no template syntax — which
28
28
  * template variables a given story string produces is a question only that
29
29
  * template's engine can answer, and the host asks it.
30
+ * @ruling NOMENCLATURE §15, R-14
30
31
  */
31
32
  /**
32
33
  * The blocks Serene Pub's shipped context template renders, **in its order**.
@@ -38,12 +39,13 @@
38
39
  * declared default cannot drift from the prompt a fresh install actually gets.
39
40
  *
40
41
  * Order is the 0.5 prompt's order, with `characterLore` under the cards it is
41
- * about — and `currentDate` LAST (B2, 2026-10-03), not first: the top of the
42
+ * about — and `currentDate` LAST, not first: the top of the
42
43
  * prompt is what a backend's cache reuses from turn to turn, and the date is
43
44
  * the one system-block value that changes on its own. Do not tidy it: every
44
45
  * entry's position is a byte in every prompt on every install that has
45
46
  * changed nothing.
46
47
  * @internal
48
+ * @ruling B2 (2026-10-03)
47
49
  */
48
50
  export const SHIPPED_PROMPT_BLOCK_IDS = [
49
51
  'instructions',
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Ranking decisions (PLAN-sdk-1.0 §3.9, R64): what a ranker says about each
2
+ * Ranking decisions: what a ranker says about each
3
3
  * candidate it judged. A node that publishes an array of these on a port of
4
4
  * shape `core:shape/decisions@1` (`S.decisions`) has them recorded by the
5
5
  * host automatically — nothing else to opt into.
@@ -13,6 +13,7 @@
13
13
  *
14
14
  * A decision with no derivable subject (a message or relationship band) is
15
15
  * counted on its ranking, not stored.
16
+ * @ruling PLAN-sdk-1.0 §3.9, R64
16
17
  */
17
18
  /** The shape id a decisions port carries. @experimental */
18
19
  export declare const DECISIONS_SHAPE = "core:shape/decisions@1";