@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.
Files changed (187) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +17 -0
  3. package/README.md +368 -0
  4. package/dist/actions.d.ts +572 -0
  5. package/dist/actions.js +829 -0
  6. package/dist/annexFields.d.ts +234 -0
  7. package/dist/annexFields.js +413 -0
  8. package/dist/announce.d.ts +464 -0
  9. package/dist/announce.js +426 -0
  10. package/dist/attributes.d.ts +670 -0
  11. package/dist/attributes.js +904 -0
  12. package/dist/bands.d.ts +125 -0
  13. package/dist/bands.js +256 -0
  14. package/dist/builder.d.ts +683 -0
  15. package/dist/builder.js +677 -0
  16. package/dist/candidates.d.ts +109 -0
  17. package/dist/candidates.js +118 -0
  18. package/dist/capabilities.d.ts +744 -0
  19. package/dist/capabilities.js +679 -0
  20. package/dist/channels.d.ts +106 -0
  21. package/dist/channels.js +129 -0
  22. package/dist/clauses.d.ts +40 -0
  23. package/dist/clauses.js +43 -0
  24. package/dist/component.d.ts +33 -0
  25. package/dist/component.js +27 -0
  26. package/dist/componentBuild.d.ts +48 -0
  27. package/dist/componentBuild.js +84 -0
  28. package/dist/componentClient.d.ts +100 -0
  29. package/dist/componentClient.js +13 -0
  30. package/dist/componentImports.d.ts +51 -0
  31. package/dist/componentImports.js +106 -0
  32. package/dist/componentModule.d.ts +8 -0
  33. package/dist/componentModule.js +270 -0
  34. package/dist/componentWire.d.ts +130 -0
  35. package/dist/componentWire.js +280 -0
  36. package/dist/config.d.ts +295 -0
  37. package/dist/config.js +231 -0
  38. package/dist/connections.d.ts +89 -0
  39. package/dist/connections.js +131 -0
  40. package/dist/declarations.d.ts +290 -0
  41. package/dist/declarations.js +794 -0
  42. package/dist/descriptors.d.ts +1774 -0
  43. package/dist/descriptors.js +1329 -0
  44. package/dist/dev.d.ts +136 -0
  45. package/dist/dev.js +161 -0
  46. package/dist/document.d.ts +202 -0
  47. package/dist/document.js +312 -0
  48. package/dist/engines.d.ts +117 -0
  49. package/dist/engines.js +203 -0
  50. package/dist/eventMapLaws.d.ts +63 -0
  51. package/dist/eventMapLaws.js +128 -0
  52. package/dist/events.d.ts +554 -0
  53. package/dist/events.js +633 -0
  54. package/dist/executor.d.ts +771 -0
  55. package/dist/executor.js +1829 -0
  56. package/dist/extension.d.ts +448 -0
  57. package/dist/extension.js +315 -0
  58. package/dist/facets.d.ts +53 -0
  59. package/dist/facets.js +60 -0
  60. package/dist/foldedSections.d.ts +74 -0
  61. package/dist/foldedSections.js +161 -0
  62. package/dist/genres.d.ts +507 -0
  63. package/dist/genres.js +633 -0
  64. package/dist/guardedConnection.d.ts +138 -0
  65. package/dist/guardedConnection.js +341 -0
  66. package/dist/handlebarsReach.d.ts +122 -0
  67. package/dist/handlebarsReach.js +222 -0
  68. package/dist/hash.d.ts +146 -0
  69. package/dist/hash.js +166 -0
  70. package/dist/hookGrants.d.ts +47 -0
  71. package/dist/hookGrants.js +68 -0
  72. package/dist/hooks.d.ts +290 -0
  73. package/dist/hooks.js +113 -0
  74. package/dist/hostElements.d.ts +447 -0
  75. package/dist/hostElements.js +702 -0
  76. package/dist/i18n.d.ts +94 -0
  77. package/dist/i18n.js +123 -0
  78. package/dist/identity.d.ts +93 -0
  79. package/dist/identity.js +135 -0
  80. package/dist/index.d.ts +85 -0
  81. package/dist/index.js +176 -0
  82. package/dist/layout.d.ts +194 -0
  83. package/dist/layout.js +40 -0
  84. package/dist/media.d.ts +202 -0
  85. package/dist/media.js +70 -0
  86. package/dist/messageBlocks.d.ts +487 -0
  87. package/dist/messageBlocks.js +683 -0
  88. package/dist/migration.d.ts +128 -0
  89. package/dist/migration.js +261 -0
  90. package/dist/names.d.ts +78 -0
  91. package/dist/names.js +136 -0
  92. package/dist/nodeInput.d.ts +399 -0
  93. package/dist/nodeInput.js +178 -0
  94. package/dist/participants.d.ts +291 -0
  95. package/dist/participants.js +252 -0
  96. package/dist/personGate.d.ts +62 -0
  97. package/dist/personGate.js +77 -0
  98. package/dist/pick.d.ts +84 -0
  99. package/dist/pick.js +103 -0
  100. package/dist/pluginHarness.d.ts +235 -0
  101. package/dist/pluginHarness.js +558 -0
  102. package/dist/pluginPermissions.d.ts +25 -0
  103. package/dist/pluginPermissions.js +97 -0
  104. package/dist/pluginRuleRef.d.ts +13 -0
  105. package/dist/pluginRuleRef.js +10 -0
  106. package/dist/predicates.d.ts +182 -0
  107. package/dist/predicates.js +249 -0
  108. package/dist/preview.d.ts +120 -0
  109. package/dist/preview.js +82 -0
  110. package/dist/promptBlocks.d.ts +130 -0
  111. package/dist/promptBlocks.js +197 -0
  112. package/dist/rankingDecisions.d.ts +60 -0
  113. package/dist/rankingDecisions.js +48 -0
  114. package/dist/receipt.d.ts +313 -0
  115. package/dist/receipt.js +60 -0
  116. package/dist/receiverRules.d.ts +24 -0
  117. package/dist/receiverRules.js +94 -0
  118. package/dist/refs.d.ts +117 -0
  119. package/dist/refs.js +137 -0
  120. package/dist/registry.d.ts +230 -0
  121. package/dist/registry.js +273 -0
  122. package/dist/review.d.ts +108 -0
  123. package/dist/review.js +97 -0
  124. package/dist/sampling.d.ts +152 -0
  125. package/dist/sampling.js +712 -0
  126. package/dist/scope.d.ts +65 -0
  127. package/dist/scope.js +128 -0
  128. package/dist/scripts.d.ts +243 -0
  129. package/dist/scripts.js +326 -0
  130. package/dist/sessionLayout.d.ts +339 -0
  131. package/dist/sessionLayout.js +503 -0
  132. package/dist/sessionSettings.d.ts +70 -0
  133. package/dist/sessionSettings.js +2 -0
  134. package/dist/settings.d.ts +501 -0
  135. package/dist/settings.js +604 -0
  136. package/dist/settingsSlot.d.ts +108 -0
  137. package/dist/settingsSlot.js +166 -0
  138. package/dist/shapes.d.ts +373 -0
  139. package/dist/shapes.js +408 -0
  140. package/dist/sheets.d.ts +165 -0
  141. package/dist/sheets.js +251 -0
  142. package/dist/statShapes.d.ts +96 -0
  143. package/dist/statShapes.js +112 -0
  144. package/dist/status.d.ts +103 -0
  145. package/dist/status.js +125 -0
  146. package/dist/storage.d.ts +145 -0
  147. package/dist/storage.js +33 -0
  148. package/dist/storyTime.d.ts +308 -0
  149. package/dist/storyTime.js +560 -0
  150. package/dist/surfaces.d.ts +501 -0
  151. package/dist/surfaces.js +292 -0
  152. package/dist/template.d.ts +312 -0
  153. package/dist/template.js +554 -0
  154. package/dist/templateCheck.d.ts +60 -0
  155. package/dist/templateCheck.js +516 -0
  156. package/dist/templateFit.d.ts +157 -0
  157. package/dist/templateFit.js +349 -0
  158. package/dist/templateIds.d.ts +138 -0
  159. package/dist/templateIds.js +144 -0
  160. package/dist/templateScopeAt.d.ts +131 -0
  161. package/dist/templateScopeAt.js +354 -0
  162. package/dist/testing.d.ts +177 -0
  163. package/dist/testing.js +383 -0
  164. package/dist/tokenizers.d.ts +113 -0
  165. package/dist/tokenizers.js +184 -0
  166. package/dist/turnLock.d.ts +96 -0
  167. package/dist/turnLock.js +79 -0
  168. package/dist/turnOrder.d.ts +143 -0
  169. package/dist/turnOrder.js +128 -0
  170. package/dist/validate.d.ts +74 -0
  171. package/dist/validate.js +1399 -0
  172. package/dist/values.d.ts +212 -0
  173. package/dist/values.js +390 -0
  174. package/dist/variables.d.ts +493 -0
  175. package/dist/variables.js +662 -0
  176. package/dist/verdicts.d.ts +275 -0
  177. package/dist/verdicts.js +348 -0
  178. package/dist/widgetDecls.d.ts +88 -0
  179. package/dist/widgetDecls.js +119 -0
  180. package/dist/widgets.d.ts +1527 -0
  181. package/dist/widgets.js +208 -0
  182. package/dist/wire.d.ts +126 -0
  183. package/dist/wire.js +140 -0
  184. package/dist/worldinfo.d.ts +150 -0
  185. package/dist/worldinfo.js +212 -0
  186. package/host-elements.d.ts +914 -0
  187. package/package.json +67 -0
@@ -0,0 +1,108 @@
1
+ /**
2
+ * The review gate (01 §7).
3
+ *
4
+ * The gate lives in the executor substrate, below the type layer, and keys on
5
+ * **declared effects rather than kind** — so an effectful Provider (an MCP tool that
6
+ * sends mail) gates exactly like a Consumer.
7
+ *
8
+ * The properties that matter are all negative, and each has a test:
9
+ * · the gated party never implements the gate
10
+ * · plugin code cannot decline it, detect it, or tell an approved payload from an edited one
11
+ * · an author may default it **on** for their own node; forbidding it is not expressible
12
+ */
13
+ import { type SettingsSchema } from './settings.js';
14
+ /**
15
+ * On or off, and nothing between.
16
+ *
17
+ * There used to be a third position, `async`: run the node, land the write as a
18
+ * proposal, and record it for somebody to look at later. Nobody could name a
19
+ * case for it. A graph proposal must never auto-apply, so it wants the blocking
20
+ * position; a review record per generated message is noise nobody reads. It was
21
+ * a shape the spec allowed rather than a thing anyone asked for, and every
22
+ * screen that offered it had to explain the difference before the reader could
23
+ * choose.
24
+ *
25
+ * `on` is the old `sync`: the run parks until somebody decides. `resolvePosition`
26
+ * still reads the two old spellings, because a stored setting or a plugin's
27
+ * `reviewDefault` may predate this.
28
+ * @experimental
29
+ */
30
+ export type ReviewPosition = 'off' | 'on';
31
+ /** @experimental */
32
+ export interface ReviewRequest {
33
+ nodeKey: string;
34
+ definitionId: string;
35
+ payload: unknown;
36
+ position: Extract<ReviewPosition, 'on'>;
37
+ }
38
+ /** @experimental */
39
+ export interface ReviewDecision {
40
+ action: 'approve' | 'edit' | 'reject';
41
+ /** Present only for 'edit'. The binding cannot tell this from an approval. */
42
+ payload?: unknown;
43
+ by: string;
44
+ at: number;
45
+ }
46
+ /** @experimental */
47
+ export interface ReviewRecord {
48
+ nodeKey: string;
49
+ position: ReviewPosition;
50
+ action: ReviewDecision['action'] | 'proposed';
51
+ originalHash: string;
52
+ editedHash?: string;
53
+ by?: string;
54
+ at?: number;
55
+ }
56
+ /** Resolver supplied by the host. `sync` parks on this promise; waiting is free (F13). @experimental */
57
+ export type Reviewer = (req: ReviewRequest) => Promise<ReviewDecision>;
58
+ /**
59
+ * The form a reviewer is shown for this node's payload.
60
+ *
61
+ * Inferred from the payload (`inferSchema`) — the one field language settings,
62
+ * plugin forms and review pauses share — and then, when the definition
63
+ * declares `review.fields`, narrowed to those names (U5b review C1). A
64
+ * declared field the payload does not carry infers nothing and is simply
65
+ * absent; an undeclared one is never offered. Absent declaration, the whole
66
+ * payload is the form, as it always was.
67
+ *
68
+ * The host builds the form through this and applies an edit through the SAME
69
+ * schema (`applyFormValues` iterates the schema, never the submission), so a
70
+ * field the form did not offer cannot be written by construction. The refusal
71
+ * in `undeclaredReviewFields` is the second, independent guard: a submission
72
+ * naming one is refused outright rather than dropped in silence.
73
+ * @internal
74
+ */
75
+ export declare function reviewSchemaFor(definition: {
76
+ review?: {
77
+ fields: readonly string[];
78
+ };
79
+ } | undefined, payload: unknown): SettingsSchema;
80
+ /**
81
+ * The keys of a decision's values that the definition's `review.fields` does
82
+ * not allow — empty when nothing is declared (every key is then a form
83
+ * field) or when every submitted key is declared. Non-empty means refuse.
84
+ * @internal
85
+ */
86
+ export declare function undeclaredReviewFields(definition: {
87
+ review?: {
88
+ fields: readonly string[];
89
+ };
90
+ } | undefined, values: Record<string, unknown> | undefined): string[];
91
+ /**
92
+ * There is deliberately no `'never'` position and no descriptor field that could produce
93
+ * one. An author picks a default; the user's setting wins over it. Forbidding review is
94
+ * not a value this type can hold, which is the enforcement (F14).
95
+ * @experimental
96
+ */
97
+ export declare const POSITIONS: readonly ReviewPosition[];
98
+ /** @experimental */
99
+ export declare function hashPayload(v: unknown): string;
100
+ /**
101
+ * Resolve the effective position: user setting if present, else the author's default,
102
+ * else off. An author can raise the floor and never lower it below what a user chose.
103
+ * @experimental
104
+ */
105
+ export declare function resolvePosition(authorDefault: ReviewPosition | undefined, userSetting: unknown): ReviewPosition;
106
+ /** Which nodes the gate applies to — effects, not kind (01 §7, 14 §4a). @experimental */
107
+ export declare function isGated(effects: string | undefined): boolean;
108
+ //# sourceMappingURL=review.d.ts.map
package/dist/review.js ADDED
@@ -0,0 +1,97 @@
1
+ /**
2
+ * The review gate (01 §7).
3
+ *
4
+ * The gate lives in the executor substrate, below the type layer, and keys on
5
+ * **declared effects rather than kind** — so an effectful Provider (an MCP tool that
6
+ * sends mail) gates exactly like a Consumer.
7
+ *
8
+ * The properties that matter are all negative, and each has a test:
9
+ * · the gated party never implements the gate
10
+ * · plugin code cannot decline it, detect it, or tell an approved payload from an edited one
11
+ * · an author may default it **on** for their own node; forbidding it is not expressible
12
+ */
13
+ import { inferSchema } from './settings.js';
14
+ /**
15
+ * The form a reviewer is shown for this node's payload.
16
+ *
17
+ * Inferred from the payload (`inferSchema`) — the one field language settings,
18
+ * plugin forms and review pauses share — and then, when the definition
19
+ * declares `review.fields`, narrowed to those names (U5b review C1). A
20
+ * declared field the payload does not carry infers nothing and is simply
21
+ * absent; an undeclared one is never offered. Absent declaration, the whole
22
+ * payload is the form, as it always was.
23
+ *
24
+ * The host builds the form through this and applies an edit through the SAME
25
+ * schema (`applyFormValues` iterates the schema, never the submission), so a
26
+ * field the form did not offer cannot be written by construction. The refusal
27
+ * in `undeclaredReviewFields` is the second, independent guard: a submission
28
+ * naming one is refused outright rather than dropped in silence.
29
+ * @internal
30
+ */
31
+ export function reviewSchemaFor(definition, payload) {
32
+ const inferred = inferSchema(payload);
33
+ const declared = definition?.review?.fields;
34
+ if (!declared)
35
+ return inferred;
36
+ const allowed = new Set(declared);
37
+ return Object.fromEntries(Object.entries(inferred).filter(([key]) => allowed.has(key)));
38
+ }
39
+ /**
40
+ * The keys of a decision's values that the definition's `review.fields` does
41
+ * not allow — empty when nothing is declared (every key is then a form
42
+ * field) or when every submitted key is declared. Non-empty means refuse.
43
+ * @internal
44
+ */
45
+ export function undeclaredReviewFields(definition, values) {
46
+ const declared = definition?.review?.fields;
47
+ if (!declared || !values)
48
+ return [];
49
+ const allowed = new Set(declared);
50
+ return Object.keys(values).filter((key) => !allowed.has(key));
51
+ }
52
+ /**
53
+ * There is deliberately no `'never'` position and no descriptor field that could produce
54
+ * one. An author picks a default; the user's setting wins over it. Forbidding review is
55
+ * not a value this type can hold, which is the enforcement (F14).
56
+ * @experimental
57
+ */
58
+ export const POSITIONS = ['off', 'on'];
59
+ /**
60
+ * What the two retired spellings mean now.
61
+ *
62
+ * `sync` is `on` by definition. `async` becomes `on` rather than `off` because
63
+ * somebody who asked to review a write should keep being asked: quietly
64
+ * dropping the gate is the one migration outcome that could let an unreviewed
65
+ * write land on an install that had deliberately gated it.
66
+ */
67
+ const LEGACY_POSITIONS = {
68
+ off: 'off',
69
+ sync: 'on',
70
+ async: 'on',
71
+ on: 'on',
72
+ };
73
+ /** @experimental */
74
+ export function hashPayload(v) {
75
+ const s = JSON.stringify(v ?? null);
76
+ let h = 2166136261;
77
+ for (let i = 0; i < s.length; i++)
78
+ h = Math.imul(h ^ s.charCodeAt(i), 16777619);
79
+ return (h >>> 0).toString(16);
80
+ }
81
+ /**
82
+ * Resolve the effective position: user setting if present, else the author's default,
83
+ * else off. An author can raise the floor and never lower it below what a user chose.
84
+ * @experimental
85
+ */
86
+ export function resolvePosition(authorDefault, userSetting) {
87
+ if (typeof userSetting === 'string' && userSetting in LEGACY_POSITIONS)
88
+ return LEGACY_POSITIONS[userSetting];
89
+ if (authorDefault && authorDefault in LEGACY_POSITIONS)
90
+ return LEGACY_POSITIONS[authorDefault];
91
+ return 'off';
92
+ }
93
+ /** Which nodes the gate applies to — effects, not kind (01 §7, 14 §4a). @experimental */
94
+ export function isGated(effects) {
95
+ return effects === 'write' || effects === 'external';
96
+ }
97
+ //# sourceMappingURL=review.js.map
@@ -0,0 +1,152 @@
1
+ /**
2
+ * Sampling parameters, declared per shape.
3
+ *
4
+ * A sampling config used to be thirty typed columns and thirty `<key>Enabled`
5
+ * booleans on one table — a layout that could only ever describe *text*
6
+ * generation, because the columns named text samplers. Adding image generation
7
+ * would have meant either a second table with a second seeding path and a second
8
+ * picker, or image columns sitting empty on every text row. Both make the modality
9
+ * a branch in every consumer.
10
+ *
11
+ * So a row is now `{ shape, values, enabled }`: an id saying which vocabulary it
12
+ * speaks, an object of values, and the list of keys that are actually in play.
13
+ * The vocabulary itself lives here, in the SDK, next to the shapes it is keyed by
14
+ * — the same place a provider declares `shape: S.imageGen`, so a sampling config
15
+ * and the provider that consumes it cannot drift into disagreeing about what a
16
+ * parameter is called.
17
+ *
18
+ * ## Resolution
19
+ *
20
+ * `resolveSamplingValues` is the one path from a stored row to what an adapter
21
+ * receives:
22
+ *
23
+ * values → keep the keys named in `enabled` → keep the keys the shape declares
24
+ * → fill enabled-but-unset from the schema default → hand over
25
+ *
26
+ * Two kinds of key deliberately survive in the row without ever being sent: keys
27
+ * that are switched off, and keys the shape does not declare. Neither is an error
28
+ * and neither is discarded — turning a sampler off and back on must not lose the
29
+ * value you had, and a row written by a newer build (or carrying a UI-only flag
30
+ * like `contextTokensUnlocked`) must round-trip through an older one intact. The
31
+ * filter is on the way *out*, not on the way in.
32
+ *
33
+ * ## What is not here
34
+ *
35
+ * Backend-specific knobs. Fooocus' `performance_selection`, a ComfyUI workflow, an
36
+ * A1111 `override_settings` — those belong to the *connection*, declared by its
37
+ * adapter's `profileSchema`. A sampling config is the modality's shared vocabulary;
38
+ * if a key here meant something to only one backend, every other backend's picker
39
+ * would be showing a control that does nothing. Adapters translate what they can
40
+ * and report the rest as ignored.
41
+ */
42
+ import type { SettingsSchema } from './settings.js';
43
+ import type { ShapeId } from './shapes.js';
44
+ /**
45
+ * Text generation — the union of what the shipped adapters can map.
46
+ *
47
+ * Every key here appears in at least one adapter's key map. A row may enable a
48
+ * key the *chosen* connection cannot honour (enabling DRY and then pointing the
49
+ * config at Anthropic); that is reported by the adapter as ignored, not blocked
50
+ * here, because the config outlives the connection it happens to be paired with.
51
+ * @internal
52
+ */
53
+ export declare const textSamplingSchema: SettingsSchema;
54
+ /**
55
+ * Image generation — the parameters every image backend either honours or can
56
+ * say it ignored.
57
+ *
58
+ * Everything is optional and nothing is required to have a value: an unset key
59
+ * means "whatever the backend does by default", which is the only honest answer
60
+ * when the same config is pointed at Fooocus, ComfyUI and a hosted API in turn.
61
+ * `sampler` and `scheduler` are free strings rather than enums for the same
62
+ * reason — the valid set is a property of the connection (its checkpoint, its
63
+ * build), not of the vocabulary, so a picker fills them from the adapter's
64
+ * reported capabilities.
65
+ *
66
+ * ⚠ These are the knobs of LOCAL DIFFUSION, and that is a real boundary rather
67
+ * than an accident of which adapters happened to ship first. A hosted image
68
+ * service shares almost none of them: OpenAI's gpt-image-1 takes `size` (an ENUM
69
+ * of exactly `1024x1024`, `1024x1536`, `1536x1024`), `quality`, `background`,
70
+ * `output_format`, `output_compression` and `n` — no steps, no CFG, no sampler,
71
+ * no scheduler, no seed. `batch` maps to `n`, a free width/height has to SNAP to
72
+ * one of the three allowed sizes, and the rest is inexpressible.
73
+ *
74
+ * That does not make this schema wrong; it makes it the shared vocabulary of the
75
+ * backends that HAVE these knobs — and the rest of the answer is already in
76
+ * place, so the fix is never "add hosted keys here". What one backend alone
77
+ * offers belongs to its CONNECTION, declared by the adapter's `profileSchema`
78
+ * (`quality` and `background` are profile fields); what a backend cannot honour
79
+ * is REPORTED through `applied`/`ignored`, not dropped. A hosted-only key added
80
+ * here would put a control that does nothing in front of every local user, which
81
+ * is exactly what the "What is not here" note above forbids — and by the same
82
+ * argument there is no such thing as a hosted sampling *preset*: a hosted
83
+ * service has no sampling knobs to preset, it has a profile.
84
+ * @internal
85
+ */
86
+ export declare const imageSamplingSchema: SettingsSchema;
87
+ /**
88
+ * Speech synthesis.
89
+ *
90
+ * Present because `core:oracle/speak@1` declares `sampling: { shape: S.tts }`,
91
+ * and a sampling slot whose shape has no vocabulary resolves to nothing at all —
92
+ * silently, since an unknown shape is an empty schema by design. A declared slot
93
+ * with no declared vocabulary is the one combination where that fallback is
94
+ * indistinguishable from a bug.
95
+ *
96
+ * `voice` is a free string for the same reason `sampler` is on images: the valid
97
+ * names belong to the connection, not to the vocabulary.
98
+ * @internal
99
+ */
100
+ export declare const ttsSamplingSchema: SettingsSchema;
101
+ /** Every vocabulary, keyed by the shape whose connections speak it. @internal */
102
+ export declare const SAMPLING_SCHEMAS: Record<ShapeId, SettingsSchema>;
103
+ /** The shape a row without one is assumed to speak. @experimental */
104
+ export declare const DEFAULT_SAMPLING_SHAPE: ShapeId;
105
+ /**
106
+ * The vocabulary for a shape.
107
+ *
108
+ * An unknown shape resolves to an empty schema rather than throwing: a row
109
+ * written by a plugin whose provider is not installed should read as "no
110
+ * parameters I can offer", not as a crash in whatever happened to load it.
111
+ * @internal
112
+ */
113
+ export declare function samplingSchemaFor(shape?: ShapeId | null): SettingsSchema;
114
+ /** The stored side of a sampling config — the three columns that carry meaning. @experimental */
115
+ export interface SamplingRowLike {
116
+ shape?: ShapeId | null;
117
+ values?: Record<string, unknown> | null;
118
+ enabled?: readonly string[] | null;
119
+ }
120
+ /** What an adapter receives: flat, enabled-only, defaults already applied. @internal */
121
+ export type ResolvedSampling = Record<string, unknown>;
122
+ /**
123
+ * Stored row → what the adapter is handed.
124
+ *
125
+ * The whole filter lives here so that no consumer has to remember the order, and
126
+ * so "is this key on?" has exactly one answer in the codebase. Callers get a
127
+ * plain object: spreading a runtime override onto it is expected and is how
128
+ * per-call budgets are applied.
129
+ * @internal
130
+ */
131
+ export declare function resolveSamplingValues(row: SamplingRowLike, schema?: SettingsSchema): ResolvedSampling;
132
+ /**
133
+ * Bring a row into a consistent state, without discarding anything.
134
+ *
135
+ * Called on the write path, so that what the form submits and what a seed
136
+ * declares end up identical in the table. It coerces the types the schema
137
+ * declares (a number field arriving as `"0.7"` from a form input is the common
138
+ * case) and drops duplicate/ill-typed entries from `enabled`.
139
+ *
140
+ * It deliberately does NOT drop unknown keys from `values`: `enabled` is the
141
+ * switchboard, `values` is the memory. Off-schema keys — a UI-only flag such as
142
+ * `contextTokensUnlocked`, or a parameter belonging to a shape this build does
143
+ * not know — stay exactly where they were, and `resolveSamplingValues` is what
144
+ * keeps them off the wire.
145
+ * @internal
146
+ */
147
+ export declare function normalizeSamplingRow(row: SamplingRowLike, schema?: SettingsSchema): {
148
+ shape: ShapeId;
149
+ values: Record<string, unknown>;
150
+ enabled: string[];
151
+ };
152
+ //# sourceMappingURL=sampling.d.ts.map