@serene-pub/sdk 0.6.0-pr-5 → 0.6.0-pr-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions.d.ts +52 -2
- package/dist/actions.js +56 -6
- package/dist/annexFields.d.ts +32 -2
- package/dist/annexFields.js +48 -5
- package/dist/announce.d.ts +142 -2
- package/dist/announce.js +198 -2
- package/dist/attributes.d.ts +331 -6
- package/dist/attributes.js +339 -27
- package/dist/bridges.d.ts +61 -0
- package/dist/bridges.js +112 -0
- package/dist/builder.d.ts +278 -51
- package/dist/builder.js +267 -30
- package/dist/cadences.d.ts +585 -0
- package/dist/cadences.js +1118 -0
- package/dist/capabilities.d.ts +106 -17
- package/dist/capabilities.js +85 -7
- package/dist/checkMethods.d.ts +240 -0
- package/dist/checkMethods.js +362 -0
- package/dist/component.d.ts +6 -1
- package/dist/componentClient.d.ts +42 -6
- package/dist/componentWire.js +22 -4
- package/dist/composerStates.d.ts +96 -0
- package/dist/composerStates.js +190 -0
- package/dist/conditions.d.ts +424 -0
- package/dist/conditions.js +521 -0
- package/dist/config.d.ts +42 -6
- package/dist/config.js +48 -20
- package/dist/conversions.d.ts +41 -0
- package/dist/conversions.js +50 -0
- package/dist/declarations.d.ts +40 -2
- package/dist/declarations.js +178 -10
- package/dist/descriptors.d.ts +287 -4
- package/dist/descriptors.js +281 -18
- package/dist/document.d.ts +47 -2
- package/dist/document.js +46 -14
- package/dist/entities.d.ts +156 -0
- package/dist/entities.js +259 -0
- package/dist/events.d.ts +711 -1
- package/dist/events.js +412 -1
- package/dist/executor.d.ts +4 -3
- package/dist/executor.js +22 -8
- package/dist/exposure.d.ts +128 -0
- package/dist/exposure.js +168 -0
- package/dist/extension.d.ts +127 -3
- package/dist/extension.js +43 -0
- package/dist/fit.d.ts +198 -0
- package/dist/fit.js +351 -0
- package/dist/functions.d.ts +554 -0
- package/dist/functions.js +712 -0
- package/dist/genres.d.ts +303 -89
- package/dist/genres.js +335 -100
- package/dist/hookGrants.d.ts +15 -1
- package/dist/hookGrants.js +11 -10
- package/dist/hooks.d.ts +34 -5
- package/dist/hooks.js +5 -2
- package/dist/hostElements.d.ts +7 -1
- package/dist/hostElements.js +20 -1
- package/dist/hostState.d.ts +110 -0
- package/dist/hostState.js +140 -0
- package/dist/identity.d.ts +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.d.ts +25 -0
- package/dist/index.js +48 -0
- package/dist/jsonSchema.d.ts +178 -0
- package/dist/jsonSchema.js +570 -0
- package/dist/libraryDraft.d.ts +27 -0
- package/dist/libraryDraft.js +25 -0
- package/dist/lorebookFile.d.ts +44 -0
- package/dist/lorebookFile.js +202 -0
- package/dist/media.d.ts +127 -12
- package/dist/media.js +45 -1
- package/dist/messageBlocks.d.ts +179 -5
- package/dist/messageBlocks.js +208 -6
- package/dist/participants.d.ts +32 -9
- package/dist/participants.js +13 -2
- package/dist/pluginHarness.d.ts +63 -33
- package/dist/pluginHarness.js +78 -144
- package/dist/pluginPermissions.d.ts +15 -1
- package/dist/pluginPermissions.js +29 -2
- package/dist/preview.d.ts +45 -4
- package/dist/preview.js +52 -12
- package/dist/primers.d.ts +177 -0
- package/dist/primers.js +265 -0
- package/dist/receipt.d.ts +11 -0
- package/dist/receiverRules.js +9 -0
- package/dist/refs.d.ts +9 -1
- package/dist/refs.js +12 -0
- package/dist/registrations.d.ts +384 -0
- package/dist/registrations.js +625 -0
- package/dist/repertoires.d.ts +502 -0
- package/dist/repertoires.js +666 -0
- package/dist/rulesetDocument.d.ts +116 -0
- package/dist/rulesetDocument.js +252 -0
- package/dist/rulesetSections.d.ts +631 -0
- package/dist/rulesetSections.js +1288 -0
- package/dist/rulesetTemplates.d.ts +161 -0
- package/dist/rulesetTemplates.js +242 -0
- package/dist/rulesets.d.ts +899 -0
- package/dist/rulesets.js +1378 -0
- package/dist/sceneSettings.d.ts +8 -0
- package/dist/sceneSettings.js +10 -2
- package/dist/scope.d.ts +44 -3
- package/dist/scope.js +18 -0
- package/dist/scripts.d.ts +31 -8
- package/dist/scripts.js +45 -8
- package/dist/sessionDossier.d.ts +157 -7
- package/dist/sessionLayout.d.ts +291 -138
- package/dist/sessionLayout.js +504 -211
- package/dist/sessionSettings.d.ts +24 -0
- package/dist/settings.d.ts +95 -4
- package/dist/settings.js +293 -4
- package/dist/shapes.d.ts +80 -1
- package/dist/shapes.js +100 -5
- package/dist/speech.d.ts +333 -0
- package/dist/speech.js +199 -0
- package/dist/statShapes.d.ts +8 -1
- package/dist/statShapes.js +8 -1
- package/dist/status.d.ts +14 -0
- package/dist/status.js +12 -0
- package/dist/storage.d.ts +53 -66
- package/dist/storage.js +7 -12
- package/dist/storyTime.d.ts +25 -1
- package/dist/storyTime.js +42 -2
- package/dist/surfaces.d.ts +15 -2
- package/dist/template.d.ts +19 -1
- package/dist/template.js +25 -11
- package/dist/templateScopeAt.d.ts +1 -1
- package/dist/templateScopeAt.js +11 -8
- package/dist/ties.d.ts +211 -0
- package/dist/ties.js +301 -0
- package/dist/turnOrder.d.ts +25 -14
- package/dist/turnOrder.js +21 -8
- package/dist/userAnnex.d.ts +126 -0
- package/dist/userAnnex.js +214 -0
- package/dist/validate.js +114 -19
- package/dist/values.js +6 -0
- package/dist/vocabularies.d.ts +192 -0
- package/dist/vocabularies.js +326 -0
- package/dist/widgetDecls.d.ts +12 -0
- package/dist/widgetDecls.js +2 -0
- package/dist/widgets.d.ts +1062 -29
- package/dist/widgets.js +218 -3
- package/host-elements.d.ts +90 -0
- package/package.json +1 -1
package/dist/capabilities.d.ts
CHANGED
|
@@ -66,8 +66,20 @@ import type { I18nText } from './settings.js';
|
|
|
66
66
|
* @experimental
|
|
67
67
|
*/
|
|
68
68
|
export declare const IO_KINDS: readonly ["text", "image", "audio", "video", "document", "embedding", "entities"];
|
|
69
|
-
/**
|
|
70
|
-
|
|
69
|
+
/**
|
|
70
|
+
* 🚧 A transform endpoint core knows by name — one of `IO_KINDS`, the KNOWN list.
|
|
71
|
+
* @experimental
|
|
72
|
+
* @ruling O1, LS4
|
|
73
|
+
*/
|
|
74
|
+
export type KnownIoKind = (typeof IO_KINDS)[number];
|
|
75
|
+
/**
|
|
76
|
+
* A transform endpoint: one core knows (`IO_KINDS`), or any other kind a
|
|
77
|
+
* plugin or a later release introduces (O1, LS4). Known kinds keep their
|
|
78
|
+
* place in the canonical order; unknown ones follow, alphabetically.
|
|
79
|
+
* @experimental
|
|
80
|
+
* @ruling O1, LS4, R41
|
|
81
|
+
*/
|
|
82
|
+
export type IoKind = KnownIoKind | (string & {});
|
|
71
83
|
/** @experimental */
|
|
72
84
|
export interface Transform {
|
|
73
85
|
in: readonly IoKind[];
|
|
@@ -84,6 +96,21 @@ export interface Transform {
|
|
|
84
96
|
* @experimental
|
|
85
97
|
*/
|
|
86
98
|
export type TransformId = `${string}->${string}`;
|
|
99
|
+
/**
|
|
100
|
+
* The canonical order of a transform side (O1): the known kinds in `IO_KINDS`
|
|
101
|
+
* order — today's ids are unchanged — then any unknown kinds, alphabetically.
|
|
102
|
+
* One comparator, so `transformId()` and `validate()` can never disagree.
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
export declare const compareIoKinds: (a: string, b: string) => number;
|
|
106
|
+
/** Is this kind one of `IO_KINDS`? An unknown kind is still a kind (O1). @experimental */
|
|
107
|
+
export declare const isKnownIoKind: (k: unknown) => k is KnownIoKind;
|
|
108
|
+
/**
|
|
109
|
+
* The shape an unknown kind must have to be a kind at all: one lowercase
|
|
110
|
+
* token — it can hold neither `+` nor `->`, which separate kinds and sides.
|
|
111
|
+
* @experimental
|
|
112
|
+
*/
|
|
113
|
+
export declare const IO_KIND_TOKEN: RegExp;
|
|
87
114
|
/** Read an id back apart, for a UI that wants the kinds rather than the string. @internal */
|
|
88
115
|
export declare function parseTransform(id: TransformId): Transform;
|
|
89
116
|
/**
|
|
@@ -101,9 +128,10 @@ export declare function parseTransform(id: TransformId): Transform;
|
|
|
101
128
|
* literal that already says `kind: 'oracle'`. `IoKinds` also matches the two
|
|
102
129
|
* spellings already here, `IoKind` and `IO_KINDS`.
|
|
103
130
|
*
|
|
104
|
-
* `satisfies
|
|
105
|
-
* a kind to `IO_KINDS` without adding it here stops compiling, and so
|
|
106
|
-
* member here whose value is not its own name.
|
|
131
|
+
* `satisfies { [K in KnownIoKind]: K }` is load-bearing in both directions:
|
|
132
|
+
* adding a kind to `IO_KINDS` without adding it here stops compiling, and so
|
|
133
|
+
* does a member here whose value is not its own name. (Over the KNOWN kinds:
|
|
134
|
+
* `IoKind` is open since O1, and a `Record` over an open key checks nothing.)
|
|
107
135
|
* @experimental
|
|
108
136
|
*/
|
|
109
137
|
export declare const IoKinds: {
|
|
@@ -130,7 +158,10 @@ export interface TransformShape {
|
|
|
130
158
|
}
|
|
131
159
|
/**
|
|
132
160
|
* Walk the CANONICAL order keeping members of `Ks` — sorting and deduping fall
|
|
133
|
-
* out free.
|
|
161
|
+
* out free. Only ever applied to KNOWN kinds: `Side` widens to `string` the
|
|
162
|
+
* moment a side holds a kind `IO_KINDS` does not name (O1), because an unknown
|
|
163
|
+
* kind sorts alphabetically after the known ones and no positional walk can
|
|
164
|
+
* place it — so the type never claims an id the runtime would not build.
|
|
134
165
|
*
|
|
135
166
|
* We filter the fixed six-element `IO_KINDS` tuple rather than sorting the
|
|
136
167
|
* author's, so this mirrors the runtime `side()` by CONSTRUCTION: recursion
|
|
@@ -142,9 +173,9 @@ export interface TransformShape {
|
|
|
142
173
|
* `IO_KINDS` ever stops being a literal tuple — drop the `as const` and every
|
|
143
174
|
* `tf()` call becomes an unassignable `never` rather than a wrong string.
|
|
144
175
|
*/
|
|
145
|
-
type InOrder<O extends readonly
|
|
146
|
-
infer H extends
|
|
147
|
-
...infer T extends readonly
|
|
176
|
+
type InOrder<O extends readonly KnownIoKind[], Ks extends readonly IoKind[]> = O extends readonly [
|
|
177
|
+
infer H extends KnownIoKind,
|
|
178
|
+
...infer T extends readonly KnownIoKind[]
|
|
148
179
|
] ? H extends Ks[number] ? [H, ...InOrder<T, Ks>] : InOrder<T, Ks> : [];
|
|
149
180
|
type Join<T extends readonly string[]> = T extends readonly [
|
|
150
181
|
infer H extends string
|
|
@@ -152,9 +183,17 @@ type Join<T extends readonly string[]> = T extends readonly [
|
|
|
152
183
|
infer H extends string,
|
|
153
184
|
...infer R extends readonly string[]
|
|
154
185
|
] ? `${H}+${Join<R>}` : never;
|
|
186
|
+
/** True when every kind of the side is a KNOWN literal kind — not `string`, not an unknown token. */
|
|
187
|
+
type AllKnown<Ks extends readonly IoKind[]> = [Ks[number]] extends [KnownIoKind] ? true : false;
|
|
155
188
|
type Side<Ks extends readonly IoKind[]> = Join<InOrder<typeof IO_KINDS, Ks>>;
|
|
156
|
-
/**
|
|
157
|
-
|
|
189
|
+
/**
|
|
190
|
+
* The exact id a shape denotes, as a literal type — when every kind is a
|
|
191
|
+
* known one. A side holding a kind `IO_KINDS` does not name (O1) widens the
|
|
192
|
+
* id to `TransformId`: the runtime places it alphabetically after the known
|
|
193
|
+
* kinds, and the type says only what it can promise.
|
|
194
|
+
* @experimental
|
|
195
|
+
*/
|
|
196
|
+
export type IdOf<T extends TransformShape> = AllKnown<T['in']> extends true ? AllKnown<T['out']> extends true ? `${Side<T['in']>}->${Side<T['out']>}` : TransformId : TransformId;
|
|
158
197
|
/**
|
|
159
198
|
* A transform id, from the kinds rather than from a string.
|
|
160
199
|
*
|
|
@@ -192,6 +231,18 @@ export declare function tf<const T extends TransformShape>(t: T): IdOf<T>;
|
|
|
192
231
|
* @internal
|
|
193
232
|
*/
|
|
194
233
|
export declare const transformId: (t: Transform) => TransformId;
|
|
234
|
+
/**
|
|
235
|
+
* 🚧 The transform a connection must meet when a model call **asks for output
|
|
236
|
+
* kinds** (O6): `base` with its output side replaced by `outputs`, in canonical
|
|
237
|
+
* order. `requirementForOutputs('text->text', ['text', 'audio'])` is
|
|
238
|
+
* `'text->text+audio'` — a spoken reply needs a model that writes both. An
|
|
239
|
+
* absent or empty `outputs` asks for nothing new and returns `base` as given.
|
|
240
|
+
* The bind check and fit read requested outputs through this, never by
|
|
241
|
+
* building the id themselves.
|
|
242
|
+
* @experimental
|
|
243
|
+
* @ruling O6
|
|
244
|
+
*/
|
|
245
|
+
export declare function requirementForOutputs(base: TransformId, outputs?: readonly IoKind[] | null): TransformId;
|
|
195
246
|
/** @experimental */
|
|
196
247
|
export interface TransformMeta {
|
|
197
248
|
i18n: I18nText;
|
|
@@ -274,6 +325,24 @@ export declare const TRANSFORMS: {
|
|
|
274
325
|
readonly en: 'Turns speech into text.';
|
|
275
326
|
};
|
|
276
327
|
};
|
|
328
|
+
/** 🚧 O4 (2026-10-21): a reply that hears a voice note itself. */
|
|
329
|
+
readonly 'text+audio->text': {
|
|
330
|
+
readonly i18n: {
|
|
331
|
+
readonly en: 'Hearing';
|
|
332
|
+
};
|
|
333
|
+
readonly tagline: {
|
|
334
|
+
readonly en: 'Can listen to audio you send it.';
|
|
335
|
+
};
|
|
336
|
+
};
|
|
337
|
+
/** 🚧 O6 (2026-10-21): one call writes a reply and speaks it. */
|
|
338
|
+
readonly 'text->text+audio': {
|
|
339
|
+
readonly i18n: {
|
|
340
|
+
readonly en: 'Spoken reply';
|
|
341
|
+
};
|
|
342
|
+
readonly tagline: {
|
|
343
|
+
readonly en: 'Writes a reply and speaks it in the same call.';
|
|
344
|
+
};
|
|
345
|
+
};
|
|
277
346
|
readonly 'text->audio': {
|
|
278
347
|
readonly i18n: {
|
|
279
348
|
readonly en: 'Speech';
|
|
@@ -345,9 +414,29 @@ export declare const FEATURES: readonly ['json_object', 'json_schema', 'strict_s
|
|
|
345
414
|
* starts a new reply, the join then glues two beginnings together, and nothing
|
|
346
415
|
* reports it. A connection that can only do that does not hold this.
|
|
347
416
|
*/
|
|
348
|
-
'continue_reply', 'wire_chat', 'wire_completion'
|
|
349
|
-
/**
|
|
350
|
-
|
|
417
|
+
'continue_reply', 'wire_chat', 'wire_completion',
|
|
418
|
+
/**
|
|
419
|
+
* 🚧 Speech arrives while it is still being made (PLAN-speech-build S3,
|
|
420
|
+
* 2026-10-28) — the first words play before the last are rendered. Banded
|
|
421
|
+
* (`BANDS.audio_streaming`): `native` — the service streams audio itself;
|
|
422
|
+
* `emulated` — it does not, and the HOST streams by splitting the line at its
|
|
423
|
+
* cue groups (`core:oracle/speak@1` makes one call per group anyway), handing
|
|
424
|
+
* each group's audio on as it lands; `none` — one whole file, after the last
|
|
425
|
+
* group. ⚠ Not `streaming`: that one is TEXT arriving token by token.
|
|
426
|
+
* Phase 1 records it and plays whole files (build assumption A5).
|
|
427
|
+
*/
|
|
428
|
+
'audio_streaming'];
|
|
429
|
+
/** 🚧 A feature core knows by name — one of `FEATURES`, the KNOWN list. @experimental */
|
|
430
|
+
export type KnownFeatureId = (typeof FEATURES)[number];
|
|
431
|
+
/**
|
|
432
|
+
* A feature: one core knows (`FEATURES`, the KNOWN list), or one a later
|
|
433
|
+
* release adds (LS4 — a `live` feature arrives without breaking SDK 1).
|
|
434
|
+
* `validate()` still refuses a feature it does not know: a feature names a
|
|
435
|
+
* mechanism an adapter implements, and only core ships adapters (R44).
|
|
436
|
+
* @experimental
|
|
437
|
+
* @ruling LS4, O1
|
|
438
|
+
*/
|
|
439
|
+
export type FeatureId = KnownFeatureId | (string & {});
|
|
351
440
|
/** @experimental */
|
|
352
441
|
export type CapabilityId = TransformId | FeatureId;
|
|
353
442
|
/** Transforms contain `->`; features never do. The two spaces cannot collide. @internal */
|
|
@@ -361,7 +450,7 @@ export declare const isTransformId: (id: string) => id is TransformId;
|
|
|
361
450
|
* the weaker forms.
|
|
362
451
|
* @internal
|
|
363
452
|
*/
|
|
364
|
-
export declare const IMPLIES: Partial<Record<
|
|
453
|
+
export declare const IMPLIES: Partial<Record<KnownFeatureId, readonly KnownFeatureId[]>>;
|
|
365
454
|
/**
|
|
366
455
|
* X is available at its `emulated` band when any of the values is at ITS top.
|
|
367
456
|
*
|
|
@@ -371,7 +460,7 @@ export declare const IMPLIES: Partial<Record<FeatureId, readonly FeatureId[]>>;
|
|
|
371
460
|
* rather than re-derived inside each adapter that happens to have a grammar.
|
|
372
461
|
* @internal
|
|
373
462
|
*/
|
|
374
|
-
export declare const EMULATABLE_VIA: Partial<Record<
|
|
463
|
+
export declare const EMULATABLE_VIA: Partial<Record<KnownFeatureId, readonly KnownFeatureId[]>>;
|
|
375
464
|
/**
|
|
376
465
|
* How well something is supported, as a number: 0 is unsupported, open upward.
|
|
377
466
|
*
|
|
@@ -429,7 +518,7 @@ export declare const BAND_ORDER: readonly ["none", "emulated", "native"];
|
|
|
429
518
|
* grade correctly: a plugin introduces a transform, and it is binary until
|
|
430
519
|
* somebody says otherwise.
|
|
431
520
|
*
|
|
432
|
-
* The
|
|
521
|
+
* The bands listed here are exactly the keys of `EMULATABLE_VIA`, and that is
|
|
433
522
|
* not a coincidence. An `emulated` band exists precisely where Serene Pub can
|
|
434
523
|
* supply the capability itself over a backend that cannot, which is what that
|
|
435
524
|
* table records. `closure` raises through `gradeOf(id, BAND.emulated)`, so a
|
package/dist/capabilities.js
CHANGED
|
@@ -68,9 +68,32 @@ import { MEDIA_KINDS } from './media.js';
|
|
|
68
68
|
*/
|
|
69
69
|
export const IO_KINDS = ['text', ...MEDIA_KINDS, 'embedding', 'entities'];
|
|
70
70
|
const KIND_ORDER = new Map(IO_KINDS.map((k, i) => [k, i]));
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
/**
|
|
72
|
+
* The canonical order of a transform side (O1): the known kinds in `IO_KINDS`
|
|
73
|
+
* order — today's ids are unchanged — then any unknown kinds, alphabetically.
|
|
74
|
+
* One comparator, so `transformId()` and `validate()` can never disagree.
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
export const compareIoKinds = (a, b) => {
|
|
78
|
+
const ia = KIND_ORDER.get(a);
|
|
79
|
+
const ib = KIND_ORDER.get(b);
|
|
80
|
+
if (ia !== undefined && ib !== undefined)
|
|
81
|
+
return ia - ib;
|
|
82
|
+
if (ia !== undefined)
|
|
83
|
+
return -1;
|
|
84
|
+
if (ib !== undefined)
|
|
85
|
+
return 1;
|
|
86
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
87
|
+
};
|
|
88
|
+
/** Is this kind one of `IO_KINDS`? An unknown kind is still a kind (O1). @experimental */
|
|
89
|
+
export const isKnownIoKind = (k) => typeof k === 'string' && KIND_ORDER.has(k);
|
|
90
|
+
/**
|
|
91
|
+
* The shape an unknown kind must have to be a kind at all: one lowercase
|
|
92
|
+
* token — it can hold neither `+` nor `->`, which separate kinds and sides.
|
|
93
|
+
* @experimental
|
|
94
|
+
*/
|
|
95
|
+
export const IO_KIND_TOKEN = /^[a-z][a-z0-9_-]*$/;
|
|
96
|
+
const side = (kinds) => [...new Set(kinds)].sort(compareIoKinds).join('+');
|
|
74
97
|
/** Read an id back apart, for a UI that wants the kinds rather than the string. @internal */
|
|
75
98
|
export function parseTransform(id) {
|
|
76
99
|
const [inS = '', outS = ''] = id.split('->');
|
|
@@ -95,9 +118,10 @@ export function parseTransform(id) {
|
|
|
95
118
|
* literal that already says `kind: 'oracle'`. `IoKinds` also matches the two
|
|
96
119
|
* spellings already here, `IoKind` and `IO_KINDS`.
|
|
97
120
|
*
|
|
98
|
-
* `satisfies
|
|
99
|
-
* a kind to `IO_KINDS` without adding it here stops compiling, and so
|
|
100
|
-
* member here whose value is not its own name.
|
|
121
|
+
* `satisfies { [K in KnownIoKind]: K }` is load-bearing in both directions:
|
|
122
|
+
* adding a kind to `IO_KINDS` without adding it here stops compiling, and so
|
|
123
|
+
* does a member here whose value is not its own name. (Over the KNOWN kinds:
|
|
124
|
+
* `IoKind` is open since O1, and a `Record` over an open key checks nothing.)
|
|
101
125
|
* @experimental
|
|
102
126
|
*/
|
|
103
127
|
export const IoKinds = {
|
|
@@ -150,6 +174,23 @@ const build = (t) => `${side(t.in)}->${side(t.out)}`;
|
|
|
150
174
|
* @internal
|
|
151
175
|
*/
|
|
152
176
|
export const transformId = (t) => build(t);
|
|
177
|
+
/**
|
|
178
|
+
* 🚧 The transform a connection must meet when a model call **asks for output
|
|
179
|
+
* kinds** (O6): `base` with its output side replaced by `outputs`, in canonical
|
|
180
|
+
* order. `requirementForOutputs('text->text', ['text', 'audio'])` is
|
|
181
|
+
* `'text->text+audio'` — a spoken reply needs a model that writes both. An
|
|
182
|
+
* absent or empty `outputs` asks for nothing new and returns `base` as given.
|
|
183
|
+
* The bind check and fit read requested outputs through this, never by
|
|
184
|
+
* building the id themselves.
|
|
185
|
+
* @experimental
|
|
186
|
+
* @ruling O6
|
|
187
|
+
*/
|
|
188
|
+
export function requirementForOutputs(base, outputs) {
|
|
189
|
+
const kinds = (outputs ?? []).filter((k) => typeof k === 'string' && k.length > 0);
|
|
190
|
+
if (!kinds.length)
|
|
191
|
+
return base;
|
|
192
|
+
return transformId({ in: parseTransform(base).in, out: kinds });
|
|
193
|
+
}
|
|
153
194
|
/**
|
|
154
195
|
* Human names for the transforms core knows about.
|
|
155
196
|
*
|
|
@@ -189,6 +230,16 @@ export const TRANSFORMS = {
|
|
|
189
230
|
i18n: { en: 'Transcription' },
|
|
190
231
|
tagline: { en: 'Turns speech into text.' },
|
|
191
232
|
},
|
|
233
|
+
/** 🚧 O4 (2026-10-21): a reply that hears a voice note itself. */
|
|
234
|
+
'text+audio->text': {
|
|
235
|
+
i18n: { en: 'Hearing' },
|
|
236
|
+
tagline: { en: 'Can listen to audio you send it.' },
|
|
237
|
+
},
|
|
238
|
+
/** 🚧 O6 (2026-10-21): one call writes a reply and speaks it. */
|
|
239
|
+
'text->text+audio': {
|
|
240
|
+
i18n: { en: 'Spoken reply' },
|
|
241
|
+
tagline: { en: 'Writes a reply and speaks it in the same call.' },
|
|
242
|
+
},
|
|
192
243
|
'text->audio': {
|
|
193
244
|
i18n: { en: 'Speech' },
|
|
194
245
|
tagline: { en: 'Reads text aloud.' },
|
|
@@ -256,6 +307,17 @@ export const FEATURES = [
|
|
|
256
307
|
'continue_reply',
|
|
257
308
|
'wire_chat',
|
|
258
309
|
'wire_completion',
|
|
310
|
+
/**
|
|
311
|
+
* 🚧 Speech arrives while it is still being made (PLAN-speech-build S3,
|
|
312
|
+
* 2026-10-28) — the first words play before the last are rendered. Banded
|
|
313
|
+
* (`BANDS.audio_streaming`): `native` — the service streams audio itself;
|
|
314
|
+
* `emulated` — it does not, and the HOST streams by splitting the line at its
|
|
315
|
+
* cue groups (`core:oracle/speak@1` makes one call per group anyway), handing
|
|
316
|
+
* each group's audio on as it lands; `none` — one whole file, after the last
|
|
317
|
+
* group. ⚠ Not `streaming`: that one is TEXT arriving token by token.
|
|
318
|
+
* Phase 1 records it and plays whole files (build assumption A5).
|
|
319
|
+
*/
|
|
320
|
+
'audio_streaming',
|
|
259
321
|
];
|
|
260
322
|
/** Transforms contain `->`; features never do. The two spaces cannot collide. @internal */
|
|
261
323
|
export const isTransformId = (id) => id.includes('->');
|
|
@@ -285,6 +347,13 @@ export const EMULATABLE_VIA = {
|
|
|
285
347
|
json_object: ['json_schema', 'grammar'],
|
|
286
348
|
json_schema: ['grammar'],
|
|
287
349
|
tools: ['json_schema', 'grammar'],
|
|
350
|
+
/**
|
|
351
|
+
* 🚧 Emulated by core itself, via no backend feature (★A2, lane V
|
|
352
|
+
* 2026-10-28): the host splits a line at its cue groups. Empty, so
|
|
353
|
+
* `closure` never raises it — an adapter declares `emulated` directly — and
|
|
354
|
+
* the rule "only EMULATABLE_VIA keys have an emulated band" still holds.
|
|
355
|
+
*/
|
|
356
|
+
audio_streaming: [],
|
|
288
357
|
};
|
|
289
358
|
/**
|
|
290
359
|
* The band names core knows: what a grade MEANS, once you know the capability.
|
|
@@ -319,7 +388,7 @@ export const BAND_ORDER = [BAND.none, BAND.emulated, BAND.native];
|
|
|
319
388
|
* grade correctly: a plugin introduces a transform, and it is binary until
|
|
320
389
|
* somebody says otherwise.
|
|
321
390
|
*
|
|
322
|
-
* The
|
|
391
|
+
* The bands listed here are exactly the keys of `EMULATABLE_VIA`, and that is
|
|
323
392
|
* not a coincidence. An `emulated` band exists precisely where Serene Pub can
|
|
324
393
|
* supply the capability itself over a backend that cannot, which is what that
|
|
325
394
|
* table records. `closure` raises through `gradeOf(id, BAND.emulated)`, so a
|
|
@@ -331,6 +400,13 @@ export const BANDS = {
|
|
|
331
400
|
json_object: [BAND.none, BAND.emulated, BAND.native],
|
|
332
401
|
json_schema: [BAND.none, BAND.emulated, BAND.native],
|
|
333
402
|
tools: [BAND.none, BAND.emulated, BAND.native],
|
|
403
|
+
/**
|
|
404
|
+
* 🚧 Its `EMULATABLE_VIA` entry is EMPTY, deliberately: its `emulated`
|
|
405
|
+
* band is supplied by the host splitting a line at its cue groups, which
|
|
406
|
+
* needs no other feature of the backend — so an adapter declares
|
|
407
|
+
* `emulated` directly rather than having `closure` raise it.
|
|
408
|
+
*/
|
|
409
|
+
audio_streaming: [BAND.none, BAND.emulated, BAND.native],
|
|
334
410
|
};
|
|
335
411
|
/** A capability nobody gave bands: it either works or it does not. @experimental */
|
|
336
412
|
export const DEFAULT_BANDS = [BAND.none, BAND.native];
|
|
@@ -646,6 +722,8 @@ const FEATURE_LABELS = {
|
|
|
646
722
|
// completion is that the model is handed one formatted string.
|
|
647
723
|
wire_chat: 'Chat messages',
|
|
648
724
|
wire_completion: 'Text completion',
|
|
725
|
+
// 🚧 The user's word: speech starts playing before the whole line is made.
|
|
726
|
+
audio_streaming: 'Streaming speech',
|
|
649
727
|
};
|
|
650
728
|
/**
|
|
651
729
|
* What to show a person for a capability id.
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🚧 **Check methods** — how a ruleset decides a moment that could go
|
|
3
|
+
* either way (PLAN-rulesets-authoring D1, ruling R1, 2026-10-22).
|
|
4
|
+
*
|
|
5
|
+
* Chance is pluggable, never an assumption of the declaration. A ruleset
|
|
6
|
+
* names its check methods under `conventions.methods`, keyed by a name of
|
|
7
|
+
* its own, with one of them the default (`conventions.defaultMethod`); a
|
|
8
|
+
* check selector may name another (`{ kind: 'check', base: 'nerve', method:
|
|
9
|
+
* 'risk' }`). A ruleset that names none decides nothing by chance: every
|
|
10
|
+
* check is judged, as under `none`.
|
|
11
|
+
*
|
|
12
|
+
* The kinds core resolves (`CHECK_METHOD_KINDS`, each with its own options):
|
|
13
|
+
*
|
|
14
|
+
* · `die-target` — one die plus a modifier against a target; the margin
|
|
15
|
+
* (total − target) reads through the ruleset's degrees, a natural face
|
|
16
|
+
* through `degrees.natural` / `naturalShift`. Takes difficulty bands.
|
|
17
|
+
* · `dice-pool` — a pool of dice, as many as a selector's value; each face
|
|
18
|
+
* at or above `successOn` is a success, and the count reads as a degree
|
|
19
|
+
* (`countToDegree`).
|
|
20
|
+
* · `card-draw` — cards drawn from a deck (`ranks` × `suits`); their ranks
|
|
21
|
+
* plus a modifier against a target, as a die-target reads. Takes bands.
|
|
22
|
+
* · `compare` — a value against another's (`opposedBy`) or a target, with
|
|
23
|
+
* no chance at all; the margin reads through the degrees. Takes bands.
|
|
24
|
+
* · `bid` — a spend from a resource (`resource`): what is spent buys the
|
|
25
|
+
* degree its cost table says (`costs`); nothing is rolled.
|
|
26
|
+
* · `none` — nothing resolves it: the game master (or the model) judges,
|
|
27
|
+
* and the outcome is told in the ruleset's own words.
|
|
28
|
+
*
|
|
29
|
+
* The kinds are **open**: a package's own is namespaced by its owner
|
|
30
|
+
* (`acme:tarot`) and accepted with a warning — a host with no resolver for
|
|
31
|
+
* it refuses its checks politely, in words (`rulesetWarnings`; the app's
|
|
32
|
+
* engine, 2026-10-22: "this pub has no resolver for ‹kind›"). An un-namespaced kind
|
|
33
|
+
* core does not know is refused, so a misspelt `die-traget` is never a
|
|
34
|
+
* silent `none`.
|
|
35
|
+
*
|
|
36
|
+
* `conventions.dice` (⏳, the shape before 2026-10-22) is read as one
|
|
37
|
+
* die-target method keyed `die` (`LEGACY_DIE_METHOD`), and a top-level
|
|
38
|
+
* `difficultyBands` as that method's bands — `normaliseRuleset` folds both
|
|
39
|
+
* in; stored documents keep their shape (and their hashes) until rewritten.
|
|
40
|
+
*
|
|
41
|
+
* ⚠ Always **check method** where the word could stand alone (R3): never a
|
|
42
|
+
* bare _method_, which is every language's word for a function. Not a
|
|
43
|
+
* **mechanic** (a piece's effect, `MechanicDecl`), not a **rigour** (how
|
|
44
|
+
* much of a ruleset a session runs) and not a **degree** (how a resolved
|
|
45
|
+
* check reads).
|
|
46
|
+
* @experimental
|
|
47
|
+
*/
|
|
48
|
+
import type { I18n } from './i18n.js';
|
|
49
|
+
import { type SettingsSchema } from './settings.js';
|
|
50
|
+
import type { DifficultyBand } from './rulesets.js';
|
|
51
|
+
/** 🚧 The check method kinds core resolves, in the order the editor offers them. @experimental */
|
|
52
|
+
export declare const CORE_CHECK_METHOD_KINDS: readonly ['die-target', 'dice-pool', 'card-draw', 'compare', 'bid', 'none'];
|
|
53
|
+
/** 🚧 One of the check method kinds core resolves. @experimental */
|
|
54
|
+
export type CoreCheckMethodKind = (typeof CORE_CHECK_METHOD_KINDS)[number];
|
|
55
|
+
/**
|
|
56
|
+
* 🚧 A check method kind: core's, or a package's own, namespaced by its
|
|
57
|
+
* owner (`acme:tarot`) — open, never a closed list.
|
|
58
|
+
* @experimental
|
|
59
|
+
*/
|
|
60
|
+
export type CheckMethodKind = CoreCheckMethodKind | `${string}:${string}`;
|
|
61
|
+
/** What every check method may say beside its kind and options. */
|
|
62
|
+
interface CheckMethodBase {
|
|
63
|
+
/** The words a person reads for it — _Roll a d20_. Display text. */
|
|
64
|
+
label?: I18n;
|
|
65
|
+
description?: I18n;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* 🚧 A step of a `dice-pool`'s count: from `from` successes on, a check
|
|
69
|
+
* reads as the degree band `band` (one of the ruleset's degrees' ids). The
|
|
70
|
+
* last step whose `from` the count reaches is the one.
|
|
71
|
+
* @experimental
|
|
72
|
+
*/
|
|
73
|
+
export interface PoolCountStep {
|
|
74
|
+
from: number;
|
|
75
|
+
band: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* 🚧 A row of a `bid`'s cost table: spending `spend` or more buys the
|
|
79
|
+
* degree band `band` (one of the ruleset's degrees' ids). The last row whose
|
|
80
|
+
* `spend` the bid reaches is the one.
|
|
81
|
+
* @experimental
|
|
82
|
+
*/
|
|
83
|
+
export interface BidCostRow {
|
|
84
|
+
spend: number;
|
|
85
|
+
band: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 🚧 **die-target** — one die (`sides`) plus a modifier against a target.
|
|
89
|
+
* `modifierOf` is the selector a check adds when it names no `base` of its
|
|
90
|
+
* own; `bands`, the targets a check may be made against.
|
|
91
|
+
* @experimental
|
|
92
|
+
*/
|
|
93
|
+
export interface DieTargetMethod extends CheckMethodBase {
|
|
94
|
+
kind: 'die-target';
|
|
95
|
+
sides: number;
|
|
96
|
+
modifierOf?: string;
|
|
97
|
+
bands?: readonly DifficultyBand[];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 🚧 **dice-pool** — as many dice (`sides`) as a selector's value: a
|
|
101
|
+
* check's `base`, else `poolOf`. Each face at or above `successOn` is a
|
|
102
|
+
* success; the count reads as a degree through `countToDegree` — left out,
|
|
103
|
+
* no success reads as the degrees' `fail` band and any as their `success`.
|
|
104
|
+
* @experimental
|
|
105
|
+
*/
|
|
106
|
+
export interface DicePoolMethod extends CheckMethodBase {
|
|
107
|
+
kind: 'dice-pool';
|
|
108
|
+
sides: number;
|
|
109
|
+
poolOf?: string;
|
|
110
|
+
successOn: number;
|
|
111
|
+
countToDegree?: readonly PoolCountStep[];
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* 🚧 **card-draw** — `draw` cards (default 1) from a deck of `ranks` ×
|
|
115
|
+
* `suits` (default 4); their ranks plus a modifier (a check's `base`, else
|
|
116
|
+
* `modifierOf`) against a target, read as a die-target's margin is. The deck
|
|
117
|
+
* is shuffled anew each scene (`reshuffle: 'each-scene'`, the default) or
|
|
118
|
+
* only when it runs out (`'when-empty'`).
|
|
119
|
+
* @experimental
|
|
120
|
+
*/
|
|
121
|
+
export interface CardDrawMethod extends CheckMethodBase {
|
|
122
|
+
kind: 'card-draw';
|
|
123
|
+
ranks: number;
|
|
124
|
+
suits?: number;
|
|
125
|
+
draw?: number;
|
|
126
|
+
modifierOf?: string;
|
|
127
|
+
reshuffle?: 'each-scene' | 'when-empty';
|
|
128
|
+
bands?: readonly DifficultyBand[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* 🚧 **compare** — a value (a check's `base`, else `modifierOf`) against
|
|
132
|
+
* another side's (`opposedBy`, a selector read on whoever the check is
|
|
133
|
+
* aimed at) or, with no `opposedBy`, against a target. No chance: the
|
|
134
|
+
* margin reads through the degrees.
|
|
135
|
+
* @experimental
|
|
136
|
+
*/
|
|
137
|
+
export interface CompareMethod extends CheckMethodBase {
|
|
138
|
+
kind: 'compare';
|
|
139
|
+
modifierOf?: string;
|
|
140
|
+
opposedBy?: string;
|
|
141
|
+
bands?: readonly DifficultyBand[];
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 🚧 **bid** — a spend from `resource` (a stat): what is spent buys the
|
|
145
|
+
* degree `costs` says. Nothing is rolled; a bid larger than what is held is
|
|
146
|
+
* refused by the host.
|
|
147
|
+
* @experimental
|
|
148
|
+
*/
|
|
149
|
+
export interface BidMethod extends CheckMethodBase {
|
|
150
|
+
kind: 'bid';
|
|
151
|
+
resource: string;
|
|
152
|
+
costs: readonly BidCostRow[];
|
|
153
|
+
}
|
|
154
|
+
/** 🚧 **none** — nothing resolves it: the game master or the model judges, in the ruleset's words. @experimental */
|
|
155
|
+
export interface NoneMethod extends CheckMethodBase {
|
|
156
|
+
kind: 'none';
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* 🚧 A package's own check method kind (`acme:tarot`), its options as the
|
|
160
|
+
* package says them. Accepted with a warning (`rulesetWarnings`).
|
|
161
|
+
* @experimental
|
|
162
|
+
*/
|
|
163
|
+
export interface PackageCheckMethod extends CheckMethodBase {
|
|
164
|
+
kind: `${string}:${string}`;
|
|
165
|
+
bands?: readonly DifficultyBand[];
|
|
166
|
+
[option: string]: unknown;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* 🚧 One of a ruleset's check methods (`conventions.methods`): a kind and
|
|
170
|
+
* that kind's own options (`CHECK_METHOD_KINDS[kind].options`).
|
|
171
|
+
* @experimental
|
|
172
|
+
*/
|
|
173
|
+
export type CheckMethodDecl = DieTargetMethod | DicePoolMethod | CardDrawMethod | CompareMethod | BidMethod | NoneMethod | PackageCheckMethod;
|
|
174
|
+
/**
|
|
175
|
+
* 🚧 What core knows about a check method kind: its words, whether chance
|
|
176
|
+
* decides it (`chance`: dice or cards), whether it throws dice
|
|
177
|
+
* (`rollsDice`: a dice-string amount needs one), whether a check under it is
|
|
178
|
+
* made against a target (`takesBands`: the kinds that hold difficulty
|
|
179
|
+
* bands), and its own **options** in the one field language — the editor's
|
|
180
|
+
* form, and `jsonSchemaOf(CHECK_METHOD_KINDS[kind])`'s document.
|
|
181
|
+
* @experimental
|
|
182
|
+
*/
|
|
183
|
+
export interface CheckMethodKindDecl {
|
|
184
|
+
readonly methodKind: CoreCheckMethodKind;
|
|
185
|
+
readonly label: I18n;
|
|
186
|
+
readonly description: I18n;
|
|
187
|
+
readonly chance: boolean;
|
|
188
|
+
readonly rollsDice: boolean;
|
|
189
|
+
readonly takesBands: boolean;
|
|
190
|
+
readonly options: SettingsSchema;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* 🚧 The check method kinds core resolves, by kind (see the module note).
|
|
194
|
+
* @experimental
|
|
195
|
+
*/
|
|
196
|
+
export declare const CHECK_METHOD_KINDS: Readonly<Record<CoreCheckMethodKind, CheckMethodKindDecl>>;
|
|
197
|
+
/** 🚧 What core knows about a kind, or `undefined` for a package's own (or nothing at all). @experimental */
|
|
198
|
+
export declare const checkMethodKind: (kind: unknown) => CheckMethodKindDecl | undefined;
|
|
199
|
+
/** 🚧 Whether a kind is a package's own (`owner:name`). @experimental */
|
|
200
|
+
export declare const isPackageCheckMethodKind: (kind: unknown) => kind is `${string}:${string}`;
|
|
201
|
+
/**
|
|
202
|
+
* 🚧 The method every check falls back to when a ruleset names none: the
|
|
203
|
+
* game master judges. @experimental
|
|
204
|
+
*/
|
|
205
|
+
export declare const NONE_CHECK_METHOD: NoneMethod;
|
|
206
|
+
/**
|
|
207
|
+
* 🚧 The key `conventions.dice` (⏳) is read under — `methods.die`, the
|
|
208
|
+
* key the data upgrade writes it to.
|
|
209
|
+
* @experimental
|
|
210
|
+
*/
|
|
211
|
+
export declare const LEGACY_DIE_METHOD = "die";
|
|
212
|
+
/**
|
|
213
|
+
* 🚧 A list of difficulty bands, each well-formed — a whole target, ids
|
|
214
|
+
* distinct, exactly one the default. What a method's `bands` and the ⏳
|
|
215
|
+
* top-level `difficultyBands` are both held to.
|
|
216
|
+
* @internal
|
|
217
|
+
*/
|
|
218
|
+
export declare function difficultyBandListFindings(at: string, bands: unknown): string[];
|
|
219
|
+
/**
|
|
220
|
+
* 🚧 Every reason a ruleset's check methods are refused: the methods
|
|
221
|
+
* themselves (`bad-method`, `unknown-method-kind`, `unknown-selector`,
|
|
222
|
+
* `unknown-degree`, `bands-without-target`, and every difficulty band
|
|
223
|
+
* reason under a method's `bands`), `defaultMethod` (`unknown-method`,
|
|
224
|
+
* `no-default-method`), and the ⏳ `dice` declared beside them
|
|
225
|
+
* (`dice-beside-methods`). `selectors` are the ruleset's selector names;
|
|
226
|
+
* `stats`, those that are stats (what a bid spends from); `degreeIds`, the
|
|
227
|
+
* ids of the degrees in force (declared, else the default crosswalk's).
|
|
228
|
+
* @internal
|
|
229
|
+
*/
|
|
230
|
+
export declare function checkMethodFindings(at: string, conventions: {
|
|
231
|
+
methods?: unknown;
|
|
232
|
+
defaultMethod?: unknown;
|
|
233
|
+
dice?: unknown;
|
|
234
|
+
}, ctx: {
|
|
235
|
+
selectors: ReadonlySet<string>;
|
|
236
|
+
stats: ReadonlySet<string>;
|
|
237
|
+
degreeIds: ReadonlySet<string>;
|
|
238
|
+
}): string[];
|
|
239
|
+
export {};
|
|
240
|
+
//# sourceMappingURL=checkMethods.d.ts.map
|