@serene-pub/sdk 0.6.0-pr-6 โ†’ 0.6.0-pr-8

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 (111) hide show
  1. package/dist/actions.d.ts +23 -0
  2. package/dist/actions.js +36 -1
  3. package/dist/annexFields.d.ts +42 -1
  4. package/dist/annexFields.js +54 -5
  5. package/dist/announce.d.ts +26 -13
  6. package/dist/announce.js +31 -0
  7. package/dist/appletCard.d.ts +17 -0
  8. package/dist/appletCard.js +60 -0
  9. package/dist/attributes.d.ts +51 -2
  10. package/dist/attributes.js +32 -1
  11. package/dist/builder.d.ts +25 -8
  12. package/dist/builder.js +59 -7
  13. package/dist/cadences.d.ts +18 -2
  14. package/dist/cadences.js +34 -2
  15. package/dist/capabilities.d.ts +13 -2
  16. package/dist/capabilities.js +28 -1
  17. package/dist/characterProfile.d.ts +137 -0
  18. package/dist/characterProfile.js +24 -0
  19. package/dist/component.d.ts +6 -1
  20. package/dist/componentClient.d.ts +42 -6
  21. package/dist/componentImports.d.ts +1 -1
  22. package/dist/componentImports.js +2 -0
  23. package/dist/componentWire.js +22 -4
  24. package/dist/declarations.d.ts +15 -0
  25. package/dist/declarations.js +33 -0
  26. package/dist/descriptors.d.ts +168 -2
  27. package/dist/descriptors.js +110 -5
  28. package/dist/document.d.ts +8 -0
  29. package/dist/document.js +44 -1
  30. package/dist/events.d.ts +199 -4
  31. package/dist/events.js +74 -3
  32. package/dist/executor.js +26 -5
  33. package/dist/extension.d.ts +144 -3
  34. package/dist/extension.js +43 -0
  35. package/dist/fit.d.ts +4 -1
  36. package/dist/fit.js +43 -1
  37. package/dist/functions.d.ts +7 -1
  38. package/dist/functions.js +3 -1
  39. package/dist/genres.d.ts +27 -2
  40. package/dist/genres.js +72 -5
  41. package/dist/hookGrants.d.ts +14 -0
  42. package/dist/hookGrants.js +21 -10
  43. package/dist/hooks.d.ts +15 -2
  44. package/dist/hostElements.d.ts +1 -1
  45. package/dist/hostElements.js +8 -2
  46. package/dist/index.d.ts +8 -0
  47. package/dist/index.js +17 -0
  48. package/dist/jsonSchema.js +14 -2
  49. package/dist/layout.d.ts +18 -0
  50. package/dist/libraryDraft.d.ts +29 -0
  51. package/dist/libraryDraft.js +29 -0
  52. package/dist/lorebookFile.d.ts +52 -0
  53. package/dist/lorebookFile.js +223 -0
  54. package/dist/participants.d.ts +53 -8
  55. package/dist/participants.js +9 -5
  56. package/dist/pluginHarness.d.ts +50 -2
  57. package/dist/pluginHarness.js +65 -4
  58. package/dist/pluginPermissions.d.ts +15 -1
  59. package/dist/pluginPermissions.js +29 -2
  60. package/dist/promptBlocks.d.ts +5 -1
  61. package/dist/promptBlocks.js +23 -8
  62. package/dist/receiverRules.js +9 -0
  63. package/dist/registry.js +6 -3
  64. package/dist/rulesetDocument.d.ts +21 -0
  65. package/dist/rulesetDocument.js +64 -2
  66. package/dist/rulesetSections.d.ts +37 -3
  67. package/dist/rulesetSections.js +47 -8
  68. package/dist/sceneSettings.d.ts +4 -0
  69. package/dist/sceneSettings.js +7 -4
  70. package/dist/sessionDossier.d.ts +90 -0
  71. package/dist/sessionLayout.d.ts +296 -85
  72. package/dist/sessionLayout.js +397 -133
  73. package/dist/settings.d.ts +102 -5
  74. package/dist/settings.js +343 -6
  75. package/dist/shapes.d.ts +46 -1
  76. package/dist/shapes.js +54 -2
  77. package/dist/sheetLatitude.d.ts +148 -0
  78. package/dist/sheetLatitude.js +161 -0
  79. package/dist/speech.d.ts +333 -0
  80. package/dist/speech.js +199 -0
  81. package/dist/storage.d.ts +44 -0
  82. package/dist/storyTime.d.ts +25 -1
  83. package/dist/storyTime.js +48 -6
  84. package/dist/surfaces.d.ts +25 -2
  85. package/dist/template.d.ts +45 -2
  86. package/dist/template.js +25 -11
  87. package/dist/templateCheck.d.ts +24 -0
  88. package/dist/templateCheck.js +299 -7
  89. package/dist/templateFit.js +4 -0
  90. package/dist/templateIds.d.ts +6 -0
  91. package/dist/templateIds.js +9 -0
  92. package/dist/ties.d.ts +1 -0
  93. package/dist/ties.js +2 -1
  94. package/dist/turnLock.d.ts +10 -1
  95. package/dist/turnLock.js +6 -1
  96. package/dist/turnOrder.d.ts +37 -4
  97. package/dist/turnOrder.js +49 -11
  98. package/dist/userAnnex.d.ts +126 -0
  99. package/dist/userAnnex.js +214 -0
  100. package/dist/validate.d.ts +4 -2
  101. package/dist/validate.js +15 -11
  102. package/dist/values.js +6 -0
  103. package/dist/variableLayouts.d.ts +141 -0
  104. package/dist/variableLayouts.js +183 -0
  105. package/dist/variables.d.ts +35 -7
  106. package/dist/variables.js +34 -1
  107. package/dist/widgetDecls.js +12 -0
  108. package/dist/widgets.d.ts +848 -48
  109. package/dist/widgets.js +221 -3
  110. package/host-elements.d.ts +5 -3
  111. package/package.json +1 -1
package/dist/builder.d.ts CHANGED
@@ -210,10 +210,13 @@ export interface BuiltNode {
210
210
  * its legend among Advanced settings. Wins over the step status and the
211
211
  * node definition's name. Any node may carry one.
212
212
  * ยท `purpose` โ€” **the step purpose**: one or two plain sentences under
213
- * that group's heading, saying what this model call is for. Only on a
214
- * model call โ€” an oracle whose definition declares a `connection` slot
215
- * (`isModelCall`); no other step heads a group, so a purpose anywhere
216
- * else would never be read.
213
+ * that group's heading, saying what this model call is for. On a spec
214
+ * that calls no model at all it may sit on any step (the routines list
215
+ * prints the first one a routine's steps declare); on a spec that calls
216
+ * a model โ€” a node whose definition declares a `connection` slot
217
+ * (`isModelCall`), or one a node's `expose.swaps` lists โ€” only on a model
218
+ * call, because no other step heads a group. `build()` and `validate()`
219
+ * refuse the rest.
217
220
  *
218
221
  * Display text, hashed with the document like `status`: a spec that
219
222
  * sets neither hashes as it always did.
@@ -492,7 +495,7 @@ export interface NodeOpts {
492
495
  status?: I18n;
493
496
  /** The step label: this step's name in settings โ€” see `BuiltNode.expose`. */
494
497
  label?: I18n;
495
- /** The step purpose: what this model call is for, under its settings heading โ€” see `BuiltNode.expose`. */
498
+ /** The step purpose: what this step is for, under its settings heading โ€” see `BuiltNode.expose` for where it is allowed. */
496
499
  purpose?: I18n;
497
500
  /**
498
501
  * ๐Ÿšง **The prompt choice's reach** (R54, 2026-10-21): `'owner'` offers
@@ -534,7 +537,21 @@ export declare function isModelCall(def: {
534
537
  kind: string;
535
538
  }>>;
536
539
  }): boolean;
537
- /** The one sentence a misplaced step purpose is refused with, at construction and at `validate()`. @internal */
540
+ /**
541
+ * Whether a spec **calls a model at all**: any node whose definition `isModelCall`, or any definition
542
+ * a node lists in `expose.swaps` that does (a swap can seat a model call). A definition the registry
543
+ * does not know counts as none. Decides where a step purpose is allowed: on any step of a spec that
544
+ * calls no model, and only on a model call in one that does.
545
+ * @internal
546
+ */
547
+ export declare function specCallsModel(nodes: readonly {
548
+ definitionId: string;
549
+ definitionVersion: number;
550
+ expose?: {
551
+ swaps?: readonly string[];
552
+ };
553
+ }[]): boolean;
554
+ /** The one sentence a misplaced step purpose is refused with, at `build()` and at `validate()`. @internal */
538
555
  export declare const stepPurposeRefusal: (key: string, definitionId: string) => string;
539
556
  /**
540
557
  * A pinned constructor of a given kind. Constraining each method to its own kind makes
@@ -805,7 +822,7 @@ export declare class PresetBuilder<Nodes extends Record<string, PortDecl> = {}>
805
822
  prompts(nodeKey: keyof Nodes & string, value: Record<string, unknown>): this;
806
823
  /** A template **and its engine** โ€” the engine travels on the value (src/engines.ts). */
807
824
  template(nodeKey: keyof Nodes & string, value: TemplateValue): this;
808
- /** Generation parameters: a reference to a named config, or field overrides on top. */
825
+ /** Generation parameters: a reference to a named config, `{ seedKey }`. */
809
826
  sampling(nodeKey: keyof Nodes & string, value: Record<string, unknown>): this;
810
827
  /** Node toggles and the review position. */
811
828
  settings(nodeKey: keyof Nodes & string, value: Record<string, unknown>): this;
@@ -881,7 +898,7 @@ export declare class SpecBuilder<Nodes extends Record<string, PortDecl> = {}, A
881
898
  * ```ts
882
899
  * .defaults((d) => d
883
900
  * .prompts('generate', { system: STORY_SYSTEM })
884
- * .sampling('generate', slot.sampling('core:sampling/story')))
901
+ * .sampling('generate', { seedKey: 'sampling-default' }))
885
902
  * ```
886
903
  * Stored where the shipped default author preset always was
887
904
  * (`presets[slug: 'default', default: true]`), so a host reading that
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
- /** The one sentence a misplaced step purpose is refused with, at construction and at `validate()`. @internal */
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
  /**
@@ -528,7 +540,7 @@ export class PresetBuilder {
528
540
  template(nodeKey, value) {
529
541
  return this.set(nodeKey, 'template', value);
530
542
  }
531
- /** Generation parameters: a reference to a named config, or field overrides on top. */
543
+ /** Generation parameters: a reference to a named config, `{ seedKey }`. */
532
544
  sampling(nodeKey, value) {
533
545
  return this.set(nodeKey, 'sampling', value);
534
546
  }
@@ -694,7 +706,7 @@ export class SpecBuilder extends ChainBuilder {
694
706
  * ```ts
695
707
  * .defaults((d) => d
696
708
  * .prompts('generate', { system: STORY_SYSTEM })
697
- * .sampling('generate', slot.sampling('core:sampling/story')))
709
+ * .sampling('generate', { seedKey: 'sampling-default' }))
698
710
  * ```
699
711
  * Stored where the shipped default author preset always was
700
712
  * (`presets[slug: 'default', default: true]`), so a host reading that
@@ -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
  /**
@@ -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 ten are evaluated natively by the host
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
  *
@@ -48,7 +48,7 @@ import type { EntityKind } from './entities.js';
48
48
  import { type FieldDecl } from './settings.js';
49
49
  import { type I18n } from './i18n.js';
50
50
  import { type ConditionDecl } from './conditions.js';
51
- import { type EventDef, type SessionEventDecl } from './events.js';
51
+ import { type EventDef, type SessionEventDecl, type TurnSeatChange } from './events.js';
52
52
  import { type StoryCalendar, type StoryTime, type StoryTimeUnit } from './storyTime.js';
53
53
  /** ๐Ÿšง `core:event/turn-ended@1` โ€” a turn ended (R51). @experimental */
54
54
  export declare const TURN_ENDED_EVENT: 'core:event/turn-ended@1';
@@ -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 */
@@ -431,6 +438,13 @@ export declare const timelineCron: (o: {
431
438
  unit: StoryTimeUnit;
432
439
  maxJump?: CadenceSpan;
433
440
  }) => CadenceRef;
441
+ /**
442
+ * ๐Ÿšง Once each story day (M0, SHAPES L3): `timelineCron({ every: 1,
443
+ * unit: 'days' })` by name โ€” what the weather routine and a nightly diary
444
+ * run on. A helper over the Timeline Cron, not a cadence of its own.
445
+ * @experimental
446
+ */
447
+ export declare const afterEachDay: () => CadenceRef;
434
448
  /** At set moments on the system clock or the story calendar (R20). @experimental */
435
449
  export declare const schedule: (o: {
436
450
  clock: 'system' | 'story';
@@ -561,6 +575,8 @@ export interface RoutineCause {
561
575
  turnsBy?: Readonly<Record<string, number>>;
562
576
  /** ๐Ÿšง `round-ended`: who spoke in the round, in order of first turn (R52). */
563
577
  speakers?: readonly string[];
578
+ /** ๐Ÿšง `turn-ended`, when the genre declares `shape.turnSeatChanges: true`: the seats that changed since the previous turn (`TurnSeatChange`). */
579
+ turnSeatChanges?: readonly TurnSeatChange[];
564
580
  actor?: string;
565
581
  castMember?: string;
566
582
  subject?: string;
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 ten are evaluated natively by the host
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 ten (PLAN-layering D2) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
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 */
@@ -723,6 +740,13 @@ export const timelineCron = (o) => freezeRef(TIMELINE_CRON.id, {
723
740
  unit: o?.unit,
724
741
  ...(o?.maxJump ? { maxJump: { ...o.maxJump } } : {}),
725
742
  });
743
+ /**
744
+ * ๐Ÿšง Once each story day (M0, SHAPES L3): `timelineCron({ every: 1,
745
+ * unit: 'days' })` by name โ€” what the weather routine and a nightly diary
746
+ * run on. A helper over the Timeline Cron, not a cadence of its own.
747
+ * @experimental
748
+ */
749
+ export const afterEachDay = () => timelineCron({ every: 1, unit: 'days' });
726
750
  /** At set moments on the system clock or the story calendar (R20). @experimental */
727
751
  export const schedule = (o) => freezeRef(SCHEDULE.id, {
728
752
  clock: o?.clock,
@@ -938,6 +962,14 @@ export function cadenceDue(ref, event, state = {}) {
938
962
  ? { due: true, state }
939
963
  : no(state, `turn ${m.turn} is not a multiple of ${n}`);
940
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
+ }
941
973
  case AFTER_EACH_TURN.id:
942
974
  case AFTER_EACH_ROUND.id:
943
975
  case AFTER_EACH_SCENE.id:
@@ -414,7 +414,18 @@ export declare const FEATURES: readonly ['json_object', 'json_schema', 'strict_s
414
414
  * starts a new reply, the join then glues two beginnings together, and nothing
415
415
  * reports it. A connection that can only do that does not hold this.
416
416
  */
417
- 'continue_reply', 'wire_chat', 'wire_completion'];
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'];
418
429
  /** ๐Ÿšง A feature core knows by name โ€” one of `FEATURES`, the KNOWN list. @experimental */
419
430
  export type KnownFeatureId = (typeof FEATURES)[number];
420
431
  /**
@@ -507,7 +518,7 @@ export declare const BAND_ORDER: readonly ["none", "emulated", "native"];
507
518
  * grade correctly: a plugin introduces a transform, and it is binary until
508
519
  * somebody says otherwise.
509
520
  *
510
- * The three listed here are exactly the keys of `EMULATABLE_VIA`, and that is
521
+ * The bands listed here are exactly the keys of `EMULATABLE_VIA`, and that is
511
522
  * not a coincidence. An `emulated` band exists precisely where Serene Pub can
512
523
  * supply the capability itself over a backend that cannot, which is what that
513
524
  * table records. `closure` raises through `gradeOf(id, BAND.emulated)`, so a
@@ -307,6 +307,17 @@ export const FEATURES = [
307
307
  'continue_reply',
308
308
  'wire_chat',
309
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',
310
321
  ];
311
322
  /** Transforms contain `->`; features never do. The two spaces cannot collide. @internal */
312
323
  export const isTransformId = (id) => id.includes('->');
@@ -336,6 +347,13 @@ export const EMULATABLE_VIA = {
336
347
  json_object: ['json_schema', 'grammar'],
337
348
  json_schema: ['grammar'],
338
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: [],
339
357
  };
340
358
  /**
341
359
  * The band names core knows: what a grade MEANS, once you know the capability.
@@ -370,7 +388,7 @@ export const BAND_ORDER = [BAND.none, BAND.emulated, BAND.native];
370
388
  * grade correctly: a plugin introduces a transform, and it is binary until
371
389
  * somebody says otherwise.
372
390
  *
373
- * The three listed here are exactly the keys of `EMULATABLE_VIA`, and that is
391
+ * The bands listed here are exactly the keys of `EMULATABLE_VIA`, and that is
374
392
  * not a coincidence. An `emulated` band exists precisely where Serene Pub can
375
393
  * supply the capability itself over a backend that cannot, which is what that
376
394
  * table records. `closure` raises through `gradeOf(id, BAND.emulated)`, so a
@@ -382,6 +400,13 @@ export const BANDS = {
382
400
  json_object: [BAND.none, BAND.emulated, BAND.native],
383
401
  json_schema: [BAND.none, BAND.emulated, BAND.native],
384
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],
385
410
  };
386
411
  /** A capability nobody gave bands: it either works or it does not. @experimental */
387
412
  export const DEFAULT_BANDS = [BAND.none, BAND.native];
@@ -697,6 +722,8 @@ const FEATURE_LABELS = {
697
722
  // completion is that the model is handed one formatted string.
698
723
  wire_chat: 'Chat messages',
699
724
  wire_completion: 'Text completion',
725
+ // ๐Ÿšง The user's word: speech starts playing before the whole line is made.
726
+ audio_streaming: 'Streaming speech',
700
727
  };
701
728
  /**
702
729
  * What to show a person for a capability 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
@@ -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
@@ -47,4 +47,9 @@ export type { AttendanceV1, AttendeeV1, AuthorsNoteV1, AuthorsNoteValueV1, Histo
47
47
  export type { StoryTime, StoryTimeUnit } from './storyTime.js';
48
48
  /** The conversation dossier โ€” `session_full.v1`, for a widget granted `session:full`. */
49
49
  export type { SessionDossierV1 } from './sessionDossier.js';
50
+ /**
51
+ * ๐Ÿšง What a spoken line carries โ€” the S6 record core's messages widget reads
52
+ * under a line that was spoken (speech build, lane V 2026-10-28).
53
+ */
54
+ export type { CueMap, Inflection, SpokenAs, SpokenMeta, SpokenVoiceFrom } from './speech.js';
50
55
  //# sourceMappingURL=component.d.ts.map