@serene-pub/core-catalog 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/README.md +1 -1
- package/components/genres/story/authors-note/AuthorsNote.svelte +2 -1
- package/components/genres/story/authors-note/AuthorsNoteWidget.svelte +177 -58
- package/components/shared/WidgetBoundary.svelte +37 -0
- package/components/shared/actions/Actions.svelte +2 -1
- package/components/shared/actions/ActionsWidget.svelte +31 -38
- package/components/shared/album/Album.svelte +2 -1
- package/components/shared/album/AlbumWidget.svelte +1 -7
- package/components/shared/annex/Annex.svelte +2 -1
- package/components/shared/annex/AnnexWidget.svelte +1 -1
- package/components/shared/attendance/Attendance.svelte +2 -1
- package/components/shared/attendance/AttendanceWidget.svelte +5 -8
- package/components/shared/backdrop/Backdrop.svelte +2 -1
- package/components/shared/backdrop/BackdropWidget.svelte +28 -22
- package/components/shared/chronicle/Chronicle.svelte +2 -1
- package/components/shared/chronicle/ChronicleWidget.svelte +211 -99
- package/components/shared/composer/Composer.svelte +25 -0
- package/components/shared/composer/ComposerWidget.svelte +146 -0
- package/components/shared/composer/composer.ts +10 -0
- package/components/shared/composer/settings.ts +59 -0
- package/components/shared/composer/target.ts +79 -0
- package/components/shared/dialogue-box/DialogueBoxMount.svelte +25 -0
- package/components/shared/dialogue-box/DialogueBoxWidget.svelte +207 -0
- package/components/shared/dialogue-box/dialogue-box.ts +10 -0
- package/components/shared/dialogue-box/settings.ts +25 -0
- package/components/shared/lore-entries/LoreEntries.svelte +2 -1
- package/components/shared/lore-entries/LoreEntriesWidget.svelte +44 -41
- package/components/shared/messages/MessageBlocksView.svelte +1 -1
- package/components/shared/messages/MessageControls.svelte +23 -5
- package/components/shared/messages/Messages.svelte +2 -1
- package/components/shared/messages/MessagesWidget.svelte +82 -191
- package/components/shared/messages/NextCharacterBlock.svelte +35 -20
- package/components/shared/messages/SceneDivider.svelte +40 -14
- package/components/shared/messages/SessionComposer.svelte +178 -123
- package/components/shared/messages/SessionContainer.svelte +89 -38
- package/components/shared/messages/SessionMessage.svelte +157 -54
- package/components/shared/messages/SpokenLine.svelte +57 -16
- package/components/shared/messages/StateProposalList.svelte +30 -20
- package/components/shared/messages/TurnLine.svelte +258 -66
- package/components/shared/messages/conversation.svelte.ts +83 -5
- package/components/shared/messages/readingPace.ts +101 -0
- package/components/shared/messages/rowFacts.ts +44 -0
- package/components/shared/messages/sceneMarks.ts +54 -0
- package/components/shared/messages/spokenLine.ts +63 -14
- package/components/shared/places/Places.svelte +2 -1
- package/components/shared/places/PlacesWidget.svelte +42 -33
- package/components/shared/routine-log/RoutineLog.svelte +2 -1
- package/components/shared/routine-log/RoutineLogWidget.svelte +0 -4
- package/components/shared/routine-log/routineLog.ts +5 -21
- package/components/shared/scene-portraits/ScenePortraits.svelte +2 -1
- package/components/shared/scene-portraits/ScenePortraitsWidget.svelte +54 -32
- package/components/shared/session-runs/SessionRuns.svelte +26 -0
- package/components/shared/session-runs/SessionRunsWidget.svelte +270 -0
- package/components/shared/session-runs/session-runs.ts +11 -0
- package/components/shared/state/PieceCard.svelte +36 -25
- package/components/shared/state/SlotControl.svelte +18 -5
- package/components/shared/stats/Stats.svelte +2 -1
- package/components/shared/stats/StatsWidget.svelte +104 -72
- package/components/shared/turn-line/TurnLineMount.svelte +25 -0
- package/components/shared/turn-line/TurnLineWidget.svelte +25 -0
- package/components/shared/turn-line/settings.ts +31 -0
- package/components/shared/turn-line/turn-line.ts +10 -0
- package/components/shared/turn-order/TurnOrder.svelte +2 -1
- package/components/shared/turn-order/TurnOrderWidget.svelte +1 -6
- package/dist/components/actions.js +71 -88
- package/dist/components/actions.source.json +1 -1
- package/dist/components/album.js +39 -44
- package/dist/components/album.source.json +1 -1
- package/dist/components/annex.js +17 -8
- package/dist/components/annex.source.json +1 -1
- package/dist/components/attendance.js +39 -48
- package/dist/components/attendance.source.json +1 -1
- package/dist/components/authors-note.js +329 -162
- package/dist/components/authors-note.source.json +1 -1
- package/dist/components/backdrop.js +52 -55
- package/dist/components/backdrop.source.json +1 -1
- package/dist/components/chronicle.js +798 -559
- package/dist/components/chronicle.source.json +1 -1
- package/dist/components/composer.js +1639 -0
- package/dist/components/composer.source.json +1 -0
- package/dist/components/core-ui.json +1 -1
- package/dist/components/dialogue-box.js +373 -0
- package/dist/components/dialogue-box.source.json +1 -0
- package/dist/components/lore-entries.js +134 -122
- package/dist/components/lore-entries.source.json +1 -1
- package/dist/components/messages.js +1517 -8930
- package/dist/components/messages.source.json +1 -1
- package/dist/components/places.js +267 -244
- package/dist/components/places.source.json +1 -1
- package/dist/components/routine-log.js +35 -51
- package/dist/components/routine-log.source.json +1 -1
- package/dist/components/scene-portraits.js +118 -59
- package/dist/components/scene-portraits.source.json +1 -1
- package/dist/components/session-runs.js +488 -0
- package/dist/components/session-runs.source.json +1 -0
- package/dist/components/{shared-7VDIXYAL.js → shared-47J4TNSF.js} +1 -1
- package/dist/components/{shared-W3XS5FEL.js → shared-5E4RQYRX.js} +3 -2
- package/dist/components/{shared-YDS7HYL6.js → shared-EFMMT76D.js} +57 -4
- package/dist/components/{shared-BIWKZFUU.js → shared-FOVKPMSK.js} +3 -3
- package/dist/components/{shared-JPG5DQO7.js → shared-HEAKNNZB.js} +92 -17
- package/dist/components/shared-JXP6SHKF.js +159 -0
- package/dist/components/{shared-XBDUENRA.js → shared-JXYPKSTQ.js} +1 -1
- package/dist/components/shared-KJIOSSE3.js +257 -0
- package/dist/components/{shared-WV3QTKZT.js → shared-KLURQFWI.js} +13 -9
- package/dist/components/shared-MHCNUDUT.js +1680 -0
- package/dist/components/{shared-QXF5CJVN.js → shared-NICRJ4Z2.js} +1 -1
- package/dist/components/{shared-BBF64YGL.js → shared-W2BBJCNE.js} +22 -16
- package/dist/components/shared-YYYXFDZU.js +4354 -0
- package/dist/components/stats.js +828 -678
- package/dist/components/stats.source.json +1 -1
- package/dist/components/turn-line.js +856 -0
- package/dist/components/turn-line.source.json +1 -0
- package/dist/components/turn-order.js +62 -67
- package/dist/components/turn-order.source.json +1 -1
- package/dist/factories/answerForm.d.ts +6 -0
- package/dist/factories/answerForm.js +104 -96
- package/dist/factories/turnOrder.d.ts +98 -105
- package/dist/factories/turnOrder.js +120 -136
- package/dist/functions/pieces.js +1 -0
- package/dist/functions/time.js +2 -0
- package/dist/genres/chat/create.js +2 -0
- package/dist/genres/chat/memory.js +64 -43
- package/dist/genres/chat/respond.d.ts +7 -6
- package/dist/genres/chat/respond.js +13 -4
- package/dist/genres/chat/turnOrder.d.ts +2 -2
- package/dist/genres/chat/turnOrder.js +28 -12
- package/dist/genres/defaults.d.ts +28 -6
- package/dist/genres/defaults.js +84 -26
- package/dist/genres/dungeon-crawler/calls.d.ts +3 -1
- package/dist/genres/dungeon-crawler/calls.js +5 -0
- package/dist/genres/dungeon-crawler/create.d.ts +9 -6
- package/dist/genres/dungeon-crawler/create.js +18 -8
- package/dist/genres/dungeon-crawler/death.d.ts +13 -6
- package/dist/genres/dungeon-crawler/death.js +26 -12
- package/dist/genres/dungeon-crawler/index.d.ts +1 -0
- package/dist/genres/dungeon-crawler/index.js +1 -0
- package/dist/genres/dungeon-crawler/journal.d.ts +1 -1
- package/dist/genres/dungeon-crawler/journal.js +1 -1
- package/dist/genres/dungeon-crawler/lore.d.ts +13 -12
- package/dist/genres/dungeon-crawler/lore.js +16 -25
- package/dist/genres/dungeon-crawler/names.d.ts +10 -3
- package/dist/genres/dungeon-crawler/names.js +10 -3
- package/dist/genres/dungeon-crawler/preamble.d.ts +5 -4
- package/dist/genres/dungeon-crawler/preamble.js +75 -33
- package/dist/genres/dungeon-crawler/respond.js +4 -2
- package/dist/genres/dungeon-crawler/rest.d.ts +8 -7
- package/dist/genres/dungeon-crawler/rest.js +39 -15
- package/dist/genres/dungeon-crawler/reveal.js +2 -2
- package/dist/genres/dungeon-crawler/roundScript.d.ts +2 -1
- package/dist/genres/dungeon-crawler/roundScript.js +23 -5
- package/dist/genres/dungeon-crawler/scripts.js +4 -5
- package/dist/genres/dungeon-crawler/shape.d.ts +16 -0
- package/dist/genres/dungeon-crawler/shape.js +5 -1
- package/dist/genres/dungeon-crawler/sheet.d.ts +20 -20
- package/dist/genres/dungeon-crawler/story.d.ts +27 -16
- package/dist/genres/dungeon-crawler/story.js +175 -46
- package/dist/genres/dungeon-crawler/storyScripts.d.ts +2 -2
- package/dist/genres/dungeon-crawler/storyScripts.js +109 -14
- package/dist/genres/dungeon-crawler/summarizeScene.d.ts +13 -0
- package/dist/genres/dungeon-crawler/summarizeScene.js +21 -0
- package/dist/genres/dungeon-crawler/turnOrder.d.ts +8 -9
- package/dist/genres/dungeon-crawler/turnOrder.js +33 -23
- package/dist/genres/guide/create.js +2 -0
- package/dist/genres/guide/turnOrder.d.ts +3 -3
- package/dist/genres/guide/turnOrder.js +29 -13
- package/dist/genres/lair/answerForm.js +4 -1
- package/dist/genres/lair/buildRoom.js +4 -3
- package/dist/genres/lair/castellanAction.js +160 -154
- package/dist/genres/lair/create.js +2 -0
- package/dist/genres/lair/fileCurrentRoom.js +13 -10
- package/dist/genres/lair/fileRoom.js +4 -3
- package/dist/genres/lair/keeper.js +6 -2
- package/dist/genres/lair/names.d.ts +2 -0
- package/dist/genres/lair/names.js +2 -0
- package/dist/genres/lair/reply.js +16 -6
- package/dist/genres/lair/roomAnswer.js +4 -3
- package/dist/genres/lair/scratchpad.js +9 -7
- package/dist/genres/lair/scripts.js +8 -6
- package/dist/genres/lair/turnOrder.d.ts +3 -2
- package/dist/genres/lair/turnOrder.js +45 -16
- package/dist/genres/story/ask.d.ts +4 -0
- package/dist/genres/story/ask.js +4 -0
- package/dist/genres/story/create.js +15 -0
- package/dist/genres/story/index.d.ts +1 -1
- package/dist/genres/story/index.js +1 -1
- package/dist/genres/story/narrate.js +8 -0
- package/dist/genres/story/narrateCharacter.js +8 -0
- package/dist/genres/story/reckon.d.ts +5 -19
- package/dist/genres/story/reckon.js +53 -40
- package/dist/genres/story/reckoning.js +3 -0
- package/dist/genres/story/respond.js +17 -28
- package/dist/genres/story/sweep.d.ts +1 -1
- package/dist/genres/story/sweep.js +1 -1
- package/dist/genres/story/turnOrder.d.ts +21 -3
- package/dist/genres/story/turnOrder.js +87 -21
- package/dist/index.d.ts +3 -0
- package/dist/index.js +23 -9
- package/dist/loadouts.d.ts +1 -0
- package/dist/loadouts.js +17 -1
- package/dist/primers/ninth-mile.d.ts +3 -4
- package/dist/registry/entries.d.ts +2 -0
- package/dist/registry/entries.js +18 -5
- package/dist/registry/genres.d.ts +146 -40
- package/dist/registry/genres.js +373 -101
- package/dist/registry/hostState.d.ts +1 -2
- package/dist/registry/hostState.js +2 -4
- package/dist/registry/layouts.d.ts +141 -111
- package/dist/registry/layouts.js +302 -141
- package/dist/registry/slots.d.ts +4 -3
- package/dist/registry/slots.js +4 -3
- package/dist/registry/widgets.d.ts +12 -2
- package/dist/registry/widgets.js +259 -106
- package/dist/rulesets/vis-itineris/ruleset.js +8 -5
- package/dist/rulesets/wherewithal/ruleset.js +2 -1
- package/dist/seed/presets.js +15 -9
- package/dist/seed/prompts.js +24 -5
- package/dist/seed/scripts.js +3 -0
- package/dist/shared/annexField.js +23 -3
- package/dist/shared/illustrateScene.d.ts +1 -0
- package/dist/shared/illustrateScene.js +29 -1
- package/dist/shared/lore.d.ts +13 -0
- package/dist/shared/lore.js +37 -1
- package/dist/shared/portrait.js +13 -4
- package/dist/shared/reckoning.d.ts +8 -2
- package/dist/shared/reckoning.js +47 -30
- package/dist/shared/roundTick.d.ts +20 -0
- package/dist/shared/roundTick.js +76 -0
- package/dist/shared/sceneBoundaries.d.ts +7 -0
- package/dist/shared/sceneBoundaries.js +62 -0
- package/dist/shared/sceneSummaries.d.ts +7 -0
- package/dist/shared/sceneSummaries.js +49 -0
- package/dist/shared/speakMessage.d.ts +9 -2
- package/dist/shared/speakMessage.js +32 -9
- package/dist/shared/speechFields.js +4 -0
- package/dist/shared/summarize/character.d.ts +1 -1
- package/dist/shared/summarize/history.d.ts +1 -1
- package/dist/shared/summarize/scene.d.ts +1 -1
- package/dist/shared/summarize/summarizeScene.js +1 -0
- package/dist/shared/summarize/summarizeSpec.d.ts +1 -1
- package/dist/shared/summarize/world.d.ts +1 -1
- package/dist/shared/ui/attendance/index.d.ts +3 -2
- package/dist/shared/ui/attendance/index.js +3 -7
- package/dist/shared/ui/chronicle/index.d.ts +24 -2
- package/dist/shared/ui/chronicle/index.js +58 -29
- package/dist/shared/ui/conversation/formAnswer.d.ts +16 -2
- package/dist/shared/ui/conversation/formAnswer.js +23 -9
- package/dist/shared/ui/conversation/index.d.ts +2 -0
- package/dist/shared/ui/conversation/index.js +4 -0
- package/dist/shared/ui/conversation/itemValues.d.ts +16 -3
- package/dist/shared/ui/conversation/itemValues.js +15 -5
- package/dist/shared/ui/conversation/messageVerbState.d.ts +17 -2
- package/dist/shared/ui/conversation/messageVerbState.js +5 -4
- package/dist/shared/ui/conversation/readingPlace.d.ts +40 -0
- package/dist/shared/ui/conversation/readingPlace.js +119 -0
- package/dist/shared/ui/conversation/rewindStrip.d.ts +13 -4
- package/dist/shared/ui/conversation/rewindStrip.js +29 -7
- package/dist/shared/ui/conversation/runsInProgress.d.ts +30 -0
- package/dist/shared/ui/conversation/runsInProgress.js +47 -0
- package/dist/shared/ui/conversation/storyDays.d.ts +7 -1
- package/dist/shared/ui/conversation/storyDays.js +8 -0
- package/dist/shared/ui/conversation/tableChannel.d.ts +8 -11
- package/dist/shared/ui/conversation/tableChannel.js +8 -9
- package/dist/shared/ui/places/index.d.ts +3 -2
- package/dist/shared/ui/places/index.js +4 -5
- package/dist/shared/ui/routine-log/index.d.ts +3 -0
- package/dist/shared/ui/routine-log/index.js +22 -0
- package/dist/shared/ui/scene-portraits/portraits.d.ts +50 -16
- package/dist/shared/ui/scene-portraits/portraits.js +84 -21
- package/dist/shared/ui/session-runs/index.d.ts +90 -0
- package/dist/shared/ui/session-runs/index.js +143 -0
- package/dist/shared/ui/session-state/stateView.d.ts +18 -5
- package/dist/shared/ui/session-state/stateView.js +29 -8
- package/dist/shared/ui/turn-order/index.d.ts +0 -9
- package/dist/shared/ui/turn-order/index.js +1 -2
- package/package.json +12 -8
- /package/dist/components/{shared-4ME6NFDK.js → shared-LUIF6DW7.js} +0 -0
|
@@ -4,58 +4,52 @@
|
|
|
4
4
|
*
|
|
5
5
|
* ## What this spec is
|
|
6
6
|
*
|
|
7
|
-
* One
|
|
7
|
+
* **One option among a genre's turn order options** on Turn order asked. It
|
|
8
8
|
* answers the question "whose turn is it" by **writing it down**:
|
|
9
9
|
*
|
|
10
10
|
* ```
|
|
11
11
|
* event ─► history ─► pool ─► mentioned ─► strategy ─► set-turn-order
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
|
-
* On
|
|
15
|
-
* — five reads and a `jsonb_set`.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* it (§4.6).
|
|
14
|
+
* On a rules strategy it calls no model, writes no message and costs no token
|
|
15
|
+
* — five reads and a `jsonb_set`. The model option (`modelTurnOrder`) seats an
|
|
16
|
+
* oracle in place of `strategy`, which asks a model once per recompute. What
|
|
17
|
+
* it produces is the session's stored turn order: the prepared turns, the
|
|
18
|
+
* candidates they were drawn from, and what the order answers. Every surface
|
|
19
|
+
* that asks "who is next" renders that state, and the reply run fires an
|
|
20
|
+
* entry out of it (§4.6).
|
|
22
21
|
*
|
|
23
|
-
* ##
|
|
22
|
+
* ## Options, not swaps
|
|
24
23
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
* document, an empty order is an answer, and the trigger decides nothing.
|
|
24
|
+
* A genre registers one pipeline per option on Turn order asked (R24); the
|
|
25
|
+
* session's choice picks which one runs, and the one marked `default` runs
|
|
26
|
+
* when it chose none. The causes an option answers are its registration's
|
|
27
|
+
* `when` over `event.asked`, never part of the document. A strategy is not
|
|
28
|
+
* swapped into a node: each option pins its own, and keeps its own pool and
|
|
29
|
+
* mention settings.
|
|
32
30
|
*
|
|
33
|
-
* ## One
|
|
31
|
+
* ## One document per option (R27)
|
|
34
32
|
*
|
|
35
|
-
* `turnOrderSpec()` below is the **public** builder
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* refuses a preset binding a spec whose
|
|
39
|
-
*
|
|
40
|
-
* `core:spec/turn-order-narrator`) are retired.
|
|
41
|
-
*
|
|
42
|
-
* A cast genre pins round robin; a planner genre (Adventure, the Lair)
|
|
43
|
-
* pins `turn-narrator`, so it gets exactly one narrator turn per send —
|
|
44
|
-
* Adventure's pool admits nobody; the Lair's admits its delvers, for the
|
|
45
|
-
* character turns a standing turn plan names. What a session may pick instead is
|
|
46
|
-
* the `strategy` node's `expose.swaps` (R28) — chat lists the other five
|
|
47
|
-
* core strategies; the rest list none, so they render no control.
|
|
33
|
+
* `turnOrderSpec()` below is the **public** builder, with one ready-made
|
|
34
|
+
* builder per core strategy: `roundRobinTurnOrder`, `byUserTurnOrder`,
|
|
35
|
+
* `randomTurnOrder`, `narratorTurnOrder` and `modelTurnOrder`. One document
|
|
36
|
+
* serves one genre — the preset check refuses a preset binding a spec whose
|
|
37
|
+
* lock names another genre (24 §4) — so an option's id is taken, never derived.
|
|
48
38
|
*/
|
|
49
|
-
import { compile, slot, spec
|
|
39
|
+
import { compile, coreEvents, slot, spec } from '@serene-pub/sdk';
|
|
50
40
|
import * as C from '@serene-pub/contracts';
|
|
41
|
+
import { applyWiring, jsonPart, wiring } from '../shared/calls.js';
|
|
51
42
|
import { chainIf } from '../shared/chains.js';
|
|
52
43
|
/**
|
|
53
44
|
* 🚧 `core:script/unprompted-modes` (2026-10-20): the genre's voices settings
|
|
54
45
|
* — its fields `sideCast` and `narratorInterjections`, read off the settings
|
|
55
46
|
* document a turn-order spec's inlet carries — as `core:task/turn-unprompted@1`
|
|
56
47
|
* reads them: `{ 'side-cast', 'narrator-interjections' }`, each `full` or
|
|
57
|
-
* `off
|
|
58
|
-
*
|
|
48
|
+
* `off`, plus `narrator-every` (1, 2 or 3; present only when the narrator is
|
|
49
|
+
* on). `sideCast` set `true` (or a stored `full` / `review`) is on.
|
|
50
|
+
* `narratorInterjections` reads `true`, `full`, `review` and `every-round` as
|
|
51
|
+
* every round, `every-2nd-round` as 2, `every-3rd-round` as 3; anything else
|
|
52
|
+
* is off (2026-11-04, playtest ruling item 7). Seeded by core (`CORE_SCRIPTS`); a turn-order spec with `unprompted` runs it.
|
|
59
53
|
* @experimental
|
|
60
54
|
*/
|
|
61
55
|
export const UNPROMPTED_MODES_SCRIPT = Object.freeze({
|
|
@@ -66,135 +60,100 @@ export const UNPROMPTED_MODES_SCRIPT = Object.freeze({
|
|
|
66
60
|
'var doc = value && typeof value === "object" ? value.session : null;',
|
|
67
61
|
'var f = doc && typeof doc === "object" && doc.fields && typeof doc.fields === "object" ? doc.fields : {};',
|
|
68
62
|
'function on(x) { return x === true || x === "full" || x === "review"; }',
|
|
69
|
-
'
|
|
63
|
+
'var n = f.narratorInterjections;',
|
|
64
|
+
'var every = n === "every-2nd-round" ? 2 : n === "every-3rd-round" ? 3 : n === true || n === "full" || n === "review" || n === "every-round" ? 1 : 0;',
|
|
65
|
+
'var out = { "side-cast": on(f.sideCast) ? "full" : "off", "narrator-interjections": every ? "full" : "off" };',
|
|
66
|
+
'if (every) out["narrator-every"] = every;',
|
|
67
|
+
'return out;',
|
|
70
68
|
].join('\n'),
|
|
71
69
|
varsIn: Object.freeze(['value']),
|
|
72
70
|
varsOut: Object.freeze(['value']),
|
|
73
71
|
});
|
|
74
72
|
/** @experimental */
|
|
75
73
|
export const TURN_ORDER_VERSION = '1.0.0';
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
* Every one of them can change who should speak next: a row landing, a row
|
|
80
|
-
* leaving, a seat being switched off, a setting moving, a branch being
|
|
81
|
-
* born. There is no gating (R1) — the list is what the genre declares and
|
|
82
|
-
* the inlet locks, and a genre that wants fewer binds fewer.
|
|
83
|
-
* @public
|
|
84
|
-
*/
|
|
85
|
-
export const TURN_ORDER_EVENTS = [
|
|
86
|
-
sessionEvents.messageCompleted,
|
|
87
|
-
sessionEvents.messageEdited,
|
|
88
|
-
sessionEvents.messageDeleted,
|
|
89
|
-
sessionEvents.messageHidden,
|
|
90
|
-
sessionEvents.memberAdded,
|
|
91
|
-
sessionEvents.memberRemoved,
|
|
92
|
-
sessionEvents.castChanged,
|
|
93
|
-
sessionEvents.sessionUpdated,
|
|
94
|
-
sessionEvents.sessionBranched,
|
|
95
|
-
];
|
|
96
|
-
/**
|
|
97
|
-
* The four events a planner genre recomputes on: a row landing, a row
|
|
98
|
-
* leaving (deleted, or hidden and shown again), and a branch's birth. Its
|
|
99
|
-
* order is one narrator entry or none — decided by whether the newest
|
|
100
|
-
* visible row is a person's — so exactly the events that change which row
|
|
101
|
-
* is newest move it. A cast change or a settings save cannot, and
|
|
102
|
-
* recomputing on them would be reads for a document that cannot differ.
|
|
103
|
-
*
|
|
104
|
-
* Delete and hide are here (lair pass F6/B9, 2026-09-27) so the order stays
|
|
105
|
-
* honest after a person removes the narrator's last reply: the line they
|
|
106
|
-
* wrote is newest again, and the narrator is ready. Both carry an `edit`
|
|
107
|
-
* cause, which auto-advance never fires on.
|
|
108
|
-
* @experimental
|
|
109
|
-
*/
|
|
110
|
-
export const TURN_ORDER_NARRATOR_EVENTS = [
|
|
111
|
-
sessionEvents.messageCompleted,
|
|
112
|
-
sessionEvents.messageDeleted,
|
|
113
|
-
sessionEvents.messageHidden,
|
|
114
|
-
sessionEvents.sessionBranched,
|
|
115
|
-
];
|
|
74
|
+
/** An oracle pin asks a model; a task pin is a rule. */
|
|
75
|
+
const isAdvise = (pin) => pin.descriptor.kind === 'oracle';
|
|
116
76
|
/** The node an advise pin seats, whatever its type version. */
|
|
117
77
|
const adviseNode = (advise, config) => ({ __node: true, descriptor: advise.descriptor, config });
|
|
118
78
|
/** The node a strategy pin seats, whatever its type version. */
|
|
119
79
|
const strategyNode = (strategy, config) => ({ __node: true, descriptor: strategy.descriptor, config });
|
|
120
80
|
/**
|
|
121
|
-
* **
|
|
122
|
-
* genre's come from this one call
|
|
81
|
+
* **One turn order option for one genre** (R27). Core's and every plugin
|
|
82
|
+
* genre's come from this one call, or from the ready-made builder of the
|
|
83
|
+
* strategy:
|
|
123
84
|
*
|
|
124
85
|
* ```ts
|
|
125
|
-
* const
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* swaps: [C.turnRandom, myStrategy],
|
|
86
|
+
* const tavernRoundRobin = roundRobinTurnOrder(tavern, { id: 'acme.rp:spec/tavern-turn-order' })
|
|
87
|
+
* register(coreEvents.turnOrderAsked, tavernRoundRobin, {
|
|
88
|
+
* label: 'Round robin',
|
|
89
|
+
* when: { on: 'event.asked', in: [sessionEvents.messageCompleted] },
|
|
90
|
+
* default: true,
|
|
131
91
|
* })
|
|
132
92
|
* ```
|
|
133
93
|
*
|
|
134
|
-
* `id` is taken, never derived (R26). `strategy` is the pin —
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
94
|
+
* `id` is taken, never derived (R26). `strategy` is the pin — a task pin is a
|
|
95
|
+
* rule (node key `strategy`), an oracle pin asks a model (node key `advise`).
|
|
96
|
+
* `pool` is the author preset on the pool node, the one road configuration
|
|
97
|
+
* takes: declared default, the author's preset over it, an administrator's
|
|
98
|
+
* deviation, a session's override last. A preset binds the result like any
|
|
99
|
+
* spec: `bindings: [tavernRoundRobin, …]`.
|
|
140
100
|
*
|
|
141
|
-
* With `
|
|
142
|
-
* settings (§4.11, R42): who is eligible
|
|
143
|
-
*
|
|
101
|
+
* With `sessionSettings`, `pool` and `mentioned` are marked for session
|
|
102
|
+
* settings (§4.11, R42): who is eligible and the mention rule's lookback.
|
|
103
|
+
* Without, the spec shows no turn control at all.
|
|
144
104
|
* @public
|
|
145
105
|
*/
|
|
146
106
|
export function turnOrderSpec(opts) {
|
|
147
|
-
const { id, genre,
|
|
148
|
-
|
|
149
|
-
// does not declare it could never take it (R26, M4 review).
|
|
150
|
-
if (advise && !genre.shape?.fields?.turnMode)
|
|
151
|
-
throw new Error(`turnOrderSpec('${id}'): advise needs genre '${genre.id}' to declare the field turnMode ` +
|
|
152
|
-
`(TURN_MODE_FIELD) — without it the model path can never fire`);
|
|
107
|
+
const { id, genre, strategy, pool = {}, historyChannel, scripts, unprompted, emptyCast, sessionSettings, outcomeNumbersFrom, version = TURN_ORDER_VERSION, } = opts;
|
|
108
|
+
const outcomes = wiring();
|
|
153
109
|
// The voices read the genre's two fields; a genre that does not declare
|
|
154
110
|
// them could never turn an unprompted voice on (R26).
|
|
155
111
|
const fields = (genre.shape?.fields ?? {});
|
|
156
112
|
if (unprompted && (!fields.sideCast || !fields.narratorInterjections))
|
|
157
113
|
throw new Error(`turnOrderSpec('${id}'): unprompted needs genre '${genre.id}' to declare the fields sideCast and ` +
|
|
158
114
|
`narratorInterjections (SIDE_CAST_FIELD, NARRATOR_INTERJECTIONS_FIELD) — the voices are its settings`);
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const strategyExpose = swaps.length ? { expose: { swaps } } : undefined;
|
|
115
|
+
const advise = isAdvise(strategy) ? strategy : undefined;
|
|
116
|
+
const rule = isAdvise(strategy) ? undefined : strategy;
|
|
117
|
+
// R42: with `sessionSettings`, who may be seated and the mention rule show as turn controls.
|
|
118
|
+
const controls = sessionSettings ? { expose: { session: true } } : undefined;
|
|
164
119
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
120
|
+
* The inlet suits Turn order asked (§4.1): one document per option. The
|
|
121
|
+
* visible history is what every rule reads to decide who has already
|
|
122
|
+
* spoken; the cast rides on the inlet in the settings document (§4.12),
|
|
123
|
+
* resolved after the write that caused this event. `pool` decides who may
|
|
124
|
+
* be seated at all; `mentioned` (R8) moves whoever was named to the front
|
|
125
|
+
* without changing who is in. `maintenance` because it is a background
|
|
126
|
+
* lane (ruled 2026-10-05): it runs after the turn, off its critical path,
|
|
127
|
+
* and carries no turn of its own.
|
|
173
128
|
*/
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
129
|
+
const opened = spec(id, { version, taxonomy: { role: 'maintenance' } }).inlet('event', C.sessionEvent.v1(), {
|
|
130
|
+
suits: [coreEvents.turnOrderAsked],
|
|
131
|
+
});
|
|
132
|
+
/** The genre's Show outcomes field, read off the settings document; with no `outcomeNumbersFrom` the step is not added. */
|
|
133
|
+
const shown = chainIf(!!outcomeNumbersFrom, opened, (o) => jsonPart(o, outcomes, 'showOutcomes', ($) => $.event.session, 'fields.' + outcomeNumbersFrom, 'Show outcomes'));
|
|
134
|
+
const upToMentioned = shown
|
|
135
|
+
.query('history', ($) => C.sessionHistory.v1({
|
|
136
|
+
scope: $.event.sessionScope,
|
|
137
|
+
...(outcomeNumbersFrom ? { outcomeNumbers: $.showOutcomes.main } : {}),
|
|
138
|
+
params: slot.params(),
|
|
139
|
+
}))
|
|
177
140
|
.task('pool', ($) => C.turnPool.v1({ cast: $.event.cast, messages: $.history.main, params: slot.params() }), controls)
|
|
178
141
|
.task('mentioned', ($) => C.turnMentioned.v1({ candidates: $.pool.main, messages: $.history.main, params: slot.params() }), controls);
|
|
179
|
-
/** The strategy — turns candidates into entries, never halts (an empty order is an answer). */
|
|
180
|
-
const strategyOf = ($) => strategyNode(strategy, { candidates: $.mentioned.main, messages: $.history.main });
|
|
181
142
|
/**
|
|
182
|
-
* The
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* `$.decide.order` with a model path, `$.strategy.order` without.
|
|
143
|
+
* The strategy — turns candidates into entries, never halts (an empty
|
|
144
|
+
* order is an answer). A rule is the task `strategy`; a model is the
|
|
145
|
+
* oracle `advise`, whose connection, sampling and prompts are session
|
|
146
|
+
* settings. Built as one or the other, typed as both: what follows reads
|
|
147
|
+
* `$.advise.order` for a model, `$.strategy.order` for a rule.
|
|
188
148
|
*/
|
|
189
|
-
const decided = chainIf(!advise, chainIf(!!advise, upToMentioned, (u) => u.
|
|
190
|
-
.when('model', { path: (v) => v.fields.turnMode, equals: 'model' }, (c) => c.oracle('advise', ($) => adviseNode(advise, {
|
|
149
|
+
const decided = chainIf(!advise, chainIf(!!advise, upToMentioned, (u) => u.oracle('advise', ($) => adviseNode(advise, {
|
|
191
150
|
candidates: $.mentioned.main,
|
|
192
151
|
messages: $.history.main,
|
|
193
152
|
connection: slot.connection(),
|
|
194
153
|
sampling: slot.sampling(),
|
|
195
154
|
prompts: slot.prompts(),
|
|
196
|
-
}), { expose: { session: true } }))
|
|
197
|
-
|
|
155
|
+
}), { expose: { session: true } })), (u) => u.task('strategy', ($) => strategyNode(rule, { candidates: $.mentioned.main, messages: $.history.main })));
|
|
156
|
+
const orderOf = ($) => (advise ? $.advise.order : $.strategy.order);
|
|
198
157
|
/**
|
|
199
158
|
* 🚧 The voices (lane 2; genre settings since 2026-10-20): the genre's
|
|
200
159
|
* two voices fields read off the settings document, then at most one
|
|
@@ -203,30 +162,47 @@ export function turnOrderSpec(opts) {
|
|
|
203
162
|
const voiced = chainIf(!!unprompted, decided, (d) => d
|
|
204
163
|
.task('voices', ($) => C.runScript.v1({ input: { session: $.event.session }, params: slot.params() }), { expose: { label: 'Who may speak up unprompted' } })
|
|
205
164
|
.task('unprompted', ($) => C.turnUnprompted.v1({
|
|
206
|
-
order:
|
|
165
|
+
order: orderOf($),
|
|
207
166
|
candidates: $.pool.main,
|
|
208
167
|
messages: $.history.main,
|
|
209
168
|
modes: $.voices.main,
|
|
210
169
|
params: slot.params(),
|
|
211
170
|
})));
|
|
212
|
-
|
|
171
|
+
const written = voiced
|
|
213
172
|
/**
|
|
214
173
|
* The one write path (§4.2). `basedOnAt` is the answered event's
|
|
215
174
|
* instant, so an order computed from an older event is dropped
|
|
216
175
|
* rather than landing on top of a newer one; `cause` travels on into
|
|
217
176
|
* `turn-order-changed`, which is how auto-advance can tell a
|
|
218
177
|
* person's send from a migration's backfill. `order` is the
|
|
219
|
-
* strategy's
|
|
220
|
-
* result port, whichever path fired (M4) — or, with unprompted
|
|
221
|
-
* turns, theirs over it.
|
|
178
|
+
* strategy's, or, with unprompted turns, theirs over it.
|
|
222
179
|
*/
|
|
223
180
|
.outlet('write', ($) => C.setTurnOrder.v1({
|
|
224
|
-
order: unprompted ? $.unprompted.order :
|
|
181
|
+
order: unprompted ? $.unprompted.order : orderOf($),
|
|
225
182
|
candidates: $.pool.main,
|
|
226
183
|
basedOnAt: $.event.at,
|
|
227
184
|
event: $.event.event,
|
|
228
185
|
cause: $.event.cause,
|
|
229
|
-
}))
|
|
186
|
+
}));
|
|
187
|
+
/**
|
|
188
|
+
* The composer gate (`emptyCast`): a side branch after the write, on the
|
|
189
|
+
* pool's candidates. Nobody: close (idempotent — the same closure written
|
|
190
|
+
* again — and only on a seat or session event, since no line can be sent
|
|
191
|
+
* while it stands). Somebody: open ONLY the closure this gate set, read off
|
|
192
|
+
* the settings document's `composerStates` (`main`, everyone, this reason),
|
|
193
|
+
* so a closure another pipeline put on `main` is never lifted here.
|
|
194
|
+
*
|
|
195
|
+
* ⚠ Every branch carries a node: a branch with none is not stored (a
|
|
196
|
+
* clause's chains are derived from its members on load), so an empty
|
|
197
|
+
* `otherwise` made the published document drift from this one.
|
|
198
|
+
*/
|
|
199
|
+
const OURS = { path: 'composerStates.main.*.reason', equals: emptyCast?.reason };
|
|
200
|
+
const gated = chainIf(!!emptyCast, written, (w) => w.junction('seats', { on: ($) => $.pool.main }, (j) => j
|
|
201
|
+
.when('nobody', { path: 'length', equals: 0 }, (n) => n.outlet('close', () => C.setComposerState.v1({ channel: 'main', open: false, reason: emptyCast.reason }), { expose: { label: 'Close the composer while nobody can reply' } }))
|
|
202
|
+
.otherwise('somebody', (o) => o.junction('closed', { on: ($) => $.event.session }, (c) => c.when('ours', OURS, (k) => k.outlet('open', () => C.setComposerState.v1({ channel: 'main', open: true }), {
|
|
203
|
+
expose: { label: 'Open the composer once someone can reply' },
|
|
204
|
+
}))))));
|
|
205
|
+
return compile(gated
|
|
230
206
|
// The author preset on `pool`, only when the genre pins anything:
|
|
231
207
|
// an empty value would be a preset that changes nothing.
|
|
232
208
|
.defaults((p) => {
|
|
@@ -234,10 +210,18 @@ export function turnOrderSpec(opts) {
|
|
|
234
210
|
const read = historyChannel ? pooled.params('history', { channel: historyChannel }) : pooled;
|
|
235
211
|
const narrated = unprompted?.narrate ? read.params('unprompted', { narrate: unprompted.narrate }) : read;
|
|
236
212
|
const voices = unprompted ? narrated.scripts('voices', [{ seedKey: UNPROMPTED_MODES_SCRIPT.seedKey }]) : narrated;
|
|
237
|
-
return scripts ? voices.scripts(
|
|
213
|
+
return applyWiring(scripts ? voices.scripts(advise ? 'advise' : 'strategy', scripts) : voices, outcomes);
|
|
238
214
|
})
|
|
239
215
|
.build());
|
|
240
216
|
}
|
|
241
|
-
/**
|
|
242
|
-
export const
|
|
217
|
+
/** **Round robin** option: each in the pool speaks in turn. @experimental */
|
|
218
|
+
export const roundRobinTurnOrder = (genre, opts) => turnOrderSpec({ ...opts, genre, strategy: C.turnRoundRobin });
|
|
219
|
+
/** **By user** option: round robin split by the person each seat belongs to. @experimental */
|
|
220
|
+
export const byUserTurnOrder = (genre, opts) => turnOrderSpec({ ...opts, genre, strategy: C.turnUserSplit });
|
|
221
|
+
/** **Random** option: the next speaker is drawn at random from the pool. @experimental */
|
|
222
|
+
export const randomTurnOrder = (genre, opts) => turnOrderSpec({ ...opts, genre, strategy: C.turnRandom });
|
|
223
|
+
/** **Narrator replies** option: one narrator turn per person's line. @experimental */
|
|
224
|
+
export const narratorTurnOrder = (genre, opts) => turnOrderSpec({ ...opts, genre, strategy: C.turnNarrator });
|
|
225
|
+
/** **Model** option: a model decides who speaks (R41); its node key is `advise`. @experimental */
|
|
226
|
+
export const modelTurnOrder = (genre, opts) => turnOrderSpec({ ...opts, genre, strategy: C.turnAdvise });
|
|
243
227
|
//# sourceMappingURL=turnOrder.js.map
|
package/dist/functions/pieces.js
CHANGED
|
@@ -86,6 +86,7 @@ export const obligationFunction = defineFunction("core:function/obligation@1", {
|
|
|
86
86
|
name: { en: "An obligation with a deadline" },
|
|
87
87
|
meaning: { en: "Something owed by a certain time — a debt, a promise, a delivery — comes due when the time passes." },
|
|
88
88
|
kind: "pieces",
|
|
89
|
+
countsTime: "story",
|
|
89
90
|
bindings: { owed: { to: "entry-type", label: { en: "Owed" } } },
|
|
90
91
|
adds: { events: [{ id: CAME_DUE, name: { en: "An obligation came due" }, description: { en: "The story clock passed what an obligation was owed by." } }] },
|
|
91
92
|
prose: "{{owed}} are owed by a certain time; when the time passes they have come due, and that has consequences.",
|
package/dist/functions/time.js
CHANGED
|
@@ -112,6 +112,7 @@ export const scheduledFunction = defineFunction("core:function/scheduled@1", {
|
|
|
112
112
|
name: { en: "At a set story time" },
|
|
113
113
|
meaning: { en: "When the story clock reaches a set moment — the festival at dawn on the third — it happens." },
|
|
114
114
|
kind: "time",
|
|
115
|
+
countsTime: "story",
|
|
115
116
|
adds: { events: [{ id: SCHEDULED_EVENT, name: { en: "A scheduled moment was reached" } }] },
|
|
116
117
|
prose: "Some things happen at a set time, whatever anyone is doing; when the moment comes, it comes.",
|
|
117
118
|
form: {
|
|
@@ -140,6 +141,7 @@ export const deadlineFunction = defineFunction("core:function/deadline@1", {
|
|
|
140
141
|
name: { en: "A deadline" },
|
|
141
142
|
meaning: { en: "Something must be done by a set time — the ransom gathered by the new moon — or the chance is gone." },
|
|
142
143
|
kind: "time",
|
|
144
|
+
countsTime: "story",
|
|
143
145
|
bindings: { goal: { to: "attribute", kinds: NUMBER_ATTRIBUTE_KINDS, label: { en: "Must reach" } } },
|
|
144
146
|
adds: { events: [{ id: DEADLINE_EVENT, name: { en: "A deadline passed" }, description: { en: "The story clock passed a deadline with its goal unmet." } }] },
|
|
145
147
|
prose: "{{goal}} has to reach its mark in time; once the time is past, it is too late.",
|
|
@@ -25,6 +25,8 @@ export const createAssistantSpec = () => compile(spec(ASSISTANT_CREATE_SPEC_ID,
|
|
|
25
25
|
family: chatGenre.family,
|
|
26
26
|
description: chatGenre.description,
|
|
27
27
|
shape: chatGenre.shape,
|
|
28
|
+
// The genre's pinned settings ride the row (how far Auto-advance runs).
|
|
29
|
+
settings: chatGenre.settings,
|
|
28
30
|
// The event surface rides the row (24 §5): the dashboard and
|
|
29
31
|
// the preset editor SELECT it, never re-derive it.
|
|
30
32
|
events: chatGenre.events,
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
import { compile, slot, spec, coreEvents } from '@serene-pub/sdk';
|
|
19
19
|
import * as C from '@serene-pub/contracts';
|
|
20
20
|
import { CORE_LOADOUT } from '../../loadouts.js';
|
|
21
|
-
import { applyWiring, heldForReview, modelCall, wiring, } from '../../shared/calls.js';
|
|
22
|
-
import { fileLore } from '../../shared/lore.js';
|
|
21
|
+
import { applyWiring, heldForReview, modelCall, on, scriptStep, textPart, wiring, } from '../../shared/calls.js';
|
|
22
|
+
import { ENTRIES_NAMED_BRIEF_SCRIPT, fileLore } from '../../shared/lore.js';
|
|
23
23
|
import { ASSISTANT_PROMPT_KEYS } from '../../seed/prompts.js';
|
|
24
|
-
import { worldLoreEntryType } from '../../registry/entries.js';
|
|
24
|
+
import { bareEntryTypeId, worldLoreEntryType } from '../../registry/entries.js';
|
|
25
25
|
/** @experimental */
|
|
26
26
|
export const ASSISTANT_MEMORY_SPEC_ID = 'core:spec/assistant-memory';
|
|
27
27
|
/** @internal */
|
|
@@ -46,46 +46,67 @@ export const assistantMemorySpec = () => {
|
|
|
46
46
|
})
|
|
47
47
|
.junction('memory', { on: ($) => $.input.routine }, (j) =>
|
|
48
48
|
// Every firing (the host never fires a routine that is Off); the notes junction reads the mode.
|
|
49
|
-
j.when('due', { path: (v) => v.mode, truthy: true }, (m) =>
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
49
|
+
j.when('due', { path: (v) => v.mode, truthy: true }, (m) => {
|
|
50
|
+
/** The memory write, sized: the entries the lines name are shown within its share of the window. */
|
|
51
|
+
const budgeted = m.task('contextBudget', ($) => C.contextBudget.v1({
|
|
52
|
+
sampling: slot.samplingOf('memory.due.memoryWrite'),
|
|
53
|
+
connection: slot.connectionOf('memory.due.memoryWrite'),
|
|
54
|
+
params: slot.params(),
|
|
55
|
+
}));
|
|
56
|
+
const read = budgeted.query('named', ($) => C.entriesNamed.v1({
|
|
57
|
+
scope: $.input.sessionScope,
|
|
58
|
+
messages: $.history.messages,
|
|
59
|
+
budget: $.contextBudget.available,
|
|
60
|
+
params: slot.params(),
|
|
61
|
+
}), { expose: { label: 'What is already kept', status: 'Taking notes' } });
|
|
62
|
+
w.params.push([on(read, 'named'), { entryTypes: [bareEntryTypeId(worldLoreEntryType)] }]);
|
|
63
|
+
/** The brief is a literal handed to the script; its answer is read back as text. */
|
|
64
|
+
const shown = textPart(scriptStep(read, w, 'briefShown', ENTRIES_NAMED_BRIEF_SCRIPT.seedKey, ($) => ({
|
|
65
|
+
brief: MEMORY_BRIEF,
|
|
66
|
+
entries: $.named.main,
|
|
67
|
+
}), 'What to look for, and what is kept', 'Taking notes'), w, 'briefText', ($) => $.briefShown.main, 'brief', 'What to look for, and what is kept');
|
|
68
|
+
/**
|
|
69
|
+
* *Remember things* — `memory.due.*`: one JSON call over the conversation,
|
|
70
|
+
* then each note filed (`create-lore-entry@1`, world lore) — on Full as it
|
|
71
|
+
* is, on Review held at the review gate. The host routes the write: the
|
|
72
|
+
* attached lorebook when the session may write it, else the session's own
|
|
73
|
+
* notes, made on first use.
|
|
74
|
+
*/
|
|
75
|
+
return modelCall(shown, w, 'memory', {
|
|
76
|
+
prompt: ASSISTANT_PROMPT_KEYS.memory,
|
|
77
|
+
brief: ($) => $.briefText.text,
|
|
78
|
+
cast: ($) => $.cast.cast,
|
|
79
|
+
history: ($) => $.history.messages,
|
|
80
|
+
schema: ASSISTANT_MEMORY_SCHEMA,
|
|
81
|
+
briefTurn: true,
|
|
82
|
+
expose: {
|
|
83
|
+
status: 'Taking notes',
|
|
84
|
+
label: 'Remember things',
|
|
85
|
+
purpose: 'Every few turns, notes what you told the Assistant, so it remembers next time.',
|
|
86
|
+
},
|
|
87
|
+
}).junction('notes', { on: ($) => $.input.routine }, (n) => {
|
|
88
|
+
const arm = (b, mode) => {
|
|
89
|
+
return fileLore(b, w, {
|
|
90
|
+
from: ($) => $.memory.due.memoryWrite.json,
|
|
91
|
+
member: 'notes',
|
|
92
|
+
listLabel: 'The notes',
|
|
93
|
+
each: 'note',
|
|
94
|
+
noun: 'note',
|
|
95
|
+
nameLabel: "The note's title",
|
|
96
|
+
max: 4,
|
|
97
|
+
entryType: worldLoreEntryType,
|
|
98
|
+
writeLabel: mode === 'full' ? 'File the note' : 'Hold the note for review',
|
|
99
|
+
review: mode === 'review' ? review : undefined,
|
|
100
|
+
matchByName: true,
|
|
101
|
+
shown: ($) => $.memory.due.named.ids,
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
return (n
|
|
105
|
+
// The routine's mode (R37): Full files each note, Review holds it.
|
|
106
|
+
.when('full', { path: (v) => v.mode, equals: 'full' }, (b) => arm(b, 'full'))
|
|
107
|
+
.when('review', { path: (v) => v.mode, equals: 'review' }, (b) => arm(b, 'review')));
|
|
108
|
+
});
|
|
109
|
+
}))
|
|
89
110
|
/** On Extraction (I12); its prompt row; every Review note behind the review gate. */
|
|
90
111
|
.defaults((p) => heldForReview(applyWiring(p.loadout('memory.due.memoryWrite', slot.loadout(CORE_LOADOUT.extraction)), w), review))
|
|
91
112
|
.build());
|
|
@@ -35,20 +35,21 @@ export declare const ASSISTANT_RESPOND_VERSION = "1.0.0";
|
|
|
35
35
|
/** The most tool passes one turn may take (★D, ruled 2026-10-19). @experimental */
|
|
36
36
|
export declare const ASSISTANT_TOOL_PASSES = 4;
|
|
37
37
|
/**
|
|
38
|
-
* 🚧 Basic's assembly template: the Assistant's instructions, the
|
|
39
|
-
* excerpts when any were retrieved, then the
|
|
38
|
+
* 🚧 Basic's assembly template: the Assistant's instructions, the scenario
|
|
39
|
+
* when there is one, the lorebook excerpts when any were retrieved, then the
|
|
40
|
+
* conversation — the Guide's
|
|
40
41
|
* layout without the docs. Triple-stashed: prose going to a model.
|
|
41
42
|
* @experimental
|
|
42
43
|
*/
|
|
43
|
-
export declare const ASSISTANT_RESPOND_TEMPLATE = "{{#systemBlock}}\n{{#if instructions}}\n{{{instructions}}}\n{{/if}}\n{{#if worldLore}}\n\nFrom the lorebook attached to this session: the person's own reference notes, retrieved for their latest message. Each key is the entry's name. When you answer from one, say which entry you used.\n{{{worldLore}}}\n{{/if}}\n{{/systemBlock}}\n\n{{#each sessionMessages as |sessionMessage msgIndex|}}\n{{#each (lookup ../injectionsByIndex msgIndex)}}\n{{#if (eq this.role \"assistant\")}}\n{{#assistantBlock}}\n{{{this.content}}}\n{{/assistantBlock}}\n{{else if (eq this.role \"user\")}}\n{{#userBlock}}\n{{{this.content}}}\n{{/userBlock}}\n{{else}}\n{{#systemBlock}}\n{{{this.content}}}\n{{/systemBlock}}\n{{/if}}\n{{/each}}\n{{#with ../postHistory}}\n{{#if (and (eq msgIndex targetIndex) hasContent)}}\n{{#systemBlock}}\n{{#if instructions}}\n{{{instructions}}}\n{{/if}}\n{{/systemBlock}}\n{{/if}}\n{{/with}}\n{{#if (eq role \"assistant\")}}\n{{#assistantBlock}}\n{{{message}}}{{{attachments}}}\n{{/assistantBlock}}\n{{/if}}\n{{#if (eq role \"user\")}}\n{{#userBlock}}\n{{{message}}}{{{attachments}}}\n{{/userBlock}}\n{{/if}}\n{{/each}}";
|
|
44
|
+
export declare const ASSISTANT_RESPOND_TEMPLATE = "{{#systemBlock}}\n{{#if instructions}}\n{{{instructions}}}\n{{/if}}\n{{#if scenario}}\n\n{{{scenario}}}\n{{/if}}\n{{#if worldLore}}\n\nFrom the lorebook attached to this session: the person's own reference notes, retrieved for their latest message. Each key is the entry's name. When you answer from one, say which entry you used.\n{{{worldLore}}}\n{{/if}}\n{{/systemBlock}}\n\n{{#each sessionMessages as |sessionMessage msgIndex|}}\n{{#each (lookup ../injectionsByIndex msgIndex)}}\n{{#if (eq this.role \"assistant\")}}\n{{#assistantBlock}}\n{{{this.content}}}\n{{/assistantBlock}}\n{{else if (eq this.role \"user\")}}\n{{#userBlock}}\n{{{this.content}}}\n{{/userBlock}}\n{{else}}\n{{#systemBlock}}\n{{{this.content}}}\n{{/systemBlock}}\n{{/if}}\n{{/each}}\n{{#with ../postHistory}}\n{{#if (and (eq msgIndex targetIndex) hasContent)}}\n{{#systemBlock}}\n{{#if instructions}}\n{{{instructions}}}\n{{/if}}\n{{/systemBlock}}\n{{/if}}\n{{/with}}\n{{#if (eq role \"assistant\")}}\n{{#assistantBlock}}\n{{{message}}}{{{attachments}}}\n{{/assistantBlock}}\n{{/if}}\n{{#if (eq role \"user\")}}\n{{#userBlock}}\n{{{message}}}{{{attachments}}}\n{{/userBlock}}\n{{/if}}\n{{/each}}";
|
|
44
45
|
/**
|
|
45
46
|
* 🚧 Agentic's assembly template: the loop's own opening text (`system`, the
|
|
46
|
-
* `assistant-agentic` row), the
|
|
47
|
-
* tools' results so far, the conversation, and the closing reminder
|
|
47
|
+
* `assistant-agentic` row), the scenario when there is one, the tools
|
|
48
|
+
* advertised, the lorebook excerpts, the tools' results so far, the conversation, and the closing reminder
|
|
48
49
|
* (`postHistory`). Triple-stashed, as every shipped context template.
|
|
49
50
|
* @experimental
|
|
50
51
|
*/
|
|
51
|
-
export declare const ASSISTANT_AGENTIC_TEMPLATE = "{{#systemBlock}}\n{{{system}}}\n\n{{{advertisement}}}\n{{#if worldLore}}\n\nFrom the lorebook attached to this session: the person's own reference notes, retrieved for their latest message. Each key is the entry's name.\n{{{worldLore}}}\n{{/if}}\n{{#if results}}\n\nWhat your tools have returned so far:\n{{{results}}}\n{{/if}}\n{{/systemBlock}}\n\n{{#each sessionMessages}}\n{{#if (eq role \"assistant\")}}\n{{#assistantBlock}}\n{{{message}}}{{{attachments}}}\n{{/assistantBlock}}\n{{/if}}\n{{#if (eq role \"user\")}}\n{{#userBlock}}\n{{{message}}}{{{attachments}}}\n{{/userBlock}}\n{{/if}}\n{{/each}}\n\n{{#if postHistory}}\n{{#systemBlock}}\n{{{postHistory}}}\n{{/systemBlock}}\n{{/if}}";
|
|
52
|
+
export declare const ASSISTANT_AGENTIC_TEMPLATE = "{{#systemBlock}}\n{{{system}}}\n{{#if scenario}}\n\n{{{scenario}}}\n{{/if}}\n\n{{{advertisement}}}\n{{#if worldLore}}\n\nFrom the lorebook attached to this session: the person's own reference notes, retrieved for their latest message. Each key is the entry's name.\n{{{worldLore}}}\n{{/if}}\n{{#if results}}\n\nWhat your tools have returned so far:\n{{{results}}}\n{{/if}}\n{{/systemBlock}}\n\n{{#each sessionMessages}}\n{{#if (eq role \"assistant\")}}\n{{#assistantBlock}}\n{{{message}}}{{{attachments}}}\n{{/assistantBlock}}\n{{/if}}\n{{#if (eq role \"user\")}}\n{{#userBlock}}\n{{{message}}}{{{attachments}}}\n{{/userBlock}}\n{{/if}}\n{{/each}}\n\n{{#if postHistory}}\n{{#systemBlock}}\n{{{postHistory}}}\n{{/systemBlock}}\n{{/if}}";
|
|
52
53
|
/** @experimental */
|
|
53
54
|
export declare const assistantRespondSpec: () => import("@serene-pub/sdk").CompiledSpec<string>;
|
|
54
55
|
//# sourceMappingURL=respond.d.ts.map
|
|
@@ -44,8 +44,9 @@ export const ASSISTANT_RESPOND_VERSION = '1.0.0';
|
|
|
44
44
|
/** The most tool passes one turn may take (★D, ruled 2026-10-19). @experimental */
|
|
45
45
|
export const ASSISTANT_TOOL_PASSES = 4;
|
|
46
46
|
/**
|
|
47
|
-
* 🚧 Basic's assembly template: the Assistant's instructions, the
|
|
48
|
-
* excerpts when any were retrieved, then the
|
|
47
|
+
* 🚧 Basic's assembly template: the Assistant's instructions, the scenario
|
|
48
|
+
* when there is one, the lorebook excerpts when any were retrieved, then the
|
|
49
|
+
* conversation — the Guide's
|
|
49
50
|
* layout without the docs. Triple-stashed: prose going to a model.
|
|
50
51
|
* @experimental
|
|
51
52
|
*/
|
|
@@ -53,6 +54,10 @@ export const ASSISTANT_RESPOND_TEMPLATE = `{{#systemBlock}}
|
|
|
53
54
|
{{#if instructions}}
|
|
54
55
|
{{{instructions}}}
|
|
55
56
|
{{/if}}
|
|
57
|
+
{{#if scenario}}
|
|
58
|
+
|
|
59
|
+
{{{scenario}}}
|
|
60
|
+
{{/if}}
|
|
56
61
|
{{#if worldLore}}
|
|
57
62
|
|
|
58
63
|
From the lorebook attached to this session: the person's own reference notes, retrieved for their latest message. Each key is the entry's name. When you answer from one, say which entry you used.
|
|
@@ -98,13 +103,17 @@ From the lorebook attached to this session: the person's own reference notes, re
|
|
|
98
103
|
{{/each}}`;
|
|
99
104
|
/**
|
|
100
105
|
* 🚧 Agentic's assembly template: the loop's own opening text (`system`, the
|
|
101
|
-
* `assistant-agentic` row), the
|
|
102
|
-
* tools' results so far, the conversation, and the closing reminder
|
|
106
|
+
* `assistant-agentic` row), the scenario when there is one, the tools
|
|
107
|
+
* advertised, the lorebook excerpts, the tools' results so far, the conversation, and the closing reminder
|
|
103
108
|
* (`postHistory`). Triple-stashed, as every shipped context template.
|
|
104
109
|
* @experimental
|
|
105
110
|
*/
|
|
106
111
|
export const ASSISTANT_AGENTIC_TEMPLATE = `{{#systemBlock}}
|
|
107
112
|
{{{system}}}
|
|
113
|
+
{{#if scenario}}
|
|
114
|
+
|
|
115
|
+
{{{scenario}}}
|
|
116
|
+
{{/if}}
|
|
108
117
|
|
|
109
118
|
{{{advertisement}}}
|
|
110
119
|
{{#if worldLore}}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 🚧 Chat's turn order — `core:spec/assistant-turn-order` (2026-10-19):
|
|
3
|
-
*
|
|
2
|
+
* 🚧 Chat's turn order — `core:spec/assistant-turn-order` (2026-10-19): one
|
|
3
|
+
* round robin option on Turn order asked, over a pool of the genre's one
|
|
4
4
|
* in-turn envoy, the Assistant, and no characters — the Guide's shape. One
|
|
5
5
|
* speaker: the order is written once and kept (canon A9), never re-decided.
|
|
6
6
|
*/
|