@serene-pub/sdk 0.6.0-pr-7 → 0.6.0-pr-9
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/annexFields.d.ts +14 -0
- package/dist/annexFields.js +7 -0
- package/dist/announce.d.ts +62 -16
- package/dist/announce.js +90 -4
- package/dist/appletCard.d.ts +17 -0
- package/dist/appletCard.js +60 -0
- package/dist/attributes.d.ts +3 -3
- package/dist/attributes.js +1 -1
- package/dist/builder.d.ts +28 -13
- package/dist/builder.js +57 -5
- package/dist/cadences.d.ts +8 -1
- package/dist/cadences.js +27 -2
- package/dist/characterProfile.d.ts +137 -0
- package/dist/characterProfile.js +24 -0
- package/dist/component.d.ts +1 -1
- package/dist/componentImports.d.ts +1 -1
- package/dist/componentImports.js +2 -0
- package/dist/componentWire.js +28 -0
- package/dist/conditions.d.ts +5 -1
- package/dist/conditions.js +7 -0
- package/dist/declarations.d.ts +63 -1
- package/dist/declarations.js +176 -7
- package/dist/descriptors.d.ts +145 -6
- package/dist/descriptors.js +106 -5
- package/dist/document.d.ts +9 -1
- package/dist/document.js +44 -1
- package/dist/events.d.ts +82 -8
- package/dist/events.js +42 -5
- package/dist/executor.d.ts +27 -0
- package/dist/executor.js +32 -8
- package/dist/exposure.d.ts +35 -1
- package/dist/exposure.js +64 -2
- package/dist/extension.d.ts +30 -2
- package/dist/extension.js +3 -1
- package/dist/fit.d.ts +4 -1
- package/dist/fit.js +43 -1
- package/dist/functions.d.ts +7 -1
- package/dist/functions.js +3 -1
- package/dist/genres.d.ts +67 -2
- package/dist/genres.js +160 -8
- package/dist/hookGrants.js +10 -0
- package/dist/hostElements.d.ts +3 -3
- package/dist/hostElements.js +12 -4
- package/dist/index.d.ts +5 -0
- package/dist/index.js +10 -0
- package/dist/layout.d.ts +18 -0
- package/dist/libraryDraft.d.ts +2 -0
- package/dist/libraryDraft.js +5 -1
- package/dist/lorebookFile.d.ts +8 -0
- package/dist/lorebookFile.js +21 -0
- package/dist/participants.d.ts +83 -8
- package/dist/participants.js +9 -5
- package/dist/pluginPermissions.js +1 -1
- package/dist/promptBlocks.d.ts +5 -1
- package/dist/promptBlocks.js +23 -8
- package/dist/provisos.d.ts +92 -0
- package/dist/provisos.js +273 -0
- package/dist/receiverRules.js +1 -1
- package/dist/registrations.d.ts +154 -14
- package/dist/registrations.js +293 -23
- package/dist/registry.js +6 -3
- package/dist/repertoires.d.ts +13 -1
- package/dist/repertoires.js +5 -1
- package/dist/rulesetDocument.d.ts +11 -0
- package/dist/rulesetDocument.js +17 -0
- package/dist/rulesetSections.d.ts +12 -0
- package/dist/rulesetSections.js +8 -0
- package/dist/rulesets.js +6 -0
- package/dist/sceneSettings.d.ts +7 -1
- package/dist/sceneSettings.js +10 -5
- package/dist/sessionDossier.d.ts +159 -2
- package/dist/sessionLayout.d.ts +296 -85
- package/dist/sessionLayout.js +397 -133
- package/dist/sessionSettings.d.ts +18 -0
- package/dist/settings.d.ts +28 -1
- package/dist/settings.js +50 -2
- package/dist/shapes.d.ts +15 -1
- package/dist/shapes.js +15 -1
- package/dist/sheetLatitude.d.ts +148 -0
- package/dist/sheetLatitude.js +161 -0
- package/dist/speech.d.ts +14 -3
- package/dist/storyTime.d.ts +77 -1
- package/dist/storyTime.js +117 -8
- package/dist/surfaces.d.ts +49 -2
- package/dist/surfaces.js +3 -0
- package/dist/template.d.ts +38 -1
- package/dist/templateCheck.d.ts +24 -0
- package/dist/templateCheck.js +465 -10
- package/dist/templateFit.js +8 -1
- package/dist/templateIds.d.ts +6 -0
- package/dist/templateIds.js +9 -0
- package/dist/turnLock.d.ts +10 -1
- package/dist/turnLock.js +6 -1
- package/dist/turnOrder.d.ts +37 -4
- package/dist/turnOrder.js +49 -11
- package/dist/validate.d.ts +4 -2
- package/dist/validate.js +84 -11
- package/dist/variableLayouts.d.ts +160 -0
- package/dist/variableLayouts.js +202 -0
- package/dist/variables.d.ts +237 -20
- package/dist/variables.js +292 -33
- package/dist/widgetDecls.js +12 -0
- package/dist/widgets.d.ts +449 -47
- package/dist/widgets.js +31 -0
- package/host-elements.d.ts +4 -2
- package/package.json +1 -1
package/dist/builder.js
CHANGED
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* to the same rows.
|
|
15
15
|
* @ruling 04 §4, 04 §4a, R-14 (2026-09-15), F6
|
|
16
16
|
*/
|
|
17
|
-
import { eventsLockFindings, swapFitFinding, } from './descriptors.js';
|
|
17
|
+
import { eventsLockFindings, swapFitFinding, getDefinition, } from './descriptors.js';
|
|
18
18
|
import { makeScope, ITEM } from './scope.js';
|
|
19
|
-
import { isDataRef, isSlotRef, slot } from './refs.js';
|
|
19
|
+
import { collectDataRefs, isDataRef, isSlotRef, slot } from './refs.js';
|
|
20
20
|
import { assertSpecId, parseSpecId } from './identity.js';
|
|
21
21
|
import { TURN_ORDER_CHANGED_IS_INTERNAL, genreIdOf, sessionEvents } from './genres.js';
|
|
22
22
|
import { eventById, isSessionEventDecl, notADeclaredEvent, packageEventById } from './events.js';
|
|
@@ -70,8 +70,6 @@ function exposeOf(key, pinned, expose) {
|
|
|
70
70
|
if (bad.length)
|
|
71
71
|
throw new Error(bad[0]);
|
|
72
72
|
}
|
|
73
|
-
if (expose.purpose !== undefined && !isModelCall(pinned))
|
|
74
|
-
throw new Error(stepPurposeRefusal(key, pinned.id));
|
|
75
73
|
if (expose.promptReach !== undefined) {
|
|
76
74
|
if (expose.promptReach !== 'owner')
|
|
77
75
|
throw new Error(`node '${key}': expose.promptReach is 'owner' or absent — an administrator's choice is the default`);
|
|
@@ -106,7 +104,21 @@ function exposeOf(key, pinned, expose) {
|
|
|
106
104
|
export function isModelCall(def) {
|
|
107
105
|
return def.kind === 'oracle' && Object.values(def.slots ?? {}).some((s) => s.kind === 'connection');
|
|
108
106
|
}
|
|
109
|
-
/**
|
|
107
|
+
/**
|
|
108
|
+
* Whether a spec **calls a model at all**: any node whose definition `isModelCall`, or any definition
|
|
109
|
+
* a node lists in `expose.swaps` that does (a swap can seat a model call). A definition the registry
|
|
110
|
+
* does not know counts as none. Decides where a step purpose is allowed: on any step of a spec that
|
|
111
|
+
* calls no model, and only on a model call in one that does.
|
|
112
|
+
* @internal
|
|
113
|
+
*/
|
|
114
|
+
export function specCallsModel(nodes) {
|
|
115
|
+
const calls = (id) => {
|
|
116
|
+
const def = getDefinition(id);
|
|
117
|
+
return def !== undefined && isModelCall(def);
|
|
118
|
+
};
|
|
119
|
+
return nodes.some((n) => calls(`${n.definitionId}@${n.definitionVersion}`) || (n.expose?.swaps ?? []).some(calls));
|
|
120
|
+
}
|
|
121
|
+
/** The one sentence a misplaced step purpose is refused with, at `build()` and at `validate()`. @internal */
|
|
110
122
|
export const stepPurposeRefusal = (key, definitionId) => `node '${key}': expose.purpose says what a model call is for, but ${definitionId} calls no model — ` +
|
|
111
123
|
`put the purpose on the oracle that does, or give this step a label instead`;
|
|
112
124
|
/**
|
|
@@ -933,6 +945,16 @@ export class SpecBuilder extends ChainBuilder {
|
|
|
933
945
|
return this;
|
|
934
946
|
}
|
|
935
947
|
build() {
|
|
948
|
+
// A step purpose is allowed on any step of a spec that calls no model, and only on a model
|
|
949
|
+
// call in one that does: a rule over the whole spec, so it is checked here, not per node.
|
|
950
|
+
if (this.spec.nodes.some((n) => n.expose?.purpose !== undefined) && specCallsModel(this.spec.nodes))
|
|
951
|
+
for (const n of this.spec.nodes) {
|
|
952
|
+
if (n.expose?.purpose === undefined)
|
|
953
|
+
continue;
|
|
954
|
+
const def = getDefinition(`${n.definitionId}@${n.definitionVersion}`);
|
|
955
|
+
if (def && !isModelCall(def))
|
|
956
|
+
throw new Error(stepPurposeRefusal(n.key, def.id));
|
|
957
|
+
}
|
|
936
958
|
// 🚧 A pipeline mounted by registrations (the suits form) offers its
|
|
937
959
|
// actions where a registration includes them, so they carry no genre
|
|
938
960
|
// (D3). A spec that said nothing at its inlet still needs the lock.
|
|
@@ -942,6 +964,7 @@ export class SpecBuilder extends ChainBuilder {
|
|
|
942
964
|
throw new Error(`spec '${this.spec.id}' contributes action '${orphan.key}' but has no inlet lock — ` +
|
|
943
965
|
`register the action (register(spec.actions.${orphan.key}, spec)) and declare the inlet with ` +
|
|
944
966
|
`{ suits: [ … ] }, or ⏳ lock it: .inlet(key, node, { genre, event })`);
|
|
967
|
+
supplyPromptStepWiring(this.spec);
|
|
945
968
|
// The handles, beside the document and never in it: non-enumerable,
|
|
946
969
|
// so nothing that serializes, hashes or compares a spec sees them.
|
|
947
970
|
Object.defineProperty(this.spec, 'actions', {
|
|
@@ -953,6 +976,35 @@ export class SpecBuilder extends ChainBuilder {
|
|
|
953
976
|
return this.spec;
|
|
954
977
|
}
|
|
955
978
|
}
|
|
979
|
+
/**
|
|
980
|
+
* Writes the wiring an `assemble@2` that feeds a model call leaves out:
|
|
981
|
+
* `template` becomes `slot.template()` and `connection` becomes
|
|
982
|
+
* `slot.connectionOf(<the model call it feeds>)`. A key the spec states is
|
|
983
|
+
* kept; only `undefined` ones are filled, so a second call changes nothing.
|
|
984
|
+
* Mirrors `validate()`'s `assemble wiring` law, over the built nodes (no
|
|
985
|
+
* edges yet): the model call is the first oracle, in node order, whose config
|
|
986
|
+
* reads this assemble's output and which `isModelCall`.
|
|
987
|
+
*/
|
|
988
|
+
function supplyPromptStepWiring(spec) {
|
|
989
|
+
for (const assemble of spec.nodes) {
|
|
990
|
+
if (assemble.definitionId !== 'core:task/assemble' || assemble.definitionVersion !== 2)
|
|
991
|
+
continue;
|
|
992
|
+
const modelCall = spec.nodes.find((n) => {
|
|
993
|
+
if (n.kind !== 'oracle')
|
|
994
|
+
return false;
|
|
995
|
+
if (!collectDataRefs(n.config).some(({ ref }) => ref.node === assemble.key))
|
|
996
|
+
return false;
|
|
997
|
+
const d = getDefinition(`${n.definitionId}@${n.definitionVersion}`);
|
|
998
|
+
return d !== undefined && isModelCall(d);
|
|
999
|
+
});
|
|
1000
|
+
if (!modelCall)
|
|
1001
|
+
continue;
|
|
1002
|
+
if (assemble.config.template === undefined)
|
|
1003
|
+
assemble.config.template = slot.template();
|
|
1004
|
+
if (assemble.config.connection === undefined)
|
|
1005
|
+
assemble.config.connection = slot.connectionOf(modelCall.key);
|
|
1006
|
+
}
|
|
1007
|
+
}
|
|
956
1008
|
/** The slug the declared defaults are stored under (`.defaults()`). @internal */
|
|
957
1009
|
export const DEFAULTS_SLUG = 'default';
|
|
958
1010
|
/**
|
package/dist/cadences.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* (`core:cadence/every-n-turns@1`) and **options** declared as fields, so a
|
|
14
14
|
* registration states it as `{ id, options }` (a `CadenceRef`): addressable,
|
|
15
15
|
* serializable, validated by the same field declarations an administrator's
|
|
16
|
-
* settings use (§11-3). Core's
|
|
16
|
+
* settings use (§11-3). Core's eleven are evaluated natively by the host
|
|
17
17
|
* (`evaluate: 'host'`); a plugin's cadence is a script of kind
|
|
18
18
|
* `core:script:cadence/due@1`, run in the sandbox.
|
|
19
19
|
*
|
|
@@ -336,6 +336,8 @@ export declare const EVERY_N_TURNS: CadenceDef;
|
|
|
336
336
|
/** @experimental */
|
|
337
337
|
export declare const AFTER_EACH_TURN: CadenceDef;
|
|
338
338
|
/** @experimental */
|
|
339
|
+
export declare const EVERY_N_ROUNDS: CadenceDef;
|
|
340
|
+
/** @experimental */
|
|
339
341
|
export declare const AFTER_EACH_ROUND: CadenceDef;
|
|
340
342
|
/** @experimental */
|
|
341
343
|
export declare const AFTER_EACH_SCENE: CadenceDef;
|
|
@@ -354,6 +356,7 @@ export declare const SCHEDULE: CadenceDef;
|
|
|
354
356
|
/** Core's cadences, by name. @experimental */
|
|
355
357
|
export declare const coreCadences: Readonly<{
|
|
356
358
|
everyNTurns: CadenceDef;
|
|
359
|
+
everyNRounds: CadenceDef;
|
|
357
360
|
afterEachTurn: CadenceDef;
|
|
358
361
|
afterEachRound: CadenceDef;
|
|
359
362
|
afterEachScene: CadenceDef;
|
|
@@ -394,6 +397,10 @@ export declare function cadenceCarries(ref: CadenceRef): EntityKind[];
|
|
|
394
397
|
export declare const everyNTurns: (o: {
|
|
395
398
|
n: number;
|
|
396
399
|
}) => CadenceRef;
|
|
400
|
+
/** Every `n` rounds — the 2nd, the 4th, … @experimental */
|
|
401
|
+
export declare const everyNRounds: (o: {
|
|
402
|
+
n: number;
|
|
403
|
+
}) => CadenceRef;
|
|
397
404
|
/** After every turn. @experimental */
|
|
398
405
|
export declare const afterEachTurn: () => CadenceRef;
|
|
399
406
|
/** After every round — the "wait for everyone". @experimental */
|
package/dist/cadences.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* (`core:cadence/every-n-turns@1`) and **options** declared as fields, so a
|
|
14
14
|
* registration states it as `{ id, options }` (a `CadenceRef`): addressable,
|
|
15
15
|
* serializable, validated by the same field declarations an administrator's
|
|
16
|
-
* settings use (§11-3). Core's
|
|
16
|
+
* settings use (§11-3). Core's eleven are evaluated natively by the host
|
|
17
17
|
* (`evaluate: 'host'`); a plugin's cadence is a script of kind
|
|
18
18
|
* `core:script:cadence/due@1`, run in the sandbox.
|
|
19
19
|
*
|
|
@@ -357,7 +357,7 @@ function scheduleAtFindings(raw, clock, at) {
|
|
|
357
357
|
}
|
|
358
358
|
return out;
|
|
359
359
|
}
|
|
360
|
-
// ── Core's
|
|
360
|
+
// ── Core's eleven (PLAN-layering D2) ───────────────────────────────────────────
|
|
361
361
|
const HOST = 'host';
|
|
362
362
|
/** @experimental */
|
|
363
363
|
export const EVERY_N_TURNS = defineCadence({
|
|
@@ -392,6 +392,20 @@ export const AFTER_EACH_TURN = defineCadence({
|
|
|
392
392
|
evaluate: HOST,
|
|
393
393
|
});
|
|
394
394
|
/** @experimental */
|
|
395
|
+
export const EVERY_N_ROUNDS = defineCadence({
|
|
396
|
+
id: 'core:cadence/every-n-rounds@1',
|
|
397
|
+
i18n: {
|
|
398
|
+
name: { en: 'Every few rounds' },
|
|
399
|
+
description: { en: 'Runs after every so many rounds of the session.' },
|
|
400
|
+
},
|
|
401
|
+
options: {
|
|
402
|
+
n: { type: 'integer', min: 1, max: 1000, default: 2, label: { en: 'Every how many rounds' } },
|
|
403
|
+
},
|
|
404
|
+
wakesOn: [ROUND_ENDED_EVENT],
|
|
405
|
+
carries: ['session'],
|
|
406
|
+
evaluate: HOST,
|
|
407
|
+
});
|
|
408
|
+
/** @experimental */
|
|
395
409
|
export const AFTER_EACH_ROUND = defineCadence({
|
|
396
410
|
id: 'core:cadence/after-each-round@1',
|
|
397
411
|
i18n: {
|
|
@@ -537,6 +551,7 @@ export const SCHEDULE = defineCadence({
|
|
|
537
551
|
/** Core's cadences, by name. @experimental */
|
|
538
552
|
export const coreCadences = Object.freeze({
|
|
539
553
|
everyNTurns: EVERY_N_TURNS,
|
|
554
|
+
everyNRounds: EVERY_N_ROUNDS,
|
|
540
555
|
afterEachTurn: AFTER_EACH_TURN,
|
|
541
556
|
afterEachRound: AFTER_EACH_ROUND,
|
|
542
557
|
afterEachScene: AFTER_EACH_SCENE,
|
|
@@ -692,6 +707,8 @@ const freezeRef = (id, options) => {
|
|
|
692
707
|
// ── The ready-made cadences (each returns a `CadenceRef`) ───────────────────
|
|
693
708
|
/** Every `n` turns — the 5th, the 10th, … @experimental */
|
|
694
709
|
export const everyNTurns = (o) => freezeRef(EVERY_N_TURNS.id, { n: o?.n });
|
|
710
|
+
/** Every `n` rounds — the 2nd, the 4th, … @experimental */
|
|
711
|
+
export const everyNRounds = (o) => freezeRef(EVERY_N_ROUNDS.id, { n: o?.n });
|
|
695
712
|
/** After every turn. @experimental */
|
|
696
713
|
export const afterEachTurn = () => freezeRef(AFTER_EACH_TURN.id, {});
|
|
697
714
|
/** After every round — the "wait for everyone". @experimental */
|
|
@@ -945,6 +962,14 @@ export function cadenceDue(ref, event, state = {}) {
|
|
|
945
962
|
? { due: true, state }
|
|
946
963
|
: no(state, `turn ${m.turn} is not a multiple of ${n}`);
|
|
947
964
|
}
|
|
965
|
+
case EVERY_N_ROUNDS.id: {
|
|
966
|
+
if (m.event !== ROUND_ENDED_EVENT)
|
|
967
|
+
break;
|
|
968
|
+
const n = isWhole(o.n) && o.n >= 1 ? o.n : 2;
|
|
969
|
+
return m.round >= 1 && m.round % n === 0
|
|
970
|
+
? { due: true, state }
|
|
971
|
+
: no(state, `round ${m.round} is not a multiple of ${n}`);
|
|
972
|
+
}
|
|
948
973
|
case AFTER_EACH_TURN.id:
|
|
949
974
|
case AFTER_EACH_ROUND.id:
|
|
950
975
|
case AFTER_EACH_SCENE.id:
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🚧 The **character profile** (plan §32 §2, §33.1; owner ruling 2026-11-05
|
|
3
|
+
* late, _"Character profile?"_): the one shape a character version holds,
|
|
4
|
+
* card and cast alike. A card version holds a whole profile; a cast version
|
|
5
|
+
* holds its own values and names in `follows` the fields it reads from its
|
|
6
|
+
* parent card version.
|
|
7
|
+
*
|
|
8
|
+
* Always qualified (R3): a bare _profile_ stays the export, docs,
|
|
9
|
+
* image-generation and evidence profiles.
|
|
10
|
+
*
|
|
11
|
+
* Owner: "Reconcile what we have for character cards. API should start with
|
|
12
|
+
* the same shape, can update both with what's best. We should also make sure
|
|
13
|
+
* we merge together any fields where there's an arbitrary duplicate like
|
|
14
|
+
* greeting and additional greetings." — so the opener, the alternate
|
|
15
|
+
* greetings and the group-only greetings are ONE list (`greetings`), and the
|
|
16
|
+
* creator notes and their translations are one field (`creatorNotes`).
|
|
17
|
+
*
|
|
18
|
+
* Mirrors the app's `shared/characters/profile.ts` field for field — an edit
|
|
19
|
+
* to one is an edit to both. Types and the field list only: the host fills
|
|
20
|
+
* them; nothing here reads or writes a character.
|
|
21
|
+
*/
|
|
22
|
+
import type { Stroke } from './strokes.js';
|
|
23
|
+
/**
|
|
24
|
+
* 🚧 One greeting. `groupOnly` marks one a group session uses.
|
|
25
|
+
* @experimental
|
|
26
|
+
*/
|
|
27
|
+
export interface CharacterGreeting {
|
|
28
|
+
text: string;
|
|
29
|
+
groupOnly?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 🚧 The creator's notes: the main text, its language when known, and other languages' texts.
|
|
33
|
+
* @experimental
|
|
34
|
+
*/
|
|
35
|
+
export interface CharacterCreatorNotes {
|
|
36
|
+
text: string;
|
|
37
|
+
/** ISO 639-1 code of `text`, when known. */
|
|
38
|
+
lang?: string;
|
|
39
|
+
/** Other languages' notes by ISO 639-1 code; never one identical to `text`. */
|
|
40
|
+
variants: Record<string, string>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 🚧 The character profile. Nullable fields hold no value; lists are never null.
|
|
44
|
+
* @experimental
|
|
45
|
+
*/
|
|
46
|
+
export interface CharacterProfileV1 {
|
|
47
|
+
name: string | null;
|
|
48
|
+
nickname: string | null;
|
|
49
|
+
aliases: string[];
|
|
50
|
+
/** A separate optional one-liner; readers fall back to the description's first sentence (§33.1). */
|
|
51
|
+
summary: string | null;
|
|
52
|
+
description: string | null;
|
|
53
|
+
personality: string | null;
|
|
54
|
+
scenario: string | null;
|
|
55
|
+
/** Merged: the opener first, then the alternates (empty ones kept: today's swipes), the group-only ones marked. */
|
|
56
|
+
greetings: CharacterGreeting[];
|
|
57
|
+
exampleDialogues: string[];
|
|
58
|
+
postHistoryInstructions: string | null;
|
|
59
|
+
creatorNotes: CharacterCreatorNotes | null;
|
|
60
|
+
strokes: Stroke[];
|
|
61
|
+
/** The face (a card's avatar, a member's face): a `files` row. */
|
|
62
|
+
faceMediaId: number | null;
|
|
63
|
+
/** The likeness for image generation; every part optional. */
|
|
64
|
+
likeness: {
|
|
65
|
+
/** The likeness image's `files` row; absent means "use the avatar". */
|
|
66
|
+
imageMediaId?: number;
|
|
67
|
+
/** The likeness prompt — a tag line of the character's look. */
|
|
68
|
+
prompt?: string;
|
|
69
|
+
/** The likeness negative — what to keep out of the picture. */
|
|
70
|
+
negative?: string;
|
|
71
|
+
} | null;
|
|
72
|
+
/** How the character sounds when its lines are spoken; every part optional. */
|
|
73
|
+
timbre: {
|
|
74
|
+
/** "a warm low alto, slight Irish lilt, unhurried" — portable prose. */
|
|
75
|
+
description?: string;
|
|
76
|
+
/** A voicebank entry's slug on THIS pub. Dropped on card export. */
|
|
77
|
+
voice?: string;
|
|
78
|
+
/** The voicebank slug that reads the prose AROUND this character's lines. Pub-local; dropped on card export. */
|
|
79
|
+
narrationVoice?: string;
|
|
80
|
+
/** ISO 639-1 code the character speaks (`en`, `ja`). */
|
|
81
|
+
language?: string;
|
|
82
|
+
settings?: {
|
|
83
|
+
/** Speaking rate multiplier, 1 = the voice's own pace. */
|
|
84
|
+
speed?: number;
|
|
85
|
+
/** 0–1, ElevenLabs-style. */
|
|
86
|
+
stability?: number;
|
|
87
|
+
/** 0–1, ElevenLabs-style. */
|
|
88
|
+
similarity?: number;
|
|
89
|
+
/** 0–1, ElevenLabs-style. */
|
|
90
|
+
style?: number;
|
|
91
|
+
/** The voice seed: on a voice-designing model it picks which person the description becomes. */
|
|
92
|
+
seed?: number;
|
|
93
|
+
/** ElevenLabs-style speaker boost: on emphasises the original speaker. */
|
|
94
|
+
speakerBoost?: boolean;
|
|
95
|
+
};
|
|
96
|
+
/** `true`: this character's lines are never spoken. Absent is spoken. */
|
|
97
|
+
silent?: boolean;
|
|
98
|
+
} | null;
|
|
99
|
+
/** A sprite set's name; null = the default set. */
|
|
100
|
+
spriteSet: string | null;
|
|
101
|
+
/** The card's remaining extension keys (likeness and timbre lifted out). */
|
|
102
|
+
extensions: Record<string, unknown>;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* 🚧 Every character profile field, in display order. A cast version's `follows` holds only these.
|
|
106
|
+
* @experimental
|
|
107
|
+
*/
|
|
108
|
+
export declare const CHARACTER_PROFILE_FIELDS: readonly ["name", "nickname", "aliases", "summary", "description", "personality", "scenario", "greetings", "exampleDialogues", "postHistoryInstructions", "creatorNotes", "strokes", "faceMediaId", "likeness", "timbre", "spriteSet", "extensions"];
|
|
109
|
+
/**
|
|
110
|
+
* 🚧 One character profile field name.
|
|
111
|
+
* @experimental
|
|
112
|
+
*/
|
|
113
|
+
export type CharacterProfileField = (typeof CHARACTER_PROFILE_FIELDS)[number];
|
|
114
|
+
/**
|
|
115
|
+
* 🚧 One cast member as a session reads them (`core:query/cast-member@1`'s `main`).
|
|
116
|
+
* @experimental
|
|
117
|
+
*/
|
|
118
|
+
export interface CastMemberV1 {
|
|
119
|
+
/** The member (the host's `lorebook_bindings.id`). */
|
|
120
|
+
castMemberId: number;
|
|
121
|
+
/** The card the member is drawn with on this reading (its version in force's parent card); null when card-less. */
|
|
122
|
+
cardId: number | null;
|
|
123
|
+
/** That parent card version; null when card-less. */
|
|
124
|
+
cardVersion: {
|
|
125
|
+
id: number;
|
|
126
|
+
number: number;
|
|
127
|
+
label: string | null;
|
|
128
|
+
} | null;
|
|
129
|
+
cardless: boolean;
|
|
130
|
+
/** The parent card version is below the card's current (highest) version: the card has moved on since. */
|
|
131
|
+
behindCard: boolean;
|
|
132
|
+
/** The profile fields read from the parent card version; [] when card-less. */
|
|
133
|
+
follows: CharacterProfileField[];
|
|
134
|
+
/** The profile as the session reads it, followed fields already filled from the card. */
|
|
135
|
+
profile: CharacterProfileV1;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=characterProfile.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🚧 Every character profile field, in display order. A cast version's `follows` holds only these.
|
|
3
|
+
* @experimental
|
|
4
|
+
*/
|
|
5
|
+
export const CHARACTER_PROFILE_FIELDS = [
|
|
6
|
+
'name',
|
|
7
|
+
'nickname',
|
|
8
|
+
'aliases',
|
|
9
|
+
'summary',
|
|
10
|
+
'description',
|
|
11
|
+
'personality',
|
|
12
|
+
'scenario',
|
|
13
|
+
'greetings',
|
|
14
|
+
'exampleDialogues',
|
|
15
|
+
'postHistoryInstructions',
|
|
16
|
+
'creatorNotes',
|
|
17
|
+
'strokes',
|
|
18
|
+
'faceMediaId',
|
|
19
|
+
'likeness',
|
|
20
|
+
'timbre',
|
|
21
|
+
'spriteSet',
|
|
22
|
+
'extensions',
|
|
23
|
+
];
|
|
24
|
+
//# sourceMappingURL=characterProfile.js.map
|
package/dist/component.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ export type { RequestDeclined } from './componentWire.js';
|
|
|
39
39
|
export type { RequestDeclineCode } from './surfaces.js';
|
|
40
40
|
export type { HostKeyEventDetail } from './hostElements.js';
|
|
41
41
|
export type { StatusText, WidgetActionReason } from './status.js';
|
|
42
|
-
export type { AttendanceV1, AttendeeV1, AuthorsNoteV1, AuthorsNoteValueV1, HistoryEntriesV1, HistoryEntryV1, HistorySceneV1, FoldedSectionPartDataV1, FoldedSectionV1, LayoutV1, MessageErrorConnectionV1, MessageErrorV1, MessageMetadataV1, MessagePartV1, MessageSwipesV1, MessageV1, PlaceLinkV1, PlaceV1, RoutineLogEntryV1, RoutineLogV1, SessionCharactersV1, SessionEntryV1, SessionPersonaV1, SessionPlacesV1, SessionStateV1, StatTrailChangeV1, StoryClockV1, WayV1, ViewerV1, WidgetAction, WidgetEvent, WidgetEventKind, WidgetRequestKind, WidgetRequests, } from './widgets.js';
|
|
42
|
+
export type { AttendanceV1, AttendeeV1, AuthorsNoteV1, AuthorsNoteValueV1, HistoryEntriesV1, HistoryEntryV1, HistorySceneV1, FoldedSectionPartDataV1, FoldedSectionV1, LayoutV1, MessageErrorConnectionV1, MessageErrorV1, MessageMetadataV1, MessagePartV1, MessageSwipesV1, MessageV1, PlaceLinkV1, PlaceV1, RoutineLogEntryV1, RoutineLogV1, SessionCharactersV1, SessionEntryV1, SessionPersonaV1, SessionPlacesV1, SessionRunStepV1, SessionRunStepsV1, SessionRunV1, SessionRunsV1, SessionStateV1, StatTrailChangeV1, StoryClockV1, WayV1, ViewerV1, WidgetAction, WidgetEvent, WidgetEventKind, WidgetRequestKind, WidgetRequests, } from './widgets.js';
|
|
43
43
|
/**
|
|
44
44
|
* 🚧 A story time and what a story clock steps by (Chronicle).
|
|
45
45
|
* @ruling W3
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
* @experimental
|
|
35
35
|
* @ruling C6 P1, owner ruling 2026-09-25 Q4
|
|
36
36
|
*/
|
|
37
|
-
export declare const COMPONENT_IMPORTS: readonly ['svelte', 'svelte/*', '@serene-pub/component-client', '@serene-pub/component-client/*', '@serene-pub/controls', '@serene-pub/sdk/component', '@serene-pub/core-catalog/conversation', '@serene-pub/core-catalog/lore-entries', '@serene-pub/core-catalog/scene-portraits', '@serene-pub/core-catalog/session-state', '@serene-pub/core-catalog/widgets', '@serene-pub/core-catalog/authors-note', '@serene-pub/core-catalog/turn-order', '@serene-pub/core-catalog/actions', '@serene-pub/core-catalog/annex', '@serene-pub/core-catalog/album', '@serene-pub/core-catalog/chronicle', '@serene-pub/core-catalog/places', '@serene-pub/core-catalog/attendance', '@serene-pub/core-catalog/backdrop'];
|
|
37
|
+
export declare const COMPONENT_IMPORTS: readonly ['svelte', 'svelte/*', '@serene-pub/component-client', '@serene-pub/component-client/*', '@serene-pub/controls', '@serene-pub/sdk/component', '@serene-pub/core-catalog/conversation', '@serene-pub/core-catalog/lore-entries', '@serene-pub/core-catalog/scene-portraits', '@serene-pub/core-catalog/session-state', '@serene-pub/core-catalog/widgets', '@serene-pub/core-catalog/authors-note', '@serene-pub/core-catalog/turn-order', '@serene-pub/core-catalog/actions', '@serene-pub/core-catalog/annex', '@serene-pub/core-catalog/album', '@serene-pub/core-catalog/chronicle', '@serene-pub/core-catalog/places', '@serene-pub/core-catalog/attendance', '@serene-pub/core-catalog/backdrop', '@serene-pub/core-catalog/session-runs'];
|
|
38
38
|
/**
|
|
39
39
|
* Specifiers no component may import, however it is built — the renderer is
|
|
40
40
|
* the host's, and so is the worker runtime that installs it.
|
package/dist/componentImports.js
CHANGED
|
@@ -65,6 +65,8 @@ export const COMPONENT_IMPORTS = [
|
|
|
65
65
|
'@serene-pub/core-catalog/attendance',
|
|
66
66
|
// 🚧 2026-10-12 (DESIGN-image-generation §6.4): the backdrop widget's plain half — appended.
|
|
67
67
|
'@serene-pub/core-catalog/backdrop',
|
|
68
|
+
// 🚧 2026-11-06 (lay-R): the Runs widget's plain half — appended.
|
|
69
|
+
'@serene-pub/core-catalog/session-runs',
|
|
68
70
|
];
|
|
69
71
|
/**
|
|
70
72
|
* Specifiers no component may import, however it is built — the renderer is
|
package/dist/componentWire.js
CHANGED
|
@@ -102,6 +102,34 @@ export function createComponentContext(port) {
|
|
|
102
102
|
case 'messages':
|
|
103
103
|
data.messages = m.messages;
|
|
104
104
|
return notify('messages');
|
|
105
|
+
case 'message': {
|
|
106
|
+
// Replaces one held row by id. A host sends it only to a peer it
|
|
107
|
+
// knows receives it; the full `messages`/`channel` posts still
|
|
108
|
+
// carry every add and remove. Arrays are copied, never mutated:
|
|
109
|
+
// a component may still hold the old one.
|
|
110
|
+
const row = m.message;
|
|
111
|
+
const id = row?.id;
|
|
112
|
+
if (!row || typeof row !== 'object' || typeof id !== 'number')
|
|
113
|
+
return;
|
|
114
|
+
const at = data.messages?.findIndex((r) => r.id === id) ?? -1;
|
|
115
|
+
if (data.messages && at >= 0) {
|
|
116
|
+
data.messages = data.messages.map((r, k) => (k === at ? row : r));
|
|
117
|
+
notify('messages');
|
|
118
|
+
}
|
|
119
|
+
let channels;
|
|
120
|
+
for (const [ch, list] of Object.entries(data.channels)) {
|
|
121
|
+
const k = list.findIndex((r) => r.id === id);
|
|
122
|
+
if (k < 0)
|
|
123
|
+
continue;
|
|
124
|
+
channels ??= { ...data.channels };
|
|
125
|
+
channels[ch] = list.map((r, j) => (j === k ? row : r));
|
|
126
|
+
}
|
|
127
|
+
if (channels) {
|
|
128
|
+
data.channels = channels;
|
|
129
|
+
notify('channels');
|
|
130
|
+
}
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
105
133
|
case 'channel':
|
|
106
134
|
data.channels = { ...data.channels, [String(m.channel)]: m.messages };
|
|
107
135
|
return notify('channels');
|
package/dist/conditions.d.ts
CHANGED
|
@@ -281,7 +281,7 @@ type AnnexOf<O> = O extends {
|
|
|
281
281
|
} : {};
|
|
282
282
|
/**
|
|
283
283
|
* 🚧 The host's fixed facts a condition may test (A5): whether the session is
|
|
284
|
-
* generating, its turn, round and last speaker (R51, R52), the open form's action, the backdrop, each cast member's current
|
|
284
|
+
* generating, its turn, round and last speaker (R51, R52), the round of a story channel by name, the open form's action, the backdrop, each cast member's current
|
|
285
285
|
* sprite, which invokable functions the session's rules use (S3), and — on an action that carries one — the message (`item.*` in the
|
|
286
286
|
* published values; absent elsewhere, so a condition on it reads false).
|
|
287
287
|
* @experimental
|
|
@@ -294,6 +294,10 @@ export interface SessionHostFacts {
|
|
|
294
294
|
readonly turn: ConditionProp<number, 'number'>;
|
|
295
295
|
/** 🚧 `session.round` — the round in progress on the story's lane, counted from 1 (R52). */
|
|
296
296
|
readonly round: ConditionProp<number, 'number'>;
|
|
297
|
+
/**
|
|
298
|
+
* 🚧 `session.rounds.<channel>` — the round in progress on one of the genre's story channels, counted from 1 (CP1). `main`'s equals `session.round`; a channel that is not a story channel reads as absent, so a condition on it is false.
|
|
299
|
+
*/
|
|
300
|
+
readonly rounds: (channel: string) => ConditionProp<number, 'number'>;
|
|
297
301
|
/** 🚧 `session.lastSpeaker` — who took the last turn on the story's lane: a participant reference, or `narrator` (R51). */
|
|
298
302
|
readonly lastSpeaker: ConditionProp<string, 'string'>;
|
|
299
303
|
/** `session.openForm.action` — the action that answers the open form, when one is open. */
|
package/dist/conditions.js
CHANGED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
* @ruling R31, A5, A19
|
|
49
49
|
*/
|
|
50
50
|
import { readPath, truthy as isTruthy } from './predicates.js';
|
|
51
|
+
import { formatChannel, parseChannel } from './channels.js';
|
|
51
52
|
import { getAttributeSlot, slotSlug } from './attributes.js';
|
|
52
53
|
import { getStatShape } from './statShapes.js';
|
|
53
54
|
import { hostStateFor } from './hostState.js';
|
|
@@ -369,6 +370,12 @@ function hostFacts() {
|
|
|
369
370
|
generating: prop('session.generating', 'boolean'),
|
|
370
371
|
turn: prop('session.turn', 'number'),
|
|
371
372
|
round: prop('session.round', 'number'),
|
|
373
|
+
rounds: (channel) => {
|
|
374
|
+
const slug = typeof channel === 'string' && channel ? formatChannel(parseChannel(channel)) : '';
|
|
375
|
+
if (!slug || slug.includes('.') || slug.includes('*'))
|
|
376
|
+
throw new Error("s.rounds(channel): name a channel by its slug — 'main', or one the genre declares with lore: 'story'");
|
|
377
|
+
return prop(`session.rounds.${slug}`, 'number');
|
|
378
|
+
},
|
|
372
379
|
lastSpeaker: prop('session.lastSpeaker', 'string'),
|
|
373
380
|
openForm: Object.freeze({ action: prop('session.openForm.action', 'string') }),
|
|
374
381
|
backdrop: Object.freeze({ set: prop('backdrop.set', 'boolean'), mediaId: prop('backdrop.mediaId', 'number') }),
|
package/dist/declarations.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ import type { WidgetDecl } from './layout.js';
|
|
|
24
24
|
import type { AnnouncedSpec, ExternalRef, StoredEventDeclaration, ConfigDecl, CoverageReport, PresetDecl, PromptDecl } from './announce.js';
|
|
25
25
|
import { type ComponentDecl } from './extension.js';
|
|
26
26
|
import { type GenreDecl } from './genres.js';
|
|
27
|
+
import { type RegistrationDecl } from './registrations.js';
|
|
27
28
|
import { type SurfacesDecl } from './surfaces.js';
|
|
28
29
|
import { type AnnexFieldDecl } from './annexFields.js';
|
|
29
30
|
/**
|
|
@@ -52,6 +53,11 @@ export interface DeclaredPackage {
|
|
|
52
53
|
* @ruling R29
|
|
53
54
|
*/
|
|
54
55
|
swaps?: readonly (SwapContribution | StoredSwapContribution)[];
|
|
56
|
+
/**
|
|
57
|
+
* Turn order options this package adds to genres it names.
|
|
58
|
+
* @ruling TQ1, TQ2, TQ4 (owner 2026-11-19)
|
|
59
|
+
*/
|
|
60
|
+
turnOrderOptions?: readonly (TurnOrderOptionDecl | StoredTurnOrderOption)[];
|
|
55
61
|
/** Events this package declares, with who may record them. */
|
|
56
62
|
events?: readonly StoredEventDeclaration[];
|
|
57
63
|
/**
|
|
@@ -90,6 +96,55 @@ export interface StoredSwapContribution {
|
|
|
90
96
|
}
|
|
91
97
|
/** The stored form of a contribution — the spec and the pin read down to their ids. @experimental */
|
|
92
98
|
export declare const storedSwap: (c: SwapContribution | StoredSwapContribution) => StoredSwapContribution;
|
|
99
|
+
/**
|
|
100
|
+
* One turn order option a plugin adds to a genre it names — `{ genre: storyGenre,
|
|
101
|
+
* option: register(coreEvents.turnOrderAsked, natural, { label: 'Natural hand-off' }) }`.
|
|
102
|
+
* The option never marks `default`: a plugin never changes a genre's default.
|
|
103
|
+
* @experimental
|
|
104
|
+
* @ruling TQ1, TQ2, TQ4 (owner 2026-11-19)
|
|
105
|
+
*/
|
|
106
|
+
export interface TurnOrderOptionDecl {
|
|
107
|
+
/** The genre it is offered in — the genre value, or its id for one you cannot import. Never this package's own genre. */
|
|
108
|
+
genre: GenreDecl | string;
|
|
109
|
+
/** A registration on Turn order asked, made by `register()`. */
|
|
110
|
+
option: RegistrationDecl;
|
|
111
|
+
}
|
|
112
|
+
/** As stored in the manifest: the genre read down to its id. @experimental */
|
|
113
|
+
export interface StoredTurnOrderOption {
|
|
114
|
+
genre: string;
|
|
115
|
+
option: RegistrationDecl;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* The stored form of an option — the genre read down to its id; the option is
|
|
119
|
+
* the same object, so the registration door still recognises `register()`'s.
|
|
120
|
+
* @experimental
|
|
121
|
+
*/
|
|
122
|
+
export declare const storedTurnOrderOption: (o: TurnOrderOptionDecl | StoredTurnOrderOption) => StoredTurnOrderOption;
|
|
123
|
+
/**
|
|
124
|
+
* Turn order options a package adds to genres it names. Each is a registration
|
|
125
|
+
* on Turn order asked, labelled, marking no default, running a pipeline the
|
|
126
|
+
* package ships (a model is asked only through core's turn advise, R53), in a
|
|
127
|
+
* genre that is not this package's own. A genre that is neither core's nor the
|
|
128
|
+
* package's is accepted and not required: the instance offers the option once
|
|
129
|
+
* that genre arrives. Reads both the authored and the stored form.
|
|
130
|
+
* @experimental
|
|
131
|
+
* @ruling TQ1, TQ2, TQ4 (owner 2026-11-19)
|
|
132
|
+
*/
|
|
133
|
+
export declare function turnOrderOptionFindings(options: readonly (TurnOrderOptionDecl | StoredTurnOrderOption)[], ctx: {
|
|
134
|
+
/** The package's namespace; optional (a catalogue judged without one). */
|
|
135
|
+
ns?: string;
|
|
136
|
+
/** The package's own pipelines, by spec id. */
|
|
137
|
+
pipelines: ReadonlyMap<string, AnnouncedSpec>;
|
|
138
|
+
/** The package's own genre ids. */
|
|
139
|
+
genres?: ReadonlySet<string>;
|
|
140
|
+
/** Whether a `core:` genre id is one core ships. Absent: the genre registry, when it holds core's genres; otherwise not judged. */
|
|
141
|
+
knownGenre?: (id: string) => boolean;
|
|
142
|
+
/** Filled with the core events the options register on (a requirement on the host's version). */
|
|
143
|
+
requires?: Set<string>;
|
|
144
|
+
}): {
|
|
145
|
+
errors: string[];
|
|
146
|
+
warnings: string[];
|
|
147
|
+
};
|
|
93
148
|
/**
|
|
94
149
|
* Swaps as authored: the spec is a value and the definition a pin. A
|
|
95
150
|
* string is refused here, at the entry — the shared pass below also reads the
|
|
@@ -230,9 +285,16 @@ export declare function actionGenres(genres: readonly GenreDecl[], presets: read
|
|
|
230
285
|
* would make every install fail permanently on a requirement nothing can ever
|
|
231
286
|
* satisfy, where the real failure mode is mild and self-announcing: the row
|
|
232
287
|
* seeds into a pool no installed pipeline offers, and is simply never shown.
|
|
288
|
+
*
|
|
289
|
+
* `forPipeline` is held to the same shape as a spec id with an owner and no
|
|
290
|
+
* version pin. When `ns` is given, one in this package's own namespace must be
|
|
291
|
+
* a pipeline in `declaredSpecs`. That refusal is this function's own rule, not
|
|
292
|
+
* a copy of `configFindings`, which records another package's spec as a
|
|
293
|
+
* requirement: a prompt's pipeline never is one, so another package's id is
|
|
294
|
+
* accepted and not added to `requires`.
|
|
233
295
|
* @experimental
|
|
234
296
|
*/
|
|
235
|
-
export declare function promptFindings(prompts: readonly PromptDecl[]): string[];
|
|
297
|
+
export declare function promptFindings(prompts: readonly PromptDecl[], ns?: string, declaredSpecs?: ReadonlyMap<string, AnnouncedSpec>): string[];
|
|
236
298
|
/** Configs: node keys verified for declared specs; slugs unique per spec. @experimental */
|
|
237
299
|
export declare function configFindings(configs: readonly ConfigDecl[], declaredSpecs: ReadonlyMap<string, AnnouncedSpec>, requires: Set<string>): string[];
|
|
238
300
|
/**
|