@serene-pub/contracts 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/outlets.js CHANGED
@@ -238,6 +238,45 @@ export const createMessage = pin(describeOutletDefinition({
238
238
  * every row but a planner's.
239
239
  */
240
240
  turnPlan: S.json,
241
+ /**
242
+ * ๐Ÿšง A folio line's **kind** (2026-10-17): one word stored as
243
+ * `metadata.kind` โ€” the Dungeon Crawler's journal writes `did`
244
+ * ยท `found` ยท `met` ยท `changed` ยท `time` ยท `lead` โ€” which a
245
+ * Messages copy filters on (`rowKinds`) and groups under. A
246
+ * literal in the node's config or a wired port; absent writes
247
+ * no kind, and a row with none always shows.
248
+ */
249
+ kind: S.text,
250
+ /**
251
+ * ๐Ÿšง `'user'`: the row is a **person's own message** โ€” the run
252
+ * owner's, through `speaker` (`character:<id>` their persona,
253
+ * `player-seat:<id>` their card-less seat, `user:<id>` or
254
+ * nothing for themselves). A literal, on `generating`'s terms;
255
+ * absent is a reply. The host writes a person's row only for the
256
+ * run's own person on a root run, refuses a persona or seat that
257
+ * is not theirs, and fires the row's `message-completed` under
258
+ * the person's cause, so turn order and auto-advance answer it
259
+ * as a send. `core:spec/save-message` sets it.
260
+ * @ruling owner 2026-10-15
261
+ */
262
+ role: S.json,
263
+ /**
264
+ * ๐Ÿšง The person's ready **tray items** to post as the row's
265
+ * attachments (`core:image` / `core:file` parts), in one
266
+ * transaction with the row โ€” or the write is refused whole and
267
+ * the tray stays. Only on a person's row (`role: 'user'`).
268
+ */
269
+ trayItems: S.json,
270
+ /**
271
+ * ๐Ÿšง `true`: the row is a **table line** โ€” the table's own
272
+ * line, said in no voice (a Dungeon Crawler roll line,
273
+ * 2026-10-15). A literal, on `generating`'s terms. Stored as
274
+ * `metadata.tableLine`; the log draws it without a speaker's
275
+ * face or name, and a history read that asks for no table lines
276
+ * (`session-history@1`'s `tableLines: false`) leaves it out, so
277
+ * a model never takes it for its own speech and imitates it.
278
+ */
279
+ tableLine: S.json,
241
280
  },
242
281
  out: { main: S.writeResult, messageId: S.writeResult },
243
282
  },
@@ -312,6 +351,15 @@ export const updateMessage = pin(describeOutletDefinition({
312
351
  * only when given. Like `reasoning`, never re-sent to the model.
313
352
  */
314
353
  sections: S.foldedSections,
354
+ /**
355
+ * ๐Ÿšง The reply's PARTS, in order (O5, 2026-10-21; additive) โ€”
356
+ * `generate-text@1`'s `parts`. Every media part (a spoken
357
+ * reply's audio, a drawn image) lands on the row as a message
358
+ * part in the order the model gave it, after the text. Text and
359
+ * reasoning parts are not written from here: `text` and
360
+ * `reasoning` carry them.
361
+ */
362
+ parts: S.partStream,
315
363
  },
316
364
  out: { main: S.writeResult, messageId: S.writeResult },
317
365
  },
@@ -342,6 +390,18 @@ export const updateMessage = pin(describeOutletDefinition({
342
390
  * Delete a message. Publishes `lost` โ€” the content, role, speaker, channel
343
391
  * and metadata the row held โ€” beside the write result, so a listener (a
344
392
  * plugin cleaning its rows, the next reply's inlet) knows what went.
393
+ *
394
+ * ๐Ÿšง **The deletion outlet** (RF fix 5, owner ruling 2026-10-23: deletion
395
+ * requires a pipeline, so the genre manages it). Placed by the built-in's
396
+ * own spec (โณ retired as a person's verb), which names its row on `target`,
397
+ * and by a **deletion pipeline** โ€” a document entered through
398
+ * `core:inlet/message-deletion-asked@1`, the only other place it may stand
399
+ * (`deletionPipelinePlaces`) โ€” which hands it the deletion the event carried
400
+ * on `asked`, wired from the inlet's `main`
401
+ * (`C.deleteMessage.v1({ asked: $.input.main })`), and deletes that message
402
+ * and no other. One transaction: the row goes and everything the message
403
+ * changed goes with it by the one retraction rule (RF fix 4) โ€” and `taken`
404
+ * says what that was.
345
405
  * @experimental
346
406
  */
347
407
  export const deleteMessage = pin(describeOutletDefinition({
@@ -356,8 +416,30 @@ export const deleteMessage = pin(describeOutletDefinition({
356
416
  timeoutMs: 5000,
357
417
  causesEvent: 'core:event/message-deleted@1',
358
418
  ports: {
359
- in: { target: S.rowIds },
360
- out: { main: S.writeResult, messageId: S.writeResult, lost: S.json },
419
+ in: {
420
+ /** The row to delete โ€” the built-in's own spec's port. */
421
+ target: S.rowIds,
422
+ /**
423
+ * ๐Ÿšง The deletion a person asked for, whole (RF fix 5): a
424
+ * deletion pipeline's port, wired from
425
+ * `core:inlet/message-deletion-asked@1.main` and nothing else
426
+ * (`validate()`). The message deleted is the one it names.
427
+ */
428
+ asked: S.deletionAsked,
429
+ },
430
+ out: {
431
+ main: S.writeResult,
432
+ messageId: S.writeResult,
433
+ lost: S.json,
434
+ /**
435
+ * ๐Ÿšง What went with it (RF fix 5): the one retraction rule's
436
+ * count of what the message changed and was taken back โ€”
437
+ * values, configurations, proposals, zone snapshots, lore
438
+ * writes by what became of each, the notes' entries, and
439
+ * whether the clock moved back.
440
+ */
441
+ taken: S.json,
442
+ },
361
443
  },
362
444
  }));
363
445
  /**
@@ -418,6 +500,11 @@ export const setTurnOrder = pin(describeOutletDefinition({
418
500
  * ruling, reversing the original "no causesEvent"): a package's state is the annex, and a
419
501
  * genre that wants its turn order to answer that state binds the event in
420
502
  * the open, where the event map draws it โ€” not through a back door.
503
+ *
504
+ * ๐Ÿšง Every write that moves the document moves the owner's **annex document
505
+ * version** (a count, 0 before the first): `base` makes the write a
506
+ * compare-and-set on it, so a run that read the document before another run
507
+ * wrote it is refused rather than overwriting that run's write.
421
508
  * @experimental
422
509
  */
423
510
  export const setSessionAnnex = pin(describeOutletDefinition({
@@ -473,8 +560,246 @@ export const setSessionAnnex = pin(describeOutletDefinition({
473
560
  },
474
561
  },
475
562
  ports: {
476
- in: { value: S.json },
477
- out: { main: S.writeResult, annex: S.json },
563
+ in: {
564
+ value: S.json,
565
+ /**
566
+ * ๐Ÿšง Compare-and-set (M2a a8): the owner's **annex document
567
+ * version** this run read โ€” `session-annex`'s `version`. When the
568
+ * stored version is another, nothing is written: the write result
569
+ * says `stale: true` (`written: false`, with a receipt note), and
570
+ * `annex` and `version` carry the document as it stands now, to
571
+ * build on again. Absent, the write lands as it always did (the
572
+ * last writer's value wins).
573
+ */
574
+ base: S.json,
575
+ },
576
+ out: {
577
+ main: S.writeResult,
578
+ /** The owner's document as written โ€” or, when `base` was stale, as it stands now. Never core's runtime keys. */
579
+ annex: S.json,
580
+ /** ๐Ÿšง The owner's annex document version after this write (unchanged when nothing was written). */
581
+ version: S.json,
582
+ },
583
+ },
584
+ }));
585
+ /**
586
+ * ๐Ÿšง Name a person's **player seat** in this session (Dungeon Crawler's
587
+ * interview, 2026-10-15): the pipeline door to the seat name a person sets
588
+ * by hand in session settings (`sessions:update` `seatName`). The seat is
589
+ * `user`'s โ€” a `user:<id>` reference, the addressee of the form the name
590
+ * answered โ€” their card-less seat first, else their first seat; with none,
591
+ * a name opens a card-less seat for them, as the hand-set name does. The
592
+ * host refuses a seat for somebody who is neither the owner nor a playing
593
+ * guest, and a blank name (this outlet never clears one).
594
+ *
595
+ * `seat` is the seat as a participant reference โ€” `player-seat:<id>` for a
596
+ * card-less seat, `character:<id>` for a seat with a card โ€” and `seats` the
597
+ * same as a one-item list, the shape `resolve-state-changes@1`'s `owners`
598
+ * takes, so the seat's own stats can be written in the same run.
599
+ *
600
+ * ๐Ÿšง `retire` (Dungeon Crawler's new character after a death, owner ruling
601
+ * 2026-10-18): one of `user`'s own seats, by reference. That seat leaves the
602
+ * table โ€” its lines keep its name, its state stays where it was filed โ€” and
603
+ * the name opens a NEW card-less seat for them, which `seat` then names. A
604
+ * seat that is not theirs, or not live, is refused. `@1` evolves in place.
605
+ * @experimental
606
+ */
607
+ export const setSeatName = pin(describeOutletDefinition({
608
+ id: 'core:outlet/set-seat-name@1',
609
+ i18n: { name: { en: 'Name a player seat' } },
610
+ effects: 'write',
611
+ reviewDefault: 'off',
612
+ review: { fields: ['name'] },
613
+ timeoutMs: 2000,
614
+ ports: {
615
+ in: {
616
+ /** Whose seat: `user:<id>`. */
617
+ user: S.participantRef,
618
+ /** The character's name in this session. */
619
+ name: S.text,
620
+ /**
621
+ * ๐Ÿšง A seat of theirs this name replaces (`player-seat:<id>` or
622
+ * `character:<id>`): retired, and a new seat opened. JSON, so a
623
+ * script's part may name it (absent or null: none).
624
+ */
625
+ retire: S.json,
626
+ },
627
+ out: {
628
+ main: S.writeResult,
629
+ seat: S.participantRef,
630
+ seats: S.participantRefs,
631
+ },
632
+ },
633
+ }));
634
+ /**
635
+ * ๐Ÿšง **Open or close the composer** on a channel lane (owner ruling
636
+ * 2026-10-15): the genre's switch for whether a person may write there. The
637
+ * state is the session row's (`sessions.composer_states`, SDK
638
+ * `ComposerStatesV1`); core opens and closes nothing on its own, so a
639
+ * composer a genre closed stays closed until a pipeline opens it.
640
+ *
641
+ * - `channel` โ€” a slug, a canonical lane (`parley:2`; the bare slug is lane
642
+ * 1 alone), or `*` for every channel;
643
+ * - `open` โ€” `true` to open, `false` to close;
644
+ * - `reason` โ€” optional: what the composer is waiting on, as a sentence
645
+ * the person reads ("Make your character on the Planner tab first.").
646
+ * Shown in place of the placeholder and repeated in the refusal of a send
647
+ * the widget let through. Named `reason`, never `message`: a message is a
648
+ * session's row;
649
+ * - `person` โ€” optional: whose composer, `user:<id>`; absent is everyone,
650
+ * the session's owner included.
651
+ *
652
+ * Opening for everyone clears the lane's every closure; opening for one
653
+ * person clears theirs, and never overrides a close for everyone. The send
654
+ * door (`sessionMessages:sendPersonaMessage`, and `message-offered`'s offer)
655
+ * refuses a line on a closed composer; turn controls (Continue) are the
656
+ * round's, not the composer's, and are not touched. Every member's page is
657
+ * told at once.
658
+ *
659
+ * `main` is the write; `states` the whole document after it.
660
+ * @experimental
661
+ */
662
+ export const setComposerState = pin(describeOutletDefinition({
663
+ id: 'core:outlet/set-composer-state@1',
664
+ i18n: { name: { en: 'Open or close the composer' } },
665
+ effects: 'write',
666
+ reviewDefault: 'off',
667
+ review: { fields: ['reason'] },
668
+ timeoutMs: 2000,
669
+ ports: {
670
+ in: {
671
+ /** A slug, a canonical lane (`parley:2`), or `*`. */
672
+ channel: S.text,
673
+ /** `true` opens, `false` closes. */
674
+ open: S.json,
675
+ /** What the composer waits on โ€” a sentence. Optional. */
676
+ reason: S.text,
677
+ /**
678
+ * Whose composer: `user:<id>`, a participant reference as text.
679
+ * Optional; absent is everyone. `json`, as `set-stat-config@1`'s
680
+ * `owner` is: a genre wires it from a script's text, and the
681
+ * host parses the reference (a typed port refused that wire,
682
+ * 2026-10-18).
683
+ */
684
+ person: S.json,
685
+ },
686
+ out: {
687
+ main: S.writeResult,
688
+ states: S.json,
689
+ },
690
+ },
691
+ }));
692
+ /**
693
+ * ๐Ÿšง **Suggest a new scene** (pass 7, R-i, sprint 2, 2026-10-25): the judged scene check's
694
+ * answer โ€” "the story moved on; the next scene begins at this line, because โ€ฆ" โ€” recorded as a
695
+ * **scene cue** with trigger `judged` (`JUDGED_SCENE_TRIGGER`) and the model's words as its
696
+ * reason. From there the session's scene mode decides, as for any boundary trigger: Suggested โ€”
697
+ * the *New scene?* chip; Automatic โ€” the boundary is placed (unless `ask`); Manual โ€” nothing.
698
+ * The host re-checks the judged check's conditions at commit and skips, with a note, when they
699
+ * no longer hold or `at` is not one of its lines. Never held at the review gate: a cue's review
700
+ * is the chip.
701
+ *
702
+ * โš  Not a scene write (a person's *Start scene here*) and not a state proposal.
703
+ * @experimental
704
+ * @ruling R-i (2026-10-24)
705
+ */
706
+ export const proposeSceneCue = pin(describeOutletDefinition({
707
+ id: 'core:outlet/propose-scene-cue@1',
708
+ i18n: { name: { en: 'Suggest a new scene' } },
709
+ effects: 'write',
710
+ reviewDefault: 'off',
711
+ review: { fields: ['reason'] },
712
+ timeoutMs: 2000,
713
+ slots: {
714
+ params: {
715
+ kind: 'parameters',
716
+ facet: 'behavior',
717
+ schema: {
718
+ ask: {
719
+ type: 'boolean',
720
+ default: false,
721
+ label: { en: 'Always ask' },
722
+ description: {
723
+ en: 'Offer the new scene as a suggestion even when this session starts scenes on its own (Automatic). Off: the scene setting decides.',
724
+ },
725
+ },
726
+ },
727
+ },
728
+ },
729
+ ports: {
730
+ in: {
731
+ /**
732
+ * The line the next scene would open at โ€” a message id, as the
733
+ * sweep's sort gives it. `json`, as `set-composer-state@1`'s
734
+ * `person` is: wired from a script's output.
735
+ */
736
+ at: S.json,
737
+ /** The channel lane `at` is on, any spelling (canonicalised); absent or blank: `main`. */
738
+ channel: S.text,
739
+ /** Why, in the model's few words โ€” the chip's reason ("the party left the inn"). */
740
+ reason: S.text,
741
+ },
742
+ out: {
743
+ main: S.writeResult,
744
+ /** A `ProposedSceneCue`. */
745
+ cue: S.json,
746
+ },
747
+ },
748
+ }));
749
+ /**
750
+ * ๐Ÿšง **Configure a stat** for one owner in this session (owner ruling
751
+ * 2026-10-15): the pipeline door to an owner's **stat configuration** โ€” the
752
+ * deviations from an attribute slot's own config that one owner carries,
753
+ * `{ max: 26 }` on a seat's health. Stored as an `attribute_configs` row
754
+ * through the same writer a person's `state:configure` takes, so the bar,
755
+ * the write's bound and every prompt read the same maximum.
756
+ *
757
+ * The three in-ports are one `StatConfigDocument` (SDK `attributes.ts`) โ€”
758
+ * the format a card or session editor sends too:
759
+ *
760
+ * - `owner` โ€” whose: `player-seat:<id>`, `character:<id>` (that card's
761
+ * session layer) or `world`;
762
+ * - `slot` โ€” the attribute slot id, `core:slot/hp@1`;
763
+ * - `config` โ€” only the keys the slot's stat shape bounds
764
+ * (`statConfigKeys`): a number's `min`/`max`, a choice's `of`, a list's
765
+ * `maxItems` and `of`/`maxLength`, a line's `maxLength`, and every
766
+ * slot's `descriptor`.
767
+ *
768
+ * Refused, halting the run with the sentence: a slot nothing declares or
769
+ * the session does not track, a key the shape does not bound or a value it
770
+ * cannot be, a `min` above the `max` once merged, an owner that is not this
771
+ * session's. Anchored like a value โ€” the owner's open anchor, or `worldRow`
772
+ * for a seat or the world โ€” so a retake or a swipe takes it back.
773
+ *
774
+ * `main` is `{ configId, owner, slot, before, config }`: the row, and the
775
+ * configuration in force before and after it.
776
+ * @experimental
777
+ */
778
+ export const setStatConfig = pin(describeOutletDefinition({
779
+ id: 'core:outlet/set-stat-config@1',
780
+ i18n: { name: { en: 'Configure a stat' } },
781
+ effects: 'write',
782
+ reviewDefault: 'off',
783
+ review: { fields: ['config'] },
784
+ timeoutMs: 2000,
785
+ ports: {
786
+ in: {
787
+ /** Whose: a participant reference, `world`, or `location:<id>` (a place's lore entry). */
788
+ owner: S.json,
789
+ /** The attribute slot: `core:slot/hp@1`. */
790
+ slot: S.text,
791
+ /**
792
+ * The deviations: `{ max: 26 }`. ๐Ÿšง One universal key
793
+ * (2026-10-17): `lock` โ€” `none` ยท `people` (no hand edit; the
794
+ * dice and the session's owner still write) ยท `all` (nothing
795
+ * writes until unlocked). The host refuses a locked write with
796
+ * its own sentence; widgets draw the slot without edit controls.
797
+ */
798
+ config: S.json,
799
+ /** The row a seat's or the world's configuration is filed at โ€” `set-state@1`'s `worldRow`. Optional. */
800
+ worldRow: S.writeResult,
801
+ },
802
+ out: { main: S.json },
478
803
  },
479
804
  }));
480
805
  /**
@@ -507,6 +832,88 @@ export const setAnnexField = pin(describeOutletDefinition({
507
832
  out: { main: S.writeResult, annex: S.json },
508
833
  },
509
834
  }));
835
+ /**
836
+ * ๐Ÿšง Write one owner's document into the **lorebook annex** (M0,
837
+ * SHAPES L9): the `set-session-annex` write at book scope. A write from a
838
+ * session is a change โ€” anchored to the turn, filed as a `lore_imprints` row
839
+ * (subject `annex`), retractable, settled with the stretch โ€” routed like
840
+ * every lore write; a write from a book-level run is lasting at once.
841
+ * @experimental
842
+ */
843
+ export const setLorebookAnnex = pin(describeOutletDefinition({
844
+ id: 'core:outlet/set-lorebook-annex@1',
845
+ i18n: { name: { en: 'Set lorebook annex' } },
846
+ effects: 'write',
847
+ /** The lorebook twin of `annex-changed`, as `set-session-annex` causes that one. */
848
+ causesEvent: 'core:event/lorebook-annex-changed@1',
849
+ reviewDefault: 'off',
850
+ review: { fields: ['value'] },
851
+ timeoutMs: 2000,
852
+ ports: {
853
+ in: {
854
+ value: S.json,
855
+ /**
856
+ * ๐Ÿšง Compare-and-set (M2b), as `set-session-annex`'s `base`: the
857
+ * owner's annex document version this run read โ€” `lorebook-annex`'s
858
+ * `version`. Another stored version writes nothing (`written: false`,
859
+ * `stale: true`, a receipt note), and `annex` and `version` carry the
860
+ * document as it stands now. Absent, the last write wins.
861
+ */
862
+ base: S.json,
863
+ },
864
+ out: {
865
+ main: S.writeResult,
866
+ /** The owner's document as written โ€” or, when `base` was stale, as it stands now. */
867
+ annex: S.json,
868
+ /** ๐Ÿšง (M2b) The owner's annex document version on the book after this write (unchanged when nothing was written). */
869
+ version: S.json,
870
+ },
871
+ },
872
+ }));
873
+ /**
874
+ * ๐Ÿšง Set one annex field declared `annexField({ scope: 'lorebook' })`
875
+ * (M0, SHAPES L9): the `set-annex-field` write at book scope, under the
876
+ * same rules as {@link setLorebookAnnex}.
877
+ * @experimental
878
+ */
879
+ export const setLorebookAnnexField = pin(describeOutletDefinition({
880
+ id: 'core:outlet/set-lorebook-annex-field@1',
881
+ i18n: { name: { en: 'Set lorebook annex field' } },
882
+ effects: 'write',
883
+ causesEvent: 'core:event/lorebook-annex-changed@1',
884
+ reviewDefault: 'off',
885
+ /** The payload was judged at the door and is judged again here โ€” approve or refuse, never rewrite. */
886
+ review: { fields: [] },
887
+ timeoutMs: 2000,
888
+ ports: {
889
+ in: { payload: S.json },
890
+ out: { main: S.writeResult },
891
+ },
892
+ }));
893
+ /**
894
+ * ๐Ÿšง Move the session's rules to another version of their ruleset (M0,
895
+ * SHAPES L4 Conversion): built-in and owner-only, also the socket
896
+ * `sessions:convertRuleset`. Per session it re-keys renamed slots, retracts
897
+ * removed ones and inserts defaults for added ones โ€” each an anchored change,
898
+ * retractable โ€” then sets the session's ruleset version to `to`.
899
+ * @experimental
900
+ */
901
+ export const convertRuleset = pin(describeOutletDefinition({
902
+ id: 'core:outlet/convert-ruleset@1',
903
+ i18n: { name: { en: 'Convert ruleset' } },
904
+ effects: 'write',
905
+ causesEvent: 'core:event/ruleset-converted@1',
906
+ /** The version is the ruleset's own, and the slots its upgrades name: approve or refuse, never rewrite. */
907
+ review: { fields: [] },
908
+ timeoutMs: 5000,
909
+ ports: {
910
+ in: {
911
+ /** The ruleset version to move to (semver). */
912
+ to: S.text,
913
+ },
914
+ out: { main: S.writeResult },
915
+ },
916
+ }));
510
917
  /**
511
918
  * Record an event your package declared: something happened, and
512
919
  * pipelines bound to it โ€” plugin listeners, and widgets when the event is
@@ -817,7 +1224,6 @@ export const offerMedia = pin(describeOutletDefinition({
817
1224
  },
818
1225
  },
819
1226
  }));
820
- // โ”€โ”€ The story clock (DESIGN-story-time P3, 2026-09-28) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
821
1227
  /**
822
1228
  * Move a session's **story clock** โ€” the session's own story now โ€” by `by` of
823
1229
  * `unit`, through its lorebook's calendar (`advanceStoryTime`): carried by a
@@ -888,6 +1294,16 @@ export const advanceStoryClock = pin(describeOutletDefinition({
888
1294
  by: S.json,
889
1295
  /** One of the units; wins over the `unit` parameter when wired. */
890
1296
  unit: S.text,
1297
+ /**
1298
+ * ๐Ÿšง **Where the clock moves to** (M0, SHAPES L3), a
1299
+ * `ClockTargetV1` โ€” the second input shape: an absolute moment
1300
+ * within the day ("sleep until 07:00") instead of a relative
1301
+ * `by`. Exactly one of the `by` and `to` in-ports may be wired;
1302
+ * both is refused with a sentence naming both. Wired, the `by`
1303
+ * and `unit` parameters are not read. One ledger move either
1304
+ * way, retractable as every move is.
1305
+ */
1306
+ to: S.clockTarget,
891
1307
  /**
892
1308
  * ๐Ÿšง **Why the clock moves** (live scenes ยง15 G4, 2026-10-13),
893
1309
  * a literal: `'action'` โ€” a person's press (*Time passesโ€ฆ*);
@@ -933,6 +1349,12 @@ export const advanceStoryClock = pin(describeOutletDefinition({
933
1349
  skipped: S.text,
934
1350
  /** It spelled through the book's calendar. */
935
1351
  label: S.text,
1352
+ /**
1353
+ * ๐Ÿšง The minutes a `to` move moved the clock (M0, T1) โ€” 0
1354
+ * when it stood where it was or was refused under `skip`, with
1355
+ * no ledger row. Absent on a `by` move.
1356
+ */
1357
+ moved: S.json,
936
1358
  },
937
1359
  },
938
1360
  }));
@@ -999,7 +1421,15 @@ export const answerForm = pin(describeOutletDefinition({
999
1421
  },
1000
1422
  },
1001
1423
  }));
1002
- /** The audio twin of `attach-image` โ€” same `target`, same commit, bound the same day. @experimental */
1424
+ /**
1425
+ * The audio twin of `attach-image` โ€” same `target`, same commit, bound the same day.
1426
+ *
1427
+ * ๐Ÿšง Speech (seam S3, 2026-10-28): `meta` is the `SpokenMeta` record
1428
+ * `core:oracle/speak@1` publishes, kept in the line's metadata for the swipe
1429
+ * (`spoken`) beside the audio part; `replace` swaps the line's earlier spoken
1430
+ * audio rather than adding a second part โ€” what re-speaking a line does.
1431
+ * @experimental
1432
+ */
1003
1433
  export const attachAudio = pin(describeOutletDefinition({
1004
1434
  id: 'core:outlet/attach-audio@1',
1005
1435
  effects: 'write',
@@ -1007,7 +1437,31 @@ export const attachAudio = pin(describeOutletDefinition({
1007
1437
  review: { fields: [] },
1008
1438
  timeoutMs: 5000,
1009
1439
  causesEvent: 'core:event/message-updated@1',
1010
- ports: { in: { target: S.rowIds, audio: S.audio }, out: { main: S.writeResult } },
1440
+ slots: {
1441
+ params: {
1442
+ kind: 'parameters',
1443
+ facet: 'behavior',
1444
+ schema: {
1445
+ replace: {
1446
+ type: 'boolean',
1447
+ default: false,
1448
+ label: { en: 'Replace earlier speech' },
1449
+ description: {
1450
+ en: "Swap the line's spoken audio for this one instead of adding a second part.",
1451
+ },
1452
+ },
1453
+ },
1454
+ },
1455
+ },
1456
+ ports: {
1457
+ in: {
1458
+ target: S.rowIds,
1459
+ audio: S.audio,
1460
+ /** ๐Ÿšง `SpokenMeta` โ€” absent writes the audio part alone. */
1461
+ meta: S.spokenMeta,
1462
+ },
1463
+ out: { main: S.writeResult },
1464
+ },
1011
1465
  }));
1012
1466
  // โ”€โ”€ Summarization โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
1013
1467
  /**
@@ -1055,6 +1509,20 @@ export const attachAudio = pin(describeOutletDefinition({
1055
1509
  * says more (2026-09-29). Absent on nearly every write, and an
1056
1510
  * empty list is the same as none. A link the list states twice, or one the
1057
1511
  * session already reads, is written once: see `linkLoreEntries` on idempotence.
1512
+ *
1513
+ * ## `fields` โ€” the entry type's own half (๐Ÿšง 2026-10-21, Lair rewrite D2)
1514
+ *
1515
+ * The typed fields the entry type declares (`EntryShape.fields` โ€” a place's
1516
+ * category; a derived entry type's piece fields, a weapon's damage), as one
1517
+ * object keyed by field. Its title-role field is not among them: that is the
1518
+ * `name` port. Checked against the type named by `entryType` with the SDK's
1519
+ * one checker (`fieldsFindings`) at the review gate and again at the commit:
1520
+ * a misfit โ€” an undeclared key, a value of the wrong kind, a required field
1521
+ * missing โ€” is refused with the field named, never trimmed to fit. A pipeline
1522
+ * asks a model for them with `jsonSchemaOf(entryType)` into
1523
+ * `generate-json@1`'s `schema`, so what is asked and what is checked are one
1524
+ * declaration. Absent: the type's declared defaults, as before. `@1` evolves
1525
+ * in place (pre-release).
1058
1526
  * @internal
1059
1527
  */
1060
1528
  export const createLoreEntry = pin(describeOutletDefinition({
@@ -1062,13 +1530,15 @@ export const createLoreEntry = pin(describeOutletDefinition({
1062
1530
  i18n: { name: { en: 'Save the lore entry' } },
1063
1531
  effects: 'write',
1064
1532
  /**
1065
- * Both the name and the content may be edited before the entry lands
1066
- *. `links` is deliberately not among them: the
1533
+ * The name, the content and (๐Ÿšง D2) the typed fields may be edited
1534
+ * before the entry lands โ€” the fields are values a reader can retype
1535
+ * (a room's terrain), and an edit that no longer fits the type is
1536
+ * refused at the gate. `links` is deliberately not among them: the
1067
1537
  * gate's form edits values a reader can retype, and a list of
1068
1538
  * references is not one โ€” a reviewer who disagrees with a room's exits
1069
1539
  * refuses the write.
1070
1540
  */
1071
- review: { fields: ['name', 'content'] },
1541
+ review: { fields: ['name', 'content', 'fields'] },
1072
1542
  timeoutMs: 10000,
1073
1543
  causesEvent: 'core:event/lore-entry-created@1',
1074
1544
  slots: {
@@ -1094,6 +1564,79 @@ export const createLoreEntry = pin(describeOutletDefinition({
1094
1564
  * note above on the live row. Names, entry ids, or `LoreLinkInput`s.
1095
1565
  */
1096
1566
  links: S.json,
1567
+ /**
1568
+ * ๐Ÿšง The entry type's typed fields, one object keyed by field
1569
+ * (the title's field excepted) โ€” checked whole against the
1570
+ * type (`fieldsFindings`); see the note above.
1571
+ */
1572
+ fields: S.json,
1573
+ /**
1574
+ * ๐Ÿšง The messages this write was written from. Pass it when the write is a
1575
+ * summary of the story; leave it off when it is a change in it (pass 6). Present, the write is committed: the
1576
+ * session's settle line moves to the newest of them.
1577
+ */
1578
+ sources: S.loreSources,
1579
+ /** ๐Ÿšง A `LoreMatch` โ€” how to find the entry this would otherwise create. */
1580
+ match: S.json,
1581
+ /**
1582
+ * ๐Ÿšง The cast member this entry is filed under โ€” a `character:<id>` reference, resolved to that
1583
+ * character's cast member in the book the entry lands in (the entry type's `anchor` role).
1584
+ */
1585
+ bind: S.participantRef,
1586
+ },
1587
+ out: { main: S.writeResult, entryId: S.writeResult },
1588
+ },
1589
+ }));
1590
+ /**
1591
+ * ๐Ÿšง Change an entry of the session's lorebook โ€” its name, its content, its
1592
+ * typed fields (2026-10-21, Lair rewrite D2: *File as a room* on a room that
1593
+ * already exists, a draft's fields laid onto an entry a person wrote).
1594
+ *
1595
+ * `entry` names it as `link-lore-entries@1`'s `to` does: an entry id, the
1596
+ * write result of the write that made it, or a **name** resolved within the
1597
+ * session's own lorebook (case and surrounding space ignored; a name nothing
1598
+ * answers to, or two entries answer to, is refused with a sentence).
1599
+ *
1600
+ * Every in-port but `entry` is optional, and an absent one leaves that part
1601
+ * as it is. `fields` is a **patch**: the keys it names are laid over the
1602
+ * entry's stored fields and the rest kept, `null` clears one; it is checked
1603
+ * against the entry's own type as a patch (`fieldsFindings(type, fields,
1604
+ * { partial: true })`) at the review gate and at the commit, and a misfit is
1605
+ * refused with the field named. The type itself never changes โ€” a room stays
1606
+ * a place.
1607
+ *
1608
+ * How the change lands is the host's: on the session's line, the way the
1609
+ * lorebook's own editor writes an edit there (an amendment where the line
1610
+ * amends). โš  It causes no event yet (๐Ÿšง): `lore-entry-created` means a new
1611
+ * row, and a subscriber that needs edits waits for one of its own.
1612
+ * @internal
1613
+ */
1614
+ export const updateLoreEntry = pin(describeOutletDefinition({
1615
+ id: 'core:outlet/update-lore-entry@1',
1616
+ i18n: { name: { en: 'Change the lore entry' } },
1617
+ effects: 'write',
1618
+ /**
1619
+ * What the change says may be retyped; which entry it changes may not
1620
+ * โ€” that is the run's identity, the rule `delete-message@1` states.
1621
+ */
1622
+ review: { fields: ['name', 'content', 'fields'] },
1623
+ timeoutMs: 10000,
1624
+ ports: {
1625
+ in: {
1626
+ /** The entry to change: an id, a write result, or a name in the session's lorebook. */
1627
+ entry: S.json,
1628
+ /** Its new name. Absent: kept. */
1629
+ name: S.text,
1630
+ /** Its new content. Absent: kept. */
1631
+ content: S.text,
1632
+ /** Typed fields laid over the stored ones, key by key; `null` clears one. Absent: kept. */
1633
+ fields: S.json,
1634
+ /**
1635
+ * ๐Ÿšง The messages this write was written from. Pass it when the write is a
1636
+ * summary of the story; leave it off when it is a change in it (pass 6). Present, the write is committed: the
1637
+ * session's settle line moves to the newest of them.
1638
+ */
1639
+ sources: S.loreSources,
1097
1640
  },
1098
1641
  out: { main: S.writeResult, entryId: S.writeResult },
1099
1642
  },
@@ -1231,6 +1774,12 @@ export const linkLoreEntries = pin(describeOutletDefinition({
1231
1774
  name: S.text,
1232
1775
  /** Its description. Optional. */
1233
1776
  description: S.text,
1777
+ /**
1778
+ * ๐Ÿšง The messages this write was written from. Pass it when the write is a
1779
+ * summary of the story; leave it off when it is a change in it (pass 6). Present, the write is committed: the
1780
+ * session's settle line moves to the newest of them.
1781
+ */
1782
+ sources: S.loreSources,
1234
1783
  },
1235
1784
  out: { main: S.writeResult, linkId: S.writeResult },
1236
1785
  },
@@ -1254,8 +1803,115 @@ export const graphProposal = pin(describeOutletDefinition({
1254
1803
  timeoutMs: 10000,
1255
1804
  causesEvent: 'core:event/graph-proposal-created@1',
1256
1805
  ports: {
1257
- in: { proposal: S.json },
1806
+ in: {
1807
+ proposal: S.json,
1808
+ /**
1809
+ * ๐Ÿšง The messages this write was written from. Pass it when the write is a
1810
+ * summary of the story; leave it off when it is a change in it (pass 6). Present, the write is committed: the
1811
+ * session's settle line moves to the newest of them.
1812
+ */
1813
+ sources: S.loreSources,
1814
+ },
1258
1815
  out: { main: S.writeResult, proposalId: S.writeResult },
1259
1816
  },
1260
1817
  }));
1818
+ /**
1819
+ * Make a character: write one character card into the acting person's library.
1820
+ *
1821
+ * Takes `card` โ€” a V3 card `{ spec: 'chara_card_v3', data }`, its `data`, or a
1822
+ * plain `{ name, description, personality?, scenario?, first_mes?,
1823
+ * mes_example?, creator_notes?, tags? }`, exactly what the app's card reader
1824
+ * takes. Writes one character row (or, under the person's library write mode,
1825
+ * a proposal for it); `characterId` is the new row's id, or absent while the
1826
+ * write waits.
1827
+ *
1828
+ * โš  The app, not the pipeline, judges the write: it finds the person acting
1829
+ * for the run, and their **library write mode** decides whether the card lands
1830
+ * now (Full), waits for them to accept it in the session (Review, the
1831
+ * default), or is refused (Off). A genre must also declare
1832
+ * `writes.library.characters`, or the host refuses the write.
1833
+ * @internal
1834
+ */
1835
+ export const createCharacter = pin(describeOutletDefinition({
1836
+ id: 'core:outlet/create-character@1',
1837
+ i18n: { name: { en: 'Make a character' } },
1838
+ effects: 'write',
1839
+ /** R-15: the card a person may retype before it lands. */
1840
+ review: { fields: ['card'] },
1841
+ timeoutMs: 10000,
1842
+ ports: {
1843
+ in: { card: S.json },
1844
+ out: { main: S.writeResult, characterId: S.writeResult },
1845
+ },
1846
+ }));
1847
+ /**
1848
+ * Change a character: edit the text fields of a character the acting person
1849
+ * may write to.
1850
+ *
1851
+ * Takes `characterId` and `changes` โ€” an object of the card's text fields
1852
+ * (name, description, personality, scenario, first_mes, mes_example). Writes
1853
+ * those fields on that character, and nothing else; the fields it replaced are
1854
+ * kept so Back can restore them. The app judges the person (write rights on
1855
+ * the character) and their library write mode (Full, Review or Off); a genre
1856
+ * must declare `writes.library.characters`.
1857
+ * @internal
1858
+ */
1859
+ export const updateCharacter = pin(describeOutletDefinition({
1860
+ id: 'core:outlet/update-character@1',
1861
+ i18n: { name: { en: 'Change a character' } },
1862
+ effects: 'write',
1863
+ /** R-15: the change a person may retype before it lands. */
1864
+ review: { fields: ['changes'] },
1865
+ timeoutMs: 10000,
1866
+ ports: {
1867
+ in: { characterId: S.json, changes: S.json },
1868
+ out: { main: S.writeResult, characterId: S.writeResult },
1869
+ },
1870
+ }));
1871
+ /**
1872
+ * Make a lorebook: write one lorebook into the acting person's library.
1873
+ *
1874
+ * Takes `lorebook` โ€” a lorebook document as Lorebooks โ€บ Import reads it (a
1875
+ * SillyTavern world-info JSON is the safe shape: `{ name, description?,
1876
+ * entries }`). Writes a lorebook and its entries (or, under the person's
1877
+ * library write mode, a proposal for them); `lorebookId` is the new book's id.
1878
+ * The app judges the person and their library write mode (Full, Review or
1879
+ * Off); a genre must declare `writes.library.lorebooks`.
1880
+ * @internal
1881
+ */
1882
+ export const createLorebook = pin(describeOutletDefinition({
1883
+ id: 'core:outlet/create-lorebook@1',
1884
+ i18n: { name: { en: 'Make a lorebook' } },
1885
+ effects: 'write',
1886
+ /** R-15: the book a person may retype before it lands. */
1887
+ review: { fields: ['lorebook'] },
1888
+ timeoutMs: 10000,
1889
+ ports: {
1890
+ in: { lorebook: S.json },
1891
+ out: { main: S.writeResult, lorebookId: S.writeResult },
1892
+ },
1893
+ }));
1894
+ /**
1895
+ * Read a lorebook into a session: attach an existing lorebook to a session.
1896
+ *
1897
+ * Takes `lorebookId` and, optionally, `sessionId` (absent: the run's own
1898
+ * session). Writes the session's lorebook; what it replaced is kept so Back
1899
+ * can restore it. The app judges the person (read rights on the book and write
1900
+ * rights on the session) and their library write mode (Full, Review or Off).
1901
+ * A genre must declare `writes.library.lorebooks`, and
1902
+ * `writes.library.sessions` to name a session other than the run's.
1903
+ * @internal
1904
+ */
1905
+ export const attachLorebook = pin(describeOutletDefinition({
1906
+ id: 'core:outlet/attach-lorebook@1',
1907
+ i18n: { name: { en: 'Read a lorebook into a session' } },
1908
+ effects: 'write',
1909
+ /** R-15: a reference, not a value to retype: a reviewer who disagrees refuses the write. */
1910
+ review: { fields: [] },
1911
+ timeoutMs: 10000,
1912
+ ports: {
1913
+ in: { lorebookId: S.json, sessionId: S.json },
1914
+ out: { main: S.writeResult },
1915
+ },
1916
+ }));
1261
1917
  //# sourceMappingURL=outlets.js.map